Nissan Almera Self Diagnostic Menu

- 2009-09-28 10:44:00

Here's how to access the self diagnostic / configuration menu on a Nissan Almera 2003 SVE (N16):

  1. Start the engine
  2. Turn the radio on
  3. Turn the radio off
  4. Hold the info button in then:
  5. Turn the volume knob up (clockwise) until:
  6. Diagnostic menu appears

From here you can do various things: run self-diagnostics; reset/change the main service counter; various other tests for the climate control, sat nav system, etc.

Ignore .gitignore in Git

- 2009-09-21 06:00:00

Recently I ran into an issue where I was working on a project which had files I wanted git to ignore, but I didn't want to commit a .gitignore file into the project. In case you don't know, any files matching a pattern in .gitignore in a git repository are ignored by git. (Unless the file(s) have already been committed, then they need removing from git before they are ignored.)

Initially I figured I could just throw the patterns I needed excluded into my global ~/.gitignore, but quickly realised that I needed files matching these patterns to show up in other git repos, so going the global route really wasn't an option. After some thought I wondered if you could make git ignore .gitignore, whilst still getting it to ignore files matching the other patterns in the .gitignore.

Lets create a new empty repo to test this crazy idea in:

$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /Volumes/Brutus/Users/caius/foo/.git/

And create a couple of files for us to play with:

$ touch bar
$ touch baz

Ignore one of the files so we can check other matches are still ignored later on:

$ echo "baz" >> .gitignore
$ git ststatus
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       bar
nothing added to commit but untracked files present (use "git add" to track)

Ok so far, but we can still see .gitignore in git, so now for the crazy shindig, ignore the ignore file:

$ echo ".gitignore" >> .gitignore 

Lets see if it worked, or if we can still see our .gitignore:

$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       bar
nothing added to commit but untracked files present (use "git add" to track)

And lets just double-check that .gitignore and baz still exist on the filesystem:

$ ls -a
.               ..              .git            .gitignore      bar             baz

Fantastic! Turns out adding ".gitignore" to .gitignore works perfectly. The file is still parsed by git to ignore everything else too, so it does exactly what I needed in this instance.

Mac Tips you may not know

- 2009-08-31 13:08:48

Here are some mac tips I know and consider "basic" mac knowledge, but no-one else seems to know.

  • exposé key is on modern mac keyboards, looks like a load of squares on the F3 key.
  • ⌘ + Exposé key => Show Desktop
  • ⌃ + Exposé key => Show Application Windows
  • ⌥ + Brightness keys => Open Displays prefpane in System Preferences.
  • ⌥ + Exposé key => Open Exposé & Spaces prefpane in System Preferences.
  • ⌥ + Dashboard key => Open Exposé & Spaces prefpane in System Preferences.
  • ⌥ + Keyboard Backlight keys => Open Keyboard prefpane in System Preferences. (Only on laptops with keyboard backlighting.)
  • ⌥ + Volume keys => Open Sound prefpane in System Preferences.
  • ⇧ + Volume keys => Adjust the volume with the feedback noise setting toggled. If you normally have feedback "blips", it'll be silent. Or vice versa.
  • ⌥ + ⇧ + Volume keys => Adjust the volume in 1/4 of a usual step.
  • ⌃ + Eject key => Shows the Shut Down dialog.
  • In the shut down dialog, hit R to restart, S to sleep, to cancel.
  • (Pretty much) Any dialog that pops up, hitting will push the "cancel" button.
  • In "Show all windows" or "Show application windows" exposé modes, hit the tab key to cycle through applications.
  • Hit the space bar in exposé to activate "Quick Look" + windows pop up to 100% size as you mouse over them.
  • Hold down ⌃ + ⇧ when mousing over the dock to toggle magnification whilst the keys are down.

(Alternative title Peter Cooper suggested, "A miscellany of input device co-ordinations to modulate the response of Apple's task preview and switching subsystem")

Education Network Restrictions

- 2009-07-31 14:14:16

This is a re-run of an old post I took offline in an old server move and hadn't re-published.


Having been on two college systems and various university networks, I'm just amazed at the levels of freedom you have on some, and how locked down others are.

