From A Ten-Line Script To A Real Utility With Codex

I’m an experienced programmer, and I’ve worked in many different languages. Sometimes being a programmer is a two-edged sword. You want to accomplish something, and you can do it easily — but it can be a lot of work to do it right. Maybe more work than you want to do.

Normally, I’ll kick out a few lines of script for something I want and be done, accepting that it isn’t production-hardened. This time, however, I decided to try an AI tool to see whether they could do the work I was too lazy to do myself. While I’ve played with chatbots, I wanted to try one of the dedicated coding agents, in this case, Codex. Outside of asking ChatGPT to write a simple function or find the cause of an error message, I haven’t done much coding with AI assistance, so I was interested to see what these agents brought to the table.

A Radio Problem

The problem was simple: I wanted an easy way to put buttons on my Linux desktop that launched Internet radio stations. Sure, I could open a player and paste in a long URL, but I’m far too lazy to remember all those URLs.

I searched for a way to make Shortwave — an Internet radio player — open a URL from the command line. Apparently, you can’t. Google Gemini suggested writing a script that launches cvlc, the command-line VLC player, with the URL as an argument.

That’s easy, so I did it. Of course, then I had to find the stream URLs for all my favorite stations. It turns out that Radio Browser maintains an extensive database of stations. I considered scraping the site or using its API, but honestly, the little script was becoming too much of a project.

Besides, I was already struggling to manage the media player’s lifetime. I didn’t want a new station playing on top of one that was already running, and I wanted a command to stop playback, so the script had already grown larger than I first imagined.

My first version used a temporary file containing the player’s process ID so a future script execution could kill the old player. That usually works, but it isn’t very robust, and I knew it. But how much work did I really want to do here? I decided I had done enough and turned the rest over to Codex, OpenAI’s coding assistant.

Continue reading “From A Ten-Line Script To A Real Utility With Codex”

“I’m Not Dead Yet!” Reverse Polish Notation Calculators You Can Still Buy

If you used a scientific calculator in the 1970s or 1980s, there was a fair chance that it worked differently from almost every calculator you see today. Instead of typing:

2 + 3 =

you entered:

2 ENTER 3 +

There wasn’t even an equals key. Hewlett-Packard made this system — Reverse Polish Notation, or RPN — practically synonymous with serious scientific calculators until other players like TI and Casio got serious. Once you got used to it, ordinary algebraic calculators could feel annoyingly clumsy.

Today, RPN calculators look like a nearly extinct species. HP left the calculator market, licensing the HP calculator line to Moravia Consulting. Old HP-15Cs, 16Cs, 32Ss, 42Ss, and 48s have become collectibles. But RPN isn’t dead. You can still buy new hardware, build your own, or turn almost any computer or phone into a very capable RPN machine. There are reasons some of us still want to.

But Why Polish?

The name goes back to Polish logician [Jan Łukasiewicz], who devised a notation in which operators precede their operands. Instead of writing:

A + B

you can write:

+ A B

The big advantage is that parentheses aren’t required. The structure of the expression tells you exactly what operates on what. Reverse Polish notation simply puts the operator at the other end:

A B +

[Łukasiewicz] wasn’t designing calculators, of course, but the same idea turned out to be extremely convenient for computers and calculators. Your software doesn’t have to remember what operation is in progress. Each operator is ready to go and can simply work on the operands that you’ve already read.

RPN isn’t exactly the way people calculate with pencil and paper, and it certainly wasn’t derived from the slide rule, but there is a similarity in the way you work. With a slide rule, you generally establish some value, operate on it, and continue from the result. When doing a long-hand calculation, you often calculate a subexpression, write down the answer, and use that answer in the next step. You will probably start with the inner parenthesis and work outward, just like someone with an RPN calculator does. RPN formalizes that process with a stack.

Suppose you want:

(3 + 4) × (5 + 6)

On a conventional calculator, you either need parentheses, or you have to calculate one result and remember it. On an RPN calculator:

3 ENTER

4 +

5 ENTER

6 +

×

The first + leaves 7 on the stack. The second leaves 11 above it. The multiply consumes both and leaves 77.

Notice what’s missing: parentheses, an equals key, and any need to tell the calculator about precedence. This isn’t much of a win for a five-key calculation. It becomes more apparent with something like computing the value of a bunch of parallel resistors:

R=1/(1/R1+1/R2+1/R3…)

An RPN user can calculate each reciprocal, add it to the running result on the stack, and finally take the reciprocal. Intermediate answers stay in the calculator naturally instead of being stuffed into memory registers or enclosed in increasingly impressive collections of parentheses.

Is RPN better? Calculator users have been arguing about that for half a century. But once RPN gets wired into your fingers, it can be surprisingly hard to give up.

Continue reading ““I’m Not Dead Yet!” Reverse Polish Notation Calculators You Can Still Buy”

What’s Mu Metal?

If you tear into old TVs or recording equipment, you may see shields made from some exotic-looking metal. Old timers will tell you it’s called mu metal, and its purpose is to — sort of — shield things from magnetic fields. The qualification is important. Unlike a conductive RF shield, mu metal doesn’t really stop a magnetic field. Instead, it gives magnetic flux an easier path to follow around whatever you’re trying to protect.

What’s In The Metal?

Mu metal belongs to a family of soft magnetic nickel-iron alloys. A typical modern formulation is about 80% nickel and 15% iron, with molybdenum and a few other elements making up most of the remainder. What makes it useful is its extremely high magnetic permeability. Commercial material can have relative permeability around 100,000 or more, and some specialty alloys can reach even higher.

You can think about reluctance as the magnetic equivalent of resistance. Put a high-permeability shell around something sensitive, and magnetic flux would much rather travel through the shell than through the space inside it, just like current tends to take the path of least resistance.

