Showing posts with label Tutorial:. Show all posts
Showing posts with label Tutorial:. Show all posts

Thursday, 29 December 2011

Tutorial: How to build an Android app

Tutorial: How to build an Android app

How to create an Android app

One of the strengths of the Android platform compared to iOS, for example, is that it has an open source basis, which makes it easier to produce your own applications and distribute them without waiting for a lengthy approval process.

You can set up your own Android app on your PC as long as you have the right software installed, and you can even take it for a test drive using an Android emulator so you can see what it will look like when it's run on a smartphone.

There are two techniques that you can use to produce Android applications with a PC. The first uses the Android Software Development Kit (SDK). This lets you write raw code and helps you get it working in the Android environment. The second uses App Inventor, a Google Labs tool that's still in beta.

This provides you with a simple drag-and-drop environment that you can use to generate new applications made up of building blocks of code and media. It's an attempt to make application development possible for people who aren't hardcore coders, but it's not recommended for production environments.

Assuming that you'd like to try the full coded environment, we'll demonstrate how to produce a simple 'hello world' application. If you'd rather work in a GUI, we'll discuss App Inventor later on. Android apps are written in Java code, so you'll need a Java development kit installed on your PC. You also need an integrated development environment (IDE) so you can write and test the code.

How to create an android app

You also need to get your computer ready for the Android SDK. Start by installing a Java Development Kit for your version of Windows.

You also need to install Eclipse IDE for Java developers. When you install Eclipse it will check for the JDK. It's best to unzip Eclipse in the same directory as the JDK. If it can't find the JDK it won't install, but you can always move the required files to whatever directory the Eclipse installer is examining.

With Eclipse up and running, you can download the Android SDK. Extract it to a safe directory on your PC and make a note of where it is.

How to create an android app

Back in Eclipse you need to add the Android Development Tools. To do this, choose 'Help > Install new software'. Next to 'Work with', enter https://dl-ssl.google.com/android/eclipse and click 'Add'. In the pane below this, check 'Development tools' and click 'Next'. Select 'Android DDMS' and 'Android Development Tools'. Click 'Next', accept the terms and restart.

You need to point the ADT plugin to where you extracted the Android SDK. In Eclipse choose 'Window > Preferences > Android'. Next to 'SDK location' click 'Browse' and locate the folder with the SDK. Click 'Apply' and 'OK'

Android platform

How to create an android app

Now that you've sorted out the programming environment, you also need to get at least one version of the Android platform. You can do this in the Android SDK and AVD Manager, which you can launch in Eclipse if you've set your system up correctly.

Choose 'Window > Android SDK and AVD Manager' to open it, then select 'Available packages' and tick the box next to 'https://dl-ssl.google.com/android/repository/repository.xml'.

After a brief scan of the repository, you'll see the available components. Tick those that you want to install and clear the rest. The most important package to install is the latest version of the Android platform. You'll only need older ones if you plan to release your app and need to test it in a range of different versions. At this stage you can also clear the samples, Google APIs and USB driver. If you need any of these later, you can always go back and install them.

Click 'Install selected' and wait for the components to download. Verify and accept the new components if prompted and they will be added to your existing Android SDK folders.

Android virtual devices

How to create an android app

Having downloaded a version of Android, you need to set up an Android Virtual Device (AVD) to run the computer. You can do this in the Android SDK and AVD Manager. Choose 'Window > Android SDK and AVD manager' and select 'Virtual devices'. Click 'New' and provide a name for your new device. Select the Android platform that you want to use as the target. Click 'Create AVD'.

If you want to test your application under different versions of Android, you'll need to create a new virtual device for each version of the platform. You can also specify other parameters here, including the presence and size of an SD card. It's also possible to select a file to use as a virtual SD card.

You can opt to use the built-in skin (recommended) or specify the resolution that you want to use. Under 'Hardware', click 'New' and select a device if you want to add more virtual hardware.

For a simple AVD, you'll generally be fine sticking with the default options. You can now close the Android SDK and AVD Manager.

Create and emulate your Android app

How to create an android app

Assuming you now have all the software in place and you've set up a virtual device in the Android SDK and AVD manager, you can create a new project. In Eclipse IDE choose 'File > New > Project'. In the New Project wizard, select the 'Android' folder and choose 'Android project'. Click 'Next'. You now have a new window for your project details.

To start with, we'll set up a simple 'Hello world' application that just displays some text when launched. In the field marked 'Project name', enter HelloAndroid. For 'Application name' enter Hello, Android. For 'Package name' supply com.example.helloandroid and for 'CreateActivity', enter HelloAndroid. Click 'Finish'. These parameters are used to set up your project in Eclipse.

The project name is also the name for the directory in your workspace that will contain your project files. Eclipse will create it for you. Assuming you accepted the default Windows workspace of C:\Users\[username]\workspace, you'll find the above directory at C:\Users\[username]\workspace\HelloAndroid.

If you browse to this in Windows Explorer, you'll see a number of subfolders and files set up as part of the project.

How to create an android app

The application name is the title of your app, which will be displayed in the Android device. Change this to change the name of the app. You need to be a bit more careful with the package name.

This is the namespace for the package where your source code resides. It needs to follow the rules for naming packages in Java. It also needs to be unique across the Android system, which is why a domain style package is used; 'com.example' is reserved for examples like this.

If you develop an app that's published, you'll need to use your own namespace. This usually relates to the organisation publishing the app.

'Create activity' relates to the class stub generated by the plug-in. An activity is basically an action. It might need to set up a user interface if it needs one. We left other project fields at their default values, but it's useful to know what they do. 'Min SDK version' lets you set the minimum API required by your application.

If 'Use default location' is ticked, your project will be saved in your workspace. You can opt to change this if you want to store the files elsewhere. 'Build target' is the platform target for your application. It's the minimum version of Android that it will run on.

If you develop an app to run on an earlier version of Android, it should run on a later one too, but one developed for a later version of the platform probably won't run on an earlier version. For an example like this, the build target isn't critical as long as you can get your application to run in the emulator. It's more of a concern when you come to release an app.

Finally, the option to create the project from an existing example enables you to select some existing code to modify. You'll find this of more interest as you move on to greater programming challenges.

Modify the code

You should now see your project displayed in the Package Explorer, which is shown in the left-hand pane of Eclipse. Double-click 'HelloAndroid' to expand it. Also expand 'src' and 'com.example.helloandroid'. Double-click 'HelloAndroid.java' to see the code that's already been set up. In the main pane you should see the following text:

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

If you can't see all of this, try looking to the left-hand side of the pane and expanding any plus signs that indicate collapsed code. This defines your application without actually doing anything at this stage. To make it do some work, we need to add an object that will contain your text.

Having done that, we also need to specify the text. Below 'import android. os.Bundle;' add the following line:

import android.widget.TextView;

Also add the following above the two sets of closing curly brackets:

TextView tv = new TextView(this);
tv.setText("My First Android App"); setContentView(tv);

You can replace the text within the quotes to make your app say whatever you like. Check that the code in its entirety reads as the following, assuming you kept the displayed text the same:

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("My First Android App");
setContentView(tv);
}
}

Save the changes to your code. You can now try it out in the Android emulator. In Eclipse, choose 'Run > Run > Android application'. The emulator launches. It can take a few minutes to boot into Android, so be patient. Once booted, your app should run automatically and you'll see a grey title bar with the app name in it. Below this, your chosen text is displayed.

Press the 'Home' button in the emulator to return to the Android home screen. Click the 'Applications' button to see the list of available applications. Among these you should see 'Hello, Android'. Select this to launch your app again.

Test your app on an Android device

How to create an android app

