Installing emacs & org-mode on Windows

Introduction

At home I am on LINUX pretty much full-time.  I only run Windows inside a VM in some special circumstances.  But at work I have to use Windows due to corporate policy, so I regularly face the challenge of finding cross-platform software which I can use both at home and at work.

One of the things I had to change when I switched from Windows at home was my text editor, because the previous editor I used was a Windows only application.

I decided that I would take the opportunity to go the whole-hog and learn a “proper” comprehensive text editor.  But this would involve a significant and ongoing investment of my time, so I wanted an editor that I could learn once and then use it everywhere.

I chose emacs.

Since then I have discovered org-mode (a major-mode for emacs which supports task management) and I have developed a detailed configuration which enables me to plan my work, clock time spent on tasks, develop projects, take notes, produce reports, etc.

Of course, I needed a setup which would allow me to work cross-platform, so that my text editing and org-mode task management would be seamless no matter if I worked at the office on Windows or at home on LINUX.  The need for a cross-platform installation and configuration was born.

In this blog I will explain my method for installing emacs on Windows.  Some of the decisions I make are related to my desire for cross-platform use, and these will be discussed.  But this blog works fine standalone, so even if all you’re interested in is using emacs on Windows, and you have no interest in sharing a configuration with LINUX, these instructions will still produce a working emacs installation on Windows for you.

I also discuss installation of org-mode and associated cross-platform use.

Pre-Requisites

EMACS ON LINUX

If you’re following this blog with the aim of cross-platform use, then you must already have a working installation on LINUX since I will not discuss the details of that here.  Your config file on LINUX must be available at ~/.emacs because that is the setup I am going to replicate on Windows.

GIT

I will discuss an org-mode installation that makes use of git.  If you don’t care to use org-mode and are only interested in emacs then this pre-requisite is not required and you can ignore it.  Otherwise, if you want to replicate my cross-platform setup with org-mode, you’ll need git.
I don’t explain how to install git on Windows, so if you’re unsure about that you will need to find some tutorials elsewhere and come back here once you’ve got git installed.  But here’s a hint: you need to visit the git web page, and install git for Windows.  If you prefer a GUI client I recommend tortoise git, you will need to install this separately.

INSTALLING EMACS

Cygwin

The first task is to install Cygwin.  Cygwin is a repository of GNU tools for Microsoft Windows.  This will allow you to install emacs on Windows and maintain an environment and file structure that is similar to that on LINUX.  This is essential to satisfy the cross-platform objective of the configuration.

Visit http://www.cygwin.com and download the Windows installer.  Launch it.

Advance the installer, and when asked to choose a download source, select “Install from internet”.

Next you will be asked to choose an install directory.  This will form the root of your Cygwin installation.  Inside it a file structure will be created, and this will include your “Home” folder.
The Home folder is the crucial ingredient; this will allow us to maintain an emacs installation that is the same across Windows and LINUX.

You don’t need to do anything to set all this up.  Just advance the installer script.  You can choose a different install location if you want, but I tend to accept the default.

Choose the installation directory

Now it is time to choose the GNU packages you want to install.  I’ll stick to what is required for emacs here.  You can always go back and browse for further packages that interest you afterwards.  I’ll be showing you how to install more packages later on.

In the search box type “emacs”.  This will show all the emacs related packages.  Now expand the “Editors” tree.

You must select the emacs package.  This is the base emacs installation.  You will see the package install message change from “Skip” to the version number that is going to be installed.

Now you have a choice.  You can either select the emacs-X11 package, in which case you will get a console only version of emacs, or you can select the emacs-w32 package.  In this case you will get the full emacs experience with GUI.  Even though emacs usage is heavily weighted towards the keyboard, I still prefer this option.

The screen grab below shows the correct selections to make:

Selecting emacs packages

Advance the installer.

The next page asks you if it’s OK to install dependencies.  You need to leave this box checked and advance to the next page.

Now cygwin will start installing everything, including emacs.  Sit back and wait!

Installing cygwin & emacs

When the installer finishes you will have an option to create a desktop icon.  This shortcut is not for emacs! It’s a shortcut for the cygwin terminal.  The terminal is quite useful, so I recommend you allow the installer to create the shortcuts, but it’s up to you.

Setting up emacs.

Emacs is installed and will run as it is.  First, let’s check it works.  Launch the Cygwin terminal using the shortcut icon.

Now you will see a terminal appear.  If this is the first time you have launched a cygwin terminal you will see some initial setup take place; cygwin will create some startup files in your cygwin home directory.  Then you will get a terminal prompt.

In the terminal prompt, type:

emacs &

If everything has worked, you should find that a bare-bones default emacs setup will launch.

emacs first launch

 

Now it is time to set things up.  If you’re a seasoned emacs user you will surely have your own config file that you want to use.  If you’re new to emacs then you should still create the file we’re going to talk about (because you will undoubtedly want to edit it in the future).

Now, a disclaimer: I can’t possibly know what you’ve got inside your own .emacs file.  If you’ve created a rats-nest in there, and some things don’t work, it’s up to you to fix them.  I’m happy to answer questions if I can though! Ask them in the comments.  Note that I consider myself very much an amateur emacs user.  I am still learning the ropes myself! I don’t know everything.

I have quite an extensive .emacs file which I have developed while using emacs on LINUX.  I control it with git, so I checked out the file and copied it to my cygwin home directory.  Assuming you accepted the default cygwin installation path then the home directory will be located at:

C:\cygwin\home\user

Where ‘user’ is your Windows user name.

This is what we refer to as your “home” directory.  On LINUX the home directory for a user is typically abbreviated as ~/.  This abbreviation works in Cygwin as well, and that’s why we can develop a common configuration that works across LINUX and Windows.  We only need to make sure that critical files (e.g. files which are referred to explicitly in .emacs, or used in org-mode) are kept in the home directory with a file structure that is replicated across the two systems.  The location of the home directory itself is not important, nor is the user name, since we will use the ~/ abbreviation when we refer to the home directory in code.

Creating an emacs shortcut icon

You might find it tedious to have to launch a cygwin terminal and type ’emacs’ every time you want to launch the application.

To fix that you can find the emacs executable in the cygwin bin directory and send a shortcut for it to your desktop.  Or you can pin it to your start menu, whatever you want.  See the screen grab below:

Creating an emacs shortcut

 

That’s it for emacs! We’re done!

You just need some way to keep the .emacs file current on both your Windows and LINUX systems.  I use git for that, so whenever I make changes I commit them to a git repository and then simply pull the changes on each local system.  This means I have one configuration which works at home on LINUX and at work on Windows.  The user experience and functionality is identical between these systems.

If you want to set up org-mode, read on:

org-mode setup

There are a few ways to set up org-mode.  I don’t debate the pros and cons here, I only offer a method that works for me.

I run org-mode by pulling the latest code from a repository and then running uncompiled source files on my systems.  This works on both LINUX and Windows.  Here’s how to do it:

First, you need git installed.  Otherwise you’ll have to find a manual method by which you can obtain the org-mode source.

Clone the org-mode repository:

clone the org-mode repository

 

make

Now you need to install the make utility.  You can get it from the Cygwin repository.  It could have been selected and installed at the same time as emacs, but if you’re not familiar with Cygwin this is a good opportunity to find out how to install extra packages.

You need to launch the Cygwin installer again.  Advance the installer in the same way as you did before until you get to the package selections.  Change the ‘View’ combobox to “Full”.  Then search for “make”.

Install make

You need to install the GNU version.  Select it so that the status changes from skip to the version number that will be installed.  Then advance the installer in the same way as before.

Make will be installed.

make uncompiled org-mode

Now open a Cygwin terminal.  Change directory to the location of the org-mode repo (in my case it’s ~/git/org-mode).  Enter “make uncompiled”.  See screen grab below:

Synchronising org files

Now you need a way to synchronise your org files in a way that will be common on both LINUX and Windows with the file paths being identical.

Some people use git to sync their org files, and that’s something I’d like to explore.  But right now I am using ownCloud, which is a cloud storage tool.  I use ownCloud because I run my own server and prefer to be in control of my own files, but you can use any cloud storage tool: Dropbox, Google Drive, One Drive, they all should work the same.  If you’re looking to run cross-platform, like me, then your choice will be limited by the clients that are available on both platforms.

The important bit is setting a target path for the cloud storage client that can be repeated on both platforms.  That means setting it up in your home folder.

I have my org files set up in the following path on both systems:

~/ownCloud/Documents/emacs/org

This way I am safe to refer to this path in my .emacs file.  For example, I have some lines in my .emacs that tells org-mode to include all org files inside certain folders into the agenda view:

This works on both platforms because ~/ refers to my home folder on LINUX and to the Cygwin home on Windows.  As long as the rest of the path is common on both systems, it’ll work.

When I am at work my org files are changed as I clock into and out of tasks, complete tasks, set new tasks, take notes, and so on.  These changes are synchronised with my server using ownCloud, and then the ownCloud client on my LINUX side at home pulls down the changed files.

The Final Result

Here is a screen grab of my emacs installation.  The theme and all configuration is common across LINUX and Windows using a single .emacs file.

my emacs installation
org-mode agenda view

Flashing CyanogenMod onto Galaxy SII via Ubuntu

Pre-Requsites

Install Heimdall