This works particularly well for DC and low-frequency fields, exactly where your usual copper or aluminum EMI shield isn’t much help.

Continue reading “What’s Mu Metal?”

Hackaday Podcast Episode 384: OCR MOD Records, Magical PCBs, And The Gravity Of Space Stations

What did Hackaday editors Elliot Williams and Al Williams read in Hackaday last week? Probably everything, but you can tune in and hear about their favorites on this week’s podcast. They heard from lots of listeners this week, and also saw DIY projects running from a 3D-printed Stirling engine, to clogs, to LEDs.

There are some over-the-top hacks like a refit for a decades-old watch to do tap-to-pay and a — for lack of a better word — a record player that optically reads MOD files. Want to emulate an iPod? Talk to Eliza? Print a hand-operated rail car? Hackaday is the place to read about it all.

The can’t miss articles included a talk from Hackaday Europe about making magical PCBs and a not-so-brief history of space stations starting in the 1800s.

Check out the links if you want to follow along, and as always, tell us what you think about this episode in the comments!

Direct download in MP3 suitable for hand-decoding.

Continue reading “Hackaday Podcast Episode 384: OCR MOD Records, Magical PCBs, And The Gravity Of Space Stations”

Artificial Intelligence As It Once Was

One day, people will look back at what we call Artificial Intelligence and laugh. We do the same thing today, as chat bots totally outstrip what the computer industry called AI up until pretty recently. This didn’t escape curators at the Internet Archive, apparently, and [Jason Scott] tells us about a recent collection, “Vintage Artificial Intelligence.”

These are old software titles that will run for you in emulated machines right in your browser, ranging from somewhere in the 1970s to the 1990s. There’s Eliza, of course. Actually, there are several copies of Eliza. Given how simple it was to write Eliza, it did a pretty good job. Then there are adventure games that are pretty conversational, Lisp, Prolog, which was going to spawn expert systems to replace us all, and Racter, which tried to write fiction.

There was even Alter Ego that was supposed to help you explore life decisions, maybe? There are a couple different versions of even a few versions of Conway’s Game of Life. We aren’t sure that’s ever really been AI, but perhaps it depends on your definition. We’re happy to see Sargon, the chess program, represented.

We didn’t see Hexapawn, which is a shame. We also didn’t see Parry (the paranoid counterpart to Eliza) or that elusive software we remember but can never find that built word chains from text called George.

We’ve written about Eliza before. If you want to experiment with Prolog and you like Pokémon, you’ll appreciate this tutorial.

An Early History Of Space Stations: Where’s My Wheel?

Last time we found out the idea of space stations is surprisingly old. By the 1950s, everyone knew we’d be working in beautiful space stations that rotated like a wheel to give us the illusion of gravity. Of course, that didn’t happen. But we did get some practical space stations, even before the current crop. The road to get there, though, was predictably bumpy.

Convair: From TASSEL to MARS

Convair had been studying multi-person orbital stations under Krafft Ehricke since the late 1950s. One result was TASSEL, an acronym for the Three Astronaut Space System Experimental Laboratory. Proposed in 1960, TASSEL was a three-man laboratory intended for an Atlas-Centaur launch into a roughly 200-nautical-mile orbit and missions lasting two or three weeks.

Around the same time, the Air Force asked contractors for proposals for a Military Test Space Station, or MTSS. Convair was one of five companies selected for the study in 1960. The surviving record suggests that Convair’s TASSEL work fed directly into its MTSS proposal.

Continue reading “An Early History Of Space Stations: Where’s My Wheel?”

An Early History Of Space Stations: The Brick Moon Made Real

People have lived in space stations for decades now, but something is wrong with them. Where are the big rotating wheels? You know the ones. They show up in old paintings of the future and, perhaps most memorably, in 2001: A Space Odyssey. Spin a great wheel in space, and people can stroll around inside with something that feels suspiciously like gravity. It seems like an obvious idea.

It is also an old idea. Much older than actual spaceflight, in fact. But to find the beginning of the space station, we have to go back to a time when powered aircraft were still several decades in the future.

A Moon Made of Bricks

In 1869, Edward Everett Hale published The Brick Moon in The Atlantic Monthly. The moon in question wasn’t natural. Hale imagined building a 200-foot-diameter sphere made from bricks and putting it into orbit as a navigation aid. Sailors could sight it and use its known orbit to determine their longitude. There was only one small problem: the thing was accidentally launched with people aboard.

That makes The Brick Moon generally regarded as not only the first fictional artificial satellite, but also the first fictional space station. Hale followed it in 1870 with Life on the Brick Moon, describing how the accidental colonists got along up there.

Hale didn’t have rockets. He proposed flinging the thing into the sky with giant flywheels, but, then again, it was 1869, so we’re inclined to cut him some slack. As the 19th century turned into the 20th, however, people started doing the math.

Konstantin Tsiolkovsky is best remembered for putting rocket flight on a sound theoretical footing. The Russian schoolteacher wrote extensively about orbital flight and space habitation, envisioning people living in orbit long before anyone had demonstrated that a liquid-fueled rocket actually worked. His ideas included rotating habitats to provide artificial gravity.

Hermann Oberth’s 1923 book Die Rakete zu den Planetenräumen — The Rocket into Planetary Space — Oberth went beyond fiction and seriously considered a permanently inhabited station. He envisioned it being periodically supplied by smaller rockets, serving as an observation and communications platform, and even acting as a jumping-off point for trips farther into space. He also suggested spinning the station to give the crew artificial gravity.

Continue reading “An Early History Of Space Stations: The Brick Moon Made Real”