What is the right time to optimize code? This is a very good question, which usually comes down to two answers. The first answer is to have a good design for the code to begin with, because ‘optimization’ does not mean ‘fixing bad design decisions’. The second answer is that it should happen after the application has been sufficiently debugged and its developers are at risk of getting bored.
There should also be a goal for the optimization, based on what makes sense for the application. Does it need to process data faster? Should it send less data over the network or to disk? Shouldn’t one really have a look at that memory usage? And just what is going on inside those CPU caches that makes performance sometimes drop off a cliff on a single core?
All of this and more can be analyzed using tools from the Valgrind suite, including Cachegrind, Callgrind, DHAT and Massif.
Keeping Those Cores Cool
Modern day processors are designed with low power usage in mind, regardless of whether they are aimed at servers, desktop systems or embedded applications. This essentially means that they are in a low power state when not doing any work (idle loop), with some CPUs and microcontrollers turning off power to parts of the chip which are not being used. Consequently, the more the processor has to do, the more power it will use and the hotter it will get.
We hear fables of how to restore the crispness to your crisp and the crackle to your crackers, but they are more hot air than some of the methods. We found one solution that has some teeth though, and it doesn’t require any kitchen appliances, just a pair of headphones. Keep reading before you mash potato chips into your Beats. [Charles Spence] co-authors a paper with [Massimiliano Zampini] titled The Role of Auditory Cues in Modulating the Perceived Crispness and Staleness of Potato Chips. It’s a mouthful, so folks refer to it as the “Sonic Chip Experiment,” which rolls off the tongue. The paper is behind paywalls, but you can find it if you know where to look.
The experiment puts participants in some headphones while they eat Pringles, and researchers feed them different sound waves. Sometimes the sound file is a recording of crackly chewing, and other times it is muffled mastication. The constant was the Pringles, which are a delight for testing because they are uniform. Participants report that some chips are fresher than others. This means we use our ears to help judge consumable consistency. Even people who knew all about the experiment report they can willingly fool themselves with the recordings.
What other foods would benefit from the augmented crunch, and which ones would suffer? If shapely food is your jam, we have a holy cookie which is probably best enjoyed with your eyes. If you prefer your Skittles organized by color, we have you covered.
Because of the architecture used for the Apollo missions, extended stays on the surface of the Moon weren’t possible. The spartan Lunar Module simply wasn’t large enough to support excursions of more than a few days in length, and even that would be pushing the edge of the envelope. But then the Apollo program was never intended to be anything more than a proof of concept, to demonstrate that humans could make a controlled landing on the Moon and return to Earth safely. It was always assumed that more detailed explorations would happen on later missions with more advanced equipment and spacecraft.
Now NASA hopes that’s finally going to happen in the 2020s as part of its Artemis program. These missions won’t just be sightseeing trips, the agency says they’re returning with the goal of building a sustainable infrastructure on and around our nearest celestial neighbor. With a space station in lunar orbit and a permanent outpost on the surface, personnel could be regularly shuttled between the Earth and Moon similar to how crew rotations are currently handled on the International Space Station.
Artemis lander concept
Naturally, there are quite a few technical challenges that need to be addressed before that can happen. A major one is finding ways to safely and accurately deliver multiple payloads to the lunar surface. Building a Moon outpost will be a lot harder if all of its principle modules land several kilometers away from each other, so NASA is partnering with commercial companies to develop crew and cargo vehicles that are capable of high precision landings.
But bringing them down accurately is only half the problem. The Apollo Lunar Module is by far the largest and heaviest object that humanity has ever landed on another celestial body, but it’s absolutely dwarfed by some of the vehicles and components that NASA is considering for the Artemis program. There’s a very real concern that the powerful rocket engines required to gracefully lower these massive craft to the lunar surface might kick up a dangerous cloud of high-velocity dust and debris. In extreme cases, the lander could even find itself touching down at the bottom of a freshly dug crater.
Of course, the logical solution is to build hardened landing pads around the Artemis Base Camp that can support these heavyweight vehicles. But that leads to something of a “Chicken and Egg” problem: how do you build a suitable landing pad if you can’t transport large amounts of material to the surface in the first place? There are a few different approaches being considered to solve this problem, but certainly one of the most interesting among them is the idea proposed by Masten Space Systems. Their experimental technique would allow a rocket engine to literally build its own landing pad by spraying molten aluminum as it approaches the lunar surface.
Linux is a two-edged sword. On the one hand, there’s so much you can configure. On the other hand, there’s so much you can configure. It is sometimes hard to know just what you should do to get the best performance, especially on a small platform like the Raspberry Pi. [Hayden James] has a suggestion: enable ZRAM and tweak the kernel to match.
Although the post focuses on the Raspberry Pi 4, it applies to any Linux system that has limited memory including older Pi boards. The idea is to use a portion of main memory as a swap file. At first, that might seem like a waste since you could use that memory to, you know, actually run programs. However, the swap devices are compressed, so you get more swap space and transfers from these compressed swap devices and main memory are lightning-fast compared to a hard drive or solid state disk drive.
This deep dive into the Linux-powered Reolink B800 IP camera started because of a broken promise from its manufacturer. When [George Hilliard] purchased a kit that included six of the cameras and a video recorder, the website said they were capable of outputting standard RTSP video. But once he took delivery of the goods, and naturally after his return window had closed, the site was updated to say that the cameras can only function with the included recorder.
Taking that as something of challenge, [George] got to work. His first big break came when he desoldered the camera’s SPI flash chip and replaced it with a socket. That allowed him to easily take the chip out of the device for reading and flashing as he tinkered with modifying the firmware. After adding cross-compiled versions of busybox, gdb, and strace to the extracted firmware, he bundled it back up and flashed it back to the hardware.
If you think that’s the end of the story, it isn’t. In fact, it’s just the beginning. While getting root-level access to the camera’s OS would have potentially allowed for [George] to dump all the proprietary software it was running and replace it with open alternatives, he decided to take a different approach.
Instead of replacing the camera’s original software, he used his newly granted root powers to analyze it and figure out how it worked. This allowed for to sniff out some very suspect “encryption” routines built into the software, and eventually write his own server side in Rust that finally allowed him to use the cameras with his own server…albeit with a bit more work than he bargained for.
Projects like these are a fantastic look at real world reverse engineering, and a reminder that sometimes achieving your ultimate goal means taking the long way around. Even if you’re not in the market for a hacked security camera, there’s no doubt that reading the thorough write-up [George] has prepared will teach you a few things. But of course, we’d expect no less from a guy who runs Linux on his business card.
So much of what we do relies on a certain societal structure that has been absent for a few months now. When the days run together, it’s hard to remember to do the things that must happen daily. You think you did something, and maybe you’re right, but it’s quite possible you’re thinking of yesterday.
Now when [Flameeyes] puts the pen away, he also triggers a Flic smart button mounted nearby. The Flic shares its status with a Feather M4 Express through a web app, and the Feather in turn changes the RGB LED inside of Pikachu’s base from red to yellow for the day. Pikachu sits in plain sight by the kettle, so there’s no guessing whether [Flameeyes] took his insulin.
Insulin is a critical commodity with a lot of DIY interest, which is probably starting to spike about now. Our own [Dan Maloney] wrote a great piece on the subject that brings up an insulin hack from around 80 years ago.
Video calls are okay. While some advocate for the benefit of body language over a standard phone call, they remain an imperfect substitute for in-person interaction. [Amos] wanted to be able to demonstrate things better when on a video chat, so devised this simple solution for when he’s working with his hands.
The hack consists of a mirror attached to a clothespeg with a flexible piece of wire. This simple device can then be clipped to the screen of a laptop, and the mirror adjusted to allow the webcam to view the user’s desk. By positioning it correctly, the user can both show their desk and their face together, in split screen. It’s a great way to explain something while giving viewers a clear shot of your face and your hands at the same time.
It’s not exactly complicated, but a nifty hack that could prove useful to anyone trying to teach without having to muck about with complicated digital handwriting setups or multiple webcams. There’s a shortage at the moment, anyway. If you’re looking for a way to chat with your less tech savvy relatives, consider repurposing an old Android tablet. Video after the break.