Stack Apps – StackProfiler

I’ve been looking into the 2.2 API for StackExchange and it’s a pleasure to use with the exception of one thing. Once you have identified a user whose content you are interested in you can get their network user_id from just about any query made about that user. If that’s the one thing you save then the network-wide /users/{ids}/associated query can get you the sites the user is active on, and that opens up the rich set of queries that require the site argument. But the associated query returns only the URL for the sites (”), and the screen name of the sites (“Stack Overflow”), not the canonical site identifier (“stackoverflow”)! I think there must be a filter or something I have missed, it is the only time I have had to mess around with strings in all the queries I have done in developing this app today, and I have run out of request quota. For now I am getting around it by splitting the URL and using everything after “//” – the documentation says “” is just as good as “stack overflow” in the site argument and it does work. But this does seem like a big oversight in what is otherwise a fantastic API.

Another thing worth mentioning is how easy this is in iOS in 2015. With Swift and NSMutableURLRequest it all just works, asynchronously, no need for any external libraries. As recently as last year I wouldn’t have even thought of doing something like this without first grabbing AFNetworking.

2014 Mac mini – adding a hard drive to a SSD model

November 16, great excitement! New stuff from Apple, including a Mac mini – sadly not quite as I had hoped but good enough. Our old mini is a 2009 white top model, Intel, but definitely showing its age. A SSD helped but it wasn’t really keeping up especially with kids in the house who leave Flash games running in the background.

The amount of anger about soldered RAM was fairly predictable. It’s easier for a lot of people to believe that this is some kind of Apple plot to overcharge for RAM than it is to think about the actual cost of two SODIMM sockets in every machine, no matter how many people never upgrade – so that’s what people did. I just bought the 16GB. Every mini I have owned has ended up with maxed RAM and storage and as I hope to get 5 years out of this one too I also upgraded to i7 3.0GHz – this is the machine that does the most video en/recoding.

HD5000 graphics is a huge bonus – many think integrated graphics is still at the level of GMA650, i.e. terrible. I spent the last year with a MacBook Air 11″ with the same graphics and was able to play Diablo III, Starcraft II, L4D2, run various 3D CAD programs, no problems. So even though that isn’t the main purpose of this machine it’s nice to have it.

Storage was the final consideration. I thought a lot about the 1TB Fusion option but ultimately decided I would rather have a better SSD as boot drive with a much larger SATA drive as bulk storage. So I bought the 256GB PCIe-based Flash Storage option and expected to slot in a big SATA drive at my convenience, while using an external 3TB drive right away.

Then I decided to open it up and take a look. I needed my Torx T6 Security bit. There was some whining about this tool being rare or difficult to find, from various sources including iFixit, but it seems to have dried up now iFixit sell this tool. I’ve had mine (part of a set) for years.

The bad news is that the SATA cable is not included in minis fitted with only a PCIe drive. The PCIe SSD cable is not included with models containing only a SATA drive. The Fusion drive models will include both (but how useful is a 128GB SSD? Or 1TB SATA?) I think the PCIe model is the one to buy – I would have liked the 1TB SSD, but if money was unlimited I would be buying a Pro. Probably OWC and others will be offering these PCIe storage blades just as they did for the MacBook Airs.

