beatworm.co.uk

There is a top level navigation menu at the foot of the page

A better iPhone 3G?

It seems like the iPhone 3G has been another smash hit. Certainly here in the UK, with pretty universal 3G signal coverage, there’s lots of interest, and the handsets are selling out as quickly as they come into stock. Several people I know who waited out the first generation immediately signed up for the 3G edition.

Responses to the new platform seem mostly positive, although there’s already some mild grumblingseeping through across the web. There’s more software glitches, unsurprising; given the rush of new third-party applications there’s countless potential software combinations interacting in unpredictable ways. The new units eschew the metal casing of the original iPhone, for a return to possibly scratch-prone iPod plastic. 3G mode depletes the battery rapidly, just as Apple said it would, when they justified their initial transport choice of GPRS/EDGE. The camera is unimproved over the first generation (although I have always been rather impressed with the iPhone camera. For a phone, with no flash it takes great photos, a textbook-worthy example of why it’s nothing to do with the megapixel count)

So maybe it’s not the holy grail of portable devices. It’s certainly not for me. I don’t like the idea of being locked to a single phone company. I don’t want a smartphone that can’t be used as a 3G modem – I’ve grown too used to being able to connect a variety of devices up to the net, using USB / bluetooth or even infra-red links. It’s a little big for my idea of a phone.

As a portable, internet connected, media player cum tablet, it can’t be beaten. The mobile browser is immeasurably better than any others I’ve used. The iPod, photo, and movie playing is slick, and the iPod + iTunes combination still the best available digital music library implementation. The straightforward syncing of contacts and calender information beggars belief (at least for Mac users, such as myself ). Thrown in a few simple PIM applications, ebooks and games from the Application store, and you’re looking at a compelling platform.

Of course, you can get the majority of this behaviour in the iPod touch. Smaller and lighter than it’s phone siblings. Metal back. iPhone-trouncing storage capacity (up to 32GB). Runs the same operating system and applications, same beautiful interface. No contract. The downside being that you can only use it as an internet device over WiFi, which means you need to be tethered to a hotspot. Except it doesn’t mean this at all.

There’s a simple recipe to open up the iPod touch’s internet capabilities to something much closer to the iPhone.

  1. Arrange a 3G phone+data connection with the phone provider of your choice. I use T-mobile, I’m very happy with the service.
  2. Choose a phone handset, with a high speed modem capability. Make sure you get a model with WiFi. I have a Nokia E51. It’s lovely. Depending on your phone contract terms, you may get this as a freebie.
  3. Configure your phone to act as a WiFi hotspot, using something like WalkingHotspot
  4. Join your iPod touch with your phone’s WiFi network. Enjoy 3.5G connectivity on the go!

Of course it’s not a drop-in replacement. You don’t get an in-device camera or GPS, although you may have these in your phone. You do get to spread the battery load between two devices, one with the big screen and multimedia capabilities, another with the data transmission hardware. Although WiFi use will run down your iPod battery faster, you might still find that this combination outperforms an iPhone 3G.

posted Thursday, July 24, 2008 at 10:53 by cms in computers, uncategorized | Comments Off

Note to self

Every time I install a fresh debian derived linux, I subsequently find out that I’m missing the man pages for the C library. Usually many months later, it’s not like I program in C for kicks. I then waste twenty minutes fruitlessly grepping around in apt using patterns like ‘glibc’. The package name is actually ‘manpages-dev’. Perhaps posting it here will fix this in my memory.

posted Friday, July 18, 2008 at 11:03 by cms in computers | 1 Comment »

Get xterm title string from the UNIX shell

Sometimes you run programs in xterm windows that try and do you a favour, by setting the xterm title property. Potentially useful enough, but aggravatingly some of them don’t restore the previous title when they exit. If you’re using some scheme of your own to set meaningful window titles, this is annoying.

Here’s a shell one liner that you can use to grab the current title in an xterm. You could use this to write a wrapper script that gracefully launches any such rude application, and restores the rightful title property when it’s done

/usr/X11R6/bin/xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/'

posted Saturday, June 7, 2008 at 14:21 by cms in computers | Comments Off

Combining PDFs with Automator in OS X Leopard

Ever wanted to combine multiple individual PDF files into a single PDF document? Say you were scanning a paper document, a page at a time, and wanted to collate the digital pages back into a single document. Or collect together a number of similar PDFs you’d generated
via ‘Print to PDF’, perhaps to send via email.

You can do this incredibly simply in Leopard, without resorting to any additional software. PDF is such a fundamental component of Mac OS X, you can script operations like this using a very simple Automator workflow.

Just build the following sequence of actions.

1. Files & Folders: – Get Selected Finder Items
2. PDFs: – Combine PDF Pages
3. Files & Folders: – Open Finder Items

