Shortlink

CUICatalog: Invalid asset name supplied: (null) on iOS

So you’re seeing CUICatalog: Invalid asset name supplied: (null) when running your project in the simulator and you want to get rid of the errors.

This happens when you call [UIImage imageNamed:fileName]; and the fileName you provide turns out to be nil.

There’s not many easy ways to fix this except using the debugger, but where in the code is you’re supplying a nil pointer can be tricky to find!

Here’s where this neat trick comes into play:

1. Go to the breakpoints tab in your Navigator pane.

Step 1

 

2. Press the + button and click Add Symbolic Breakpoint…

Step 2

 

3. Fill in the following fields, taking note to include the $arg3 == nil condition

Step 3

 
That condition is the secret to this magic!

Shortlink

Google Email Uploader For Mac OS X

After moving my email account to Google Apps, I was looking for a way to migrate all of my old email in the Apple Mail.app to Google’s servers. In their setup guide, they link to the Google Email Uploader For Mac 1.2 app which seemingly is exactly what you want.

After giving it a go, it appears since OS X 10.7, Apple have changed the way they cache their email and there’s sub-folders (used for indexing?) numbered 1 to 9 (and occasionally ‘Data’) within each IMAP .mbox folder.

Since I’ve recently become a good Objective-C coder (mostly on iOS) I decided to check out the code from googles website and try to modify it to give proper labels for each individual mailbox.

I’ve uploaded my code to github and have a copy of the app here:

Labeled Google Email Uploader 1.0

Source on GitHub.

Shortlink

Creating a Front Mech/Derailleur Shim (31.8 to 34.9)… From Beer Cans!

Like many things with push bikes, there’s a part that you’re missing and there are a huge number of ways to fix it. They are usually:

  1. Buy the part made by the original manufacturer (a set of shims is £4.99) for more than you paid for the main item (I paid £4 for the derailleur)
  2. Bodge something else to make the part (I tried an inner tube first)
  3. Have a quick google for suggestions and make something someone else already has.

Option three is normally the best and cheapest method of doing this.

Here’s how I made mine:

Firstly, I took measurements of the circumference of the seat tube (diameter of 31.8mm) and subtracted 10mm for the compression created by the band: This is about 95mm.

The mech band is about 15mm in height, so the shim should be about 20mm tall so you don’t have to be very careful about position, but only protruding 2.5mm from top and bottom.

If we half the difference between the two diameters we want, we get 1.55mm for the thickness of the shim.

So, here’s the list of supplies I used (and you’ll probably need):

  • 2x 440ml beer cans
  • Rule
  • Electrical tape
  • Scissors
  • Sharp knife
  • If you’ve got one, and can use it: a micrometer

Steps to create the shim:

  1. Cut the top and bottom from your cans. Use the sharp knife to create the initial cut, and then the scissors to create an edge with less burrs.
  2. Cut the resulting large cylinder length ways and you should end up with a sheet of metal about 200mm x 120mm.
  3. At this point I measured the thickness with a micrometer to work out roughly how many layers I would need, and it came out to 0.11mm thick. Assuming the electrical tape that we will wrap it in is 0.05mm thick on both sides, we need about 14 layers to create a shim 1.53mm thick.
  4. Along the long edge, measure 95mm intervals and cut down them, this should make 2 sheets of 95mm x 120mm with a little excess.
  5. Then on each of these mark 20mm and create 6 strips that are 95mm x 20mm x 0.11mm. Keep doing this until you have 14, and discard the rest of the can. Measure the thickness of this stack (carefully, it’s sharp!) and it should come out about 1.5mm (because they’re not perfectly flat)
  6. Then cut two small strips of electrical tape to cover the ends, and stick them on. This should hold the layers together.
  7. Then start wrapping the whole shim with electrical tape and overlap the layers a little so nothing is exposed when it’s bent/stretched.
  8. You should have something that looks like this!

Shortlink

Windows Won’t Resume From Sleep, How to Diagnose and Fix the Problem.

Backstory: I recently sold some computer components to a friend and after building the computer, it would not resume from S3 sleep. I had previously used the components to sleep and resume many many times, so I did a lot of research into why a computer will sleep and almost resume but not get there. Turns out it’s almost always a badly written device driver that is not ACPI compatible.