Visit the Heimdall home page, select “Linux”, and download the package for your distribution.  On Ubuntu variants you want the latest ‘.deb’ package.  e.g.:

ubuntu13.04-heimdall_1.4.0-0_amd64.deb

Note that the “Frontend” packages are not required.  Everything can be done easily from the command line.

Install Heimdall using dpkg:

sudo dpkg -i ubuntu13.04-heimdall_1.4.0-0_amd64.deb

Install adb

Install adb from the Ubuntu repositories:

sudo apt-get install android-tools-adb

sudo apt-get install android-tools-fastboot

Download ClockworkMod Recovery

Download ClockWordMod Recovery for the Galaxy SII (i9100).  I got it from here.

Download CyanogenMod

Download a compatible version of CyanogenMod for your handset.  You can get it here.

My personal preference is to stick with CM11 (Android 4.x) on the Galaxy SII.  CM12 (Android 5.x) is available too but it’s an old handset now so you need to consider if it’s ideally suited to the newer versions of Android.  CM11 runs really fast on it, so I prefer that.

Download GAPPS

Normally the best place to get GAPPS (Google Applications; Play Store etc) is via OpenGAPPS.  But in my experience the packages provided by OpenGapps are too large for the Galaxy SII.  If you took my advice to install CM11, then you need GAPPS version gapps-kk-20140105-signed.zip, provided here.  This one is small enough to install successfully.

Flash Custom Recovery onto the Galaxy SII

With the handset turned OFF, place it into “Download Mode” by holding VOLUME-DOWN, HOME & POWER.
You should see a screen which looks like this:

IMG_20160717_092817

Press ‘VOLUME-UP’ to confirm and then you should see the Download Mode screen:

IMG_20160717_092840

Connect the handset to your computer via USB.

Now, on your computer, browse to the location where you downloaded the CWM package (see Pr-Requisites section).  Extract it.  It should come out as a filename called “zImage”.  If what you get is named something a bit different don’t worry, just take account for that in the terminal command you’re going to enter next…

Open a terminal and ‘cd’ to the directory where the CWM package was extracted.  Then enter the following command:

sudo heimdall flash --KERNEL zImage --no-reboot

You should see a blue transfer bar appear on the handset download screen.  The transfer is complete when the blue bar has filled, as shown in the photo below.

Downloading

IMPORTANT – Boot into Recovery Next

This next bit is a little important; you need to boot into the custom recovery you just installed next, before you do anything else.  If you don’t, the stock recovery might overwrite CWM.  The consequences of this are minimal; you’ll just have to start again! But to avoid this, boot into recovery as follows:

  • Disconnect your USB cable from the handset.
  • Turn the handset OFF by holding the POWER button.
  • Boot into CWM by holding VOLUME-UP, HOME & POWER.

You should see a screen like this:

IMG_20160717_095032

  • Now, using the VOLUME buttons select “wipe data/factory reset”
  • Press POWER to enter.
  • Select “Yes – Wipe all factory user data”
  • Press POWER to enter.

If factory wipe is successful you will be returned to the main menu.

Flash CyanogenMod

Now for the cool bits.  Connect your handset back to the computer via USB.
Open a terminal and ‘cd’ to the location where you downloaded the CyanogenMod zip file.  Don’t extract the zip! We’re going to transfer it as-is to the handset and then the handset will extract it and install.

At the handset, use the VOLUME buttons to select “install zip” and then press POWER to enter.
Select “install zip from sideload” and select.

At the handset you should see a message confirming that sideload has started.  Using adb, you need to transfer the CyanogenMod zip file using a terminal command as follows:

adb sideload cm-11-20141115-SNAPSHOT-M12-i9100.zip

Adjust the command to suit the filename of the ClockworkMod you downloaded.

You should see some information in the terminal to confirm that the file is being transferred.  When it’s done, the handset will attempt to install the update, and you’ll see a screen similar to below.

IMG_20160717_095948

Unfortunately you don’t get any obvious confirmation that it completed at the handset.  But one way to tell is to try the menu selection; if you have control of the menu using the VOLUME keys, it has finished.

Install GAPPS

This next bit is optional (maybe you don’t want any standard Google Apps on the handset) but without it you won’t be able to use the Play Store.

Using the same method as you used to transfer and flash CyanogenMod, ‘cd’ to the location where you downloaded the GAPPS package (see Pr-Requisites) and then enter the zip sideload function on the handset.  When ready, use adb to transfer and install GAPPS:

adb sideload gapps-kk-20140105-signed.zip

If the process fails you’ll be informed about it.  Otherwise, if you haven’t been shown any errors on the handset and you have control of the menu, it’s finished.

DONE! Reboot

That’s it! You’re done.  Use the menu to select “Reboot” and enjoy CyanogenMod on the Galaxy SII.
Note that boot-up will take longer the first time as the handset will install and set itself up.

 

 

CDTV 3FFF Problem – Diagnosis & Repair

Diagnosis and Repair of a Commodore CDTV unit which has a strange ‘3FFF’ problem.

In the first part, below, I diagnose.  In the next part (coming soon, will be added here) I repair.

https://www.youtube.com/watch?v=KtxYHoK8vFg

Tasker: Disable Pin Lock Near Home

Introduction

If you’re away from home it’s very important to have a pin or password lock on your phone, just in case you misplace it or it is stolen.  Typically the modern mobile phone is a gateway to a multitude of private services and data, such as personal photos and videos, cloud based data, social media, shopping accounts and even bank account access.  A password lock will not necessarily prevent the determined person from gaining access to your phone, but it will at least prevent instantaneous, unchallenged, access to compromising services.  The idea is that you would shutdown access to these services at the earliest possible time after your phone has been discovered missing, and hopefully before access to the mobile phone is gained.

When you think about it, the modern mobile phone (which is really a mobile computer first, with a mobile phone as a secondary or even tertiary feature) is a very compromising device to carry around with you – and most of us take it for granted.

Still, having to enter a pin or password on your device can get pretty tedious after a while, especially when you’re at home.  If you’re in the comfort of your own home, you know your device is safe, and maybe you’re willing to relax the security on it under these circumstances.

This post will explain how to do exactly that – automatically – using Tasker.  If you decide to use this option, please be very aware that you are significantly compromising the security of your device.  You are basically trading away some security for a bit of convenience.  I’ll explain some of the security vulnerabilities at the end of the post.  The choice, then, about whether to make the trade, will be up to you.

Pre-Requisites

The pre-requisites for this tutorial are:

  1. An Android based mobile phone, with Tasker installed on it.  You can get Tasker from the Play store.
    If you’re running iOS you’re out of luck; Apple think you’re too stupid to know what you’re doing, so they would never let you have access to a great application like Tasker in the first place.  You should take this opportunity to throw your Apple device in the bin immediately – liberate yourself from the oppression!
  2. Your phone should be rooted.  Root access is not required for Tasker itself, but it is required in order to enable a third party tool (which Tasker will use) to change the phone lock settings.
  3. The third party tool you need is called “Secure Settings”.  This is available on the Play store as well.  You may need to purchase the pro version to get access to the features we’re going to need (I can’t remember what comes with the free version).  If you do, it’s cheap anyway and well worth spending a few bob on.

The Tutorial

Enable Admin Access for Secure Settings

The first thing to do is give Secure Settings the admin access it’s going to need in order to change the lock settings.  Open the Secure Settings application and select the little Spanner‘spanner’ icon to enter the preferences.  At the time of writing this post, the spanner icon is available at the top of the Secure Settings main screen.  Once you’ve entered the preferences, check the box labelled “Device Administrator”.

DeviceAdmin

Set up the Tasks

Now you need to set up the Tasks, from within Tasker, which will enable/disable the pin lock.

First, to enable the pin (or password) lock, open Tasker and select the ‘Tasks’ tab at the top of the screen.  Then select the ‘Add Task’ button (a large plus sign) at the bottom right-hand-side of the screen.  Call your task something descriptive; I called mine “EnablePin”.

Now you need to add an action to the Task.  Select the ‘Add’ icon in the bottom middle of the screen.  Then, from the Action Category list that appears, select ‘Plugin’.  If Secure Settings is installed, it should display as an available plugin.  Select ‘Secure Settings’ from the list.
Now edit the configuration by selecting the edit icon (a pencil) from the right hand side.  In the Secure Settings Actions menu that appears, select “Dev Admin Actions”.  A secondary list will appear, from which you need to select “Password/Pin”.

DevAdmin Actions
Inside the Password/Pin settings, Select the ‘Disabled’ button so that it changes state to ‘Enabled’.  Now you need to choose a Password or a Pin Code and enter it twice.  Once you have entered it, select the ‘Save’ icon (a floppy disk) to complete the action.

Enable Pin/Password You will be returned to the Action Edit area and there should now be some text inside the Configuration area.  The text will be the name of the action that will be performed – in this case, either “Set Pin” or “Set Password”.
Return to the Tasker task edit screen by selecting the back button at the top left of the screen.  You should see a Secure Settings action as the only action in the list.  Select ‘back’ again to return to the Tasks list.

TaskListNow you need to repeat the same process to add a “DisablePin” task.  The process only differs in the Secure Settings Actions setting.  Instead of selecting the ‘Disabled’ button to change its state to ‘Enabled’, you need to leave it in its ‘Disabled’ status.  Then select ‘Save’ as before.  This should create a Secure Settings “Clear Password” action.  At the end of the process you should have created two Tasks; one that sets a pin or a password of your choice and enables it, and one that clears the pin or password.  You can test the tasks by selecting them from the list and then selecting the ‘run’ icon.  After you run the Enable Pin task, you will need to enter the correct pin or password to unlock your device.  After you run the DisablePin Task, you will only need to swipe the screen to unlock your device.

