How to recover file contents after Notepad++ crash

Notepad++ is generally a pleasure to use but it does very occasionally crash and empty whatever file you happened to be editing at the time too… Here’s where you can find a backup version to recover your file if this ever happens to you too:


Note: At the time of writing I’m running Notepad++ v6.7.8.2 on Windows 7 Professional, but you’ve not got anything to lose by trying this for other versions of Notepad++/Windows.

Thanks to Indrajit on Stack Overflow for posting the solution originally!

Form validation made super easy with jQuery

We spend a lot of time coding both client and server-side form valdilation.

This is the routine I now always use for client-side validation, which has been refined over the years to become what I’d consider to be some pretty tight code, whilst providing good quality feedback to the user to help them complete forms quickly and with minimal confusion.

Hopefully you can learn a trick or two that you can use yourself, by looking at the code…

function errorBefore(error, $insertBefore) {
  $('<p class="error">' + error + '</p>').insertBefore($insertBefore);

$(function () {

  $("#my-form").submit(function (e) {

    // remove any errors from previous form submission
    $('.error', $(this)).remove();

    // get jQuery reference to form fields
    var $name = $('#name');
    var $email = $('#email');

    // validate name input
    if (!$name.val()) {
      errorBefore('Please enter your name.', $name);

    // validate email input
    if (!$email.val()) {
      errorBefore('Please enter your email.', $email);

    // check for errors
    if ($('.error', $(this)).length) {

      // find first error and focus on form field it relates to
      $('.error', $(this)).first().next('input, select, textarea').focus();

      // stop form submission



Reverse Geocoding for iOS using the API

In this tutorial, we’ll be creating a simple iPhone app capable of reverse geocoding – the process of finding the nearest address from a set of location coordinates. In this case, our location coordinates represent the user’s current location and will be provided natively by the CoreLocation framework (more on this in a bit).

On route we’ll learn how to make requests to a web service using NSURLConnection and how to process the JSON response we get back from it, using SBJson (a JSON parsing framework) which is available at

Open Xcode (I’m using version 4.2 but instructions shouldn’t vary too much for earlier/later versions) and create a new Xcode project. Choose Single View Application as the template for your new project and name your product something appropriate. Leave the 3 checkboxes unchecked and click next and then create in the following dialog.

Grab the Frameworks etc

(Note: There are more detailed instructions on the respective github pages telling you how to successfully get the frameworks into Xcode if you get stuck with either of these steps).

Head over to and download the latest .ZIP file. Open up the .ZIP and select all the files in the Classes folder then drag them into your project, creating a new group for them to keep things tidy.

We’re also going to use a lovely, easy to use, loading indicator which you can find at Create another new group and drag the MBProgressHUD.h and MBProgressHUD.m files into it.

Lastly – We need to add the CoreLocation framework to our project. In the project navigator, select your project – Select your target and then the ‘Build Phases’ tab. Open the ‘Link Binaries with Libraries’ expander and click the ‘+’ button. Search for the CoreLocation framework and click ‘Add’.

The User Interface

Open up your .xib file and drag on a Label and a button, then open up your view controller’s header file and add an IBOutlet for your label and an IBAction for your button.

@interface ViewController : UIViewController {

UILabel *addressLabel;


@property (nonatomic, retain) IBOutlet UILabel *addressLabel;

-(IBAction) buttonClick;


Go back to the Interface Builder for your .xib file, right click the File’s Owner icon (the semi-transparent yellow box to the left of the editing area). Drag the addressLabel outlet onto your label and the buttonClick received action onto your button, selecting touch up inside as the type of interaction.

Back to the Header File

We need to add a few things in our header file before we can get on with coding the beefy bits of our application. Shortly but sweetly:

  • Import the CoreLocation and MBProgressHUD.h header files.
  • Have your view controller implement the CLLocationManagerDelegate delegate.
  • Add instance variables for responseData (NSMutableData), locationManager (CLLocationManager), currentLat (CLLocationDegrees), currentLon (CLLocationDegrees) and HUD (MBProgressHUD).

Your finished header file should look like this:

#import ;
#import ;
#import "MBProgressHUD.h"

@interface ViewController : UIViewController  {

NSMutableData *responseData;

CLLocationManager *locationManager;

CLLocationDegrees currentLat;

CLLocationDegrees currentLon;

UILabel *addressLabel;

MBProgressHUD *HUD;


@property (nonatomic, retain) IBOutlet UILabel *addressLabel;

-(IBAction) buttonClick;


The Beef Of The Code

Include the SBJson.h header file in your implementation file, and synthesize the addressLabel property we created earlier.

No more undefined index using PHP’s $_GET and $_POST

It’s very annoying having to check whether $_GET['somevalue'] is set before checking its value – but if you don’t, your code is going to throw a a lot of Notice: Undefined index warnings and that’s never good.

I’ve written a quick class to make every PHP developer’s life a bit easier. It’s based on CodeIgniter‘s $this->input class. You can use it as follows and never have to worry about whether the index exists or not… It will just get set to NULL if it doesn’t.

class Input {
     function get($name) {
          return isset($_GET[$name]) ? $_GET[$name] : null;

     function post($name) {
          return isset($_POST[$name]) ? $_POST[$name] : null;

     function get_post($name) {
          return $this->get($name) ? $this->get($name) : $this->post($name);
$input = new Input;

$page = $input->get('page'); // // look in $_GET
$page = $input->post('page'); // // look in $_POST
$page = $input->get_post('page'); // look in both $_GET and $_POST