I bought the  (This kit does NOT include the Torx T6 Security. That’s and set to installing a 2TB Samsung drive (ST2000LM003 HN-M201RAD) extracted from a Seagate Backup Plus Slim Portable Drive. In Australia at least it’s cheaper to buy the complete external 2TB than a bare drive.

Driver carrier before fitting SATA hard drive

Driver carrier before fitting SATA hard drive

This is the mini with the main assembly removed, power supply and drive carrier remaining. Here’s how it looks before the SATA drive and cable are installed. You can see the PCIe cable ready to plug into the mini’s main board but there’s no SATA cable.

Apple grommets have a large hole, iFixits are smaller.

Apple grommets have a large hole, iFixits are smaller.

The iFixit kit includes hex-head grub screws and a set of four grommets. These grommets are a neat fit for the grub screws and they should replace the four original Apple grommets which have a larger hole. With the drive in place it is easy to insert each of the grub screws and secure the drive. If you’re too lazy to find a hex key for this, the T6 Torx bit fits just fine. Don’t tension them too much if you do this or you will ruin the Torx bit.

2.5" HD mounted, ready to reassemble.

2.5″ HD mounted, ready to reassemble.

With the drive installed you can see the SATA connector ready to connect to the main assembly on the left, with the power supply connector in the middle and the PCIe connector at right.

Putting everything together you will notice that while the PCIe connector has a cover secured by two screws to hold it in place, the SATA connector does not. There is a screw hole to the side of it so probably if there is ever an Apple upgrade kit there will be a similar cover in it… It would be easy to make one but in my stock of screws stripped out of of MacBooks and the like I did not have one small enough, so I left it. A bit of Kapton tape would be an OK solution. Or if your mini doesn’t get bumped around it shouldn’t fall out anyway.

The internal 2TB drive as reported by "About This Mac"

The internal 2TB drive as reported by “About This Mac”

Here’s the result – some of the drive is used because I’ve started copying over the media library. The 3TB Seagate Desktop drive can stay as a backup for most of this stuff, but now can be moved over the the USB slot on the Airport to act as a remote bulk store. Job done! At least until 2TB PCIe SSD modules are cheap enough.

Waiting for couriers…

The couriers lurk in courier central, telling tales of deliveries missed and hearts broken. Regaling themselves on sweet, sweet tears, they laugh at stories of doorknocks followed by hasty getaways. They smirk as old, grizzled couriers teach how to break contents without damaging packaging – much as a senior sergeant might instruct a probationary constable in the art of the phone book interrogation. They leave this happy place only when reliably informed their recipients have left their homes – or are at the very least in the shower.

Pedals that Bite

Nice pedal. Shame about the knife edges!

Nice pedal. Shame about the knife edges!

I bought Shimano XC Race Pedals (Grey) when I found them cheap on Wiggle, as my older SPD pedals were creaking. I hate noise when I ride. The XTR pedals look great, notice the milled surface just above the logo? Better shoe-pedal engagement says Shimano. But there lies the problem.


Pedal Wound!

Pedal Wound!

The edges of these pedals are sharp! I wrote about this in a review on Wiggle but they didn’t publish it – why would they publish an honest review that doesn’t help sell pedals? They work fine so I’m not returning them, I just need to get around to Dremeling those edges to make them less like James Bond’s DB5 tire shredders.

Aston Marton DB5 Optional Equipment

Aston Marton DB5 Optional Equipment

Knog Blinder Road 3: Not Impressed

I was in the bike shop for no good reason other than there was a bike shop in my way, and this light caught my eye. It’s a Knog Blinder Road 3 – neat little package with a very bright light that looked great in the shop. Australian company too. My riding has been frequent enough that I felt OK spending another hundred-odd on lights, so I bought this and a matching rear light, a Blinder 4V.
At first glance the Blinder Road 3 is a neat design – a rechargeable light with a fold-out USB connector built in! Except that the curvature of the light’s mount and the position of the USB connector is such that it can’t plug directly into anything much, so a short USB extender cable is provided. And this connector is positioned under the mount, so the light has to come right off the bike for it to be charged. That’s strike 1.
Next the mount itself. It’s a stretchy silicon strap that has a hook and lever design, the lever meets with the strap behind whichever bar you are going to attach the light to and then is folded back flat against the bar. Just like a guitar case’s latch. That’s fine, except that my bars are a bit thin, so the stretch wasn’t tight enough to stop the light from drooping after bumps. (Perhaps this was not an issue with the lighter-in-front Blinder Road 2) I padded it with some rubber, but then the latch wouldn’t stay shut.
One morning I noticed the latch wasn’t shut as I rolled down the bike path. I tried to grab it, but my gloved hands were a bit clumsy and soon it was bouncing down the road. It didn’t break but did get scratched up. That’s strike 2.

Probably seemed like a good idea at the time...

Probably seemed like a good idea at the time…

Two buttons control the light. One selects the mode of the light and the other toggles a high beam mode, so whichever mode you are in it can get a lot brighter – in high beam, the green indicator light turns blue. A long press on the mode button turns the light on and another turns it off. A short press switches between the modes. Time your press wrong and it does the wrong thing, and the buttons are very small and hard to press in gloves. I’m not sure why there is a high beam button since it is all but impossible to find while riding. That’s strike 3.
I wish I had not spent the money to find out about the Knog Blinder Road 3, I am back to using the Moon X Power 500.

Moon X Power 500, detached from mount.

Moon X Power 500, detached from mount.

The Moon light has a mount that attaches securely to the bike, then the light slides off for charging via a mini-USB connector. It has one button that is large enough to press while wearing gloves, though even larger would be good in winter. It seems as bright or better than the Knog light but I admit I have not tested them objectively. My only big complaint is that it doesn’t use a stainless bolt in its mount, so I found it had rusted somewhat as I took it off after 6 months, but grease on the thread made it better and should keep it from rusting further.

Knog Blinder Road Rear

Knog Blinder R

I am less disappointed in the Blinder R rear light, it is still on my bike. Apparently my seat post is just the right diameter for the mount to work, and since there is only one button (and choosing the right mode is far less critical) I can live with it – but it’s still too small and in an awkward place. I expect I’ll go back to using the Tioga Dual Eyes once the power runs out since the hidden USB plug is still a problem on the Blinder 4. Weeks have passed and it’s still going strong so I have to give it some credit for battery capacity.
Final note – if you ride with a high-powered front light on your bike, point the beam down at the ground a few metres in front of your bike. Don’t blind everyone coming the other way – and that means don’t stick a high-powered light on your helmet, blinding everyone you look at. Thanks.

The Next Mac mini

I love the Mac mini. In 2005, after the WWDC keynote, I couldn’t order one fast enough. When I opened one up and found it used a laptop-sized IDE connector, inspiration struck – I built a tiny PCB with a female 2.5″ drive connector and a male 3.5″ drive connector, allowing use of a cable to connect a full-sized drive (with its own power supply) for better speed and higher capcity. I made and sold hundreds of those little boards, it was my 15 minutes of internet fame.
Over the years I have had several minis. Early on there were two G4s, both with the larger drive modification. After the switch to Intel I’ve owned at least three or four. Most of my iOS programming has been on a mini. Right now the family still uses a late 2009 2.26GHz with maxed RAM and a OWC Data Doubler allowing an extra drive internally.
The little 2009 mini still chugs along. It gets a real workout from kids playing Flash games, serves music and video around the house and even gets used for Xcode sometimes. My main workhorse now is an 11″ MacBook Air 6,1. The Air is almost perfect – surprisingly fast, and 8GB RAM hasn’t been the compromise I thought it would be – but it isn’t quite portable enough. When I bicycle to work I wish it was smaller because I rarely use the screen or keyboard, I plug it in to a monitor at both ends of the trip.
There is no question that this, the smallest of Apple’s laptops, is far more capable than the 2009 mini and it’s comparable in performance to a current mini – because the Mac mini has always been basically a headless laptop. In 2009 this was a performance problem since laptop performance lagged far behind desktops. Thes days, not so much.
So what could a new Mac mini look like? Like this:hero_macpro
…but smaller. Inside the Mac Pro is a central triangular heatsink extrusion around which the two GPU cards and CPU card are arranged. A mini only needs a single board containing a CPU with integrated graphics. Sometimes I want discrete graphics but the Air’s HD Graphics 5000 graphics is adequate, I play Diablo III on it. It won’t be good enough for Star Citizen or Day Z on a big screen but no mini ever has been. It will be the usual choice, Core i5 at the bottom end, Core i7 with more cores at the top. I don’t think ARM is at all likely this iteration.
Overall size is probably dictated by the drive, assuming the mini doesn’t get PCIe-based flash like the Pro. If it did, how small could it get? Probably smaller than industrial designers would consider ideal. With SSD the machine would need to be built around a cylinder capable of accepting 2.5″ drives vertically. It could have a small door on the bottom allowing this drive to be replaced by the user, or the cylinder could lift off as it does on the Mac Pro to allowing access to memory modules. I’m not sure if soldered-on RAM is the future of Apple and it doesn’t bother me much but I would like a next generation machine to have a 16GB RAM option.
Cooling would be just like the Mac Pro, an aluminium extrusion to which the hot components are thermally coupled. A fan of similar design to the Mac Pro’s could cool the machine if necessary but with the opportunity for a bulky heatsink and adequate convection it would rarely activate.
So what connectors would you expect to find on the back? Two Thunderbolt connectors. Four USB, headphone/line out and microphone. And MagSafe.
Using MagSafe to power the mini would take a bulky component out of the machine. Thunderbolt Display users don’t need a power supply since the display already has one – making the display an even more attractive accessory. Everyone else could use an adapter, just like laptop users do.
MagSafe can disconnect, that’s true – in practise it doesn’t unless you make it, and I don’t believe it would be a problem in a situation where the mini sits on the desk and the cable is routed away from hands and feet. If it did get yanked I think I would rather have it disconnect and the Mac lose power than for it go go flying. But what if a small battery were included giving the mini built-in UPS functionality, just like a laptop? It could be just enough for the mini to safely suspend to disk.
Not Ethernet – I got over my distrust of WiFi and it is perfectly adequate for this kind of machine. If you must have Ethernet then buy the Thunderbolt adapter.
Not HDMI – minis aren’t for driving TVs or projectors. For Apple TV and larger laptops it makes sense. If you need it buy the Thunderbolt adapter.
That’s the mini I want, and what I hope is announced at WWDC. If they do I bet they put it in on-screen and let everyone assume they are seeing a Mac Pro before pulling back to reveal the Mac Pro sitting next to it.

Pneumonia and Pleurisy

From about mid-January this year I have been sick. It started out as a cold and moved around the body, one week just a persistent cough and the next it was sinus congestion and pressure. Then an earache, then back to the chest and around again. I didn’t go to the doctor – my doctor doesn’t give out antibiotics for this kind of thing because it has no effect on the viral cause. Why pay for a consultation when only your own body can sort it out?
I nearly got better several times but each time I would feel good, do a day in the garden and get tired, then be back to square one the next day. Total rest would have been great but when you are responsible for taking care of the house it isn’t always an option. Everyone at work more or less got used to me coughing. People warned me I would get pneumonia if this continued but I didn’t take that very seriously, only old people get that.
Then last Wednesday I woke up and just couldn’t go to work. The dreams are strange with a fever. I have industrial-themed dreams where some process or operation is repeating with great noise and huge scale. I couldn’t balance and it was an effort just to get in the shower. The doctor said I probably had pneumonia and gave me Roxythromycin to take. Feeling as sick as I did I took it seriously and stayed in bed after that, only sleeping and watching TV. No internet. My birthday came and went and I didn’t want to know, I couldn’t eat or even talk much.
That Sunday evening my parents came to visit and I got out of bed. I didn’t think I was shaking that much but apparently I was shivering, so I was taken off to a weekend clinic where the doctor said to head straight for hospital. At Cabrini Private they didn’t take too long to see me but then I was stuck in the ER cubicle for a few hours before moving to a ward. While there I had a cannula inserted into my hand and started the antibiotics.
That night was about the worst fever I have ever experienced. Twice I woke on the ward and had to ask for a new gown and new sheets. My head was like a fountain of sweat. Strange dreams again, of people who ran across a huge grid as living pointers to data in some huge machine my brain never came up with a purpose for.
First thing in the morning the nurses made me get out of bed and sit up in a big chair, they even had me walking around the ward pushing my IV pump ahead of me. What I didn’t know was that lying down is a bad thing for pneumonia, but I had been doing it for days. Maybe if my GP had told me that I would have made a recovery without going to hospital?
The IV drugs sorted out the infection very quickly. Each day I had the same thing, a large syringe of a yellow antibiotic pushed straight into the cannula and a bag of clear antibiotic through the IV pump. I don’t think my bacteria was cultured and identified as the infection responded well to these broad-spectrum drugs. On Monday I felt extremely rough, on Tuesday I was a lot better and thinking about home, on Wednesday I was ready to leave. On Wednesday I did go home with a ten-day course of two kinds of oral antibiotics – I can’t even have beer until that’s all over.
There’s no sleep in hospital unless you have a private room and even then a nurse will be in to do observations every couple of hours. I was in a four-bed ward as I have been on nearly every other hospital visit. The other guys were about thirty years older than me and while nobody snored everyone had IV pumps that had alarms ringing every hour or so, lights are on and off all the time, and on one bad night the man next to me had chest pains resulting in visits from five doctors in the small hours of the night. I knew I was going to get better but they didn’t necessarily. I never felt like I wasn’t going to come out of there but I did come away with an appreciation of how fragile we are, I would not have had to be much sicker to be very seriously worried.
At home my lungs have felt clear and I have had no fever, but pleurisy is ongoing and is perhaps worse than the pneumonia. The pleura is the lining surrounding the lungs and when it becomes inflamed that’s pleurisy, a common counterpart to pneumonia. The best way I can describe it is that when you breathe it feels like being stabbed. The worst pains have been with the sudden intake of breath that comes with yawning. It means I can’t lie on my side at the moment and I have to take Ibuprofen regularly. It does cut the pain a little but more importantly will clear up the inflammation, paracetemol + codeine is masking the pain so I can sleep.
My fitness is very low now. Lung capacity is reduced following pneumonia and it will take months to get back to the point where I can ride the round 30km to work each day. Just walking around the house sees me out of breath and sweating, but that’s what I have to keep doing to build up fitness again. This Tuesday back at work I’ll need to walk a few city blocks and I’m going to have to take that very easy.
Financially it wasn’t pleasant. The ER doctor sent a bill for several hundred dollars for an “extended consutation”. I talked to him for five minutes total. I heard him talking to the specialist about me for five mintes too, he must have spent a lot of time on me I don’t know about. Each day in the hospital cost hundreds. The medicine cost more hundreds. The lung specialist hasn’t sent his bill yet but I don’t expect it to be small. On top of all that I’m out of sick leave, so no pay either.
What are the lessons from this?

  • Don’t push yourself too hard when sick, nothing beats rest.
  • I was right not to see a doctor until the fever hit, they all said they could not have helped.
  • if you get pneumonia you sit up, you don’t lie down or sleep all day.
  • you can’t possibly thank nurses enough. They get paid far too little.
  • while this was expensive it would have been orders of magnitude higher in a country without universal health care. Look after Medicare, be proud of it.
  • Next time I’m going to a public hospital. I’ve got no reason to think the staff will be any different and my health insurance covers so little as to be useless – its only purpose is to avoid the extra tax imposed on anyone without private health insurance. John Howard introduced this to prop up the failing private health insurance industry years ago. Of course private health premiums rose by just a little less than the tax penalty very soon after he did that.

Rocksmith 2014 Guitar Package

In December this year I heard about Rocksmith 2014. Sounded good, but then I found it was Mac-compatible and it got upgraded to must-have. Steam got it installed with no fuss, an eBay seller provided the cable and it was ready to go. The cable is essential – Rocksmith will not work with other guitar-USB adapters, though GarageBand can get a low signal from the Rocksmith cable. There’s the famous Ubisoft DRM, I guess.

The voice of Rocksmith sounds like you would expect given a voice actor and a brief to sound like a Rock Dude (searched, but can’t find his name). He guides you through the intro sequence, asks you to identify the headstock and to calibrate the level coming from your guitar. Once that is done you can get right into “Learn a Song”, though new players can use the lessons, from basics like “holding a pick” up to stuff I have yet to learn. From the start, little tasks keep popping up to keep you moving along (same as starting a new World of Warcraft toon) and if you just stick to one song it will remind you to try something else, or do a lesson or play a game.

Small annoyance: “Log in to UPLAY” pops up every time you switch users and I don’t want an account with them. That means hitting ESC twice each time and when you play alternate songs with someone else, switching users each time, that’s a lot of ESC. I play without logging in and I might miss out on an “exclusive” song but the are plenty left.

I’ve spent almost all my time in Learn a Song with brief Guitarcade sessions. The games are OK but I don’t much care for the 8-bit look even though it’s what I grew up on. I did some lessons and liked the interaction – you try out the idea about halfway through most lessons, then you get a practise track. You can repeat the practise track until you get 100% accuracy or until you quit out.

The repeating is what really makes this system work. As you start on a new song it starts out very easy and your rating is 0%. As you hit each note the system detects that you’re doing OK and makes things harder for you, adding notes or switching simple note for chords or adding variations like bends or mutes. Each time you finish the song you get graded on accuracy and difficulty and your song score goes up if you have done well enough.

My Blitzkrieg Bop is at 108%, so there’s some strange math going on there. What this shows is that you don’t have to be perfect to get to 100% because even with that 108% I know I’m not playing perfectly. Losing My Religion is at about 70%. Detection is accurate though, in the R.E.M. track there are parts switching quickly from an Em chord to an F# note and it will get me evry time if I miss, same with the mandolin sections. Rocksmith is tough but fair and will definitely make you play better if you put in the time. If those songs sound too easy check out the songlist, if there are no challenges left then my hat is off to you.

Riff repeat is a great feature to stretch out any part of the (or the whole) song without altering the pitch so you can get tricky sections down without feeling like it is impossible. You still play in strict time, you just get to vary that time. And I feel this is another huge Rocksmith advantage when you are learning – the tempo is the tempo and if you miss, you miss. With tab you can learn a song incorrectly because you always take just a bit longer to get your fingers in position on hard parts. Who has the discipline to practise with a metronome?

I play a lot with my son who is ten and has been having weekly lessons for a year. While the songs he is learning are nothing like what he does in lessons the overall guitar experience (string and note positioning, finger strength and stretch etc.) have obvious benefits. I can’t think of this as a game is that it’s something that’s just fun, it is one of those rare things that is in no way bad to do and it’s still a lot of fun.

Now we’re on summer holiday for a few weeks and the thought of leaving Rocksmith behind wasn’t a happy one. With budget airline tickets carrying a guitar wasn’t an option even if the risk of damage was acceptable. Why not buy another guitar! I read a couple of reviews saying that the included guitar was OK so decided to give it a shot. Of course there were people who said it was garbage but you can take any kind of guitar and someone will hate it.

The Guitar

This is the main point of the post, so you can decide whether you want this guitar or not. I couldn’t find much information about it before committing to buy so I hope this helps you.

A bit of background is in order. You’ll want to know whether I am at all qualified to have an opinion on this which is fair enough. I’ve had guitars for about twenty years, acoustic and electric. Currently I have a Chapman ML-1, a Korean Epiphone Les Paul from around 1997, a Heritage “Class of 59″ (similar to model H 157 in Korina, an Ed Roman special – opinions vary!), a Maton EM100 and a Maton EML6. They range from OK to excellent; the point is not to brag but to show my frame of reference for writing about the included guitar in the Rocksmith package. I’ve built a Tele-style guitar with a Stew-Mac neck also, and done a lot of minor repairs so am familiar with how these things are put together.

front of headstock

The guitar is the usual shape with the big “Junior MODEL” label on the headstock in the same style as all the Les Paul models and it is the usual Les Paul dimensions. Just to be sure you know what you have the truss rod cover has “Les Paul JUNIOR” on it.

back of headstock

Paint is a very glossy black and from the rounded edges on the headstock it looks to be a very thick coat of paint. Tuners are a generic Grover-style and they work well enough, no slop in the mechanism and they have the usual screw to tighten up. The nut is big and chunky and the slots are varying quality – some deep, some shallower but not too sloppy. I’ll be making and fitting another nut if I ever take this back home but the plan is to leave it here for the next visit. The “Made in China” sticker, QC, recycle sticker and serial number are found hereabouts.

closeup of nut slots

The neck is a very similar profile to my other two LP shaped axes, nothing to complain about. Fret wire is nicely finished and well polished. Slots are cut and wire is trimmed so the edges are not visible from the side of the neck. Markers are simple pearly dots, small dots on the player’s side of the neck.

Neck meets body

Heading down to the body itself the neck attachment is by bolt and big square plate, very Fender! There’s no angle relative to the body like most Gibson/Epi guitars with a set neck. The fretboard continues with a small gap over the body, overlapping the 3-ply pickguard, and is chopped off about one fret’s space away from the 22nd fret.

neck bolts & plate

The pickup is an uncased humbucker and it is black and it works. Can’t say much more about it than that with no other guitars and no amps here to compare it to. The surround is cream plastic and it is really cheap and lightweight, chrome would look a lot nicer and it would be easy to replace – could have added a dollar to the build cost though.

one humbucking pickup

The bridge is a one piece mounted on two large screws with intonation ridges cast into the top. The strings pass through the center of the bar and wrap over, the assembly is not unlike the regular LP tail piece except that there is no extra piece between this and the pickups. Because there is only one pickup there is no need for a switch or extra control knobs. Only two knobs decorate the front of the instrument in the familar transparent “speed knob” style. The top is flat and the Fender-like three-ply pickguard covers a large area.

guitar body

In the first session with this guitar I noticed the action was really high. So much so that on the high strings I’d think I was about to hit the ‘e’ string and find the ‘B’ in the way. Without any tools I could not do much about it except screw the bridge down further until the ‘E’ just started to buzz, then back it off a little. It is playable but I think a new nut could help a lot.

Back of guitar

Here’s the bottom line on the package including the guitar: this is incredible value. As above, it’s a good guitar for the money and if you are learning you absolutely do not need anything better. You get a lead which is not covered in fancy vintage woven cloth but it does work. You get a strap and two picks, which are nice if you have none but they are pretty much junk. Two Allen keys – no word of explanation, what’s a beginner to think they are for? Best to leave them out in a package like this. You get a Rocksmith cable, and you get a disc with the game. I needed an extra cable so my son and I can play together and I’ll sell the PS3 game disc alone, so the guitar probably cost around $160 Australian in the end, not bad at all. There are much worse guitars for that money.

Front of guitar

I’m playing on a Mac, an i7 2013 11″ MacBook Air to be exact. Sometimes I play on a 27″ monitor and sometimes not. It will install and run on the Late 2009 Mac mini (2.26GHz, GeForce 9400M) but is not playable – video features can be turned to make it acceptable but too many notes aren’t detected, the old mini just can’t keep up. It is also available for PC, for PS3 and for XBox 360. I’m told by friends that have consoles that you cannot run PS3 games on a PS4 and you can’t run XBox 360 games on XBox One so if you just bought the latest console hopefully they will release a version for you.

This “game” is amazing and has done more for my playing in a month than years of downloading tabs and wasting money on gear I didn’t needed ever would have. The guitar is a testament to repeatable CNC manufacturing in volume and before you sneer at such a cheap instrument, try one out. I wouldn’t hesitate to recommend the package to anyone who wants to go a long way in guitar for relatively little money. Smart marketing too, I know one person who went out and spent $3000+ on a nice new Gibson a couple of weeks after buying Rocksmith. No doubt I’ll be spending money on DLC, even more when the Steam issue that stops you buying Rocksmith 1 DLC is fixed – they are compatible but right now Steam requires you to buy Rocksmith 1 before buying DLC for Rocksmith 2014. Now I’m going to go play it again.

Continuous Integration with Jenkins and Xcode

Last week (15 November 2012) I gave a short talk on setting up a continuous integration environment with Jenkins at Melbourne Cocoaheads. This is pretty much the content, converted into a blog post. Some said afterwards they would like more detail on various parts, so here is the whole thing with the shell script at the end. I hope you find it useful. I have to give a lot of thanks to all the other bloggers who wrote about their own experiences in doing this and to Stack Overflow.
First up, why would you do this? There are two big problems that this setup solves. First and most broadly speaking, continuous integration solves the problem of a broken build where nobody really knows how it got broken, which change broke it or how long it has been like that. If you let your project get into that state then it will be a miracle if you ever deliver anything, dealing with this issue is a huge part of success when working in a team. Because the build is performed every time anyone submits to the repository you will know right away that there is a problem and you can fix it right away. You can also apply some appropriate penalty to the person that did it – they can buy the team a coffee or something, pour encourager les autres1.

Secondly and more closely tied in with iOS development is that you can have your automated build sign and deploy a build so that anyone can point their iOS device at your distribution server with mobile Safari and have it install your build using Over The Air (OTA) provisioning. This is a feature of iOS available since release 4. You, the developer, will no longer have to deal with Important People tapping you on the shoulder asking for a build – you can direct them to your server. Remote testers can easily grab a build too.

There are some services that do this for you. Two I know of are Hockey and Testflight but this article deals with neither. They work well and provide a lot of extra features, particularly around bug and tester management, but it’s good to know what’s going on underneath. When you’ve done this setup you may choose to move on to one of those services for those extra features.

Build on Success
Before getting started with this process, make sure you can do a successful Archive build in your regular work environment. If you can’t then it isn’t going to be any easier attempting to do it headless and automatically. That means all private keys, developer certificates, provisioning profiles and Xcode functioning together happily – sometimes this is not a trivial task. As a little refresher, here’s how all the developer pieces come together in code signing.
Provisioning Ingredients diagram created in Core Data model editor
Virtually Risk-Free
Having configured Jenkins and OTA provisioning once or twice before I hesitated to install Jenkins and jump into command line changes on the machine I work on every day. Instead I installed a clean install of OS X 10.8 (Mountain Lion) using VMware Fusion, version 4.1.4 – couldn’t be easier. OS X came from the Mac App Store, the .dmg was converted to a CDR and VMware treated it as a boot CD. According to the Mac OS X 10.8.2 EULA, you are licensed to do this if you bought your copy from the Mac App Store2.

In addition to not potentially screwing up the machine on which you earn a living, virtualisation allows you to make a snapshot of your Virtual Machine (VM) – a saved game, if you like. Any time you know you have got something right you can pause the machine and take another snapshot. Any time things go badly wrong you can revert. The cost of this is nothing but disk space.
First up, the new VM needs Xcode installed. When done it is a good idea to license Xcode for all the users on the machine using the terminal:
sudo xcodebuild -license
The reason for this is that your build system will not be interactive, it can’t pop up the click-to-accept license dialog. About 7,109 presses of the space bar will be required before you can type “agree” to accept the license for all users on the system. I would never advocate using ‘G’ to make less skip straight to the end of the license agreement, you should read it all. (This is the first of many useful bits of information from an excellent session from WWDC 2012, hereafter simply called “404″3)

Next up, java. Theoretically java should be installed for you automatically when Jenkins tries to start. Once I installed Jenkins and it did not start, reason unknown. Now I type “java” at the command prompt and cause it to be installed before installing Jenkins. This will download and install java from the Mac App Store, nice and easy.
Before installing Jenkins I like to create the “jenkins” user. If you install Jenkins first the user is created but not as a regular, interactive user. Creating the user will make it easier to deal with some keychain operations later. You can create this user in the normal way with System Preferences. I made “jenkins” an administrator but it probably does not have to be.
Finally, time to install Jenkins itself. Because of my VM strategy I downloaded the Jenkins package on the host machine then copied it into the VM via a shared folder. If things go wrong this will save you from having to download it again. The Jenkins installer is fairly simple and nothing needs to be changed though you might want to look at the customize button to check that settings have not changed since I wrote this. Jenkins should be made to run as “jenkins”, the user you just created.
Following a successful Jenkins installation the Jenkins console should pop up in your browser – but this isn’t successful just yet. As of version 1.489, Jenkins includes a property list that must be edited first. At the console,
sudo launctl unload /Library/LoadDaemons/org.jenkins-ci.plist
then edit it to point to user “jenkins” actual home folder, (/Users/jenkins) and
sudo launctl load /Library/LoadDaemons/org.jenkins-ci.plist
Jenkins home page
Jenkins is now configured to load when the system starts and should be running! If you launch a browser and enter you should see the Jenkins console, ready to go to work.
In your clean system + Xcode you have git installed, but Jenkins can’t find it yet. You need to go to “Manage Jenkins” and specify the path. That path will be
Jenkins supports SVN as installed, but I’m using git. For git users, you will want to install the Jenkins Git plugin. Github users will also want to install GitHub and GitHub API plugins. The way Jenkins uses git is to clone the repository you want to build before each build commences. I guess you could do this with a simple copy or ftp also, but I hope you are using some kind of revision control.
Before configuring the Jenkins build job, user “jenkins” needs a bit of setup. In your day-to-day environment, the one where you can successfully build an Archive of your project for distribution – remember that “Build on Success” section? – you have a keychain containing your developer credentials, and “jenkins” does not. You need to export them and then import them into a keychain for jenkins to use during the build. Your private key and your distribution certificate are required to make an OTA build, so export those and transfer them into the jenkins account using your public folder or similar.
A note about privacy – your private key is private, and important. Don’t leave it in your public folder. There is discussion on StackOverflow about how sharing a key like this is actually a bad idea, but I don’t know how to do it better.
Switch to the jenkins account and it’s time for some terminal magic:
security create-keychain -p jenkins JenkinsCI
security default-keychain -s JenkinsCI
security import -k JenkinsCI -P security import -k JenkinsCI
These commands create a new keychain named “JenkinsCI”, set it to be the default keychain, and then import the private key and distribution certificate you have transferred in to this account. The password “jenkins” is used throughout. During the build these assets will be used to sign the code with your developer credentials.
The provisioning profile is the last developer artefact needed. In your own account you will find it in ~/Library/MobileDevice/Provisioning Profiles, where Xcode puts it. You might choose to put that in the same place in the jenkins account, or you might choose to check it in with the code in the repository. Either way it must be available during the final stage of the build.
Now the configuration of the Jenkins job can begin. Each job in Jenkins is a series of steps that you define to produce some useful outcome. Here the outcome is a downloadable, installable iOS package on an accessible web server. Start by clicking “New Job” in the Jenkins console.
New Job
This job is configured as a “Free-style software project”. A Multi-configuration project is shown in 4043 but this is only slightly different, a little simpler. There are six main phases to configure and once you have chosen a name for this job you are done with stage one. It remains to fetch code from the repository, build it, sign it and upload it. Finally you will set up when the job will execute.
Assuming you are a git user, in the Source Code Management section of job configuration you can just select git and then enter the repo location, such as[GitHub account]/[Project Name].git/ – on every project in your GitHub repository you will find the clone path at the top of the repo page. If your repos are not public you will need to deal with creating an ssh key for your jenkins user in your GitHub account– or use HTTPS, or any method that works your your repo. At the start of every job execution Jenkins will clone the entire git repository and use it for the build.

At this point it is time to be sure that jenkins has access to the keychain created for this build. In the Build section of job configuration you need to add a build step, “Execute shell”. You’ll get a window that accepts shell commands which will be run. The first command to enter is
security unlock-keychain -p jenkins JenkinsCI
As you might guess this unlocks the keychain, allowing the rest of the script access to developer artefacts as required.
In this script one very important variable set for you here is $WORKSPACE – it is set by Jenkins and is your pointer into the place where everything happens. It is used many times in the build commands.
Before building with Xcode in Jenkins, another important variable should be set. The xcode-select command sets the default installation of Xcode that will be used. The DEVELOPER_DIR variable can override xcode-select, so it is a good idea to be sure it is set to the right value before proceeding even though in this case there is only one Xcode installed. In future you might lift this script to run on some machine with more than one.
The build itself is deceptively simple:
xcodebuild \
-project [Project Name].xcodeproj \
-target [Target Name] \
-configuration Release \
-sdk iphoneos \

The command xcodebuild is the main command used to execute builds from the command line with Xcode. My project is a project rather than a workspace, so I am specifying the .xcodeproj rather than the .workspace here. The target is the target name as you would see it in Xcode. The configuration is Release (but it could be Debug) and the sdk is iPhone rather than simulator.
Initially I had a command that looked a lot more like what is presented in 4043 but I got an error message that indicated the code signing identity was not set. Why this happened I do not know, but specifying the code signing identity, like
SIGNING_IDENTITY="iPhone Distribution: [Developer Name]" fixed it. Now Xcode is building your code.
When the build has finished you have a .app file, which isn’t very useful. Because it is built for the iphoneos sdk it doesn’t run on the simulator and because it isn’t signed it doesn’t run on a device. Let’s sign it.
The other command used with Xcode on the command line is xcrun – it is a two-phase thing, finding and then executing commands included with the Xcode distribution. To sign, xcrun is using a perl script included with Xcode called PackageApplication.
xcrun -sdk iphoneos PackageApplication \
-o "${WORKSPACE}/[Target Name].ipa" \
-verbose "${WORKSPACE}/build/Release-iphoneos/[Target Name].app" \

It can take a lot of options. The ones I found necessary are the output, where you specify where the .ipa archive will be place. The input, which is the .app built in the xcodebuild stage. The signing identity, also the same as the xcodebuild stage. Finally the provisioning profile, which you may have copied into the jenkins account or you may have committed with your code.
At this stage you may get an error – I did. Some searching revealed the cause of the error is a misconfigured Xcode installation, a soft link that should be present is not. The message is “Object file format invalid or unsuitable” which may lead you to think that the failure has something to do with the object file format. Bad error message!

It is fixed with this variable set in the script:
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
Then – happiness. You should see “Finished: SUCCESS” in the Jenkins console output, and if you have been executing the job along with the description then the ball will be blue.
After all that, OTA deployment is easy. There are three parts necessary before you can get a successful download to a device. The html, which must include a link with the itms-services:scheme, linking to the property list; the property list, which must contain the location of the IPA archive created in the Sign phase; and the IPA archive itself, the payload. If all these things are together on an accessible web server, a device whose UDID is included in the provisioning profile will be able to install the app. While you have created the IPA with this process you will probably create the html and plist manually and commit it to the source repository.
cURLis a great tool included with OS X. If you have ever worked with web services you may have used it to take a look at raw JSON or XML to figure out where interesting data is. What I didn’t know is that it can send data too. Sending files via ftp turned out to be simple. one of those rare trial-and-success experiences:

-Q "TYPE I" \

Most of this should be very easy to understand. You have a host address and a path on that host where you want the html, plist and IPA to be placed. You know the name and password of an account on that server which has the required privileges to upload to it. You have the thing to send, specified by the -T argument – here the IPA is being transferred. A final note about the ftp protocol: it is ancient and assumes everything is 7-bit text unless you specify otherwise. If you transfer binaries without specifying “TYPE I” then the binary will become corrupted. For the html and plist assets this -Q argument can be omitted.
And you’re done! if all went well you should now be able to connect to your sever and install the app.
Build Triggering
Hang on, this isn’t continuous integration yet, it only happens when you click “Schedule a build”. It should happen whenever code is pushed to the repository. This is easily done. The most easy way to do it is to poll the repository at intervals to see if anything changed. In the Build Triggers section of job configuration, Poll SCM allows you to set a schedule for this polling. Once every five minutes is specified by “*/5 * * * *”.
If you feel that polling in general is bad (and it is) and you are using GitHub, AND your build machine is accessible to GitHub (i.e. is on the public internet) then you can have GitHub notify your build machine when a job should be executed. Mine isn’t so I didn’t try this.6

Either way your final test is to push to your repository and wait to see if Jenkins starts a build. Make some change that you can see on your device, let it go through the whole process and download the result. Ah, satisfying.

This has been a very basic kind of how-to article. A lot more can be done to automate build, packaging and deployment and shell masters will find plenty of room to improve what I have shown here. It would be good practise to archive each deployed build. Multiple versions and configurations could be built at each build trigger. Automated testing could be run. Build lightscould be set to show the result of each build. You could convert the VM to a physical machine to make use of a mini or similar as a build server.

The Source
Shell commands used inside Jenkins:
HOSTING_NAME="[your account name on your deployment server]"
HOSTING_PWD="[your password on your deployment server]"
HOSTING_ADDRESS="ftp://ftp.[your server's address]/"
HOSTING_PATH="[path you will serve the build from]"
# interesting to know the path
# your provisioning profile can be called, and stored, as you like
TARGET_NAME="[Your target name]"
SIGNING_IDENTITY="iPhone Distribution: [Developer Name]"
PROVISIONING_PROFILE_DIR="/Users/jenkins/Library/MobileDevice/Provisioning Profiles"
# always set for xcodebuild
export DEVELOPER_DIR=/Applications/
# Lucky I found this on Stack Overflow. My build wasn't working until I did.
export CODESIGN_ALLOCATE="/Applications/"
# Unlock the keychain containing code signing keys and certificates
security unlock-keychain -p jenkins JenkinsCI
# Do the actual build
xcodebuild \
-project [Project Name].xcodeproj \
-target ${TARGET_NAME} \
-configuration Release \
-sdk iphoneos \
# sign the .app so that it is ready for OTA
xcrun -sdk iphoneos PackageApplication \
-o "${WORKSPACE}/${TARGET_NAME}.ipa" \
-verbose "${WORKSPACE}/build/Release-iphoneos/${TARGET_NAME}.app" \
# place the new assets on the server so everyone can get them
# index.html
-T ${WORKSPACE}/Crawler/OTA/index.html
# plist
-T ${WORKSPACE}/Crawler/OTA/${TARGET_NAME}.plist
-Q "TYPE I" \

And that’s it – I hope you get something out of this post.
1. Voltaire wrote in Candide, of Admiral Byng’s execution: “In this country, it is wise to kill an admiral from time to time to encourage the others.”
2. Apple Mac OS X 10.8.2 EULA – see section 2 (iii).
3. Apple WWDC 2012 Session 404, Building from the Command Line with Xcode – this is a very practical and useful session.
4. GitHub instructions on creating and installing SSH keys
5. cURL website
6. GitHub instructions in “WebHooks”
7. My “Angry Murloc” build light.

Digital Radio – DAB+ in the van

About 6 years ago I bought a Volkswagen T5 Multivan, the family situation (requirement for child seat restraints) made it a choice between that or a Mercedes Vito. The Vito is great but was a fair bit more money. Or there was the hilariously ugly SsangYong Stavic, but that’s no choice at all. Google for some amusing comments on this last abomination. (update – several other minivan choices became available about 6 months too late for us)

If you have to drive a van the VW is a good one. I don’t have much to complain about, although I could mention the horrible turbo lag and general hugeness, but that’s balanced by the internal hugeness, convenience of sliding doors, being able to get to any seat from any door or the amazingly tight turning circle. The thing I seriously hated since day 1 was the sound system.
VW Australia installed some Eurovox 6-CD changer as original equipment but it had a fault, the display didn’t illuminate at all. So it went back to the dealer and was replaced or fixed, but in the process they broke a trim piece. On the next service that was “fixed” with glue but of course it didn’t hold up long, we lived with it. Who’s got time to keep taking a vehicle back to the dealer? The dealer knows this.
One issue it had was crackles and static on all but a few Melbourne FM stations. Another issue was the weird angle you have to insert a CD at for it to be loaded right. A third is that nobody ever remembers to bring new CDs so once out of radio range you’re listening to an album you used to like.
There are at least three iOS devices on the road on any family holiday so playing music from one of those seemed like a good idea. With no front AUX jack and no information on how to interface this Eurovox thing to an iPod any other way a FM transmitter was the only choice. But they barely work in metropolitan areas and will be overpowered by every regional station you get within 100km of – do not waste your money. I have had three different kinds and all worked equally badly.
Finally I decided to replace it, and AUX-input was priority number one. Mechless seemed like a good idea. Didn’t care much about Bluetooth or phone integration. Zero gauge wiring, subwoofers, mono block amps and hojillion farad capacitors interest me about as much as neon underbody lights. I did notice there were a couple of models with DAB+ though.
Sony, JVC and Kenwood have models available in Australia. I couldn’t find much information about them, probably because DAB+ is limited to a small selection of regions right now. I have a JVC in my other car and it’s OK. I used to be a huge Sony fan but got very tired of everything being incompatible or proprietary. In the end I bought a Kenwood KDC-U5049DAB. Got it online for way less than JB Hi-Fi offer.
Installation – DAB+ works on a different frequency to AM or FM so a separate antenna is required. Job No. 1 is to install the DAB+ antenna, a stick-on conductive film that needs to mount close to a pillar so you can stick the signal amplifier unit onto the glass, contacting the antenna itself, and run the cable back to where the head unit is mounted. There are clear instructions included in the box.
glass-mounted DAB+ antenna
Sticking film onto glass is easy but getting it installed behind the neatly-fitting trim pieces looked like it was going to be the tough bit. I would rather change a head gasket than get upside down under a dashboard again so I wasn’t looking forward to this at all. But it wasn’t so bad…
The grab handle on the passenger side A-column has a clip-off cover exposing two T30 Torx bolts. When that is off the whole trim piece unclips with careful steady force. The glove box (mine doesn’t contain gloves either) is held in by eight T26 Torx bolts, five under black plastic covers. Lid and box remove as one unit, allowing the cable to be snaked through behind on the way through to the centre console. Getting it all back in place was easy too. The antenna and amplifier block are not very noticeable on the window, certainly not when you’re the driver. In a van this wide it is basically side-on and invisible from the right side.
Removing the original head unit was also easier than expected. The tray on top of the dash just lifts out from the window side once the clips let go, then the centre panel has two Torx screws to remove before it too lifts away. Detaching the wire from the driver’s seat heater control allowed it to all swing away for the duration. Then there were just two phillips head screws holding the head unit’s bracket in – one hole was stripped, thanks Volkswagen service department. With the physical restraints removed the whole unit came out revealing a harness adapting the Eurovox connector to ISO10487 – sweet!
Wiring harness behind dash
The only wart was a power connection made to the FM antenna signal amplifier. Or so I thought… I happily went off to Repco and bought the Kenwood to ISO adapter, pushed my luck by plugging it all together one hour before a family trip, but it was as easy as I had hoped. Until we set out and I discovered the thing had gone back to demo mode with no station memory – so no permanent power connection. Still, it worked.
Back home I pulled it out and did some comparing between the Kenwood and Eurovox harnesses – it was as simple as the permanent and switched 12V connections being swapped. Which is why you don’t do these things in a hurry, and why you should never completely trust an off-the-shelf adapter. I didn’t have to cut any wires, just used a tiny screwdriver to release the spade connectors from the plastic housing and swapped them over.
Finished installation with extra storage
All finished – with extra storage space. The original unit was double DIN so I needed to fill up the space with a $15 Aerpro single DIN pocket. It’s got some rubbery mat from Bunnings in it to stop things sliding around.
So what’s it like?
Aux: Works like you’d expect – a stereo 3.5mm lead from something with a headphone or line out plays music, sounds great. Everything is controlled by the connected device. If you forget to pause the music when you turn the car off it keeps playing, could cost you just your place in the music or all your battery.
USB: Interesting – basically you plug in the iOS device and get a hierarchical menu controlled by the main knob and back button. It’s not as easy as selecting music from the iOS device of course but it’s usable and might be the best way if you just want to pick one playlist. While connected via USB the device is charging too.
I didn’t try playing any music from a thumb drive, but they are going the way of optical media and chances are I never will.
Tuner: Nothing much to report here – without the power to the VW’s antenna signal booster a few stations came in, with power they all come in strong. I haven’t been out driving next to a tram yet but I am hopeful it will be better than the old one for resistance to interference.
DAB: This is a good feature but whether it is worth $100 over the price of a head unit without depends on how much radio matters to you. I like to hear Melbourne’s PBS FM and it’s on DAB+. There are more stations available generally and to me they are more interesting stations, they certainly run less ads. If you want to hear the football you can browse around FM, or you can pick SEN or ABC Grandstand by name and know you’ve got the right station.
BUT it isn’t CD quality. It is better than AM for sure but I don’t think it is any better than a strong FM signal. I’ve been reading people with serious stereo tuners complaining about the possibility of their superior analog FM being turned off and now I think they have a point. But in a car DAB+ is seriously good, for the extra choice you get, for the ease of finding what you want and for the clear, no-static sound. That’s worth $100 to me.
However Kenwood’s display during DAB setup is kind of confusing. The unit needs to download information about the digital stations available but until it has some you get no indication of what is going on, in fact if you use the display button to switch to signal strength report it will say NO SIGNAL. I thought this meant I had done something wrong with the antenna installation when I saw this.
The manual explains how to initiate download of station info – when you do it reports that it is updating and that it has finished, but still no stations. However after ten minutes or so I tried scan tuning again and plenty of stations came up. I guess signal strength only means “this station’s signal strength” because then it reported plenty of signal. There really needs to be more feedback during this process.
Remote: It comes with a remote, but I can reach the controls from where I sit and there’s no way I’m passing control back to one of the kids. I’d rather pay $2 less and not have a remote, OK Kenwood?
If you want to see an (exhaustive) demo of the Kenwood KDC-U5049DAB, see this video by Simonskie250 from Adelaide. He’s wrong about one thing though, it does not have to do the scan on each startup – that’s configurable.
While I feel like I have bought an early adopter model – there will be something twice as good next year for half the money – I’m very happy with this change. I hope this post helps someone who might be looking into DAB+ for the car, or who needs to know how to install in a T5 Multivan.