Now you've successfully run your app in the emulator, you can try running it on a real device. First you need to ensure that the USB driver is installed in the Android SDK and AVD manager. Choose 'Window > Android SDK and AVD manager > Available packages'. Select the Android repository, ensure that the USB driver is ticked and click 'Install selected'.

Connect your phone to a spare USB port and wait for Windows to detect it. In the New Hardware wizard, choose 'Locate and install drivers' and opt to browse your computer for the driver software. Browse to the 'Android SDK' folder and locate the subfolder for the USB driver. Windows should find and install it from here.

Now you need to declare your app as debuggable. In Eclipse, expand your HelloAndroid application and double-click 'AndroidManifest.xlm'. Move to the 'Application' tab and select 'True' from the Debuggable dropdown list. Save the project.

Go to your Android phone and choose 'Menu' from the home screen, then select 'Applications > Development' and enable USB debugging. Now you can reconnect it to your PC via USB. If you want to check that the SDK can see your phone, browse to the 'Tools' directory in your 'Android SDK' folder. Launch 'adb.exe' and you should be able to see your phone listed as 'Device'.

To launch your application on the connected phone, you need to choose 'Run > Run > Android application in Eclipse'. Now you have both the emulator and your phone connected, you need to specify which you want to run it on. Eclipse presents you with a Device Chooser that lists all the available devices and emulators. Select your phone from this list to install and run the app.

Now you've produced and run a very basic application from raw code in an emulator and on an Android device, you can begin to learn how to develop your own. It helps to have some knowledge of Java programming, but you'll also find a number of stepped tutorials in the Android Developer Resources pages.

These include introductions to the different views available to apps and how to implement them. You'll also find ways to use common resources like location information, and find out how to debug your work.

You can find a full list of sample code on these pages too. This will help you to work through example applications that you can modify to your own ends. These include games such as Snake and Lunar Lander, plus utilities like Note Pad and Wiktionary. You can find even more samples at Apps-for-Android.

How to use App Inventor

App Inventor

How to create an android app

For those whose eyes glaze over at the sight of a few lines of code, App Inventor may well be the answer. This Google Labs innovation lets you create applications using your browser and either a connected phone or an Android phone emulator. All your work is stored on the App Inventor servers, so you can come back to it at any point.

App Inventor consists of three main components. The App Inventor Designer lets you select components for your app, including media, buttons, labels and everything else that's related to the way your app looks and feels.

How to create an android app

The App Inventor Blocks Editor is concerned with the processing components of your application. Any decision handling is dealt with here, and it's shown as a kind of puzzle. You drag and drop program pieces like a jigsaw.

The emulator provides a virtual phone so you can try your program out, and it's updated as you make changes in real time.

You can opt to use a real Android phone instead of the emulator, as long as there are Windows drivers to support it that will work with App Inventor.

While it's partially cloud-based, there are still components that need to run locally, with the most important being the most recent version of Java. It's worth running a couple of tests to ensure your browser can execute Java code correctly before downloading the full App Inventor local program. If you have any browser extensions installed that stop code running in the browser, such as No Script for Firefox, it's a good idea to disable or even uninstall these before attempting to run App Inventor.

Once you have App Inventor installed, you need to run it by connecting to the App Inventor site. You can't just launch it from the Start menu. In your chosen browser, head to App Inventor at Google Labs; if you have everything in place, the program will start. You may need to log into your Google Account if you haven't already done so, because this is where your development data will be stored.

Create your first Android app: step-by-step

How to create an android app

To create an Android app in App Inventor, first download the most recent version of your browser and get Java.

Run a couple of tests to ensure that your system is set up to run App Inventor, first by running the Java test. If it works, you'll be presented with a success message. If it fails, reinstall Java. After this, browse to the Check Java for App Inventor page, signing in with a Google account if prompted. The page will tell you if your browser is correctly configured.

How to create an android app

If it is, click the 'Launch' button to check that you can run a simple application in your browser using Java.

Now you know that App Inventor will run in your browser, go to the App Inventor Setup page and click 'Download'. Once downloaded, browse to the file named 'AppInventor_Setup_Installer_v_1_2.exe' and launch it. Follow the installation. Make a note of the installation directory in case you need it later, but don't change it.

The software already supports a number of popular Android phones. These include T-Mobile G1 / ADP1, T-Mobile myTouch 3G / Google Ion / ADP2, Verizon Droid (not Droid X), Google Nexus One and Google Nexus S. If you have a different phone, visit the Windows Drivers page to get its drivers. Alternatively, you can run your app in the emulator.

Next, go to App Inventor at Google Labs and wait for App Inventor to launch. Click 'New' to start a new project, name it 'HelloPurr' as one word and click 'OK'. This project uses two media files: a picture of a cat in PNG format and an MP3 of purring. You can download them from the Building Your First App tutorial webpage or use your own.

How to create an android app

The Designer opens. In the left-hand pane you'll see the palette, which shows each of the components you can use. Click and drag a button onto Screen 1 in the viewer, to the right of the palette. To the right of this is a list of components in use.

How to create an android app

Select Button 1 and click 'None' under 'Image'. Choose 'Add', then browse to your cat picture. This changes the appearance of the button. Click under 'Text' and delete the existing wording.

How to create an android app

You now need to set up the app in the Blocks Editor. This can run your app via its emulator or through your phone. Click 'Open the blocks editor' and wait for the editor to open in a new window. Keep the existing window open. Choose 'Connect to device' and select your phone from the dropdown list. Wait for the editor to connect properly. If all is well, you'll see a picture of a cat on your phone. Alternatively, click 'New emulator'.

How to create an android app

If you're using an emulator, once it's running you need to connect to it in the same way as a phone. Click 'Connect to device' and select the emulator. Once connected, you'll see your cat picture on the emulator's screen. You may need to unlock the emulated phone by dragging the green lock button to the right.

How to create an android app

Return to the Designer window and drag a label from the palette to the viewer in Screen 1 so it appears below the picture. In the label properties on the right, enter the text 'Stroke the cat'. Change the font size to 30 and choose a different colour if you like. We'll now add the purring sound for when the cat is stroked.

How to create an android app

In the Designer window, click 'Palette > Media > Player'. Drag it to Screen 1 in the Viewer. Select 'Components > Player1 > Source and add'. Find the MP3 file of the purring sound, select it and choose 'OK'.

Everything is now in place, but the application needs to know to play the sound only when the cat is touched.

How to create an android app

Return to the Blocks Editor, select the tab 'My blocks' and click 'Button 1'. Drag the element 'when Button1.Click do' into the main editor screen. Now click 'Player1' and drag the element 'call Player1.Start' into the space within the existing element. Now click the cat to play the sound.

Back in the editor, choose 'Package for phone and download to this computer', and that's it.

Once you have the simple Hello Purr program running, you can stretch your wings a little. There's a wide range of tutorials for developing applications at App Inventor. These include a simple painting program, various quiz and arcade style games, and apps that use a phone's GPS chip to help find your way back to your car.

You can use and modify these programs to help you to develop similar ones. If you need to get more information about App Inventor, you can find out more about components, blocks and more in the Reference pages.



Tutorial: How to manage your files with your iPhone

Tutorial: How to manage your files with your iPhone

How to manage your files with your iPhone

Your smartphone is your true mobile companion. It has more computing power than it took to put a man on the moon. It's an always-connected PC, sitting in your pocket; yesterday's dreams made real. And, as such, your smartphone is the perfect device for dealing with your precious documents and files.

No other hardware has the power of internet connectivity, push notifications, compatibility with our PC operating systems, and most importantly, is omnipresent in everyone's lives, ready to be called on at a moment's notice.

