How to create Linkshare Affiliate Links to iTunes Products

One of the worst ever interfaces i have ever come across is that of Rakuten LinkShare. Even before they’ve been bought by Japanese giant Rakuten it was bad, and it hasn’t been improved since I’ve signed up with them in 2008. Lucky for us we don’t have to use their interface to get links to […]

How to create a UIBarButtonItem in code and make it call a method

Some things are really easy to do via a Storyboard – but when you want to create the same thing in code I frequently forget how to do it. Turns out it’s equally simple: this example assumes you have a View Controller which is embedded in a Navigation Controller (so it already has a UINavigationBar […]

How to remove a Core Data Model Version

Core Data can handle several versions of your Model. It’s easy to add a version (via Editor – Add Model Version) and set it active, but it’s not so easy to remove a version you no longer need. Thankfully there is a way to delete version files which goes a long way to declutter your […]

How to create a View Controller defined in you your Storyboard programmatically

Your View Controllers are created by the Storyboard automatically depending their defined relationships in Interface Builder. Sometimes however we need to create and transition to View Controllers we’ve defined in code. For example, if you want to transition to a view as part of displaying a search result. We can do this by creating a […]

How to add a Search Display Controller to a UITableView (in code)

We’ve recently discussed how to deal with a Search Bar and Search Display Controller using Interface Builder. You can however do this in code too. This can be useful if you don’t want to make all the relevant connections in every Storyboard. This example assumes you have a Table View (self.tableView) to which you’d like […]

How to add a System User Account on Linux (CentOS)

On both CentOS and Red Hat Linux systems you can easily create new user accounts with their own home directories. Here’s how you do this from the command line. I’m assuming you’re logged in as root, and the new user we’d like to create is called “testuser”: useradd testuser Let’s give our testuser a password … Read more

How to parse a JSON URL in iOS and Cocoa

Both Cocoa and iOS have built-in methods to parse (and generate) JSON data using NSJSONSerialization. Most commonly you’ll want to call a URL with parameters which will return some data. You take this output and tell Objective-C that it’s JSON, then typecast the return to an array or a dictionary which in turn lets you […]