Select all the individual pages in a Finder window, and then run the workflow. After a short wait, while the actions are run, a multi-page PDF will open in Preview. Choose ‘Save As’, to create a new file. Notice the optional Quartz Filter operations you can apply to the new document when you save.

posted Sunday, March 30, 2008 at 13:40 by cms in computers | Comments Off

Simple accumulator in Quartz Composer

Another kind of iteration you often want to do when constructing programs, is to count things. Quartz composer provides the counter patch, which increments a running total when one of it’s inputs switches from false to true. Similarly, it decrements the total whenever the signal to it’s other input changes from false to true.

By generating a regular true/false alternating value, and connecting this up to the increment line, you could generate a regular count. This composition demonstrates one way to do this. Using the Patch Time patch, a count of time in seconds is passed through a modulo 2 operator to generate a regular sequence of alternate 1s and 0s. This is connected up to the increment line of the counter, which then counts upward in integers.
quartz composer counter generating stripe width

The counter value is used to govern the stripe width of a vertical stripe pattern. As the patch runs, the stripe width increases every other second. This is a very simple display, but the bit generator and accumulator demonstrated are useful in a variety of ways. You can download a copy of this patch here.

posted Sunday, February 10, 2008 at 13:25 by cms in computers | 1 Comment »

Basic looping with Quartz Composer

Quartz composer is a visual programming tool from Apple that ships as part of the Developer tools with Mac OS X 10.4 or later. It presents a visual object-oriented programming metaphor around Quartz and Core Graphics that allows you to simply compose graphical effects by connecting inputs and outputs of different objects together, graphically.

You can use QC to build pipelines that respond to a variety of inputs, local or via peripheral interfaces to construct visualisers for a variety of source signals, such as MIDI, audio from the built in mic, video signals from an iSight camera, or even networked events from computers on your internet or LAN. It also can be used to procedurally generate graphics, which you can use to build fancy displays or screen savers. Some of the system screen savers that ship with OS X, like the ‘word of the day’ or the ‘rss visualiser’, are actually simple Quartz Composer scripts.

It’s an impressive tool, and ships with documentation and some examples of what you can do. You can achieve nice effects quite quickly, but there is still a learning curve to climb. As an example, a common thing you might want to do when constructing simple animating displays, is loop over a set of possible outcomes. Iterators are a common piece of the vocabulary of programming languages, but it took me a little while to figure out how to achieve this with the ‘box and string’ interface of this tool.

Here is a simplistic solution solution I came up with. Read the rest of this entry »

posted Friday, February 8, 2008 at 13:44 by cms in computers | Comments Off

Tracing Unit Tests with the XCode 3 Debugger

XCode has a nifty integrated debugger which is really a pretty wrapper around gdb. It lets you point and click, and drill down on things within the gui with ease, but still preserves access to the underlying raw gdb console and output. You can create breakpoints and watches, both literal and dynamic, step through your application as it runs, all the usual stuff.

I’m not the world’s greatest user of debuggers. I’m more likely to trace through things until they make sense using some combination of logging, print statements, paper and pencil, or my absolute favourite, just explaining your mystery problem out loud to a nearby third party, embarrassing yourself by spotting the obvious bug mid-flow. That last one sometimes even works with the dog. Sometimes though, you’re stumped, and you want to set some watchpoints, step through your program as it executes, or just generally prod things mid-run, and poke around under digital rocks.

Something I’ve been trying to practice recently is Test Driven Development. XCode 3 ships with support for the OCUnit testing framework built in. You can add a Testing target to your XCode project, and build up test case classes that use this framework, and the build tools know how to run these through the test harness. And so you progress, write a test for a feature, run the test harness, write code to pass the test harness, repeat. It’s a great way of not only catching certain classes of bug before they happen, but perhaps more interestingly imposing a more minimal design focus on your application as you build it; you’re automatically casting yourself more in the mind of a consumer of your application services, something I find really helps avoid over-design.

At some point though you are likely to run into some kind of hard to understand failure case within a unit test, and find yourself reaching for the debugger. And then finding that the debugger doesn’t work. This is because the runtime of your unit testing target is actually the separate test harness framework, and not your application target. The test harness is a regular application that’s dynamically loading your test classes and running them. In order to be able to use the IDE to debug your unit tests, you just need to do a little extra configuration within your XCode project, as follows.

Read the rest of this entry »

posted Thursday, February 7, 2008 at 15:56 by cms in computers | 13 Comments »

X11 is really borked in OS X ‘Leopard’

It shows how infrequently I use it these days, but I yesterday found myself using a remote X client on my Macbook, and to put it bluntly, the X11.app as shipped with leopard is fucked. When I was working for IMDb, this would have scuppered my world. I can’t decide if I even need it enough now to make it worth trying to fix.

