Getting status from dd when writing disk images on MacOS

dd is a pretty useful tool for creating and writing disk images from a source to a destination, for example writing disk .img files to SD Cards for your Raspberry Pi (see here, and here).

The trouble is if you’re writing images that are several GB that can run for 20mins or so, you don’t get any feedback on the progress until it’s complete. Well turns out if you send a ‘kill -INFO’ signal to the PID of the process, it will output the current status of bytes written and bytes remaining. Found this tip here.

Serving static content, REST endpoints and Websockets with Express and node.js

I’ve yet to see a framework that is as simple as Express for developing REST endpoints. I’m experimenting with a React app that receives push updates from the server using Websockets. Is it possible to use Express to serve all the requests for this app: static content (the React app), REST endpoints and Websocket? Turns out, yes, and it’s pretty easy too.

Starting first using Express to serve static content:

This uses the static middleware for serving the static content.

Handling REST requests with Express is simple using the get(), post(), put(), and delete() functions on the Router. Adding an example for a GET for /status now we have this:

 

Next, adding support for Websockets, using the ws library. Incrementally adding to the code above, now we create a WebSocket.Server, using the option to pass in the already created HTTP server:

const wss = new SocketServer({ server });

At this point we add callbacks for ‘connection’ and ‘message’ events, and we’re in business:

This is the starting point for a React app to build a websockets client, more on that in a future post. The code so far is available in this github repo: https://github.com/kevinhooke/NodeExpressStaticRESTAndWebsockets

2002 Power Mac G4 Quicksilver from eBay – on it’s way

For no other good reason than “why not” I just picked up a Power Mac G4 800Mhz from eBay for < $100, with OS X 10.4 installed. I’ve been shopping for a G4 MDD for a while, but as the highest spec’d G4 that can still run Mac OS 9 these seem to go for a pretty penny on eBay given their age. I almost picked up an MDD without a HDD for a decent price, but for a working machine with a fresh OS X install this G4 seems a pretty safe bet, so fingers crossed, now waiting for my new toy to arrive.

Samsung Galaxy S8 and the DeX dock

It’s interesting how some tech product features come and go over time. It’s not the first time we’ve had a dockable phone that converts into a desktop replacement while in it’s dock. We’ve had the Motorola Atrix with it’s dual boot Android and Linux WebTop desktop when inserted into its laptop dock or docking cradle. Motorola’s Lapdock also supported a number of other Android phones that had the same capability (include the Droid Bionic, Droid Razr).

More recently, Microsoft’s Lumia 950 with Window Mobile’s Continuum feature tried to bring us the promise of a mobile Windows device that you could dock while not on the go to provide a Windows desktop experience from the same device.

Today’s Samsung Unpacked 2017 event introduced the expected S8 and S8+. It’s an incredibly attractive new flagship device that is most likely going to sell like hotcakes, despite even the disaster that was the Note 7. The curious wildcard feature though is a new feature called DeX that allows you to dock your phone into a docking cradle and use it as a desktop.

Given the lacklustre interest in this capability in previous products so far, what makes Samsung think that this is going to capture our interest now? Or as Engadget asks, “Does anyone want to use a phone as a desktop?”