iPad Initial Impressions

So, last night I got to play with an iPad for a couple of hours (thanks @davea!) and thought I’d post some of my initial impressions. Obviously these are my thoughts, your mileage may vary.

  • It’s smaller than you probably think it is
  • It’s exactly as big as you thought it was if you were sad enough to make an actual-size cardboard model of it months ago
  • The screen is gorgeous. Really bright, the colours just jump out at you, and the viewing angles are unreal. Photos look brilliant on it, but you see a slight lack of resolution in text when you’re zoomed some way out of a web page.
  • That said, because the screen is a piece of glass, it seemed as though glare could definitely be an issue depending on where you’re sat. I was trying to read Winnie-the-Pooh, and I could just see my face reflected in the screen because I was in the wrong position.
  • It feels really nice in your hand. It’s a good weight (although lighter would be nicer) and it feels reassuringly solid.
  • It’s fast. I’d read all the reviews saying how quick it was, but I didn’t expect it to be quite that quick. Everything just feels so slick and fluid, and I think this is a very big part of why I found it so nice to use.
  • Web browsing and Google maps are just brilliant. Again, there was a lot of hyperbole about how browsing the web on this thing is a totally new experience and you have to try it to understand it – and whilst that’s a little OTT, I kind of get where they’re coming from. It feels very different (in a good way) from anything I’ve used before. For casual web surfing, lay back on the sofa or in a comfy chair, and for actually reading web pages, I think it’ll be brilliant.
  • The Instapaper app was probably the nicest reading experience I came across while trying out the iPad. With the default font settings, it’s totally gorgeous. I could spend hours and hours working my way through my Instapaper reading list on this thing.
  • Reading PDFs is also a pretty great experience. It’s so nice to be able to flick through a PDF, and hold it like a book. A vastly better experience than reading them on a laptop or on my Sony Reader (which is far too slow for PDFs, and they don’t work well with that screen size).
  • Photos look great, and the slideshows work really well. The iPad would make a brilliant digital photo frame whilst not in use.
  • The keyboard surprised me by being much more usable than I was expecting. Portrait mode’s a little cramped, but landscape seems nearly full size. Straight away, I was typing very quickly with very few mistakes. I could see myself inputting a lot of text without the need for an external keyboard. NaNoWriMo 2010, perhaps?
  • It seems a very social device. Sure, we were all interested in trying it out and so it got passed around a lot – but it’s just so easy to spin it round or hold it up to show other people something cool. Or to load up an app and hand it over to someone to play with. It’s very unlike a laptop in that respect.
  • The ‘just a big iPod Touch’ comment that people have made is total crap. iPhone OS on a device this size is a very different experience. The extra screen space adds a lot. Web browsing in particular feels completely different to browsing on an iPhone.
  • My iPhone now seems very small, cramped, and slow.

I liked it, and can’t wait to get one. I think my primary use would be reading – Instapaper, websites, feeds, and PDFs. And I think I would use it a lot for all of those things. In fact, other than coding and managing my photos, I could see it replacing my laptop for a lot of things I do with my computer – namely, using the web, email, etc. And for me, that’d be a good thing – I hate being stuck behind a laptop when all I want to do is read. It’d be a nice distinction, because laptop would be for getting something done (coding, etc), and iPad would be for leisure. The iPad would also come in very hand whilst coding, for reference books, etc.


I just wanted to share an iPhone app I came across the other day which I’ve totally fallen in love with. It’s called Momento.

Momento is a diary/journaling app, which I guess is fairly self explanatory – you can add text to days in the form of ‘moments’. You can also attach photos to days, as well as tags for people, events, and geolocation information if you wish. Momento also has the ability to passcode your journal, to hide it from prying eyes (the main reason I want an electronic journal rather than a paper one). It’s super-simple to use, which is part of its charm; it gets out of your way and makes journaling easy (low barrier to entry: check!).

You can browse through your entries in a sweet calendar view or flick through individual days. Take a look at the screenshots on the Momento website – this thing is gorgeous. It’s a joy to use, both for writing and reading, and feels pretty damn close to using a paper journal. It brings to mind Tweetie 2 in terms of its visual polish – in fact, it even has that cute little arrow that slides along the tab bar at the bottom of the screen when you change modes, just like Tweetie.

In addition to its kickass-as-it-is journaling functionality, Momento can pull in ‘social moments’ from Twitter, Facebook, Last.fm, and Flickr. Fill in your account details for any of these services, and it’ll show your Flickr uploads, Twitter updates, etc, alongside your handwritten journal entries. In fact, it even grabs this data from the past, so you instantly have a very rough historical journal without having to write anything yourself.

My only real criticism of the app as it is is that there’s no easy / automatic way to export / import data. As it stands, you can email yourself an XML file of your journal entries from within the app, but there’s no way to re-import that data and the export is a manual process. Some kind of sync might be nice. It’s mainly for security purposes, just so I don’t lose my entries – I’m not interested in sharing them with anybody (I have a blog for that!). That said, paper journals don’t have a backup system!

