This video teaches Go programming concepts including error handling (where functions return errors as values rather than using try-catch blocks), interfaces (which should have minimal methods to reduce complexity), arrays versus slices (arrays are fixed-size while slices are dynamic and backed by arrays), and practical problem-solving through exercises like FizzBuzz, prime number detection, and matrix creation. The instructor demonstrates debugging techniques and emphasizes that Go's explicit error handling makes code more maintainable despite creating more verbose code.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Code + Coffee + Chat: Learn Go with boot.dev
Added:my microphone.
Sorry about that.
Good morning, Thunder Dear. How are you?
Your first one in this morning, huh?
Appreciate you stopping by the stream.
We're me doing a little bit of boot.devon.
Boot dot. Remember that thing? Remember Devon? Remember Devon AI? Wonder what happened to that company.
Devon AI.
Wonder if they're still a thing. I guess they're still a thing.
Huh. I haven't heard anything more about these guys.
Introducing Security Swarm.
Oh, how things come and how things go, right? Crazy.
Here one day, gone the next.
Okay. Interfaces. Interfaces should have as few methods as possible. It's okay for interfaces to be aware of the types that satisfy them. Uh, false, true, false, false, true, true.
Um, false.
According to the lesson, what is the primary goal of keeping interfaces small? Uh, to reduce the complexity of implementation to make the code fixable for future changes. Um, Minimal behavior necessary.
Oh, whoops.
Damn it. That took one of my armors. Son of a [ __ ] I'm doing good here. It's 11:41 here.
Trying to create my own assembler. Oh, wow. 11 11:41 at night. You're trying to create your own assembler.
You're a you're a special kind of dude, man. Special kind of dude.
Hoping to be able to keep at it without getting bored and moving on immediately.
Well, lock in, man. I hope you got a cup cup of coffee and uh you're welcome to listen to me ramble on about my my boot.dev time and we can just kind of work together, you know, like co-working.
And if you ever get bored, you can just uh we can chat while you whenever you get bored.
Hello, Keshan. How are you? Oh, it's A.M. Okay, nice. Great. Well, you've got a long day ahead of you then. So, a simpler time. Go lock in.
How are you, Keshan? Nice to see you again. It's been a minute. Hope life is treating you well.
Okay.
So, define an interface with a method format that returns a formatted string. So interface formatter format turns.
Good morning Bradley. Nice to see you.
Hello caffeinated minds. Long time no see. Ohoy.
How how how goes it?
How goes it?
been busy going well, but having to troubleshoot some alerts and work today.
Well, that's no fun. I mean, I'm I'm hoping the busy is good. You know, busy is sometimes good. Hopefully, it's a good kind of busy, not a bad kind of busy. And uh hopefully the alerts at work were were solvable.
I have an idea where I will create an API or library that will take text data random or sorted and it will convert it that into a beautiful looking UI by using Okay. And then we need to actually implement those functions. So we'll say function C code has a function called uh format.
It returns a string code should return the message in a single back tick to simulate inline code. Uh, so we could do back ticks plus C dossage plus back tick something like that and then we got to do it. I'm going to take another week off at the beginning of August. Um, been working out, been writing a lot of code. I been spending a [ __ ] ton of time working on this Tuy terminal app of mine. Um, been building Atari app, too. Been streaming every morning, doing boot.dev for a little bit now. Again, it's good. It's good.
Life is good. I mean, I'm healthy. My family's healthy. So, I really just don't have much to complain about. You know, there's so many other people who have it. So, so have such uh way more challenging, you know, circumstances than me.
So I I have enough, you know. I have enough.
Let's see. Winding down for the night here. trying to untangle some good oldfashioned result async code blocking you of course everywhere it's a mess dude whenever I see do dot whenever I see dot result or I myself type dot result I immediately pause and I think about all the choices I made in my life and how I must have taken the wrong turn somewhere where I mean I know it has actual I mean I know it has actual use cases you know I mean I know I just I just think it's more of a foot gun than it is useful.
I think one of the things I think that happens with.NET developers is I think sometimes they just try to get way too clever with stuff, you know, like you're just trying to be way too clever, man.
Just write just write the boring code.
Write the boring code that works.
Too many return values. Want string.
Line 12.
More than one character in rune literal.
Oh, that should be undefined C.
You should be B.
Yes.
Sharpshooter test earned.
implement the importance methods for each type. They should return the important score for each message type.
Okay, let's go ahead and define the methods first and foremost.
So, we're going to need one of these.
Funk.
Let's see.
funk D.
Actually, the way you'd say this is you'd say function has a receiver of type D. Has a receiver D of type direct message named importance that returns an int, but now it just returns zero.
and function has a receiver of G of type group message uh named importance that returns an int and we'll return zero also I realize that this is split by my camera so I apologize and then we will have a type with a receiver of S of type system alerts. Hey, system alert. What are the odds of that? Bradley was just talking about that.
Oh, no, that wasn't that was caffeinated mind. I was talking about that. That's that's hilarious.
Uh, this is named importance as well.
Let's return type int.
Okay.
For a direct message, the important score is based on if the message is urgent or not. If it is urgent, the important score is 50. Otherwise, the important score is equal to the DM's private private priority level. So, we'll do D.ority level. It's the default. And we'll do a little if little iffy check. If D is urgent because, you know, I mean, is it really urgent?
My experience is not most things aren't urgent, especially after spending 3 years working in the ER. Yeah, most things aren't urgent.
I mean, compared compared to what you see in the ER, most things are not urgent for a group message. The important score is based on the messages priority level.
Okay.
G dot priority level.
All system alert messages should return an important score of 100 cuz they're uber important.
Complete the process notification function. It should identify the type and return different values for each type. For a direct message, return the sender's username and the important score. For a group message, return the group's name and the important score.
For system alert, return the uh the alert code and the important score. If the notification does not match any known type, return an empty string and a score of zero.
Okay, we can use a we can switch on the type.
So we can say switch actually we can do switch type.
And then we can do case.
Um what were the three cases? Direct message.
This would be in.
Okay. Uh this would be system alert and this would be case group message.
Then we'll have a default.
So the default will just return empty string zero.
This will return group message and intimp importance.
This will return system alert and this will type wreck message in.imp Importance unexpected name importance after top level declaration.
937.
What have I done wrong here?
Good morning, Rockberry. Nice to see you. Hello, Cyber Lanca. Hello. It It works. It just works. Okay.
Every time I read your username, I stumble.
How are you guys doing? Good.
Let's see. So, what have I messed up here? Uh, default does not like my switch statement.
unexpected name importance after top level declaration.
Okay, they wrote that code. I did not write that code.
What what does that error tell us?
Uh the code on line 37 was not written by me.
Oh [ __ ] I did write that code. I just I just tried to lie to the lie to the AI. I'm sorry.
I did write that code.
Okay, everything's failing. Why is everything failing?
Um, oh, because it shouldn't return this. It should return it should return uh in do username.
This should be the alert code and this should be in.name. This is what happens when you wake up and immediately start trying to write code and you haven't dranken any coffee.
Username is not defined. Sender username alert code undefined. What? Group name alert code in dot sender name undefined type notification has no field or method sender name.
Uh, you sure about that?
You sure about that, Cinder?
What are you talking about, bro?
Oh.
Uh, this would be Got to grab the result of the type check.
Got to grab the result of the type check.
Now try. Now tell me I'm wrong.
Suck it.
All right, that one took a little bit too long.
Uh the air interface. We offer a product that allows businesses to send pairs of messages to couples. It is mostly used by flower shops and movie theaters.
Complete the send SMS to couple function. It should send two messages first to the customer and then to the customer spouse. Use send SMS to send the message to customer. And if an error is encountered, return zero.
Uh and the air. Do the same for the message to spouse. If both messages are sent successfully, return the total cost of the messages added together.
Okay, so where are the type definitions here?
So, we're going to have um cost one, error one. I don't even know what to call them. uh message send SMS message to customer uh and then we'll check if uh error one does not equal nil then we will return zero and error one do the same for the message spouse we'll say cost 2 equals air to go send SMS message to spouse if air two it's not equal nil do the same thing otherwise return cost one plus Must and no.
Oh no, I was doing so good.
One test failed. Uh expecting zero can't send texts over 25 characters but got zero nil.
Oh, right here we should be air two.
Man, I I'm I'm using the armor this morning. Okay, I have three armor. I need to remember that.
Complete the get SMS error string function. It should return a string with this format. SMS that costs cost to be sent to the recipient cannot be sent.
Cost is the cost of the SMS message.
Always following always showing the price formatted to two decimals.
Uh recipient is the stringified version of the recipient's phone number.
Be sure to include the dollar sign symbol and wrap the recipient in single quotes.
We go and copy this. We'll say return format.sprint sprint sprint f and we need to pass in the cost and we need to pass in the recipient.
So this will be percent s percent d.
Oh, yep.
You are right, sir.
Air interface. The assignment update the code so that the divide air type implements the air interface. Its air method should just return a string formatted in the following way. Okay, we say bump receiver D of type divider. No.
Yes. Of divide. Of type divide.
Divide air has a method called error.
Returns a string.
Specifically, it returns this string.
Use the percent V verb to format the dividend as a float.
Percent V formats F.
And this would be d.dividend.
Promise I can spell h. I spelled it divvid.
Uh, okay. Maybe I can't spell.
Look at us.
Look at us. Who would have thunk it? Who would have thunk it?
I got a new camera this weekend. Or not new camera, new lens this weekend. Still trying to figure out the right the right POV.
What is the underlying type of an air struck string interface?
Can a type be an error and also fulfill another interface? Yes. Yes, it can.
Go does not handle errors the same way that languages like Java, JavaScript, and Python do. JavaScript, for example, uses a try catch paradigm. Let's pretend we have a function called get user. We probably need to wrap the call to get user in a try block because it's a function that might throw an error. For example, maybe the user doesn't exist.
And in that case, the catch block runs instead. Now, go does not have try catch blocks. Instead, it just returns errors like it does any other value. If everything goes well, the error is nil.
We continue to the next lines of code just like normal. In this example, if something does go wrong, the error variable, usually called error, will not be nil. So, we just handle the error, say by printing it and returning early.
But if everything does go well, then the error will be nil. And it means we can just continue to the next lines of code.
For example, maybe we want to get a user's profile picture based on their ID. So we call that function that also can return an error. So again, we handle the error either by failing or just continuing. There are no exceptions or throwing. We just have a simple conditional check, an if statement. So functions that can fail in Go return an error value as their last return value and we as the caller of the function are just expected to check it. Now, there are two main reasons I prefer Go's method of error handling over try catch.
The first is it makes for a really straightforward control flow. There's no magic that jumps us out of a block that we're in like the throw keyword does.
The code just executes line by line even when things go wrong. And second, it's explicit. You can see that a function might return an error just by looking at its return type. In JavaScript, the return type does not tell you whether a function might throw an error or not.
You just kind of have to know. In Go, you can't ignore potential errors unless you really go out of your way to do so.
I mean, that is a positive thing. I mean, it it is, but it does also make for a lot of noisy noisy if checks.
Uh, read the go doc for the airs.
But here's a simple example. Heirs new.
Okay. Uh, complete the divide function.
Use the errors new function to return an error when y equals 0 that reads no dividing by zero.
No dividing by zero.
Not enough return values. Oh, Okay, complete the validate status function. Hey, what's up, Satcha? Sorry, I uh was not paying attention to chat.
Hello. Good to see you. Hopefully, you weren't sitting there for too long.
I was not ignoring I was not ignoring chat. I do my best not to ignore chat.
Uh let's see. If the status is empty, return an error that reads status cannot be empty.
If uh status return errors do new status cannot be empty.
No problem. Yeah, of course. Yeah, I hope you're doing well. Hopefully life is hopefully life is treating you exactly how you would like it to treat you.
So status length length of status is greater than 140 return errors.
Oh, otherwise just return nil.
Wonderful. Wonderful.
Continuing sea second half of day's work.
I have yet to start the first half of today's work, but it will soon be upon me.
It will soon be upon me.
Let's see. At text IO, we have a dynamic formula for determining how how much a batch of bulk messages cost to send.
Complete the bulk send function. It should return the total cost as a float to send a batch of num messages. Each message costs one 1.0 plus an additional fee. The fee structure is first message, second message, third message, fourth message. use a loop to calculate the total cost and return it. Okay, so we'll say um cost uh what how I want to call this uh cost.
Then we'll say for uh I range over num of messages and we will say say total cost return total cost.
And so what we'll do is we'll say total cost gets incremented by one by cost uh plus I divided by 100 basically right No.
Yeah. By 100. And then return the total cost.
Oops.
mismatch type.
Oh, cast this to float.
Uh, should this be float 64?
Cannot use total cost. Oh.
Success.
Omitting conditions from a loop.
Complete the max message function. The parameter thresh is your total budget in pennies. Return the maximum number of whole messages you can send without the total cost ever exceeding thresh.
Yeah. Is it wanting me to? I think it wants me to write the loop by omitting the the value. So, I will try to do it that way. So, I guess four.
Um, now I don't need parenthesis because I'm writing go for I zero and after is I ++ total equals zero.
return zero and we will say total gets incremented by uh cost which is cost is 100 plus whatever I is and we need to say if total if total It needs to not it needs to not exceed it, right? So as long as total is less than thresh.
That's kind of a weird way to write that, isn't it?
Uh what about why don't we do this? So let's do so if total is greater than or equal to thresh that's I think a a better way to write it now why are you failing uh see inputs 103 expecting one actual is zero return the Maximum number of whole me oh maximum number of whole messages.
Okay, that's uh let's see total that's a different thing.
Uh that's a different thing.
I mean we can basically get to the answer. We can just say whole messages equals zero.
This isn't probably how you'd actually want to solve it, but uh little messages expecting nine. So total is greater than.
Okay. Why are we off?
Should we first do this before we break?
Okay, we're off. We're off by one. Why are we off by one?
All right, I'm gonna I'm gonna approach this in a different way. Here we go. So, we got cost, we got total um uh let's do spent. Let's calculate what we spent. So we'll say spent is equal to uh the number of whole messages that we've sent We're off by one. Why are we off by one?
We start at zero.
We increment cost by 100. We increment the total by cost and I let's go ahead and do some printing we can understand when we break so input format print line we'll say uh breaking thresh is percent D and then we'll say whole messages is percent D.
So whole messages.
No, sorry, Thresh. That's Thresh. Thresh and whole messages.
Total total undefined. Oh, yep.
Okay. Breaking 103. Whole message threshold is two.
Oh no, we're going one too many times.
So we actually want to do greater than or equal.
There we go. So, we adjust the total first, check if it exceeds the threshold, and only then do we increment the message.
There's probably a way to write this where you're where it's a little less messy. Wonder what their solution looks like.
No.
Let's see. Inputs 100 expecting one actual zero.
So if we start at zero cost is going to be 100. No thrash is 100 right.
Yeah thresh threshold is.
So here the total should be 100 plus i this should be 100.
So if 100 is greater than there we go.
Most programming languages have a concept of a while loop because go allows for omission of sections of a for loop. while loop is just a for loop that only has a condition. For example, uh for PL plant height less than five.
Yeah. Yeah. Yeah. Okay. We have an interesting new cost structure from our SMS vendor. They charge exponentially more money for each consecutive text we send. Let's write a function that calculates how many messages we can send in a given batch given a cost multiplier and max cost in pennies. In a nutshell, the first message costs a penny and each message after that costs the same as the previous message multiplied by the cost multiplier. Uh there is a bug in the code. Add a condition to the for loop to fix the bug. The loop should stop when balance is equal to or less than zero.
So what condition should the for loop evaluate?
It should say balance is less than or equal to zero.
He basically gave me the answer and I got it wrong.
The loop should stop when balance.
So what condition should for loop evaluate actual pennies and costs messages to send. We have our balance.
I guess we could do balances greater than zero.
There we go.
Nice success. Hey Kale, how are you doing? I was going to say good morning, but then I realized, yeah, it's not good morning for you.
We've been going strong here on some boot dive dev. Making progress.
Implement an integer stack.
stack is a last in first out data structure. Um, no, I'm okay. I don't want to get distracted. I want to do I want to do the lessons.
I just sent a professional fu to a company that said I didn't do my IT work correctly. I take pride in the detail of my work. Not my fault. They have issues now. Feels good. Feel righteous anger.
Righteousness.
Well, that's I'm sorry that you're dealing with that, man. That sucks. That um that's the worst. Yeah, it's the wor I mean, honestly though, that's that's a lot of what happens in companies. I mean, it's I don't think you should take it personally. A lot of a lot of times people leave and for whatever reason, even if that person was valued and did a good job while they were there, they turn into a very easy scapegoat for the people that remain. You know, it's it's very easy to in sort of an off-handed way say, "Oh, that was Steven. Steven, I don't know why Steven did that. That you know, or I, you know, Ste Steven decided on that. He didn't explain himself, right?
It just become you become a very easy scapegoat.
They blame you for their inadequacies after the job. That could become a scapegoat." Yeah, exactly. That's all it is. And so, you can't really take it personally. It's just it's just the nature of businesses and the politics of a of an office and and work culture. It sucks that it's that way. I'm not saying it really should be that way, but uh I'm a big believer in dealing with the world as it is, not the way I wish it to be, you know. So, I apologize they did that. They really shouldn't even be reaching out to you at this point. I mean, if if uh if you're not really employed there, you don't work there anymore, right? Um, I mean, you you even taking the time to respond to them was you doing them a favor, but that sucks, man. I'm sorry to hear that.
They should hire someone else to fix it.
For sure they should. If if they don't if they don't um if they don't believe in your work, for sure they For sure they should. I was going to get a a Bash Bunny Pomodoro. I was going to get a Pomodoro timer.
I think she has one that runs in the terminal.
It is Palm Tui.
Um, does she not have it built? I guess not.
Does this guy have it built?
I have one for you, but not easy to send. I'll check it on GitHub. Yeah, send it over. Yeah, I'd be more than interested to Let's see. Uh let's go to maker tui.
Actually let's just remove and we'll do get clone.get Um does go. So if I do go build dot go build help uh go help build.
Oh, there was a there the flag was right there. So I do go build out bin um on 2.
Now formed input path leading dash go help.
I saw the exe but I want to I I want to put it in bin. So I'm just going to run the command. I mean I guess I could move it there but I would much rather just use go build to do it.
The O flag forces build to write the resulting executable or object to the named output file or directory.
There we go.
Now I Now I Now I get it. Now I get it.
Okay. But I didn't I didn't do it the right way. Remove.exe.
exe go build out on 2 exe.
There we go. Hey, Bradley. Well, Stephen, you may be pleased to know I finally started writing some Rust after now for years of C#. Rust is good. Yeah, I mean, I'm I've been writing I've been writing quite a bit of Rust lately.
Uh, Rust is good.
It's uh very good. C is good, though, too. I I right now I'm I'm heavily swapping back and forth between Rust and C in my own side projects.
And every time I switch back to C, I just think, okay, this this feels like home to me. Uh Rust still feels foreign, you know, and I don't know how long you have to write a language.
It's taken me, you know, I've basically written mostly C for the last uh several years.
So, I guess it'll take me another several years to get equally as comfortable in another language.
C is a great enterprise lang really. I don't know, man. And I think it's great for everything honestly. I mean [ __ ] you can do uh you can do this now. You can do echo console.right Right line.
Hello.
Hello world.
Oh my goodness.
Then you can stick it in index.cs.
Oh, whoops.
Gotta for Gotta have them semis. Gotta have them semis.
And then you can just do net run index.cs and it'll run run a program. So I mean it's it's super lightweight now too. You know, I feel like it gets I feel like it gets tagged as like a big heavy grown-up language, which it definitely is, but I feel like they've done a really good job recently to bring it down to the uh lower ends of the spectrum in terms of complexity, right? So, if you want if you want to write a.NET API that looks like a node API, like a like a express server, you definitely can if you want to do that. You know, I hate OSX when it's past obsolete. Why?
Why do you hate it?
Why no like?
Also, why is it printing debug messages?
Bro, your app is printing debug messages. Why?
I wonder if if her fork does that.
Um CD into move palm tui star game.
Can't make anything. Can't upgrade.
Can't distro swap. It's a sheet of metal that is more like a brick. So, I guess you just That just means you need to hot swap it with some Linux e-waste. That still works. Should be fine to run. Yeah, that's what I have.
Both my I have both my um both my old MacBooks are over there.
Uh right there running Linux.
They're just like Linux servers now.
Good old Linux.
Otherwise, yes, they they basically are e-waste.
Uh what happened?
I confused.
Didn't I set up the environment variable? I thought I added that to the environment variable.
Environment variables edit.
It's there.
Uh CD pal. Oh, pomo2i is what I cloned it into. So then we need to move it. MV palm tui palm tui now. Palm tui bro.
Oh my gosh, what have I done? Uh, let's see. So, I want to move Pomo Tui. I move everything in it to the root of this one. And I want to remove Pomotui.
Uh, remove dash fo.
What the hell? Authentication failed.
Dial TCP. Lookup cloud.sharm.sh.
No host known. What is going on in this code?
Why is it calling out to palsh?
All right. Well, I guess we're not going to have a pal pomodoro terr in the terminal.
Bastards.
She must be in the middle of doing something on this branch, right?
It just doesn't work.
I guess it is a 2-year-old app. The last commit was or it's three years now. The last commit was in 2023.
All right. Well, no go there.
We'll just do my boring old web browser.
Guess that means we'll just have to build one. Or maybe Kale can send me his time to make some more coffee.
Yeah, go ahead and send it, man. I'd love to take a look. Maybe that'd be a fun thing to build on stream. We could build with Ratatouille. We could write a little Rust Ratatouille.
I'm sure the vibe coders will love to tell us that Fable can one-shot a Pomo Pomodoro timer in the terminal.
Hey, what's up Oblivion? Nice to see you. Your your watch streak is is wonderful. Thank you very much for stopping by the stream that many times.
Hey Tyler, what's up man? How are you?
You having a good day?
Good morning, Justin and Stephen. Love the thumbnail. Thank you, man. I've been trying to be a little bit more creative.
I did I did have to use AI to generate the gopher monster. I I don't have the drawings. I tried to draw it and it just looks so bad. It looks so bad. So, I did have to use AI for the for the um for the gopher monster. But, I'm trying to get more creative about how to make thumbnails and I'm I'm trying to use it as a way to kind of work on another skill. You know, if anybody I if anybody knows anybody who's like a thumbnail artist or or like kind of thinks of themselves that way, I'd be happy to work with them.
Uh short break. Uh so I'll just start breaks.
color theme muted dark mode. Yeah, I need to change the And why is everything broken?
Huh? Oh, I guess I have to start it to run, huh? Probably. All right, we'll get the coffee and then we'll start it. You can't see gifts. Uh, what do you mean?
You mean like like gif gif or like gifs?
Like g i f ts.
I just use AI to separate a monster 4,000 line file into 14 smaller organized files. Nice. Who who is the who is the uh who is the guy that wrote uh YouTube gifts? Uh yeah, I think I think I can.
Why did you send one? Cuz if you did, I'm I apologize. I thought I had alerts on. Maybe I don't. Uh let me go to Let me go to YouTube Studio and see if I can see it there.
You've been sending me gifts. Hoping you'll notice me. Huh? What what gifts are you sending?
I don't know what I don't know even know what you're referring to here. I'll try to go to uh YouTube Studio.
See if I can see anything there.
Uh oh, yes. You sent a 100 for two jewels. You sent a star for two jewels.
You spent 100 for two. Yeah. So, I can see those. Yeah. But I can only see them, for whatever reason, I can only see them in uh YouTube Studio. I can't see them in Streamer.
Apologies, Tyler. That's my bad.
I use this application called Streamerbot to kind of manage all my stuff locally. So, I don't really I don't really hang out in the Twitch stream manager or YouTube Studio on the the web. So, that's my fault. I wonder why that is. I wonder why they don't they don't do those.
They they do a lot of different events for YouTube. They do um well I guess not all of them. They do super chat, super sticker, new membership, user banned, user timed out, broadcast started, broadcast completed. So I guess yeah, that must be a newer one that they don't support yet.
Yeah, sorry about that.
Thank you very much, though. I appreciate your gifts.
All right. Coffee. Coffee.
by Forgot to put up my be right back sign.
Not doing this streamer thing pretty very well, am I?
Okay, let's go ahead and start this guy.
Okay, assignment. We're hiring engineers at Tex IO. So, time to brush up on the classic FSBuzz game, a coding exercise that has been dramatically overused in coding interviews across the world.
Complete the fsbuzz function uh that prints the number 1 2 100 inclusive each on their own line, but replace the multiples of three with the text fizz and multiples of five with buzz. Print fsbuzz for multiples of three and five.
Oh, good old. I don't think I've ever had to do this before. Bisb buzz. Okay, so this is uh delete that.
So we need to find we need to range over 4 I in range of 100.
Print line we'll print I need to go one to 100.
Oh, whoops. That's not how you do that.
And so that will be exclusive. So, we really should start at um how do I do that and go go range between two numbers.
Range clauses range over one to 100 and only then go.
Uh yeah, but can't you use a range to do it?
I hate writing manual for loops. Hate it so much.
Uh I guess you have to make a slice.
Okay, fine. I'll just do the manual way.
For I equals zero.
I is less than 100.
Actually one less than or uh equal to 100 I ++ cannot use assignment.
cannot use assignment I as expression.
There we go. Okay, so we got one to 100 and now we need to find our multiple. So is multiple of three.
This would be some modulo math, right?
So we can do I mod 3 uh equals Z is multiple of five equals I mod 5 equals Z right let's see format print line or print f and we'll do uh percent or I is multiple of three is a multiple of five and we'll say um percent D is and then I'll just say three five and I'll just print percent V and percent B for those a comma just to make it readable.
Oh, we need a new line, too. Without the new line, it will be unleible.
Is this Rust? No, this is Go. We're doing boot uh go on boot.dev.
So, yes, multiple of three, I would expect.
True, true, true, false, true, false, true, false.
Are there any um 7590?
Okay, I think I have that. Let me get my coffee real quick. Sorry, one sec.
Also, hello RPAM. Welcome to the stream.
You're welcome back anytime.
I have returned.
The less than equals looks different.
You had it right. You were spot on with it, Pam.
You were spot on it, man. This reminds me of the old Ben Aad clip of him doing this with the macros in Haskell.
Well, Ben Ben Aad is on he's on some next level [ __ ] Have you seen his recent videos about using uh or letting AI run a business or something?
Yeah, I haven't watched the video, but it looks like it would be good.
Okay, what does it need to do? Um so if is multiple of three and is multiple of five do print line.
Yeah, he's losing money non-stop l on every model. That's crazy. Yeah, I I I find experiments like that super interesting. I just don't have the money to waste money on it. You know what I mean? Like every every dollar I earn is just so much better spent um invested.
But maybe maybe once I reach a certain level of financial independence, then I'll feel a little bit more comfortable doing experiments like that. Cuz I mean, you're basically just lighting money on fire. I mean, it's like buying fireworks for the 4th of July, you know?
This should be fib. This should be which I guess that will if that actually is my plan that means that you guys will need to come back to my channel in the year 20 like 40 something to watch me do experiments like that.
Okay. Um, let's see.
100 on their own line. Print the numbers 1 to 100 inclusive each on their own line, but replace multiples of three with the text fizz and multiples of five with buzz. Print fizz. Okay. And I still need to print the uh the individual number.
So continue.
Okay. And let's try to submit it.
Woo.
Got my daily chest. Got another frozen flame. I've got several of those frozen flames.
Let's see. How do I check how many I have? I have two embers, but I know I have some frozen flames. I don't know how I see where those are, though.
Remains a mystery to me.
I get confused with the cursor placement in Vim. Really? You mean with the block the block cursor? Like, you mean if the block cursor is here, where do you put it?
Um, I don't know. I think the block cursor makes a lot of sense when you're in visual mode, right? It's when you're in in if you're it's when you're in a an insertion context and it's a block cursor to me where it gets confusing.
But if you're in if you're in normal mode, I think the block cursor makes a lot of sense.
Yeah. I I I mean, if you're like if you're like in PowerShell, the block terminal is a little confusing.
You know, if you're in your shell, it's a little confusing.
you know, cuz like where where is this going to insert at? I don't know, you know, but then you you you come to realize it's always on the left edge, right? You you'll you eventually get used to it, but I think if you're in an insertion context, yeah, I can see how it would be confusing.
Okay. As an Easter egg, we decided to reward our users with a free text message if they send a prime number of text messages this year. uh complete the prime prime the print primes function.
It should print all the prime numbers up to and including max. It should skip any numbers that are not prime. Here's the pseudo code uh breakdown.
Uh this is this is a primality test. We skip even numbers because they can't be prime. We only check up to the square root of n. uh a factor higher than the square root of n must multiply with a factor lower than the square root of n.
Meaning we only need to check up to the square root of n for potential factors.
In your code, you can set the stop condition as uh i * i is less than or equal to n. Uh we start checking at two because one is not prime.
For the first test case, prime number up to 10. Primes up to 10. 2 3 5 7. We only want you to print the numbers themselves, not the headings and delimiters. They are already handled for you in the test code.
Okay.
So, I basically just need to translate the pseudo code on the left to go code on the right.
Okay. Um I guess let's write a for loop and I'm going to use kind of the similar naming of variables. So we'll say n starts at two and we will increment n by we'll check to see if n excuse me if um n is less than or equal to max right because we go through max so we will increment in Then let's just do a little I always I don't know I'm I I might this might be pedantic but I just like to always print stuff because I like to visually see that what I think is happening is actually happening you know and I like to do it in small little chunks.
So we're just going to re we're just going to overwrite max. So, whatever they give us, it should print uh 2 through 10.
Yeah, 2 through 10. It's what we want.
And then we've got to translate the rest of this. So um if n uh equals 2 then we know in this prime print it and skip to the next in. So we can say format.print line in then we just continue otherwise we're going to continue on. If n is even how do we check if something is even? we say in mod 2 equals zero, right? That means it's even um and probably this I'm I'm this is pedantic. I know some people find this pedantic in code, but I'm a big believer in like readability. So more even for myself, it makes it easier to reason about the code. So I'm going to say uh is even right and the math is the same, but now it has a label, right? So now I don't have to do that calculation to say oh yeah that's a is even check. I just know if is even uh n is not prime skip. So this would be continue.
Okay. And then we're going to set a default case of is prime equals true.
Then like they said we're going to loop over We're going to loop over starting at uh i= 3 now and we're going to say uh I is less than the square root of our number + 1 Is there a square root function? What's the square root function in go?
Go. Square root function.
How much do you find this type of learning sticks for you? I struggle with this type of content where I feel like I'm progressing, but then I don't really go on to do anything afterwards with it.
Uh, yeah. I I would say this isn't super I wouldn't say that these type of exercises are terribly great for translating to like building something like building a project. I think they're good.
It's kind of like practicing. It's kind of like in uh Brazilian jiu-jitsu where you just practice your reps, right?
You're just getting you're getting practice like moving through the motions, right? Whatever you're whatever thing you're working on, whatever move you're working on or submission you're working on, you go through it and you probably go through it like a half speed. I think these kind of exercises are like that. It's just you practicing the syntax of the code. It's practicing you the how to order code, the logic, you know what I mean? It's just it's not necessarily going to translate directly into, well, how do I go build a web application and go with this information? Um, it's just about getting more and more reps under your belt, which for me, this probably isn't really this that's not boot.dev is not designed for people like me who have been writing code for 6 years. It's designed for people who are newer to code, probably have less than, you know, let's say less than 50 hours, right, ever spent writing code. And so they're just trying to give people as many opportunities to get their fingers on a keyboard and be exposed to how to think about the logic in a program, even a small program, right?
And how to author that in a in a way that accomplishes the goal, but they can also understand, you know? So, it's just it's um yeah, it's it's designed for a particular audience, I guess I should say.
I mean, Justin's point's fair. It's like nothing's really stopping you from doing anything with it. It's just it's just the I understand what you're I think I understand what you're saying, Bradley.
It's just uh Yeah. It's not directly, it feels not directly related to what to what you actually are going to go and want to do with your code. You know, you should make a shirt that has a BJJ quote. For sure, we can do that.
For sure, we can do that.
Yeah, this helps with the abstract thinking plus syntax. Yeah, that's exactly right. It's uh it's it's like um it's kadas. That's that's what it is. I mean, that's the best term for it, right? Katada comes from uh Does that come from karate? What does that come from? That comes from a martial art, doesn't it?
I guess it's I guess katada is just uh a Japanese word for form or pattern.
But this but it's Yeah, it's it's just like it's just like in martial arts practicing movements. like you're never actually going to do like for example like if you're if you're practicing like uh kamura in in BJJ you're not going to the way you practice that when you're with a with when when you're when you're with your training partner is not necessarily how you're going to throw it when you're in a match when you're actually sparring. It's just about trying to build that muscle memory, right? and trying to trying to build the awareness of that skill. So that's becomes second nature so that when you are actually in a in a match, you're not thinking about what is the how do I do that, you know, you just do it, right?
Um, and I think that's the same thing with this type of content is you're you're getting reps at writing for loops and if statements and ordering logic so that when you're actually solving a problem in in your program, you're not so hung up on the syntax, you know, you're more focused on solving the business problem or the problem at hand.
Yes, I and and Bradley, I share your I share your um I completely share your opinion as well.
The only reason I'm doing boot.dev is because I'm very interested in getting that coin in the letter.
What why that has become motivating, I can't tell you, but I just I like the idea of receiving a letter in the mail telling me I'm an arch mage. If it wasn't for that, this probably wouldn't hold my attention either. So, I I do share your I that resonates with me.
Okay. So, we've got uh let's see. We need to loop over I think it's math, right? There's a math math. square root square root of n + one we'll do i ++ okay so then we'll say if n can be evenly divided by i is false equals.
Okay, so we'll do is evenly divis divisible. Yeah, I can I can spell occasionally.
So we'll do n divided by i.
So if is evenly divis or sorry this is mod and that has nothing left over.
Then we can set is prime to false and break.
And then if we get out of the loop, right? If we get out of this loop, then we can check is prime.
Now what are we supposed to print?
just the number.
So, let's go and see if we're anywhere close to getting this reasonably correct.
Undefined is even. Undefined is prime.
Yes, because I'm trying to write this like Python. So this should be walrus operator cannot use in variable of type int. Uh, okay. So, we should float this or no, we should do right.
This should become a float.
And then does square root give me back a float? What does square root give me back?
What's the return type square root?
Yeah, it hands me back a float. So I think I want to do int undefined I. Oh my gosh. Stephen, use your Wallace operator for the love of God.
Two, three, five, seven. Okay, so 10 works. So let's see what happens with the others. Yeah.
Okay, submit.
Woohoo.
Well, that was a good 25 minute session.
Here we go.
It's okay to lose interest in a project.
Projects are like books. Yes. Yes. 100%.
And I I think I that's why I always have multiple books going at the same time.
And that's why I tend to have multiple projects going on at the same time is because some days I don't want to uh some days I don't want to um work on a particular project. Like yesterday I didn't want to work on my Tory app, so I spent the whole day working on term chat and that was a ton of fun. I actually added uh I actually added support to term chat for things other than messages.
So now you can see if we go to these are p these are streams from yesterday. But if we scroll through here yeah cuz it's not live. Um, if we scroll through here, I added support for like, oh, here we go. Watch streak. So, I added tags for those kinds of events.
That's what I did yesterday.
Gifted subs works now.
Um, I couldn't find this is I know this is probably not very artistic. This is just the best uh way I came up for for displaying this information.
Yeah, it's good to it's good to have multiple things like that so that whenever you do feel like ah I don't want to you know what I mean? It's like I don't want to do that today. You have something else you can work on.
I also think it's good to have like um I think it looks neat and a bit retro. It does look retro, doesn't it? Uh it does look retro.
Uh, I think it's good to have like not only different not only different projects, but I also think it's good to have like things you're interested in learning about. So, just like keep a list of things that have that that you've heard about that you don't know anything about, but that at some point you'd like to explore. And whenever you have a moment of like uh ooh whenever you have a moment of oo towards your projects then break out that list and be like okay what's something I can explore today to get my reps in.
could be duck DB, could be a new language, uh could be a new framework in a particular language that you like to work with, right?
Um I I think for me it's just it's just the act of doing a little bit every day, right? Some trying something a a pallet cleanser. Exactly. Like my that's what my wife calls certain books that she reads. She's a big reader. Like my wife reads like she read she read 400 books last year and I think she said she's up to likeund and something books this year but she always tells me that um you know sometimes she gets to an end of one book and she just needs to take a break right even like she's in the middle of a series or something.
Got to have a Yeah, I know what exactly I know, dude. She re she reads incessantly now. She she does a little bit of she does a little bit of both like reading on her phone or Kindle and then she does a little bit of re listening and then sometimes she does them at the same time. Uh if she can get the audio book and the written book but yeah she she swallows swallows books. It's crazy.
It's unbelievable.
When she told me that number at the end of last year I honestly I honestly didn't believe her. I was like there's no way. I was like, that's more books than I've probably read in my entire life.
40, 50. I'm not I'm I'm I'm probably not at 50. I'm probably maybe 10 to 20 a year, maybe one a month. Um I started making my way through the B Brandon Sanderson series, and that's been a lot of fun. I'm currently trying to push myself through the first half of the first book in the second era of the Misborn saga. Um, I don't know what it is. It's something about the difference in timeline or or time periods in the books is making it hard for me, but I'm going to push through. I'm determined to read all of the Cosmir. So, I'll see you guys again in 20 years when I finish.
Yeah, start. Yeah, start small. Yeah, just read them. Read read, you know, read once a day for 30 minutes or so.
Or set a Pomodoro timer, do some work, read for 5 minutes, do some more work, read for five minutes. You know what I mean?
Okay. I think that is that's that's a little loud, isn't it?
Let me uh let me fix that.
Let's fre Oh, I can't turn that down. Can I control the volume in here somewhere?
There you go. That's better.
That's better.
Nah, bro. I need my death metal when pumping iron.
Audiobooks. Oh, audiobooks plus workouts are good. I I personally like audio books plus walks. Yeah, listen to audiobooks on like long walks. That's That's a good one. But working out, I tend to listen to like podcasts or music or something like that.
Death metal. Yeah. Not not for me. I've never been a death metal fan, you know?
Like I work out to all kinds of music though. I work out to like Taylor Swift, Sabrina Carpenter, Eminem.
I I listen to all kinds of random music.
I'll put my Pomodoro on GitHub. Oh, thanks, dude. Uh will you link it to me in Discord or link it? I mean, you can you can send it to a DM or if you want to share it with the with the server, you're w you're more than welcome to in the projects channel. But yeah, just just uh just send me a link. I would love to check it out. I mean, the web, this web app isn't bad, but I just, you know, I kind of feel like, hey, man, we do everything in the terminal around here, right?
SC, a man of taste.
Okay, connections. Complete the count connections function that takes an integer group size representing the number of people in the group chat and returns an integer representing the number of connections between them. For each additional person in the group, the number of new connections continues to grow. for a loop to accumulate the number of connections instead of directly using a mathematical formula.
Use a for loop. Sorry, use a for loop to accumulate the number of connections instead of directly using a mathematical formula. To make sure you're picturing it right, if there are two people, how many possible connections exist between them? If you add a third person, how many new connections are created with the rest?
So this is definitely C. You can there's definitely a formula for this, right? Uh there's a formula for the number of nodes and the number of edges that you can actually run.
Uh but he doesn't want me to do that. So we're going to loop.
So you basically have to go to each node and say this guy can be connected to this guy can be connected to this guy can be connect to this guy can be connected to this guy.
Uh so you're going to need some nested loops. Huh? So you're going to say four uh i equals z i is less than group size um i ++ for j 0 j is less than group size Plus total.
Okay. What's the total here?
Okay, expected six, actual is 16. Okay, so did I not understand the question?
For each additional person in the group, the number of new connections uh growth, use a for loop to accumulate the number of connections instead of directly using a mathematical formula.
Instead of sending me sending messages multiple times to individual people, you send So this guy would be connected to Oh yeah, but you can't just blindly count cuz this is the same thing, right? One, two. Yeah, these are So I'm counting these multiple times. Um, so I guess we could do Oh, this also needs to start at uh this needs to start one ahead. that doesn't it? Cuz we don't want to do zero.
I always get so confused with these matrix.
So we basically want to do 0 uh one 0 two zero to three. Right?
And then we want to do one.
So I I + one cuz this would we'd want this to be two two.
Speaking of terminals, end up giving Terminina a go. Psyched with how it turned out for my use case. Nice, dude.
Yeah, Terminina is great. It really is great.
Looks like walking Postman MLP can connect to all except itself.
Yeah, I I I always know what I I always know what I need to do in these problems, but I never know. I always get confused at trying to get it expressed in code every time.
every time.
So I want to do three and then I want to do sorry one to zero. But see this is a dup this is duplicative.
This is duplicative of this one. Right?
So we don't want to do that.
And then this would be two, right? So this would start at three because we already have 2 1 then we do three 33.
There we go. Yeah, there we go. I think that's it.
Sh.
Man, I tell you what, just writing stuff out like thinking in pseudo code so helpful for me personally. Like in math, like in school, I always did math. My It's so funny. My ma my son does math all in his head. Like if he has a math problem for homework, he just he'll just sit there and like think real hard and then he's got the answer. But then he'll ask me and I have to like get a scratch piece of paper like write it out all out by hand. Uh I just don't I don't know. I don't process things well um without without thinking through it. Writing it down, drawing it out.
Okay, we got this.
Yeah. Write out the pseudo code.
Exactly. Yep. That's That's the It's the It's the OP move every time.
every time.
I I also think that's why I also think that's why rubber ducking is so valuable. I I feel like so many people discredit rubber ducking. Um, like so many times if you just try to explain your problem to a group of people, it might it might be a good reason why you should stream like stream while you code even if you're streaming to nobody is you you you're forced to kind of talk out loud as you're thinking about things and as you're trying to explain your problem, you're like, "Oh, wait.
Actually, that sounds really dumb. Now I see why I'm all screwed up."
Good morning, Mark. Good to see you. Are you going to head over to Twitch and say hello over there?
Here, I'll I'll beat you to it. Uh, Mark, good morning.
Oh, I'm not going to beat you to it. Oh, I'm not going to be a You be Oh, dang it. I was screwing around with the stupid chat app. I was going to try to send a message to say hello to you before you got over there.
Yo, thank you, man. I appreciate you coming back and visiting the stream. Super kind of to you.
Let's see. When our clients don't respond to a message, they can be reminded uh with up to do two additional messages. Uh complete the get message with retries functions. It takes three strings and returns an array of three strings and an array of three integers.
Uh the return string contains the original messages. The first is the primary message. The second is the first reminder and the third is the last reminder. The integers in the integer array represent the cost of sending each message. The cost of each me message is equal to the length of the message plus the length of any previous message.
For example, hello costs five. Word cost five. Adding hello makes total cost 10.
Um cost one. Okay.
Sounds good.
Got you. I appreciate it, man. I do appreciate it.
If it if there's anything I can do it better to make it better over there in Twitch world, let me know. Um my my Twitch world is pretty small. I mean, my stream in general on YouTube and Twitch is very small, but if there's anything I can do to make it better, just let me know. Try to do my best. I still haven't figured out the internet issues. I don't The internet issues are what they are. I don't know. They may not get fixed till we move houses again.
I don't understand. I don't understand the purpose of primary, secondary, and tertiary.
That has me confused.
When our clients don't respond to a message, they can be reminded with up to two additional Hey, let's go. Seven streams in a row. That's awesome.
Thanks, man. You are consistent.
Okay. So, I guess what they want me to do is they want me to do something like um results equals uh I don't even know if I remember how to make a slice and go Can you do that?
Unexpected new line and composite.
Not enough. Yeah. Okay. So, that's valid.
Um, so this is going to be our strings.
Then our intent results.
Uh let's see. What do you want me to do here? Um, gamble all. I don't think we have gamble. What What would What would the gamble command do? The woodchucker.
I got too many points to spare. Oh, dude. Use your points, man. Use them up.
Fire off some text to speech messages.
Okay.
plus the length of any previous message.
So, honestly, can't I just uh can't I just do something like for string or stir range over strings result and then Hey, so hello costs five, right? So we can do the cost equals the length of the current string plus whatever the Okay, so let's do let's keep track of another variable called total, right?
And so cost is going to be the length of string plus total.
So if prior so if this comes through we start the first one this is going to be five and zero. So the cost is five. The next time we come through total is already five and the length of the word is five.
So that's yeah I think that's correct.
Then we have to append uh let's see in in result total. Is that how you do the append function?
Okay. Declared and not use cost.
Yep. You're right. So total uh length.
I guess we'll do length.
So, you don't want to add the total to the total. You just want to add the length of the current word to the total.
Uh, and then we need to change this to S.
S invalid argument S for built-in length.
Oh, this is I have to do this, right? I have to do this is the index and this is the value declared not use cost append cost argument must be a slice uh let's see we have int results um add to array in go.
Uh do I have to set the index individually? I guess uh I guess we can do that. We can do instead of the way we're doing it, we can say 4 I equ= Z uh I is less than the length of what uh strings results and then we could say does length work on the on length of array in go total plus equals oh cost. Yeah. Cost plus equals.
I think I think I'm on the right path.
I guess we'll find out. Yeah, we can do length.
So, we'll do basically everything we're doing here.
Let's do it here.
Instead of s, we'll say uh strings result at i. And then here we'll just say ins. I feel like I'm using syntax that hasn't actually been taught to me yet in the course.
Uh so I don't know if that's good or bad.
So let's do this now. run.
Fail fail fail fail. Okay, so inputs are this expected this. I think we got the expected back correct.
Um, okay. We're adding too much each time, right? So, that's a problem.
All right. So, there's something here. I think Justin's alluding to my a mistake that I've made here.
So the idea is I want to let's just step through let's just step through this with their little example.
Let's say there we have hello first right. So length becomes what? Length becomes five.
Total gets incremented to five which means to oh that's wrong. That should happen after right.
So this needs to be so this is going to be five plus total which is zero that equals five. That's what you want. Then you're going to populate the array. The next time through you have world world equals 5.
This time you have five + 5 = 10.
Okay. And then the length gets incremented again. So now or the total gets incremented again. So now you come through you have exclamation point this is one this becomes total is now 10 + 1 = 11 yeah I think this is correct now yes order matters I'm interested to see their solution because I'm not sure I did this anywhere at all what they wanted me to do Uh, let's submit.
Okay, let's take a look at their solution real quick.
Solution. What did they do here?
Oh, they didn't loop at all. They just hard co They just hard.
Oh, okay. Yeah, that makes sense. I thought I thought it wanted me to loop.
Yeah, I guess the lesson here is about the fixed size nature of arrays. So that would have probably given me a hint on what I should have been doing.
What, you know, there's more than one ways to skin a cat.
All right, now we learn about a we're talking about slices.
Dude, I I love these visualizations.
Every time I see one of these on boot.dev, I kind of gush over it on stream. But I just I love these visualizations.
Like look at that. That's so cool.
Bootdev, chill. Keep it simple. That's right. Chill. Keep it simple.
You ain't going to need it.
I I'm super bad at violating you ain't going to need it all the time. I I'm I'm so bad at it cuz I I'll be writing code to do something and then I'll think, you know what, this would this would function so much better and this would be so much more extensible and this would look so much nicer if it had this signature or this interface.
Then I get distracted basically building like a library inside my app instead of actually building my app.
All right, time to lift a kettle bell or two.
Don't mind my uh don't mind my heavy breathing.
more commands. Oh, that would be a good one. A lift command would be so on point. Let's do that. Let's set that up right now.
Big yawn.
I think my yawn made me yawn.
Okay, we have to add a new command in streamerbot.
Uh, we'll allow anyone to use it. It could come from Twitch. It can come from YouTube.
Uh, I'm going to add an alias for it called doust thou even hoist.
No one's ever going to type that.
Okay, now we go to actions and we add a command. We'll just copy one of the existing ones.
I think putting on putting it on point so I can use mine. Oh yeah, for sure.
For a sure. One second.
Let me get it.
Let me get it added.
How do I copy stream manager?
Dude, I forgot how to do all this stuff.
How do you How do you add custom There we go. Custom.
Add new custom.
Uh, give your reward a name. Lift.
Make Stephen.
Oh no, we ran out of time.
Make Steven do exercises.
That one needs to have a We need to think carefully about this cost because um I'm actually going to Okay, we'll finish setting that up on the next break.
At least both muscles and brains are improving for sure, dude. I just you can't spending so much spending hours in a row seated just makes my body feel horrible.
So the pomodor is actually a nice a nice thing cuz it actually makes me stop and like look up like I spent way I spent way too much time yesterday seated here working on that stupid chat toy thing and at the end of the day my knees hurt.
Like why do my knees hurt after I sit?
Like doesn't make any sense.
Okay. Where low index is inclusive and high index is exclusive. Uh okay. We're learning about Okay. What do we want to do here? Retries are per premium feature now. Text.io's free users only get one retry message while pro members get an unlimited amount. Complete the get message with retries for plan function.
It takes a plan variable as input as well as an array of three messages.
You've been provided with constants representing the plan types.
Okay.
If a plan is a probe plan, return all the strings from the messages input in a slice.
Okay.
So if if plan equals pro plan pro then we're going to return messages and we are going to slice the whole thing. So how do we do that?
like this.
Then if the plan is a free plan, if plan equals free plan, uh return the first two strings from the message input in a slice. So we want to take from messages from the beginning up to two, right? cuz this is not inclusive or I think it's not inclusive.
If the plan isn't either of these, return nil and an error.
So this actually should return nil nil. And then this should return nil errors new unsupported plan run success.
We have way too many names for ordered lists of things in programming. In JavaScript, we call them arrays. In Python, we call them lists. And while in Go, they're actually two unique types, arrays and slices. And they are very different. Arrays are fixed in size, means their size can't change. And we could create a new array of five items with this syntax. And then we can assign values directly into each index like this. But this array will always have exactly five elements in it. So you might wonder, how is that even useful if I can't add or remove things from the array? And well, frankly, it's usually not. And that's why as a developer in Go, you'll use slices instead. At least like 99% of the time. At least slices are what you'll use directly. See, dynamic slices are backed by fixed size arrays. Slices are just much easier to work with. And here's how you create a new slice. Notice that there isn't a size limit. A slice is dynamically sized. It's a flexible view into a backing array. Now, while you won't often use arrays directly, unless you really don't need resizing, slices do rely on arrays behind the scenes. Aside from being resizable, slices are, as the name suggests, slices or parts of an array. You can use slicing syntax to create a new slice that just has a section of an existing array or slice.
For example, say we wanted to get the second through the fourth items. We can create a new slice like this. The first index one is inclusive and the second four is exclusive. Now, slices in array in Go are stored in contiguous memory just like arrays in C because accessing data stored contiguously is faster than pulling it from a bunch of different scattered memory locations. The downside of contiguous memory is that we can't expand a slice in place if there's no room. Say our slice uses memory addresses 700, 701, and 702. If address 703 already holds some other variable, we can't just expand into it. And that's why backing arrays are fixed in size. It prevents us from overwriting other memory. So how do slices grow? Well, they need to automatically allocate a new larger backing array and copy the data from the old array into the new one. For example, let's say we have this.
If we append a new value, then a new array.
>> You want me to back it up?
>> I can back it up.
>> Too many names for ordered lists of things.
>> I got distracted.
>> In JavaScript, we call them arrays. In Python, we call them lists. And well, in Go, they're actually two unique.
>> I I was distracted building Kale's project.
>> They are very different. Arrays are fixed in size, means their size can't change. And we could create a new array.
>> I know. I'm doing it again. I I know. I know. I know.
>> And then we can assign values directly into each index like this. But this array will always have exactly five elements in it. So you might wonder, how is that even useful if I can't add or remove things from the array? And well, frankly, it's usually not. And that's why as a developer in Go, >> thanks a lot. It's interesting. Never learn Go 99% of the time. At least slices are what you'll use directly.
See, dynamic slices are backed by fixed size arrays. Slices are just much easier to work with. And here's how you create a new slice. Notice that there isn't a size limit. A slice is dynamically sized. It's a flexible view into a backing array. Now, while you won't often use arrays directly, unless you really don't need resizing, slices do rely on arrays behind the scenes. Aside from being resizable, slices are, as the name suggests, slices or parts of an array. You can use slicing syntax to create a new slice that just has a section of an existing array or slice.
For example, say we wanted to get the second through the fourth items. We can create a new slice like this. The first index one is inclusive and the second four is exclusive. Now slices an array in go are stored in contiguous memory just like arrays in C because accessing data stored contiguously is faster than pulling it from a bunch of different scattered memory locations. The downside of contiguous memory is that we can't expand a slice in place if there's no room. Say our slice uses memory addresses 700, 701, and 702. If address 703 already holds some other variable, we can't just expand into it. And that's why backing arrays are fixed in size. It prevents us from overwriting other memory. So how do slices grow? Well, they need to automatically allocate a new larger backing array and copy the data from the old array into the new one. For example, let's say we have this slice with three elements. If we append a new value two, then a new array say of length six is actually created automatically for us. The old values are copied into it and then the new value is just added. This new array lives in a completely new memory location. But the same slice that we had originally still now points to it. Now this whole copy operation where we go from the old array to the new array might sound slow and sometimes it is, but Go is smart. It doesn't grow the array for every single new append. Instead, it allocates extra space ahead of time. So, resizing only needs to happen every so often.
>> Good to know, right? Good to know.
Uh, okay. Yeah, Kale, I got your thing built. So, I'm going to use that um on the next cycle. On the next Pommo cycle, we'll use that instead of the the app or the web app.
Okay. What references the other? Slices references array or arrays reference slices. No, slices. Slices references arrays because arrays act as the backing field basically for the slice and the arrays are automatically created and allocated for us. And our slices always point get moved from pointing at the old array to the new array whenever we add things. Excuse me.
Multiple slices can point to the same array. True. A function that only has access to a slice can modify the elements of the underlying array. True.
Okay. Let's see. Most of the time we don't need to think about underlying array of a slice. We can create a new slice using the make function.
Wonderful. Wonderful.
What what do we want to do? Pre-allocate a slice for the message costs of the same length as the messages slice. Okay.
Oh, let me put the music back on.
Such a pro.
If only. If only, man.
If only.
See, cost is going to be make.
And what are the arguments to make?
The arguments are the type. We want an uh inter array and then the length of the capacity. So the length is going to be the same length as messages.
Okay.
Fill the cost slice with the cost for each message. The cost in the cost slice should correspond to the message in the messages slice at the same index. The cost of a message is the length of the message multiplied by 0.0. So, I think what we could do then is we could do well, I guess I'm going to do this the way I think they want me to do it instead of the way I was going to say we could just loop over the cost, grab the message based on the index, and then do our math. But I think what they probably want me to do is actually um I think what they want me to do is actually just Well, maybe they don't want me to do that because they don't actually tell me a set size, do they? So maybe they do want me to loop over it.
I'm gonna I'm just going to do that. So I'm gonna say for uh I range over costs just submit that we can say uh I or we're going to say length equals the length of messages at I and then the cost should correspond to the message and the M message length. The cost of a message is the length. So cost equals length times 0.01.
So then we set cost at I to 0.01 0 1 or sorry the cost and then we return and this should also be cost cost and I guess they want this to be a float 64 declare not used length Um, oh yep, you would be right about that.
Untyped float constraint truncated to int.
Wonder what the how they did it.
Yeah, I guess that makes more sense because I don't think I don't think they've taught me I don't think they've taught us the rain syntax yet.
Oh man, I keep forgetting to start my potions too. Damn.
What is float 64?
It's a 64bit floating point uh number.
Instead of just having like an int which can't have uh you can't have decimals, you can use a float.
And you can you can cast things to specific types in Go just by basically calling the type like a function.
I don't know how how big of numbers they can store.
Uh it's pretty big.
float 64 max value in go.
Uh see the maximum value of the float type in go float type in go is the max value is a big ass number.
Uh it's I don't even think I can read that number.
It's uh float 64 can be negative 1 7.
Uh, I don't even know how to read that.
It's huge.
Yeah, the 64. Yeah, the 64 just means uh the number of bits used. So that mean that determines how large it can be. And I think float 64 is the default size. So default float and go. I think it's 64 is the default.
There is a float 32. I think there's only float 32 and float 64. And the default is float 64.
Okay. The length of a slice may be changed as long as it still fits within the limits of the underlying array. Just assign it to a slice itself. The capacity of a slice accessible by the built-in function cap um reports the maximum length the sl the slice may assume. Here's a function to append data to a slice. If the data exceeds the capacity, the slice is reallocated. The resulting slice is returned. The function uses the fact that length and cap are legal when applied to the nil slice and return zero.
Let's see. Allocate double what's needed for the future growth. The copy function is predeclared and works for any slice type.
Okay.
What does the cap function do? It returns the maximum length of the slice before reallocation of the array necessary. Yes.
What does the length function do? The current length of the slice.
What do length and cap do when a slice is nil? Return zero.
Variat variatic. Very variatic. Variatic I think is how you say that.
Oh, I forgot to start the pomodoro.
Whoopsies.
Okay, before we before I go on, I'm going to finish that uh that new reward.
Okay. So, manage uh see custom alert.
Add new custom alert. We'll call this uh lift.
Make me lift some weight cost.
Let's do that.
Got to get a pre-made icon here.
There's got to be a cool down, right?
Uh, let's see. Cool down. Give me five minutes at least.
Okay. How do I Where do I get power up templates for the I think my powers are coming back.
Dude, I love that emote. I love that emote. I'm going to come up with a a thumbnail that is inspired by that emote at some point.
Pre-made Twitch rewards. Pre-made icons.
Oh, there we go.
Um, there's not really a good one that fits.
Just do that.
Let's see. Extract all We have to upload them tools.
And then what's the color I use? Um, the color I use is YouTube title. I left my I let my Twitch chat punish me for hours. No, no, no punishment.
Sorry, this is taking me so long.
I never screw with this stuff much. So, it's all it's like I'm doing it for the first time all over again.
Uh, create.
Okay. So, I created the reward and now I have to wire that up in uh I have to wire that up in um in streamerbot. So, I have to go to streamerbot. I have to go to this. I need to make a copy. Duplicate it.
We're going to edit it. We're going to change it to lift.
We're going to set this to edit trigger list. Okay.
Edit subaction.
Herman V is telling you to lift some weights.
>> There we go. God, he sounds so enthusiastic about it.
>> Okay, that's wired up. Sorry, I was lagged out there.
Or maybe the stream was lagged out. I don't know. Could have been me. Could have been Could have been the internet. Sorry about that. Sorry about that. Oh, also we no longer need our um our web pomodoro cuz we have Kale's pomodoro to help us. So, watch this. We go pomo. Oh, I need to add it to my environment variables.
Environment variables.
You said this was a simple pomodoro and it does not look simple at all, man. It looks very good. Looks like you put a lot of time into it.
Let's see. Edit.
This should be save.
Now we'll do thato.
Dude, that's I mean that's pretty nice.
That's a pretty nice uh little app, man.
I give that 10 out of 10. 10 out of 10.
I mean, simple cuz it's not trying to be a Pomodoro timer, so it kind of sucks at that. I was trying to make a multicompatible display thing. I think it I think it's great. I think it's great, man.
I love I love the fact that it actually animates into the bottom of the timer. I love that. Yeah, I'll definitely This will definitely become part of my my regular tool set. I like it.
It does look good. It does look great.
Yeah. Uh Kale put the link to this in um our Discord, but here I'll also share it on GitHub or I'll share it in chat too since I can post links.
Yeah. WW This was made by Kale JK.
Oops. Crap. I did it again.
And then this was made by Kale on Twitch.
Shout out. Yeah, of course, man. I mean, I hope you like it, too. You know, I'm sure you built it for yourself, but I hope uh I hope you like it, too. But I like it. I'll definitely use it. I would have just I would have just gone and built one myself, and now I don't have to.
Okay. Very attic. Uh spread operator.
Nice assignment. We need to sum up the cost of all individual messages so we can send an end of month bill to our customers. Complete the sum function to return the sum of all inputs.
Okay.
Oh, also, but I probably I probably need to This doesn't play. Does it play any sound? I probably have to have this uh like visible, don't I?
Test one, two. I see you. I see you. I see you. Caffeinated minds. Also, thanks for becoming a member. When did you become a member? And why didn't I get an alert?
What the hell?
Dude, yeah. Thank you so much. That's so that's so kind of you. I don't know why I didn't get a why I didn't get an alert. Let me look at streamerbot.
Huh?
Am I not connected to I'm not connected to stream elements. I think that comes through stream elements.
No, I'm logged in. Huh. I don't know why that didn't work. I'm I apologize for that, but I'm giving you a shout out now. Thank you very much, man. That That's very kind of me or very kind of you, and you don't know how much it means to me for someone to support my channel like that. So, thank you very much.
Uh, the test was to check if my name changed color or the site needs a refresh. It should change color. Well, thank you very much, man. I appreciate that.
Just going to see if I could um if I could fix this.
Huh?
It did not come through and I don't know why it's come through in the past.
So I don't know what's changed.
Welcome to the party, pal.
>> Yeah, see that's what it should that's what it should do, but I don't know why it didn't do that.
I might have to spend some time debugging that after stream. No problem.
Happy to support. Well, man, I'm I It's too kind. It's too kind of you.
And let's get your let's get your name added to the list.
Let's get your name on the list. See?
Delete.
Rename. This should be members.
We'll run a little command.net uh YouTube CS and then I'll be right back. I got to I got to flip over to Mel Studio and I got to reload. I'll be right back.
I'm going to go dark for a second.
Okay, I'm back.
All right, now you should see your name on the screen.
Fantastic.
You know, I wonder if that's why I didn't see the gifted the you know, Tyler said earlier I he could that I couldn't see his gifted events. I wonder if that I wonder if something's broken with my YouTube connection.
So, the last new member was a it was six days ago. So, I should have gotten an alert.
That's so weird.
I guess we'll wait to see if any if anything comes through a subscriber or anything like that.
That's all we can do.
Okay, I know I wasted like 10 minutes of this 20 minute cycle, but that was important.
Uh, we so we're here. We're doing I is less than length of nums. We do I ++ excuse me we do total plus equals uh nums at i and then we return We've been asked to add a feature that extracts cost for a given day. Complete the get day cost function using the append function.
It accepts a slice of cost strrus and a day int and it returns a float 64 slice containing that day's cost. Uh, a day may have multiple costs. If there are no costs for that day, return an empty non-nil slice.
Okay.
So, let's say why would you return a slice though?
A day may have multiple costs.
Oh, I see. Okay, now I understand. So we do results equals a slice of float 64.
Oh, for I was lagged out there for a second. I apologize.
Okay. Also, if you want to change the alert sound, you can use awave file thing thingo and I can send you the fix if you want in the future. Uh, no. I'm I'm okay with the If there's a default beep in there, that's totally fine.
Yeah. No, no worries there at all.
I don't want to make you do any more work than I don't want you to have to spend any more time on it than what you want.
This is what you what you've built is more than functional for me personally.
I mean, [ __ ] the v the visual is the visual is more than I would have I would have put in there.
Let's see. You've been asked to add a feature that extracts cost for a given day.
I got to know is the visual procedural.
Uh I don't know. Yeah, I'll let Kale Yeah, I'll let Kale uh talk to talk to it.
If there are no costs for the day, return empty. Okay, so we are going to do four cost.
Well, I guess they haven't taught us that yet and I keep using it. I should really be doing this.
uh I is less than length of cost and I ++ and then we'll do if um if cost at this index dot day equals day.
Then we will say append result cost I do value. I think this is what they want. This is what I was confused about. I think this is the condition we're supposed to be checking for.
Uh this should be cost cost value of type float 64 is not used.
Um, what do you mean by that? Line 13. It's this line.
Yeah, I don't know what that means.
And there's no more coffee.
Um, okay. Let me just format.
line cost I do value should print something, right?
Okay. So why Why doesn't this work?
I don't I don't understand the air I am getting.
Think about what a pin actually does.
Does it modify the slice you pass in directly in place or does it return? Oh, damn it. Yes, you're right. You are right. Yes. Yes.
Okay. Go provides syntactic sugar to iterate easily over elements of a slice.
We need to be able to quickly detect bad words in the messages our system sends.
Complete the index of first bad word function. It takes two arguments.
Message, a single message represented as a slice of words. Uh bad words, a slice of bad words. If if it finds any bad words in the message, it should return the index of the first word in the message slice. This will help filter out naughty words from our messaging system.
If no words are found, uh return negative one.
Okay.
So, let's do negative one.
So we'll loop loop over um I guess I range over message and then we'll Hey for J see let's do message word I guess we are in go so we should use their conventions and we can say bad words over the bad words.
Um so if index of first bad word if message word equals the bad word we return I otherwise return negative one.
Okay. So the only thing I would think here is we probably need to normalize that. So let's do go to lowercase method strings. They haven't taught us about any of this, but wonder if they're sneaky going to try to trip us up.
It's very slow.
It's a very slow algorithm.
We're just We're just brute forcing our way. Uh let's see. Tip. What's the tip here? Remember, you can ignore return values with underscore. So, what's their solution? Did they do a Yeah, they did that, too.
This is very slow.
Very clean logic.
What' you say? I hope you hope you don't get banned. Why?
I would never ban you.
Got some sand asy from Stack Overflow.
Then made 72 grains of dark shade Unicode characters. It converts time percentages into character counts.
Clamping totals against row width to draw sand. That's cool, man. It's very cool. Yeah, I think that's cool how it fills up.
That would have that would have I mean personally just looking at this like I'm thinking about building it and I'm thinking that would have taken me a while to build.
I I'm just not a very fast builder.
Okay. Now what are we doing? slices of slices. Slices can hold other slices effectively creating a matrix or a 2D slice. Eight months with Google. Well, it's it's very impressive, man. That would that would have taken me that would have taken me a while, you know, to figure out the whole math of the rows and the sand and the the making it match up with the countdown and all that.
Yeah, that would have taken me a while to figure out all that math. I would have had to write a lot of tests to to figure it all out.
I get so jealous like when I see though I get so jealous of people when I see them programmers or developers that are just so quick and everything clicks for them and they just you know what I mean?
It just seems like it's all effortless for them. I get so jealous because I feel like I have to work really really hard to to to be even like halfway decently, you know, productive.
Like when I I don't know if you guys saw Did you guys see that last video that uh was the Prime posted about that guy who created FFmpeg?
Um, I guess it wasn't his last video, but it was a recent one.
This guy This video is crazy, man. I You guys should go watch his video. I I didn't I've never I never heard of this gentleman before. His name, what is his name? Um, I forgot it. For Fbris Forbes something, I forgot his last name. Fbris Ballard.
And I was just listening to him like list off all the accomplishments of this guy and I was just like, "Oh my god."
And if you go, this is his website, you know, and you read through all these and you're like, he did what? And then he did what? And then he did what?
And I'm over here like, how do I square root this?
Yeah, FFmpeg's wonderful. I mean, what a what a what a I mean, that that single piece of technology, right, has probably made millions, if not billions of dollars for the world.
It's It is God. It really is god tier.
Uh it really is god tier. It's un unbelievable.
He and he also built um he also built that uh Q QMU the virtualization array or whatever that you can use to build like I the only real exposure I have to it is I've used it with Docker to build like a container that's going to run on an AMD machine or not an AMD machine a um an ARM machine on a non-arm machine like Okay. I guess you can just build whatever you want when you're that smart.
Easily trillions. Yeah. Easily trillions. Backbone. Yeah. Backbone of the internet. Yeah. Especially with all the video, right? Yeah.
Man, a lot of that is from good old Google and Stack Overflow. Yeah. But still, it's impressive that you were able to track it all down and grock it and translate it into your translate into code. You know that takes effort, takes work.
You should be proud of it.
All right, let's see if I can finish this before the timer runs out. Complete the create matrix function. It takes a number of rows and columns and returns a 2D slice of integers. The value of each cell is F * J, where I and J are the indexes of the row and the column respectively. Basically, we're building a multiplic a multiplication chart. for example, a 5x10 matrix produced from creating from calling create matrix.
Okay, so we'll we did a lot of this in uh we did a lot of this in advent of code last year when we were solving everything with go. So for i range over rows um and then 4 j range over columns.
Yeah.
Then we are going to say um would we do result is equal to our slice of slice slice of slice in that.
And so we need to build up a kind of intermediate, right? So this will be our let's just call this row and this will be this guy.
So we will do row or we'll do yeah row append and we will append row J or I time J that's the value and then at the end of each row we will call results or append And yeah, that'll get your attention. Damn, I didn't finish in time.
How are you finding the Go Pass so far?
I personally went the TypeScript route.
Uh the Go the Go Pass good. I chose Go over Typescript because I kind of like I think I kind of like Go a little better than Typescript.
Um, I like TypeScript a lot, but I think I like Go a little bit better. Um, and I I've written far more TypeScript than I've written of Go in my life, like in the the time that I've been programming.
So, I figured ah, let's just get some more reps in with Go. But yeah, so far boot all the boot.dev courses have been really good. Um, my favorite one so far was probably if I had to pick so far that we've done probably learn Git was my favorite one.
It's I've never that was the first time I've ever taken kind of like a official course on Git, you know, where somebody like really stepped through each each piece of functionality with visuals and everything. So that was that was pretty good.
Um, well actually I take that back probably learn memory management because I haven't I've never written C before.
That was completely net news. That was probably the most or maybe that's not my favorite but it's the most valuable one I've done so far.
Um, I'm really looking forward to the PubSub architecture as well as the Docker because these are kind of both like git where I've learned them and I use them every day. Uh, or at least I use Docker and Git every day and I've built things with Rabbit MQ before, but I've never taken a formal course on them. So, I think those will be good good cementers or refreshers of information.
But, yeah, so far it's been well worth the couple hundred I spent and it's been fun. I I like the leveling. I like uh that you get rewarded. Um and I'll be excited once I get to the bragging status.
It's the pix tone. Nice. I like it.
It'll get your attention. I like it.
Learn Git was quite useful. Nice to understand Git more in depth. I think my personal favorite has been memory management. opened up my eyes a lot.
Yeah, the me the we just got done doing that. So, we that's what we spent the last um I guess last week or so. So, we spent about a we spent I don't know two or three days going through the course and then we spent four or five days building a um building a little uh emulator, little chip emulator uh which was pretty fun.
Oops.
What do we call it? Chip. We call it chip. I don't know what we called it.
Uh, make build.
Make run.
Oh [ __ ] Did I break this?
When did I break this?
I don't know. We built. But yeah, that's what that's what we spent the last few few or five days doing. It was good.
Caught one of your earlier seams. Was surprised to see memory management C.
Nice to know I wasn't the only one struggling. Yeah, dude. It C was hard. I thought C I thought writing C or so far my based on my limited experience. I thought learning and writing C was more difficult than picking up Rust.
myself.
I think I think the thing that makes C a little bit harder is there's a there's there's um not much convenience is afforded to you, you know, and if you come from programming languages where that's not the case, uh it feels a little foreign.
There we go.
I'm hoping C is a good primer for Rust.
Uh I think I don't know. I don't know how much how much will translate. I think I think if you go through C and I think what'll be helpful is if you go through and learn Rust when you're learning Rust and they're talking about pointers and dangling pointers and and things of that nature and they're sort of kind of pointing out the pitfalls of existing programming languages and how Rust deals with them. I think that will be very helpful because you'll be like ah okay that makes like oh I see I see why that's a bene you know a beneficial thing. Um but definitely to me they were they were definitely not um knowing Rust did not help make learning C any easier.
There we go. Time's up.
Russ is more complex, but more exists to help. Yeah, I I I don't know, man. C just felt C felt way more foreign than picking and picking up the other one.
For thumbnail, used the chat GPT. I used uh I used um Gemini for the gopher. The rest of it is just assets I found online or um images that I took and then stripped the background out of. But the gopher, I tried to draw like a monster gopher on my iPad, but it was really ugly and looked like a three-year-old drew it.
Uh, so I I resorted to um I resorted to AI shamefully. Shame, shame, shame, shame. But I Yeah, if anybody ever knows a thumbnail artist or person who wants to get into thumbnail artist stuff and would would like to have a client, I would happily I would happily accept referrals. I'm trying to get better at it myself, but I'm I'm just not a very good artist currently.
Oh, also, if you haven't watched this video, you should go and watch it. I'm going to spam chat with this link.
You should watch this.
I can make you using AI. No, but see, I could do that. I want someone I want someone who's like makes a, you know, makes that original make does that trad trad arting traditional art, whatever you want to call it. Uh, and an o an odd but functional option is making thumbnails with 3D software. It would be amazing to watch you learn Blender, for example. Oh, yeah. I've been watching um I actually have watched the last couple days I've been watching uh Zed Shaw on Twitch work in Blender. I guess he's learning Blender and that's been fun to watch. Yeah, but I don't know what what would you use Blender for? Like if you I used to make gaming ones. Nice. Well, if you ever want to take a shot at making programming ones, let me know.
You're on break now. No, now I'm back.
Now I'm supposed to be Now I'm supposed to be back focusing, but uh I'm not going to be controlled by no timer.
No, I'm supposed to be focusing right now.
>> Mark Manula is telling you to lift some weights.
>> Okay. Yeah, that that actually would be a good idea. I need to restart the timer anyways cuz I I [ __ ] it up when I resized the the window.
just make let's see you can fix that by resizing the terminal. It doesn't seem like it's responding to resize events on my side.
I wonder if >> is reminding you to hydrate.
>> Oh, thank you, Mark. I actually haven't dranken a sip of water the whole time I've been streaming this morning.
You can composite the same way with Photoshop and you can post-process with shaders. Honestly, the sky's is the limit as long as you can see it visually. Yeah, I think I just need I need a lot more practice at doing visual things, you know, like I was listening to Zed Shaw talk about how if you can break visual things down into basic shapes and understand how you use multiple basic shapes to construct it, that's kind of like the kind of foundational skill like physical. Yeah, it doesn't seem like it's responding to me.
I mean, obviously I can see when the warning pops up, but for whatever reason, it doesn't seem like the Yeah, it could be. It could be my shell.
You know what I mean?
But I can't seem to make it small and then big again. Small, big.
Or maybe it's maybe it's my terminal.
I don't know. I'm not going to blame your code. I'm just going to blame me.
I'm always the problem.
you know any sites to get free overlay for Streamlabs? So, I do not. Um I do not.
I've only screwed around with overlays once before and it was when I was making some gaming videos and doing some streaming of Call of Duty and I got those overlays from Streamlabs OBS.
I don't know. My bad. Oh, no. You're fine. Oh, no. You're totally good, man.
No big deal at all.
Now you got me thinking about how to not do that.
Don't let me nerd snipe you. Unless you want to be nerd sniped. You know, nerd sniping has derailed many a day for me.
Sometimes I regret it and sometimes I appreciate it.
I think one of my favorite parts about your app is the first time when you load it up and it shows you um it basically shows you like do you have what this app requires to function properly. I really really like that. I feel like that's one I think that's a part of a lot of apps that don't get enough attention like the onboarding and configuration and initialization of applications. I feel like a lot more love and care could go into that process because I also think it's important because a lot of times it's your first experience a user has uh with whatever thing that you built is right.
So I I appreciate that.
I'm planning on using that timer tomorrow morning. Do it. Do it. See Kale's timer is going to be all over the internet all over the world. People will be dependent on Kale Kale's timer.
What is nerd? Uh nerd just refers to like an person who's super super geeked out on a particular topic, but it can in my opinion it can really be anything. It could be programming, could be football, could be lifting weights, Xboxes, techn, you know what I mean? You can be a nerd about anything.
been putting effort into a guide and help overlay view for my current desktop project. Yes, sniff. Well, yep, you can be a nerd about sniffing books. This is this is true. Yeah, Oblivion. I think that's s I think that's such a good you such a good experience when your app has like great help, great feedback, like when things go wrong, if your app can provide users with helpful instructions on what to do.
Like I just think all of that care care and feeding that goes into those user interactions is makes I think it makes a big difference.
So so much attention goes to the happy pass, right? um the the user experience for happy pass, but I feel like sad pass should get equal equal time.
All right, what we're doing here? So we were appending result row then we have to return the results success. I reached level 70.
Let's go, dude.
6.88% of members have earned this achievement.
I'm in rarified air, people. I want you to know you're you're watching a sage at this moment. Just want you all to be aware.
uh why is five the final value in the last index of J? The append function changes the underlying array uh of its parameter and returns a new slice. This means that using append on anything other than itself is usually a bad idea.
Um, Yeah. So J and G point to the same thing.
Why doesn't the bug regarding slices J and G in example two occur in example is one as well?
So we append four.
Yeah, the exceeded. Do you best avoid these kinds of bugs? Don't use the append function. Always assign the result of the append function to a new slice. Always assign the result of the append function back to the same slice.
I am a nerd. Yes, I am a nerd, too. I'm a nerd about a lot of things. That's like the other day when my wife my wife was like, "Oh my god, here we go. You guys really got them started there." I'm not I don't talk much. Like I might say I mean outside of streaming throughout the day, I might say less than 500 words in a given day. I don't know.
I don't talk very much, but man, if if somebody gets me going on something I I'm a nerd about, I won't shut up about it.
But I I'm ain't nerd. Oh, you you are not a nerd, huh? That's okay. You don't have to be a nerd, but it's fun to be a nerd. Being a nerd is kind of like equivalent to being a fan, you know? You just you're really into something, you know? And I think that usually draws out u a lot of passion and I think that's typically good for most people.
Your task is to implement a function that filters a slice of messages based on the message type. Complete the filter message function. It should take a slice of message uh message interfaces and a string indicating the desired text. It should return a new slice of message interfaces containing only names of the specified type.
Okay, we can do this.
We can do this.
So, we'll just go ahead and define our results.
Go ahead and return our result.
We will start our loop. So we'll say four message range over messages and do some filtering.
I'd say I'm a nerd sleeper build.
Geeks are more are more so fanatic. No.
Yeah, I guess so. I guess you could say that. I guess you could say that. I go by this unofficial scale. Jock dork geek nerd.
I like it. I like it. We need to come up with a name for that scale.
I don't know what the name for the scale is, but we need to come up with a funny name for it.
Girlfriend didn't even know I had a PC until we started dating.
That's hilarious. Yeah, I Well, I personally like in congruency. Uh like I've always thought that that's some of the the best or the most interesting people are those people that are sort of in congruent where like well like Kent Beck right like Kent Beck goat farmer master programmer like you wouldn't really think those two go hand in hand or I had a professor in college Dr. Chel. He was the he was my physics professor. Uh and he his PhD was in like something to do with quantum mechanics related like super like smart guy, right? Just like crazy smart. And like looking at him, you you just think he's like a nerdy physics professor, right?
But he was like he was he basically like ran and operated a small farm. So he was also he had this also like this really strong like blueco collar streak to him.
And those things just never to me those are like two things that you you typically don't think of going together like highly trained physicist and quantum mechanics also a farmer like you I really enjoy uh those kinds of overlaps you know yeah nerd evolution goer I'm stuck in an infinite learning cycle uh I I mean that That's probably a good thing, right? Like you always want to be learning. I mean, I think technology is sort of perpet is is kind of marked by perpetual learning. Technology, science, these fields that the whole point of the fields is to like drive progress. You're sort of always learning. But maybe what you mean is you're stuck in like a tutorial hell scenario where you just feel like you're never getting better from all the time spent learning.
Which if that's the case, then yeah, that's no bueno. That's a bad feeling. I've been in that. I've had that feeling before for sure.
Yeah, imposter syndrome. Yeah, imposter syndrome is a thing and I don't know if there's really a way to overcome it other than kind of you almost are like it's almost like proving to yourself that you're capable of things, you know? Um, like the the more hard things you do, the more the ceiling on what you feel competent to achieve, I think gets pushed up a little bit. Um, I mean, I think some amount of imposter syndrome is natural, normal, and probably probably good because it puts a little bit of a chip on your shoulder.
Um, but obviously you don't want it to like prevent you from prevent you from having the confidence to take on or to take on challenges or accept opportunities, right? Because those challenges and those opportunities are what's going to allow you to hopefully continue to build competence and continue to increase that.
I don't I don't know what the term is. I I just always think of it like whatever thing I have to do, I just compare it against the hardest thing I've done in that particular domain. And if I compare if I look at this thing and I think, oh, this was this was much harder. Okay, I can I can I can figure this out, right? Um, so I feel like the more hard things you can do, the higher that ceiling goes and by comparison gives you more confidence that you can tackle other things.
It took me like 25 minutes to like, nah, [ __ ] it. I'll chuck this on GitHub even though I know it's chill. You It looks great, man. Yeah, you should. You should You're You're pro. We're our We're our worst critics, you know? We're all There's nobody that's going to be harder on us themselves nine times out of 10.
Yeah. Fail further, faster, 100%.
Okay, I'm going to finish this one and I think this is going to be it and then I got to go to work.
Success. Oh, I guess I already submitted that. I'll do one more. Okay. As part of the improving security, Text IO wants to enforce a new password policy. A valid password must meet the following criteria. Um, at least five characters long but no more than 12 characters.
Contains at least one character, one uppercase character, contains at least one digit. Implement the isvalid password function by looping through each character in the password string.
Make sure the password is long enough and includes at least one uppercase letter and one digit.
Okay. So, I think there's a couple ways to do this, but I think because so I guess first and foremost we can do this check. We can say um let's see password length is equal to the length of password. So this is our first check pretty straightforward. If password length is greater than 12 or password length is less than five.
we can return false.
Then we're going to need to actually uh going to actually need to range over the character C range over password and How do I want to do this? I guess uh the idea I have right now is just to do simple flags and say like has uppercase and start that as false.
And then do the same thing with has digit.
Start that at false too.
And then we'll at the bottom here we'll say has uppercase and has digit.
And then we'll just do a check on each iteration that says uh if C um assume passwords have only ASKY characters uh isn't C is a C is a C is a see print format.print print line is going to be C run this.
Oops.
C is a C is a rune. I think at this point it's not a string. And I think runes Oh, I think runes are represented by the number, right?
Come on. Yeah. So what we can do is we can go and figure out what the values of the standard Um, let's see. So, these are all valid.
So, that's 61.
61 to 71.
So if C is less than or actually uh if C is less than or equal to 71 or oh and C is greater than or equal to 60.
Then we consider that a digit and we say has digits equals true.
There's got to be some built-in function I could use to do this.
Uh, I'm guessing I could I could search it up. Let's see. 65 to 91. Uh, yeah. Let Well, actually, let's do this. Let's say 97 to 122. 97 to 122.
C is less than or equal to 97.
Also, this is not Python.
says go and c is greater than or equal to oh no this should be 97.
The other number should be what? 122.
Hold on. Does that mean any vas any valid ASI characters you can have spaces?
I honestly don't know what he what that means. Remember that in character and ghost strings are really just bites in the hood. You can compare a character to another character like a or zero to check if it falls within a certain range.
Yeah, but I don't want to I don't want to spell I don't want to spell all those out.
That's too much work.
So actually I need to check for 132 101 132 101 32 101 Okay, let's Fail. Fail. Three pass one fail. So what failed? So password 1 2 3 4 5 expecting false actual false.
So we have pass 1 2 3 expecting true actual is false. So why is pass 1 2 3 false? It should have a digit, right?
Where are we? Pass.
I don't know why that one fails.
I would think P falls in here somewhere.
P is 120.
for the 80.
Th This should be hitting, right?
Oh, these aren't hitting. Why aren't those hitting?
The numbers the numbers aren't working.
So something about the some something about my assumption about let's see rune in go number what does correspond with It is a 128. No, it's a 32bit int is what that number represents.
Oh, so this should be 48 to 50 7. Oh, that's why. 48.
Oh, whoops.
There we go.
No.
Uh, let's see. One, two, three. Short.
Uh, actual is true.
Am I looking at the wrong I think I'm looking at the wrong numbers, aren't I? Decimal.
So, it should be 65 to 90. That's my bad. I'm looking at the wrong numbers.
65 I'm the sweet sound.
Now I'm looking at the render. Now I'm looking at rendering the hourglass in a fixed grid. Do it, man. Do it. It's a pretty timer. It's a pretty timer.
My only my only feature request would be that I can pick the color. That would be my only feature request of of it. Uh um but I'm h I'm happy to continue using it the way it is. It's not a it's not a big deal. But that would be my I guess I could go in and change the source code myself. I have it locally, but I don't know C++ and I haven't looked at the code, so I don't know how much trouble that would be. Uh, but if yeah, but if if you can make the if the color is easy to make configurable or pass it in as a command argument or something, that would be awesome.
Thank you for sharing it with us, man. I I I know you said it took you a minute to consider actually sharing it, but I'm I'm really glad you did. I appreciate it. I know it's hard it's hard to it's hard to create stuff and share that stuff that you've created with with other people um because it it opens you up to criticism and there's a lot of there's a lot of people in the world who get far more um for whatever reason get far more enjoyment out of breaking people down than building them up. But I'm definitely not one of them. So thank you. Thank you very much.
Okay. Well, guys, I got to run off to work. I hope you all have a lovely start to your week. I hope you have a great Monday. And if you're somebody like Kale, I hope you guys had a had a good Monday. And I'll be back tomorrow morning to do more boot.devon.
All right. Hope you guys have a wonderful day. Bye, Kale. And anybody else who's here, I hope you have a good day. Bye. Oh, that was a timer. I forgot to stop it.
Bye. See you guys. Appreciate you hanging out with me.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23