Take the first university network I ever used for example. It was pretty much totally open, to the point that I could game quite freely, and the administrator only picked me up because I was logged in as admin and not a normal user. (I didn't have an account for that machine.)

Going from that to my school network was a very big shock as it was moderately filtered through third party filtering software. This meant you couldn't go on the usual NSFW stuff, but still had access to other sites that could be seen as bad, such as proxy sites, or IRC java Clients for example.

Having moved from my old (slightly crass) college to my new one, its interesting how filtered this one is. You can't seem to go on a site with proxy or irc in the URL, except clean sites like the BBC or Wikipedia. The Proxy searching only came about through looking for web based IRC solutions.

Personally I think the universities have got it right. With all the students they have, they just limit the things they definitely have to, and allow everything else. (Blacklisting technique.) Both colleges seem to do the opposite - block everything until its verified and unblocked. (Whitelisting technique.)

The way I see it, the problem with the white listing technique is that people will always find a way around whatever restrictions are in place. For instance, I'm locked out of all of my web based email sites, so I can't email anyone. Its not the not being able to send that bothers me, its the not being able to save text that I've written in college to a website to then retrieve it from home that annoys me.

So how did I work around this restriction? Well I remembered that Google had bought Writely at some point recently, so one quick sign in later and I've got my own little area where I can save, organise and edit text based files. All I have to do when I get home is login, copy / paste into my email client and hit send.

One word that isn't blocked yet is blog, so I can still post this, and edit my posts. However, I'm still writing it in Writely and checking my markdown syntax is correct with Dingus. The writely interface is just that much nicer than notepad.

Capitalise "ringer" on the iPhone Volume Bezel

- 2009-06-20 15:44:04

Backstory: Got myself a first generation iPhone second hand and unlocked it to work on my existing T-Mobile (Official iPhone network in the UK is O2.) Noticed after a week or so of owning it that when you change the volume on the phone, the bezel that comes up says "ringer" across the top. But when you have headphones plugged in, it says "Headphones". (Note the capitalisation difference.)

Now I'm not usually bothered by stuff like this (honest!) but as soon as I'd noticed the "bug", I couldn't help but think of it everytime I changed the volume, whether I was looking at the screen or not. Seeing as I'm running a jailbroken phone, and therefore have SSH access to it, I figured the string would be defined in a .strings file somewhere in the /System folder. And I'd be able to change it!

Fast-forward a few months and I install the iPhone OS 3.0 update (jailbroken of course), and finally decide to turn the phone's SSH server on and go looking for the setting. To do so I figured I'd just need grep installed on the phone - I could copy the file itself to my mac and edit it there.

So I connect to the phone, have a poke around the filesystem and then start a search to find the correct file:

# On the iPhone
$ cd /System/Library/
$ grep -r "ringer" *
Binary file CoreServices/SpringBoard.app/English.lproj/SpringBoard.strings matches
Binary file CoreServices/SpringBoard.app/M68AP.plist matches
Binary file CoreServices/SpringBoard.app/SpringBoard matches
Binary file Frameworks/CFNetwork.framework/CFNetwork matches
Binary file Frameworks/CFNetwork.framework/da.lproj/Localizable.strings matches
Binary file Frameworks/CFNetwork.framework/no.lproj/Localizable.strings matches
Binary file Frameworks/Foundation.framework/da.lproj/URL.strings matches

At which point I stopped the grep search (^C) because I know the home screen of the iPhone is the SpringBoard.app, so I figured it would be in the file SpringBoard.app/English.lproj/SpringBoard.strings. Making sure to have SSH enabled on your mac, a simple scp CoreServices/SpringBoard.app/English.lproj/SpringBoard.strings user@your_mac.local: later and the file is sat in my home folder on my mac.

Switching to the mac, now I try and open the file with TextMate, only to realise its in binary format. I need it in the nice XML format to edit it, so a quick google later and I've found a hint on MacOSXHints telling me how to convert from binary to xml plist format.

# On the mac
$ plutil -convert xml1 SpringBoard.strings

Then opening the file in TextMate was a bit more successful! I can actually understand what its defining now. Search through the file for "ringer" and I found the following lines:

<key>RINGER_VOLUME</key>
<string>ringer</string>

Change the "ringer" to "Ringer" between the <string> and my editing work is complete! Yes, it really is that easy to edit an interface string that is defined in a .string. Now I just need to convert the file back to binary, and copy it back to the phone. Converting back to binary file is one line, just change the xml1 in the previous command to binary1.

# On the mac
$ plutil -convert binary1 SpringBoard.strings

And then scp it back to the phone, make a backup of the existing file, and overwrite the existing file with the new one I've edited:

# On the iPhone
$ cd ~
$ scp user@mac_name.local:SpringBoard.strings .
$ cd /System/Library/CoreServices/SpringBoard.app/English.lproj/
$ mv SpringBoard.strings SpringBoard.strings.bak
$ cp ~/SpringBoard.strings SpringBoard.strings

And then restart the phone, either in the usual manner or just run reboot on the phone via SSH. Lo and behold once its rebooted and I changed the volume, it read "Ringer"!

Screenshot of Volume bezel