Diagnosing the problem

  1. Remove all connected USB devices. If you can, use a PS/2 keyboard and mouse
  2. Run msconfig.exe and chose diagnostic startup (See screenshot)
  3. Open event manager and check if there are any critical errors. Don’t worry too much about the Errors and Warnings
  4. Check for Windows disk errors: Right click on drive and select properties. Go to tools tab and click ‘Check now’ under Error-checking. See below for screenshot.

If the problem is now fixed, you can now start enabling some items on the startup.

  1. Run msconfig.exe again
  2. Select the Services tab
  3. Add all of the microsoft services and restart again.
  4. If this has not returned, keep adding 1-2 services and restart again to diagnose which is problematic

If the problem wasn’t fixed by the diagnosis startup, then it’s a driver/hardware issue. Try using to discovery which is the issue.

Shortlink

Raspberry Pi Debian Administrator (root) Password for LXDE

When trying to re-partition my SD card I fired up GParted from the LXDE menu and it asked me for the admin password. I assumed that it would be the same password that I used to login to the system when it booted; raspberry. No joy!

Assuming that it wants the root password, here’s how to change it:

  • Press Ctrl + Alt + F3 to get a new console (Press Ctrl + Alt + F2 to get back to LXDE)
  • Type: sudo passwd root
  • It will ask for YOUR (you’re currently logged in as pi) password, so give it raspberry
  • Then it asks for the new password (this is for root) twice, so put this in.

As soon as you’ve done this you can switch back to LXDE (Ctrl + Alt + F2, remember?) and enter the password you just created.

Shortlink

Getting started with the Raspberry Pi (Installing XBMC!)

A little background first.

I got my Raspberry Pi on Tuesday and I instantly wanted to get it up and running, do things that I had seen in YouTube videos, and generally have a bit of background I knew I could use when I suddenly came up with an idea or experiment. After connecting something to every available port except the composite video (I assume you have done the same and connected the Ethernet, Mouse/KB to USB, HDMI, 3.5mm audio, >2GB SD Card with the recommended Debian Squeeze distro. and the all important microUSB power) I managed to get a screen up that is almost all blank (after logging in with username: pi, password: raspberry) except for the prompt: rasp-pi:~ pi#

This isn’t as exciting as I was expecting. I remembered the download page saying that it has the LXDE window manager (lightweight X11 desktop environment) so i typed lxde and pressed tab twice (to make it suggest auto-completion) and I got given a list of commands/files that didn’t mean anything. I googled for a while before I found what I wanted; the command to start the X11 server!

startx

Once you press that, it fires up X and loads LXDE 🙂 You can open a web browser, play some games and do word processing. Keep an eye on the CPU graph in the bottom right corner to see how much its being stressed!

The friend I was with was pretty adamant that we should make progress on getting XBMC working straight away, so I researched how to get the current ARM port and install it on the system and we did it! Warning: this doesn’t do anything impressive, there aren’t any graphics drivers included in the debian distribution on the website so XBMC says something along the lines of 'There are no graphics drivers... Quitting in 5, 4, 3, 2, 1.' But perhaps this will work in the future, so here’s how to get XBMC installed on the Debian Squeeze distribution:

If you’re in LXDE already, then press CTRL + ALT + F3 (press CTRL + ALT + F2 to get back to LXDE) to get a new terminal displayed. Login and start typing the commands:

Firstly, we need to add a repository for the binaries to the sources.list (this is a debian specific thing for aptitude, the package manager) Type this in the command line and we should be good to go:

echo "deb http://www.deb-multimedia.org squeeze main non-free" >> /etc/apt/sources.list

Then we need to get hold of the GPG key for this repository so the Pi trusts it, so we do this:

wget http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2012.05.05_all.deb
dpkg -i deb-multimedia-keyring_2012.05.05_all.deb

Now we have to tell the Pi to go and have a look what’s available and updated in the whole of our system (which now includes this new repository) so type this (you should get prompted for your password, raspberry):

sudo apt-get update

If we didn’t get any errors then we are ready to install XBMC! It’s as simple as:

sudo apt-get install xbmc

It’ll do a search for what it needs and then ask you if you want to install lots of things, type Y and press enter to start the process! It took about 20 mins for me, and then goes back to the bash prompt afterwards.

Only one thing left to do! Type xbmc and press enter and fire it up!