iOS Dev: Decoding PHP URL Encoded Strings with NSString

If you do any PHP development, you should be familiar with the urlencode() function:

1
2
3
4
5
6
7
8
9
10
<?php

     $string = "This string will totally screw things up if it isn't urlencoded!";
     $encoded_string = urlencode($string);
     echo $encoded_string;

     // Result:
     // This+string+will+totally+screw+things+up+if+it+isn%27t+urlencoded%21

?>

Notice that the resulting string contains percent escapes in place of the apostrophe (‘%27′) and exclamation point (‘%21′), but the spaces have been replaced with ‘+’ symbols. This is what urlencode() does, and it works just fine if the encoded string will be decoded by the urldecode() function in PHP.

Things get a little more complicated if you use urlencode() to encode a query response for an iOS app. The standard, easy way to remove percent escapes is the NSString stringByReplacingPercentEscapesUsingEncoding: method. When used on the encoded string shown above, we get this:

Read more…

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

One big reason why the iPad matters…

Yesterday Apple announced the iPad, finally bringing an end to months of rumours. If you somehow missed all the hype, you can catch Steve Jobs’ keynote presentation here.

The response to the iPad has been predictable. Apple’s fans are crazy for it, while their detractors are falling over themselves to find fault with it. Is the device perfect? Certainly not. Either was the iPhone, but that didn’t stop over 40 million people from buying it, or stop tens of thousands of developers from contributing over 140000 apps to the platform. Apple currently owns the smartphone market, not because they produced the clearest sounding phone or the most powerful mobile email client, but because they created the best mobile user experience. The iPad promises a similar experience, with the benefit of a larger screen.

The large screen is the whole point of this device. Small devices like the iPhone are wonderful for personal use, but they don’t make it easy to share your content with others. They also don’t support truly rich user interfaces. Before you point out that your laptop handles those things nicely (one of the most frequent arguments against the iPad), stop for a moment to consider what you have to do to get information into it and out of it.

Your laptop is married to input technology that is over 30 years old. The QWERY keyboard and mouse/trackpad don’t exist because they represent the best way to accomplish their respective tasks. They exist because, several decades ago, they were the only practical solutions. Apple clearly recognizes that past necessity is a bad reason to continue doing anything, and the iPad is the first big step towards freeing users and developers from the limitations presented by these devices. Once app developers get their hands on actual devices, expect to find yourself using fewer traditional input methods and more innovative, human-friendly gestures. We don’t know exactly what these gestures will be yet, but the potential is there for the first time.

Multitouch technology married to a screen with decent real estate is a big deal for usability and accessibility. Anybody who can’t see that should think a little less about how they worked yesterday, and more about how they want to work tomorrow.

Update:

Steven F. does a better job of explaining this than me. Read his take on the iPad and the future of computing.

If you’re constantly disappointed by minor flaws in new technology, like a lot of people seem to be, you should probably read this.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Using Custom Objects in JavaScript

Objects provide a simple, powerful way to store and manipulate data, and should be part of every JavaScript developer’s toolkit. This short tutorial will demonstrate how to create custom objects for your data.

Note: This is not an in-depth tutorial. You should already be comfortable with basic JavaScript and programming concepts like functions and arrays before you start.

Read more…

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Taxulator Review at The Loop

Taxulator just received a positive review by Jim Dalrymple at The Loop! Read the review

Jim suggested that the tax settings panel should be moved into the app, instead of the iPhone settings bundle where it currently resides. A number of Taxulator users have asked for this change and it will be implemented in the next update.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Heuristic Media on Twitter & Facebook

Heuristic Media now has a dedicated feed on Twitter.

Follow @heuristicmedia for updates about iPhone apps and web development.

Follow @heuristicmusic for updates about new music, cool links and my daily ranting.

You can also find us on Facebook.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon