Programming

0 readers
1 users here now

A magazine created for the discussion of computer programming-related topics.

Rules

Please keep submissions on topic and of high quality. No image posts, no memes, no politics. Keep the magazine focused on programming topics not general computing topics. Direct links to app demos (unrelated to programming) will be removed. No surveys.

founded 1 year ago
MODERATORS
1
 
 

after lusting for a copy of andré lamothe's Black Art of 3d Game Programming for years, i finally found an affordable copy

it does not disappoint. one of the fatal flaws of 95% of 3d game programming books is that they jump straight into mathematical proofs, instead of explaining in human terms how concepts are relevant to making a game. lamothe's programming concepts are clear, easy to understand, and provide real-world examples before diving into code

to my delight, the book doesn't limit itself to just 3d. it covers every conceivable topic for building a game engine from scratch in MS-DOS - and includes some great chapters on FM and wavetable synthesis!

#programming #c #retroGaming

A four-inch-tall coffee cup sits beside a girthy copy of the book, rising 2/3rds up the cup's side.
A page from the book, showing how FM synthesis works on sound cards. Two diagrams describe how FM synthesis is produced over time.

2
 
 

#POSIX #C #programming

So, you want to launch some external tool. Ok, fork()/exec() is simple enough.

But you don't want to "care" for it (wait()) if it's running longer. Ok, just fork some intermediate child, init will adopt it when this child exits.

But wait ... you do want to know if execution itself fails ... or if the tool exits "somewhat quickly" with an error. Okay, this will be interesting ...

Seriously, I'm quite unsure whether this code here is correct. But it's surprisingly large for that "simple" job.
https://github.com/Zirias/xmoji/blob/master/src/bin/xmoji/xdgopen.c#L56

3
 
 

#Python 3.13 released with new and improved interactive interpreter, experimental free-threaded build mode, experimental JIT, support for type defaults in type parameters, and more https://pythoninsider.blogspot.com/2024/10/python-3130-final-released.html

#OpenSource #programming #Linux

4
 
 

#X11 #programming #tales – the magic pager powers! 🤩

There's a general problem with windowing systems and desktop environments. You can do stuff with windows like, bring them to the front, activate them, move them to a different virtual desktop, and so on. That's nice until something bad happens like a user accidentally typing sensitive stuff into a wrong window ... or maybe just annoying the user.

So, windowing systems started to do things to prevent this. E.g. they just ignore something an application wants to do ... or replace it with something different (hey, this window wants to be activated, let's flash it in the taskbar instead).

But then, there are very valid usecases where e.g. bringing a window to the front is most likely exactly what the user wants. While implementing single-instance mode (which I plan to make optional of course!) in #Xmoji, I had such a usecase. So, the user only wants to have a single instance of that app running. Yet the user starts it again ... 🤔 the natural expectation would be that the already running instance appears on the screen as if it was newly started, which is, of course, on top ...

Well, enter #EWMH (which is used for communication with the window manager additionally to #ICCCM in all "modern" environments). They identified that pagers always have valid reasons to do anything to windows. So, they added a field to lots of requests, the "source identifier", which must be set to 1 if the request is issued by a "normal" application, and to 2 if it is issued by a pager. Window managers are required to always obey the pager.

Now for the magic trick: What if we just tell the window manager "hey, I'm a pager"? Oh, I love it! 😂 (sudo make me a sandwich style, just better).

Of course that's sarcasm. The initial problem just can't be solved that way. It can only be solved in individual applications, that just shouldn't do unexpected nonsense with their windows. 🙄

Side note: #Windows does it differently. An application on a windows desktop can only "self-activate" if the currently active application explicitly passes permission. That's a lot more boring (I can't just pretend something and make the desktop obey me 😞), but also doesn't solve the problem. While I could certainly cover my usecase in Xmoji that way (I mean, the new instance can pass that permission to the already running one), I'm sure there are lots of other valid usecases for e.g. activating a window that just can't be done on a Windows desktop...

5
 
 

Has anyone understood and is using <memory_resource> in C++17..?
#cxx #programming

6
 
 

i am in love with the cover art on al sweigart's python game programming book

it was switched out with some more corporate art a year later.

#programming

7
 
 

Versatility, Speed.

Pick Two.

October 23 and 24th, come see the magic. And,

the crime we use to get it. https://www.p99conf.io/

#p99conf #ScyllaDB #DevTalk #programming

video/mp4