Tech Thought

Tech tips, hints, and general musings. PHP, Perl, Mysql, Javascript, AJAX, JSON, Linux, Mac OSX

Entries for January, 2009

How-To: URL Encode NSString in Objective-C

It’s very easy to URL Encode an NSString in Objective-C (i.e. make a string safe to send using a GET request).  Simply do this: NSString* escapedUrlString = [unescapedString stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding]; Then just use the escapedUrlString in your NSURL object and you’re on your way.

Comments (5)

WSDL WebServices for Salesforce using PHP

I’ve found developing for Salesforce with PHP to be somewhat of an undocumented nightmare.  However, there are a few useful blog posts around that can make life easier.  One is here, which takes you through creating a webservice on Salesforce and then accessing it via PHP calls (yes – an end-to-end example!  hooray!) – thanks [...]

Comments (1)

Objective-C: Calculating Days, Minutes, Hours from seconds

If you need to convert a total number of seconds into specific components (days, hours, minutes and seconds) in Objective-C, you can use this code snippet.  You can probably do this a million other ways, but this works beautifully for me:     NSNumber *valueForDisplay = [NSNumber numberWithDouble: [self valueForDisplay:clockName]];     NSNumber *totalDays = [NSNumber numberWithDouble: [...]

Comments (5)

How-To: Add subdirectories to your iPhone Application

I battled with this for quite sometime without realising how simple the solution to the problem is. I wanted to have my complex app resource directory structure replicated in the “Resources” directory of my app – so that all my images, sound files and html files were stored in logical locations – except they always [...]

Comments (1)

Bagpipes on your iPhone: iPiper

WSP Online Solutions released iPiper yesterday, an iPhone app that allows you to play the highland bagpipes on your iPhone.  It was released just in time to play Auld Lang Syne as the clock strikes midnight on New Years Eve. The app provides the ability to play nine of the notes on the bagpipe, along [...]

Comments (2)