Ubuntu 13.04 on a Late 2012 Mac Mini

EDIT: Tonight i’ll be picking up one of my Mac Mini’s from the Datacenter to get Ubuntu 13.04 up and running! expect a full guide with drivers here shortly 🙂

So Ubuntu 13.04 LTS recently was released, It comes with the new 3.8.0-19 upstream of the Linux Kernel so I thought I’d check it out!

Although our patched 12.04 and 12.10 Ubuntu’s use version 3.124c of the tg3 NeXtreme drivers from Broadcom which have Mac Mini support… The version in Ubuntu 13.04 (3.128c) seems to have had this removed!

A simple run of modinfo tg3 | grep 1686 reveals sadly that support for detection of the Mac Mini Ethernet hardware seems to have been removed during 3.124 and 3.128 of the Broadcom tg3 drivers.

I’m likely to install 13.04 on a Mac Mini sometime soon so will update this post with a proper howto and any good news I encounter but I don’t think its good news…

lsmod | grep Ethernet returns
01:00.0 Ethernet controller: Broadcom Corporation Device 1686 (rev 01)

whilst modinfo tg3 | grep 1686 on our modified 12.04/12.10 machines using the NeXtreme driver from this blog returns:

alias:          pci:v000014E4d00001686sv*sd*bc*sc*i*

however on 13.04 returns nothing.

 

Instantly gain insight on someone else’s iOS App Architecture with MADebugTools

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 🙂

 

 

Getting started with Mosh: the mobile shell

Mosh is something i’ve been meaning to give a go for a while now… but have never had the chance. Recently however, on a train from Rome to Florence, I got a little tired of reconnecting SSH sessions and re-attaching screen’s / tmux’s. Then I remembered… Mosh!

Some examples of why / when to use Mosh

Dubbed “the mobile shell” mosh is simple, it requires you have the mosh binaries installed on both client, and server, and that you have permission to SSH to said server (you don’t need a root account). Then mosh will create an initial SSH session, which it in-turn uses to create a UDP connectionless “session” between mosh running on the server and mosh running on the client.

Why?

Well… I can type mosh username@server.tld start a nice terminal session, close my laptop / phone, come back 4 hours later, open my laptop… and carry on. It’s also very useful for environments where your connectivity is poor or you have a dodgy ISP supplied Router that can’t sustain SSH connections very well.

$ mosh username@hostname.tld

Directly, stolen inspired from the original website. Mosh will log the user in via SSH, then start a connection on a UDP port between 60000 and 61000.

Beyond just having a really stable “connection” to a remote Terminal session. Mosh also has some quite cool features, that users of other modern shells will appreciate, such as auto complete of common commands and also a nifty indicator bar to tell you if something is up with the connection.

All in all, give mosh a go, it took me less than 120 seconds to get up and running. If you hate dead ssh sessions and can’t wait for timeouts, then what are you waiting for ;). As usual, hit me up at @italoarmstrong on twitter if you want banter.

 

All posts now have Send To Kindle functionality

Amazon recently released their “Send to Kindle” plugin, allowing users of Kindles (whether on iOS/Android or owning a physical Amazon Kindle device) can now send any post on this blog directly to their device over the air or whispernet (depending on device) without having to manually copy and paste content. A little convenience method for those who wish to read offline / on the go. For those who don’t… simply ignore it 🙂

Enjoy offline reading! (go into the posts to see “Send to Kindle” buttons

 

The __block specifier in Objective-C and Why its so mis-understood

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…

… 

 

Manage your KVM Hypervisor Remotely on your iPhone / iPad

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.

 

Why use a Mac Mini in a Datacenter environment, even without Mac OS X?

I recently changed from having Dedicated Servers to renting co-location rackspace directly in a datacenter. What this meant was that the “density” of CPU:Power ratio was important. Say for example you rent 1U of rackspace, that will come with some amount of power, measured in FLOOR(0.9*(AMPS=(WATTS / VOLTS)) during “peak” or “boot” power usage… with a total allocation of say 0.4 amps, along with bandwidth etc.

So why a Mac Mini for this purpose? Take for example a Dell Poweredge 1U Server… fits perfectly in the 1U of space provided and can consume a lot of power, 0.5+ so really, you can only squeeze 1 of these in without paying over-ages… at a push. What it does give you over a Mac Mini though, is the possibility to have 128GB RAM and 4 HDD bays in a single chassis, but at a much higher power cost. Lets take for example the Mac Mini… I’m colocating 4 Late 2012, Core i7 Mac Mini’s with 16GB RAM and 2TB hard drive space in EACH. Due to the way in which the Mac Mini was engineered, these consume around 0.19 AMPS each. Making the “density” increase, so in my 0.4 allocation, I can place 2 Mac Mini’s without incurring additional charges… thats 8 Physical Core i7 Cores… 32GB RAM and 4TB Hard drive space… in a piece of metal that is easily and readily available/replaceable and modular…

Those datacenter savvy people amoung you will now be thinking… ah, what about cooling, what about remote reboots etc… well there are solutions to all of that also, see my guide on Ubuntu 12.04 and 12.10 on a Late 2012 Mac Mini for a detailed howto.

The end result, you’re reading this blog post on a Centos VM hosted on a Debian KVM Based Hypervisor running on a Late 2012 Mac Mini! all setup and configured to be at a lower cost than any competitor and offering a really high density in a datacenter environment.

Wanna discuss, tweet me @italoarmstrong

 

How to turn off Auto Layout Automagically on Xcode 4 post iOS 6

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

 

 

New Job New Posts New Fangled Things

Well… I’ve recently resigned from a nice role I had as a Mobile Architect at a large well known online company. Moving on to being an Independent Contractor working on different kinds of Mobile Projects. What this means is I’ll have a little more freedom to write about… whatever I want! So expect some more of the usual + some interesting and intricate iOS and Android posts. Of course as always, don’t judge me too badly 😉 feel free to tweet me @italoarmstrong with any comments.

P.S. if you read a post over 1 month old… I can’t guarantee the quality of it 😉

 

Best of Gadget Show Live 2012


Last week I had the chance to take a peak at the Gadget Show Live event hosted at the NEC in Birmingham, UK. There were literally hundreds of vendors present, all showcasing their latest products and innovations; aswell as the usual suspects and big names you’d expect. Rather than bore you with a mash up of what I saw as you’ve probably seen all that over 1000 blogs.. I thought i’d post up a few photos I took at the event of various things…

Hope you enjoy them, photos after the break…

All photos (c) 2012 SuperArmstrong LTD.

…