Sunday, January 29, 2012

Grand central dispatch plus blocks = bliss

I've been doing some iOS programming recently and needed to load a UITableView with images from a web site.

You don't want to load images synchronously as the view scrolls or it kills the user interface response so that needs to be done in another thread. There is some nice code around to do that but after watching the Stanford lecture on the topic I'm totally turned on to the GCD block pattern where a lump of code is written in line but gets run in another thread.

Here's a snippet from my - (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath

// Load the image with an async block executed in another thread
dispatch_queue_t downloadQueue = dispatch_queue_create("image downloader", NULL);
dispatch_async(downloadQueue, ^{
 NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
 UIImage *image = [UIImage imageWithData:imageData];
 // this has to be back on the main thread
 dispatch_async(dispatch_get_main_queue(), ^{
  cell.imageView.image = image;
 });
});
dispatch_release(downloadQueue);

The effect is that you scroll the table view and the images load later. The code looks pretty ugly (to my eye) but it's much simpler than any alternative and great to have it right there in line rather than off in another mystery object.

Wednesday, January 25, 2012

Six point plan to halt movie piracy

Bouncing off the Megauploads story, I had an opportunity to reflect on RNBreakfast on why there is a widespread problem with people obtaining illegal copies of (in particular) movies.

I think the problem stems from the big studios failing to keep pace with the technology habits of the general public, this has turned Mr and Mrs Average  into a pirate, not because they want to be, but because they can't get what they want.

Here's what I think studios should do to give people what they want and start receiving the money which is currently flowing to Megauploads and friends:

  • Make new content available everywhere in the world at the same time.
  • It should be easy to purchase, without needing to join an ongoing service.
  • The price should be fair so that risky pirate alternatives don't seem worth the effort.
  • Price should slide according to quality - phone size to 4k TV video, extra for 3D, extra for multi-channel sound, extra for extra features.
  • DRM should be permissive and allow a user to move the purchase around their devices.
  • Upgrades should be available - if I rent the phone version I should be able to upgrade to HD later.
Finally, all of the fights over territory and fragmentation of titles across stores should just be solved. I should be able to rent any movie, or TV show, or music, or book, or whatever that has ever been made on any of my devices.

Audio from this morning here.

Tuesday, January 24, 2012

Coffs Harbour Radio Expo, a bit smaller this year

For many years we've headed north to Coffs Harbour at this time of year for the radio expo. Alas, this year it wasn't on - but we decided to go anyway.


It's a lovely place, we often discuss the idea of moving there to escape Sydney. There was a confluence of radio though as I'd just sold an IC-718 on eBay and the buyer was Scott, VK2AET, who lives not far north so we met up and had our own little radio expo in a cafe.


Scott's a great guy and recently lost a lot of gear in a lightning strike to his house - hence the interest in the Icom radio. We had a very interesting chat and I hope to catch up on air in the near future.


Despite the deteriorating weather, we had a great time including a chance to view the film Hugo which I highly recommend, particularly to film buffs.

Wednesday, January 11, 2012

Ericsson phone catalog

Rob, VK2ZNZ, showed me a marvellous catalog of old Ericsson telephone handsets. These are drawings but many look photo-realistic and show great skill by the artists.

Ericsson Type AC 110 "Magneto table telephone"

Ericsson Type AC 210 "Magneto table telephone"

Ericsson Type AB 140-145 "Magneto wall telephone"

Ericsson Type AC 130-140 "Magneto table telephones"

Ericsson Type AC 1000 "Extension table telephone without generator or bell"

Ericsson Type BC 1300-1301

Ericsson Type BC 2050 "Battery ringing table telephone"

Ericsson Type CL 510

Ericsson Type AC 100

Rob has some of these phones and you can truly say they were built to last. I called him on skype and he answered on a magneto table telephone.

Kodak Zi8 pocket HD video camera to watch out for

Dave, VK3ASE, tipped me off to this one. There's a, now obsolete, video camera from Kodak (soon to be obsolete too), called the Zi8. It has two things I look for - high quality video and an audio input port. Here's some test footage, but I recommend you go to YouTube and switch to HD to watch it here.


Highlights are burnt out and it really needs a tripod to get good quality. It's much better than my existing Canon video camera and very compact.

Here is an example of the 15cm close up mode:



Incidentally, I'm selling this IC718 on ebay at the moment.

I paid a little over $80 for the Zi8, they're a bit hard to find but they are out there.

Here's a picture from Kodak's site.


Native recording format is .MOV containing H.264 video with AAC Audio so it's perfect for my uses and uploading to YouTube.

Sunday, January 08, 2012

Charming sketches from travelling friend

Old friend Jennifer Lewis has just returned to Australia after working in London and Indonesia. She's been doodling in a sketchbook too good effect.


Check out her blog with scans of her sketches as she's not getting much traffic so far. Great stuff!

Friday, January 06, 2012

SyPy in the pub with Malcolm Tredinnick

An informative, entertaining, tasty, thirst-quenching meeting of the Sydney Python group was held last night in a pub in the Sydney CBD (instead of at Google for a change).


The new venue had has pros and cons. On the plus side, we could order Thai food which was delivered to us when ready; it's a nice central location, just near Town Hall; and the house beer was just $3.60 a scooner. The down sides were some street noise and a bit of a flow of patrons through the presentation looking for dunnies.

Malcolm, a long time Django contributor, ran through the top security risks and talked about how Django protected us from ourselves in general. I've had the experience of one of my apps being formally externally security audited. Being a Django app it came up pretty well except for a few things that I had introduced.

Malcolm pointed out that Django's attention to security ironically makes us more likely to be kidnapped and "rubber hosed" by attackers!

It was great to get together and as always the chats with others in attendance were interesting and valuable. Thanks to the organisers, particularly Dylan.

Tuesday, January 03, 2012

A perfect day: work, social and soldersmoke

The weather has turned in Sydney and we have very pleasant sunny days with a refreshing wind.

Today I woke early and went for a brisk walk listening to a podcast. In the morning I worked, doing a geospatial project converting a Django project from Google Maps 2 to 3 as well as working to handle complex polygons efficiently (tens of thousands of points) with holes in them.

Lunch with Jonathan, then some more work followed by some quality shed time.

A kit arrived from QRP Kits, it's a DC40B CW transceiver. I'm still struggling to learn CW and I thought that having a CW only transceiver might help with my motivation. Instructions are good and it was lovely working in the shed with a breeze through the window blowing the solder smoke.

Over the past week there have been numerous visitors to the shed. Dave, VK3ASE, George, Bob, Dave VK2HLG, and Indy (ham call coming soon).

I'm on 20m WSPR and band conditions are really good. I'm running just 1W (the minimum my rig will go down to) and getting spotted right around the globe including by K1JT himself.


My reception seems quite low in noise and I'm also hearing lots of stations.