Update UI elements from a background thread in iOS

Posted & filed under howTo, iOS, iPhone/iPod, Objective-C.

This is a weird one, yet not weird at all really. I was playing around with Grand Central Dispatch (GCD) in viewDidLoad:

dispatch_queue_t queue = dispatch_queue_create(“com.codebrane.onlineTimeQueue”, NULL);

dispatch_async(queue, ^{

  … some code to retrieve the time from an online service

  self.textField.text = responseAsText;

});


It worked fine when textField was a label but when I changed to use a textField to get the full response displayed, it produced this error:


 

Tried to obtain the web lock from a thread other than the main thread or the web thread.
This may be a result of calling to UIKit from a secondary thread.
Crashing now..

(more…)

codeBrane blog feed moving from FeedBurner

Posted & filed under howTo.

With Google Reader disappearing into the ether I’m not that keen on using FeedBurner any more. So if you’re one of the handful of bods who read my pokey blog, please subscribe on the normal channels:

Entries RSS
Comments RSS

I’ll be deleting FeedBurner stuff end of the month.

Releasing the LDAP mail attribute from the Shibboleth IdP

Posted & filed under howTo, SAML, Shibboleth.

In this tutorial I show how to get the Shibboleth Identity Provider (IdP) to release a user’s mail attribute from an LDAP store. If you don’t have an IdP installed, perhaps you’d like to spend a happy half hour reading my other tutorial - Coffee break Shibboleth IdP install with custom certificate, login page and LDAP.

(more…)

Coffee break Shibboleth IdP install with custom certificate, login page and LDAP

Posted & filed under howTo, SAML, Shibboleth.

In this tutorial I show how to install the Internet2 Shibboleth IdP, link its authentication to LDAP, customise its login page and use custom certificates. I’ll be using SAML2 rather than Shibboleth as that’s the main use case these days and installing on unix (OS X in my case). For an overview of the relationship between Shibboleth and SAML you could do worse than read my contribution to the SCURL Walk In Access Report which tries to clear up the confusion that can arise when people talk about Shibboleth and SAML. It’s on page 30, Section 3.1 Security Assertion Markup Language of the PDF report. You’ll also register and test your new IdP with the TestShibb2 service and hopefully along the way keep your sense of humour while dealing with middleware configuration. What’s that about coffee break though? Surely it takes more than 15 minutes to install a Shibboleth IdP? Well, it took me about an hour the first time, what with having to search around for how to do the various things but after blowing it away and doing it again, it did take about 15-20 minutes. Enough time for a refreshing brew. So, let us begin…

(more…)

Setting up an LDAP server on an Ubuntu VirtualBox

Posted & filed under howTo.

You’re drifting idly on a sun kissed lagoon in the Caribbean, the remains of a piña colada balanced on a floating table next to you. You stretch under the midday sun and decide it’s time to do some work on that toolkit you’re developing, the bit that needs LDAP integration. You’re just on the edge of the wifi out here so you fire up the IDE, crank out some lines of code and connect to the corporate LDAP server only to be greeted with a laughing sysadmin avatar from the other side of the firewall telling you to get lost. You sigh, wave to the barman at the beach bar to send out another colada and you decide to crack open a can of Open Source Juice and roll your own. So what do you do?

(more…)

Starting slapd on a localhost alias on OS X Lion

Posted & filed under howTo.

This is how I used to start slapd on OS X Snow Leopard:

OPENLDAP_HOME/libexec/slapd -h "ldap://smeorach:9000/"
      -f OPENLDAP_HOME /etc /openldap /slapd.conf

where ‘smeorach’ is a localhost alias in /etc /hosts but it doesn’t work on OS X Lion, failing with the error:

daemon: getaddrinfo() failed: nodename nor servname provided, or not known

You have to put the alias above the fe80:: line:

/private /etc /hosts

127.0.0.1       smeorach
fe80::1%lo0     localhost

Reference: OSX Lion Gotcha! – /etc /hosts file

Migrating from CVS to git : update

Posted & filed under howTo.

A while ago I wrote a post about migrating from Sourceforge to Github which required quite a few tricky steps. The steps in question are these ones:

mkdir guanxi-sp-engine
cd guanxi-sp-engine
cp -r ~/dev/Guanxi/Engine/* .
# Remove all the CVS directories and IDEA files
git init
git add .
cd guanxi-sp-engine
cat ../cvs2svn-trunk/output/guanxi-sp-engine-blob.dat /
         ../cvs2svn-trunk/output/guanxi-sp-engine-dump.dat |
         git fast-import

(more…)

OS X Lion : the worst upgrade ever

Posted & filed under howTo, Opinion, The Rantorium.

And so it rumbles on, this joke OS. 10.7 is what I give it out of a hundred. This time it’s the network not coming back after sleeping. According to this thread you can variously turn off/on wifi to get your wired connection back, invoke network in system preferences, or, get this, start a backup. I mean, what’s the point of releasing crap like 10.7? There has obviously been very little testing.

OS X Lion : the jokemobile rumbles on

Posted & filed under howTo, Opinion, The Rantorium.

This time it’s XCode. Refuses to install from the app store. None of that fancy leaping from the store into your dock with a progress bar to inform you it’s downloading. Nothing. It just sits there saying “Installing” then installs nothing. Thinking it had opened a wormhole in space and time to download its multi-gig bulk in super quick time I tried XCode in my dock. It blew up complaining it wanted 10.6 back. Sigh. Uninstall the now dud XCode:

sudo sh
/Developer/Library/uninstall-devtools --mode=all

delete XCode from the dock, login to the Apple Developer site and download the DMG from there. But wait. Where are the commandline tools? Sigh. They’re making it as difficult as possible to develop on this platform now. You need to go into XCode -> Preferences -> Downloads and install them from there. Or you can download them separately from the SDK site.

Another OS X Lion annoyance : Safari last window

Posted & filed under howTo, Opinion, The Rantorium.

This is so tedious, having to go through settings putting them back to the ‘default’ before OS X Lion stamped it’s iOS footprint all over them. This time it’s Safari opening with the last page viewed no matter what its settings are. You have to go into a completely unrelated area to sort this. This smacks of iOS interference as that’s what you do on iOS, use the Settings App to change some global settings. Well OS X is NOT iOS.

System Preferences -> General

uncheck this:

Restore windows when quitting and re-opening apps