Despite the smartphone's power to put files and documents at our fingertips, it can be surprisingly difficult to access them. One particular offender is iOS, which, despite being the operating system behinds the world's most popular handset, the iPhone, is totally inept when dealing with files.

We should point out that we're concentrating on iOS in this article, merely because it's the most restricted of the smartphone operating systems. Many of our tips will also apply to Android and BlackBerry handsets too. Grab the Dropbox app for Android and you'll be able to do many of the things we describe here.

Back to iOS, then. It hides its file system, it's unable to read files placed onto its memory using a USB connection, there's no microSD port for moving files physically, and Safari will plainly refuse to use web versions of online file systems such as Dropbox. It's like the anti-computer.

Even if you're able to access them - perhaps by connecting a camera connection kit to an iPad and inserting an SD card - iOS has little provision for reading files natively, so that essential Word document will be about as much use to you as an animated GIF of a gurning Jeremy Clarkson.

Luckily, what can't be done natively on the iPhone can mostly be achieved though the use of apps. You can extend your phone's functionality to add features, and when it comes to going mobile with your files, there are plenty of methods to choose from.

Dropbox

How to manage your files with your iphone

One of the first names that come to mind when dealing with file storage and distribution is Dropbox. And rightly so. This online cloud storage service has rocketed in popularity over the last couple of years due to its excellent connectivity options, fast speeds and intuitive interface. One of the best things about Dropbox is that it's multi-platform - you might already use it on PC or Mac through a desktop app or through the browser portal, which lets you to access the files you're storing from anywhere.

However, fewer people are aware of the rather excellent iOS version of the Dropbox app, which really puts you in control of your stored documents. If you're ever away from your PC, on the move or simply need to access an important file quickly, your smartphone can come to the rescue.

You can download the Dropbox app for iOS from the App Store free of charge. Once it's installed, tap it to open and you'll be asked if you're a Dropbox user. If you've used the service before, just add your details to access your files. If this is your first time using it, click 'I'm new to Dropbox'. There's a short signup process, which is kept to a minimum, then you're taken to your storage area.

Once you're logged into the app you can view any file that's been uploaded to your Dropbox and stored in the cloud from any system; this means your files can cross between Android handsets, PCs, email accounts, the lot.

There's also the option to view files, which is one of the few ways you can actually read documents that have been sent to your iPhone, given its usual stoic refusal to view anything other than PDFs and images.

Dropbox is able to natively display a host of image types, a variety of text documents and a string of other common file types besides. Unfortunately you can't make changes or amendments to the documents, and they will only open in a read-only mode.

Share and share alike

How to manage your files with your iphone

You can, however, redistribute files, which can be a godsend when you're on the move. If a colleague or family member has ever called you to ask for a file while you're enjoying a day off, it can often mean an irritating journey to your PC to send it.

Retrieving the file on Dropbox makes the process much easier. Open any file, even if it's in an unreadable format, and press the icon at the bottom left that looks like two linked chains. Choose 'Email link' and a new message containing a hyperlink will open using the iPhone's default mail programme. Send that to the recipient and they can download the file without any hassle, leaving you to get on with your day.

One weakness of using Dropbox on your iPhone is that there's little scope for uploading to the app. You can add files, but with iOS's limited file support you can only deal with your photos.

Thankfully, there's another way. Other apps that let you interact with your files can connect with Dropbox, letting you save your files in a central location. A great example of this is the email app provided with iOS. Scroll to the bottom of an email containing an attachment and tap it. When it loads, press the forward arrow in the top right corner. Choose 'Open in' and select 'Dropbox' from the list. The app prompts you to pick a location for it to be saved in before it's uploaded to the cloud.

Dropbox presents one of the simplest ways to control your files using your iPhone, and there's not a lot that it can't do.

However, mobile workers who use a host of FTP connections may find there's a lack of options on offer, and could be put off by the need to use the desktop application. Locked down corporate systems won't let you install the app either, which means it's a case of using the clunky web interface, which is never a good thing.

However, an iOS app called Air Sharing does offer a neat alternative.

Air Sharing and DiskAid

Air Sharing

How to manage your files with your iphone

While Dropbox is a fantastic way to access files when you're away from your PC, it doesn't put you in full control. If you're looking to really work remotely, try the Air Sharing app, which is available for £1.49 from the App Store. This features a host of functions that give you the power to turn your iPhone from a basic file reader into a powerful server.

In short, Air Sharing lets you use your iOS device as a portable hard drive, with your files stored wherever you go. You can access them via your phone, PC, Mac or via a web portal which offers 10GB of storage. You can even mount your iOS device onto your desktop as if it were a portable hard drive, which is particularly useful if you have a large capacity device; it may not matter to you if the phone itself can read the files if you're always carrying the equivalent of a large USB drive in your pocket.

The key benefit of Air Sharing over other types of mobile storage is that instead of storing your data in the cloud, it uses the physical memory on your iPhone. This means you can use up to 10GB of storage, rather than the measly 2GB provided with the free version of Dropbox.

It also means that you have a backup if you need a file when you're offline, and you may even get better speed running over Wi-Fi than you would over USB.

How to manage your files with your iphone

To get started, download the Air Sharing app from the App Store. There's a Pro version that costs £3.99 and has many more features, and you can upgrade at any time. Mounting your iPhone as a physical drive on your PC is easy. First you need to connect your iPhone to your home network, then open the Air Share app and press the wireless icon at the bottom of the home screen. This will open a small menu that contains important information about your account.

Put your iPhone to one side and turn to your PC. In Windows 7, click the Start menu and right-click 'Computer'. Choose 'Map network drive' from the list, then enter the IP address listed in your Air Sharing app into the 'Folder' field. Click 'OK' and a Windows Explorer window will open showing all of the files contained in your Air Sharing inbox.

You can also do the same on a Mac, if you're using one. Begin by right-clicking on the Finder icon in your dock, then choose Connect to Server. Use the same IP address as you would on PC in order to have the storage location mounted for seamless connection between Mac and iPhone.

The support provided by Air Sharing is also fantastic, and includes some difficult formats. There's iWork, Microsoft Office, HTML, RTF, PDF, movies, audio, and even source code, including C++. That could prove invaluable if you're a programmer.

If you're a mobile worker, Air Sharing has a few more tricks up its sleeve. Unlike Dropbox, it supports a wealth of FTP file sharing protocols, Home Pipe, MobileMe, and Dropbox itself, which gives you plenty of options.

You don't have to settle for FTP links to get more from Air Sharing; if you have Bonjour installed on your PC or Mac, you can connect using your web browser. This address doesn't change from session to session; just find it in Air Sharing's connections menu once and you'll always know exactly how to connect to your phone.

View your files on your PC

How to manage your files with your iphone

Air Sharing is a powerful tool, but it's possible to supplement or even replace it with a different, more hardcore application. DiskAid is a PC app that lets you explore the contents of your iPhone like any other drive. You can download a 14-day trial, after which you can pay $9.95 to upgrade to the full program.

Once the trial is installed, it will prompt you to connect your iOS device, which must be unlocked the first time so DiskAid can recognise it. You will then get a basic file tree view, which lists all your installed apps as well as general storage. This is the bit of iOS that Apple tries its best to hide from public view - the file system itself.

We're of the mind that Apple isn't trying to be deliberately awkward, though; Steve Jobs' philosophy, even back when he and Steve Wozniak were designing the original Apple home computers, was that they should be simple enough for anyone to use. There was even an argument in those early days; Woz had to fight hard for the Apple II's expansion slots.

