I think this is the first time I've stopped one of your videos and started actually doing it myself, rather than sitting passively and taking it in. The moment you started doing lists I just felt that this was I problem I needed to try to tackle on my own before seeing someone else do it.
@@jonhoo Gjett'a ^^ I listened to you discussing why it's not trivial to find the right 'e', and my mind started racing. I just reached that point myself in the course, so I'm going to do some chores that I've been putting off, and then I'll get cracking.
I like the way you write a code and tell what the code syntax means, like "rest, until ..len". I learn Rust syntax and libs much faster than reading their docs. Great stuff!
Your thought process is highly insightful and engaging to observe. Thanks for great content. And yeah, topic like that are incredibly interesting (live coding of X). I'd be more then happy watching you'r implementing any kind of DB engine, the same stuff as those folks from codecrafters suggest (clone of docker, git etc), browser engine, SQL parser, interpreter or any possible real thing from the fundamental technology we use every day. For example I'm studying Rust, and trying to fill the gaps in my CS knowledge and indeed, building the real things are incredibly powerful approach. And again, watching you doing things, studying your way of thinking and using the language and tools is a real treasure.
At 2:32:57, you were still passing `t.announce` to `Url::parse` instead of `tracker_url`. That's why it looked like it was stripping off the query params.
I discoverd Codecrafters thanks to your stream. I decided to implement it on my own and only watch your video when I'm absolutely stuck. Funny enough I spent the most time in many of the places where you were such as the issue with json Value not liking the bytes array and then URL encoding these bytes. I hope Codecrafters can improve on this, like maybe do not run the previous steps in their tests and pull in a create for URL encoding for bytes.
Please say you plan to continue this your videos and the way you break things down really helps me see alternative ways of doing stuff.. that said I think a quick refactoring of those calls in your main function would have really cleaned stuff up lol
For dark mode, you could add a CSS rule: `html,img,video, { filter: invert(1) hue-rotate(180deg) }` This inverts the whole page, and then reverts any images back to normal. Easy to put in a bookmarklet: `javascript:(function(){var s=document.createElement('style');s.innerText='html,img,video,{filter:invert(1) hue-rotate(180deg)}html{background:white}';document.head.appendChild(s)}())`
one thing I kept thinking about all the time with the dark mode is, why not use the dark reader extension? He's using firefox, I might be missing something but the extension seems to be great.
@jonhoo In 2:46:40, the unsafe cast Handshake as a slice, you've explained that you can do that because of the #[repr(C)]. Ok, but won't that introduce undesired padding, that the C repr would be generating in the memory?
Did you figure it out? I am beginner in C too but my guess is that since all of them have the same alignment (u8) there is no padding/holes in the struct.
@@siddharthbisht8522 I didn't yet, thank you! Yep, perhaps that's it. Even arrays of 19 u8 have no padding? But anyway, in case we did have a struct with a u32 for instance, we _would have_ this memory padding problem in case we wanted to output its bytes, right? I'm not sure what #[repr(C)] does as well. He says that's why he can treat it as a bytes array in the first instance, but "it's not really what it means directly"...
16:52 -> No, it's not nicer. Before that you had determined that the encoded string starts with 'i', so it doesn't belong to the last branch any longer. Now you can't distinguish between "doesn't start with i" and " it does, but the input is corrupted"
the zero copy trick shown in this video seams very neat but it requires unsafe. I would love a video where you explore this type of optimizations and if/why they are ok and when.
At one point you said that the fat pointer to you unsized struct stores the length of the last field, but the pointer to byte slice would contain the length of the entire thing, so I don't think your unsafe cast is valid. Though I would expect it to be off-by-8 not off-by-7. 😅
When I think of a Software Engineer this is what I mean. Not somenone who learns how to use a framework to make a CRUD. I'm in my path to transition from CRUD dev to real engineer (in my conception)
In networking numbers adresses etc. are always in big-endian. The way I remember it is that it's similar to phone numbers. You always start with the numbers that represent large things like a country then a region to small things like a city then a street...
I'm glad its not just me that's infuriated with crates that aren't configurable enough. I have been trying to use tonic with mutual TLS and they don't provide a way to override the rustls TLS configs except through their builder, which doesn't have what I need. I essentially had to rebuild tonic with tower myself!
Could you please make a video about GenericArray? I also encountered it a lot and never took the time to research, why its needed and how to really work with it.
Just a note here on #[repr(C)], be super careful if you're going to use it like he did (writing bytes directly from/into a struct). #[repr(C)], just means "treat this like a struct in the C language", which means padding/alignment/endianness is totally dependent on the system you're compiling for! "unsafe" is appropriate here, as mismatches in endianness/alignment can lead to behavior that may be "defined" (as he mentions any bit representation of POD is valid), but not what you're intending :)
I kept wondering if the time you put into implementing the tokio codec would be wasted if the platform rejected/ignored your Cargo.toml changes, but the video ended before you ever pushed your changes relying on it 😭
Oh, you mean the life stream? There was a power outage, but I came back maybe 5-10m later. This video has the whole thing, including after I came back (and did that push)
Amazing content. I don’t do Rust, but I learnt, learn the fundamentals, language is just a medium . So I follow you and learn a lot. I did want to get some career suggestions from you , any chance you on discord or any slack community, and I can reach you over dm. Thanks .
I think this is the first time I've stopped one of your videos and started actually doing it myself, rather than sitting passively and taking it in. The moment you started doing lists I just felt that this was I problem I needed to try to tackle on my own before seeing someone else do it.
It's fun isn't it! :p
@@jonhoo Gjett'a ^^ I listened to you discussing why it's not trivial to find the right 'e', and my mind started racing. I just reached that point myself in the course, so I'm going to do some chores that I've been putting off, and then I'll get cracking.
You leveled up 👍
I will gladly spend all my time watching you go through every challenge on that site 😂
This.
Watched the entire thing and i couldn't agree more. Git or SQLite would be a fun one to watch
Yes please they're super interesting. The applied code coupled to reading the different protocols and docs is awesome
This is the kind of programming content, one craves for on youtube! 👏
I like the way you write a code and tell what the code syntax means, like "rest, until ..len". I learn Rust syntax and libs much faster than reading their docs. Great stuff!
Your thought process is highly insightful and engaging to observe. Thanks for great content. And yeah, topic like that are incredibly interesting (live coding of X). I'd be more then happy watching you'r implementing any kind of DB engine, the same stuff as those folks from codecrafters suggest (clone of docker, git etc), browser engine, SQL parser, interpreter or any possible real thing from the fundamental technology we use every day. For example I'm studying Rust, and trying to fill the gaps in my CS knowledge and indeed, building the real things are incredibly powerful approach. And again, watching you doing things, studying your way of thinking and using the language and tools is a real treasure.
I love the idea of teaching you by building something that already exists. I am definetly considering doing this on my own.
At 2:32:57, you were still passing `t.announce` to `Url::parse` instead of `tracker_url`. That's why it looked like it was stripping off the query params.
I discoverd Codecrafters thanks to your stream. I decided to implement it on my own and only watch your video when I'm absolutely stuck. Funny enough I spent the most time in many of the places where you were such as the issue with json Value not liking the bytes array and then URL encoding these bytes. I hope Codecrafters can improve on this, like maybe do not run the previous steps in their tests and pull in a create for URL encoding for bytes.
Best Rust content on RUclips.
Please do part 2!
Now _that_ was an incredible livestream
Please say you plan to continue this your videos and the way you break things down really helps me see alternative ways of doing stuff.. that said I think a quick refactoring of those calls in your main function would have really cleaned stuff up lol
You might like the "Dark Reader" FF extension ;) awesome content as always!
I wanted to say about the same Dark Reader ext. Here you have already did.
For dark mode, you could add a CSS rule: `html,img,video, { filter: invert(1) hue-rotate(180deg) }`
This inverts the whole page, and then reverts any images back to normal.
Easy to put in a bookmarklet:
`javascript:(function(){var s=document.createElement('style');s.innerText='html,img,video,{filter:invert(1) hue-rotate(180deg)}html{background:white}';document.head.appendChild(s)}())`
one thing I kept thinking about all the time with the dark mode is, why not use the dark reader extension?
He's using firefox, I might be missing something but the extension seems to be great.
Please keep doing "impl" rust streams, you are fairly unique in this respect.
Nice, the replay is here! Couldn't be there during the live stream. Good topic.
@jonhoo In 2:46:40, the unsafe cast Handshake as a slice, you've explained that you can do that because of the #[repr(C)]. Ok, but won't that introduce undesired padding, that the C repr would be generating in the memory?
Did you figure it out? I am beginner in C too but my guess is that since all of them have the same alignment (u8) there is no padding/holes in the struct.
@@siddharthbisht8522 I didn't yet, thank you! Yep, perhaps that's it. Even arrays of 19 u8 have no padding?
But anyway, in case we did have a struct with a u32 for instance, we _would have_ this memory padding problem in case we wanted to output its bytes, right?
I'm not sure what #[repr(C)] does as well. He says that's why he can treat it as a bytes array in the first instance, but "it's not really what it means directly"...
16:52 -> No, it's not nicer. Before that you had determined that the encoded string starts with 'i', so it doesn't belong to the last branch any longer. Now you can't distinguish between "doesn't start with i" and " it does, but the input is corrupted"
the zero copy trick shown in this video seams very neat but it requires unsafe. I would love a video where you explore this type of optimizations and if/why they are ok and when.
Looking forward to part two, if you make one!
Thank you for such content. It instils nice coding habits of mature engineers to newbies like me.
What shell magic are you using for the typeahead/autocomplete directory name at 4:09? Is that a zfish thing?
At one point you said that the fat pointer to you unsized struct stores the length of the last field, but the pointer to byte slice would contain the length of the entire thing, so I don't think your unsafe cast is valid. Though I would expect it to be off-by-8 not off-by-7. 😅
Yep, that was indeed one of the bugs! See github.com/jonhoo/codecrafters-bittorrent-rust/compare/f71ed3d223acbceaa42fea220f774f9aba8f56c9...HEAD
1:23 That's just sponsorship minus the good part of money 😂
2:25:00 I agree it is pretty stupid, why not #[serde(skip)]?
if you don't mind, could you update your dotfiles in your repository? I would like to try out your setup!
github.com/jonhoo/configs
@@jonhoo wow thanks for sharing !!
When I think of a Software Engineer this is what I mean. Not somenone who learns how to use a framework to make a CRUD. I'm in my path to transition from CRUD dev to real engineer (in my conception)
Great stream! Thanks a lot! Looking forward for part 2… 😅
In networking numbers adresses etc. are always in big-endian. The way I remember it is that it's similar to phone numbers. You always start with the numbers that represent large things like a country then a region to small things like a city then a street...
I'm glad its not just me that's infuriated with crates that aren't configurable enough. I have been trying to use tonic with mutual TLS and they don't provide a way to override the rustls TLS configs except through their builder, which doesn't have what I need. I essentially had to rebuild tonic with tower myself!
2:31:47 - it's not cutting off info_hash, you shadowing tracker_url and all it's params by parsing just announce on the next line.
Hi, have you shared your Neovim config previously?
Great video, looking forward to pt2
@jonhoo Would be awesome if you did a Decrusting the Bevy engine crate!
Could you please make a video about GenericArray?
I also encountered it a lot and never took the time to research, why its needed and how to really work with it.
Link to your chair? Would you recommend?
amazing. I was wondering if you could share your nvim dotfiles ?
The next best thing to pairing with an expert!
Just a note here on #[repr(C)], be super careful if you're going to use it like he did (writing bytes directly from/into a struct). #[repr(C)], just means "treat this like a struct in the C language", which means padding/alignment/endianness is totally dependent on the system you're compiling for! "unsafe" is appropriate here, as mismatches in endianness/alignment can lead to behavior that may be "defined" (as he mentions any bit representation of POD is valid), but not what you're intending :)
Do you file bugs in projects when you encounter chaos like the url params stuf?
My favorite part by far is talking out loud while you're tackling a problem you haven't "practiced" before the stream
A wild chaos move appeared! 44:23 😂
I don't understand where the 1
Oh, yeah, you're right, that's entirely a brain fart on my end I think!
love this content, more "real life issues" if you ask me
I kept wondering if the time you put into implementing the tokio codec would be wasted if the platform rejected/ignored your Cargo.toml changes, but the video ended before you ever pushed your changes relying on it 😭
Oh, you mean the life stream? There was a power outage, but I came back maybe 5-10m later. This video has the whole thing, including after I came back (and did that push)
Very beautiful code.
20:27 - Cat confirmed employed.
Better be paying a decent wage man, they be hungry out here on a budget 😂😂😂❤
Great content,. Thank you
The last chunk size bug is not trivial to find😂
2:33:20 I really feel your pain!
chaos move!
Yeah, I been stuck in the URL part for a week hahahaha
Great
wooooah, that service is expensive! really makes me want to make my own (much worse) version of it lmao
23:26 you made mistake, it's not "rest" but "rust" 😂
🫡 Please do more videos like this, Highly insightful !!
Amazing content. I don’t do Rust, but I learnt, learn the fundamentals, language is just a medium . So I follow you and learn a lot.
I did want to get some career suggestions from you , any chance you on discord or any slack community, and I can reach you over dm. Thanks .