Learn To Program With Literate Programming

My heyday in programming was about five years ago, and I’ve really let my skills fade. I started finding myself making excuses for my lack of ability. I’d tackle harder ways to work around problems just so I wouldn’t have to code. Worst of all, I’d find myself shelving projects because I no longer enjoyed coding enough to do that portion. So I decided to put in the time and get back up to speed.

Normally, I’d get back into programming out of necessity. I’d go on a coding binge, read a lot of documentation, and cut and paste a lot of code. It works, but I’d end up with a really mixed understanding of what I did to get the working code. This time I wanted to structure my learning so I’d end up with a more, well, structured understanding.

However, there’s a problem. Programming books are universally boring. I own a really big pile of them, and that’s after I gave a bunch away. It’s not really the fault of the writer; it’s an awkward subject to teach. It usually starts off by torturing the reader with a chapter or two of painfully basic concepts with just enough arcana sprinkled in to massage a migraine into existence. Typically they also like to mention that the arcana will be demystified in another chapter. The next step is to make you play typist and transcribe a big block of code with new and interesting bits into an editor and run it. Presumably, the act of typing along leaves the reader with such a burning curiosity that the next seventeen pages of dry monologue about the thirteen lines of code are transformed into riveting prose within the reader’s mind. Maybe a structured understanding just isn’t worth it.

I wanted to find a new way to study programming. One where I could interact with the example code as I typed it. I wanted to end up with a full understanding before I pressed that run button for the first time, not after.

When I first read about literate programming, my very first instinct said: “nope, not doing that.” Donald Knuth, who is no small name in computing, proposes a new way of doing things in his Literate Programming. Rather than writing the code in the order the compiler likes to see it, write the code in the order you’d like to think about it along with a constant narrative about your thoughts while you’re developing it. The method by which he’d like people to achieve this feat is with the extensive use of macros. So, for example, a literate program would start with a section like this:

Continue reading “Learn To Program With Literate Programming”

How An Amiga Graphics Business Ran In The 1990s

If you have ever used an eraser to correct a piece of pencil work, have you ever considered how much of an innovation it must have seemed when the first erasers were invented? It might seem odd to consider a centuries-old piece of stationery here on Hackaday, but there is a parallel in our own time. Digital image manipulation is such a part of everyday life these days as to have become run-of-the-mill for anyone with a mobile phone and the right app, but it’s easy to forget how recent an innovation it really is. Only a few decades ago your only chance of manipulating a photograph was to spend a lot of time in a darkroom with a photographic developer of exceptional skill, now children who have never known a world in which it wasn’t possible can manipulate their selfies with a few deft touches of the screen.

[Steve Greenfield] pointed us at a detailed description of the business he ran in the 1990s, offering digital and composite photography using an upgraded Amiga 3000.  It caught our attention as a snapshot of the state of digital image manipulation when these things still lay at the bleeding edge of what was possible.

His 3000 was highly customised from the stock machine. It featured a Phase 5 68060 accelerator board, a Cybervision 64 graphics card, a then-unimaginably-huge 128MB RAM, and an array of gigabyte-plus Fast SCSI drives.  To that he had attached a Polaroid SCSI digital camera with a then-impressive 800×600 pixel resolution. The Polaroid had no Amiga drivers, so he ran the Shapeshifter Mac emulator to capture images under the MacOS of the day. The fastest 68000-series Mac only had a 68040 which the early PowerPC Macs could only emulate, so he writes that his 68060-equipped Amiga ran the Mac software faster than any Mac at the time.

His stock-in-trade was attending sci-fi conventions and giving costumed attendees pictures with custom backgrounds, something of a doddle on such a souped-up Amiga. He writes of the shock of some Microsoft employees on discovering a 60MHz computer could run rings round their several-hundred-MHz Pentiums running Windows 95.

