How to do this EASILY via software using Mac OS X?

I spent a long time trying to figure this out. Ziphone doesn’t seem to do it (it doesn’t brick the iPhone, it just forces a restore). Some of the others are too hard (SSH’ing to the iPhone, come’on really…script it or something!). Sure, I understand the reason why 2.2 works and 2.2.1 doesn’t for the unlock (the baseband upgrade), and honestly, I don’t care. I just want to be able to click a button and follow some on screen instructions ;)

My final (working) solution? Don’t. Upgrade to 3.0 and do it with that.

Basically, get a copy of redsn0w to jailbreak the 3G 3.0 firmware and install Cydia, then add the Ultrasn0w repository and install ultrasn0w. Complete! I also did this on an un-activated iPhone by doing the install via Wifi instead of 3G.

Complete instructions for obtaining and installing redsn0w are available at iClarified.

Complete instructions for the jailbreak + unlock technique are available at Quickpwn (obviously, using the instructions above for the jailbreak…it really doesn’t matter how you jailbreak your phone, only that it /is/ jailbroken to enable the Cydia install).

Written on July 10th, 2009 , Informative

You’ve probably seen spreadsheets produced using Microsoft Excel that have this kind of look. You might have seen files produced using OpenOffice Calc that look like this. Excel 2007 comes with many (and I mean lots) of styles for the tables, many of which include alternating row colors. Calc comes with about 10 styles in total, 3 of which use alternating styles, none of which look very “professional” in my opinion (I’d never use them), and all of which are unwiedly and unconfigurable. So, aside from selecting the rows individually one by one and setting the alternating colors (then inserting a cell and having to redo it all over again, ugh), does OO Calc 3 provide an easy way to do this?

Not so far as I can tell. Google showed up a couple of options, all of which were either too hard to setup or too difficult to change once it was setup. I have to conclude that OO3 doesn’t provide a pre-built function for this. But it does give the tools necessary to create one. I’m talking about the conditional styling. Here’s what I do.

We want to apply a conditional style that says “If this cell is even then make it color 1, if it is odd then make it color 2″. Conditional formatting relies on styles being defined. You can’t just tell the Conditional Formatting box that you want the cell to be color 1. You have to tell it that you want the cell to be style1. No problem, all we need to do is create a style based off the default that has a different background color.

If you’re styles window isn’t showing, just go up to the Format > Styles and Formatting option from the menu and it will. In my window I already have the styles defined, but you want to right click in the window and select “New”. Set the name of the style (as you can see, I’ve given mine obvious names for what I used them for). Go to the Background tab and select your desired color.

Click ok to exit the dialogue box. You’ll probably want to create 2 styles like I have, one for your “light” row and one for your “dark” row. Once you’ve done that, we’re ready to setup the alternating row colors in the actual table. Select the cells that you want to apply the alternating row color to and go up to Format > Conditional Formatting like I’ve done below.

Once you’re in the Conditional Formatting dialogue box, we need to set 2 conditions. The first one is “if cell is even” and the other one is “if cell is odd”. Every cell falls into one of these two categories in an alternating fashion. By default the dialogue box asks for “Cell Value”. You need to drop that box down and select “Formula”. You also need to tick the 2nd condition box and drop that down to “Formula” as well. It doesn’t matter what order you enter these in, but the formula for the odd cell is:

MOD(ROW();2)==1

And the formula for the even cell is:

MOD(ROW();2)==0

Then select the appropriate style for each i.e. you’re newly created styles.

Click OK to apply the settings and your rows should be alternating with the colors you set in the styles. Woohoo! :)

Some notes:

  • To edit the colors that are applied, just edit the styles. Click on your style then click on “Edit” and just go change the background color.
  • Conditional formatting is applied on a per-cell basis just like when you make the text in one cell bold. If you copy a cell from somewhere else in the sheet that is not part of the alternating rows, and paste it into the sheet (overwriting some other data perhaps), the pasted cell will not have the conditional formatting and thus will probably not have the right color. The easiest way  I have found to fix this is to re-select the cells in the alternating colored table, and re-apply the conditional formatting. This is easy because when you go into the conditional formatting dialogue box, the formulae should already be there, and clicking OK will apply it to the new cell.
  • The formatting is dynamic. That is, as you insert rows, the numbers of the rows change, and so the table automatically re-adjusts for the correct alternating row colors.
Written on June 22nd, 2009 , Informative

I compiled Eclipse from ports in PCBSD, which is the FreeBSD ports. I have updated them, so they are current. Upon running Eclipse, it bails and dumps the log file:

java.lang.UnsatisfiedLinkError: no swt-gtk or swt-gtk in swt.library.path

Along with a bunch of other referencing errors as to why the file is needed. The solution? Remove Eclipse:

pkg_delete eclipse-3.4.2

Then reinstall it as the package:

pkg_add -r eclipse