Reminiscing aside, you can use the DiskAid app to transfer files to and from your iPhone's memory. Unfortunately it's not a straightforward case of dragging and dropping - the tools are located at the top of the DiskAid window. Click one of these to locate the file and the destination, and DiskAid will take care of transferring it to your memory. This does introduce one large issue: you'll need a machine with DiskAid installed to move files around on an iOS device, so it's not a universal solution.

If you're using Air Sharing, you can also find these files by choosing the app from the list located near the bottom. Click on the name to display a new folder containing all of your remote files. You can transfer these to your PC by clicking them and choosing 'Transfer to PC'. Just set the destination and your file will be copied across.

There are a few other file management solutions worth mentioning here. If you're looking to grab files straight from the internet and store them on your device, you could do worse than trying Downloads, a £1.50 app that especially suits MP3s, given that it has its own built in player.

Or, if you're looking to improve iOS compatibility with media files, try something like VLC Streamer, which plays back videos of all types, streaming them over your network.

Or why not try Screens, which lets you see and control your PC's desktop directly from your phone? It's pricey at £14, but worth the investment.

If you're really looking to take control of your files then iOS is far from perfect, but the huge range of apps on offer means you don't have to rely on USB sticks and clunky cloud web interfaces.

We heartily recommend anyone to try Dropbox, and the app is a great extension of a superb web service. Alternatively, Air Sharing is a fantastic service, especially if you go for the pro version.



Wednesday, 28 December 2011

Tutorial: How to choose the right password

Tutorial: How to choose the right password

The dangers of poor passswords

Passwords seem to be the modern version of the medieval hairshirt.

They seem to exist as an irritant to today's online life. You want access to your PC? Password, please. You want to add a Facebook status? Password! You want to check your bank account online? Password needed!

So, how do you create good ones? In fact, what are good ones? How do you remember them? How can you reduce the irritation?

In order to authenticate yourself to the systems you use every day – to prove to them that you are who you say you are – you use a password. This password, in theory anyway, is known only to yourself and the system you are trying to access – be it Facebook, Twitter, your bank, your email, your blog or anything else. It is a secret not to be revealed to third parties.

There is another essential piece to the authentication puzzle – your username – but this is generally your email address or your name in some concatenated form, and is easily discoverable. Your password is therefore the 'open sesame' that reveals everything about you. How can you make sure that your privacy remains intact and that the secret persists?

Let's approach the question from the viewpoint of a black hat hacker who wants to impersonate you for some system. To raise the stakes, let's assume that the system is your bank and the hacker wants to test your credit limit. How can he get your password?

Watch and learn

The first way is the simplest: he watches you as you type in your password. That way it doesn't matter how strong or weak your password is; the hacker just watches you enter it. I'm going to assume that you'd be aware of someone watching over your shoulder, so the question becomes how else could a hacker 'watch' you?

Back in March, RSA (producer of the SecurID systems used by corporations and the US Department of Defense) was hacked. Someone managed to gain access to internal systems and networks and steal secrets pertaining to the SecurID two-factor authentication key.

A couple of months later, they attempted to hack into Lockheed Martin, the defence contractor using them. How was this done? Simple – it was a phishing attack.

An email purporting to be about 2011 recruitment plans and containing an Excel spreadsheet was sent to several low-profile staff members at RSA, seemingly from a recruitment agency. The spreadsheet contained an embedded Adobe Flash object that in turn contained a zero-day vulnerability. Once the spreadsheet was opened, this malware installed a backdoor onto the machine, which gave the attackers access to the PC and the network.

At that point all bets are off. The attacker could install a keylogger and track exactly what you type at login screens – there goes a password. Even worse, they could download your system password files (those used by System Account Manager) and then crack them with a program like Ophcrack, which uses techniques like rainbow tables to reverse the hashed login data. There go all your passwords.

In fact, that last scenario brings up the whole subject of cracking passwords. There are two stages: guessing the password using some algorithm – usually brute-force by trying every permutation – and then validating the password against the system being hacked.

The issue with validating passwords is that many systems have built-in safeguards. Generally you only get so many attempts at trying a password before the system locks out the account being tried. Sometimes the system will also deliberately delay resetting the login screen by a few seconds to make trying many passwords extremely slow.

Note that a standalone Windows 7 machine has account lockout disabled by default, whereas a PC on a corporate network might have it enabled. If the system is embodied in a file – say the victim is using a password manager and the hacker has managed to capture the password file – the hacker's job is made much easier.

In essence, the online safeguards (limited number of password attempts, delay between attempts) are no longer in play and the hacker has free rein to try as many passwords as they like as quickly as possible. This is where the strength of the password comes into play.

Strength in numbers

When we access a new resource for which we have to create a password, we're generally given some guidelines for creating a strong password and discouraged from using weak ones. The guidelines usually include making passwords longer than some defined minimum (say, eight characters), not using normal words, using upper and lower case letters, and using numbers and punctuation symbols.

With luck, the screen where you enter your new password will have some kind of visual cue to show how good it is, like a progress bar coloured from red (bad) to green (good). The worst systems are those that limit your password to a low character count, restrict the characters used to just lowercase letters and digits, and so on. Such guidelines will automatically produce weak passwords.

The strength of a password is measured by its entropy, as a number of bits. The greater the number of bits the larger the entropy, and the harder it will be to crack the password.

Entropy is a concept from information theory, and is a measure of a message's predictability. For example, a series of tosses from a fair coin is unpredictable (we can't say what's coming next) and so has maximum entropy. Text in English – this article, for example – is fairly predictable in that we can make judgments about what's going to come next. The letter E appears far more often than Q, if there is a Q, it's likely that the next character will be U, and so on.

It's estimated that English text has an entropy of between one and 1.5 bits per (8-bit) character. In another sense, entropy is a measurement of how compressible a message is – how much fluff we can discard in compressing a message and still be able to reconstitute the original message at a moment's notice. If you like, the compressed message contains just the information content of the message.

We've all compressed a text file in a zip file to get 70-80 per cent compression or more; that is just an expression of the entropy of the text.

How to choose the best password

Password entropy

Let's apply this to a password. Suppose we are only allowed to use numeric digits in our password. In other words, our password is a PIN that we use to get cash from an ATM. Each character is selected from a set of 10, from 0 to 9. How many bits of entropy are there per character, assuming that each character is going to be selected randomly?

First of all, there are eight bits per character using an ASCII character set, but most of those bits can be discarded without losing the 'essence' of the digit. We can compress the characters to a simple binary code: 0000 for 0, 0001 for 1, all the way to 1001 for 9.

We can say there are between three and four bits of entropy for each digit (only 8 and 9 need four bits – the rest of the digits need three) and use a bit of mathematics to basically calculate log2(10), which gives us 3.3 bits per digit.

