Seeing Code: The Widescreen Rant

A couple of weeks ago, Linus Torvalds laid down the law, in a particularly Linusesque sort of way. In a software community where tabs vs. spaces can start religious wars, saying that 80-character-wide code was obsolete was, to some, utter heresy. For more background on how we got here, read [Sven Gregori]’s history piece on Hackaday, and you’ll learn that sliced bread and the 80-character IBM punch card both made their debut in July, 1928. But I digress.

When I look at a codebase, I like to see its structure, and I’m not alone. That’s one of the reasons for the Linux Kernel style guide’s ridiculously wide 8-character tabs. Combined with a trend for variable names becoming more and more descriptive, which I take to be a good thing, and monitors’ aspect ratios growing seemingly without end, which I don’t, the 80-column width seems like a relic from the long-gone era of the VT-220.

Hazeltine TerminalIn Linus’ missive, we learn that he runs terminals at 100 x 50, and frequently drags them out to a screen-filling 142 x 76. (Amateur! I write this to you now on 187 x 48.) When you’re running this wide, it doesn’t make any sense to line-wrap argument lists, even if you’re using Hungarian notation.

And yet, change is painful. I’ve had to re-format code to meet 73-column restrictions for a book, only to discover that my inline comments were too verbose. Removing even an artificial restriction like the 80-column limit will have real effects. I write longer paragraphs, for instance, on a wider screen.

I see a few good things to come out of this, though. If single thoughts can be expressed on single lines, it makes the shape of the code better reflect its function. Getting rid of pointless wrapping takes up less vertical space, which is at a premium on today’s cinematic monitors. And if it makes inline comments better (I know, another holy war!) or facilitates better variable naming, it will have been worth it.

But any way you slice it, we’re no longer typing on the old 80-character Hazeltine. It’s high time for our coding style and practice to catch up.

Building A 3270 Terminal Controller

We like to talk about how most of our computers today would have been mainframes a scant 40 or 50 years ago. Because of that, many people who want to run IBM mainframes such as the IBM 360 or 370 use the Hercules emulator to run the big iron on their PCs. However, mainframe IBM computers used an odd style of terminal and emulating it on a PC isn’t always as satisfying. At least, that’s what [lowobservable] thought, so he decided to get a 3270 terminal working with Hercules.

Back in the bad old days of computing, there were two main styles of terminals. Some companies, for example DEC, essentially used terminals as a “glass teletype.” That is, the screen was an analog of a roll of paper — more or less — and the keyboard immediately sent things to the remote system. However, companies like IBM and HP favored a different approach. Their terminals dealt with screens full of data. The terminal was smart enough to let you fill in forms, edit text on the screen, and then you’d send the entire screen in one gulp. Both systems had pros and cons, but — as you might expect — the screen-oriented terminals were more complex.

Continue reading “Building A 3270 Terminal Controller”

Linux Command Line Productivity With Tmux

It is no secret that most Linux power users use the shell for many tasks, as for people who know what they are doing, it can be quite efficient. In addition, there are some tasks that can only be carried out from the command line, although their number shrinks every year. However, these days we are spoiled because you can have one X session running lots of terminals at once. If you log into a server, it might not have X. Or you might log into a computer over a slow connection where X is painful to use. What then? The modern answer is the tmux terminal multiplexer, and [zserge] has a thoughtful introduction to how you can use tmux for improved productivity at the command line.

In particular, he shares some configuration and offers sound advice. For example, do you really need a status bar that shows you CPU load at all times? Cool, yes, but not always a practical win.

Continue reading “Linux Command Line Productivity With Tmux”

This Compact Pi Terminal Will Show You The Way

The Raspberry Pi holds incredible promise for those looking to build a small mobile terminal that they can take with them on the go, something you can throw into your bag and pull out whenever there’s some hacking to be done. But getting the diminutive Linux board to that point can take quite a bit of work. You need to find a suitably small keyboard, design a custom case, and wire it all up without letting any of that pesky Magic Smoke escape.

But a recent project from [remag293] might make things a bit easier for those looking to get their feet wet in the world of custom mobile computers. The boxy handheld device has everything you need, and nothing you don’t. A basic case, a short parts list, and an absolute minimum of wiring. What’s not to love? Even if you don’t make an exact clone of this device, it’s an excellent reference to quickly bootstrap your own bespoke terminal.

So what’s inside the 3D printed case? Not a whole lot, really. Obviously there’s a Raspberry Pi, a 3.5 inch TFT touch screen display, and a miniature keyboard. The keyboard is of the Bluetooth variety, and other than being freed from its enclosure and wired into the header on the display module for power, it’s otherwise stock.

As for the parts you can’t see from the outside, there’s a 3.7 V 4400 mAh battery pack and an Adafruit PowerBoost 1000 module to handle charging and power distribution. Beyond the big lighted button on the side (which you could certainly replace with something more low-key should you chose), that’s about it. When it’s all together, you’ve got a battery powered computer that’s ready for the road with a minimum amount of fuss.