Why didn’t I do this originally? I did, it failed to install for some reason or other. Incidentally, when I installed it from the package system, it installed 3.4.1. Not that it really matters, it runs, and that’s what matters! *And* because it build the dependencies from source (I only removed the Eclipse program), I have an optimized version of the JDK woo!!!

Written on June 16th, 2009 , Informative

Recently I wanted to rebuild the index of an AVI file in PCBSD. I know AVIDemux will do this if you open the AVI and set the audio / video encoding to copy, and save it. This is good, because AVIDemux is available as a PBI installation package for PCBSD. Unfortunately, AVIDemux failed to open the AVI file (probably because the index was bad and it got confused). Anyway, I know that mencoder (the encoder part of MPlayer) will also do this. It’s command line based, and not included in PCBSD. So, I built it from ports. It wouldn’t build with x264 support, but that’s ok, I got it to build with the ‘normal’ codec selection.

My first attempt to run it yielded:

[spanky@zen /usr/home/spanky]$ mencoder
/libexec/ld-elf.so.1: Shared object “libtwolame.so.0″ not found, required by “mencoder”

Bu in the build process it had stated that the TwoLame libraries were found. I don’t know where it found them, but *I* found them in the VLC directory. Because PCBSD uses isolated installation files (i.e. the installation file includes all “shared” libraries required by the program for execution), and it is possible to uninstall those programs, all libraries that a program needs are kept in that programs directory. That means, if you install 2 programs from a PBI that use the same library, you will have 2 copies of it on your system. This isn’t unusual, Windows does this as well. Anyway, I happened to have VLC installed from a PBI, and VLC uses the TwoLame library also. So, it was simply a matter of linking the VLC version to the normal library search paths so that mencoder would execute:

[root@zen]/lib(85)# ln -s /usr/Programs/vlc0.9.9a/lib/libtwolame.so.0 /usr/lib/libtwolame.so.0

And then everything was peachy and I could [M]Encode!

Written on June 15th, 2009 , Informative


When building ports in PC-BSD 7.2 I often get this error:

autom4te: need GNU m4 1.4 or later: /usr/local/bin/gm4

The actual cause is that /usr/local/bin/gm4 does not exist in PC-BSD. PC-BSD places it in /PCBSD/usr/local/bin/gm4. All you need to do is symlink it, and everything should build fine:

ln -s /PCBSD/local/bin/gm4 /usr/local/bin/gm4

Written on June 14th, 2009 , Informative

I seem to get problems with SSH every now and then, and they are always a little obscure. I guess it’s just because I use it so much. Here’s my latest one.

spanky@spanky:~$ ssh admin@jenny
ssh_exchange_identification: Connection closed by remote host
spanky@spanky:~$

Ok so we have a Windows style error message – it tells us the connection was closed, but no indication of why. I also tried SSH’ing from multiple different boxes which normally work, and all yielded the same error. Jenny is a FreeBSD 7.0 box I use for database testing. I logged in physically to check this out. and found that my messages log file was spammed with errors of the /dev/null file missing. Interestingly enough, I couldn’t run any programs (w, ls etc.) because they all complained about the null device. I never realised how much depends on it…

The cause of this was that when I was compiling the Percona database source, it removed my /dev/null file. Incidentally the Percona compilation failed, although it is a problem with the InnoDB source / Makefile that is known. Anyway, a quick reboot of the server fixed it as it causes the device filesystem to be repopulated. If you every get this happening on a production server, I suppose you could just mknod the null device. I don’t know what the correct major / minor numbers on FBSD7.0 are though. There wasn’t really any need to learn given that I knew a reboot would fix it anyway – it did. :)

Written on June 7th, 2009 , Informative

Tonight I was reading Intel® 64 and IA-32 Architectures Software Developer’s Manual (not sure how long that link to Intel will be valid for; it looks quite obscure) and in the introduction chapter it states what processors the manual is specific to. Interestingly enough, it also goes on to state what processors belong to what family. I found it interesting because it’s unusual that I see documentation from companies that is so concise in giving information. While I knew the Pentium Pro / Pentium II micro-architecture  was the same, I didn’t know it was called the P6 micro-architecture. Just a little tidbit of information I thought I’d post and watch Google eat into the world knowledge banks (whole excerpt from the document below).

  • P6 family processors are IA-32 processors based on the P6 family microarchitecture. 
  • This includes the Pentium® Pro, Pentium® II, Pentium® III, and Pentium® III Xeon® processors. 
  • The Pentium® 4, Pentium D, and Pentium processor Extreme Editions are based on the Intel NetBurst® microarchitecture. Most early Intel® Xeon® processors are based on the Intel NetBurst® microarchitecture. Intel Xeon processor 5000, 7100 series are based on the Intel NetBurst® microarchitecture. 
  • The Intel® Core™ Duo, Intel® Core™ Solo and dual-core Intel® Xeon® processor LV are based on an improved Pentium® M processor microarchitecture. 
  • The Intel® Xeon® processor 3000, 3200, 5100, 5300, 7200, and 7300 series, Intel® 
  • Pentium® dual-core, Intel® Core™2 Duo, Intel® Core™2 Quad and Intel® Core™2 
  • Extreme processors are based on Intel® Core™ microarchitecture. 
  • The Intel® Xeon® processor 5200, 5400, 7400 series, Intel® CoreTM2 Quad processor Q9000 series, and Intel® CoreTM2 Extreme processors QX9000, X9000 series, Intel® CoreTM2 processor E8000 series are based on Enhanced Intel® CoreTM microarchitec-ture. 
  • The Intel® AtomTM processor family is based on the Intel® AtomTM microarchitecture and supports Intel 64 architecture. 
  • The Intel® CoreTMi7 processor is based on the Intel® Microarchitecture (Nehalem) and supports Intel 64 architecture.
