Programming Leftovers
-
Nerve cells in a dish can learn to play Pong
Growing the network on the chip was only part of the story, though. Getting it to perceive and interact with the world was, as he describes in a paper in Neuron, quite another. The chip had predefined “sensory” (input) and “motor” (output) regions. In the sensory region, eight electrodes gave the cells tiny zaps that communicated the positions of the paddle (there was only one; the network was playing against a “wall”) and the ball with respect to one another. The neurons’ firings in the motor region determined the movement of the paddle.
By randomly zapping the sensory neurons for four seconds every time the network missed the ball, the software running the chip wiped out the pattern that led to the loss. Conversely, winning plays, which did not lead to random zapping, were retained.
-
How to fix an ancient GDB problem
The GDB debugger has a long history; it was first created in 1986. It may thus be unsurprising that some GDB development happens over relatively long time frames but, even when taking that into account, the existence of an open bug first reported in 2007 may be a little surprising. At the 2022 GNU Tools Cauldron, GDB maintainer Pedro Alves talked about why this problem has been difficult to solve, and what the eventual solution looks like. The problem in question, Alves said, has to do with the handling of keyboard interrupts, which normally result from the user hitting control-C. The user's normal expectation is that an interrupt within GDB while the target program is running will stop the program and return the GDB prompt. If, however, that program has blocked the SIGINT signal, the interrupt will never be delivered. At best, GDB will not stop; at worst, the entire debugging session can become stuck and need to be killed from another terminal. GDB users, it seems, tend not to like that behavior.
This problem results from how GDB handles both terminals and interrupt signals. A "session", in the Unix sense, is a set of process groups, all of which share a single controlling terminal. Normally, the debugged process runs in the same session as — and shares the terminal with — GDB, but GDB puts that process into a different process group. Multiple process groups can share a terminal, but only one of those — the foreground group — will receive signals generated by the user at that terminal. GDB normally runs as the foreground group but, when it runs the target program, it designates that program's group as the foreground group instead.
-
Qt WebAssembly Q-A, Part 1
WebAssembly is a bytecode representation that is meant to be targeted by high-level programming languages such as C++ and to be executed inside a virtual machine in a browser. It will change the way you design your embedded devices, applications, and other software. Qt for WebAssembly allows you to run your C++ applications on popular web browsers, such as Google Chrome and Mozilla Firefox – and our efforts to support more browsers are continuous.
Want to find out more about WebAssembly but don't know what to ask? We quizzed our Senior Product Manager, Veli-Pekka Heinonen, with 11 burning questions sent to us by our dev community. This will be an ongoing series, so do not hesitate to send us your questions for our next edition!
-
Convert Any PDF eBook to an Audiobook with Python