Set up the Profile

Finally, you need to set up a Profile, to automatically trigger the tasks when you’re at home.  There are quite a few options here; you could set a profile to trigger the clear password task when you’re within range of a certain cell tower, or when you’re connected to a specific Wifi access point, or when you’re within range of a particular Bluetooth device (e.g. your car’s bluetooth).  Or you could add a button to your screen to manually (but conveniently) enable/disable the pin lock at will.

I will show you how to set up a profile which will clear the password when you’re connected to a particular wifi access point, and set the password lock if you’re not connected to the wifi access point.  In practice the wifi access point would be your home network hub, or something like that.  You can also set a profile which activates if you’re merely in range of the wifi hub, so that you don’t even need to be connected to it.  There are many variations upon the theme which you can explore for yourself; the process for all the various profile options is very similar.

State ProfileFirst you need to create a new profile.  Enter Tasker, and select the ‘Profiles’ tab at the top of the screen.  Then select the ‘Add Profile’ button at the bottom-right of the screen.  You will be shown a small Profile Category list.  We want to activate the profile given a particular state, so select the ‘State’ category.

Next you will be shown a list of states.  Select the “Net State”.  Now you will be shown a list of Net States.  You will see various Bluetooth states, Wifi states, Network states etc.  Choose ‘Wifi Connected’.

Now you will be shown the ‘wifi connected’ state setup.  You have three optional settings which can be configured.  If you don’t configure any of these, then the profile will become active when you are connected to any wifi access point.
If you only want to activate the profile when you’re at home, then you need to enter Screenshot_2015-10-11-15-20-19_soptions which are specific to your home wifi access point.  e.g. you can enter the SSID of your home wifi (the wifi name which shows up when you scan for an access point).  If you’re unsure what the exact name of your wifi access point is, you can select the search button (magnifying glass) and choose from a list of scanned access points.
You can do the same with MAC, to set the profile to trigger when you’re connected to a wifi access point which has your home wifi hub’s MAC address.  Again you can search for this to help you set it up.
You can also set the IP, so that the profile only triggers when your device is connected to a wifi access point and you are assigned a specific IP address.  This would be useful if your home hub is configured to assign your device a particular static IP address.
If you combine all the options, the profile will activate only when you’re connected to a wifi access point which has the correct SSID, the correct MAC address, AND assigns you the correct IP address.

Once you’re happy with the setup, return to the Tasker profile setup screen.  You will be asked to select a Task to run: select the DisablePin task you created earlier.  Now you will see a profile entry with the trigger set to your particular preferences.  There will only be an entry task though, shown with a green arrow.  You really want an exit task as well, so that the password is set again when you’re no longer connected to the Wifi access point.  If you select and hold the entry task, another menu will appear from which you can select “Add Exit Task”.  Choose the “EnablePin” task which you created earlier.

Now you should have a profile set up which triggers the “DisablePin” task when you’re connected to your home wifi, and triggers the “EnablePin” task when you’re not connected to your home wifi.  In this way, you can disable the pin or password lock screen when you’re at home.

Entry & Exit Tasks

Conclusion

That’s it, you’re done! There are many variations upon this theme which you can play with.  Explore them and have fun!

Be very aware that this particular Tasker profile significantly compromises the security of your device.  For example; if I happened to know that you had such a Tasker profile set up, and I was able to gain physical access to your device, then I could simply set up a spoof Wifi access point with the same SSID, IP and even MAC address.  Then, when your phone connected to it, it would think it was your home wifi and disable the password access.

Of course, this assumes I have detailed knowledge of your Tasker profile and your home wifi details up-front.  Probably an unlikely scenario for the person who comes along and steals your phone, or finds it by chance.  So it’s a risk you can choose to take, or not!

Good luck!

Recover Data From Unfinalized DVD RW

Introduction

Sometimes you’ll end up having to deal with a DVD which has video recorded on it but the author neglected to finalize the disc. This can be a bit troublesome, because until the disc is finalized it doesn’t contain the necessary data to make it compatible with the DVD standard. Most consumer DVD players and PC based DVD drives rely upon this information to make sense of the data content on the DVD, so if it isn’t finalized most systems won’t open the disc.  Either it will open a blank explorer window, or it won’t mount this disc at all. What to do?

Well, thankfully, it is possible to recover from this situation. There are some commercial applications out there which will do it (get your wallet out) or you can make use of open source software instead. I am going to describe the process for some free open source software on Linux.

DVD+RW-Tools

First of all, you need some free open source software called DVD+RW-Tools.  This is a collection of programs for working with optical video disc media.  Most modern linux distributions come with the tools installed as standard.

Reading the disc

Once you have the tools installed, you can use them to extract useful information about the data content on your unfinished disc.  To do this, open a terminal and type:

dvd+rw-mediainfo /dev/dvd

You will get some output from the command.  Here is a sample of output from an unfinalised DVD+RW which has one track on it:

