about:benjie

Random learnings and other thoughts from an unashamed geek

OSStatus iPhone SDK Meanings

| Comments

Image representing iPhone as depicted in Crunchbase

If you’ve got a line like this:

1
 LOGGING_FACILITY1( sanityCheck == noErr, @"Problem adding private key, OSStatus == %d.", sanityCheck );

But you don’t know what the OSStatus value means, and you’re devving on iPhone, here’s the answers:

OSStatus definition - what the different codes mean.
1
2
3
4
5
6
7
8
9
10
11
12
 enum
 {
 errSecSuccess                = 0,       /* No error. */
 errSecUnimplemented          = -4,      /* Function or operation not implemented. */
 errSecParam                  = -50,     /* One or more parameters passed to a function where not valid. */
 errSecAllocate               = -108,    /* Failed to allocate memory. */
 errSecNotAvailable           = -25291,  /* No keychain is available. You may need to restart your computer. */
 errSecDuplicateItem          = -25299,  /* The specified item already exists in the keychain. */
 errSecItemNotFound           = -25300,  /* The specified item could not be found in the keychain. */
 errSecInteractionNotAllowed  = -25308,  /* User interaction is not allowed. */
 errSecDecode                 = -26275,  /* Unable to decode the provided data. */
 };

iPhone SDK Upload Issues? Blame Apple’s “Compress This” Feature.

| Comments

Apple Sucks

If your app won’t upload but you’re sure you’ve compiled it and signed it right, the fault might not be yours. For me, it was the built in “Compress [Folder]…” option - the archive produced from this might be missing files. You’re likely to see such errors as: “The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.” “Icon specified in the info.plist not found under the top level app wrapper” Seriously, Apple, what the f*ck? Thats 2 hours of my life lost because Apple couldn’t nail the basics: an archive utility. I’m so angry right now.

Jem Shared Porn With Me on Google Reader!

| Comments

I was shocked and awed that my wife, Jem, shared porn with me on google reader: Jem shares 'Porn' with me in google reader

and I suggest you read the post from xkcd, too. In fact, I suggest you read the entirety of xkcd. I coined the verb “to be xkcd’d” which means “when you discover a new web comic and like the latest strips so much that you go back to the very beginning and read every single strip until you catch up to date again so that you can understand all the jokes in the full context of the comic” - quite a necessary abbreviation, I think you’ll agree! With xkcd, the king of xkcding, I was actually xkcd’d twice - first when I first discovered it, and second when I realised about the title text… And that bring me on to my xkcd reading tip: READ THE CAPTIONS - hover your mouse over the xkcd image and read the title text. Do this on the xkcd website. That Randall is a comedic genius. :) Some of the captions are too long for firefox, so I have installed ‘ Popup ALT Attribute’ for Firefox which gives a larger ‘tooltip’ window. Read on for the strip itself and my recommended webcomics I have a thing for corrupt women.

Whilst we’re on the subject of webcomics, heres a few more I read (in rough order of preference, though the top 3 are in ‘joint second place’ to xkcd):

  • Cyanide and Happiness - awesome if gross and un-PC. Very frequent.
  • SMBC - Saturday Morning Breakfast Cereal - very very good.
  • 909sickle - “popsickle” - generally a good read, often very funny, sometimes quite deep, infrequently impersonating other’s comics (when they did SMBC I didn’t notice until I read about it under the next SMBC strip!) - they generally do title text too though they did start phasing it out at one point(!!) and now they don’t do it all the time. :(
  • User Friendly - don’t get xkcd’d on this - theres 5 a week and it’s been going since 1997! Very techy :)
  • Basic Instructions - Genius - especially the early ones.
  • Buttersafe - nice’n long, often make me laugh
  • Luke Surl comics - short but sweet
  • Killer Spoons - makes me smirk

Wow, now I list them, I realise I really should get a life… Happy xkcding!

Calling All Southampton Hackers!

| Comments

City of Southampton