His business is long gone, but its website remains as a time capsule of the state of digital imagery two decades ago. The sample images are very much of their time, but for those used to today’s slicker presentation it’s worth remembering that all of this was very new indeed.

In a world dominated by a monoculture of Intel based desktop computers it’s interesting to look back to a time when there was a genuine array of choices and some of them could really compete. As a consumer at the start of the 1990s you could buy a PC or a Mac, but Commodore’s Amiga, Atari’s ST, and (if you were British) Acorn’s ARM-based Archimedes all offered alternatives with similar performance and their own special abilities. Each of those machines still has its diehard enthusiasts who will fill you in with a lengthy tale of what-if stories of greatness denied, but maybe such casualties are best viewed as an essential part of the evolutionary process. Perhaps the famous Amiga easter egg says it best, “We made Amiga …

Here at Hackaday we’ve covered quite a few Amiga topics over the years, including another look at the Amiga graphics world. It’s still a scene inspiring hardware hackers, for example with this FPGA-based Amiga GPU.

Amiga 3000 image: By [Joe Smith] [Public domain], via Wikimedia Commons.

Netbook Finds New Home In A Jaguar Dashboard

You’d figure a luxury car like a Jaguar would have a high-end infotainment system. [RichTatham]’s Jag did, but the trouble was that it was a high-end system when a cassette deck and trunk-mounted CD changer were big deals. So naturally, he saw this as a great reason to modernize the system by grafting a netbook into the Jag’s dash. The results are fantastic!

Even though the Jag’s original system didn’t have much left that made it into the final project — the navigation system, CD changer, phone and even the amps ended up on the scrap heap — at least the dashboard instrument cluster proved to be very amenable to his mods. By substituting a climate control cluster from another model into his car, he was able to free up tons of space for the netbook’s 8″ display. A custom bezel and some clever brackets completed the head-end of the new system, and the look is as close to a factory install as you’re likely to find in an aftermarket mod. With the netbook stashed in the bay vacated by the OEM system, a GPS dongle, and a USB sound card connected to a 5.1 amp using the original speakers this jag is ready to bump. We bet that the system sounds as good as it looks, and with the added functionality of a Windows PC to boot.

For obvious reasons, lots of computers make it into hackers’ dashboards, whether they be Windows like this one, Samsung tablets or Nexus tablets running Android, and even phones. But [Rich]’s build is top notch, and takes in-car integrations to the next level.

[via r/diy]

Hands-On With The BBC Micro:Bit

It’s been a long wait, but our latest single board computer for review is finally here! The BBC micro:bit, given free to every seventh-grade British child, has landed at Hackaday courtesy of a friend in the world of education. It’s been a year of false starts and delays for the project, but schools started receiving shipments just before the Easter holidays, pupils should begin lessons with them any time now, and you might even be able to buy one for yourself by the time this article goes to press.

The micro:bit top view
The micro:bit top view

It’s a rather odd proposition, to give an ARM based single board computer to coder-newbie children in the hope that they might learn something about how computers work, after all if you are used to other similar boards you might expect the learning curve involved to be rather steep. But the aim has been to position it as more of a toy than the kind of development board we might be used to, so it bears some investigation to see how much of a success that has been.

Opening the package, the micro:bit kit is rather minimalist. The board itself, a short USB lead, a battery box and a pair of AAA cells, an instruction leaflet, and the board itself.  Everything is child-sized, the micro:bit is a curved-corner PCB about 50mm by 40mm. The top of the board has a 5 by 5 square LED matrix and a pair of tactile switches, while the bottom has the surface-mount processor and other components, the micro-USB and power connectors, and a reset button. Along the bottom edge of the board is a multi-way card-edge connector for the I/O lines with an ENIG finish. On the card edge connector several contacts are brought out to wide pads for crocodile clips with through-plated holes to take 4mm banana plugs, these are the ground and 3V power lines, and 3 of the I/O lines.

Continue reading “Hands-On With The BBC Micro:Bit”

