Placeholder Image

Subtitles section Play video

  • check.

  • 123 Sorry about that.

  • I didn't realize I had the volume down very low.

  • This is my sound check of my voice.

  • How are the levels?

  • Can you hear me?

  • And is the balance between me and the get started in just about two or three minutes?

  • Well, hello.

  • Happy is a Thursday.

  • I am really having trouble keeping track of what day it is.

  • Welcome too.

  • Coating train with me.

  • Your host, Dan, We'll just take a deep breath, take a big, deep breath together.

  • Ready?

  • I don't know where you're watching from this.

  • From where in the world you're watching this.

  • I don't know what your circumstances are.

  • What you did, What time of day it is what you did this morning this afternoon, at night.

  • How you slept any of those things.

  • But I all in all, I would just like to know How are you doing?

  • Are you doing okay?

  • I am based in New York City, specifically in Brooklyn, New York.

  • It has been quite a week of chaos here, if not a month or a year or the last.

  • However many.

  • Here's whoever you want to get started.

  • Do you hear that noise, By the way, I want to talk about that noise in the second.

  • Um, but things are quite influx in the city here, specifically where I work where my day job is at New York University.

  • Do you hear that sound?

  • I would like to know.

  • Maybe you can't hear it.

  • Um, I'm gonna wait for that sound to finish.

  • By the way, that is literally the soundest body washing their hands.

  • And I'm not kidding.

  • You know, there's a lot of I know, irony or humor there.

  • You gotta have a sense of humor.

  • Sometimes, though, it's important to take things seriously and follow science some dancing around the topic that is on my mind, which is what's going on with Corona virus and specifically New York City and New York University.

  • So, um, nobody's saying they could hear that sound.

  • Oh, yeah, I hear it says d t six.

  • Let me address that a second.

  • So New York University has, um, go, um, canceled all in person classes and events and meetings.

  • There's a lot of other changes going on in the city of New York itself.

  • This has caused a lot of us who work at N Y U to have to change our daily routines to revamp our curriculum, to think about different things.

  • I am a person, as you might have noticed, who happens to do a lot of online education.

  • Evil adjacent stuff on the Internet.

  • So in many ways I am set up well.

  • Thio engage in an experiment with remote education.

  • But I would say that I think it is something very different to be caring for and teach caring for a class a cohort of whether it's six students or eight or 12 or 16 or 20 or 50 or 100 even which is quite different than this was like a live streaming thing on YouTube.

  • There are relationships and the things I do on this channel.

  • I hope our resource is two people who are teaching courses that they can create their community, their local community of their course around.

  • But I do think it's it's ah, I want to be careful about suggesting that, Oh, it's time to do remote education.

  • That's a thing that I do already.

  • It's not.

  • I do a kind of remote education, and maybe a lot of it's filled with like way too much nonsense, but, um but yes, So I don't want to.

  • I don't want to belabor this story.

  • There is a huge amount of stuff to sound, and I am not qualified to prognosticate and predict the future.

  • I'm just kind of working with what I need to do today.

  • And I think actually, some of the changes that are happening based on looking at reducing the spread of the virus will probably ultimately open up a lot more time for me to live, streamed or make video tutorials.

  • But actually, what's happened to me this week is I'm having a lot less time because there's a lot of things that need to be changed.

  • I'm spitting up, actually a couple new classes for N.

  • Y.

  • U.

  • Um, I, um there's just a lot of meetings, and not to mention like my son school closed.

  • He's actually having classes with Zoom Software at home.

  • He's in fifth grade on DSO.

  • You know, I don't have to be there with him right now because I have that covered.

  • But that's the puzzle pieces.

  • My daughter school still open, but the puzzle pieces of family and all that kind of stuff become enormously complicated, but I was minted, managed to stick to having a live stream Today.

  • I started about 1/2 an hour earlier than I originally intended, and I have to leave absolutely 100% at 3 30 which is now about one hour and 50 minutes.

  • If I could still do math on some level loud sink, I would that noise to happen again so bizarrely I was in here the other day.

  • I actually was making a quick video tutorial for how to do video conferencing with Zoom, which I might try to do some more of that on the channel itself.

  • Um, but who's loud noise?

  • I thought, You know the shop.

  • There's a sorry hit the bell by accident.

  • There's a wood shop over there and I thought, That's where that I never hear the wood shop in all of a sudden, I'm hearing it today, drilling and hurt again and heard again.

  • Maybe there's there's construction going on this building.

  • Maybe was construction then, uh, later I was like, I need to know, go to the bathroom doing number one.

  • I need to wash my hands.

  • I didn't watch my head a lot.

  • So I went in to watch.

  • My hands are when the water comes out.

  • So right now during this live stream, if we hear the sound bar, I mean, somebody's washing their hands, and we should applaud them for blood them for washing your hands for not touching your face.

  • Um, it could be something we could co today a hand face detector, but I don't want to be due to I don't want to make light of what is an incredibly complicated and difficult on life changing for many people situation right now.

  • So that's all I have to say about that.

  • I'm gonna move on to back to my sort of, like, usual programming, which is a lot of this stuff.

  • Well, today's episode of the coating train you have one two days early Pi Day thing.

  • Okay.

  • Who?

  • It's getting warm in here.

  • Fever.

  • Okay, I'm good.

  • Touch my face.

  • All right.

  • Um, we should let us let us now also transition to reading the ceremonial book of random numbers.

  • Things are a little ominous these days, so we're gonna have to do it.

  • 49,514.

  • 56,977.

  • 61,091.

  • 92,612 Okay.

  • Uh oh, ho, boy.

  • Friday, the 13th is tomorrow.

  • Okay.

  • You know, I I already probably told my Friday the 13th story when I was a little young lad and lass.

  • Lassie, laddie, Whatever.

  • Whatever it is you say, I had a boo boo boo boo boo boo on part of the 30.

  • Don't want diary of some old live stream from a year two years ago.

  • Somebody will find it.

  • So, um, this Saturday is March 14th also known as Pi Day for 3314 being the 3.14 being the first digits of pi.

  • Um, I I have in the past on a live stream on Pi day.

  • I actually was supposed to travel this weekend.

  • I am no longer traveling this weekend.

  • That trip was canceled.

  • So But I don't know what I'll be doing yet this weekend, and I I almost I'm sure I won't be physically here in this building on Saturday.

  • So no pi day, Livestream, Lis.

  • I spend something up from home or something like that, but I thought what I would do today is a coding challenge related to pie.

  • So it would happen today during this live stream in the next hour and 45 minutes or so.

  • And then, uh, Matt, you and I would work in the next 24 hours or so to edit it down to its sort of like core essential components, which would then be released as the Pi Day coding challenge on Saturday.

  • So that is my plan s So that's what happened today.

  • Now it's something we've been asking the thumbnail.

  • It says things like O.

  • B s Basics.

  • The N O.

  • C.

  • Chapter three Yesterday and I woke up this morning.

  • I was like, I want to talk about live streaming and how I could use open broadcast studio record a lecture and I'm nature of code.

  • I'm gonna be in chapter three so I could do a little bit on nature of coach everything.

  • The time, the time, the time, the time it got compressed.

  • I do want to really think about and maybe come back next week and focus on our there a set of tutorials that I could do to help teachers specifically who might be, um who who might be doing so Remote learning might want recorded video lecture.

  • Are there things that I that I can off make some content about to help people so specifically?

  • If you're a teacher and there's, like a thing I would love to hear from you Or if you have ideas for me, let me know.

  • And maybe next week.

  • You know, a lot of a lot of what people are doing with remote learning is real time interaction and questions and feedback and smaller groups.

  • And that's not something that I really actually have a lot of experience with.

  • What I have experienced this much more like one way broadcast, although it is sometimes like a chat and different things.

  • But, um, but I would like to offer some resource is one resource I do want to mention Let me just, ah, try to find it for a second because there have been a lot of people putting together um, this total.

  • Sometimes I can't talk in search.

  • By the way I have a question.

  • My kids say search it up like, um, you, um, who won the World Series in 1967 of Hey, Dad, just search it up.

  • Is that a thing?

  • Do people say search it up?

  • Or did they invent saying searching up?

  • And now it's a thing that people are going to say because I'm telling you could say Search it up, Katie.

  • It's catchy, trust me, but maybe it's already a thing and I'm old, old Internet man who just says I will search for it But now it's a search it up.

  • I'm searching something up and I can't concentrate.

  • One surgeon it up.

  • I'm people.

  • Thing is, you can't even see what I'm doing trying to log into arena.

  • I don't have my password looking up searching it up.

  • Okay, I found what I was looking for.

  • I searched it up.

  • All right, so this is a lot of people been putting together.

  • Resource is and there's ah, slack channel that exact lever minute put together for people teaching online in the age of Cove in 19.

  • But Melanie Hoff, who is one of the organizers of code societies, that school purported competition and alum of the I T P program.

  • And if you don't, if you don't know her work that you check out her work.

  • But she put together this really excellent arena compilation of all sorts of resource is for people who are teaching online.

  • So I just wanted Thio Highlight that you can find it at arena slash Melanie dash Hoff slash teaching online.

  • So I would like to come back and and maybe if there's time left over at the end, I will answer some questions and nice questions came in on Twitter.

  • And maybe next week I could make this the subject of an entire life stream.

  • But today I will be doing my pi Day challenge searching.

  • Oh!

  • Oh, silly me.

  • Silly me.

  • The thing that I'm searching up is ah, available.

  • Uh, playlists.

  • Um, Ro Private, like videos.

  • I got a surgeon up.

  • Uh, okay.

  • Ah, The other thing I want to mention is that I am deep into whips.

  • Whips.

  • Oh, no, that shouldn't say one should say, Well, I got to fix this.

  • I can fix this.

  • I'm working on a entirely new set of nature of code video's in JavaScript with p five.

  • These are re of new versions of video series that I made almost eight years ago at this point are actually eight years ago.

  • And so if you're new to the channel.

  • Expect a lot of new videos to come out related to this.

  • You can actually see they're all there already.

  • So if the video has a thumbnail, that kind of all that means is well, ah, thumbnail was made.

  • A description is their nature.

  • The code is online, it's linked.

  • But if you want to kind of get ahead, you can see all of these videos air there.

  • And then the forces of the Chapter two has started as well.

  • So one thing that I want to say about these videos that some of them are unlisted and some of them are listed.

  • Especially the video is unlisted and there's a significant mistake or issue with it.

  • Please let me know, because if it's unlisted, it's very easy for me to delete and re upload a fixed version.

  • If it's already published video, it's harder for me to do that.

  • But if there's a real significant issue, I will do that.

  • Okay, Uh, I'm also gonna have to sing.

  • Oh, you can barely tuners.

  • Battery is gone.

  • You have to do some pie day singing.

  • Maybe today eating of some pie, who knows?

  • I'm out of sorts people out of sorts.

  • I searched it up, but I couldn't find it.

  • Chris Ray asks Are you going to remake genetic algorithm chapter?

  • Uh, not probably know you now?

  • Uh, no, I don't think so.

  • Uh, the genetic alloy chapter is actually something that I revisited more recently, so there might be some added videos, or I might swap in and out a new version of one of those videos.

  • But for the most part, that's going to be, uh, stay when I made a couple years ago.

  • But I do have some ideas for some additional ones.

  • All right, so the first thing that I want to do is I want to find myself a text file with one million digits of high.

  • Um, let's try this.

  • Um, this is good.

  • One million digits of pi just going to have to trust that this file is correct.

  • Let's put it on the desktop, and I want to find a 1,000,000,001 billion digits of pi.

  • Uh, I don't think I want to try with 22.4 trillion.

  • That would be nice.

  • Pied a 1.5 billion.

  • This looks like it might be good.

  • Ah, Here we go.

  • Pi 1,000,000,000.

  • This'll be a much larger file, right?

  • Um, I'm just gonna download it effectively.

  • Let's do it this way.

  • Okay, This file is almost a gigabyte, and I have about two minutes left to download it.

  • Okay, Uh, recording two disc time.

  • Start recording.

  • Uh, and multi quarter, Um, I am not going to record two disc the whiteboard view, which I think you are now seeing.

  • I'm not I don't have my preview up anymore because I keep moving things around.

  • I am here.

  • We are over here.

  • Um, um, Okay, uh, let's see, there's the whiteboard actually working is there Looks critic Creek into me.

  • I'm, like, Skip using the whiteboard today.

  • We'll see.

  • So this is my plan.

  • So, uh, fathom information design.

  • Um pi dot fathom dot org's maybe no, father.

  • A pied a fathom dot com probably.

  • All right.

  • Fine.

  • Fathom pie peak in pi dot Info fathom dot info slash pine.

  • This is what we're pi dot fathom dot info.

  • And in case I did forget which I did forget.

  • Let me also before I get started.

  • Coding say thank you to belief not.

  • Or GE, the sponsor of today's coding train Live stream.

  • I will.

  • So brilliant is a wonderful website and app and all sorts of where you can learn a lot of stuff.

  • And by the way, if you need to learn things remotely these days, this is a really good tool for you to use.

  • But that's the new courses that I'm excited to share with you and I always have a daily challenge.

  • I always loved you Brilliance Daily Challenge.

  • And that's something that I will be attempting about halfway through this livestream.

  • Okay, Now, um, and if it wasn't clear, if you want to take a look at brilliant, go to brilliant dot org's slash coding train and that will let them know that you found this from from here, and it also get you a 20% off.

  • You can sign up for free.

  • But if you're interested the premium of subscription, you could get 20% off through that.

  • You're all the 1st 200 people to do, so Okay.

  • Um, so I want to make my own.

  • Yeah.

  • Thank you, Simon.

  • Uh, so I know that's is one of the reasons why I don't want to use the whiteboard today.

  • There's something going on with Lady in this room.

  • Okay?

  • What I am interested in attempting to do is make my own version of this wonderful peek inside pie Web application that was created by fathom information design.

  • And so, if you don't know about fathom, it's a wonderful design firm.

  • Cuffs started by Ben Fry, who is one of the creators of processing itself on DSO here.

  • What I can do is I can look for any sequence of digits and find where they occur in pie.

  • So I'm gonna type 14 and we're gonna see There they are.

  • It's the first digit of pi.

  • And so if I keep searching, there we go.

  • But is there 14159 But instead of 214159 six and it was found as the 731,000 for thousands, 406 digit of pi.

  • So this is good for us to find because I now want to recreate this exact thing.

  • I'm going to load in a file with one million digits of pi, and then I want to create an interface where I type this in.

  • I'm gonna have to say all this again, but I'm getting myself set up because I'm gonna do that.

  • I want to create an interface where I type this in.

  • And I want to find where if that sequence exists in the number of digits of pi that I have and if so where And while I'm going to this and JavaScript while I could just use the built in index of function, I'm going to write my own search in a string algorithm because, um, once I get tau one billion digits, am I gonna run into performance issues?

  • And so, um, here it is.

  • This was one of this pie day suggestions.

  • Um, and, uh, in this suggestion, um, there's also another website.

  • I think this is actually where I downloaded the digits from It looks like, but there's also other algorithms one known as Boyer more, which I actually have never heard of until I saw it posted.

  • Um, which maybe which optimizes this kind of brute force search.

  • I don't know if I'm gonna have time to actually implement this.

  • And yeah, hash and gas is asking.

  • That's crazy.

  • Yeah, you You can't load this pie file into the browser.

  • Correct.

  • So I will be using a node server once I get to the one billion digits.

  • Okay.

  • Um, so this is the plan, and I'm gonna I would like this to be all one video.

  • So all of that explanation, unfortunately for you, the live viewer, I'm going to kind of read, start, hopefully say it more succinctly on and then just get to coding, and hopefully I'll be done by an hour and 1/2 from now.

  • We'll take a short break about half an hour, 45 minutes from now.

  • And then this will get edited and put together into a video to be published on Saturday.

  • Any questions?

  • I got a lot of questions.

  • So many questions.

  • Okay.

  • What?

  • Okay, start this over.

  • Got my P five sketch peak in pie.

  • One billion digits.

  • Um, pie search page, huh?

  • Pint.

  • A challenge.

  • All right.

  • Okay.

  • Um, I think I'm ready.

  • Vill hem is asking why is he not using processing for this?

  • Good.

  • Good point.

  • Good question.

  • I could use crossing for this.

  • I feel like using the browser so I could do this in processing.

  • I could do that as a follow up video I'll mention it.

  • That's that's actually a great question.

  • Good job.

  • Good job.

  • Good.

  • Yeah, Yeah, yeah.

  • Uh huh.

  • Okay, here we go.

  • Shake it up.

  • Shake it off.

  • Well, it all out.

  • Okay.

  • Happy Pi Day.

  • Welcome to today is this year's 20 twenties coating train pie coding challenge and I thank you too.

  • Fattening Bemis, who suggested this idea?

  • Find a sequence in the pie.

  • So this is the challenge I'm going to take on for this year's pi day.

  • I'm saying the same thing many, many times.

  • I get one chance to start over one time I get to start over.

  • I used I I used the ukulele last year.

  • This will be more just coding.

  • Coding coating.

  • Okay.

  • Okay.

  • Happy high day.

  • Hello.

  • Welcome to 2020 pi day coding challenge thing that I'm about to D'oh!

  • I really got to get going Because if I keep restarting this, we're gonna be in big trouble.

  • I have to, no matter what.

  • Leave at 3 30 There's no and I mean, when I say 3 30 I mean I mean so I should really be saying three.

  • I really gotta leave my three.

  • Okay?

  • Happy Pi Day it's 2020.

  • This year's Pi Day it's today and I would like to do is not really today because I'm recording this couple days early.

  • But I would like you to see this on Pi Day coding challenge themed around the number pi and thank you to fatten B bus who suggested this one.

  • Pi day.

  • Find a sequence in pie issue number 1464 I wonder if those numbers are where they are in Pai, who will find out by the end of this video how to look at how one might search for any given sequence of numbers in pie.

  • This could lead to a lot of other things like what if those numbers were encoded as music?

  • Or what if music was encoded his numbers?

  • Or if you took a text a message and encoded his numbers?

  • Could you find secret messages and pie melodic phrases and pie?

  • There's so many creative possibilities that you could create from my code.

  • I'm gonna do something really, really basic.

  • Now, in this suggestion, this particular website I'm angio dot net slash pie is mentioned.

  • It has a bunch of different resource is resource of where you can download all the digits of pi a place to search for pie.

  • But I thought this this at it point edit point.

  • This is going to be edited out.

  • It'll be funny if we actually keep that in.

  • Si ah meta meta Pete, Give up.

  • This all reminded me of a wonderful project from Fathom Information Designs.

  • If you don't know about Fathom, their information design firm, based in Cambridge, Massachusetts, founded by Ben Ben Fry, who was one of the creators of processing itself, could find out more at fathom dot info.

  • But they created this project Peek inside pie, which you could play with at pi dot fathom dot info.

  • There's also a nap version.

  • A lot of the virgins all linked all those things in the views description.

  • So the idea here is that Lincoln type I could tap tap.

  • Where is it?

  • Oh, it's not working.

  • My touch screen doesn't work.

  • Let's see if I can fake it.

  • Look, no, that's too with the wrong number.

  • Well, the point is, for any given sequence, like 14159 Look, I can search for it right here.

  • And there it is.

  • It's found at the first digit of pi.

  • So now let's pick another sequence like, What's a wonderful sequence?

  • It is.

  • Today's date is March 14 2020 and that is not in the 1st 1 million digits of pi.

  • Ah, if only we had more, did it.

  • I must have more digits.

  • So this particular Web app is searching through the 1st 1 million digits of pi.

  • And that's what I want to create.

  • First, let's just try this.

  • So the number 030314202 is available is found.

  • Simon Simon Simon's interrupting my flow.

  • You're interrupting my flow With all the at mentions, You only only really earned it.

  • Not mentions, please.

  • Um but he doesn't.

  • Simon does have a great suggestion.

  • Um did it.

  • He did it to drew.

  • D'oh!

  • D'oh!

  • I'm told that I should search for the number 999 999 which is the 762nd digit of pi.

  • So let's remember that and make sure when I write my own version of this that I find the same digit.

  • So I'm gonna do this at first.

  • I'm gonna do this with P five GS job script the browser, and it's not gonna be as nicely designed with a beautiful interface like this.

  • But I'm first going to recreate this exact thing.

  • And then and then what I'm gonna do is I'm gonna go from one million digits to one billion digits and see if I could still search range in and probably I'm gonna fail because we're gonna need some kind of like optimization.

  • It's gonna run too slow if he's gonna come crashing down.

  • But I'm gonna try nonetheless and we'll see where we get to by the end of this video, and I I should mention, just don't end up covering it.

  • There are optimal ways to search for a string just to search for a string inside of a larger string And one of those albums called The Boy Arm or Algorithm.

  • And so depending on where I get it, I get to the end of this video.

  • I don't know what I'm talking about this now.

  • It's not the end.

  • I'll know where I've gotten to uh um, betting on where I get to.

  • That might be something that you could also do as your own as a contribution.

  • When I That could also be something that you do as her own contribution on the coding train dot com itself by making a optimized version of this.

  • All right.

  • Okay, here we go.

  • You just put this in applications.

  • I'm starting with a simple P five sketch and to text files, one with one billion digits of pi, which is just a megabyte and one with one billion digits of pi, which is get it by that much bigger file.

  • So let's start with the one megabyte file.

  • I uploaded it.

  • I've uploaded the file to the P five Web editor and I can load all the text from that file right now, using pre load.

  • I'm going to just take away animation here.

  • I'm gonna get rid of the draw loop, and I'm gonna say no canvas.

  • And then the file itself has all of the digits of pi in one line.

  • But load strings loads text files into an array with each element of the Arabian a different line of the text file.

  • So what I'm going to do here is create a variable called digits and just say it is the first element in that raw data array Let's console log digits and just see what happens.

  • Okay, so all of the digits of Pi are down here in the console.

  • Now, what I want to do is search for a given digit.

  • Let's make it interface.

  • A very, very crude, simple interface for searching.

  • Now I have this tiny, tiny search box up here.

  • Can you make that bigger?

  • This is one of things I hate.

  • Give me a second.

  • Here is one thing I don't love about using the web editor, because can I zoom an eye frame?

  • Can I just make that bigger?

  • Can I do it with CSS?

  • I don't want to go crazy here.

  • If I do something like, just say what is it, like text size or something?

  • I don't know.

  • CSS.

  • Somebody tell me how to put some global CSS on size.

  • Okay.

  • No, that's going to work.

  • I didn't make the text file.

  • Do I need to do it for, like, input?

  • Hey, there we go.

  • Perfect.

  • Okay.

  • That's probably bigger than I need.

  • Here we go.

  • That's plenty visible now.

  • Okay.

  • I also just added a I also just increased the fun size for any input element on the page.

  • That's a little easier for you to see.

  • But that's you know, the interaction that I'm looking for is any time anyone types anything into that search box, I wanna look for that string that those digits in pie itself search and P five gs has a special event function called input, which you can call on the search box and pass another function that will be executed any time a change has been made.

  • So let me write that.

  • Search it up function, because that's when I'm looking for something.

  • I say search it up.

  • Um And then, uh, I'm gonna be a little silly and make these global variables, and I'm going to Then then let me get what I'm searching for from the search box and console log that.

  • So now whenever I type anything into that search box, I should see what I type here in the council, and that's working.

  • This is gonna actually be a really easy project to do.

  • You know why?

  • Because I could just use the index of function in job script.

  • Tell Let me do that real quick.

  • Just please, please go.

  • Just got real quick up into that real quick digits.

  • Index of search.

  • So this is saying look inside this search string and give me back the index of where No, no, no, no.

  • This is saying, look inside the long string digits and give me the index of wherever this string search happens to appear.

  • If it doesn't appear, I'll take a negative one, please.

  • So I'm going to say create.

  • Let's make another element on the page.

  • Um and no.

  • How do I make that?

  • People?

  • I don't know.

  • CSS at all.

  • Help me out here.

  • At least it's sticking it red when it's wrong.

  • Font color.

  • No color me color, right?

  • I mean, I could make a background color that I know will work.

  • No.

  • Oh, this is wrong.

  • Oh, I need another f.

  • It had the wrong number of digits.

  • I'm the worst.

  • The worst.

  • There.

  • You forget?

  • Yeah, Just just don't.

  • So now, when I get that index back, I can say index p dot html That index, which will put the actual index words found in the paragraph, text there on the web page.

  • So, for example, if I say 14 159 why don't think too So really when counting the digits of pi.

  • What seems to be the convention is the first digit is the first digit after the period.

  • So it's three point.

  • The first digit is one.

  • So I should really say index minus one.

  • And now 14159 I got one.

  • And then what if I say 999999 too?

  • All right, so we got it.

  • 99999 appears at the 762nd digit in pie.

  • Also going to write a little s statement here.

  • Say, if index is greater than, uh well, I guess if I'm looking for three, but that's a bug.

  • So I'm looking for three.

  • That zero.

  • Which minus one.

  • How do I do?

  • I want to handle that bug index off.

  • Must let me start searching from a certain character.

  • Right?

  • Uh, start from index too.

  • Great.

  • So it is a three.

  • I don't want it to find that zero digit, So I'm going to start searching from index to and their looks great.

  • So I guess I hope that's right.

  • But a three a dozen appear until the chat is also rightfully pointing out that I could just chop off the 1st 2 digits of the string would be much too easy.

  • I'm gonna do it this way.

  • Uh, so I'm gonna start from looking at digit, too.

  • And I'm going to say, as long as index is greater than zero set that otherwise say, um, I'm going to say otherwise, I'll put a message about it not being found.

  • Okay, so let's try 14159999999 not found.

  • So I now have essentially without the care and thought into the interaction design, the visual design, the layout of the page.

  • All of those elements recreated my my own version of this peek inside.

  • I got this.

  • Video is not over them.

  • I got two more things I want to dio.

  • Number one is I want to just investigate.

  • What does it mean for me to actually perform this search myself to write my own index of function?

  • Because maybe if I do, that might unlock some other creative possibility isn't also I might learn something about programming.

  • And then once I do that, let me increase things up to one billion digits and see if it still works, which it won't.

  • Um and, um um, I'm reading the chat.

  • I shouldn't be reading the chat.

  • Let me increase things to one believed in its and see what happens.

  • What breaks down once I have a one gigabyte file that I'm loading all the digits of pi n as opposed to a one megabyte file, right?

  • So let's first write our own index of function.

  • So I'm just gonna change them to comment this out, and I'm going to say, let index equals index of a search in this string for this search string.

  • Okay, so search in the string digits for the string search.

  • And so the function looks like this.

  • Its name is the next up.

  • It needs to receive a block of text and the sub string that you're searching for in that text.

  • Okay, I'm thinking about this.

  • Let's say we do this.

  • Let's start with what's the first character in the search string.

  • Then I want to reiterate over the entire string of text and say, Hey, does this character in the entire string of text match the first character of the search string?

  • If so, I need another loop with J starting at I plus one.

  • Well, actually, let's do it this way.

  • Let's betting toe loop through all of the characters off that search string.

  • I don't have an error here.

  • Bad assignment.

  • Oh, this must stay for.

  • So I don't need to start at zero because I've already checked to make sure that zero and I want to check is text car at I plus J, the same as search car at J.

  • Again, I'm I'm not worrying about running this optimally or elegantly.

  • I just want to get the core idea out.

  • I'm starting with, and I really should use the white board for this.

  • Do I dare?

  • A white board is all, like, weird and shadowing this light.

  • There's a like a nice bright light that's always been in this room That is very dim today.

  • That's your C is it, too?

  • Oh, you can't even see that.

  • That's so sad.

  • 3.14159 Let's say I'm looking for the string for 15 Yeah, so in the example and building, this is the text.

  • We just start over.

  • Okay.

  • That person is like water running water a little bit longer, kind of short what comes after the nine people, is it too?

  • Help it too.

  • So let's say this is my text.

  • And what I'm looking for is I want to find out where is 415 in that particular string.

  • This is my search.

  • Sorry.

  • My watch is buzzing at me, and I am going to turn that off being at again.

  • Okay.

  • Okay.

  • Uh, I'm a jolly happy person.

  • I'm not actually bothered by just like to play at.

  • Okay.

  • Um, so this is my text, and this is my search string.

  • What I have going on here is I know the first character of what I'm searching for is four.

  • So I the index I is starting here and looking.

  • Is that for us that for Is that for?

  • Is that for?

  • Ah, this is for now.

  • Let's let's save our let's save this spot.

  • And then based on this length three, which lets iterated over this length with J 012 and let's add J ty 012 and see if all those digits continue to match.

  • Um uh, okay.

  • So, ultimately, really, what I'm looking for here is anything's any of those digits that aren't the same.

  • So I really want to look for first.

  • I'm gonna be very strict about this and use the triple equals.

  • There's a funny thing, a job script.

  • If you haven't encountered this before, where if I use double equals, this will return true.

  • But if I use triple equals, they won't.

  • So it's a little like double equals a little bit of a fuzzier truth and triple equals like No, no, no, no.

  • Those things are really, really, really, really equal.

  • Fuzzier equals, I guess.

  • Um I don't know if that's necessary to explain.

  • You could probably get that out, and then I'm gonna say not equals.

  • So basically, I'm going to make a I want to make a guess that I found it right.

  • As soon as I find that as soon as I find the first character, as soon as I find the first character be the same, huh?

  • I found it.

  • And then any time I find any need to be different, I can now say found equals false.

  • So the question becomes right here.

  • If found is true, then I can break out of things.

  • And once one is not true, I don't need to check the rest so I can break out And then, if found return.

  • What?

  • So I'm gonna say, Let found index equals negative one.

  • I'll give a default value of negative one.

  • And then, actually, if I've found it right here, um found index should equal what I wherever we started with I and then a little bit lost in terms of all the loops going on here.

  • And then if I've gone through every possibility and I haven't found it, then I'm gonna get to the end that I'm still just going to return negative one, but found Index will have negative one.

  • So if I found it somewhere, I'm gonna set it equal to that first index.

  • Get out of the loop.

  • I don't need to check anymore, cause I'm just looking for the first instance and then return what I found.

  • I must have made a mistake here somewhere, right?

  • There's no way this could be correct.

  • And, um, I'm gonna add 1/3 argument for offset.

  • Um, and I can say, and just a really quick hack.

  • I'm just going to start at index equals two to skip the three.

  • I mean, whatever.

  • Let this is fine.

  • Let me just started.

  • Ah, right.

  • Let's run and see if this works.

  • No found is not define sketch line 22.

  • This if statement has got to be inside here.

  • This is where I'm looking at every single character in the large string on searching through as soon as one of those characters is equal to the start.

  • Check every check all the subsequent characters.

  • And then, if I found it, break out of that larger Luke and, uh, keep going so that this should be right now, I'm sure there's other mistakes, but that will be fixed.

  • All right.

  • 14159 at digit number one, which is right.

  • Weirdly enough, I didn't subtract out the one anywhere.

  • Right?

  • So the chat is giving me a nice quick optimization.

  • The chat is Give me a nice suggestion.

  • I could simplify this code where I don't actually need this found index because I could just return I which will automatically break out of the loop.

  • And then if I get to the end, I could just return negative one.

  • So let's try that again.

  • Yeah.

  • Why's that?

  • One should be 01 Shouldn't that be getting too.

  • Oh, I'm already subtracting the one there.

  • Right?

  • Great.

  • So this works.

  • Let's try the 999 thing.

  • There we go.

  • So this is done.

  • And this algorithm has no problem with one million searching in a string of one million characters.

  • Be interesting to think of.

  • What is the try?

  • A different number.

  • Um um 2 30 Excellent.

  • Gonna be taking a break soon.

  • I'm trying to think, Uh oh, Thank you, Simon, About the noting the thing about brilliant.

  • I will check that big o notation.

  • One thing I'd like to think about here is what is the big O notation for this particular album?

  • So when I talk about big O notation, why is it Oh, again order?

  • That's what I thought.

  • OK?

  • One of the things that would love to consider here is what is the big O notation for this particular algorithm?

  • Big toe for the order of the algorithm.

  • How long?

  • How many computational cycles are required to search for a string of end characters in a larger string also of of end characters?

  • Oh, boy.

  • Yeah, it's a way.

  • Is there any moderators here can help me with this?

  • Um report.

  • Okay.

  • Um Oh, yeah, I'm years old.

  • Okay?

  • I'm trying to moderate this.

  • No, if anybody, uh, wants to help me with that, that would be great.

  • Oh, my God.

  • So many of them are there no moderators.

  • Ally.

  • Uh, watching.

  • Okay, so for J is here.

  • Thank you.

  • Thank you.

  • Two for J train whistle for you.

  • Right.

  • So let's think about this, right?

  • I'm gonna start this thought over.

  • So before I move on, I want to think about the big O notation.

  • What I mean is, what is the order?

  • What is the computational complexity of this particular search algorithm?

  • So I have a string I'm searching through, and it has its length is n characters.

  • And then I'm searching for another string whose length is M characters.

  • And when work.

  • When considering big o notation.

  • The ideas that think aboutthe worst case scenario, How long does that take?

  • If I'm not gonna find it, basically, if I find it at the very, very end of that string, so I know I need end checks.

  • 01234567 All the way up to end.

  • So it is at least big o order end.

  • But for every one of these, I've also got a check.

  • I mean, if I find one of them, I've got to check all of these.

  • So really, I think it should be how?

  • Give this 10 digits here and there's three digits here.

  • That's 30.

  • Checks.

  • 123123123123123123123123 Now, of course, it's less than that because I only had to check these three when I see the four matches.

  • But imagine if this whole string wherefores and then this were also afore.

  • I always have to keep checking, so it's really just end times end, end times end.

  • And let's remember that for when we start looking at one billion digits Oh, so is that like, reduced to just saying n um, yeah, I know.

  • I know.

  • There's some box in the chat.

  • I apologize about that.

  • I have, like, really not usually have this problem, so I've never had Thio sort of deal with it.

  • But there's some folks on the case here, so, um, hopefully we could D'oh!

  • Well, it's crazy is the bots or just like it's confusing because what they're doing is they're taking other chat messages that other people have posted and then re posting them with some extra emojis.

  • It's kind of amazing.

  • Uh, I don't know howto permanently ban an i p.

  • Um, so we'll see what we do.

  • Okay?

  • Yeah.

  • And let me say that.

  • And even though ultimately the order is the big O notation is end times m because the idea here and is going to be so much larger than what I'm looking for an M.

  • This could be sort of reduced down to a operation of order end which isn't so bad, to be perfectly honest.

  • So tie little ball around this.

  • We say that this is a big O notation, and for the length of the search string the string I'm searching in.

  • All right, so I'm gonna take a short break.

  • Maybe this will also help us get rid of the bots Very emotionally spots.

  • And I, um um and I am going thio.

  • Take a minute.

  • Thio, tell you about the sponsor of today's a coating train.

  • Live stream, which is, uh, bronc button.

  • Wrong button.

  • Brilliant.

  • Brilliant.

  • Is has been a long time sponsor of the coating train.

  • I'm very thankful for having the sponsor.

  • It's a website on app that I really enjoy.

  • If you're interested in interactive learning, you're trying to do some learning from home.

  • These days.

  • I thought this could be a useful Web site to you.

  • They have a lot of online courses, and one of things that I really love is how the courses are interactive.

  • So I want to tell you about some new stuff.

  • Looks that is that a highlight for you that are different than maybe would have highlighted before?

  • And so there's a new calculus.

  • In a nutshell.

  • Course on calculus is a language used by Ecologist urban planners, physicists.

  • You need kind of calculus to do stuff on the coating train to describe the world, but it's often a lot of formulas and a lot of memorization.

  • So Brilliant takes a bird's eye view using visual and physical intuition, by the way, the next one and tell you about the neural network, one which is what's playing right now to present major pillars of calculus limits drew in trickles and infinite sums.

  • So in that calculus calculus course There's a lot of background material through interactive lessons.

  • I can really support the stuff that I'm doing on my channel.

  • Really excited about this new neural network course, little behind and talking about in terms of when the videos are auto playing.

  • But what you're seeing here is a couple simple games that you could play interactively in the browser to learn the basics of how a neural network functions so of wiring up neurons in the process of feedback, you could build a net where you could get to build your own network that classifies handwritten digits.

  • And then there's another game, which you just saw called Where are My Keys?

  • I'm gonna come.

  • It doesn't take too long to place him to come back and explain you that one.

  • When it comes back on, I work on my timing next.

  • It's really been a rough week, people.

  • But this is what I'm talking about in terms of the calculus course, people to play with formulas and visualizations and graphs and interactive way.

  • It's a really fun thing to do, and you know the foremost can be scary, but this really help you.

  • So this is the neural network course.

  • So let me tell you about this keys one which will show up in a minute.

  • So the idea is that you want to find your keys in a m

check.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it