- 25
- 96 338
Gregg Ink
Ireland
เข้าร่วมเมื่อ 21 มิ.ย. 2014
All things computer programming with emphasis on C and Linux.
1024 subscriber special and the duCx programming language getting into shape!
Gitlab project where you find the duCx source code:
gitlab.com/greggink/youtube_episode_ducx_1024_subs
The duCx playlist, see previous episodes:
th-cam.com/video/lpJX3e-LTRc/w-d-xo.html
My old (not very good) video (part 1) about combinations and permutations:
th-cam.com/video/p7LKDs2wpKQ/w-d-xo.html
Intro (00:00)
duCx recap (0:55)
Changes, this version (01:23)
Drawing a sierpinski triangle in an interesting way (02:01)
duCx code and demo (04:48)
duCx version screen (06:09)
Features discussion and future direction (06:53)
Outro (14:34)
If you believe I deserve a free coffee for my efforts, you can buy me one here: ko-fi.com/greggink
gitlab.com/greggink/youtube_episode_ducx_1024_subs
The duCx playlist, see previous episodes:
th-cam.com/video/lpJX3e-LTRc/w-d-xo.html
My old (not very good) video (part 1) about combinations and permutations:
th-cam.com/video/p7LKDs2wpKQ/w-d-xo.html
Intro (00:00)
duCx recap (0:55)
Changes, this version (01:23)
Drawing a sierpinski triangle in an interesting way (02:01)
duCx code and demo (04:48)
duCx version screen (06:09)
Features discussion and future direction (06:53)
Outro (14:34)
If you believe I deserve a free coffee for my efforts, you can buy me one here: ko-fi.com/greggink
มุมมอง: 229
วีดีโอ
I wrote my own JSON parser. Also, JSON is a terrible standard.
มุมมอง 4.2Kปีที่แล้ว
Link to the code in the gitlab: gitlab.com/greggink/youtube_episode_jsense Timestamps: Intro (00:00) Why JSON? (00:14) What is JSON? (02:15) Why is JSON a bad standard? (03:23) Pothole markers (09:54) Designing JSENSE (13:49) Stress testing JSENSE (21:26) Outro (27:38) The JSON-C video: th-cam.com/video/dQyXuFWylm4/w-d-xo.html If you think I earned a coffee for my trouble: ko-fi.com/greggink pa...
How to compute Sandwich Numbers? ( a.k.a. Langford pairings )
มุมมอง 7342 ปีที่แล้ว
How to compute Sandwich Numbers? Code available at: gitlab.com/greggink/youtube_episode_sandwich_numbers Source for the proof (02:14) : nrich.maths.org/1364 Timestamps: Intro (00:00) What are Sandwich Numbers? (00:02) Pattern when listing combinations (05:41) Discussing the code (07:07) Another approach to listing combinations (13:49) Outro (15:21) To buy me a coffee: ko-fi.com/greggink or Payp...
AI-generated images cannot be copyrighted (for now).
มุมมอง 3.2K2 ปีที่แล้ว
The US copyright office decided there is no copyright protection for AI-generated images. Sources: Actual decision by the US Copyright review Board www.copyright.gov/rulings-filings/review-board/docs/a-recent-entrance-to-paradise.pdf First copyright act www.britannica.com/topic/Copyright-Act-of-1790 Supreme Court decision 1884: caselaw.findlaw.com/us-supreme-court/111/53.html Thoughts by an act...
How to register a domain name (registering, set up DNS, get a certificate, set up HTTPS)
มุมมอง 5412 ปีที่แล้ว
The apache configuration file is available at : gitlab.com/greggink/youtube_episode_register_domain My previous video on CGI file upload: th-cam.com/video/_j5spdsJdV8/w-d-xo.html If you think I deserve a coffee for my efforts: ko-fi.com/greggink or paypal.me/greggink Timestamps Intro (00:00) Registering the domain (01:02) Setting up DNS (05:53) Setting up HTTP (12:20) Certificate Signing Reques...
Why I dislike youtube removing the dislike count.
มุมมอง 1102 ปีที่แล้ว
Here are my thoughts as to why youtube should not have removed the dislike count. If you believe I deserve a coffee for my efforts: ko-fi.com/greggink
512 Subscriber special and creating a Turing complete duCx interpreter.
มุมมอง 2052 ปีที่แล้ว
Find the code on gitlab.com/greggink/youtube_episode_ducx_512_subs My previous video about tc.h: th-cam.com/video/WcN7ryZYUeQ/w-d-xo.html Previous duCx video: th-cam.com/video/lpJX3e-LTRc/w-d-xo.html Preview (00:00) Intro (00:23) Implementing bytecode (04:59) Implementing while loop (16:04) Parsing mathematical expressions (24:52) duCx is Turing complete (43:00) Speed test (46:17) Outro (52:21)...
Webprogramming (CGI) in C: creating a file upload page
มุมมอง 3.3K3 ปีที่แล้ว
Original webprogramming video: th-cam.com/video/rFaRFCyewpA/w-d-xo.html Hashing video: th-cam.com/video/yGjUDh_XxrY/w-d-xo.html Gitlab link for this project: gitlab.com/greggink/youtube_episode_cgi_file_upload If you think I deserve a coffee for my efforts: ko-fi.com/greggink Contents: 00:00 Intro 00:52 Recap Post and Get methods 06:41 upload.c, first version 11:24 upload.c, second version 14:1...
Understanding Pointers, Arrays and Strings. My own version of strtok()
มุมมอง 2.6K3 ปีที่แล้ว
EDIT: there is a bug in my_strtok2.c. On line 23, there should be : i = 0; I did correct it in the gitlab project. As per viewer request, I make my own version of strtok and explains to basics of C required to understand the function. Intro (00:00) Normal strtok() (00:18) Variables & Pointers (02:20) Arrays (10:02) Strings (13:48) Static Variables (17:33) My strtok 1 (19:06) My strtok 2 (23:31)...
What is hashing? How to encrypt all your secrets using C? 🙈 🙉 🙊
มุมมอง 4873 ปีที่แล้ว
The code for the episode can be found at: gitlab.com/greggink/youtube_episode_hashing/ My free e-book about bitcoin: greggink.com/bitcoin My previous video explaining logic gates and other low level stuff: th-cam.com/video/SxX1Xfgn0h8/w-d-xo.html Casey Muratori's Meow Hash: mollyrocket.com/meowhash If you enjoyed this video, you can buy me a coffee: ko-fi.com/greggink Intro (00:00) What is a ha...
256 Subscriber special and the birth of the duCx programming language
มุมมอง 7623 ปีที่แล้ว
Find the code on gitlab.com/greggink/youtube_episode_ducx_256_subs My previous video about tc.h: th-cam.com/video/WcN7ryZYUeQ/w-d-xo.html Intro (00:00) Celebrating 256 subscribers (00:03) Creating a new language (00:51) General design discussion (02:12) duCx: boilerplate code (08:09) duCx: run Hello World (13:26) duCx: escaping quotes in strings (29:51) duCx: Implementing integers (36:08) Outro...
Process special keys ( function keys and other ) in Linux terminal applications.
มุมมอง 1.1K3 ปีที่แล้ว
Apologies for the black border on the left. I have a new monitor and I am not used yet to the new setup. Link for the code on gitlab: gitlab.com/greggink/youtube_episode_terminal_control_2 00:00 Intro 00:20 Naive implementation 03:38 New & Improved tc.h 08:19 Demonstrating new tc.h 14:07 Showing off codeviewer command 16:52 Outro If you believe I deserve a free coffee for my efforts, you can bu...
How to use Pipes in C and Linux
มุมมอง 1.1K3 ปีที่แล้ว
Link to previous video th-cam.com/video/ldHSMIRV9Uw/w-d-xo.html Gitlab link to code gitlab.com/greggink/youtube_episode_pipes 00:00 Intro 00:08 Recap previous video 05:10 Explaining pipes 10:10 Exploring IDE 20:50 Running the IDE 25:40 Outro If you believe I deserve a free coffee for my efforts, you can buy me one here: ko-fi.com/greggink
How to run a program from within a program in C & Linux
มุมมอง 5833 ปีที่แล้ว
How to run a program from within a program 00:00 Intro 00:03 Doing it the easy way with system() 08:18 Doing it the right way with exec* 14:37 Using fork() 16:43 Outro If you believe I deserve a free coffee for my efforts, you can buy me one here: ko-fi.com/greggink
Understanding text for C Programmers (UTF-8, Unicode, ASCII)
มุมมอง 12K3 ปีที่แล้ว
Understanding text for C Programmers (UTF-8, Unicode, ASCII)
Take Control of the Terminal using C (Colours, Move Cursor, Clear Screen and more)
มุมมอง 16K3 ปีที่แล้ว
Take Control of the Terminal using C (Colours, Move Cursor, Clear Screen and more)
What do Computers do? And what are Integers and Floating Point?
มุมมอง 7904 ปีที่แล้ว
What do Computers do? And what are Integers and Floating Point?
How to Master Recursion and Proficiency in Coding
มุมมอง 7804 ปีที่แล้ว
How to Master Recursion and Proficiency in Coding
A closer look at GCC and the C compilation process
มุมมอง 2.6K4 ปีที่แล้ว
A closer look at GCC and the C compilation process
How to create your own linux command? - C programming
มุมมอง 14K4 ปีที่แล้ว
How to create your own linux command? - C programming
Odds of winning lottery, euro millions, poker [part 2]
มุมมอง 1645 ปีที่แล้ว
Odds of winning lottery, euro millions, poker [part 2]
Odds of winning lottery, euro millions, poker [part 1]
มุมมอง 1895 ปีที่แล้ว
Odds of winning lottery, euro millions, poker [part 1]
probably the only good notation is s-expressions. XML,JSON or other stuff all have problems.
CGI is almost dead! Perl still used by sysadmins, but Pyton are much better. If you wanted to support web development using C, just checkout modern frameworks like an Crow.
JSON is fine. Not being strongly-typed is by design. There are alternative strongly-typed wire format if that's your use case. (e.g. protobuffer) We are on the real world -- people use different languages, run incompatible software versions, will enter garbage data, have to pay contractors to update their software -- JSON allows for sufficient leeway for that (backwards compatibility, fail-safe).
great video - thanks Gregg. This is the glue I was missing in my C studies....
I am asking myself for nearly 40 years: why I am dealing with this? so whatever
Thank you so much for the video! I really enjoyed it
i love your content. your json parser has saved my life at multiple times. hands down the best api among json c parser.
Thanks very much. I appreciate that.
On 6:56 when you say that JSON does not understand arrays I think it is worst than that. You see, JSON does not understand anything right, it is an specification. Arrays in C and low level languages as you say are defined on your words as contiguous memory holding elements of same size to complete. But you see JSON is not a low level language it does not have to use the same definition of array. In the end JSON is just a text file with certain syntactical rules, that is structure. Literals (true; false; null) in JSON are just strings as everything That is why it is so funny to me when people use it as an example of unstructured data which is nothing besides max entropy. But I agree with you that the curse of JSON is too much flexibility and not being able to know better what to expect. On my field of work, this express itself largely as a confusion where people seem to believe that JSON can replace a data model which is a completely different concept. And here is also where constraints come in place! So, yeah agree with you that the lack of defined constraints limit a lot JSON as a data exchange format and causes a large percentage of the headache for most data engineers besides all the business loss derived by the semantic loss given the lack of constraints.
21:00 You could potentially use const char* variadic arguments. So in this case you'd call jse_get("file", "json") or jse_get("file.json") depending on whichever you need
BEST POINTER EXPLANATION ON TH-cam.
25:27 Surprised no one mentioned this yet but that file is "JSON5" and not actually JSON. Biggest change is it supports trailing commas and comments
19:09 if you want to do that in windows you need the termios.h header file and im not sure if this is even possible on dos/windows architecture
Include windows.h and u have the windows API console functions to use
Bastante interesante el video. Gracias por la explicación.
Good Morning I am little bit curious about c language its job scope for development... Could you make video on that
How about introduce the better one.
... and then we'd have N+1 competing serialization standards...
Would love follow up to this. Great video!!
The title should be "How to create a http client GET request in C"
Thankyou I am YET to see a good C multi array string example passed by reference Integer/number are easier to handle For example Char string_array[100][10]; 100 strings Passed by reference & updated by the called function Which will be very useful for C beginners For example
Hi Gregg, fantastic video. Thank you! one question, in relation to ca. minute 13:44. How is the env executed on the browser when the c file is originally meant to be executed with command line arguments? how does one get the command line argument for free? is there a way to compile a c file as if it had been executed with arguments? I hope I made myself clear. I appreciate it, great content!
...btw I tried a few ways. For example, creating an executable bash script and passing that as the file to be read by the cgi. But no success!
What you are seeing at 13:45 was not run in the browser. It was run on a server. The browser merely displays the output of the server. There were no command line arguments, what you see displayed are environment variables. The code to generate that output is seen at 13:38 Hope this helps.
@@GreggInkCodes all clear, thanks! its working now:)
Hey!, I find your content very informative and educational for someone like me who started programming during covid. Please keep it up!
14:15 What's the magic number -12 for?
12 is the length of the string "Hello World!" It is needed to calculate where to display the string so it will be centered.
Also when you use a library (in any lang/framework) you lose control of your project recursively, because you don't control what other libraries that library calls, and what other-other libraries the other libraries call, and so on... Which is where we are today, with exponentially more computers made of expontentially better hardware, connected by exponentialialy faster networks, but still the user experience is slower than it was 20 years ago :(
Please is there any documentation on cursor code just like the color code which is documented in terminal-colors.d 5, i will be grateful if you can help me out thank you
Yes, there is. ( man7.org/linux/man-pages/man4/console_codes.4.html ) I played around with it a bit to test, it's working. e.g. write(1, "\033[30G", 5 ); will move cursor to column 30 of current row.
@@GreggInkCodes thanks bro, it good to know you
While I feel like the video is great, you are able to tell cool things and being interesting. But there are some issues: I also implemented a JSON library myself - multiple times, in C, C++... - I use JSON for describing data in some of my projects (in OSDEV, gltf parsing...). The power of JSON is its simplicity, and generally, the size of the parser. - 3:41 when you say that you would love to have beginning and end markers, we already know when the file is expected to end: when the depth is 0 after parsing the first element. I mean, if you start to see the '{' token, you know that the file has not ended until you have seen the corresponding closing bracket. Also, the error handling should not be inside the JSON data, but should rather be placed outside the management of the standard. I mean, if you open a nonexistent file in an OS, the error is returned in another place, rather than using a fake file that contains 'null'. JSON is used to store errors in an API because it's a whole another abstraction. It's not the JSON parser that returns an error, but the API. I explain later why the degenerates' case makes sense. The beginning and end markers are also placed outside the JSON standard, for example, in a file system, we already know the length of the file, in a request, we know its length... - 5:40 The key isn't the only way to access an element, generally it's like a map, you explore it by its key or by exploring each element by itself. Nothing restrain you from using JSON map for storing things in the form of {name}: {data} and so, using UTF-8 seems logical. Also, for a text based data format, it's not a specific part of the document that is UTF-8 but the whole document. - 7:00 JSON arrays, are implemented in a way that it's easy to implement a recursive JSON parser, for each entry, it's like parsing a whole new JSON document for the current entry. It's just that enforcing a single type for all arrays entry would be slower, because you would have to check each entry type. (for example, A parser that I help to implement a long time ago: (GitHub) brutal-org/brutal/blob/main/sources/libs/json/parser.c ). It seems like you want to map a JSON array structure to a C struct perfectly, and you can do it with the help of unions: struct JsonValue { JsonType type; union { JsonMap map; JsonArray array; float floating; ... }; }; Then you would use everything as a JsonValue, also your document. That's why a document could have just a value (3:23, 3:16), and why an array could have multiple types. It's meant to be implemented that way because a 'Value' could be a literal, an object, an array... You say that it's slower because it doesn't have constraint, but it's false, First, if the speed is the most important component, you should not use JSON but rather a binary format. (But binary formats have their own disadvantages). JSON is aimed at being simple to implement as a recursive parser, and still being easy to edit. And JSON is already fast enough, I mean, at the end, the bottleneck that you encounter isn't your library but the file system/disk itself. --------------- - 11:46 The standard should not contain a minimum value, because it's specific to each implementation. JSON is meant to be used in other specification, or your own. For example, it's used in Javascript. It's used in the GLTF specification, and so on. This means that those specifications may be able to put a value to the JSON limit. Your JSON file is meant to target things it knows in advance (you would not write a JSON file without knowing where it would go ?). The C standard puts a limit on thing (like the variable name length) because it's meant to be used by multiple compilers. But JSON is only generally used to abstract data for another standard. For example, a GLTF file may be massive, (10M +), so a high limit is important, but for a config file, having a 1M+ limit seems overkill. So it's implementation dependent. (same things for 2, 3, 4). -------------- - 14:30 I feel like the comparison is a little bit unfair, because your code doesn't have error handling. Technically, the code on the right doesn't handle it, but the library that he uses does. Have a nice day ! Great work.
I really appreciate this video. I came across it trying to find out how to understand the gobbledegook that is, e.g., "\x1B[0;31m," as I came across similar formats to do a platform-agnostic screen clear. What does all of that represent? It reads to me like an escape sequence, but I'm not sure what exactly it's doing.
I just got the idea to do an exact match search for the string of characters and found that this relates to ANSI 6429--right? Finding this really helps me understand what's going on now.
The "\x1B[0;31m," is a control escape sequence. The "\x," means that whatever follows is a hexadecimal number. Then we have 1B in hex or 27 in base 10. This is the ASCII code for Escape, hence the whole thing being called an escape sequence. What follows after that is just a code to control what you want the terminal to do: change colour, clear screen, etc.
@@GreggInkCodes Thanks! Now I'm even more curious. Do you know the reason they drop the standard leading zero before the x in the hex? Is it for brevity or to be more universally agreeable with compilers and CLI's? Maybe some other reason? And that makes me also wonder what are we "escaping" from? Is it similar to a system() call to the CLI outside of the binary itself?
can you please make the text smaller ?
if you have problem with the work of the professor of this lecture - read a book
hmm ... your header relocation doesnt seem to work for me ... but i tryed just Location: %s and it worked
All code was tested and run on my server prior to making the video to make sure everything worked. I just tested it again to make sure. It is working over here. I cannot tell you why it is not working on your system. Could it be a typo? Did you type in the code yourself or did you download it from my gitlab. Also, bear in mind that your browser could be buffering things.
Nice job. I have done something simlar such as input and rectangle routines but not as organized as this. You have inspired me to update and refactor my code!
Happy to hear.
I tried it in Windows, discovered that there are some includes from the SYS directory which obviously Win doesn't have. But thank you for the lesson!
Pl post more content like this.. very few people look at C for web programming..
Thanks, I have definitely a few ideas for more videos in this series.
Awesome fella!
Neat. Awesome. Good vid. Totally agree with statements regarding independence and familiarity with the tools and language one would use to develop, and the terminal is inescapable (even in Windoze afic). The varied examples and use case scenarios are brilliant, common concerns and illustrated concisely; fantastic work!
Glad it helped.
@@GreggInkCodes Did more than help - it inspired. Seriously. Thank you!
very interesting content; thank you for the time you took to give those detailed and clear explanations; subscribed :)
You are welcome and thanks for the subscription.
why are you including pthreads, I don't see it used in the code
I have a library called "technical" which I use for virtually every project. It contains a range of things including string manipulation functions, file-related functions and code to start another process. "Technical" requires pthreads so it has to be included, even if the specific project doesn't use it.
@@GreggInkCodes ahh makes sense, when I saw it I was like (no way hes splitting the json up)
it is almost like the standard was written by programmers who anticipated writing json parsers, and wanted the "freedom" to change the criteria of there implementation
you actually saved me so much time. I was just going to write a json parser for the same reasons (all libraries I have found are overly verbose), didn't think the standard was so loose, although it is something derived from Javascript so ....
So JSON would be so much better if it only supported American English ? The American Standard Code for Information Interchange? Maybe get a globe - there's a whole world out here that isn't in the USA.
I was not suggesting that JSON should be in American English only. I am European. I have never been in the USA. I have been in France, the Netherlands, Belgium, the UK and Ireland. I speak several languages well (English, French and Dutch) and have at least some level in Esperanto and Italian. I am well aware of what's on the globe. I do recognize that computers have an American bias because of their history. The thing is: that will be true for almost everything in computing. Some Indian programmer with Urdu as a mother tongue still types words like "if" and "while" in his code. And the thing is, that's most convenient for him. Keyboards all over the world might have a variety of layouts (Qwerty, Azerty, Dvorak) but they all have a Western bias. To type Chinese, you will either need a keyboard that covers the entire floor of your office, or you come up with some more sophisticated system based on a more European or American keyboard. The Chinese use a system called "Pinyin"; it is the "foremost romanization system for Standard Mandarin Chinese." (according to Wikipedia) This system was invented by a Chinese person, published by the Chinese government and pre-dates computers. The world isn't perfect and for better or worse, a romanized system is the way for typing code and developing software. My suggestion in the video is that the *keys* should be in ASCII, which doesn't necessarily mean English. In my opinion, that is better for everyone, is the most convenient and would cause the fewest compatibility problems. I made clear in the video that the *values* is the place for emojis and other scripts ( kanji, cyrillic, etc. ). It's a convenient, technical solution in an imperfect world, not a statement of superiority.
@@GreggInkCodes W response.
🤡
7:51 perfect explanation, now I understand C arrays much better
Thanks. Concerning arrays and pointers, I go into more detail here: th-cam.com/video/1yrqGG2KnNY/w-d-xo.html You might be interested.
about ascii keys, it's cool and pretty understandable you don't want emojis in there but it breaks down if you wanted keys written in a language with non-ascii letters. Contrary to popular belief, not all APIs are in English
amazing work thanks
You are welcome.
I appreciate the effort but I cannot read that text
You can make functions static in a header file to make it "local" to that file. meaning any file that includes that header, it wont be able to use that static function. This might be slightly better instead of the prefixes in your function names.
Is there a slight possibility that the owner of the AI may steal your copyright claims by saying his AI was the actual creator of the art instead of you who used the AI to create it? I mean is there any possibility of such claims actually become a law or precedent?
in other words , if you want to write actual useful commands , you are going to need to know the kernel source code
nad what about if i make my own server in bare bone hardware
What about it? As far as the server itself is concerned, I don't see what the difference would be.
@@GreggInkCodes sorry i mean without using linode
@@unLinuxeroMas Still not entirely sure what your question is. If you mean that you want a server in your own backyard, then you will need a special contract with your ISP and specifically request a static IP address. Then you will also have to sort out domain name servers (dns). I think namecheap might offer that service but I am not sure. Everything else should be pretty much the same.
The first video that clearly explained the multibyte codepoint. Thanks!
You are welcome.
Im kind of stupid. So does this mean any AI art created by anyone ever is up for grabs to be used by anyone else with no consequences?
Yes and no. In theory yes, but (and it's a big but) if you use AI art which is based on copyrighted material, you can still expect to be sued. You will be able to defend yourself in court by saying that since it's AI, it's okay. The other party will present a counter like "we own the copyright on those characters, you cannot just use them." Which way the judge will decide remains to be seen.
So far, the approach states take varies. Some recognise copyright of ai generated works. While others don't. The EU recently made recognition of ai generated work possible. This is in contrast to the old traditional view. Whether one approach is better than the other is up to each. However it is likely that the new approach may prove to be detrimental especially to people whose occupation is dependent on their skills, as their works may now be massed produced through AI generations.
First comment pin pls
Keep Going 💪