Just a quick post to say i’ve posted my first piece of code in over 5 years to GitHub. Its a clever little Objective-C iOS Category on UIViewController that seemlessly overlays a UILabel on every single view controller managed view with the class, nib or storyboard name that is used. Great for debugging old or inherited projects with minefield architectures. It uses some cool libobjc runtime techniques to accomplish this, but implementing the category is a case of dropping it into your project and Build+Go!

Category in Action

Grab the source code here as usual, follow me @italoarmstrong on twitter :)

 

Send to Kindle
Share

I’ve seen a lot of source code recently where people are mis-using the __block “specifier” that ships with modern Objective-C runtimes. I’ve always had the opinion that if you are to use __block for an Object then you should design around it and avoid, reserving its use for primitives. Regardless of that, here is a summary of my understanding of __block to share with any other keen readers who may be interested.

__block is used as variables outside the scope of a block become readonly once inside a block. For example

int num=1;
void (^someBlock)(void) = ^{
num = 2;
};
someBlock();

Would cause a compiler error asking for the __block specifier to be used. so in this case you can try:

__block int num=1;
void (^someBlock)(void) = ^{
num = 2;
};
someBlock();

and num will contain the correct value after block execution.

Straight forward right? So what about the following example:

__block NSMutableArray *someArray = @[@"Hello",@"World"];
void (^someBlock)(void) = ^{
[someArray addObject:@"Goodbye"];
};
someBlock();

It’s wrong… you don’t need __block in this case… why? because you’re not assigning a value to the captured “variable” someArray, rather you’re just sending a message. I often see this and wonder why.

The __block specifier is actually a storage-class specifier, to give you an idea of what this means, the following are also storage-class specifiers in C. extern, typedef, static and so on.

Why don’t I like __block a great deal then? Read on for more…

Continue reading

Send to Kindle
Share

Recently I began experimenting with KVM virtualisation in the Linux Kernel. Its a great technology that if your CPU supports VT-x / AMDV offers almost (really, almost) bare metal level performance inside Virtual Machines. It works on most Linux flavours and has a couple of handy management tools such as virsh and virt-manager. However, one thing I thought was always lacking and annoying me was of course, the ability to manage my Hypervisor from my iPhone / iPad when on the move! Time for an experiment I thought; then out came “KVM Remote”

KVM Remote on the iPad and 3 Different Remote Hypervisors

Its universal so works on both the iPhone and iPad and is extremely bleeding edge right now, but works! and is incidentally the first App i’ve made that doesn’t have selfish fiscal intentions, so theres another great reason to download it from the AppStore now!

P.S. i’ll be updating it regularly adding more features as requests come in.

Send to Kindle
Share

I’m sure i’m not the only one who is annoyed at the fact that, even though my project Deployment Target is set as iOS 5.0… Xcode finds it neccesary to enable Auto Layout on all newly created XIB’s regardless… causing Runtime exceptions that can be pesky and hard to find if not testing looking. So I started thinking how to disable this once and for all…

After monitoring the state of my disk, before and after ticking the infallable box in IB, I realised that Xcode is actually using some xml files to enable/disable this feature, however, there are a few locations and its a little pesky… i’d document it all here, but I don’t have it to hand and can’t remember… so maybe later… but until then, here is a little tool I made that performs a simple regexp on some of your Xcode installation files to make sure Auto Layout is disabled :) NOTE: You’ll have to re-run this tool if you update/re-install Xcode.

Download: AutoLayoutAnnoysMe.zip

 

Send to Kindle
Share

So… some of you may have already seen this, if you didn’t then, here it is :) its pretty cool, it works… but has one caveat… Its a TEMPORARY unlock… i.e. it will unlock your phone sure, but once your TMSI (Temporary Mobile Subscriber Identity) is refreshed, you will have to repeat the process again… in the UK and US i think this happens when you switch the phone on/off or travel over a large geographic area… however it could potentially happen whenever…

Instructions on how to unlock are after the break :)

  1. Grab your iPhone
  2. Insert a supported Sim Card… so, if your phone is locked to Tmobile, put a Tmobile sim in there Continue reading
Send to Kindle
Share

Well, i know i’ve been slacking lately on this blog, but heres a lil treat, I recently got an iPad and iPhone and bla bla, and soon got very tired of converting all of my mkv and avi content over to the iPad, so I made a little tool to simplify the process, it supports as input formats pretty much everything that VLC does, including: xvid / flv / mkv / mpg etc, and outputs all files into .mp4 H264 :)

Its free to use and released under a beer-ware license… i.e. if you like it, donate me some £ for some beer :) there is a giant button in the app, you can’t miss it =). Here it is anyway: iPad Ripper

Requires: Intel Based Apple Mac running Mac OS X 10.6 or later.

Convert anything to iPad for Free

Convert anything to iPad for Free

Send to Kindle
Share

Hurricane Electric, the most reliable tunnel broker in my opinion have always provided ipv4 exhaustion statistics as found somewhere on this site! however, they’ve now launched an iPhone application and gadgets/widgets for google desktop and windows. From the email they sent me i quote:

“We have just released a free iPhone App, Webpage Widget, and
Google and Windows Desktop Gadgets that report the growth of IPv6 deployment and the exhaustion of IPv4.”

I thought it would be worth  mentioning as i know lots of readers here have iPhones :) . The iPhone App, Webpage Widget, and Desktop Gadgets are available at:
http://ipv6.he.net/statistics

Send to Kindle
Share