Monday, 14 May 2012

UFO: Enemy Unknown on Android

Watching the video for the most recent and promising remake of UFO: Enemy Unknown I decided to see if you can get the game running on Android.

Turns out it is pretty easy.

Emulator

I have tried two emulators for this now:

  • aDosBox - Free and works well enough. Performance is not great and the app crashes when you lock the screen which means you can't pause play to do anything else. There is a niggle with the mouse in that the game locks up until you move the mouse sometimes.
  • Turbo DosBox - £2.49 and is excellent. The performance is flawless and the mouse trackpad is arguably better than aDosBox (which I thought was pretty good already). The screen can be locked and the game resumed later when you're ready. Worth the money.
Get the game

Find a copy of the DOS version of UFO.

Unzip it to your SDCard. e.g. /sdcard/games/UFO

DosBox conf

If you are using aDosBox, then edit the DosBox configuration file /mnt/sdcard/app-data/org.hystudio.android.dosbox/.dosbox/dosbox-0.74.conf and changing the end of the config file to the following:

mount c: /sdcard/games/UFO
c:
UFO

Otherwise if you are using Turbo DosBox then you will need to find the Autoexec configuration option and enter the same text in there instead.

There you go, DosBox will start and load XCOM automatically.

The keyboard and mouse interface works nicely, again not as responsive as a real mouse and keyboard but enough to play.

Dropbox Sync

Finally I went one stage further and used Dropbox synchronisation to ensure that I had my saved game regardless of the system I played on. In particular an app called DropSync is perfect for this job.

Thursday, 19 April 2012

Compact Archery Target

Following on from the success of my previous attempt at a target, I decided to make a smaller more compact target for shooting away from home.

This time a washing powder box, some masking tape, lots more cardboard padding and some string were used. Again, very effective, and a pair of small stakes keep the target upright. The string acts as a loop to place the stakes through.

Thursday, 29 March 2012

Home Made Field Archery Target

The following is my first attempt at a home made archery target made of stuff we normally throw away. The objective is to make something that can take a few arrows and is simple enough that it can easily be replaced or repaired.

For my first attempt I will be using a reinforced cardboard box filled with scrap cardboard which was going to be recycled.

Start with a good sized box, I used the one for the vegetables delivery.

Then cut a piece of board to act as a back plate. Anything might do instead of wood. Strips of wood, carpet, thick cardboard etc.

Next insert a couple of camping straps which we can use to tension the filling. String would do as well, possibly masking or packing tape. I have also reinforced the box with another cardboard box cut to size.

Fill with a suitable filling. I used cardboard, but empty plastic bottles would do as well. Old clothes, telephone directories or even old books would all be suitable.

Keep filling...

Back plate on and tension.

There we go, that is all there is to it. Next up is a test shoot at the weekend. I will use a couple of pieces of wood as a back rest to stop the target falling over.

A successful test, the target held up well. My bow is not terribly powerful at 28" so the cardboard filling was quite enough to stop the arrows.

Monday, 19 March 2012

Full Sized Wallpaper For The Samsung Galaxy S

Setting the wallpaper doesn't seem all that obvious. Initially you look in the Android standard Menu - Wallpaper - Home Screen Wallpaper. Then you can pick a file. This is all fine until you realise that you cannot select the full size of the image. Only a fixed area that doesn't seem to scale.

Instead, I found it easier to resize the image manually to 800x960 and then use the Wallpaper Set and Save App to set the wallpaper.

Build Scripts

Having worked on a number of large build systems, mostly based on Ant, I am convinced they are not a helpful direction to go in.

The problems with Ant for example are legion:

  • Gardener effect - Great whilst the build system expert is present, but when they move on, it gets dumped in the lap of someone who might not give it as much love.
  • Tendency to grow - Systems growing organically is desirable in Agile development. An overgrown build system is however a pain to maintain.
  • Never Flexible Enough - Especially with Ant, we are constantly finding that the build system does not do exactly what we need it to and changing it is often awkward.

I could go on, but you get the point. What is the alternative?

Maven seems like a helpful option with its industry standard tasks and dependency resolution. I feel though that it is just a better Ant. That strikes me as a good starting point, but is at risk of suffering the same fate as Ant.

What is the alternative? Build it yourself.

  • Everyone can maintain it - But better than that, if you write it in the main development language then everyone can become a build system expert too.
  • Testable - Using the same testing framework as your production code means you can make sure the build system does what it says on the tin.
  • Expressability - How much extra faff do you need in Ant to conditionally compile some code? If you develop a light weight and sensible DSL for the building system, then you can express concepts like that in a lot less complicated, much more readable way.

Samsung GALAXY S Video Conversion

