the way you find the solution by opening the manual on the terminal really inspired me.. darn this is the real programming activity... gonna learn more about C
Man I love this stuff. It really makes C feel much more accessible. Forgive me if you've talked about this before, but how do you feel about some of the relatively newer languages like Rust and Zig? (Especially Zig).
They look very cool, I haven't learned them yet, but I do definitely plan to do that - especially Rust since there is an interesting open source project called Ruffle which is written in that language and it would be nice to be able to contribute.
@@nirlichtman Right on. 🙂 I've been learning a little Rust (emphasis on "little"), but I've really liked it. I'll have to check out Ruffle to see what that is about. Zig has been catching my eye lately, so I'd be interested in your thoughts on it if/when you get around to it. I'd definitely watch any videos you share on it!
Rust is focused on memory safety. Example if you never called free() or deallocate memory before, it means your C code has some memory leak. Example you create a variable A this is saved into memory, you need to deallocate it from memory manually. With Rust you are basically writing C but reducing your memory leak (near to zero). On another hand Zig has a different approach, it is not like C at all. It is mostly like Javascript but much better with the speed of C. Easy to pick up. Zig primary goals are easy maintenance and ease of use. Rust is a great alternative to C or C++, Zig is a great alternative to Rust because of it's easy of use (Rust has a steep learning curve btw). People who uses Zig writes low level code, because it is quite complex and Zig leverage that part. Rust will cover 99% of what you need. Go with Zig is you are doing low level programming like writing your own linux kernel for example. Rust is too strict sometimes. Zig let you do whatever you want. Writing safe code in Rust and Zig is simple. Writing unsafe code (mostly low level stuff) in Rust is difficult. Writing unsafe code in Zig is easy. Got it ?
@@BrunoBernard-kn6vtI feel that rusts syntax is just weird. As a c++ coder looking at rust code makes me want to gouge my eyes out. Like what’s the design choice of :’s?? I’d much prefer if I could get that rust safety without ugly syntax
Good video. Have you thought about giving like a 1-2 minute high level overview of what the application is supposed to do and how it works before diving into code and man pages?
Great video! By the way, since we're talking about Rust and memory safety - maybe you can do video about malloc() and free()? Also you may combine it with the topic of strings. I know this is a cliché, but it will be fun to see how you're talking about it in your unique 10-minute style video.
Depending on which version of vim/neovim you're using, you might be able to use the `:Man` command to open the man page in vim/neovim. I use neovim and I mapped that to `k` and that would save all the back and forth between the two tmux panes. Otherwise, you should lookup `:h K` because you can set it to do something similar. Might make the video less clear though.
Yah the :Man command is great but I prefer using man in the terminal on my videos so it will be more universally clear (and not too specific to Vim). Actually, for the windowing in this case I use the built in Vim windows and not tmux.
Nice tutorial Nir, however would you please let me know why you used MAKE instead of CL while compiling this time, unlike previous videos? Is it because you never used Microsoft headers (no MSVC) and it was pure C? Keep up good work, regards!
Thanks! In this video I programmed on Linux so I used WSL with Debian, and I used a trick in which you can run make command without a Makefile and it will use the default compiler, on my Linux setup - the default compiler is gcc.
If you want to do the same in bash, then tmux or screen (great name, I know...) are your friends. They'll be a pain to get used to, but once you are, you'll be happy you spent the time. Being able to split bash into separate panes and/or pages is invaluable.
Your videos are very refreshing. A question. When I run on linux "man sockaddr" - "No manual entry for sockaddr". I run (WSL/Ubuntu) - what more do I need to install? Keep em coming
@@nirlichtman The error where it will still count the resource as busy, I found you had to use SO_REUSADDR and the error got away! Thank you again for the great video btw
רמה גבוהה ביותר. יש לך סגנון ייחודי, מסביר מה אתה עושה בלי הקדמות מיותרות. אהבתי במיוחד את השימוש הנרחב שלך בדפי מן, מראה איך להגיע לפתרון מהר בלי לרוץ כל שנייה לדפדפן.
Excellent video! Good content! Nir, please explain to us how we can prepare a Windows machine to compile in C just like you do. The make file is not in git. Make is an instruction that gcc implicitly does? In the past, I used Clipper5 and Make and CL were batch files that created an EXE from a source program. We also want to know, how did you install the Tile Windows Manager? What her name? How can we install it? Thank you! Congratulations, you are the best!
Thanks! :) In this video I am using WSL with Debian. About the make command, it is possible to run make without a Makefile, in which case it will just use default rules and all I need to do is pass the name of the C file - in my setup it will use by default gcc to compile. The tiling window manager I use is called dwm-win32, more info about the setup in the welcome link on my channel.
@@nirlichtman Thanks Nir, Your videos are very good. It is a good gift for learning. Thank you for supporting us in learning more about C Language and other computer science things.
Do you write these programs for reference before doing these videos? Or do you just know the std lib that well? Man pages are great; it's why I love unix-type OS's and C but I run into the "don't know what I don't know", problem where I'm happy to RTFM if only I knew which utilities to check given the functionality I need.
Before making these videos, I write a POC to practice and make sure I know all the functions needed. During when I write the POC, I mostly like working with the man pages whenever I can and also exploring additional functions by starting with functions I know and then at the bottom of the man page there is "see also" which helps discover more stuff. If you want some tips to navigate man pages, I have a video on that :)
did you know that hitting Shift-K at the start of a word in vim searches for its manpage in a new window? cool trick that seems like it would have applied a lot in this video
Yah Shift+K is cool, but the problem is that the window that is opened fills the whole screen and I like working with the man pages in a split view with the code. There is also the :Man command which does open the man page in a new split Vim buffer, but I still prefer working with the "man" command in the terminal (on my videos) so it won't confuse people that are using editors other than Vim.
In this video I used dwm-win32 but I recently decided to stop using it due to bugs and overcomplication of the code, I am now working on making a new minimalist tiling window manager for Windows which I also started using myself (my most recent video is about this project)
@@nirlichtman Interesting, I've started playing around with dwm-win32 and I do notice some bugs. Will follow the development of your window manager. Great stuff!
How do you open a terminal split on top inside vim? I don't see you first splitting and then running :terminal. Or have you just set a keymap for that?
@@pajeetsingh I see now that the first time he opens the terminal he does just run :term but usually that just opens a terminal instead of the editor, not split.
Hey! Can you please show how to use unicode strings in C? For example, how to make this chat send not only english messages? Thank a lot for your videos!
Actually, this chat program also supports international UTF-8 languages, since it just sends the bytes of the messages and doesn't do anything specific that assumes the characters are ASCII only, but I do plan a video about UTF-8 and UTF-16, interesting topics :)
@@NostraDavid2 I have a struct struct node { char something[10]; struct node *next; } I have different values to add into node.something through a function function add(struct node **n, value) i'm tottaly blind on how i'm gonna add values to this node and continue to next, because the function is being called inside a loop
Interesting try running it with ltrace/strace to see if there is any problem, also you can check the link in the description to view the code I wrote in the video
@@nirlichtman Retried it on ubuntu and it works as expected. I guess it was an issue of incompatibiity with Mac headers. I thought since Mac is unix it should work.
@@nirlichtman coming here 1 month later to ty for this video, i had just copy pasted ur code and played with it but now i completely understand it, even bitwise ops! : D
great video, but i have problems with this on mac, when i start server and client it works but when i write someting into console it doesnt show up on other side have a wonder full day everyone reading that :)
Don't worry, I worked as a programmer in 2 startups before I decided to go to University, I can indeed find a job as a programmer, but I decided to study in order to learn the theoretical side of CS and open more options.
Windows as os with a custom tiling window manager, running Linux command shell using WSL and vim as your editor. A combination I've never seen 👏
what the actual fuck? how do you do that?
i thought it was just a themed terminal application to look like the terminal from win 11
actual psychopath
@@guigs4467 yes a bit
talk to those who uses a old pc where he do tasks like linux on windows 10.
I love the way you just get right down to the business of writing code, it's so refreshing.
the way you find the solution by opening the manual on the terminal really inspired me.. darn this is the real programming activity... gonna learn more about C
The C classes I _should have taken_ 😅 better late than never
You have a great skill in using man pages btw
Literally RTFM
Man I love this stuff. It really makes C feel much more accessible.
Forgive me if you've talked about this before, but how do you feel about some of the relatively newer languages like Rust and Zig? (Especially Zig).
They look very cool, I haven't learned them yet, but I do definitely plan to do that - especially Rust since there is an interesting open source project called Ruffle which is written in that language and it would be nice to be able to contribute.
@@nirlichtman Right on. 🙂 I've been learning a little Rust (emphasis on "little"), but I've really liked it. I'll have to check out Ruffle to see what that is about. Zig has been catching my eye lately, so I'd be interested in your thoughts on it if/when you get around to it. I'd definitely watch any videos you share on it!
Rust is focused on memory safety. Example if you never called free() or deallocate memory before, it means your C code has some memory leak. Example you create a variable A this is saved into memory, you need to deallocate it from memory manually. With Rust you are basically writing C but reducing your memory leak (near to zero).
On another hand Zig has a different approach, it is not like C at all. It is mostly like Javascript but much better with the speed of C. Easy to pick up. Zig primary goals are easy maintenance and ease of use.
Rust is a great alternative to C or C++, Zig is a great alternative to Rust because of it's easy of use (Rust has a steep learning curve btw). People who uses Zig writes low level code, because it is quite complex and Zig leverage that part.
Rust will cover 99% of what you need. Go with Zig is you are doing low level programming like writing your own linux kernel for example.
Rust is too strict sometimes. Zig let you do whatever you want. Writing safe code in Rust and Zig is simple. Writing unsafe code (mostly low level stuff) in Rust is difficult. Writing unsafe code in Zig is easy. Got it ?
@@BrunoBernard-kn6vtI feel that rusts syntax is just weird. As a c++ coder looking at rust code makes me want to gouge my eyes out. Like what’s the design choice of :’s?? I’d much prefer if I could get that rust safety without ugly syntax
@@tweetyguy7347 well if you want to move to a better syntax consider zig
one of the best programming videos I've ever seen on youtube. great job!!
Good video. Have you thought about giving like a 1-2 minute high level overview of what the application is supposed to do and how it works before diving into code and man pages?
Thanks! That is a good idea, it can help give more context.
Men i cant get rid of using copilot and this guy doesnt need internet at all, epic dude
Umm.. 23.6K subscribers??? Only??? The fact alone you started writing on 0th second the video began is enough for me to sub tbh
Thanks :)
Very good video !! Loving those short tutorials.
I've done quite a similar project but not by using socket but UNIX signals.
Pretty neat man. I loved (still loving) C during college
I love how you can just use man for pretty much everything in C. I wish more languages and tools adopted this (but its a lot of work)
Did something like this on my 2nd year at college :))
Good stuff!
Great video!
By the way, since we're talking about Rust and memory safety - maybe you can do video about malloc() and free()? Also you may combine it with the topic of strings.
I know this is a cliché, but it will be fun to see how you're talking about it in your unique 10-minute style video.
Thanks, yes :)
Another exceptional video, thank you!
Depending on which version of vim/neovim you're using, you might be able to use the `:Man` command to open the man page in vim/neovim. I use neovim and I mapped that to `k` and that would save all the back and forth between the two tmux panes. Otherwise, you should lookup `:h K` because you can set it to do something similar. Might make the video less clear though.
Yah the :Man command is great but I prefer using man in the terminal on my videos so it will be more universally clear (and not too specific to Vim).
Actually, for the windowing in this case I use the built in Vim windows and not tmux.
The peace is perfect, not to slow not too fast 🎉
I love your content! Could you write a minimalist regular expression engine at some point?
Thanks :) Yes, that is a good idea!
Nice tutorial Nir, however would you please let me know why you used MAKE instead of CL while compiling this time, unlike previous videos?
Is it because you never used Microsoft headers (no MSVC) and it was pure C?
Keep up good work, regards!
Thanks! In this video I programmed on Linux so I used WSL with Debian, and I used a trick in which you can run make command without a Makefile and it will use the default compiler, on my Linux setup - the default compiler is gcc.
I never knew C can do these things
Keep up the amazing work, it is fun to see :)
I’ve always wondered how async code waits for IO. Bow I know, the poll function. Thanks
Poll is very useful in case you don't want to fork another process and still need to wait for more than one file descriptor
learned a lot from this video. thanks
Thank you very much for this content.
How did you split your terminal lile that? It looks nice
Thanks! I use the window splitting feature built-in Vim, I have a video about that on my "Vim Tips" playlist
If you want to do the same in bash, then tmux or screen (great name, I know...) are your friends. They'll be a pain to get used to, but once you are, you'll be happy you spent the time. Being able to split bash into separate panes and/or pages is invaluable.
I dont write C but man you make it look easyyy
Great vidddd❤❤
this channel is a fucking gem..
Your videos are very refreshing. A question. When I run on linux "man sockaddr" - "No manual entry for sockaddr". I run (WSL/Ubuntu) - what more do I need to install? Keep em coming
Do you have manpages-dev package installed?
Hey, thanks for the video it was really interesting and the workflow is very nice. How do you get rid of the error while binding?
Thanks! to which error exactly are you referring ?
@@nirlichtman The error where it will still count the resource as busy, I found you had to use SO_REUSADDR and the error got away!
Thank you again for the great video btw
I use the Same setup! Nice 👍🏻
Great video as always. I do have a small suggestion to improve your videos. The sound of your keyboard is quite a bit too loud compared to your voice.
Thanks for the feedback 👍
🤍
Love every video that has C or minimalist in the title.
רמה גבוהה ביותר. יש לך סגנון ייחודי, מסביר מה אתה עושה בלי הקדמות מיותרות. אהבתי במיוחד את השימוש הנרחב שלך בדפי מן, מראה איך להגיע לפתרון מהר בלי לרוץ כל שנייה לדפדפן.
תודה רבה! :)
Excellent video! Good content!
Nir, please explain to us how we can prepare a Windows machine to compile in C just like you do.
The make file is not in git. Make is an instruction that gcc implicitly does?
In the past, I used Clipper5 and Make and CL were batch files that created an EXE from a source program.
We also want to know, how did you install the Tile Windows Manager? What her name? How can we install it?
Thank you!
Congratulations, you are the best!
Thanks! :) In this video I am using WSL with Debian. About the make command, it is possible to run make without a Makefile, in which case it will just use default rules and all I need to do is pass the name of the C file - in my setup it will use by default gcc to compile. The tiling window manager I use is called dwm-win32, more info about the setup in the welcome link on my channel.
@@nirlichtman Thanks Nir,
Your videos are very good. It is a good gift for learning.
Thank you for supporting us in learning more about C Language and other computer science things.
Do you write these programs for reference before doing these videos? Or do you just know the std lib that well? Man pages are great; it's why I love unix-type OS's and C but I run into the "don't know what I don't know", problem where I'm happy to RTFM if only I knew which utilities to check given the functionality I need.
Before making these videos, I write a POC to practice and make sure I know all the functions needed. During when I write the POC, I mostly like working with the man pages whenever I can and also exploring additional functions by starting with functions I know and then at the bottom of the man page there is "see also" which helps discover more stuff. If you want some tips to navigate man pages, I have a video on that :)
did you know that hitting Shift-K at the start of a word in vim searches for its manpage in a new window? cool trick that seems like it would have applied a lot in this video
Yah Shift+K is cool, but the problem is that the window that is opened fills the whole screen and I like working with the man pages in a split view with the code. There is also the :Man command which does open the man page in a new split Vim buffer, but I still prefer working with the "man" command in the terminal (on my videos) so it won't confuse people that are using editors other than Vim.
I built a UDP server with audio. Used a relay to get around NAT but sound is cutting. I think I need to implement RTP
Amazing code.
Maybe use a softer keyboard while recording.
great video but i must ask, howd you get dwm working on windows?
In this video I used dwm-win32 but I recently decided to stop using it due to bugs and overcomplication of the code, I am now working on making a new minimalist tiling window manager for Windows which I also started using myself (my most recent video is about this project)
@@nirlichtman Interesting, I've started playing around with dwm-win32 and I do notice some bugs. Will follow the development of your window manager. Great stuff!
How do you open a terminal split on top inside vim? I don't see you first splitting and then running :terminal. Or have you just set a keymap for that?
:sp
@@pajeetsingh This only splits the editor, not open a terminal
He is using dwm I guess so it has bindings to do so.@@Benjaneb
@@pajeetsingh I see now that the first time he opens the terminal he does just run :term but usually that just opens a terminal instead of the editor, not split.
Ok nvm apparently it's just because I use neovim, works like in the video with regular vim
Hey! Can you please show how to use unicode strings in C? For example, how to make this chat send not only english messages? Thank a lot for your videos!
Actually, this chat program also supports international UTF-8 languages, since it just sends the bytes of the messages and doesn't do anything specific that assumes the characters are ASCII only, but I do plan a video about UTF-8 and UTF-16, interesting topics :)
@@nirlichtman Thank you)
how do you get your terminal and file to do that on the same tab?
You mean how I split the source code and the terminal? I use Vim window splitting, I have a video about that on the channel on my playlist "Vim Tips"
My terminal upon entering command "man sockaddr" says 'No manual entry exists :('
What is your setup? make sure you have the relevant man pages package installed (ubuntu/debian: manpages-dev)
its basically like python
help: better way to add data into a linked list without loops or inserting it directly? I need to read a file
What do you intend to do? Create an empty linked list, then expand its size and then add items? I'm unsure what you want to do.
@@NostraDavid2
I have a struct
struct node {
char something[10];
struct node *next;
}
I have different values to add into node.something through a function
function add(struct node **n, value)
i'm tottaly blind on how i'm gonna add values to this node and continue to next, because the function is being called inside a loop
Ecole 42, Minitalk project same like that
we can make with c++ like this ?
what's the name of the font you're using?
Cascadia Mono
please tell me what font you use!
On this vid I use my WSL setup on Windows Terminal and the terminal is configured with the Cascadia Mono font.
I followed this code line by line and compiled it with gcc on mac, but messages are not displayed on the server/client.
check your code thoroughly, cc version and libraries. Try to compile the code you have written in somewhere else.
Interesting try running it with ltrace/strace to see if there is any problem, also you can check the link in the description to view the code I wrote in the video
@@nirlichtman Retried it on ubuntu and it works as expected. I guess it was an issue of incompatibiity with Mac headers. I thought since Mac is unix it should work.
interesting, thanks
Why did you use &?
You mean when I used it to make a bitwise AND? Reason I used & over there is to check if a certain bit flag is enabled
@@nirlichtman you speak funny words magic man, but thanks for the explanation, i shall study more.
You can get more information about this on this article: en.wikipedia.org/wiki/Bit_field
@@nirlichtman coming here 1 month later to ty for this video, i had just copy pasted ur code and played with it but now i completely understand it, even bitwise ops! : D
Neato.
btw the wind sound in the background at 9:12
you need to do a setsockopt SOCK_REUSE or something like that
great video, but i have problems with this on mac, when i start server and client it works but when i write someting into console it doesnt show up on other side
have a wonder full day everyone reading that :)
What do you see when running strace/ltrace?
👍👍!
My fear is that a guy like you doesn't work in programming, so I think what the hell do I have to do to work?
Don't worry, I worked as a programmer in 2 startups before I decided to go to University, I can indeed find a job as a programmer, but I decided to study in order to learn the theoretical side of CS and open more options.
answer, peace or war ?
peace is always better
I hope all of your country's people are like you in this option ;)
The man page is so slow to load on wsl wow.