Crash Your Code – Lessons Learned From Debugging Things That Should Never Happen™

Let’s be honest, no one likes to see their program crash. It’s a clear sign that something is wrong with our code, and that’s a truth we don’t like to see. We try our best to avoid such a situation, and we’ve seen how compiler warnings and other static code analysis tools can help us to detect and prevent possible flaws in our code, which could otherwise lead to its demise. But what if I told you that crashing your program is actually a great way to improve its overall quality? Now, this obviously sounds a bit counterintuitive, after all we are talking about preventing our code from misbehaving, so why would we want to purposely break it?

Wandering around in an environment of ones and zeroes makes it easy to forget that reality is usually a lot less black and white. Yes, a program crash is bad — it hurts the ego, makes us look bad, and most of all, it is simply annoying. But is it really the worst that could happen? What if, say, some bad pointer handling doesn’t cause an instant segmentation fault, but instead happily introduces some garbage data to the system, widely opening the gates to virtually any outcome imaginable, from minor glitches to severe security vulnerabilities. Is this really a better option? And it doesn’t have to be pointers, or anything of C’s shortcomings in particular, we can end up with invalid data and unforeseen scenarios in virtually any language.

It doesn’t matter how often we hear that every piece of software is too complex to ever fully understand it, or how everything that can go wrong will go wrong. We are fully aware of all the wisdom and cliches, and completely ignore them or weasel our way out of it every time we put a /* this should never happen */ comment in our code.

So today, we are going to look into our options to deal with such unanticipated situations, how we can utilize a deliberate crash to improve our code in the future, and why the average error message is mostly useless.

Continue reading “Crash Your Code – Lessons Learned From Debugging Things That Should Never Happen™”

Oreo Construction: Hiding Your Components Inside The PCB

In recent months, the ability to hide components inside a circuit board has become an item of interest. We could trace this to the burgeoning badgelife movement, where engineers create beautiful works of electronic art. We can also attribute this interest to Bloomberg’s Big Hack, where Jordan Robertson and Michael Riley asserted Apple was the target of Chinese spying using components embedded inside a motherboard. The Big Hack story had legs, but so far no evidence of this hack’s existence has come to light, and the companies and governments involved have all issued denials that anything like this exists.

That said, embedding components inside a PCB is an interesting topic of discussion, and thanks to the dropping prices of PCB fabrication (this entire project cost $15 for the circuit boards), it’s now possible for hobbyists to experiment with the technique.

But first, it’s important to define what ‘stuffing components inside a piece of fiberglass’ is actually called. My research keeps coming back to the term ’embedded components’ which is utterly ungooglable, and a truly terrible name because ’embedded’ means something else entirely. You cannot call a PCB fabrication technique ’embedded components’ and expect people to find it on the Internet. For lack of a better term, I’m calling this ‘Oreo construction’, because of my predilection towards ‘stuf’, and because it needs to be called something. We’re all calling it ‘Oreo construction’ now, because the stuf is in the middle. This is how you do it with standard PCB design tools and cheap Chinese board houses.

Continue reading “Oreo Construction: Hiding Your Components Inside The PCB”

Sharpest Color CRT Display Is Monochrome Plus A Trick

I recently came across the most peculiar way to make a color CRT monitor. More than a few oscilloscopes have found their way on to my bench over the years, but I was particularly struck with a find from eBay. A quick look at the display reveals something a little alien. The sharpness is fantastic: each pixel is a perfect, uniform-colored little dot, a feat unequaled even by today’s best LCDs. The designers seem to have chosen a somewhat odd set of pastels for the UI though, and if you move your head just right, you can catch flashes of pure red, green, and blue. It turns out, this Tektronix TDS-754D sports a very peculiar display technology called NuColor — an evolutionary dead-end that was once touted as a superior alternative to traditional color CRTs.

Join me for a look inside to figure out what’s different from those old, heavy TVs that have gone the way of the dodo.

Continue reading “Sharpest Color CRT Display Is Monochrome Plus A Trick”

Scramjet Engines On The Long Road To Mach 5

When Charles “Chuck” Yeager reached a speed of Mach 1.06 while flying the Bell X-1 Glamorous Glennis in 1947, he became the first man to fly faster than the speed of sound in controlled level flight. Specifying that he reached supersonic speed “in controlled level flight” might seem superfluous, but it’s actually a very important distinction. There had been several unconfirmed claims that aircraft had hit or even exceeded Mach 1 during the Second World War, but it had always been during a steep dive and generally resulted in the loss of the aircraft and its pilot. Yeager’s accomplishment wasn’t just going faster than sound, but doing it in a controlled and sustained flight that ended with a safe landing.

