Programming thread

Where does one go to start learning assembly anyways? X86 stuff I mean. I learned 6502 asm on a whim, which is pretty easy, but x86 makes my head hurt.

I used the book by Kip Irvine, but if you have prior experience it's not too hard to understand.
I have a short degree in programming and have been working on the backend and APIs of websites for the past five years, every once in a while I start feeling inappropriate (either due to some code challenge or job requirements) and right now is such a time.
I wanna brush up on some concepts and learn others (like list comprehension, lambdas) and also read up on design patterns. What resources (books, tutorials, videos, etc) would you recommend for that sort of thing?
In the case of lambdas and list comprehension I want something that cares more about teaching the concept and how/when to implement it than something that just tells you how to do it.
You want ways to study various programming concepts in depth, or specifically those? Cause depending on the answer I could say either "pick up the gang of four book 'Design Patterns'" or combine videos, books, and discussing these things with others to get a good handle of those concepts and their motivations, etc (I'd recommend talking about them anyway, concepts like lambda expressions can be a little tough to understand not because they're complicated but because their purpose might seem a little obscure without clarification)
 

I used the book by Kip Irvine, but if you have prior experience it's not too hard to understand.

You want ways to study various programming concepts in depth, or specifically those? Cause depending on the answer I could say either "pick up the gang of four book 'Design Patterns'" or combine videos, books, and discussing these things with others to get a good handle of those concepts and their motivations, etc (I'd recommend talking about them anyway, concepts like lambda expressions can be a little tough to understand not because they're complicated but because their purpose might seem a little obscure without clarification)
The former and I have been meaning to give tht book a read for some time now.
As for why I named those two concepts: they came to mind since I recently had to solve some code challenge and stuff from work which when I finished, told myself. "this could be a lot cleaner/shorter".
I have always struggled with lambdas in general due to them not being very readable and thus I try to avoid them, same goes for list comprehension in python. I want to at least be able to implement both without always having to rely on stackoverflow or the like.
Reading the previous replies did help me understand list comprehension a little more so maybe I am making them out to be more complicated than they really are.
 