Before we start, just to be clear - this is not for crackers (people who illegally break in to computer systems) but for hackers (people who modify the software or hardware of their computer system including building, rebuilding, modifying and creating software and electronic hardware either to make it better, faster, give added features or to make it do something it was never intended to do).

UPDATE: we have a google group: http://groups.google.com/group/southackton

I’m intending on setting up a “Hackerspace” in Southampton targeted around software programming (for fun) and hardware hacking (e.g. robotics). I anticipate that people would attend the hackerspace either with their own personal projects (such as controlling their television using a Wii remote), or looking to join in on a cool project. The idea is that we can all share knowledge and help each other out in a fun and innovative environment .

I am provisionally calling this project SoutHACKton, though

Useful Bash Scripts

| Comments

Bash

Here’s a couple of bash scripts I’ve written recently that might be of use to someone. They work well under Ubuntu, and should work under any GNU/Linux or Unix system with the suitable software installed. Improved “svn diff” command (ignores whitespace “Whitespace (computer science)”), colour highlights output, requires colordiff) - I put it in /usr/local/bin/svndiff:

/usr/local/bin/svndiff - ‘svn diff’ but coloured and ignoring whitespace
1
2
#!/bin/bash
svn diff -x -w $@ | colordiff

Improved recursive grep command (greps recursively, ignores files in the .svn folders, ignores temporary files, highlights output in colour) - I put it in /usr/local/bin/grepr:

/usr/local/bin/grepr - recursive grep with colour highlights and excluding temporary files and .svn directories.
1
2
3
4
#!/bin/sh
SEARCHTERM=$1;
shift;
find . -type f -a -not -iname "*~" -a -not -iwholename "*/.svn/*" -exec grep -H --color=auto $@ "$SEARCHTERM" "{}" \;

You might also be interested in my previous “whoops I deleted files without telling svn” post here.

SVN Hint: Automatically Removing Manually Deleted Files From SVN

| Comments

Bash

When deleting files in a working copy of an SVN repository you should do it on the command line: svn rm [filename]. If, however, you don’t do this (e.g. delete through a gui, or just do “rm” without the “svn”) then SVN gets confused, and puts a “!” in it’s status before all the deleted files. If you svn update, all the files will be recovered, rendering all your time spent deleting them wasted. Really you should use svn rm, but if it’s already too late for that, you can use this bash fragment to delete the files from SVN:

Tell SVN to delete the files that you’ve deleted without telling SVN.
1
svn status | grep "^\!" | sed 's/^\! *//g' | xargs svn rm

This command does a status command, finds all lines starting with “!”, and then extracts the filename and runs it through “svn rm” - really deleting the file. Caveats:

  1. Manually deleted files are not the only things that makes svn use “!” - so beware of this! Ensure you do really want to delete all those files!
  2. This works for filenames which are all_one-word/without/any.spaces but I am not sure if it will work or not for filenames with spaces in.
  3. Use at your own risk. The code is simple enough so you should be able to grok what it does.

Enjoy!

New Year: Get Fit With GymFu!

| Comments

PushupFu Demo

I had intended to get fit (and thin) before my wedding last August, however that never happened. And before I knew it it was Christmas, with all that loverly food. I’m not stupid enough to try and diet over the Christmas period! Instead, I thought, what else is the New Year for if not improving ones health?

My business partner Jof and myself had been working on a fitness app for the iPhone, PushupFu, for a couple of months and we finally uploaded it to Apple on 23rd December. In a very generous gesture from Apple, the app was released on 1st January (or 31st December, depending where you live!) - a full week earlier than we were expecting. I find that the app definitely motivates me to do pushups when users challenge me, plus I also intend to complete the training course (should be done by May) - when I can do 100 pushups I will really feel fit! (Currently I’m still only able to do single figures, but I have only just started!)

So, if you feel you need to get a bit more toned this year, why not give it a go by visiting http://www.GymFu.com/ ? At time of writing we have 5 reviews in the App Store, all are 5 stars, so give it a go! Check out our other reviews below: