Archive for September, 2008

Empty directories in Mercurial

Sep 24 2008 Published by Desmond Elliott under Uncategorized

Mercurial does not support empty directories (Section 5.1.2), but you need empty directories if you have Mercurial running ontop of an SVN checkout and you want to move your Mercurial repository to a different machine and still be able to perform svn operations.

Running the following script from the base of your repository will rebuild the empty directories.

#!/bin/bash

# Rebuilds empty directories which are lost by HG but required by SVN

for d in `find . -type d | grep /.svn$`;
do
        # -p to make $d/tmp parent directory
        `mkdir -p $d/tmp/prop-base`
        `mkdir $d/tmp/props`
        `mkdir $d/tmp/text-base`
done

An example of how I used this script:

I had a local directory named recsys where I was working on the recommender system for DSpace. It was an SVN checkout of the DSpace trunk and I liked to keep the prototype in sync with trunk to help prevent bitrot. If I pulled recsys from my development machine to my laptop, I lost vital svn directories for performing SVN updates.

Running the above script from the base of the recsys directory re-created the empty SVN directories and let me continue with my work on a different machine.

delliott@localhost:~/Source/recsys$ hg init
delliott@localhost:~/Source/recsys$ hg pull http://example.org:8000
pulling from http://example.org:8000
requesting all changes
adding changesets
adding manifests
adding file changes
added 9 changesets with 820 changes to 809 files
(run 'hg update' to get a working copy)
delliott@localhost:~/Source/recsys$ hg update
807 files updated, 0 files merged, 0 files removed, 0 files unresolved
delliott@localhost:~/Source/recsys$ svn update
svn: Can't open '.svn/tmp/tempfile.tmp': No such file or directory
delliott@localhost:~/Source/recsys$ ./create_empty_directories.sh
delliott@localhost:~/Source/recsys$ svn update
U dspace/config/dspace.cfg
Updated to revision 3005.

Caveat: I may have totally misunderstood Mercurial. If you think I have, please let me know how I should have solved this problem.

No responses yet

The iPhone 3G Battery Life: From Almost Two Days to Almost Three-and-a-half

Sep 12 2008 Published by Desmond Elliott under Uncategorized

(This post was updated on 14th October 2008 to include data on the battery performance of the iPhone 2.1.x OS. Some paragraphs were re-worded to reflect the inclusion of 2.1.x and 2.0.x data)

I stood in line on the 11th July 2008 to buy an iPhone 3G. Many people have written about the short battery life of the iPhone, so I decided to evaluate of the battery life in my real-world use. This is not supposed to be the most comprehensive analysis, but it is over a more significant period of time than the major publishers and I didn’t test the battery life exclusively in one task domain.

Methodology

1. Start with a discharged iPhone, defined as when the iPhone shows you this screen:

2. Fully charge the iPhone through the USB by connecting it to a computer. Record the date and time you remove the phone from the charger.

3. Use the iPhone until discharged, as defined above. See the section on Verification for instructions on how I used the iPhone.

4. Record the date and time of discharge and return to Step 2.

Verification

It will be difficult to verify the results of this experiment because there were only two conditions on how I used the phone: the phone must discharge as defined above before recharging it to a full charge. This is not a controlled laboratory experiment because I’m not aware of anybody who uses their mobile phone in that situation.

I use the iPhone to read sports news in Safari, listen to music on the iPod, read GMail (1 hour fetch), occasionally play Hanoi or Labrynth, telephone calls, text messages, take photographs, browse Facebook, and use Google Maps for directions. The brightness is set to the lowest level and the ringer volume varies depending on where I am. Sometimes I used 3G to access the internet but I let the phone choose whether to use 3G or EDGE based on reception.

Usage statistics for my phone after the 2.0.x trial were:

Lifetime Call Time: 7 hours 22 minutes;
Data Sent: 13.5MB
Data Received: 174MB

Usage statistics for the phone after the 2.1.x trial were:

Lifetime Call Time: 9 hours 26 minutes
Data Sent: 17.3MB
Data Received: 219MB

Results

Over the 28 day period from 13th August 2008 to the 12th September 2008, the iPhone held its charge for an average of 46 hours 17 minutes.

Over the 28 day period from 12th September to 12th October, the iPhone held its charge for an average of 81 hours 49 minutes.

The graph below shows charge time in hours per cycle using the 2.0.x iPhone OS and the 2.1.x iPhone OS. The colour coordinated blocks show equivalent charge cycles, the white blocks show when the phone was charging, and the grey blocks show the additional charge cycles when using the 2.0.x software.

There is a slight discrepancy in the total duration between the 2.0.x and 2.1.x and this is because I wanted to let the experiment run until the end of the battery life for the final 2.1.x charge.

Final thoughts

I’d like to hear from anybody who has been taking similar measurements and what their results are, or whether anybody with an iPhone competitor has taken similar measurements. The release of the iPhone 2.1 software encouraged me to take these measurements for another month and I think they confirm, for my use pattern, that there really is “significantly improved battery life, for most customers” using the new OS.

No responses yet