If you’re looking for something that’s a bit larger, and more than a little unconventional, you could start by printing out a full cyberdeck. After all, if you’re going to build your own non-traditional portable computer, you might as well go all out.

A Raspberry Pi Terminal That’s Always Within Reach

Inspired by films such as The Matrix, where hackers are surrounded by displays and keyboards on articulated arms, [Jay Doscher] created this cyberpunk “floating” terminal so your favorite Linux single board computer is always close at hand. Do you actually need such a thing mounted to the wall next to the workbench? Probably not. But when has that ever stopped a Hackaday reader?

[Jay] has come up with a modular design for the “A.R.M. Terminal” that allows the user to easily augment it with additional hardware. The 3D printed frame of the terminal has hardpoints to bolt on new modules, which thanks to threaded metal inserts, will have no problem surviving multiple configurations.

This initial version features a panel on the left side that holds various buttons and switches attached to the Pi’s GPIO pins. With a bit of code, it’s easy to pick up the status of these controls and use them to fire off whatever tasks your imagination can come up with. On the bottom [Jay] has mounted a stand-alone VFD audio spectrum display that’s hooked up to the Pi’s 3.5 mm jack. It’s totally unnecessary and costs as much as the Raspberry Pi itself, but it sure is pretty.

If there’s a downside to the design, it’s that the only display currently supported is the official Raspberry Pi touchscreen which is only 800×480 and a bit pricey compared to more modern panels. On the other hand, there’s something to be said for the standardized bolt pattern on the back of the official screen; so if you want to use a higher resolution display, be prepared to design your own mounting bracket. Extra points if you share your changes with the rest of the class.

For anyone who likes the look of the A.R.M. Terminal but isn’t too keen on being tethered to the wall, you’re in luck. [Jay] previously created the Raspberry Pi Recovery Kit which shares many of the same design principles but puts them into a ruggedized case that’s ready for life in the field.

Line Printer Does Its Best Teletype Impression

Back in the early days of computing, user terminals utilized line printers for output. Naturally this took an incredible amount of paper, but it came with the advantage of creating a hard copy of everything you did. Plus it was easy to annotate the terminal output with nothing more exotic than a ballpoint pen. But once CRT displays became more common, these paper terminals (also known as teleprinters, or teletypes) quickly fell out of style.

A fan of nostalgic hacks, [Drew DeVault] recently tried to recreate the old-school teletype experience with (somewhat) more modern hardware. He picked up an Epson LX-350 line printer, and with a relatively small amount of custom code, he was able to create a fairly close approximation of what it would have been like to use one of these terminals. He’s published all the source code, so if you’ve got an old line printer and a Linux box, you too can learn what it was like to measure your work day in reams of paper.

This is made possible by the fact that the modern Linux virtual terminal is simply a userspace emulation of those physical terminals of yore. [Drew] just need to write some code that would essentially spawn a shell on the Linux USB line printer device, plus sprinkle in some quality of life improvements such as using Epson’s proprietary ANSI escape sequences to feed the paper out far enough so the user can see what it says before pulling it back in to write the next interactive line.

Of course, the experience isn’t perfect as the printer naturally doesn’t have a keyboard attached to it. If you’re looking for something a bit more authentic, you could always convert an old electric typewriter into a modern-ish teletype.

A Bootable Greeting For The Xenomorph In Your Life

When he needed a gift for his Alien superfan friend, [Stephen Brennan] decided the best way to put his unique set of skills to use would be to create a bootable Linux operating system that captures the sights and sounds of the Nostromo’s retro-futuristic computer systems. We could all use a friend like that.

Even if would never occur to you gift somebody a bootable flash drive, there’s a wealth of information in this blog post about Linux customization which could be useful for all sorts of projects. From creating a bootsplash image to automatically starting up a minimalistic windowing environment so a single graphical application takes center stage.

Whether you’re looking to tweak your desktop machine or build a Raspberry Pi kiosk, the commands and tips that [Stephen] shows off are sure to be interesting for anyone who’s not quite satisfied with how their Linux distribution of choice looks “out of the box”.

But there’s more to this project than a custom wallpaper and some retro fonts. [Stephen] actually took the time to create a facsimile of the “Personal Terminal” computer interface shown in the recent Alien: Isolation game in C using ncurses. The resulting program, aptly named “alien-console”, is released under the BSD license and is flexible enough that you could either use it as a base to build your own cyberpunk UI, or just load it up with custom text files and use it on your cyberdeck as-is.

Finally, to really sell the Alien feel, [Stephen] went through and ripped various audio clips from the film and wove them into the OS so it would make the movie-appropriate boops and beeps. He even included a track of the Nostromo’s ambient engine noise for proper immersion. But perhaps our favorite trick is the use of the sleep command to artificially slow down the terminal and give everything a bit more “weight”. After all, flying a pretend starship should feel like serious business.