Update:

Of course I had to try! Installing the latest community developed packages seems to fix most of the immediate problems, giving a useable X11. And the new code base, and launchd integration bring real improvements over Tiger. Now quartz-wm is open source, X11 on the Macintosh can be synchronised with X.org. It would be even better if Apple folded some of these fixes into official updates.

posted Saturday, January 12, 2008 at 10:27 by cms in computers | Comments Off

Scripting iTunes for the iPod, with Perl and Mac::Glue

I acquire new music at a relatively steady rate. I’ve been use my computer as a music library, storing my purchased music on a fileserver. Once I migrated to Macintosh, I started using iTunes to manage this process. It’s a useful solution, what small trouble I do have is usually related to my unusual configuration. I keep my music collection on an NFS filesystem, enough of a weird thing to do that I’m surprised iTunes doesn’t have more trouble with it.

A few years into this process I decided to get a portable audio player. An iPod was the obvious choice, despite the cost. Plug and go, lovely interface, Just Works™, all the usual. The 40GB model I went for was larger than my entire music library, compressed, to mp3 or increasingly to aac, with moderate settings. Synchonising is almost magically simple; set the iPod to sync ‘checked items’ and uncheck anything in iTunes you wish to exclude. I extolled the benefit of this approach to anyone who asked.

This approach will only scale so far. After several years of acquisition, the ‘checked’ set must exceed the 40GB capacity of the device. Luckily, by the time I reached it, Apple upgraded the iPod range, the new ‘classic’ guise, offering a potential 160GB storage. I toyed with one of these on display in a shop, but quickly gave it up unconvinced. I had misgivings about the new unit, foremost was the surprisingly sluggish interface.

Read the rest of this entry »

posted Thursday, January 10, 2008 at 15:44 by cms in computers, music | 3 Comments »

2008 brings the changes

I detest New Year’s Eve, and I’m not an enormous fan of the Gregorian Calendar, which seems to me to be one of those aggravatingly archaic measurement systems, which whilst possessing romance and historical pedigree in gross quantities, really don’t scale too well to the modern age. And don’t get me started on time-zones

Database-nerd pedantry aside though, I do really like New Year resolutions. I like the idea of working at self-improvement, and consequently I always make a goodly set of targets for myself, mostly privately. They’re not always focused on tangible goals, and those that are I often fail to meet, but then, stretching oneself is sort of the point.

Probably the silliest scheme I’m going for in 2008 is to quit drinking alcohol. Not that I think I have a problem, as you’re traditionally obliged to add as a follow up to that statement. As a regular alcohol user though, I do think it will present an interesting challenge, and I suspect it will have a generally beneficial effect on my health, and also my bank balance. I’m in good company too, it seems like Richard Herring is joining me on my quest.

I’m going to leave myself the cop-out clause, of still allowing champagne. Firstly, it allows me to join in the toasts at significant social gatherings. Secondly, it lends an air of faux-class, as by champagne, I mean your actual champagne; none of your prosecco or cava, thanks very much. Thirdly, if I find myself regularly buying crates of champagne at bulk discount for home consumption, I’ll have good grounds to accuse myself of hiding a drink problem.

Another good thing about breaking in a new year, is that it encourages change. I’ve already indulged in some long-neglected home improvement work, and I’ve extensively rebuilt and replumbed this website to use the WordPress system for the blogging bits. The base URL has changed, and there’s now a wider variety of detailed feeds. I’ll endeavour to maintain all the old permalinks and feeds with redirects, and I’ve migrated all the old content across. There is bound to be breakage, so let me know if you spot anything.

Previously, I was using a publishing system which started out as the marvellously simple blosxom, which progressively grew less marvellous and more complex as I hurriedly hacked new features into it on demand, or whenever the mood caught me. Blosxom is ace, and if the idea of a blogging tool that is just a perl script that builds static content and uses text files within the filesystem instead of a database strikes you as intriguing, you should definitely give it a go.

Blosxom development seems to have stagnated for a long while, although there’s recently been more activity, and my slapdash customisations had grown crufty and brittle enough to make my publishing environment fragile, and irritating to change. And so, WordPress. This brings all sorts of new features I’ve been asked for, but too lazy/busy to add in the past (comments!), extensibility and an active development, and it’s based on the industry lowest-common-denominator combination of apache / PHP / mysql, so I can keep control of my own content, yet can easily move it to pretty much any cheap-ass hosting provider under the sun if needs be.

And as an added benefit, I expect I’ll be posting more frequently, at least until the novelty wears off.

posted Wednesday, January 9, 2008 at 17:33 by cms in computers, uncategorized | 1 Comment »