The former and I have been meaning to give tht book a read for some time now.
As for why I named those two concepts: they came to mind since I recently had to solve some code challenge and stuff from work which when I finished, told myself. "this could be a lot cleaner/shorter".
Where are you getting code challenges from, king? Sites like CodeAbbey are pretty nice. (My experience with the same is that it's not quite as math-intensive as Project Euler.)
 
Where are you getting code challenges from, king? Sites like CodeAbbey are pretty nice. (My experience with the same is that it's not quite as math-intensive as Project Euler.)
It was one of the company I'm applying for websites.
I'm not into code challenges at all but it is nice to know about that one, I enjoy little coding "puzzles" from time to time.
 
It was one of the company I'm applying for websites.
I'm not into code challenges at all but it is nice to know about that one, I enjoy little coding "puzzles" from time to time.
Exercism is another good one, and there it's easy to see how others solve problems and even get mentoring. I mention these because they're a very good way to get up to speed with the various tools any given programming language offers you, as with comprehensions in Python.
 
"You should never write your own software, just use libraries!!!" - not a nigger, apparently. Whether it is more niggerlicious to 'npm install left-pad' or to write a 3 line function? Everyone wants to nitpick the XML example and assume you're writing an xml library that parses millions of unknown files. Nigger, what if you have one 30 line xml file, do you need an xml parsing library or do you need to have your head examined? What if it's a static corpus of xml? It's just like a Rust developer to start crying about safety and muh wheels when they don't even know the constraints or what's being built. It's just an observation that dependencies have hidden cost, but NIGGERS who write in these managed languages with package managers want to cry because their zero-cost abstractions in fact have cost that they ignore or don't understand.
As the guy who wrote a JSON parser in rust a few pages ago, just use the damn library. There's nothing to gain from shoehorning what should be a fun side project into your production codebase at work. I'm not saying never write your own libraries and applications, you absolutely should write your own libraries and applications where existing solutions are insufficient, or just for fun.
Do you really want to put in extra time and effort to write some shitty parser at your job for Mr Niggercorp and then be contractually obligated to license it however they want to license it, just to have to then justify that money you wasted spending the time to implement a less robust version of what is already out there to whoever pays your salary? Unless you're the one allocating funds for the work, or it's some truely bleeding edge software without the library ecosystem available, just use the damn library for Mr Niggercorp's piece of shit web app. Mr Niggercorp would kill you and sell your organs if he could get away with it. Don't give him an inch more than what you're being paid to do.
 
I've already tried that. One guy wrote a sh program that took the last line of such output. It works decently for some values and not others. In Glibc, the value of MSG_TRUNC is MSG_TRUNC, because the value is also what passes for an enumeration type there. This doesn't help with the types either. I've used GNU GLOBAL and cscope, to no avail. I really shouldn't be surprised that something done automatically in Lisp would be a massive pain in the ass to do manually with the C language, but it certainly seems to be.
Depending on how far you want you go you could use LLVM as a library and write a little program to spit out the data you need, if your on Linux you should be able to install it from the package manager. As far as the types, the only type information you need is sizeof(var), I would just write a simple program to spit out the information into stdout and redirect that to a file and read that into a bindings generator in lisp or whatever language you need. Sorry I'm not too familiar with lisp so haven't tried using c with it
 
  • Like
Reactions: UERISIMILITUDO
Depending on how far you want you go you could use LLVM as a library and write a little program to spit out the data you need, if your on Linux you should be able to install it from the package manager.
I thought about that, but the documentation I saw was incomprehensible.
As far as the types, the only type information you need is sizeof(var)
It's actually even more complicated than that. So, the little program I showed verifies some integer macro values and typedefs. Ada has a package Interfaces.C which exposes types like Unsigned, Long, and Size_T for their corresponding types, but not types like ssize_t and the gay little shit like socklen_t. What I've shown isn't even the entire problem, however.

The sockaddr structure has a consistent size of sixteen octets across UNIXen, but an annoying little deviation between them. Here's the GNU implementation, or close enough:
C:
struct sockaddr
  {
    sa_family_t     sa_family;      /* Address family */
    char            sa_data[];      /* Socket address */
  };
C:
struct sockaddr_in
  {
    sa_family_t sin_family;
    unsigned short int sin_port;
    struct in_addr sin_addr;
    unsigned char sin_zero[8];
  };
This looks simple, albeit retarded, enough. For reference, here's the FreeBSD implementation of the structure:
C:
struct sockaddr {
    unsigned char    sa_len;    /* total length */
    sa_family_t   sa_family;    /* address family */
    char        sa_data[14];    /* actually longer; address value */
};
Notice that sa_family_t is a short in GNU, and a char in others. That worthless sa_len field is always set to zero, even though its very name calls it a length. Amusingly, a big endian system would hide this difference when treating the two as one, but little endian is the UNIX hacker's common choice.

At least something like the linger structure is simple and consistent across systems. The sockaddr structure actually violates aliasing rules, and basically requires an exception just to work:
C:
struct linger
  {
    int l_onoff;                /* Nonzero to linger on close.  */
    int l_linger;               /* Time to linger.  */
  };
It's impossible to fuck this up, at least.
Sorry I'm not too familiar with lisp so haven't tried using c with it
This is for an Ada library I've already written, but want to make easier to port and test. Common Lisp has variable interaction with other languages, due to its variety of implementations. ECL, as an example, provides a special form that allows for the direct execution of C language code, FFI:CLINES and FFI:C-INLINE.
 
I am interested in looking into programming, but I am overwhelmed and don't know where to start.

Where should I start learning to program/code?
What kind of programming? There's a great deal of difference between programming a video game, a programming tool, a real-time system, and some WWW nonsense.
 
I am interested in looking into programming, but I am overwhelmed and don't know where to start.

Where should I start learning to program/code?
I started in middle school many moons ago but Automate the Boring Stuff with Python is widely touted as a great way to get started. Don't let anyone tell you you're a poser unless you use something like Structure and Interpretation of Computer Programs because even John Carmack has had a hard time with it.
 
That is highly dependent on what you want to program, mind sharing more specifics?
What kind of programming? There's a great deal of difference between programming a video game, a programming tool, a real-time system, and some WWW nonsense.
I think small desktop programs caught my fancy. It's not the most useful thing to learn but I like the feel of those crappy Java applets I use at work. Game programming is cool too, but making an engine sounds very hard, even for a 2d platformer or simple JRPG.

I don't have anything too practical in mind, I just like the idea of tinkering.

I started in middle school many moons ago but Automate the Boring Stuff with Python is widely touted as a great way to get started. Don't let anyone tell you you're a poser unless you use something like Structure and Interpretation of Computer Programs because even John Carmack has had a hard time with it.
Oh yeah.

Online I see two schools when it comes to learning to program, the more old School SICP recommending people, and the newer "programming is easy actually" crowd. Programming circles have their culture(s), and a ton of e-celebs/grifters who are out there to sell the dreamjob. It's not easy to separate the fluff from the crunch from the outside.

In school we had Turbo Pascal, lol. I sometimes dabble with VBA, but I am so burned out of my work, I can't be bothered to make it any more efficient. I won't be getting paid more. I remember when people used to recommend to start with The C Programming Language book.
 
I think small desktop programs caught my fancy. It's not the most useful thing to learn but I like the feel of those crappy Java applets I use at work. Game programming is cool too, but making an engine sounds very hard, even for a 2d platformer or simple JRPG.
You do not need to make your own engine to make a game, I would recommend Godot (or rather its recent fork - Redot). They have a pretty good manual that covers the basics and should help you get started, there is also an independent site that offers both free and paid tutorials which are apparently good, but I haven't looked at them. I am learning redot right now and its pretty fun. Some people use it to create normal programs as well, for example DungeonDraft is written in godot.
I remember when people used to recommend to start with The C Programming Language book.
I really like the C language, but I probably wouldn't recommend it if you are trying to do graphical stuff, I haven't read the book.
 
Game programming is cool too, but making an engine sounds very hard, even for a 2d platformer or simple JRPG.
You would be surprised how simple it is to make 2D platformer using something like SDL or Raylib.
If you focus on making simple games then I think gamedev is one of the best ways to get into programming.

I personally can recommend Game Programming Patterns, but that's not a beginner book. You can pick it up after learning basics.
 
Why did they fork -- to get away from troon shit? I notice a lot of documentation is carried over, but the call for moderators has been deleted, and I can't find a girlCoC.
Basically. A few months ago the Godot moderators had a huge spergout after posting that they are "wokot" and proud and banned everyone who thought it was weird for an engine to be political, and then banned everyone who thought the banning was excessive.
 
Basically. A few months ago the Godot moderators had a huge spergout after posting that they are "wokot" and proud and banned everyone who thought it was weird for an engine to be political, and then banned everyone who thought the banning was excessive.
That's just how many open source projects will end up. Weirdos show up, overtake it and kick out everybody they don't like. Same goes to any space that's not openly hostile to Bluesky users.

You would be surprised how simple it is to make 2D platformer using something like SDL or Raylib.
If you focus on making simple games then I think gamedev is one of the best ways to get into programming.

I personally can recommend Game Programming Patterns, but that's not a beginner book. You can pick it up after learning basics.
I've bookmarked the link.

I can imagine it working out, I've been playing some NES games lately and I really admire their simplicity.

You do not need to make your own engine to make a game, I would recommend Godot (or rather its recent fork - Redot). They have a pretty good manual that covers the basics and should help you get started, there is also an independent site that offers both free and paid tutorials which are apparently good, but I haven't looked at them. I am learning redot right now and its pretty fun. Some people use it to create normal programs as well, for example DungeonDraft is written in godot.
Yeah, I heard about Godot, they say it's rather good for 2D stuff.

I really like the C language, but I probably wouldn't recommend it if you are trying to do graphical stuff, I haven't read the book.
Is plain old C still being used? For embedded systems or something similar?
 
Back