→ The Learjet repo man

The story of Nick Popovich. The worlds super-repo man.

 

→ Google Answers: Ants in a microwave

oven.

Possibly one of the most important questions, answered.

Why don't ants die in the microwave.

 

The Internet is like alcohol in some

sense. It accentuates what you would do

anyway. If you want to be a loner, you

can be more alone. If you want to

connect, it makes it easier to connect.

- Esther Dyson

 

A simple comment build script for Xcode

If you’re a casual coder (like me), you’re code is probably plagued with loads of TODO’s or XXX comments awaiting your attention.

Here’s a small python script which you can add to the xcode build process to consolidate all your code comments into one tidy text file.

You can download it from here

And here’s a quick tutorial on how to get it up and running:

Firstly, make sure you’ve got some TODO or XXX comments in your code.

At the moment the script only looks in .h and .m files, but if you look at the script source, that’s pretty easy to change.

Next up, you’ll need to right click on your target, and select New run script build phase.

Now right click on the new build phase, and select get info.

The inspector window should present itself and you’ll need to change the shell location, and paste in the script contents as shown in the screenshot.

Now just build your application, and you should see a todo.txt file pop up in your project directory. You may want to add that to your project for easy referencing.

If we look at the contents, it should contain a reference to each file, the line number and the comment entered, grouped by TODO’s and XXX’s.

Enjoy!

Using hdiutil to resize disk images

I've been working on a small project that requires sparse disk images to be resized on the fly, although it ended being a great deal more difficult than I'd had originally hoped.

Originally I was creating disk images using the following code:

hdiutil create -size 100m -fs HFS+ -type SPARSE myImage

Which worked fine, I'd end up with a fully functional sparse image. However, when I went to resize the image using:
hdiutil resize -size 200m myImage.sparseimage

I would receive the following error:
hdiutil: resize failed - error -5341

Which was quite vague, and doesn't at all help the debug process (especially since there really hasn't been much talk of such things online).

After a few hours of tinkering around I was able to work out how to create a disk image using hdiutil and later resize it.

It seems to revolve entirely around the partition type.
After creating a few images using Disk Utility and inspecting their innards using the hdiutil imageinfo command I realized that the layout of the image determined how 'resizable' it is.

So, getting to the point, this is how you create a disk image and resize it using hdiutil:

# create a 100mb sparse disk image called myImage
hdiutil create -fs HFS+ -layout NONE -type SPARSE -size 100m myImage

The most important aspect of this command is the -layout NONE argument, it's what tells hdiutil to only create one single partition on the new image, the default is GUID (or so it seems), which creates a few different partitions which; for some reason; can't be resized.

I'm not the most savvy person in this field, so maybe someone with a greater understanding of such things could explain the reasons in greater detail

Now for the resize, this is all pretty easy, and runs just as it should:

# resize the image to 200mb
hdiutil resize -size 200m myImage.sparseimage

I haven't tinkered on the topic any further (since my requirements are now fulfilled), but I imagine there's other layout types which will allow resizing, if you work them out, be sure to let me know.

Enjoy.