Kerbal Space Program For The Apple II

[Vince Weaver] tried to use his time machine to jump a few years in the future to get a less buggy version of Kerbal Space Program, but as usual with time travel, nothing went right and he ended up heading to 1987. Finding himself in an alternate timeline where KSP had been released for the Apple II, he brought back a copy.

Well, that’s the narrative proposed by [Vince Weaver] on his YouTube channel. The real story, and hack, being that he wrote a version of KSP for the Apple II in Applesoft Basic. He has used the language for the ridiculous before. You can build a rocket, select a pilot, launch, and if you’re lucky (or skilled), reach orbit.

We loaded up his disk image on an Apple II emulator and gave it a try. We managed to murde—lose a few pilots, but that was about it.  It was hard not to get distracted by the graphics and remember to point the rocket the right direction. Either way, it was a neat bit of fun in retro computing. Video after the break.

Continue reading “Kerbal Space Program For The Apple II”

Raspberry Pi Cluster Build Shows How And What

Raspberry Pi clusters are a dime a dozen these days. Well, maybe more like £250 for a five-Pi cluster. Anyway, this project is a bit different. It’s exquisitely documented.

[Nick Smith] built a 5-node Pi 3 cluster from scratch, laser-cutting his own acrylic case and tearing down a small network switch to include in the design. It is, he happily admits, a solution looking for a problem. [Smith] did an excellent job of documenting how he designed the case in CAD, prototyped it in wood, and how he put the final cluster together with eye-catching clear acrylic.

Of interest is that he even built his own clips to hold the sides of the case together and offers all of the files for anyone who wants to build their own. Head over to his page for the complete bill of materials (we didn’t know Pis were something you could order in 5-packs). And please, next time you work on a project follow [Nick’s] example of how to document it well, and how to show what did (and didn’t) work.

If 5 nodes just doesn’t do it for you, we suggest this 120-node screen-equipped monster, and another clear-acrylic masterpiece housing 40 Pis. This stuff really isn’t only for fun and games. Although it wasn’t Pi-based, here’s a talk at Hackaday Belgrade about an ARM-based SBC cluster built to crunch numbers for university researchers.

How The Dis-integrated 6502 Came To Be

I made a bee line for one booth in particular at this year’s Bay Area Maker Faire; our friend [Eric Schlaepfer] had his MOnSter 6502 on display. If you missed it last week, the unveiling of a 6502 built from discrete transistors lit the Internet afire. At that point, the board was not fully operational but [Eric’s] perseverance paid off because it had no problem whatsoever blinking out verification code at his booth.

I interviewed [Eric] in the video below about the design process. It’s not surprising to hear that he was initially trying to prove that this couldn’t be done. Unable to do so, there was nothing left to do but devote almost six-months of his free time to completing the design, layout, and assembly.

What I’m most impressed about (besides just pulling it off in the first place) is the level of perfection [Eric] achieved in his design. He has virtually no errors whatsoever. In the video you’ll hear him discuss an issue with pull-up/pull-down components which did smoke some of the transistors. The solution is an in-line resistor on each of the replacement transistors. This was difficult to photograph but you can make out the soldering trick above where the 3-pin MOSFET is propped up with it’s pair of legs on the board, and the single leg in the air. The added resistor to fix the issue connects that airborne leg to its PCB pad. Other than this, there was no other routing to correct. Incredible.

The huge schematic binder includes a centerfold — literally. One of the most difficult pieces of the puzzle was working out the decode ROM. What folds out of this binder doesn’t even look like a schematic at first glance, but take a closer look (warning, 8 MB image). Every component in that grid was placed manually.

I had been expecting to see some tube-based goodness from [Eric] this year. That’s because I loved his work on Flappy Bird on a green CRT in 2014, and Battlezone on a tube with a hand-wound yoke last year. But I’m glad he stepped away from the tubes and created this marvelous specimen of engineering.