Converting video for the Samsung Galaxy S is as simple as the ffmpeg command below:

 ffmpeg.exe -i %1 -s 800x480 -vcodec mpeg4 -b:v 800k %1.samsung.mp4  

Importantly, the screen and resolution on the AMOLED display require a higher than default quality setting on the converted video. Otherwise you'll end up with a poor result.

As with before, paste the above command into a batch file and use it as a command line utility or as a drop target. You will need ffmpeg installed an on the path. But you knew that already right?

Wednesday, 14 March 2012

IBM ThinkPad X40 Compact Flash hard drive

The IBM ThinkPad X40 has proven to be a stalwart system. Both compact and with reasonable specification it can handle most programming tasks I throw at it. However, of late it has been suffering the slow painful stuttering process of its hard disk aging.

After doing some research it seems there are a number of people who have decided to replace the hard drive with a Compact Flash card. This is something I've been interested in trying for a while.

Components

ThinkWiki provides the starting point for the research along with various blogs. The following components have been selected for the upgrade.

PA-CF18H Adapter - Initially I had selected the Addonics adapter mentioned on the wiki, but it was only available from the US. Instead I found that Amazon UK sold a similar adapter by Sintech. It turns out that this is a product intended to be a replacement for 1.8" drives and is sized to fit into the same space and there was plenty of evidence to indicate that it worked successfully.
Transcend 16 GB 400x TS16GCF400 - This was a much more tricky a choice to make. Importantly for a Windows based Compact Flash installation, it must report to be a fixed drive. All Transcend cards do this automatically which was why I selected this card. Then it was a balance between speed and cost. There is the 600x series, but at almost double the price that put it outside my budget.
Sintech 2.5" to 3.5" adapter ST4044A - This component is not needed for the drive replacement, but it was essential in order for me to get an operating system onto the Compact Flash card. The X40 has no CD Drive so another system will be used to install and test the drive before replacing the laptop hard drive.

Proceedure

The following steps cover the replacement:

Format & Install

I connected the Compact Flash card and adapter to my main PC and ran through the standard Windows XP installation. The BIOS and Windows recognised the card as a hard disk and I was able to start the installation.

Note: I noticed that formatting the drive as NTFS seemed to cause the installation to take a very long time complete. Instead I reverted to FAT32 and found that the process was much faster. It seems the Compact Flash card is better suited to FAT32.

Configure Boot Loader

Once installation is complete, I encountered the somewhat dreaded "NTLDR is Missing" error message which occurs just after the BIOS completes its POST and tries to load the Operating System. Googling for this brings up various results until I found this page.

The reason the NTLDR error appears is because NTLDR looks at the drive geometry of the Compact Flash card, and finds it does not match what it was expecting. To solve this problem I followed the instructions from the article above and replaced the NTLDR boot loader with GRUB4DOS.

In order to complete this, I connected the Compact Flash card to a PC with a Card Reader. This will allow us access to the drive, to put the new bootloader onto it.

  1. Connect the Compact Flash drive a PC using a card reader.
  2. Download MBR Installer
  3. Download GRUB4DOS
  4. Using the Disk Management control to work out which drive the Compact Flash drive is. This is via Start -> Run -> "diskmgmt.msc" then look for the disk number of the Compact Flash drive.
  5. Extracted the grubinst executable from the "grubinst_1.0.1_bin_win.zip" and then from the command line, executed grubinst --pause (hd2) (where hd2 was the Compact Flash card drive number). This completed successfully.
  6. Copy "grldr" from the "grub4dos-0.4.4.zip" to the root folder of the Compact Flash card.
  7. Created a file called "menu.lst" in the root folder of the Compact Flash drive with the contents "chainloader /ntldr".

After these modifications, the Compact Flash drive would successfully boot and allow me to finish off the Windows installation and subsequent configuration.

Installation Into Laptop

The installation of the adapter is fairly straight forward. From the underside of the laptop, the hard drive is located on the left hand side towards the front.

The hard drive has a cover which is clipped onto the drive. This cover is screwed onto the chassis. Remove the marked screw and then carefully use the cover to extract the hard drive from the chassis. The hard drive slides out quite smoothly.

The hard drive screw mounted onto a tray which we will use to hold the Compact Flash adapter as the PA-CF18H fits exactly into the tray and this gives us a bit of extra purchase when slotting it back into the chassis. On my system there was some glue holding the hard drive into the tray, this comes apart with a little persuasion.

Place the adapter into the tray, and reinsert the tray into the chassis. Carefully guide the pins of the adapter into the corresponding connector being careful not to bend any pins. The tray should fit neatly inside the chassis.

Reattach the cover

References

I found the following blogs very useful:

The following articles were helpful:

Adapter Manufacturers: