The Trains With Rubber Tires

The train was one of the game-changing inventions that defined the Industrial Age. No more would humanity rely on tempestuous animals to haul goods and passengers great distances across the land. Fire and steam came along to rapidly increase the speed of travel and transformed the very fabric of society itself.

To this day, the vast majority of train networks rely on the same basic principle—heavy locomotives and carriages running steel wheels on steel tracks. Yet, there is a curious alternative twist on this concept that sees trains of carriages riding on tires instead. But what would possess anyone to build a rubber tired train?

Continue reading “The Trains With Rubber Tires”

Linux Fu: Upcycling An Old Router

You’re wandering through a thrift store and spot an old router for ten bucks. Worthless, right? But in this case, it was a Google OnHub, which, at the time, was pretty premium and still isn’t anything to sneeze at. Of course, Google abandoned it long ago, and it runs Chrome, so pass, right? Of course I didn’t. In fact, I bought two for less than $20. The question is always the same: what do you do with it?

OpenWrt will run on the device. That’s a good start, but merely replacing the firmware isn’t much of a project. The more interesting question is whether the hardware can still do something useful. I had a specific need: connect a wired workstation to a reasonably distant WiFi network without running cable and without suffering the usual double-NAT headaches that come from turning the router into yet another subnet. For this, the OnHub turned out to be nearly perfect.

The Hardware

The OnHub was Google’s first Wi-Fi router, built by TP-Link and ASUS in different versions. Mine was the TP-Link model, and one was missing a bit of plastic cowl trim. Under the hood, it has a Qualcomm IPQ8064 dual-core processor — a dual-core ARMv7 — multiple radios, gigabit Ethernet, and enough memory to run OpenWrt comfortably: 1 GB of RAM and 4 GB of flash. The processor also has two network offload processors, but it isn’t clear to me that the stock OpenWrt build uses them.

These devices were expensive when new, but now show up regularly at thrift stores and surplus sales. Installing OpenWrt was straightforward. You do need to remove a screw that covers the magic switch at the bottom, but that’s not a big problem. You can just peel the rubber foot back if you don’t want to remove it. However, the interesting part came afterward.

Continue reading “Linux Fu: Upcycling An Old Router”

MSYS2 And The No-Fuss Way To Get More GNU Into Your Windows

As great and streamlined as the Windows desktop experience is, one area where it’s at best disappointing and at worst rage-inducing is when it comes to its command line interface (CLI) offerings. In Windows 9x/ME this could be excused by the fact that it was essentially just a dressed-up MS-DOS CLI experience, but on Windows NT-based OSes no such excuse exists.

Yet even after Microsoft finally acknowledged the shortcomings of the cmd.exe shell by 2006, they then proceeded to go their own way with PowerShell, industry standards be damned. Especially for those of us who have no beef with the UNIX/BSD/Linux CLI experience and the joys of shell scripting, this insistence was disappointing. Simultaneously, everyone from OS X/MacOS to Haiku were happily offering a familiar CLI environment alongside POSIX compatibility.

Although Windows NT OSes were POSIX compliant, they never offered a suitable shell along with it, nor any of the other things you’d expect in a modern-day BSD, Haiku or Linux CLI environment. In a recent article by my esteemed colleague Al Williams, these sore points were somewhat addressed as far as basic CLI tools go, but the issue goes obviously much deeper than just the basic userland tools. Which is where MSYS2 comes into the picture.

Continue reading “MSYS2 And The No-Fuss Way To Get More GNU Into Your Windows”

What Happens If Russia Shuts The Door On Their Leaky ISS Module?

There was a particularly tense moment aboard the International Space Station earlier this month, with NASA directing their astronauts to secure themselves in the Dragon capsule and prepare for a potential return to Earth while their Russian counterparts engaged in what we now know to have been some impromptu demolition work on their side of the orbiting complex.

