Francis Devereux

June 4, 2011

Copy SMSes from Nokia S60 phones to Android phones

Filed under: Android, Symbian — Tags: — frankoid @ 8:59 pm

I’ve just written a Python utility to help me copy my SMSes from my N95 to my HTC Desire. I’ve uploaded it to github in case anyone else needs to migrate text messages from a Nokia phone to an Android-based one.

http://github.com/frankoid/nokia-sms-to-android

To use it:

  • export your messages to CSV using Nokia PC Suite
  • convert the CSV to XML using nokia2sbr.py
  • copy the XML file to sdcard/SMSBackupRestore/ on your Android’s SD card
  • install SMS Backup and Restore and use it to restore the XML file

If you want to copy both sent and received messages you’ll need to repeat the procedure for the Inbox and Sent folders on your Nokia.

February 15, 2010

Quick Recipe for Building Universal jsvc on OS X 10.5

Filed under: Java, Mac OS X — frankoid @ 4:52 pm

Edit: Now that commons-daemon 1.0.2 has been released and included in MacPorts, an easier way of building a universal jsvc is to install MacPorts, set universal_archs to “i386 x86_64″ in macports.conf and run “sudo port install commons-daemon +universal”.

Here’s how to build Apache jsvc (commons-daemon) on OS X 10.5 so that it is capable of launching Java 1.5 32 bit, 1.5 64 bit or 1.6 64 bit.  This post is mainly for my own reference, so it hasn’t been tested thoroughly…

First, get the latest commons-daemon code from svn (the 1.0.1 release won’t work – you need the fix for this):

svn co http://svn.apache.org/repos/asf/commons/proper/daemon/trunk commons-daemon-trunk

Now the recipe:

cd commons-daemon-trunk/src/native/unix/
autoconf
CFLAGS="-g -O2 -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" ./configure
make
sudo cp jsvc <prefix>/bin/

This jsvc will start a 64-bit JVM by default.  To run a 32 bit JVM, do

arch -i386 jsvc <jsvc args>

or, if you are using tomcat6 from MacPorts and have the universal jsvc in /opt/local/bin:

JSVC_ENV="arch -i386" tomcatctl start

September 6, 2009

Running Carbon Emacs.app 22.3 on Snow Leopard

Filed under: Emacs, Mac OS X — frankoid @ 8:09 pm

Here’s how to get the Carbon GUI version of Emacs 22.3 running on Snow Leopard. It won’t compile on Snow Leopard, so you need to compile it on Leopard.

Ingredients:

  • a mac running OS X 10.5.8 with Xcode 3.1.x installed
  • a mac running OS X 10.6.0 with Xcode 3.2 installed
  • the Emacs sources, emacs-22.3.tar.gz

On the 10.5.8 mac, extract the emacs sources and compile them:

tar xzf emacs-22.3.tar.gz
cd emacs-22.3
./configure --enable-carbon-app && nice make -j2

On the 10.6 mac, copy the emacs-22.3 directory from the 10.5.8 mac and install. The path ‘/Volumes/francis’ in the commands below is my home directory on the 10.5.8 mac, which I mounted on the 10.6 mac in Finder:

ditto /Volumes/francis/Code/unmodified/emacs-22.3 emacs-22.3
cd emacs-22.3
sudo make install

You should now have a working /Applications/Emacs.app on your 10.6 (Snow Leopard) mac :-)

January 11, 2009

6GB of RAM in a MacBookPro4,1

Filed under: Hardware — frankoid @ 2:53 pm

I have recently been working with VMware Fusion VMs at the same time as running other memory-hungry apps such as IntelliJ IDEA and NeoOffice on my Early 2008 MacBook Pro 15″.  Even with 4GB of RAM, the maximum officially supported, the machine would still start paging heavily from time to time.  After reading this thread on mactalk.com.au I decided to try replacing one of my 2GB DIMMs with a 4GB one.  I bought a G.Skill 4GB DIMM from memoryc.co.uk and it’s working great.  Here’s the obligatory System Profiler screenshot:

 

System Profiler Screenshot

