Avoid Entering Username and Passwords After Restoring iOS

If you restore your iOS (iPhone or iPad) from a backup in iTunes, you’ll find you need to re-enter your usernames and passwords for all your email accounts.

Simply tick the Encrypt iPhone Backups option in the device summary tab in iTunes and enter a password to secure your backups. iTunes will now backup and restore your sensitive data, usernames, passwords and MobileMe data, and do so securely.

Quickly Creating an HTML Link in JavaScript

A cool and little known JavaScript function is .link() available to all string objects. Calling string.link(url) returns an HTML string for an anchor tag with the URL in it. For example:

var text = 'the best website ever';
var html = text.link('http://bencollier.net/'); 
html === "the best website ever" //true

A great way to quickly make links without having to do:

var text = "the best website ever";
var url = "http://bencollier.net/";
var html = "" + text +"" ;
html === "the best website ever" //true

Xcode 4: Unable to Select Project / Template Type

iOS File Template Selector

iOS File Template Selector - unable to click an item


When opening a new iOS or template type in Xcode 4 (4.0.2) I was unable to select any of the project or file templates, turn it out this occurred when tapping (not ‘clicking’) on the items.

Using a firm clicking click or the arrow keys seems to work around this. Tapping just seems to deselect anything currently selected.

What a strange bug!

Show / Reveal Password Bookmarklet

If you’ve got a password saved, but can’t remember what it is, you can use this bookmarklet to reveal it.
Drag the image to the bookmark bar:

Reveal Passwords
Click the button above to try it out:

If you’re interested in the JavaScript source:

javascript:Array.prototype.slice.call(document.querySelectorAll("input[type='password']"))
    .map(function(el){el.setAttribute('type','text')})

It gets all password inputs and turns their type to text; and should work in modern browsers (like Safari, FF4, Chrome etc) that support ‘querySelectorAll()’.

PhoneGap & The Android Back Button (0.9.5)

In PhoneGap 0.9.5 they’ve updated how the Android back button works. Here’s what to change.

Before in 0.9.4:

BackButton.override();
document.addEventListener("backKeyDown", function() {
    someBackButtonHandlingFunction();
}, true);

Now in 0.9.5:

document.addEventListener("backbutton", function() {
    someBackButtonHandlingFunction();
}, true);

In 0.9.5 and later you no longer need to override the back button, as it’s assumed when you’re adding the event listener that you want to handle the button yourself. Make sure if the user is at the root view of your mobile app, the back button closes the app.

To exit the app in 0.9.4 you’d use:

BackButton.exitApp();

Now, in 0.9.5 you need to use:

device.exitApp();

Good to see PhoneGap advancing to a more device agnostic syntax.