Programming

1 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
 
 

My universal keybind, explained: https://summeremacs.github.io/posts/universal-keybind/

#emacs #keyboard #keys #elisp #programming #geek

2
 
 

If you use Vial (https://get.vial.today) to configure your keyboard on macOS and you need to map a key to backtick/tilde, the backtick/tidle key won’t work (you’ll get the section/plus-minus key). Instead, map it to the following code:

KC_NONUS_BSLASH

(At least that’s what worked for me on the British English Mac layout.)

#Mac #keyboard #layout #programming #backtick #tilde #via #vial

3
 
 

"After 27 years, Tcl/Tk 9 finally arrives with 64-bit power and Zip file magic" - https://www.theregister.com/2024/10/02/tcltk_version_9/ 🧰 🛠️
#tcl #tk #tcltk #programming

4
 
 

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.

5
 
 

#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

6
 
 

#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

7
 
 

#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...

8
 
 

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

9
 
 

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

10
 
 

😎

#programming

11
 
 

Tcl/Tk 9.0 Release Announcement - https://www.tcl-lang.org/software/tcltk/9.0.html
The first major release in 27 years. 64-bit internal structures, so data can be huge. Full unicode with all the funky new emojis. Zip filesystems, etc., etc.

There's lots of new stuff, and some old cruft has been dumped, so some programs may need a few updates, but there's still a high level of compatibility. The page above links to release notes with details of what's in and what's out.
#tcltk #tcl #programming

12
 
 

Explore chat rooms and relevant programming content on Chat-to.dev. Take part in discussions, share code and improve your software development skills.