If the digits in the password are chosen randomly (so that the PIN isn't 1111 or 1234, for example), the digits are independent from each other. In other words, knowing one or more digits in the PIN doesn't help us guess the remaining ones. The total entropy in a four-character PIN is about 13 bits.

This means that guessing a four-digit PIN is equivalent to tossing a fair coin 13 times to get a particular sequence of heads and tails. Since there are 2ˆ13 (8,192) different ways to toss a fair coin 13 times, we have some appreciation of how many trials a hacker would have to make in order to break a PIN. I know there are 9,999 possible different PINs. I've rounded the total entropy down, but the error is insignificant and using bits of entropy makes the estimates for cracking a password easier to understand.

Bear with me. Now let's look at it from the hacker's viewpoint again. Let's say that using some specialised password-cracking programs, a hacker might be able to generate and try one million passwords per second. One million is roughly 2ˆ20, so another way of looking at this is that our hacker can test 20 bits of entropy per second.

Our PIN number would fall instantly. Luckily the issue with hacking PINs is the validation of them: hopefully your bank would lock the account after three invalid attempts or so. Still, this is a nice round number for evaluating the strength of a password: a password with an entropy of 20 bits will be cracked in one second.

Also, since there are approximately 2ˆ25 seconds in a year, we can estimate that our virtual hacker will crack a password with an entropy of 45 bits in a year. We'll call such a password a year-strong password.

Since every extra bit of entropy doubles the cracking time, we can estimate that a 50-bit password will take 32 years to crack. Doubling the speed of cracking will halve the time taken, and therefore require an extra bit of entropy to get us back to where we were.

Character traits

Now that we have a feel for the strength of passwords using entropy, we can try using different character sets for our passwords. For now we'll assume that each character in a password is chosen randomly; we'll talk about what happens if this is not the case later.

Let's add the characters A to F to our set of possible symbols. This is what WEP passwords were like on your old Wi-Fi router (WEP was deprecated in 2004).

There are exactly four bits of entropy per character. A 10-character WEP key (the original standard) would have 40 bits of entropy. A brute force attack would discover it in 2ˆ20 seconds, or 11 days. WEP suffers from other security issues, so a brute force attack wouldn't be needed in practice.

Now let's look at just using single case letters to form a password. Since there are 26 of them, we have 4.7 bits of entropy per character (2ˆ4.7 = 26). Let's suppose we want to have a year-strong password, then we would have to have a 10 letter password, with each letter being completely random. If you're using uppercase, lowercase and digits, that's a 62 element set, or just under six bits per character. A year-strong password would need eight characters, and these would need to be completely random.

Adding punctuation like commas, semicolons, question marks and so on would give us another 16 possible characters, to make 6.3 bits of entropy per character. A year-strong password would need about seven characters.

The biggest problem for us as humans when presented with completely random passwords is memorising them. It's possible with one eight-letter random password I suppose, although I'd hate to, but several of them would be a chore, especially if they involved punctuation.

A better option is to generate quasi-random (or random-looking) passwords. You could say these types of passwords have mnemonics built in and are nothing like '123456' or 'password'.

While we're discussing entropy and character sets, let's play around with another type of symbol set: the set of all words. To be more specific, suppose we have a list of 2,000 words. The entropy per word is 11 bits, since 2ˆ11 is roughly 2,000. How many random words from this list concatenated together would produce a year-strong password?

The answer is, surprisingly, roughly four. If each word is seven letters long or fewer, you'd be typing in 28 characters or fewer for your password. If the 2,000 words in the list were specially chosen to help evoke images in your mind, memorising the four-word password would be much easier.

Unfortunately, few services will allow a 28-character password. And how would you choose the words randomly? A computer program is one way, but if you just have the numbered list of words, you could try shuffling a pack of cards. Take out the court cards. Shuffle the rest well and deal out three. Counting 10 as zero and ignoring suits, you can read off a four-digit number between 0 and 999.

Now check the colours shown: if you have more reds than blacks, add 1,000 to your number. You now have a random number referencing one of your words in the list. Repeat this three more times to get the four random words.

As a final word, let's repeat the winner of the Best Gag award at the 2011 Edinburgh Fringe Festival. It was by Nick Helm and went as follows: "I needed a password eight characters long, so I picked Snow White and the Seven Dwarves." And on that note, I'm logging off and changing my password.



Monday, 26 December 2011

Tutorial: 50 tips to get you started with your new Mac

Tutorial: 50 tips to get you started with your new Mac

50 tips for your new Mac

Apple goes to great lengths to make your Mac as easy and as intuitive to use as possible, but that doesn't mean there aren't ways in which you can improve your experience even further.

Whether you're new to Macs and looking for a friendly guide, or a long-time Mac user who's hoping to glean some new approaches to familiar tasks, there's a tweak out there to change the way you use your computer for the better.

In this article we'll reveal 50 different tips and techniques for getting the most from your Mac. We'll cover fundamental aspects of using your Mac, from using Finder to browse your files, to switching between desktops using Mission Control. We'll even show you how to give your operating system a lick of paint with some handy customising pointers.

All of the tips in this article work with OS X Lion, but the vast majority also work with Snow Leopard too. So sit back and prepare to enhance the way you use your Mac.

01. Manage what starts with your Mac

startup

Do certain programs you rarely use insist on starting with your Mac? Or maybe you have a number of applications you always use that you'd like to start automatically when you first log on each day, saving you the bother of doing so manually.

To manage your startup items, open System Preferences > Users & Groups. Select your user account and click the Login Items tab to see what's starting with your Mac. Unwanted items can be removed by being selected and then clicking the '-' button.

To start a favourite application with your Mac, click the + button instead, then click the Application link under Favorites to locate the app you want to launch at login time. Select it and click Add. If you want the app to start in the background, tick the Hide box before closing Users & Groups.

02. A smarter way with folders

Smart folders

Smart folders enable you to build up customised folders containing files of a certain type, name or whatever criteria you choose. The files are left in their original location - instead the smart folder is basically a set of links to those files, so you can have the same file contained in more than one smart folder without creating copies to clutter up your hard drive.

Smart folders are created by saving the results of a search you've performed, and they can be created in a number of ways: choose File > New Smart Folder. Type your search term - a name, for example - then click the + button to start adding filters to restrict what files are displayed: for example, to search only for image files, choose Kind followed by Image. Add more filters if you wish.

Once the results are to your satisfaction, click Save, give your smart folder a name and leave Add to Sidebar ticked if you want to be able to access it from the Finder sidebar.

03. Window management tweaks

Resizing application and Finder windows can be a bit tricky, which is why Lion has introduced a number of great new features that will appeal to many.

First and foremost, you no longer need to grab a corner of the window to resize it - you can now resize by clicking and dragging on any part of the window edge. If your window is the right aspect ratio, but the wrong size, hold down the Shift key as you drag it, and it will resize proportionally. If you'd like to make it wider or taller at both ends, hold the Option key when you click and drag one edge, and the other edge will resize at the same time too.

You can also move windows when clicking on an edge by first dragging in the wrong direction - for example, drag up or down when clicking on the left or right edge. Once it's moving, you can drag the window in any direction.

04. Resize an app to full-screen

Full screen

Lion introduces full-screen support, which allows supported apps to take up the entire window. Not all apps are compatible, and Snow Leopard users may be feeling a little out in the cold.

One workaround is to install a free program called Right Zoom for Mac. This little gem 'fixes' the green zoom button in selected applications or Finder windows, so when clicked the window will always resize to the full available width and height of your desktop. It's not as good as full-screen mode, but it's a decent substitute.

Once downloaded, unzip Right Zoom and drag the app to your Applications folder before launching it. You'll be prompted to configure it before use: tick Activate Right Zoom to get started and work your way through the options, which allow you to restrict its use to specified apps or when you hold the Option button as you click the green maximise button.

05. Revamp the startup screen

Boot logo

Fancy changing the background colour and logo that appears when your Mac boots? It's a simple procedure with a free tool called BootXChanger; it sadly doesn't work with newer Macs including the 2011 MacBook Pro, Air and Mac mini. It should work with older Macs, though, even those running Lion.

BootXChanger is refreshingly simple to use, considering what it does. Follow the link above to download the app. Once that's done, open it and then drag your choice of logo - nine alternatives are supplied in the Sample Boot Images folder - onto the program window.

Next, choose a new background colour, click Apply and reboot to see the fruits of your handiwork. You can use any square PNG image - try to keep the size down below 512x512, or as little as 90x90 if possible - but we recommend using the Chrome Apple logo with a white background for a really classy startup look.

06. Customise file and folder icons

File and folders

Icons help identify what's going on, but sometimes you might feel uninspired by a particular icon being used, or find folders hard to find in a sea of identical-looking icons. The good news is that customising your icons is a simple affair with two basic choices.

The first is to assign a colour label to the selected folder or file name - choose File > Get Info in Snow Leopard, or simply pick a colour label from the File menu in Lion.

Alternatively, change the icon itself. First, locate one - it can be another file or folder icon, or an icon file (search Google for 'free mac icons'). Select the file containing your chosen icon and press Command+I. Click the icon and press Command+C, then open the Information pane for your target file or folder, select its icon and press Command+V to replace it.

07. Manage the Launchpad

Launch control

Launchpad, which was introduced in Lion, was inspired by your iPhone or iPad's home screen. It gives you quickfire access to all of your apps from a single location, but it needs to be tweaked to reflect your needs before it can be deemed truly indispensable.

Start by organising your icons in the order you want them to appear. You may also want to move icons between pages: to do this, just drag the icon to the left of the screen to move it to the previous page, or the right to place it on the following page.

You may also want to restrict the Launchpad so that it only shows your choice of application. To do this requires a free program called Launchpad Control, which installs into System Preferences under Launchpad. From here, simply untick the items you wish to hide and click Apply to streamline the Launchpad. Re-tick an item to make it visible again.

08. Switch between open applications

Switcher

If you've got loads of windows and apps hidden away to prevent desktop clutter, switching between them can be tricky. Hold down the Command key and press Tab to launch an icon-based task switcher.

You can use Tab and Shift+Tab to move between them, before hitting Return to switch to that application (you can also press Q to quit it, or H to hide or show its windows). Want more detail? Hit 1 and the Exposé Application Windows mode takes over. This gives you a preview of all the windows currently opened by the selected app.

Move between windows using Shift and Tab keys, using [Space] for an up-close preview of the currently selected window. Jump to the next app in the list with Command+'. Hit Return to select the current window and return to the desktop, or Esc to simply exit back to the desktop.

09. Search by Spotlight

Spotlight search

You don't need to open Finder to initiate a search for files and documents on your hard drive: you can also search your Mac directly from the menu bar using the Spotlight magnifying glass icon in the top right-hand corner. The results appear via a drop-down menu, which are helpfully organised into file types, and clicking one opens it.

That's as far as it goes for Snow Leopard users, but Lion users should revisit the Spotlight bar as a number of useful enhancements have been added. First, you can now get a preview of any search result simply by moving the mouse over a specific file and waiting for a pop-up to appear.

Second, hold Command+Option as you roll the mouse over a file and its path will be revealed underneath the QuickLook window. Finally, hold Command as you highlight a document and the first instance of your search term will be highlighted at the same time.

10. Limit the scope of your search

Spotlight b

By default, Spotlight (top-right of the menu bar) will search in no less than 15 categories, including various file and document types, applications and System Preferences. When you perform a search, you can narrow the results to specific file types by choosing Show all in Finder to open the results in a Finder window.

Click the + button next to Save and click the Any drop-down menu to limit your search accordingly. Want to search two or more file types? Simply click the + to add another file type to the list.

If you would like to limit future searches to specific types, resulting in faster searches, open System Preferences and choose Spotlight. Simply untick those categories that don't interest you, and Spotlight will helpfully ignore those file types in future searches.

You can also ban Spotlight from searching specific folders on your Mac: switch to the Privacy tab and either drag a folder into the window, or click + to add it manually.

11. Change your desktop background

Desktop background

If you're bored with the backdrop that greets you every time you boot your Mac, it's time for a change. Open System Preferences and select the Desktop & Screen Saver > Desktop tab.

From here you'll find a number of different backgrounds to choose from - if you can't choose between them, tick Change picture and rotate the background at set intervals, from a frankly ridiculous five seconds to a more sedate daily switch. Also tick Random order to prevent the selection getting stale.

A large number of backgrounds are provided, while you can also select something more personal from an iPhoto collection or your Pictures folder. Add additional folders by clicking + to select them. If you're going for something personal, try to resize or crop it using Preview's Tools menu to match the dimensions of your desktop. If you don't know what it's currently set at, find out from the Displays System Preferences pane.

12. Master Lion's new Finder features

Finder

The Finder has been overhauled in Lion to provide a number of useful new features. There's a new smart folder called All my files that appears in the sidebar, for example; clicking it lets you view all of your documents and other personal files, all arranged according to their type.

There's also a new button that lets you quickly choose how your files are arranged without having to select Show View Options first. There's also a new option (Date added), which is especially useful for folders like Downloads.

One thing that's missing by default from the new Finder - which may annoy you - is the status bar. Getting it back is simple enough though: just press Command+/ to toggle it on or off.

13. Lock your Mac

Screensaver

Do you frequently leave your Mac unattended and get frustrated at the hoops you have to jump through in order to 'lock' it, so it can't be used until you return? Then read on for a handy hint that shamelessly steals one of the better ideas from Microsoft Windows.

First, pick a screensaver that you'd like to use while your Mac is left unattended: open System Preferences and choose the Desktop & Screen Saver > Screen Saver tab to do so. If you don't want the screensaver coming on at any other time, set the Start Screen Saver slider to Never.

Now return to System Preferences and this time select Security & Privacy. Tick Require password immediately after sleep or screen saver begins. Close System Preferences and when you next go to leave your Mac, press Ctrl+Shift+Eject to trigger the screensaver and lock your Mac.

14. Work with multiple desktops

Mission control

While you can keep your desktop reasonably clutter-free by minimising open windows, it isn't the most convenient way to work. A better way is to make use of Spaces (Snow Leopard) or Mission Control (Lion), which enables you to set up to 16 virtual desktops, allowing you to both assign windows to different desktops and then switch seamlessly between them.

Lion users can quickly access Mission Control by pressing Ctrl+Up Arrow, but Snow Leopard users need to enable the feature first: open System Preferences and choose the Exposé and Spaces > Spaces tab. Tick Enable Spaces and - for easy access - Show Spaces in menu bar.

Four desktops are set up by default in Spaces - click Add Rows or Add Columns to add more. New desktops are added to Mission Control by either dragging a window into empty space to the right of the desktop or by clicking the + button that appears in the top right-hand corner.

15. Manage multiple desktops

Assign apps

Applications can be manually assigned to a specific desktop simply by launching them when that desktop is visible. You can also move windows between desktops in Mission Control simply by clicking and dragging their preview window to the new desktop.

Better still, you can configure applications to open in specific desktops, allowing you to effectively configure one desktop for web browsing, another for productivity apps like image editing and so on.

Lion users can assign an application to a specific desktop by right-clicking its Dock icon and opening the Options sub-menu to choose between one desktop, all desktops or - the default behaviour - no desktops.

Snow Leopard users should open the System Preferences > Exposé and Spaces > Spaces tab, then click the + button to assign open applications (or click Other to browse for one) to a specific desktop, or Every desktop if you want it universally available (recommended for key tools like Finder).

16. Set up your Dock icons

dock setup

The Dock is an incredibly useful tool, giving you quick and easy access to various parts of your system, but it pays to take the time to set it up exactly how you want it to operate.

Start by customising the Dock so that it conveniently shows your favourite applications. Remove unwanted icons from the Dock simply by dragging the icon onto your desktop, where it will disappear into a puff of smoke. Next, add favourite applications to the Dock so they're permanently visible: open the Applications folder and simply drag your app's icon onto the Dock in the place where you want it to lie in the list. Make sure it's to the left of the dividing line that appears between app icons and stacked folders.

Once done, rearrange your app icons into a logical order by dragging and dropping them into place on the Dock. (You can resize the Dock on the fly by click-dragging the separator up or down with your mouse.)

17. Change the Dock's behaviour

dock prefs

Want to change certain aspects of the Dock's look, as well as hide it from view until you need it? You'll find most options available under the Apple > Dock menu, but to take full control of the process, open System Preferences and select Dock.

From here you can resize the Dock plus set a magnification level that makes highlighted icons more visible. You can choose to place the Dock on the left or right of the screen, plus set the Dock to automatically hide when it's not being used (just drag the mouse to the screen edge where the Dock is to reveal it).

By default, all minimised windows are displayed as thumbnails between folder stacks and the Trash: tick Minimize windows into application icon to disable this behaviour.

18. Working with Stacks

Stacks

Drag a folder right of the dividing line on the Dock and it will create a 'stack' of that folder's contents, which appear when you click the folder icon. Stacks display their contents in Grid, Fan or List view - switch views by right-clicking the folder.

Files and folders can be moved from the stack to the desktop or a Finder window simply by dragging them to the appropriate location - hold the Option button to copy them instead.

If you're a Lion user you can even move or copy files between stacks in this way: open the first stack, drag the file onto another stack folder and either let go or wait for the folder window to open, allowing you to place it precisely. Lion users can preview individual stack entries by placing the mouse over it and pressing the [Spacebar] for a preview of the file.

19. Populate your Dashboard

Dashboard

The Dashboard lets you place a number of useful information-based tools called widgets on your desktop. A small number are enabled by default, but getting more is easy: click the + button at the bottom left of the desktop to add more.

You'll also find thousands more widgets online: check www.apple.com/downloads/dashboard. Once downloaded, you can preview a widget without having to install it: double-click the zip file to extract the widget, then double-click the widget itself.

When prompted to install, hold Command+Option and the Install button will become a Run one. Click this and the widget will open in your Dashboard, but when closed it will disappear. This allows you to give the widget a test drive - if you subsequently don't like it, just close it and delete the downloaded file. If you want to keep it, just double-click the widget file again, this time choosing Install to add it to your Dashboard.

20. Automate repetitive actions

You can't master the powerful Automator tool in a single tip, but you can get a flavour of its usefulness and power by following this simple tweak, which allows you to create a thumbnail quickly and easily by automating a number of otherwise repetitive actions.

Open Automator from the Applications folder. Select Application and click Choose. Select Photos under Library and ignore the restrictive Create Thumbnail Images option.

Instead, drag Change Type of Images across, clicking Don't Add when prompted. Pick your chosen output format - PNG or JPEG in most cases. Now drag Scale Images across - again, click Don't Add - and choose an exact pixel size (width) for your thumbnail.

Finally, select Files and Folders under Library and drag Rename Finder Items across, click Don't Add for a third time, and tweak it to Add Text (for example _thmb) after the filename. Save your application and test it by dragging image files onto it to automatically create thumbnails.

30 more Mac tips for new users

21. At your Service

Services

Automator can be used to create menu items and other useful features where none exist in OS X. These are created by launching Automator and choosing Service. Would you like to right-click a file and print it without having to open it in its parent app first?

Select Utilities under Library and drag Print Finder Items. Set the Service receives selected drop-down menus to files and folders in Finder and save your finished service with a suitable name (such as Print this file). You can access it by right-clicking any file and choosing Services > Print this file (or whatever name you gave it).

All services are stored in your user's /Library/Services folder (this is hidden in Lion - hold down Option as you open the Go menu in Finder to access it). Should you later decide you no longer want a service, simply trash it from here before logging off or restarting.

22. Launch apps via the keyboard

Keyboard

Imagine being able to avoid using the Dock or the Applications folder to open your favourite program. Well imagine no more, because thanks to Automator, you can create services that allow you to do just that.

Launch Automator, select Service and click Choose. Next, set the Service receives drop-down menu to no input. Then select Utilities under Library and then drag Launch Application into the right-hand window. Now select your chosen app from the drop-down list, then choose File > Save to save the service.

Now close the Automator app and open the Keyboards System Preferences panel. Switch to Keyboard Shortcuts and choose Services from the left-hand menu. Scroll down to the bottom of the list and double-click in the blank space to the right to set your chosen keyboard shortcut. Hold down the desired shortcut keys, then make sure the service is ticked. Finally, log off or restart your Mac to test it out.

23. Tweak Lion's Resume settings

Lion's new Resume feature has all the trademarks of Marmite: you either love it or hate it. Things aren't helped by the lack of customisability in Lion itself.

You either switch off the state-saving feature for all supported apps (open System Preferences > General and untick Restore windows when quitting and re-opening apps) or you leave it on and struggle to remember to manually press Command+Option+Q each time you quit an app you want to restart with a clean slate.

Thankfully there's a third way in the form of TinkerTool. Switch to the Resume section and you'll be able to pick and choose exactly which applications are allowed to save their window states when quitting. So now you can restore windows on well-behaved apps while preventing others from opening windows you have no need for.

24. Undo unwanted Lion touchpad tweaks

It can be awkward using the touchpad to drag multiple items around, which is why lots of people swear by the tap-drag method: choose your items, then tap and release, before tapping and holding as you drag your selection around the screen.

At first glance, it appears that Lion has ditched this functionality, but before tearing your hair out, relax: it's simply been disabled as default behaviour. To get it back, open System Preferences and select Trackpad, then tick Dragging (with/without) Drag Lock.

When it's enabled, Lion will even display an iOS-like badge telling you how many items you're currently dragging around the screen. You can also undo another trackpad-related change from the same panel: reverse scrolling (Apple chooses to call it 'natural scrolling'). While some may find the new system intuitive, others will no doubt gratefully untick the option labelled When using gestures to scroll or navigate, move content in the direction of finger movement.

25. Get fast folder access

If you frequently access a specific folder, add a convenient link to it in the Finder sidebar. Open Finder, locate the folder in question and then drag it to the sidebar's Favorites (Lion) or Places (Snow Leopard) section. Rearrange icons by dragging and dropping them in the desired order. Once that's done, clicking this link jumps straight to that folder's contents in future.

26. Streamline the Finder sidebar

Too many unwanted items appearing in the Finder sidebar? You can strip them out by opening Finder and choosing Finder > Preferences. Select Sidebar and you can untick those items you rarely use.

You'll also find one option is de-selected by default under Devices - tick this if you want one-click access to all of your computer's drives and network shares from the sidebar.

27. Make use of Recent Files

Your Mac remembers recently opened applications, documents and servers. So if you want to quickly reopen something you were just working on, click the Apple menu and choose Recent Items to select it from the list. Many applications also store a recent documents list too, accessible from their File menu, Open/Save dialog boxes and - in Lion - when you right-click an application icon on the Dock.

28. Create network drive shortcuts

Save yourself time connecting to favourite shared folders by creating shortcuts to them. Open Finder, choose Go > Connect to Server and connect to the shared folder. Once its icon appears on the desktop, right-click it and choose Make Alias. Use this shortcut to connect to the folder in question via a quick double-click in future.

29. Reveal the Library

The Library folder has been hidden in Lion by default, but thankfully there's an easy way to access it without having to show all the hidden folders on your Mac in the process: just open Finder's Go menu and hold the Option key - you'll see the Library appear between Home and Computer on the list. Just select it to open your personal Library folder.

30. Delete sensitive items securely

When you drag an item to the Trash and then empty it, the file in question is actually still present on your hard drive until the space it resides in is written over by other data. Click and hold the mouse button over the Trash icon, then hold the Command key to reveal the Secure Empty Trash option. Select it to more thoroughly wipe private files from your drive.

31. Create semi-opaque sticky notes

The Stickies application allows you to paste reminders all over your desktop in the form of sticky notes in various colours and styles. If you find your desktop's getting overwhelmed by all of your notes, you can make individual notes less visible: select the offending note and select Note > Translucent Window. Select Note > Use as Default to make all new notes semi-transparent too.

32. Login quickly

If you share your Mac with others, you may find having to log in each time you start it gets to be an annoyance. Fortunately, you can bypass it: first open System Preferences > Users & Groups; click the lock, then click Login Options, pick your user account from the Automatic login drop-down menu and enter your password to boot straight to your desktop in future.

33. Switch between locations quickly

If you find yourself moving your MacBook between different networks, you might have to configure different settings for each network you connect to. Open System Preferences and select Network, then click the Location drop-down menu and choose Edit Locations.

Click + to create a new location, give it a name and click Done. Then fill in the details you need to access that network by way of an Ethernet cable or wireless connection. Switch between networks using the Location drop-down menu.

34. Change the Launchpad background

When opened, the Launchpad overlays a blurred version of your desktop background image. If you don't like this, you can easily change it: with Launchpad open, press Command+B and the background will change to black and white.

Press it again for a blurred black and white image, and once more for a regular colour view of your desktop. If you want to return it to its original setting, just hit Command+B for the fourth and final time.

35. Reveal more detail in your search results

Being able to sort your search results a number of ways can be advantageous when you're trying to pick a single file from dozens or even hundreds scattered all over your hard drive. One quick way to track down a file is by searching for the date that it was created or modified.

By default, Finder search results don't include this information, but by simply right-clicking anywhere in your search results window and choosing Show View Options, you can add additional information, including Label, Date Created and finally, Date Modified.

36. Spotlight drag and drop

It gets even better for Lion users rediscovering the joys of Spotlight: you can now drag and drop Spotlight search results out of the window for a myriad of purposes. Drag them to a Finder window or the desktop to create copies while the originals are left untouched.

More excitingly, you can drag and drop Spotlight results into an email, or share it with other users via AirDrop, making Spotlight a great time-saving tool.

37. Preview files in Finder

Want a quick preview of a selected file? Just press the [Spacebar] to activate QuickLook for a quick peek. Snow Leopard users can also zoom into a thumbnail of selected images in Finder's column view: with the preview visible, hold the Option key as you click on it to zoom into the image, or Shift+Option to zoom back out again.

When you're zoomed in, you can easily pan around the image using the mouse. This also works on the image's preview when you select it and choose File > Get Info in Finder.

38. Manage AutoCorrect for different apps

A large number of built-in applications - including Safari and Mail - make good use of AutoCorrect, but sometimes it's a hindrance rather than a help. Fortunately you can do something about it.

Manage it by opening System Preferences and choosing Languages & Text > Text tab. From here, tweak its settings or disable it entirely (untick Correct spelling automatically). The changes come into effect when apps are relaunched. You can also disable it on an app-by-app basis. To do so, place the cursor in a text field then choose Edit > Spelling and Grammar > Check Spelling Automatically to remove the tick.

39. Enable AirDrop on any Mac

AirDrop makes it simple to share files between two Macs on the same network, but it apparently only works on newer Macs that support a particular type of Wi-Fi connection. If you've upgraded your Mac to Lion and discovered it doesn't appear to support AirDrop, don't fret.

Open Applications > Utilities > Terminal and type the following command on all the Macs you wish to enable AirDrop on, even those which it already supports:

defaults write com.apple. NetworkBrowser BrowseAllInterfaces 1

Restart each Mac, and AirDrop should now be accessible to all Macs running Lion on the same network.

40. Switch between desktops quickly

Moving between your virtual desktops can be done from the menu bar or Dock icon, or by clicking on an app's icon in the Dock itself. Alternatively, use your keyboard: press Ctrl+" or ' to quickly move to adjacent desktops, or jump straight to a specific desktop in your spaces via Ctrl+1, 2, 3 or 4.

These latter shortcuts are disabled in Mission Control, but fortunately you can get them back: simply open System Preferences and select the Keyboard > Keyboard Shortcuts tab. Choose Mission Control and then tick the relevant boxes next to each Switch to Desktop... shortcut you want to use.

41. Reveal hidden menu bar options

Click on an application or system tool's menu bar icon and you'll see a list of options appear via a drop-down menu. All very useful, but if you hold the Option key as you click you may find some alternative options popping up: verify your backups in Time Machine, for example, or perform a diagnostic test on your Bluetooth connection.

42. Cut, paste and consolidate files

Lion introduces two handy features for managing files in Finder: the ability to easily move files from one location to another, plus an option for consolidating a selection of files into a single folder.

To move files from one location to another, select your choice of folders and files, and press Command+C to copy them, followed by Command+Option+V instead. The files will be moved here, and deleted from their original location.

To move a group of files into a single folder, simply select the files in question and press Command+Shift+N, then rename the folder to finish.

43. Identify your virtual desktops easily

You can assign a different background image to each virtual desktop in Lion (these were known as Spaces in Snow Leopard), helping you identify which is which. First, make sure you right-click the System Preferences Dock pane and choose Options > All Desktops. Then simply switch to each desktop in turn using Mission Control and open the Desktop & Screen Saver Preferences pane to set a unique background for that desktop.

44. Change the Login screen's background

If you're running Lion, start by preparing your replacement 'texture' - a 256x256-pixel image in PNG format. Type 'texture background' into http://images.google.com if you're stumped for inspiration.

Once the image is resized and converted, rename it NSTexturedFullScreen BackgroundColor.PNG. Browse to /System/Library/ Frameworks/AppKit.framework/Versions/C/Resources, back up the original and then copy your new image here, overwriting when prompted.

Things are slightly different in Snow Leopard: you need to create a JPG file in the same native resolution as your display, named Aqua Blue.jpg. Browse to the folder /Library/Desktop Pictures, back up the original and replace it with your new image. (In Terminal, Type chflags nohidden /Library/ if your Library folder is hidden.)

45. Set your Dashboard free

In Snow Leopard, your dashboard widgets are designed to float on top of your desktop, but in Lion they've been assigned their own dedicated desktop space. If this change doesn't suit, you'll find that, thankfully, setting your Lion widgets free is a straightforward task: just open System Preferences and select Mission Control, then untick Show Dashboard as a space.

46. Take screen captures quickly

You can quickly take screenshots using one of two handy keyboard shortcuts: hold Command+Shift+3 to grab the entire screen, or Command+Shift+4 to grab a selected area. You can press [Space] to capture selected windows instead.

47. Magnify images in Preview

A new feature in Lion allows you to magnify a selected area of the currently loaded document or image. Switch it on by pressing the ' key and you'll see the magnifier appear - just move it around the image using your mouse. You can easily alter the magnifier's magnification using the + and - keys.

48. Animation in slo-mo

As you've no doubt noticed, your Mac is blessed with some fabulous animation effects as windows swoop, desktops slide into place and more besides. Sometimes, though, you might appreciate a slower pace to things, and there's a keyboard shortcut for that: the Shift key. Just hold Shift as you click Dashboard, Launchpad or a desktop in Mission Control, for example, to see what we mean.

49. Perform Spotlight calculations

Click the Spotlight icon, type in a sum and the search results will include a calculation courtesy of the built-in calculator. It supports some advanced commands - try sqrt(9) for example - but it's not always accurate and is best left for simple arithmetic. Remember, you can access the main calculator from the Applications folder for complex calculations.

50. Access Dock from full-screen apps

One of the few drawbacks of running apps in full-screen mode in Lion is that the Dock appears to be inaccessible. In fact, you can still access it directly from full-screen mode: just move your mouse down to the bottom of the screen as normal, then lift it before moving it down again, at which point the Dock appears.