Written on May 10th, 2009 , Informative

Recently I bought an iPhone. I had it shipped here from over east, so one of the first things I did was to reset the time zone in the General Preferences. It’s 3G so there isn’t any option to turn off time zone support completely, but that doesn’t bother me.

What frustrated me was that even after setting the time zone (Settings -> General -> Date and Time), my calendar events were still using the time zone from over east. I’m in Perth and the phone *was* using Melbourne time. Melbourne is 2 hours ahead of us (right now) so my calendar on my phone would say I have a 9AM appointment (because I set it that way), but when I sync with my Macbook, it would change it by 2 hours because it thought the phone calendar was using Melbourne time. This was driving me nuts not being able to sync my laptop and iphone calendars correctly.

After about an hour of Googling, I finally found out iCal (both on the iPhone and laptop) have support for independent time zones of the normal time. This is found in Settings -> Mail, Contacts, Calendars. So, even thogh I’d set the iPhone time to Perth, the calendar time was still in Melbourne. Grr…At least it was a simple fix once I found out what it was!

Written on April 22nd, 2009 , Informative

I use Munin to do some server monitoring. Munin uses a central server that polls nodes, it collects system data and graphs it for you. I have moved a Munin server before: just create the appropriate configuration so that the server polls the same nodes, and copy the RRD files over from the database directory on the old server.

I ran into a problem doing this recently, and my logs were telling me:

Mar 13 21:10:43 – Unable to graph /usr/local/var/munin/y.com.au/x.y.com.au-open_inodes-max-g.rrd: This RRD was created on another architecture

The problem is that the RRD graphs that Munin stores its data files in are endian specific. That means you can shift between the same endian’ness but not to a different system. More specific to my problem, you can shift between 32 bit same endian’ness, but not between 32 bit and 64 bit! Obviously the shift was because I upgraded a server, wanted to retain the data, and found that because the new server was 64 bit, I can’t.

Now, that’s not quite true. You CAN retain the database data, but you have to dump it out of the RRD file manually and re-import it manually. I didn’t bother, but it would have been nice knowing this in advance anyway.

Written on March 14th, 2009 , Informative

spanky@zen:~$ ssh user@host
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
30:82:36:ff:f4:78:e9:c9:df:94:8b:41:35:f6:2b:a4.
Please contact your system administrator.
Add correct host key in /home/spanky/.ssh/known_hosts to get rid of this message.
Offending key in /home/spanky/.ssh/known_hosts:5
RSA host key for [host]:22 has changed and you have requested strict checking.
Host key verification failed.
spanky@zen:~$

When you update OpenSSH server, timetimes it will change the host fingerprint. This means you will find yourself getting the above error on any host that you have saved the host fingerprint on. The fingerprint is designed to verify that you are indeed connecting to the host that you say you are. As the warning suggests, it can detect man-in-the-middle attacks. However, if you know that you are getting this because you updated software (or you have regenerated the host fingerprint manually), you probably just want to be able to connect to the server again!

You may already know that host fingerprints are stored in ~/.ssh/known_hosts. The problem can sometimes be that the individual entries are not stamped by host. Well, they don’t need to be, they are unique entries. So how do we know which one to delete? The line:

Offending key in /home/spanky/.ssh/known_hosts:5

Actually tells us that the key is indeed stored in ~/.ssh/known_hosts, AND it is on line 5. If you open up the file in vi, you will probably find each it looks like there are many more than 5 lines. Don’t worry, it’s just wrapping the line. Just count down to line 5 (alternatively, use :set numbers to see the line numbers – press the colon key, then type “set numbers” and hit enter). Then hit “dd” to delete the line”. :wq (colon then “wq”) to save the file and exit, and you should be sorted!

Written on January 29th, 2009 , Informative

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something is proudly powered by WordPress and the Theme Adventure by Eric Schwarz
Entries (RSS) and Comments (RSS).

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something

Personal jorunal of a professional geek – James Pearce in Perth, Australia