Archive for Technology category

Make Home & End keys behave like Windows on Mac OS X  

I’ve been using Mac OS X daily since 2001 when I purchased my Titanium PowerBook and I still can’t get used the home and end key behavior.

If, like me, you want Home to send you to the start of the line and not to the top of the document then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:

{
    "\UF729"  = moveToBeginningOfParagraph:; // home
    "\UF72B"  = moveToEndOfParagraph:; // end
    "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
    "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
    "^\UF72B" = moveToEndOfDocument:; // ctrl-end
    "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
    "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}

This remapping does the following in most Mac apps including Chrome (some apps do their own key handling):

  • Home and End will go to start and end of line
  • ShiftHome and ShiftEnd will select to start and end of line
  • CtrlHome and CtrlEnd will go to start and end of document
  • ShiftCtrlHome and ShiftCtrlEnd will select to start and end of document

Note that you will need to reboot after creating this file for it to take affect.

Also: If you have a PC keyboard with LED backlighting and would like the scroll-lock, num-lock or caps-lock LEDs on when using your Mac check out my free SetLEDS for Mac

[)amien

Revitalizing a BBC Micro  

Moving house means making possessions count so my collection of vintage computers has shrunk over the years and the bar keeps getting higher. Right now:

  1. It works – Test it, repair it or part with it. A wealth of online technical information makes this easier than ever.
  2. A small footprint – Eject unusable peripherals and accessories. Keep the essentials.
  3. Make it usable – Forget slow-loading tapes and corrupt disks, a fast loading is essential.
  4. Something special – It should either be collectable or one I have a connection with.

Recent casualties were my Apple ][e (no disks), Acorn ARM (wouldn’t boot) and Commodore VIC 20 (poor state). Next up is my Acorn BBC Micro B:

BBC attached to Amstrad monitor and giant twin floppy drives

Physical inspection

My ‘Beeb’ is in good condition and works well although the case screws have long since disappeared (a common theme in my collection) and it needed a good clean. These older mechanical keyboards attract serious dust and dirt.

Schools were filled with BBCs in the 80s and I’ve written about the origins of this love affair before. I learned first BBC BASIC and then some 6502 assembly (mixing it with Basic) while at school. I later picked this machine up around 91 after seeing a local paper advertisement.

A giant twin 5.25″ drive housing system (shown above) contained my one still-functional floppy drive. I want to be able to read some physical disks but in keeping with the minimal footprint I transplanted the floppy drive into a 5.25″ externally powered CD-ROM enclosure. Big reduction.

The BBC Micro has a few video output options – UHF, composite over BNC and RGB over 6-pin DIN connector. By a staggering coincidence the pinout is identical to the Amstrad CPC so works directly my Amstrad monitor, no adaptor cable required this time!

Replacement media, SD cards via GoSDC

BBC Micro with SD Card fitted

SD cards are my replacement storage of choice for vintage systems. I chose John Kortink’s GoSDC for the following reasons:

  1. Supports MMC, SD, SDHC up to 32GB
  2. Internally fits into a spare ROM socket
  3. Adds operating system commands for great integration
  4. Supports disc images, tape images and ROM images

Retro Isle comprehensively reviewed GoSDC in February (2015) and have a bunch of usage tips and tricks too.

Getting started with GoSDC

The device plugs into a ROM slot but to make life easy you can give it access to a second one so it can patch the filing system. The docs are complex as they describe the many possibilities available. Here’s my setup that works well on a BBC Micro Model B (known as Option B in the docs):

  1. Remove Acorn DFS ROM
  2. Fit GoSDC in slot third from right
  3. Fit cable from GoSDC jumper (middle-left) to pin 6 up from bottom right
  4. You should be left with the Acorn OS ROMs in the ROM sockets to the left of GoSDC

Once fitted, slide in an SD card and power up your BBC and you should see the usual welcome screen. Then type *SDCINFO and see the results:

BBC Computer 32K

Acorn DFS

BASIC

>*SDCINFO

GoSDC (mbe) 1.05 (01 Sep 2014)

ROM slots : main 15, free 13

Flash ROM : S25FL007, 1024 KiB

Flash card : SDHC, 7580 MiB

Available areas
---------------
X :     416256 bytes
1 : 4294966784 bytes
2 : 3653238784 bytes

>

If you see ROM slots main and free with numbers your device is correctly controlling two slots and can patch the DFS for you. If not, check the adapter and cable.

If you see “GoSDC : No flash card inserted” check the card is securely in and power cycle the machine. If it still doesn’t recognize it try another card. Note: When switching card you will need to press CtrlBreak for the machine to recognize it.

The first time you use a card you’ll need to format it. The command and subsequent output should look like this:

>*SDCTOOL SDCFO
Formatting area ... done
Verifying format ... ok
Please hard-reset your machine now
>

If you have a card greater than 4GB then it will create 4GB areas which can be switched between with *SDCAREA number. I’d recommend switching to the additional areas, formatting and CtrlBreak after each before you put any software on it as this command will wipe it out again.

Finally you’ll need to tell GoSDC to provide a patched filing system like this:

*SDCCONFIG FSNR 1
*SDCCONFIG FSRM 13
*SDCRESET
  • 1 sets Acorn DFS on my machine although the docs says it should be 2
  • 13 should match the free ROM slot shown in *SDCINFO

If you mess up your ROM selection and are unable to type because of ‘No drive’ do not fear! Press caps-lock and break twice to get the prompt back and choose another.

Finding old software

One option is to image all your floppy discs to SD card but you are probably going to find that those discs are corrupted. Thirty year old floppy disks are not reliable.

Another option is to download old software online. This can be a grey area as the software is copyrighted but no longer sold and many authors are okay with allowing it (e.g. Ian Bell and David Braben of Elite fame). A great site that honors the wishes of authors can be found at the weirdly named Stairway to Hell.

The author of GoSDC supplies Windows scripts to download, unpack and write the files to disc which I took the liberty of porting to Bash so they could be used on Mac OS X and Linux.

Recommended old games

Purely based on subjective childhood experiences…

  • Elite a 3D space trading game so good they recently Kickstarted Elite 4
  • Citadel one hundred screens of arcade adventure madness
  • Chuckie Egg quick platform dash with birds, ducks, eggs and platforms
  • Repton Boulderdash to the next level, try 1 or 3, Repton 2 is insanely hard
  • Granny’s Garden educational fun alas distribution is denied as they sell an iPad version

Using GoSDC

Once the card is loaded up with software the actual commands are simple:

*SDCLIST

Will list the contents although you’ll probably want to put a wildcard after it to limit it down. Remember CtrlShift pauses the screen on the BBC!

Then, to mount a disc you use *SDCDISC and provide the name to mount. You can also use wildcards here and it will pick up the first match. e.g.

*SDCDISC *Chuckie*

Once mounted hold down Shift and tap Break to boot the game (or educational title, right?)

A few other useful commands are:

*. List contents of a disc
*EXEC !BOOT Is what ShiftBreak actually does
CHAIN "filename" To LOAD and RUN a BASIC program from disc
*filename To execute machine code programs from disc

I put some BBC Micro tips and tricks together or you can can grab PDFs of pretty much every book created for the BBC Micro .

You can also see which discs are currently selected using *SDCDISC with no arguments. You’ll note you can mount a second disc and the command to do that is *SDCEXTRA with usage otherwise exactly like *SDCDISC.

GoSDC can do much more including imaging your real floppy discs and writing them back out so be sure to check out the comprehensive documentation which also includes how to upgrade the firmware (use another memory card as that process uses FAT no the GoSDC file system)

Out for Pi Day!

Pi Day (3/14/15 = 3.1415) was last weekend and my work put on a session for kids about how to program the Raspberry Pi using Scratch and a breadboard (using CanaKits so we had a breadboard, LEDs, switches, wires, resistors etc.).

Me helping some kids with a circuit connected to their Pi!

The original Raspberry Pi was heavily inspired by the BBC Micro and even the name “Model B” took cues from the original. Few people also seem to realize that the manufacturer of the BBC Micro – Acorn – went on to create a processor for it’s sequel the Acorn RISC Machine or ARM for short. That’s right, the Pi is powered by an Acorn processor design (like most smartphones) so it made sense to bring it in.

Alas it was a hectic event with little time to show the machine. In fact just sitting there it popped a capacitor in a puff of smoke!

Power supply repair

Despite the noise and smoke the dying capacitor didn’t actually stop the machine working as it is part of the electromagnetic interference suppression not the power circuitry itself. Still, it should be repaired and I thought I may as well replace the other X2 film capacitor as they have been failing over the last 30 years.

BBC power supply with blown X2 capacitor BBC power supply with new X2 capacitors

I picked up a couple of RIFA PME 271 M capacitors – 100nf and 10nf – (with a matching pitch so they would fit correctly) from Mouser for less than $2 each plus shipping. Five minutes of desoldering and soldering later and it was good as new!

[)amien

What to do before your iTunes Match subscription expires  

At $25 a year the iTunes Match service can be a little tough to swallow given all it does is synchronize your music across iTunes especially when other file-sharing services are cheaper and more general purpose (OneDrive, Mega, DropBox etc).

One important thing to know however before you let your subscription lapse or cancel is that once it’s gone all your cloud-backed-up music will be unavailable.

That means if you don’t still have a local copy of the track your ripped from CD/download from anywhere but iTunes you’re going to be digging through backups or have to re-rip or repurchase it.

There is a simple way to download all your missing music before your subscription expires though.

Steps to download all your iTunes Match tracks

  1. Start up iTunes
  2. Create a new Smart Playlist with the criteria (as shown in screenshot)
    1. iCloud Status is matched
    2. Location is not on this computer
      iTunes Smart Playlist for finding Cloud-only tracks
  3. Save this Smart Playlist as say “iTunes Match Download”
  4. Browse to this Smart Playlist and select one song
  5. Select all with CtrlA (Windows) or CmdA (Mac)
  6. Consider the total size at the bottom of the screen in terms of whether you have this disk space or bandwidth allowance.
  7. Right click on the items and choose Download

This may take a while. You can see the status by opening the Downloads window.

If the downloads stop or fail for any reason just repeat steps 4-6 as your new playlist will keep shrinking as files are now available on your computer.

Enjoy!

[)amien

Setup an Ubuntu server at Digital Ocean  

This post is part of a series on Turbocharging WordPress with NGINX and HipHopVM but also serves as a standalone beginners guide to getting an Ubuntu server ready at Digital Ocean.

Virtual machines are called Droplets at Digital Ocean so hit Create then:

1. Give it a name

Give your server a name. This has no bearing on the name your customers see and is only for initially connecting to it/in the Digital Ocean dashboard.

2. Select size

A popular blog should have no problem with the $10 a month 1GB/30GB/2TB option but I run a few sites so went for the next one up with more CPU and RAM.

You can scale up later although you won’t get the extra disk space as it can’t resize the disk. Given static storage like Amazon S3 is cheap and integrates with their CloudFront CDN this isn’t a problem.

3. Select region

Is your audience focused in a specific area?

  • Yes (e.g. a real estate site) then choose the closest server to them
  • No – choose the US East Coast like New York for good global coverage

4. Select Image

Here you select which distribution of Linux, which version and which CPU architecture you want to use.

For this guide I’m using Ubuntu 14.04 x64. In theory you could use alternative distributions or versions but you’re on your own.

Do not select x32 as HipHopVM is only supported on 64-bit architectures.

4. Add optional SSH keys

SSH keys let you automatically sign in without a password – the security being a key file on your computer instead. It’s worth learning how to use this but is outside the scope of this article so just use the normal password for now.

5. Settings

Leave the defaults on unless you want to pay extra for their backup service. Personally I like to use a WordPress plugin that backs up to S3 called UdraftPlus.

6. Hit Create Droplet

Within 60 seconds you should have a fresh virtual machine ready to go.

Connect to your Ubuntu virtual machine/droplet

You will need ssh (preinstalled on a Mac, Windows users should check out Putty) Check the IP address shown on your droplet’s page then:

ssh root@107.170.26.154

You should confirm the fingerprint the first time by typing yes then be rewarded with a Welcome message and a cursor to type new commands into!

Update your Ubuntu virtual machine

Even though the version of Ubuntu you chose is quite up to date there will be a few updates to apply, thankfully this is very easy.

sudo apt-get update

Tells the package manager (known as “apt”) to go find out about all the updates. It doesn’t yet install them though, to do that we need to wait until it’s finished then type:

sudo apt-get upgrade

You’ll need to confirm this with Y and wait a little bit. This upgrades a lot of the packages and applications. Once complete then:

sudo apt-get dist-upgrade

This tells apt to upgrade the core operating system as well. Again confirm with Y and wait a little bit. Once this one is complete you’ll need to reboot your machine with:

sudo reboot now

You’re now ready to reconnect and starting installing packages to make your virtual machine do something useful!

[)amien