System Profiler Screenshot

 

Note: I wouldn’t recommend using 2 4GB DIMMs for a total of 8GB because people who have tried it have reported problems.

November 6, 2008

S60 Remote Control API Weirdness

Filed under: Software Development, Symbian — frankoid @ 10:24 pm

I have been using Symbian OggPlay (a music player for mobile phones) for quite a while, first on a Nokia N70 and now on an N95. It doesn’t have support for the volume buttons on the N95, so I decided to add it. The N95 has a volume control on the side of the phone, and another one on the remote control in the headphone chord.

I used the remote control API to handle the volume controls, and noticed something strange: the actions reported to my code when the volume control on the headphone remote is used are different to the actions reported when the volume control on the phone is used. Here’s what is sent to my code’s MrccatoCommand method:

Volume control on headphone remote

When the volume up (or down) button is pressed, an ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is immediately sent with a button action of ERemConCoreApiButtonPress. When the button is released, another ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is sent with an action of ERemConCoreApiButtonRelease.

The headphone remote never generates commands with action set to ERemConCoreApiButtonClick.

Volume control on the side of phone

When this volume control is used, a different sequence of commands is reported depending on whether the button is held down for a short or a long time.

When the button is held down for a short time, only one command is sent and its action is set to ERemConCoreApiButtonClick.

When the button is held down for a long time, first a command with action ERemConCoreApiButtonClick is sent as soon as the button is pressed, then there is a short delay and a command with action ERemConCoreApiButtonPress is sent. When the button is released a command with action ERemConCoreApiButtonRelease is sent.

If you would like to look at my code, the patch to OggPlay is at http://www.devrx.org/software/symbian/oggplay/symbianoggplay-mediakeys.diff.

October 29, 2008

Installing gcc 3.3 on Mac OS X Leopard/Intel

Filed under: Computers, Mac OS X, Software Development — frankoid @ 5:01 pm

In order to build applications that run on Mac OS versions prior to 10.3.9, you need to use gcc 3.3 (see this Apple documentation for details). This is a problem if you have an Intel Mac running Leopard, because the Xcode 2.5 installer will only allow you to install gcc 3.3 on Tiger. However, there is a way to get it to install anyway… Be warned that Apple probably had a good reason to prevent gcc 3.3 from being installed on Leopard, so this may break your system and/or the binaries that you compile. However, it did work for me and allowed me to compile a small application that ran OK on OS X 10.3.7/PPC. Here’s how to do it:

  1. Install Xcode 2.5, including the 10.3.9 SDK.
  2. Copy gcc3.3.pkg from the Packages/Packages directory in the Xcode Tools disk image to your desktop.
  3. Open the copy of gcc3.3.pkg (right click it and choose “Show Package Contents”).
  4. Open gcc3.3.pkg/Resources/VolumeCheck in a text editor.
  5. Change if( CheckVersion("$SYSTEM_VERS", "10.5", "ProductVersion", ">=" )) to if( CheckVersion("$SYSTEM_VERS", "10.6", "ProductVersion", ">=" )) and save the file.
  6. Double-click on your modified copy of gcc3.3.pkg. You will now be able to install it like any standard Installer package.
  7. “If it breaks you get to keep both pieces.”

Data Recovery with ddrescue and the Freezer Trick

Filed under: Computers, Hardware — frankoid @ 4:42 pm

Recently one of the hard drives in my Linux server failed. I did have a backup but it wasn’t as recent as I’d like and didn’t include some recent emails that I wanted to keep (it’s my main email machine – I did have copies of the emails on my laptop but merging them with the server backup would have been a bit tricky).

At first the filesystems on the failed disk wouldn’t even mount, so I ordered some new drives and resigned my self to restoring from the backup. When the new drives arrived I decided to have one last go at copying my files from the failed drive… and this time the filesystems would mount! Unfortunately the faulty drive wouldn’t talk to my computer for long enough to copy the data off (part way through the copy it would stop responding to the computer and I would have to power-cycle the computer for it to be able to see the disk again).