Despite objections from their American partners, Roscosmos had given their cosmonauts the go-ahead to drill and cut into the walls of the Zvezda module — one of the core components of the ISS which has been in orbit since 2000 — to try and identify and ultimately repair persistent leaks that have been venting the Station’s atmosphere out into space for several years. We may never know the exact nature of the behind-the-scenes communication that went on between the two space agencies, but in the end the Russians abandoned their plan and NASA’s personnel were told to resume their normal duties.

But where do things go from here? Although it’s true the International Space Station is entering its final years, the mission isn’t over yet, and that means the two countries need to continue to work together if they hope to get any science done in the time they have left.

At this point there hasn’t been any official word from either agency, but sources that wish to remain anonymous have been dropping hints, and that’s got the rumors swirling. With the understanding that anything is still possible, at this point it looks like Russia is going to abandon any further attempts to repair the leak and instead seal off the crippled compartment of the Zvezda module. This won’t solve all the problems, and in fact will create some new ones. But if that’s what it will take to keep the peace with NASA until Station operations wind down, it’s apparently a bargain they’re willing to make.

Continue reading “What Happens If Russia Shuts The Door On Their Leaky ISS Module?”

Ask Hackaday: What Ever Happened To The Hero Nerd?

Knowing absolutely nothing about you other than the fact that you’re currently reading Hackaday, I can predict with a high degree of certainty that we’re both fond of at least a few of the same movies. That’s not to say they’re necessarily our favorite works of art. Indeed, in some cases they may even be objectively bad films. But the memory of them has stuck with us — and by extension nearly everyone else in the hacker and maker community — for decades.

Even if you don’t remember all the little details, you’ll never forget the names: movies like WarGames, Ghostbusters, Back to the Future, and Short Circuit. Stories that showed smart people using their intellect and a bit of cobbled together hardware to triumph over the bad guys. The tech wasn’t always believable, sometimes it was downright farcical. But they made it seem real, and by the end of the story when they won the day using brains and a soldering iron rather than fists or a gun, the minutia of how it all worked wasn’t really that important anyway.

It’s not a stretch to say that films such as these helped put many of us on a path towards science and technology. For those with an interest in more cerebral pursuits, seeing a scientist or an engineer save the day was hugely influential. How many engineers got their start watching Scotty frantically eke just a bit more power out of the Enterprise?

But as we recently discussed some of these classic movies behind the scenes here at Hackaday, it struck us that all of the best examples we could come up with were now 20, 30, or even 40 years old. That’s not to say there aren’t a few contemporary standouts, but they mostly seem to be biopics or other historical dramatizations which don’t quite scratch the same itch. Even so, none of them appear to have had the cultural impact necessary to stand the test of time in the same way their predecessors have.

So where have all of Hollywood’s heroic nerds gone, and what does it mean for future generations if these niche role models are no longer represented?

Continue reading “Ask Hackaday: What Ever Happened To The Hero Nerd?”

A Brief History Of Unix Commands On Windows: CoreUtils (Again)

If you use Windows today and type ls, cat, grep, or awk in a terminal, there is a good chance something useful will happen. That was not always true. For most of the history of personal computing, Unix/Linux and Windows lived on opposite sides of a cultural border. Unix people had pipes, small composable tools, shell scripts, make, sed, awk, grep, tar, and the idea that everything was a file. Windows people had drive letters, backslashes, COMMAND.COM or cmd.exe, and an API that did not care much about what POSIX thought.

Yet there has always been a demand for Unix tools on Windows. Some of it came from programmers who wanted the same build scripts everywhere. Some came from administrators who missed grep and awk. Some came from companies trying to port big Unix applications to NT without rewriting them all. The result is a long, strange history of Unix-on-Windows layers, toolkits, compromises, and almost-but-not-quite compatibility.

Easy?

The simplest version of the problem sounds trivial. How hard can cat be? Open a file, copy bytes to standard output, done. Writing ls is a little more work, but Windows has directory APIs. Common commands like cp, mv, rm, mkdir are not very mysterious. Even pipes are not foreign to Windows. A lot of the everyday Unix command set can be ported as ordinary Win32 console programs with some path handling and enough patience.

But not all of Unix or Linux translates cleanly to Windows. The big issue is fork(). On Unix, a process can clone itself. The child gets a copy of the parent’s address space, open file descriptors, environment, signal state, and so on. Modern kernels make this efficient with copy-on-write memory, but the programming model is old and deeply baked into Unix. Shells use it constantly. Servers use it. Build systems use it. Scripting languages assume it exists, or at least that the surrounding environment behaves as though it does.

Windows process creation is different. Windows has CreateProcess(), which starts a new program. That is a perfectly reasonable model, but it is not fork() (more like fork()+exec()). If you are just launching notepad.exe, no problem. If you are trying to implement a POSIX shell that forks, redirects file descriptors, adjusts the environment, and then starts another program, the mismatch is extreme and you’ll have to do some strange things to fake things out.

One of the early commercial answers was the MKS Toolkit, originally from Mortice Kern Systems. MKS gave Windows users a pile of familiar commands, shells, and development tools. It was not just ls and friends; it included things like ksh, vi, grep, find, awk, make, and many of the utilities needed to move scripts and build procedures between Unix and Windows. The current PTC MKS documentation still describes it in exactly that spirit: Unix shells and hundreds of commands for interoperability with Windows.

MKS was attractive because it treated Windows as Windows. You were not necessarily pretending your machine was a Unix workstation. You were getting a Unix-flavored toolbox that could operate in a Windows environment. For many people, that was enough. You could write scripts, process text, drive builds, and avoid learning three different syntaxes for the same job.

Continue reading “A Brief History Of Unix Commands On Windows: CoreUtils (Again)”

Picking A CRC

You send a file, but how do you know it arrived intact? In other words, how do you know that it didn’t get cut off, garbled, or changed somehow? Simplistically, you could just add up all the bytes in the file — a checksum — and send that along with the file. You compute the checksum when you know the file is good, and the receiver can compare the checksum to see if they match.

However, a simple addition doesn’t catch certain classes of errors, which is why there are better checksum algorithms that, for example, wrap the carry bit around or otherwise modify files with common errors so they produce different checksums. There are two problems with checksums. First, no matter how much you modify the algorithm, the chances that two files produce the same checksum are pretty high. Especially with common error patterns.

For example, assume a very simple algorithm that simply adds the bytes and discards any carry. If a file contains 0x80, 0x80, those numbers essentially cancel each other out. If you replace them with 0, 0, you’ll get the same checksum. To some degree, using anything other than a second copy of the entire file will have this problem — some corruption goes undetected — but you want to minimize the number of times that happens.

The other problem is that a checksum by itself doesn’t let you correct anything. You know the data is bad, but you don’t know why. If you think about it, the simplest checksum is a parity bit on a byte: odd parity is simply summing all the bits together. If the parity bit doesn’t match, you know the byte is bad, but you don’t know why. Any even number of errors goes undetected, but I am sure one-, three-, five-, or seven-bit errors will get caught.

People invent better error-checking codes by devising schemes that can promise they can detect a certain number of bit flips and, at least in some cases, correct them. One of these is the cyclic redundancy check (CRC). It is easy to think of the CRC as a “strong checksum,” but it actually works differently. What’s more, there isn’t just a single CRC algorithm. You have to select or design a particular algorithm based on your needs. Most people pick a “named” implementation like CCITT or Ethernet and assume it must be the best. It probably isn’t.

A CRC is a checksum in the broad sense: you feed it a message, and it gives you a small value that you append, store, or compare later. But unlike a simple additive checksum, a CRC is based on polynomial division over GF(2), which is a fancy way of saying “divide using XOR instead of carries.” That detail matters. It gives CRCs very strong guarantees against common classes of errors, provided you choose the right polynomial for the job. That’s the key. You must choose the right polynomial.

Continue reading “Picking A CRC”