brian@kubuntu:~$ dvd+rw-mediainfo /dev/dvd
INQUIRY:                [HL-DT-ST][BD-RE  BH16NS40 ][1.03]
GET [CURRENT] CONFIGURATION:
Mounted Media:         13h, DVD-RW Restricted Overwrite
Media ID:              80SONY-W0
Current Write Speed:   2.0x1385=2770KB/s
Write Speed #0:        2.0x1385=2770KB/s
Speed Descriptor#0:    00/716191 R@6.0x1385=8310KB/s W@2.0x1385=2770KB/s
READ DVD STRUCTURE[#10h]:
Media Book Type:       00h, DVD-ROM book [revision 0]
Legacy lead-out at:    716800*2KB=1468006400
READ DVD STRUCTURE[#0h]:
Media Book Type:       32h, DVD-RW book [revision 2]
Last border-out at:    2045*2KB=4188160
READ DISC INFORMATION:
Disc status:           appendable
Number of Sessions:    1
State of Last Session: incomplete
"Next" Track:          1
Number of Tracks:      1
READ FORMAT CAPACITIES:
no media:              716192*2048=1466761216
00h(800):              716192*2048=1466761216
10h(10):               716192*2048=1466761216
15h(10):               716192*2048=1466761216
READ TRACK INFORMATION[#1]:
Track State:           incomplete incremental
Track Start Address:   0*2KB
Next Writable Address: 132208*2KB
Free Blocks:           583984*2KB
Fixed Packet Size:     16*2KB
Track Size:            716192*2KB
READ CAPACITY:          0*2048=0

Note that it is possible to have many video clips contained within a single track or you can have video clips spread across multiple tracks; it depends on how the video information was written by the original equipment.  You may also see multiple disc ‘sessions’.  In the sample case above, we have a single track within a single session and I happen to know that there are multiple video clips contained in it.

I will show you how to extract the video for the above single track, but the method is exactly repeatable for any number of tracks and any number of sessions.

The dd Command

‘dd’ is a command for copying data from some media.  To use it, you give it a block size, a start address, an end address, an input file and an output file.  To see how this applies to the above information, consider the following command:

dd bs=2048 skip=0 count=716192 if=/dev/dvd of=/$HOME/track1.vob

This will extract the single track from the disc and place it in your home.  To explain, let’s go through the parameters one at a time:

bs

This is block size.  To get the correct block size, take a look at the information from DVD+RW-mediainfo.  You will see that the data information (e.g. Start Address) is terminated with an asterisk and a number:

Track Start Address:   0*2KB

In this case we are given 2KB.  Since there are 1024 bytes in a kilobyte, the number to give for bs is 2048.

skip

This is the number of bytes to skip in order to reach the start address of the track.  In the above example the start address is 0, so there are 0 bytes to skip.  But in examples with multiple tracks and/or sessions, you will have non-zero start addresses.  Just enter the start address for the track you are interested in as the parameter for skip.

count

This is the number of bytes to extract, from the start address.  To obtain this information, simply use the track size data:

Track Size:            716192*2KB

if

This is the input file.  You need to supply the path to your DVD device.  In most cases it will be /dev/dvd

of

This is the location where the output file will be written.  $HOME works fine.

Finished – Play It!

Once you have extracted your track, you can play it in any standard media player.  You could also write it to a new disc, remembering to finalise it this time!!!

Good luck.

rarcrack review

rarcrack

I stumbled across a little program called rarcrack yesterday, which provides brute-force cracking of password protected archives.  I decided to give it a try and make some general observations about it.

An example

To set up an example, I created a .rar with a 5 character password.  The password consists of upper-case letters, lower-case letters, and numerals.  rarcrack does not know ahead of time how many characters the password is, so it has to try all possible combinations.  I set the cracker going, and left it for a while. The next day, over 24-hours later, it was still going and had not cracked the password.  Here’s a sample of the program output this Morning:

Probing: '6tgvK' [1296 pwds/sec]
Probing: '6thwV' [1305 pwds/sec]
Probing: '6tiyi' [1309 pwds/sec]
Probing: '6tjzn' [1303 pwds/sec]
Probing: '6tkAt' [1304 pwds/sec]
Probing: '6tlBu' [1302 pwds/sec]

 So it seems that it has started on 5 character passwords, having completed 4 character combinations.  But it is still working through the 5 character combinations and I can see that it hasn’t got to mine yet because it does numerals first and my password started with a letter.

Some Calculations

Okay, so given the above information, how long can we expect rarcrack to take to crack a 5 character password? The speed is ~1300 attempts per second.  That seems really low to me, but I assume it has something to do with the overhead associated with accessing the .rar file.  Otherwise I would expect a PC as powerful as mine to make a lot more attempts per second than that.

Let’s do some calculations.

How many characters?

We have 26 lower-case letters, + 26 upper-case letters, + 10 numerals =

62 possible characters.

How many combinations?

Easy.  62^5 = 916,132,832.

Best case scenario

The best case scenario is that rarcrack finds the password on its very first attempt at a 5 character word.  That scenario is 62^4 + 1 attempts = 14,776,337 attempts.

14,776,337 ÷ 1300 ÷ 3600 = 3.2 hours.

Worst case scenario

The worst case scenario is that rarcrack finds the password on its very last attempt at a 5 character word.  That scenario is 62^5 = 916,132,832 attempts.

916,132,832 ÷ 1300 ÷ 3600 = 195.7 hours, or 8.1 days!!!

It gets a lot worse very quickly from here!

Okay, so what happens if we add more characters? The situation gets a lot worse very quickly.  Here’s some worst case scenarios for some more characters:

[table id=3 /]

You can see that even an 8 character password takes over 5,000 years to crack.  Wowsers.

A little harsh?

Okay, maybe we’re being hard on rarcrack.  What if we were foolish, and we set a password consisting of only lower-case letters? The worst case for an 8 character password would then be:

26^8 ÷ 1300 ÷ 3600 = 44,621 hours.  Or 5.2 years.

Still a very, very long time.

Conclusion

rarcrack is an interesting program, but at the current speeds I can achieve with it the program is useless except for passwords consisting of 5 or less characters.

 

Adding USB devices in a Virtual Machine

Adding USB Devices in a Windows Virtual Machine with VirtualBox

One of the most confusing things for me when I first experimented with VirtualBox was the question of how to add USB devices.  I run Linux (Ubuntu) as my main OS now, but sometimes I need to dig around in Windows (e.g. work related stuff) so for those cases I run it in a virtual machine.  I recently needed to add a data acquisition device for use in the virtual machine on Windows, so I thought I’d document the procedure here.

Pre-Requisites

You need to have VirtualBox installed on your machine, and a Windows virtual machine set up.  I am going to run Windows XP in a virtual machine on Ubuntu in this tutorial.
You also need Virtual Guest Additions installed in the virtual machine to enable the USB support, amongst other things.  If you’re confused about this aspect, there is plenty of information available if you ‘google’ it.

Sorting out the Group Permissions

The only reason that USB support is confusing at all is that you need to add your user to the VirtualBox group before any USB devices will show up for use.  VirtualBox doesn’t offer any other useful information; it just complains that there are no available devices.  The problem is that VirtualBox is not allowed to share your USB devices, so the next steps will fix this.

First you need gnome-system-tools.  Run the following command in a terminal to install it:

sudo apt-get install gnome-system-tools

Now go to the dashboard and type ‘user’.  You should see an icon for Users & Groups appear.  Select it, and the following window will appear:

Users Settings_002Select ‘Manage Groups’.  The following window will appear:

GroupsSettingsScroll down to ‘vboxusers’ and then select ‘Properties’.  The following window will appear:

Group'vboxusers'PropertiesMake sure your user is ‘ticked’.  It probably won’t be by default.  Then select ‘OK’.

WinXP-Dev-SettingsNow USB should work.  But you have to log out and back in again first.  You should do that now.  When you log back in, open Virtual Box and select the settings for your virtual machine.  Select the USB settings, and make sure USB is enabled.  Now you just need to add the USB device you want to use in your machine.  Make sure it’s connected to your computer, and then select the ‘add’ button.  I’m going to add my National Instruments DAQ device:

selectniNow, when you start your virtual machine, Windows should detect new hardware and install it for you:

installingnidaqFinally, when it’s done, you can test out your hardware.  I am using a DAQ device so I started the software for it and captured an analog signal 🙂

Capture

DONE

That’s it, you’re done.  Any time you need to add more USB devices, you can add them to your virtual machine in the same way.

Good Luck.

 

Hosting a Calibre Library with Linux, COPS & Google Drive

Introduction

Free your Ebook collection!!!

Are you tired of being locked in to commercial Ebook software such as Apple iTunes (shudder), Google Books or Amazon Kindle? Would you like to take complete control of your Ebook collection and host it yourself, giving you the ability to serve whatever Ebooks you want at any time and at no extra charge? You’re not alone.

This is a short tutorial to show you how to host a Calibre library on a Linux server with the help of Google Drive and a nifty php program called COPS.
The general idea is that you will create a Calibre library on your local computer (or perhaps you already have an existing Calibre library) and then synchronise it using Google Drive (or you can use a cloud storage provider of your choice, the concept is the same).  In this way any changes you make to your Calibre library, now or in the future, will be automatically synchronised with cloud storage.  At your Linux server end, you will install a command line google drive client which will allow you to pull the synchronised Calibre library down to the server and keep up to date with any changes made on your local machine.  This synchronisation, using Google Drive, will help you to keep an up-to-date Calibre Library that has all your latest books, book covers and meta data on your Linux server.  The synchronised calibre library will be ‘served’ (made available on the web) using a program called COPS, which is able to serve a calibre library using a web based interface and also standard (ODPS) Ebook library interfaces.  This means you will be able to read your ebooks on any device with an internet browser or standard Ebook reader application.

library
COPS web based interface

 

You will be able to access your entire Ebook collection, anywhere and at any time.  Nobody will tell you which books you can host and which you cannot.  You won’t be locked in to any Ebook provider.  Your Ebook library will be free.

Careful about the ‘free’

Okay, so we will need to take a small precaution here.  Your Ebook collection is okay to be free to you, both in terms of liberty and cost, but you don’t want every man and his dog getting access to your Ebook collection.  This will be easily solved by creating a .htaccess file which you will place on your library’s web space.  This will allow you to create a simple username and password which will be required to access your library.  It just takes a few minutes and only needs to be set up once.  I will show you how.

A demonstration of what we’re trying to achieve

I often feel that it helps to be able to see and use an end product so that I can see where I’m going with something before I delve too far into it.  The user interface for our personal online Ebook collection will be provided by a little PHP program called COPS, and the author of this program provides a demonstration of this at his website, here.

A Couple of PreRequisites

In order to be able to synchronise files and host your own content you will of course need access to a few things first.  The pre-requisites for this tutorial are:

  • Some web space, hosted on a Linux platform, which you either have direct access to (your server is at located at home, for example) or you have remote SSH (root) access to – for installation of your own programs and services.  Simple web space hosted by someone else is not good enough because those services won’t let you have control of the server itself.
  • A Google Drive account.  You can just register a free one if you want; competition in cloud storage is rife these days, so even free accounts have enough storage to reliably synchronise thousands of Ebooks.

The Tutorial

Step 1 – Installing Google Drive on your local machine.

If you’re a Windows or Mac user this is easy.  Just visit https://tools.google.com/dlpage/drive and download the client for your computer.  Follow the installation instructions and choose a location on your local machine which you want to sync.  Create a folder in your local Google Drive called ‘Ebooks’.  You will put a Calibre library here later, and use Google Drive to synchronise it.  If you’re a Windows or Mac user, this step is now complete and you can skip forwards to step 2.  If you’re a Linux desktop user, read on…

Drive not Ready!
Drive not Ready!

If you’re a Linux user it’s not quite so easy.  Google have promised us an official Linux client for years, but so far it hasn’t been delivered and there is no indication as to when it will ever be delivered.  One google employee has even labelled the entire concept of automatic background synchronisation as fundamentally flawed, and I think she has a point.  She is the initial creator of a Google Drive command line client for Linux (called ‘drive’), which provides manual synchronisation capability.  This is the program you will install on the server later to pull down your Calibre library from Google Drive.  But you can also install it on your Linux desktop machines to push local changes to your Calibre library up to Google Drive.

To install the semi-official drive command line client for a Linux local machine, follow the same steps as in (3) and (4) for your server; the process is identical.

Step 2 – Installation & Setup of Calibre on your local machine

Calibre
Calibre

Calibre is a free, open-source, Ebook management tool.  Even if you do nothing else in this tutorial, this step alone will empower & transform your local Ebook collection.  You can manage the book covers, change the meta-data, sort your books using tagging or virtual libraries, etc.  If you just want to manage your Ebooks locally then Calibre is a fantastic tool.  It even has its own hosting tool to allow you to host a Calibre library online.  The tool we are going to use instead (COPS) is designed with light-weight servers in mind (suitable for a VPS), and that’s why I am not going to be covering the built in Calibre hosting here.

To install Calibre, go here and download the client that is appropriate for your operating system.  If you use Linux I still recommend that you fetch the program from the Calibre website as opposed to using apt-get.  In my experience the version in the standard repository for Ubuntu is way out of date.

I won’t cover set up of a Calibre library in any detail here.  That is a separate topic.  But you will find that it is pretty intuitive to set up a library, and there is extensive help documentation available.  During the set up of your library you will be asked to set a location for it:

Make certain that you set up your library inside the Ebooks folder you created on your local Google Drive.  This is how you will synchronise it to Google and to your server.  I called my Calibre library ‘BJH’.  Call yours whatever you like.

Once the library is set up you can add books by simply dragging them into the application.  There is a tool which can automatically fetch your book cover and meta data from the internet too – this is extremely useful.  I have one hint here; it is often better to ‘prepare’ your books for automatic meta-data collection by manually adding the ISBN into the meta-data editor yourself first.  This helps Calibre to find your book online in the first place, and it also helps it to get the cover for the correct edition.

Any changes you make to your Calibre library should be automatically synchronised with Google Drive.  Or, if you’re on Linux, you should manually run the “drive push” command described later.  You don’t have to waste all your day perfecting your Ebook collection right now if you don’t want to; just add some books in there to get started so that you can continue with the server setup.  You can perfect it as much as you like another time!

Step 3 – Installing GO on your server

If you want to run Google Drive on a Linux server (or on a local Linux machine), then you will be disappointed to learn that there is no official client for it.  There are a few options, both free and commercial, but I am only going to discuss Google’s semi-official command line client here, which is free.  I say “semi-official” because it was developed by a Google employee who has worked on a Linux client.  The command-line client is written in a programming language developed by Google called ‘GO’.  You will need to install a GO programming environment on your system so that you can fetch the source code for the drive client and build it on your system.  This is nowhere near as difficult as it sounds, and I’ll take you through all the steps:

Install GIT

You need GIT on your machine first, so that you can clone GIT repositories.  Open a command line (if installing on your server, you need to open an SSH connection to it) and type:

sudo apt-get install git

Follow the instructions.  Once done, you can check all is well by typing:

git --version

You should get back a version number for git.

Install Mecurial

sudo apt-get install git mercurial

Download GO & Extract

Visit the golang main page and access the downloads area. Select a stable version to download:

Downloading GO
Downloading GO

 

Upload the archive to your server, or you can use wget on your server to download it straight to your remote machine.  Open a terminal and ‘cd’ to the directory where you downloaded/uploaded the archive. e.g:

cd $HOME/Downloads

Then extract the go archive to /usr/local making certain to substitute “go1.4.linux-amd64” in the example below for the name of the archive you downloaded:

sudo tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz

 Create a GO Workspace

Now you need to create a GO workspace.  This is a place where you will download 3rd party packages (the semi-official Google Drive program, in this example) and where you would create your own GO programs if you decided to experiment with GO yourself.  You can create the workspace anywhere you like.  In my example, I will create a workspace in $HOME/Programming/GO/ as follows:

mkdir -p $HOME/Programming/GO/src/github.com/bh4017

The reason for the [src] directory is that a GO workspace requires somewhere to put sourcecode.  The reason for the [github.com] directory underneath [src] is that you will often download the sourcecode for GO programs from github, and finally the reason for the [bh4017] directory is that I wanted a place to store my own GO programs.  bh4017 is my github.com id.  You should substitute ‘bh4017’ for your own github.com account name, or leave it out completely if you don’t intend to experiment with your own GO programs.

Inform the GO tool about your workspace

You need to tell GO where your workspace(s) are.  You can do it inside the terminal using an ‘export’ command, but the problem is that GO will forget about your workspace as soon as your terminal is closed.  To make GO ‘remember’ your workspace, you can remind it each time you log in by placing the ‘export’ commands inside your ‘.profile’ file.  This file is executed at each log-in and so GO will be automatically reminded of your workspace(s) every time you start Linux.  Open .profile in the editor of your choice.  In the following example I will use nano:

nano $HOME/.profile

Once you have opened your .profile, scroll to the bottom and add the following lines.  In the second and third ‘export’ lines, substitute my GO workspace path for the path you chose when you created your workspace.

# BEGIN GO
export PATH=$PATH:/usr/local/go/bin
export PATH=$HOME/Programming/GO/bin:$PATH
export GOPATH=$HOME/Programming/GO
# END GO

In order to make these changes go ‘live’ you need to log off and back on again so that .profile is executed.  You should do that now.

A good way to test your GO installation is to write the ubiquitous ‘hello world’ program.  There’s a tutorial available for this on the GO website.  If you don’t want to bother with that for now, then as a minimum you should open a terminal and type ‘go version’.  If successful, GO should return a version number to you.

Step 4 – Installing ‘drive’

Assuming you’re happy with your installation of GO, the following command should fetch the latest ‘drive’ source code and build it on your system:

go get -u github.com/odeke-em/drive/cmd/drive

No news is good news, so if your GO installation is working properly the terminal will return after a short while without any messages.  GO should have fetched the source code from github.com and built it for you.  To check that it did something, cd to $HOME/Programming/GO/bin (substituting for your own workspace path as created earlier).  Type ‘ls’ and if all is well you should see drive listed in there.

If your ‘export’ commands have been entered correctly you should be able to open a terminal at any time and simple type ‘drive’ to execute a google drive command.  Entering ‘drive’ on its own will bring up a usage response:

drive usage response
drive usage response

Step 5 – Synchronising your Ebook collection to webspace

First you need some webspace.  Instructions for this are outside the scope of this tutorial; presumably if you’re managing a linux server then you already know how to set up some web space.  For my own Ebook collection I used a subdomain called ‘library’, so my Ebook collection is now hosted at http://library.brianhoskins.uk.

Once you’ve got some web space, you need to find out where the space is located on your server.  For example, it could be located at /var/www/vhosts/yourdomain/sub-domain/ but the actual location will vary depending on your setup.  Once you know where your web space is located on your server, ‘cd’ to the location in a terminal and create a Google Drive folder using the ‘mkdir’ command.  You can name it whatever you want – I literally named mine “GoogleDrive”.

Once you have created your folder, you need to initialise it.  In your terminal, type the following:

drive init your-folder-name

If all goes well your terminal should respond with a url to obtain an authentication code.  This is to allow the drive client access to your Google Drive.  You need to use a browser to visit the provided link, and then you will be given an authentication code.  Paste this authentication code back into the terminal and press ‘enter’.

Once your folder has been initialised as a folder to manage using ‘drive’, ‘cd’ into it and type:

drive pull your-folder-name/Ebooks/your-library-name

drive should spend a few minutes resolving (comparing cloud to local) and then it should respond with a confirmation showing what it intends to download fresh from the cloud and, if this is not the first time you’ve pulled from Google (you are updating your Ebook collection) the files already downloaded which it intends to modify.  You are asked to accept, and then drive will pull down your Calibre library from the cloud to your server.  You now have a fully synchronised Calibre library on your Linux server!  In future, when you make changes to your library using Calibre on your local machine, you will simply allow Google Drive to synchronise them and then SSH into your server to run the ‘drive pull Ebooks’ command on your server again.  In this way, your server’s calibre library will be kept continually up to date with the books you add, delete, and maintain (covers, tags, meta data and all) on your local machine.

Note that if you are also using the linux drive client to synchronise a local calibre library up to the cloud, then you should use the ‘drive push’ command to synchronise local changes made to your Calibre library.

Step 6 – Installing & Configuring COPS on your server

Now that you have a way of maintaining a Calibre library on your local machine(s), synchronising them with Google Drive, and then pulling down synchronised changes to your server, you need a way of ‘serving’ your calibre library online.  This is what COPS does for us.  Fortunately, it’s extremely easy to install and set up!

Pre-Requisites

First of all, you need PHP 5.3/5.4 on your server and SQLite3.  My server is Ubuntu 12.04 and it wasn’t necessary for me to install or change anything on my system.  If yours is different, you should check which versions of these applications your server is running and update if necessary.

Downloading COPS

You can get COPS from github or you can get a zip archive from the author’s website.  I won’t link to the actual zip download because it may change depending on future updates to the software.  Visit the website I linked to, scroll to the very bottom, and under the heading “Download” you will find the latest zip file.

Installing COPS

Once you’ve downloaded the zip, installation is very straightforward.  Simply extract the contents of the zip to the root of your chosen webspace.  Once this is done, you should be able to browse your website and see a COPS interface.  It’ll report a bunch of errors because it can’t find your Calibre library – we’ll set that up in the next step.

Configuring COPS

First of all, enter the following commands:

mv config_local.php.example config_local.php
nano config_local.php

This should copy a sample setup into the COPS config file, and then open it for editing.

Find the line $config[‘calibre_directory’] =

Here you must enter the location of your Calibre directory on your server.  It is the directory underneath which the metadata.db file is to be found.  As an example, if you called your library ‘myBooks’, and placed it inside a folder structure called GoogleDrive/Ebooks/, then the config line would be:

$config['calibre_directory'] = './GoogleDrive/Ebooks/myBooks/';

Make CERTAIN that you include the final ‘/’, or COPS will not be able to find your Calibre metadata.db file and it won’t be able to serve your books!

Next, find the line $config[‘cops_title_default’]

This line simply sets the title bar.  Call it whatever you want – I changed mine to say library.brianhoskins.uk.

Once you’re happy, save the file and exit.

DONE!

That’s it, you should be done! Browse to your library webspace and COPS should be serving your Ebooks.  You can get to them via any modern browser.  You can also use an Ebook reader to view the books.  There are some dedicated Ebook readers for mobile platforms too – I use Moon+ reader pro on Android.  You can set up access to your library in these applications.

Setting Password Access

.htaccess

Okay, so now your library is working but every body on the planet can access it.  We’ll solve this problem in the next steps.

Open up a terminal and ‘cd’ to the root of your library website, where you installed COPS.  In there you will find a .htaccess file.  Open it up in a text editor.  Scroll to the bottom and find the following text:

#<FilesMatch "\.php$">
#AuthUserFile /path/to/file
#AuthGroupFile /dev/null
#AuthName "Acces securise"
#AuthType Basic
#Require valid-user
#</FilesMatch>

These are the entries which control password access.  At the moment they’re commented out, so password access is disabled.  Uncomment them by removing the ‘#‘ characters.

Now you need to point the .htaccess file to a password file called .htpasswd.  You haven’t created this file yet, but we’ll create it in a minute.  You need to place it somewhere where access is generally restricted (usually the root of webspace is).  Here’s a sample setup for you – tailor it you your specific requirements:

<FilesMatch "(index|feed)\.php">
AuthUserFile /var/www/vhosts/mydomain/sub-domain/.htpasswd
AuthGroupFile /dev/null
AuthName "SPEAK FRIEND AND ENTER"
AuthType Basic
Require valid-user
</FilesMatch>

.htpasswd

Now you need to actually create your .htpasswd file at the location where you told .htaccess it would be.  Create it and open it up in a text editor.

All you need to do now is add a user and password.  The password, though, should be encrypted.  The easiest way to go about this is to use an online tool, like this one.  Enter in your desired username and password.  The tool will then create the text you need to enter into your .htpasswd file.

FINISHED

Hopefully you’re done! If you now browse to your online library you should be prompted to enter a username and password.  Enter the plain text user and pass you set up earlier; the decryption is taken care of for you.

It’s a lot of fun managing your own online ebook repository.  Any questions, leave them in the comments and I’ll try my best to help!

 

Amiga 1200D Indivision-AGA MKII Installation

Connecting the Indivision

Introduction

This post is a step-by-step tutorial for installation of the IndivisionAGA MKII hardware into an Amiga 1200 Desktop machine.  The target Amiga already has a FastATA fitted and there are some extra (easy) steps that will be necessary in order to allow these two peripherals to be fitted together in the machine at the same time.  This tutorial will also cover these steps.

MyAmiga1200D
My Amiga 1200 Desktop

What you will need

In order to complete a working installation of the IndivisionAGA MKII you will require the following:

  1. An Amiga 1200 Desktop (or towered – the steps will be similar) Computer.
  2. An IndivisionAGA MKII peripheral from AmigaKit.
  3. A phillips-head screwdriver for removal of the A1200D enclosure.
  4. A couple of 40-way DIL sockets (See Note 1)
  5. A hot-melt glue gun.
  6. A piece of thin plastic or other suitable (strong) insulating material approximately 75mmx60mm (See Note 1)
  7. An anti-static wrist strap with associated electrical earth connection.

*NOTE 1: These items are only required if you intend to install the IndivisionAGA with a FastATA.

Preparations

Step 1: Remove A1200 top enclosure

In order to complete this procedure you are going to need to take the cover off your Amiga.  If you are unfamiliar with this kind of task then I can offer you the following advice:

Amiga computers were born to be modified.  You are almost committing a crime if you don’t modify it.  Modifying your Amiga comes with the territory, and should form part of the enjoyment you get out of using the machine.  As long as you’re able to be careful, and take things slowly (thinking each stage through as you go along) you shouldn’t encounter any major difficulties.
That said, I do feel obligated to point out that damage to your Amiga is possible if you mess something up.  If you’re already convinced that hardware modification is not your strong point then I would advise you to seek the assistance of a trained technician.  AmigaKit is one company who can offer these kinds of services, and I would highly recommend them to you.

Step 2: Prepare work surface

First, prepare your work top.  My Amiga is a Commodore edition in pristine condition so I like to avoid scratches and scuffs.  If you feel the same then you’re going to want to put something soft down on your work top to prevent cosmetic damage to your machine when you work on it.  The ideal solution would be an anti-static bench mat, but if you don’t have one of these (I didn’t either) then any soft material that does not tend to generate any static should work.  I used an old towel.
Position your Amiga as shown below and then release all of the enclosure screws.

Release screws
Release screws

Once you have released all of the securing screws, carefully turn your Amiga back over and then remove the top cover.  Be careful because it is still tethered to the Amiga motherboard via the power/hard-drive LED wiring.  You should be able to flip the top cover over as shown below:

RemoveCover
Remove the top cover

Step 3: Remove the keyboard

The next step is to remove the keyboard.  The keyboard is connected to the Amiga motherboard via a green flat flex-foil cable.  Care must be taken to ensure that the mating connector clasp is released before you try to pull this flat cable out.  In order to release the clasp, pull the top collar upwards on each side until it releases its hold on the flat cable.

Note that the clasp does not fully remove.  It releases its hold on the flat cable and then sits in a released position on the connector housing.  Do not try to remove the clasp from its housing because you will break it!

When the clasp is released it’ll look like the photo below:

 

Clasp Released
Clasp Released

Once the clasp is released the flat cable should pull free without resistance.  If you feel any resistance then you have not fully released the clasp.
With the cable pulled free you can lift the entire keyboard from its retaining points and set it to one side.

Keyboard Removed
Keyboard Removed

Step4: Remove FastATA

If you have a FastATA fitted then you will need to remove it in order to allow fitting of the IndivisionAGA.  If you don’t have a FastATA then you can skip this stage.

TIP
In my experience the FastATA Gayle connection is not to be tampered with.  Once it has been connected, and it has settled in place, then the less it is disturbed the better.  For this reason I would recommend leaving the Gayle connection alone – you can separate it from the FastATA motherboard by removing the IDC connector.  This will leave you with just the FastATA motherboard to remove from the A1200 ROM sockets.

You need to take great care when removing the FastATA from the A1200 ROM sockets.  The risks, if you’re not careful, are as follows:

  • Bending or snapping pins on the FastATA if it is released suddenly at an angle.
  • Damaging the FastATA PCB if it is levered against without care.
  • Damaging the A1200 motherboard if a sharp instrument is used to lever the FastATA from the ROM sockets.

 

FastATA removed
FastATA removed

With these potential hazards in mind, use a flat instrument (preferably plastic but I was able to use a flat screwdriver with great care) to gently prise the FastATA from the ROM sockets.  Work on all four corners of the FastATA a little bit at a time, exercising patience.  The retention force of the ROM sockets will initially be very strong because the FastATA will have settled in its connection.  Eventually, after some perseverance and patience, you will be able to release this connection and pull the FastATA free.

 

Step5: Removing the floppy drive

Remove Floppy Drive
Remove Floppy Drive

In order to route the IndivisionAGA graphics cable it is better to remove the internal floppy drive.  This item is easily removed by releasing its retaining screws and disconnecting the power and data cables.  Please exercise care when removing the data cable as if it is pulled away at an angle you will bend pins.

Installing the hardware

Step 1: Fitting the IndivisionAGA

The IndivisionAGA main board connects over the top of the Lisa chip.  Make sure you connect it with the orientation shown in the photo below!
When making the connection, press with equal force on the top of the PLCC socket so that it engages Lisa with the minimum angle possible.  It will be necessary to press quite hard in order to complete the connection fully.

Don’t use any tools to force the IndivisionAGA onto Lisa! Use only your hands.

Connecting the Indivision
Connecting the Indivision

After you’ve fitted the Indivision to Lisa then you will need to route the graphics cable.  Methods are varied but there is unfortunately no ‘perfect’ solution for this as of yet.  My preferred ‘solution’ was to route the cable underneath the floppy drive (hence why I asked you to remove it) and then out of the rear expansion slot next to the mouse port.  I left the DVI connector dangling out of this small access panel, but I secured it later by using the monitor cable fasteners.  Not an ideal solution by any means, but it works.

Step 2: Fitting the ‘riser’ ROM sockets

40 way DIL socket
40 way DIL socket (round pin)

If you are installing the Indivision with a FastATA, or you plan to use a FastATA in the future, then you will need to fit ‘riser’ sockets into the ROM locations so that the FastATA board will fit over the top of the Indivision.  To do this you will need to fit one pair of 40-way DIL sockets into the existing ROM sockets.  The best type of DIL sockets to buy are the ’round pin’ type as shown in my photo.  You should be able to obtain these from AmigaKit, or you can get them direct from an electronics supplier such as Farnell, e.g. order code 1103855.  Note that the ROM sockets fitted into the A1200 motherboard are 42-pin

riser sockets fitted
Riser sockets fitted

but the front two pins are not used.  Therefore you will need to fit your riser sockets so that they sit flush with the back of the A1200 motherboard sockets as shown in the following photo.  Note that some Amiga users report that they prefer to fit two pairs of riser sockets so that the FastATA is hoisted up further, providing even more clearance.  If you order four 40-way DIL sockets then you are free to experiment with this but my experience is that one set of riser sockets provides just enough clearance whilst also ensuring that the Fast ATA does not foul against the keyboard.

Step 3: Preparing the FastATA (insulating) for re-fitting

The FastATA motherboard is mostly through-hole construction, which means that the component connections protrude through to the bottom side of the board.  These protrusions are quite lengthy and as such there is a risk of short-circuit to the Indivision PCB.  In order to guard against short-circuits it is important to insulate the two boards in some acceptable manner.

FastATA insulation
FastATA Insulation Plate

In my experience I was able to find a piece of strong, thin plastic from an old ring-binder that I trimmed to size.  I then fitted it to the bottom-side of the FastATA using two spots of hot-melt glue.  Hot-melt glue is a good solution because it is easily removed at a later time should the need arise.  Remember that the glue is not there to hold the FastATA board together – it only needs to keep your piece of insulation in place!
I think it goes without saying that the chosen insulation material must be non-conductive.  Plastic is a good choice for this reason.

Step 4: Refitting the FastATA

Once you have settled on a suitable method of insulating the bottom-side of the FastATA from the Indivision you are ready to fit the FastATA back into the ROM socket risers.  Be very careful to ensure that all the pins on the FastATA line up with your riser socket receptacles.  Your FastATA will now entirely fill the ROM sockets because you fitted 40-way sockets into the existing 42-way sockets that are fitted to the A1200 motherboard.  Once you have fitted the FastATA back into the ROM sockets you need to press firmly all around it to ensure a solid connection.  If you end up with a dodgy ROM connection then you will experience all sorts of problems reading/writing to your storage devices so the connection needs to be very secure.

Step 4a: Tie down the Fast ATA?

Some Amiga users prefer to tie-wrap their FastATA motherboards in place to secure it from coming loose after fitting.  I have had mixed experiences with this method and I have not found it to be necessary in a desktop machine, provided of course that your machine is not subjected to transportation.  A modified desktop A1200 is rarely a portable one.
The problem I’ve found with tie-wrapping the FastATA is that it doesn’t quite hold the board down in a manner that is guaranteed to prevent the board from working loose.  In fact, I have had experience of the tie-wraps themselves forcing the FastATA to retreat from its ROM sockets.

The ideal solution to this common problem would be to do some surgery on the A1200 motherboard, removing the existing ‘flat’ type ROM sockets and fitting the ’round’ type (like the ones you’ve used as risers) instead.  This would provide a much stronger connection both electrically and mechanically.  Unfortunately this is not a task for the amateur Amiga tinkerer because it can be very difficult to remove through-hole components from a multi-layer PCB like the A1200 motherboard.  Still, it is possible and a good technician would be able to do it for you if you think it’s necessary.

In my case I found that I was able to complete this work without replacing the A1200 ROM sockets and without tie-wrapping the FastATA in place.

Note that you should strictly limit the number of mating cycles you subject the standard A1200 ROM sockets to.  In practice this means that any time you dismantle your A1200 in the future you should always disconnect the FastATA from the riser sockets, leaving the riser sockets fitted to the A1200 motherboard.  This is because your riser sockets are round-pin and the standard A1200 motherboard sockets are square-pin.  A consequence of fitting a round peg into a square hole is that the connection quality is reduced, and the number of reliable mating cycles is once or twice at maximum before the connection will cease to be mechanically or electrically sound.  If you compromise the standard A1200 ROM socket connection quality then you may be forced to have the ROM sockets replaced (if so use round pin types as described earlier!) so the best advice I can give you is connect the riser sockets once, then never touch them again.

Step 5: Refitting the floppy drive and keyboard

We’re almost done! The floppy drive goes back in the same way that it came out.  Be careful when re-fitting the data cable because it’s all too-easy to miss a set of pins if you are complacent.
Once the floppy drive is re-fitted you can re-fit the keyboard.  Make sure that the mating connector clasp collar is released before you try re-connecting the flex-foil.  If the collar is released then there should not be any resistance when you try to mate the flex-foil to the connector.  Grap the flex-foil with one hand so that it is held in a fully-home position inside the mating connector, and then with your other hand press the clasp collar back down into place.

Step 6: Testing your installation

Murphy’s law says that if you put the cover back on before testing your installation then your work is guaranteed to be a failure.  For some reason as yet unexplained by science, you have to humour Murphy by testing it before putting the covers back on.  If you don’t believe me, try fitting the cover back first and you’ll see what I mean!

First Test
First Test

In any case, testing first is a good idea.  If there is any unexpected behaviour or problems then you are in a much better position to see what’s going on, and react appropriately, if you have the covers off.
If, for example, you have unwittingly created a short-circuit condition of some kind then you will often see, hear or smell evidence of this if your senses are able to be trained on the gubbins of your equipment.  Reacting to these kinds of issues quickly will save your Amiga.  Blissful ignorance of them (like when the cover is fitted) could damage your equipment beyond repair.  Please take my advice!
If all goes to plan then you should see an Individual Computers logo appear on your monitor within 2-3 seconds of switching on your Amiga.  If, after this, your Amiga boots into Workbench then you will also have confirmed that your FastATA is still working.  If you don’t see the logo, or your Amiga doesn’t boot (or both!) then you will almost certainly have some kind of connection problem.  Go back through your work, checking and re-checking all of the connections and making certain that all the socketted connections are seated firmly in place.

Step 7: Closing

After all is confirmed working Murphy will let you fit the covers back on and all will be well.

I hope you have found this tutorial to be of use.  Please feel free to write a comment.  Constructive criticism is also very welcome – I am an electronics engineer by trade but I certainly do not pretend to know it all!

If you have problems with your installation I may be able to offer some advice.  In that case I would prefer you to comment so that the advice is then available to others, but I also welcome email – please see the ‘contact’ section of my website.

Enjoy, and happy modding!

Finished
Finished

 

 

Hardware Hacking the IOMEGA StorCenter ix2-200

Introduction

The StorCenter ix2-200 is a RAID network drive supplied by iomega.  I have used the 2TB version for about two years now to keep secure (backed up) copies of my precious data.  Any data I write to the device is mirrored on its paired 2TB drive inside the unit, so one drive can fail and I’ll still keep my data.

Recently I’ve had cause for complaint with this unit’s default network setup routine.  When you switch the device on it goes through a boot-routine which involves setting up the network address and subnet.  If possible it does this via dhcp so if you’ve got it connected to your router it’ll be assigned an appropriate IP and will be instantly visible on the network.
The problems start when, for whatever reason, the device is not able to obtain network settings via dhcp.  In that case it assigns itself an address in the range 169.254.x.x with subnet 255.255.0.0.  In that case the network drive could end up with one of 65536 possible IP addresses in that range.  How is one supposed to know what IP address it’s assigned itself?

Hardware Hacking

Location of JP1 on ix2-200
Location of JP1 on ix2-200

I had two choices.  Set my computer to scan all of the 65536 possible IP addresses until it finds an active one.  Or, take the unit apart and see what hardware hacking can be done.  The former is probably quicker, but the latter is more fun.  Hence, this hardware hacking blog was born.

With the unit apart, I found a conspicuous looking pin header called JP1.  A few pokes around with my ‘scope revealed what looked like microprocessor level (3.3V) RS232 comms on one of the pins.

 

Completing the hack…

RS232 data on pin (2)
RS232 data on pin (2)

The next task was to try and see if I could view these signals on a PC.  The main problem here is the fact that the data output is 3.3V logic levels (basically it’s the raw output from a microprocessor) and the RS232 input to a PC is +/-12V standard RS232 logic levels.  It’s easily solved though, you just need to get yourself an RS232 level-shifter chip such as a MAX3232 and rig-up a circuit as per my schematic shown below, and then connect it to JP1 (as shown on the schematic) according to the pinout in the photo.

Schematic

JP1_2

 

 

 

 

I only had an SMT version of the MAX3232 part in my junk bin so I soldered it onto some proto-board with the 0.1uF capacitors tacked on top and then I wired it up to JP1 as shown in the photo below.

My hacked on level shifter IC to interface with the PC
My hacked on level shifter IC to interface with the PC

Viewing the data on the PC.

In order to view the data on a PC you simply need to put everything back together, connect the ends of your cables to a DB9 connector as shown in the schematic, and then connect the DB9 connector to your PC’s serial port via a standard 9-way serial cable.  Then fire up a terminal (I recommend PuTTY) and enter the following settings:

PuTTYConfig
PuTTY Terminal Settings

 

 

 

 

 

 

 

 

 

 

 

Once you’ve entered in the settings, select connect, and power on the NAS.  If all goes well some boot-time debug data should start spitting out on the terminal.  Something like that shown below:

Debug data coming through over the terminal
Debug data coming through over the terminal

After 2-3 minutes you should be presented with a login prompt.  If you want to gain root access to the NAS over your PC terminal simply log in with the following credentials:

USER: root
PASS: soho

Gaining root access via the terminal
Gaining root access via the terminal

Sweet!

That’s it – you’re in with root privileges. You can now enter the standard Linux commands and change whatever you wish.  My main reason for going to all this trouble (apart from enjoying hardware hacking) was to find out the boot-time network settings it was assigning itself.  Once I knew those I was able to gain access via the standard PC based web interface and change the settings to suit my home network.

I hope you enjoyed! Here is a quick video of the entire boot process and logging in:

Rescued CDTV from the crusher

A good find…

It’s a chore to find yourself lugging junk down to the tip.  But every now and then you happen across a diamond in the rough! Today was my day to score as I spotted a Commodore CDTV unit lurking in a dark corner of the electrical disposal area.  She was looking poorly and in desperate need of rescue.  Needless to say I took on the challenge, plucking her from the ruin (yoink!) and saving her from certain destruction.  I am now the proud owner of a CDTV unit!

Does she work?

Well… no, she didn’t.  Completely dead.  Hence the throw-away, I presume.  But no self-respecting nerd would give up this easily; I released the top cover and had a bit of a poke around.  The fault was actually quite easy to find – a 5A fuse on the secondary side of the PSU was blown.  Of course, a blown fuse is rarely the root cause of the problem – usually some other fault is to blame.  In this case, though, I replaced the fuse and Bob’s your uncle – she powered straight up!

 

Where is the fancy CD boot screen?

That was my first observation, too.  CDTV units had a cool CD boot screen with a spinning disc and a laser.  This unit was just booting to a kickstart 1.3 floppy screen.  How disappointing!

JP15 Link

I noticed that the unit had a clunky old switch hanging off the rear.  This was clearly a poorly implemented modification by a previous owner.  An obvious application for a user-installed switch would be some kind of ROM-switcher, so I began to wonder if this was the case here.  The switch terminated at a 3-pin molex, but it wasn’t connected anywhere and nor did there appear to be an obvious place for it to go on the motherboard.  Eventually, though – after quite a long period hunting around the motherboard and scratching my head – I found JP15 which is an in-line 3 pin header.  It wasn’t a molex receptacle but the pitch looked about right.  Tried it on for size and it was a perfect fit!

CD boot screen

A couple of power cycles with each position of the clunky switch finally revealed the classic CD boot screen.  Even by today’s standard it looks uber-cool.  This photo doesn’t really do it justice:

 

HURAHH!

So, I am now a very proud owner of a Commodore CDTV.  She’s not the best of examples (the reset button on the front is broken and the keyboard is a bit worse for wear) but she’s fully functional and I reckon she’ll make a nice base unit for some hardware hackery.  It’d be nice to bring some modern computer peripherals to this machine and see if I can get them working together with her.  A hard drive would be nice, for example.  Hmmmm! To be continued!

Amiga 500 eaten alive!

I’m having some fun messing around with a few of my old retro computers at the moment and, inspired by EEV Blog’s recent teardown and successful boot of a 25 year old Amiga 500 I decided to get my old girl down from the attic and give her a go.

Unfortunately my attempts were rather less successful! I was met with the dreaded blinking power LED and a continuous cycle of repeated resets.  Drat.  What could possibly have gone wrong after a mere quarter of a century?

A quick look under the cover revealed the very obvious culprit:

Amiga A500+ Battery Leakage
More Amiga A500+ Battery Leakage

 

 

 

 

 

 

Also, rather bizarrely, the battery fuelled corrosion seems to have spread all the way over to poor old FAT AGNUS!

FAT AGNUS battery leakage

 

 

 

 

 

 

 

 

 

It seems like this may be terminal for my trusty old Amiga 🙁 but I will break out the old toothbrush over the weekend and see if I can clean her up a bit.  With a bit of luck a good clean will see her up and running again.  Wish me luck!

 

Sinclair ZX Spectrum Composite Video Modification

Introduction

The Sinclair ZX range of computers were among the first affordable computers and kick-started the UK’s home computer revolution in the 1980s.  These machines relied on consumer television equipment for their display output and, as such, they featured an RF modulated output so that users could simply “tune-in” to them on their television sets.

Modern TVs use digital tuners and thus are no longer compatible with the analogue output of the Sinclair ZX computers.  However, most TVs – even the most modern models – still feature composite video inputs and it turns out that it’s very easy indeed to modify the video output on these computers to be compatible with a TV composite video input.  As well as providing compatibility with modern television sets, this modification also improves the computer’s video output quality.  This post will detail the procedure for modification of the Sinclair ZX Spectrum Computer, but it should be fairly similar on other Sinclair models of that era.

As shown in the basic block-diagram below, the basic principle of video generation and display for the ZX Spectrum Computer is as follows:

  • Generate composite video output from memory map
  • Add chrominance (colour)
  • Generate UHF with RF modulator
  • Send down cable to TV
  • Recover composite video with TV UHF demodulator
  • Display
Video display block diagram

As can be seen, the modulation/demodulation process is actually quite wasteful because we start with composite video, modulate it at the Spectrum video output, and then we just de-modulate it at the TV end to get composite video again! This was convenient at the time the computer was designed because it allowed users to display the computer output on standard analogue tuner TVs, but with most modern TVs featuring composite video inputs it’s pointless – we can just cut the mod/de-mod process out and connect standard composite video out straight from the Spectrum Computer directly to the TV composite inputs!

Completing the modification

The modification is very straightforward.  All you need to do is disconnect and remove the RF modulator, and then connect the machine’s composite video compatible output directly to the RCA connector via a decoupling capacitor.  Here is the process broken down into stages:

1: Remove the front cover

Cover Removed

To remove the front cover, release the 5 screws on the bottom of the machine.  The front cover will then lift away, but BE CAREFUL of the keyboard flat cables – you will need to disconnect these before you can lift the front cover all the way off.  They can be a little bit tight but with care they will simply pull out.  After this you should be able to remove the front cover completely.  The item we are going to remove is the RF Modulator unit which is enclosed inside a metal screening can at the top left-hand side of the unit, shown in the photo to the left.

 

2: Remove the RF Modulator top screening plate

Screening Can Removed
Remove Screening Can

Next you will need to remove the top plate from the RF Modulator screening can.  It simply prises off – a flat blade screwdriver will help you.  Be careful not to slip and cut yourself though!

With the Screening can removed you will be able to see the RF modulator circuit inside.  We are going to remove this circuit board completely in the next steps.

3: Disconnect the Modulator 5V supply & composite video feed

Remove Cables

The RF Modulator has two connection cables from the main PCB, as shown in the photo.  One is a 5V power supply and the other is a composite video feed.  These need to be de-soldered from the main PCB.  The easiest way to do it is to heat the joint from the top side of the board and then, with soldering iron still applied to the joint, carefully pull the cable through the joint with a pair of pliers.  Be careful when you do this as there is a danger of flicking up molten solder – unless you wear glasses then basic eye protection should be worn.

 

4: Disconnect UHF feed resistor from RCA Connector

Disconnect Resistor

Now you need to disconnect the feed resistor from the RCA connector shown in the photograph.  You can either desolder it or just snip it off with a good pair of wire snips.  The choice is yours!  If you’re going to snip it off then make your cut close to the RCA connector itself – this way you can save the RF modulator circuit complete and it will be easy to reinstall in the future in the unlikely event that you decide to put it back.

5: Remove the RF module from the Main PCB

Desolder & remove the RF Module

Now it is time to remove the RF module completely.  To do this you will first need to remove the Main PCB from the bottom casing.  This is very easy to do – there is just one screw securing the Main PCB to the bottom casing so release it and the Main PCB will come away easily.
After this you need to desolder the RF module anchor points which are shown in the photograph.  It can be a little tricky to desolder these because they are connected to a huge ground plane which – in conjunction with the screening can itself – tends to sink the heat of your iron away from the solder joint itself.  If you have an adjustable temperature on your iron you will want to turn it up to full for this particular job.  It is quite difficult to completely free the joints of solder so you will probably find that the removal process is a case of heating the joint and carefully prising the module free a little bit each side at a time.

6: Remove RF Modulator PCB

Remove the modulator PCB

With the RF module removed it is time to remove the modulator PCB.  This is very easy – there are four anchor points as shown in the photograph.  Desolder these and the PCB will come free.  You will then be left with an empty screening can which you’ll want to solder back in to the board so that you can re-use the RCA cable.

 

7: Fit decoupling capacitor

Fit decoupling capacitor

With the empty screening can fitted back onto the PCB as shown in the photograph you’re ready to fit a decoupling capacitor between the machine’s composite video connection point and the RCA connector.  All you need for this is a 100uF 10V capacitor.  I used a 16V part because it’s all I had in my parts bin – it works fine.  At these kinds of capacitances you’re probably going to be using a polarised part (most likely an electrolytic like the one I’ve used).  In that case connect the positive end of the component to the RCA connector and the negative end to the main PCB.  On an electrolytic capacitor like the one shown, the negative lead is designated by a marking on the component body itself.

.

NOTE: The decoupling capacitor isn’t really that essential.  It may improve picture quality for certain models of television set – it depends how the composite video input circuitry works – but on other models you probably wouldn’t notice any difference.  If you don’t have a suitable component around you and you can’t be bothered to order one then you can just try connecting a cable straight from the composite video point on the Main PCB directly to the RCA connector itself.  It should work.

8: Test

Time to test it! Don’t bother putting it all back together just yet – connect up the power and  connect the RCA connector to your TV composite video input using a standard RCA cable.  If all is well (and it should be) you will see a nice clean video output!

9: Enjoy!

I hope you enjoyed this simple modification.  If you try this mod yourself then I welcome comments – please feel free to join the discussion! I will leave you with a video I made of the modification that I made it while I was still on a voyage of discovery with it myself – you may still find it useful.

10: Links

Here are some links to other good sources of information on modding your Spectrum:

http://mrpjevans.com/2013/04/how-to-zx-spectrum-composite-video/

http://samsmods.blogspot.co.uk/2011/10/zx-spectrum-48k-composite-video-mod.html

http://www.jammarcade.net/zx-spectrum-composite-video-mod/

http://womblesretrorepairshack.blogspot.co.uk/2008/11/zx-spectrum-composite-video-mod.html

VIDEO: