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 iTunes Products – we can use the standard good looking and well working iTunes Link Maker. All we need is go there via LinkShare, which will embed our affiliate code.
Here’s how to do this step by step:
1.) Login to LinksShare and see the awful Home Screen
2.) Head over to Links – Get Links
3.) Click on “US iTunes, App Store, iBookstore, and Mac App Store” (you need to be subscribed and approved for this option to become available).
This should get you to a screen similar to this:
4.) Notice the grey button that says “Link Maker Tool”. Click that and you get to a new window and is the familiar iTunes Link Builder, as provided by Apple:
Note the message that reads: “Your affiliate Network is…” – this is the confirmation that you’re building links as an affiliate. If that message isn’t there, your links are not tracked. Instead if LinkShare, this can be a different partner (TradeDoubler is another one for example).
Now you can enter a product and grab the link, which will already contain your affiliate ID.
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 at the top). Here’s how you add a button to it, set the title and target, and tell it what to do when it’s pressed:
// first we create a button and set it's properties
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 brain. The secret lies in the fact that the .xcdatamodeld file is actually a Package and can contain more than one file. It’s like the .app extension which isn’t just one file. I never knew this!
To explore, select your versioned .xcdatamodeld file, right-click it and select “Show in Finder”. Once in there right-click it again and select “Show Package Contents”. Surprise – here are all your Model Versions. Before you go on a mad deleting spree, head back to Xcode and do the following:
activate a Model Version that you want to keep (by going to the top level .xcdatamodeld entry, then select it under “Versioned Core Data Model”)
next remove the entire file from your project (just the reference… do not move to trash)
head back to the Finder and delete the files inside the Package you no longer want
go back to Xcode and add the .xcdatamodeld file again
Voila – now all your unnecessary Model Versions are gone. Perhaps in a future version of Xcode there will be an easier way to do this, but as of Xcode 4.6.2 (April 2013) there is not.
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 new UIStoryboard object and then asking it to create a View Controller defined in it. For this to work you need to give your View Controller a unique identifier using the Identity Inspector (under Identity, set a Storyboard ID).
This example assumes we have a Storyboard file called MainStoryboard.storyboard in which there’s a View Controller called DetailView. Here’s how we create it and push it onto a stack of Navigation Controllers:
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 to add a Search Bar and Search Display Controller at the top. We do this by utilising the Table View’s tableHeaderView property:
// create a new Search Bar and add it to the table view
This week has seen a rather large scale attack of a bot network that specifically targets the “admin” user in WordPress installations. This means that if your site as a user called “admin” then your site is under threat of being a potential target.
No matter if you’re using “admin” as an active user or not: if it exists, your site is at risk. Period.
In this podcast I’ll show you how to change your user name. Sadly this isn’t as easy as just amending “admin” to something else; you’ll have to create a new user, then delete the “admin” user from your site. Don’t be afraid though, I’ll cover each and every step in detail and explain why this is necessary.
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”:
Let’s give our testuser a password so s/he can login to the system via SSH:
This will prompt for a new password (twice), followed by the message that “all authentication tokens have been updated”. Which is nice.
You can now login as “testuser” with your designated password. Testuser’s home directory is located here:
That’s all there’s to it – congratulations on creating a new user on your system 😉
Removing a User Account
If you’re done with the account you can remove it with
The data in this user’s home directory will still be intact, even when the user is removed. In case you’d like to do some house cleaning, you can pass -r which will remove the user’s directory and all contents he may have had:
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 access the data. It’s genius!
What you’ll get back depends on your individual JSON structure of course. This can be quite complex, for example you could receive an array full of dictionaries, each of which could be full of dictionaries. JSON data can be mapped to an NSArray, NSDictionary, NSNumber and NSNull.
Once you have access to the top level elements you can then loop through each one, examining what’s in it and access what you need.