Chuck Yeager and his Bell X-1

In that way, the current status of hypersonic flight is not entirely unlike that of supersonic flight prior to 1947. We have missiles which travel at or above Mach 5, the start of the hypersonic regime, and spacecraft returning from orbit such as the Space Shuttle can attain speeds as high as Mach 25 while diving through the atmosphere. But neither example meets that same requirement of “controlled level flight” that Yeager achieved 72 years ago. Until a vehicle can accelerate up to Mach 5, sustain that speed for a useful period of time, and then land intact (with or without a human occupant), we can’t say that we’ve truly mastered hypersonic flight.

So why, nearly a century after we broke the sound barrier, are we still without practical hypersonic aircraft? One of the biggest issues historically has been the material the vehicle is made out of. The Lockheed SR-71 “Blackbird” struggled with the intense heat generated by flying at Mach 3, which ultimately required it to be constructed from an expensive and temperamental combination of titanium and polymer composites. A craft which flies at Mach 5 or beyond is subjected to even harsher conditions, and it has taken decades for material science to rise to the challenge.

With modern composites and the benefit of advanced computer simulations, we’re closing in on solving the physical aspects of surviving sustained hypersonic flight. With the recent announcement that Russia has put their Avangard hypersonic glider into production, small scale vehicles traveling at high Mach numbers for extended periods of time are now a reality. Saying it’s a solved problem isn’t quite accurate; the American hypersonic glider program has been plagued with issues related to the vehicle coming apart under the stress of Mach 20 flight, which heats the craft’s surface to temperatures in excess of 1,900 C (~3,500 F). But we’re getting closer, and it’s no longer the insurmountable problem it seemed a few decades ago.

Today, the biggest remaining challenge is propelling a hypersonic vehicle in level flight for a useful period of time. The most promising solution is the scramjet, an engine that relies on the speed of the vehicle itself to compress incoming air for combustion. They’re mechanically very simple, and the physics behind it have been known since about the time Yeager was climbing into the cockpit of the X-1. Unfortunately the road towards constructing, much less testing, a full scale hypersonic scramjet aircraft has been a long and hard one.

Continue reading “Scramjet Engines On The Long Road To Mach 5”

Twelve Circuit Sculptures We Can’t Stop Looking At

Circuits are beautiful in their own way, and a circuit sculpture takes that abstract beauty and makes it into a purposeful art form. Can you use the wires of the circuits themselves as the structure of a sculpture, and tell a story with the use and placement of every component? Anyone can exercise their inner artist using this medium and we loved seeing so many people give it a try. Today we announce the top winners and celebrate four score of entries in the Hackaday Circuit Sculpture Contest.

Let’s take a look at twelve outstanding projects that caught (and held) our eye:

Continue reading “Twelve Circuit Sculptures We Can’t Stop Looking At”

Web Development: What’s Big In 2019?

I try to keep up with web development trends but it’s hard to keep pace since it’s such a fast evolving field. Barely a week goes by without the release of a new JS framework, elaborate build tool or testing suite — all of them touted as the one to learn. Sorting the hype from the genuinely useful is no mean feat, so my aim in this article is to summarise some of the most interesting happenings that web development saw in the last year, and what trends we expect to see more of in 2019.

A technology or framework doesn’t have to be brand new to be on our list here, it just needs to be growing rapidly or evolving in an interesting way. Let’s take a look!

Continue reading “Web Development: What’s Big In 2019?”

UPnP, Vulnerability As A Feature That Just Won’t Die

UPnP — in a perfect world it would have been the answer to many connectivity headaches as we add more devices to our home networks. But in practice it the cause of a lot of headaches when it comes to keeping those networks secure.

It’s likely that many Hackaday readers provide some form of technical support to relatives or friends. We’ll help sort out Mom’s desktop and email gripes, and we’ll set up her new router and lock it down as best we can to minimise the chance of the bad guys causing her problems. Probably one of the first things we’ll have all done is something that’s old news in our community; to ensure that a notorious vulnerability exposed to the outside world is plugged, we disable UPnP on whatever cable modem or ADSL router her provider supplied.

Continue reading “UPnP, Vulnerability As A Feature That Just Won’t Die”