I’ve been using Momento every day for the past week, and it’s brilliant. I’ve been wanting to keep a journal for a long time now, but I’ve never really given it a proper go. I’m intending to carry on with this now I’ve found a great way to do it – I’m going to try and write every day for a month, and then hopefully just keep on writing.


In recent years, I’ve become increasingly concerned about my scatterbrained-ness. I find it hard to focus on a single task for a prolonged period of time: for example, I find it takes me far longer to get through a book, or even read a short passage of text, than it ever used to. I don’t listen to the other person when I’m having a conversation — or rather, I try to listen, but the information somehow always seems to pass through my brain without being stored anywhere. I’m not really present in the moment. My brain gets distracted very easily, and I’ll swear I hadn’t had that conversation with you. My comprehension of texts is perhaps worse than it’s ever been, too. Not all the time, but often, I have to concentrate quite hard in order to actually take in the details of what I’m reading if I want anything more than a cursory understanding. When using the computer at home, I never seem to do anything productive — just follow an endless cycle of checking my feed reader, my e-mail, Twitter, and flicking through my open tabs. Sure, I get things done, but slowly, and piecemeal. My concentration usually feels scattered, my focus divided, my brain like it’s trying to juggle too many balls/clubs/knives/porcupines at once.

Continue reading “Singletasking”

Pea & Mint Soup


Tonight I cooked up a really tasty pea soup. I made it up as I went along – fortunately it turned out really tasty! Here’s my recipe (this made enough for about 2 large bowls):

  • 1 clove garlic, crushed/chopped
  • 1/2 onion, chopped
  • 1 small potato, quite finely chopped
  • 250 – 300g frozen peas (I used 275g)
  • fresh mint, torn; I used one really really good sized handful. Don’t be stingy, it can take a lot!
  • A good squeeze of lemon juice
  • 500ml vegetable stock
  • Some oil for cooking
  1. Heat the oil in a pan at a medium temperature. Add the garlic and onion, and cook until the onion starts to soften. Add the potato and cook a little longer, just to start it off.
  2. Add the stock, cover, and simmer until the potato’s fairly soft (10 minutesish?)
  3. Add the peas and the mint, stir, cover again, and cook until the peas are just soft.
  4. Scoop out a small amount of the peas with a slotted spoon / spatula (you can stick them back in at the end when you serve it).
  5. Blend until smooth. You may need to add a little extra water to get it to a consistency you like.
  6. Season, and add a good squeeze of lemon juice – adjust to taste.
  7. Spoon into bowls, and garnish with the peas you took out earlier (it’s best to lower them in on a spoon, or else they just seem to sink) and a little more chopped mint.


OS X on a Dell Mini 9

These days, my primary computer is a 15″ MacBook Pro. It’s an amazing machine, but sometimes those 15″ can be a little unwieldy (yes, that’s what she said).

Apple used to make a small, very portable laptop: the 12″ PowerBook, which was unfortunately retired during Apple’s switch to the Intel platform. However, the transition did introduce the potential ability to run Mac OS X natively on non-Apple hardware. Whilst Apple don’t (currently) make their own netbook1, a big community has sprung up around running OS X on non-Apple netbooks. I should note from the outset that installing OS X on non-Apple hardware potentially violates the OS X EULA. If you’re going to do this, in the very least ensure you own a legal copy of Mac OS X Leopard.

Continue reading “OS X on a Dell Mini 9”

Building Ruby 1.9 on Mac OS X 10.5 (Leopard)

I’ve recently been learning Ruby, and I wanted to install Ruby 1.9 on OS X to try out some of the new features (the current ‘stable’ version of Ruby is 1.8.6). Unfortunately, I couldn’t find one cohesive guide to doing this, and instead had to mash together various instructions from across the interwebs. I’ve pieced everything together here in the hope that it’ll help out someone else. 🙂

Continue reading “Building Ruby 1.9 on Mac OS X 10.5 (Leopard)”

Swapping Variables

I thought I’d share a little trick I learnt the other day regarding swapping variables.

A common coding/computer science task is to swap the values of two variables. In some languages, such as Java, one may start by creating a new temporary variable. For example (assuming we already have two ints, x and y):

int temp = x;
x = y;
y = temp;

This creation of a new variable uses more memory, and whilst in most circumstances would be fine, it could become an issue if we’re swapping many times, for example in a sorting algorithm.

Some languages allow us to do a nice swap without extra variables, using multiple assignment and tuple packing and unpacking:

x, y = y, x

This is pretty neat, although is apparently slower than using a temporary variable.

Anyway, yesterday I discovered a third method: XOR swapping. Again, this doesn’t require the use of an extra variable, and I thought it was pretty clever (here ^ represents XOR, as in Python):