At this point I had a look on the internet for tools that might help me recover my data and eventually found ddrescue. ddrescue is a clever tool that can copy data from one disk to another, skipping over areas that it can’t read. It logs which areas it couldn’t read, so that it can retry just those areas without having to read the whole disk again. I also read about the “freezer trick” – apparently some failing hard drives will work again briefly after being in a freezer (inside a watertight bag) for a few hours).

So, I ran ddrescue and it managed to read most of my drive. I then froze the drive for about 8 hours and ran ddrescue again. It was able to read some of the previously-unreadable areas, but I’m not sure whether this was because the drive was frozen or not. Anyway, in the end there was only about 10KB of 400GB unreadable, so I was pretty happy.

The next thing I did was improve my backup regime ;-) My server now has 2 drives mirrored using RAID 1, and a 3rd drive that is synchronised with the main drives every night.

July 17, 2008

OS X Tip: Finding All PowerPC Applications

Filed under: Operating Systems — frankoid @ 6:50 pm

I recently upgraded from a PowerBook to a MacBook Pro, and used Migration Assistant to copy the applications from the PowerBook to the MBP.  I wanted to find out which installed applications were PowerPC-only so I could look for updated Universal versions.
My first thought was to write an application to find them (I’m learning OS X programming at the moment and it also seemed like a good exercise).  After I got my app working I discovered that I didn’t need to write it: the built-in System Profiler has a list of applications and their architectures.  Oh well, writing the app was a good exercise and I learnt about an interesting undocumented function: _LSCopyAllApplicationURLs.
Anyway, here’s how to find your PowerPC-only apps with System Profiler:

  • Open System Profiler (Apple menu->About This Mac, then click on More Info…)
  • Click on Software->Applications in the tree in the left hand side of the System Profiler window
  • Click on the Kind column heading in the applications table, then scroll down to find the applications whose kind is PowerPC

May 21, 2008

A Memory Management Idea

Filed under: Operating Systems — frankoid @ 11:53 am

There is often a trade-off between speed and memory usage.  For example, when a web browser loads a new page, it can do a number of things with the old page, including:

  • nothing (throw it away)
  • cache the files that it downloaded from the server
  • cache the fully rendered version of the page

The first of these options uses the least memory and the last one (probably) uses the most.  Unfortunately, the first option also makes going back to the old page the slowest (because the browser must get the files for the page from the server again and render them again).  Now, the browser on my Nokia N95 seems use the first option.  This makes sense, because mobile phones don’t have very much RAM and don’t have virtual memory, so if the N95′s web browser cached pages in RAM then there wouldn’t be much RAM left form other applications to use.

The Idea

My idea is that when the OS notices that free RAM is low it could make a call to applications to say “please free some RAM”.  Then apps could merrily use RAM without having to worry about that causing problems for other apps.  If memory started to get tight the OS would ask the apps to free up some RAM and they could discard their caches.

Of course, there wouldn’t be much point in allocating some memory for a cache only to be told to free it up again straight away, so their should also be a way to allocate memory that would fail if there wasn’t plenty free – an “malloc if possible” OS call.

This idea would not only be useful on devices without virtual memory, like phones.  It would also be useful on desktop computers; for example the OS could ask apps to free up RAM before it started to page to disk.

Potential Problems

Memory management is already a difficult problem, especially in a virtual memory environment; it is difficult for the OS to determine what to keep in RAM and what to page to disc (or throw away, in the case of disc caches).  This idea would make things even more complicated.

There could be some interesting reentrancy issues too.  For example, an application could be asked to free RAM as a result of it requesting RAM itself.

I wonder whether this idea has ever been implemented?  If you’ve come across a system that implements this idea I’d be very interested to hear about it…

April 17, 2008

Hello world!

Filed under: Uncategorized — frankoid @ 7:06 pm

After years of resistance / indifference I’ve finally got a blog.  Can you guess why?

It’s (hopefully) a pretty original reason… because my Mum told me to!

So what am I going to be writing about?  Probably mostly technology rants (sorry Mum!) but I’ll also write some more personal posts; get in touch if you’d like to see them.

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.