Don’t Let Endianness Flip You Around

Most of the processor architectures which we come into contact with today are little-endian systems, meaning that they store and address bytes in a least-significant byte (LSB) order. Unlike in the past, when big-endian architectures, including the Motorola 68000 and PowerPC, were more common, one can often just assume that all of the binary data one reads from files and via communication protocols are in little-endian order. This will often work fine.

The problem comes with for example image formats that use big-endian formatted integers, including TIFF and PNG. When dealing directly with protocols in so-called ‘network order’, one also deals with big-endian data. Trying to use these formats and protocol data verbatim on a little-endian system will obviously not work.

Fortunately, it is very easy to swap the endianness of any data which we handle. Continue reading “Don’t Let Endianness Flip You Around”

Linux-Fu: Help Messages For Shell Scripts And Here Documents

Imagine that you want to output multiple lines of text in Bash, or any shell script. Maybe it’s for a help string for a particularly convoluted shell script you’re writing. You could have a separate echo command for each line.  Or you could use the “here document“.

The “here document” construction takes the text between two delimiters and passes it, as if it were piped, to a command.

if [[$# == 0 ]] || [[ "$1" == "-h" ]]; then
cat << EOF
This is my help message. There are many like it but this one is mine.
My help message is my best friend.
EOF

All of the text, as written, with line breaks and spaces and all, get passed to cat and your helpful formatted message is printed to the user.

Continue reading “Linux-Fu: Help Messages For Shell Scripts And Here Documents”

COVID Tracing Apps: What Europe Has Done Right, And Wrong

Europe has been in COVID-containment mode for the last month, in contrast to the prior three months of serious lockdown. Kids went back to school, in shifts, and people went on vacation to countries with similarly low infection rates. Legoland and the zoo opened back up, capped at 1/3 capacity. Hardware stores and post offices are running “normally” once you’ve accommodated mandatory masks and 1.5 meter separations while standing in line as “normal”. To make up for the fact that half of the tables have to be left empty, most restaurants have sprawled out onto their terraces. It’s not really normal, but it’s also no longer horrible.

But even a country that’s doing very well like Germany, where I live, has a few hundred to a thousand new cases per day. If these are left to spread unchecked as before, the possibility of a second wave is very real, hence the mask-and-distance routine. The various European COVID-tracing apps were rolled out with this backdrop of a looming pandemic that’s tenuously under control. While nobody expects the apps to replace public distancing, they also stand to help if they can catch new and asymptomatic cases before they get passed on.

When Google and Apple introduced their frameworks for tracing apps, I took a technical look at them. My conclusion was that the infrastructure was sound, but that the implementation details would be where all of the dragons lay in wait. Not surprisingly, I was right!

Here’s an update on what’s happened in the first month of Europe’s experience with COVID-tracing apps. The good news is that the apps seem to be well written and based on the aforementioned solid foundation. Many, many people have installed at least one of the apps, and despite some quite serious growing pains, they seem to be mostly functioning as they should. The bad news is that, due to its privacy-preserving nature, nobody knows how many people have received warnings, or what effect, if any, the app is having on the infection rate. You certainly can’t see an “app effect” in the new daily cases rate. After a month of hard coding work and extreme public goodwill, it may be that cellphone apps just aren’t the panacea some had hoped.

Continue reading “COVID Tracing Apps: What Europe Has Done Right, And Wrong”

CampZone 2020 Badge Literally Speaks To Us

The pandemic has left my usual calendar of events in shambles this year. Where I’d have expected to have spent a significant portion of my summer mingling with our wonderful and diverse community worldwide, instead I’m sitting at home cracking open a solitary Club-Mate and listening to muffled techno music while trying to imagine myself in a field somewhere alongside several thousand hackers.

As a knock-on effect of the event cancellations there’s another thing missing this summer, the explosion of creativity in the world of electronic conference badges has faltered. Badges are thin on the ground this year, so the few that have made it to production are to be treasured as reminders that life goes on and there will be another golden summer of hacker camps in the future. This year, the CampZone 2020 badge was given its own voice and perform neat tricks like presenting a programming interface via WebUSB!

Continue reading “CampZone 2020 Badge Literally Speaks To Us”

No-Melt Nuclear ‘Power Balls’ Might Win A Few Hearts And Minds

A nuclear power plant is large and complex, and one of the biggest reasons is safety. Splitting radioactive atoms is inherently dangerous, but the energy unleashed by the chain reaction that ensues is the entire point. It’s a delicate balance to stay in the sweet spot, and it requires constant attention to the core temperature, or else the reactor could go into meltdown.

Today, nuclear fission is largely produced with fuel rods, which are skinny zirconium tubes packed with uranium pellets. The fission rate is kept in check with control rods, which are made of various elements like boron and cadmium that can absorb a lot of excess neutrons. Control rods calm the furious fission boil down to a sensible simmer, and can be recycled until they either wear out mechanically or become saturated with neutrons.

Nuclear power plants tend to have large footprints because of all the safety measures that are designed to prevent meltdowns. If there was a fuel that could withstand enough heat to make meltdowns physically impossible, then there would be no need for reactors to be buffered by millions of dollars in containment equipment. Stripped of these redundant, space-hogging safety measures, the nuclear process could be shrunk down quite a bit. Continue reading “No-Melt Nuclear ‘Power Balls’ Might Win A Few Hearts And Minds”

Geocaching On Mars: How Perseverance Will Seal Martian Samples With A Return To Earth In Mind

With the roughly 20-day wide launch window for the Mars 2020 mission rapidly approaching, the hype train for the next big mission to the Red Planet is really building up steam. And with good reason — the Mars 2020 mission has been in the works for a better part of a decade, and as we reported earlier this year, the rover it’s delivering to the Martian surface, since dubbed Perseverance, will be among the most complex such devices ever fielded.

“Percy” — come on, that nickname’s a natural — is a mobile laboratory, capable of exploring the Martian surface in search of evidence that life ever found a way there, and to do the groundwork needed if we’re ever to go there ourselves. The nuclear-powered rover bristles with scientific instruments, and assuming it survives the “Seven Minutes of Terror” as well as its fraternal twin Curiosity did in 2012, we should start seeing some amazing results come back.

No prior mission to Mars has been better equipped to answer the essential question: “Are we alone?” But no matter how capable Perseverance is, there’s a limit to how much science can be packed into something that costs millions of dollars a kilogram to get to Mars. And so NASA decided to equip Perseverance with the ability to not only collect geological samples, but to package them up and deposit them on the surface of the planet to await a future mission that will pick them up for a return trip to Earth for further study. It’s bold and forward-thinking, and it’s unlike anything that’s ever been tried before. In a lot of ways, Perseverance’s sample handling system is the rover’s raison d’être, and it’s the subject of this deep dive.

Continue reading “Geocaching On Mars: How Perseverance Will Seal Martian Samples With A Return To Earth In Mind”

Smashing The Atom: A Brief History Of Particle Accelerators

When it comes to building particle accelerators the credo has always been “bigger, badder, better”. While the Large Hadron Collider (LHC) with its 27 km circumference and €7.5 billion budget is still the largest and most expensive scientific instrument ever built, it’s physics program is slowly coming to an end. In 2027, it will receive the last major upgrade, dubbed the High-Luminosity LHC, which is expected to complete operations in 2038. This may seem like a long time ahead but the scientific community is already thinking about what comes next.
Recently, CERN released an update of the future European strategy for particle physics which includes the feasibility study for a 100 km large Future Circular Collider (FCC). Let’s take a short break and look back into the history of “atom smashers” and the scientific progress they brought along. Continue reading “Smashing The Atom: A Brief History Of Particle Accelerators”