x = x ^ y
y = x ^ y
x = x ^ y

Neat, huh? It’s fairly simple to see how it works if you simply walk through the steps. Let’s swap x = 7, y = 9:

x = 0111
y = 1001
x = x ^ y = 1110
y = x ^ y = 0111
x = x ^ y = 1001

Apparently this method is quite commonly used in embedded assembly code, however you won’t find it appearing much in code on a desktop computer. It usually is slower to compute than using temporary variables, as most processors attempt to execute commands in parallel – and of course, each of these instructions depends upon the previous result, so they must be executed sequentially. Still, it’s a nice thing to know.

The short version: it seems that if you’re trying to save memory then XOR swap or use multiple assignment, otherwise if efficiency is an issue, use a temporary variable.

FizzBuzz Follow-up

I thought I’d post a follow-up to yesterday’s FizzBuzz post with some sample solutions, as a bunch of you seemed to find it fun to solve. Feel free to add your own solutions in the comments of this post!

My own first solution was Python-based, and a fairly simple one:

for i in range(1,101):
    if i % 3 == 0 and i % 5 == 0:
        print "FizzBuzz"
    elif i % 3 == 0:
        print "Fizz"
    elif i % 5 == 0:
        print "Buzz"
        print i

Obviously it’s not in a function or anything, but I just wanted to do it as fast as possible. Shortly afterwards, I realised that line 2 could be simplified by changing it to:

if i % 15 == 0:

Because of course, if a number is a multiple of 3 and 5, then it must be a multiple of 15.

Here are a couple of nice alternatives (ideas courtesy of Dave, although re-written by me because we didn’t save them). First, writing FizzBuzz as a iterator:

def fizzbuzz_generator(n):
    for i in range(1, n+1):
        if i % 15 == 0:
            yield "FizzBuzz"
        elif i % 3 == 0:
            yield "Fizz"
        elif i % 5 == 0:
            yield "Buzz"
            yield str(i)

for result in fizzbuzz_generator(100): print result

Then, a simple function to calculate the correct fizz/buzz, combined with a list comprehension to create the result (man, I love list comprehensions):

def fizzbuzz(i):
    if i % 15 == 0:
        return "FizzBuzz"
    elif i % 3 == 0:
        return "Fizz"
    elif i % 5 == 0:
        return "Buzz"
        return str(i)

print "\n".join([fizzbuzz(i) for i in range(1,101)])

Finally, here are two neat little Ruby one-liners, taken from the comments of the original FizzBuzz article. I hope the authors (Brendan, and Brian respectively) don’t mind me reproducing them here:

puts (1..100).map{|i|(s=(i%3==0?'Fizz':'')+(i%5==0?'Buzz':''))==''?i:s}
puts (1..100).map{|i|i%15==0?'FizzBuzz':i%5==0?'Buzz':i%3==0?'Fizz':i}

How neat is that? Anyway, as I said, feel free to leave your own solutions below.

FizzBuzz and Other Problems

Update: Check out the follow-up post for some sample solutions!

I love to code. Since a young age (I think I was about 7 when we first got our BBC B, and I would patiently tap BASIC code into the blinking prompt from childrens’ books about programming), I’ve loved to write programs. I read somewhere recently (unfortunately, I forget where) that it’s not the act of coding itself we love, but rather it’s solving problems that we love. I think that’s one reason I like learning new programming languages, as it allows me to solve problems in different ways.

A while back, I came upon the FizzBuzz idea. In short, it’s a simple exercise for employers to give to potential employees at interviews; a very simple exercise, yet one that someone will only be able to answer quickly if they ‘get’ programming. A suggested FizzBuzz problem is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print ‘Fizz’ instead of the number and for the multiples of five print ‘Buzz’. For numbers which are multiples of both three and five print ‘FizzBuzz’.

I invite everyone reading this to have a go now – time yourself, and see how quickly you can do it. Unfortunately, I only timed myself by looking at the clock, but I was glad to have completed it in under a minute. Apparently this shows I can code:

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary? – the majority of comp-sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

That is a scary thought, but I expect it’s almost certainly true.

So, this sort of simple problem excites me – I can work out a solution, and then try and improve that, perhaps. Myself and Dave spent a fair while earlier today trying to come up with more and more sophisticated solutions. And y’know what? It was fun!

On a similar note, I thought I’d mention a website that I found a while back (thanks to Matt Gwynne) that might be of interest to anybody else who enjoys these kind of problems. Project Euler is “a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve”. It contains a list of (at the time of writing) 195 mathematical problems, and the aim is to write code to solve them. You can then put in your answers, the website will tell you if you’re correct, and check them off the list. Great fun, and it’s neat to see some of the interesting solutions that people come up with (and the range of languages they use!). Hooray for being a geek! \o/