May 07

Building a great website is tough, but finishing the code and layout is only half the story. Too many sites have problems after going live because they weren’t tested properly first. Lots of things can and do go wrong, from poorly formatted code that some browsers choke on, to pages that break when opened on other platforms. If you developed your site on a Mac, what guarantee do you have that it’ll look the same on a PC, for example?

Your site is a prism for browser light. Make sure it’s not a flawed one.

Even now, when HTML structures are likely to be served as part of a CMS template system, it’s important that all the basics are in place. You need a soak test: a checklist of crucial areas that you can test are working before the site goes live. That’s exactly what we’ve put together here. Follow our tips and your site will be as problem-free as possible.

Clean up your code

Clean, glitch-free code with no stray tags or unclosed comments looks better, is easier to edit and is less likely to spring surprises on you when your site goes live. WYSIWYG web authoring tools already include features for tidying up your code. Let’s face it – some of us really need them. Dreamweaver will even format and indent your HTML following your configuration guidelines. Go to ‘Commands | Clean Up HTML’ or ‘Clean Up XHTML’.

We prefer to run static code through HTML Tidy, which is available as a stand-alone program from http://tidy.sourceforge.net/#binaries, or as a plug-in for manual code-editing tool NoteTab Light. The software deletes stray tags, adds any missing tag elements and completes open tags for you.

Meet HTML standards

Compliance with World Wide Web Consortium (W3C) standards makes your sites more accessible and usable, and also helps them to perform well on multiple platforms. You can see whether your site is compliant with XHTML and CSS standards by using W3C’s online validation tools. You’ll find the main testing page at http://validator.w3.org. This gives you a full breakdown of all the syntax and code errors in any page submitted. You can then update your code in accordance with the guidelines. Don’t be disheartened if your site fails. Some of the web’s biggest sites have XHTML errors according to the validator, including Google and Microsoft’s homepages.

There are numerous tools online that will validate your site for compliance with the relevant standards.

To use the W3C’s validation tool, go to http://validator.w3.org and enter the URL of the web page you wish to test. You can also upload code from a local machine or paste HTML mark-up into the Direct Input box. The validator can only check one page at a time.

Meet CSS standards

There’s a second service available to help you check and correct CSS scripts. It can be found at http://jigsaw.w3.org/css-validator. Again, you can point the validator to a version of the file you wish to check online, upload the code or paste it directly into a box.

The errors returned come with detailed explanations of how you can fix them. The validator will identify even the smallest of problems, including missing line terminators and brackets.

Enable resizing

Remember the early days of the web, when sites came with front-page disclaimers such as ‘Optimised for Internet Explorer at a resolution of 800 x 600 pixels’? How we groaned. Don’t forget that people are viewing your site on different platforms, with different display settings and monitor resolutions. Enabling your page to resize to any browser means that it will work better on multiple platforms, from desktop machines to handheld devices. The key is to use percentage sizes when creating <div> layers rather than specifying fixed sizes. It’s a tough habit to get into, especially if you’ve become used to creating exactly positioned layouts.

Resizer is essential for testing the flexibility of your site’s design.

First, check that your site looks good on the largest monitor size your setup can muster, then work backwards – down to 800 x 600 pixels. Right-click your Windows desktop and choose ‘Properties’. Click ‘Settings’ and you’ll be able to change your default desktop resolution using a slider. If you use Vista, choose ‘Personalise’ from the contextual menu instead. It’s even easier in Windows 7 – there should be a right-click menu item labelled ‘Screen Resolution’. Some video card control panels let you do this without venturing into Windows’ display settings.

Test on all browsers

It’s important to make sure that pages look the same in the big five browsers: Internet Explorer, Firefox, Chrome, Safari and Opera. Fire up your site in each of these and make a careful comparison. Here’s a quick tip: if you have two browsers open showing the same page, right-click on an empty part of the Windows taskbar and choose ‘Tile windows horizontally’ (or ‘Show windows side by side’ on Windows 7). This makes it easier to spot differences.

Five browsers on one system may seem like overload, but there are ways to cut that down. If you’re a Firefox user, you can install IE Tab, a plug-in that enables you to view pages using Internet Explorer’s rendering engine. There’s also Chrome View, which renders pages in Firefox using Google Chrome. In short, get Firefox.

Test on Macs and PCs

Your pages should look the same on Macs as they do on PCs running Windows, whether you have access to one or not. The best method is to borrow a Mac to test your site. If you’re developing for a professional audience, you can employ the services of Browsercam instead.

The Litmus test. Run your site through actual browsers on actual operating systems. For a price…

Litmus uses a bank of testing machines running multiple browsers on all the main OSes. For a subscription fee of $49 (£30) a month, it lets you test an unlimited number of web pages. You enter your site’s URL and receive screenshots as it appears on Macs and Windows systems running any of 24 web browsers. Most of the important ones are included, with different iterations of Firefox, IE and Chrome on Windows, and Safari and Camino on the Mac. The only current important omission we can spot is the Mac version of Chrome. $39 (£24) buys you a 14-day ‘project pass’, which is a good choice if you only have a single site to test.

Testing for free

These are trying financial times for most of us, so here are a couple of free solutions. The runaway leader is Adobe Lab’s Flash- and Flex-based BrowserLab. It’s similar to Litmus in that it gives you a side-by-side view of a given URL in a set of chosen browsers. The tool is currently in limited beta and you’ll need an Adobe user account to use the service. Once in, you enter a URL, pick a browser and platform (or choose from the default browser set), then pick your view. As well as side-by-side comparisons, there’s an ‘Onion Skin’ mode that helpfully enables you to see the output of one browser laid over that of another. BrowserLab renders pages using the main browsers on Mac and Windows.

If you’re unable to access BrowserLab, BrowserShots was once a favourite of ours and is still good for checking multiple versions of Internet Explorer on Windows. Support for Macs has waned, but there are Linux- and Windows-based WebKit browsers included. WebKit is the rendering engine used in Apple Safari, and Google Chrome uses a tweaked version.

Check your gamma

A perennial brain-ache for designers working on Macs and PCs is that, until recently, Mac displays had different default gamma settings to PC monitors. These settings determine the relative brightness of the screen. PCs have a gamma setting of 2.2, whereas Macs had a gamma setting of 1.8. We say ‘had’, because that changed with the release of OS X 10.6 (Snow Leopard), which sets display gamma to 2.2 – the same as PCs and TVs. Even so, many people still use older Macs, and there’s a disproportionate number of Mac-based designers. The result? Images produced on pre-Snow Leopard Macs can look muddy on PCs, while PC-created pics can seem washed out on older Macs. The solution is to check images at both gamma settings to make sure they look OK either way.

You can never be entirely sure of the look of your site, but it does pay to test varying gamma settings.

Adobe Photoshop has a built-in Mac (or PC) gamma preview feature. Select ‘2 Up’ in the Save for Web dialog, then set an image to render using the setting ‘Macintosh (no colour management)’. It’s arguably more important that Mac-based designers get it right than PC users – and if you’re a Mac owner, you can switch your display to PC gamma in the Display section of the System Preferences panel. Click ‘Colour’, choose the current profile and click ‘Calibrate’. Work your way through the Display Calibration Assistant and choose ‘2.2 Television Gamma’.

Buy a Mac

If you have a lot of sites to test, it might be worth investing in one of Apple’s diminutive Mac Minis. They start at £510 (or even less on the second-hand market), are small, stylish and make excellent media centre PCs. Load yours up with Google Chrome, Camino and Firefox and you’ll be ready to test as many sites as you need to. You don’t even need to leave your PC to do so – you can use free remote desktop software TeamViewer to access and control any application on a TeamViewer-equipped Mac from a PC, or vice versa. The machines don’t even have to be on the same LAN, because connectivity is routed over the internet.

DDA accessibility

Your site needs to be accessible to all users – that’s the law. The Disability Discrimination Act is the main legislation covering this area, and the guidelines you need to match have been laid out by the World Wide Web Consortium. Full details are at www.w3.org/WAI.

Accessibility testing will help make your site available to all potential visitors.

There are fewer online accessibility testing services available in 2010 than there were in 2000 because many of them have become commercial. For example, you can use Adobe Dreamweaver to produce an accessibility report. Go to ‘Site | Reports’, then go through the Accessibility section to select elements to test.

Fujitsu offers a free tool that does a similar job, letting you test your site locally on Windows or Mac OS X. Download the Web Accessibility Inspector from www.bit.ly/aDgNZD. There’s also the Fangs screen reader emulator (www.bit.ly/bDhCfQ). It’s an add-on for Firefox that shows you how your pages will be seen by readers, enabling you to tweak the textual content.

Speed

The need for speed never went away – you should still optimise images and link to multimedia rather than embedding it directly. This is particularly pertinent in the light of Google’s recent admission that page speed is a component of its labyrinthine page rank algorithm.

OctaGate SiteTimer is a free service that not only tells you how speedy your pages are to download, but also pinpoints exactly where any bottlenecks may occur. As pages download, SiteTimer saves data on every element, recording how long each takes to download. More recently, Google came up with Page Speed, a Firefox add-on that you can use to generate a report on your code and your web server’s efficiency in delivering it. If there’s a bottleneck, Page Speed will find it.

User experience testing

Big web companies pay lots of cash to have their sites tested by specialist usability testing agencies. They’re looking for problems with the navigation system, embedded media and the site’s overall flow. However, you can cobble together your own tests with very few resources. All you really need is a group of people, some computers, a site to test and the right set of questions. Your first task is to gather a test group together. The group doesn’t have to be large, but its makeup should correspond roughly to your site’s target demographic.

Present your subjects with variations on your site or page design. Are you unsure where the shopping cart works best, or whether that dark, hi-tech colour scheme works better than a lighter, cleaner presentation? Try the different layouts out on your group of test subjects.

Put together a list of questions to ask your test group. You could ask them to rate site navigation, look and feel and whether they could easily find what they wanted. You could also ask them specifically what they liked and disliked about each aspect of the site.

Tags: Apple, application, cell, Compliance, Computer, computers, connectivity, context, desktop, desktop machines, device, embedded, google, Internet, iss, linux, Macintosh, microsoft, Operating Systems, Personal, rms, sap, Server, sla, SOA, Software, system, tools, Vista, web, Windows, World Wide Web, XP
Feb 26

There are three reasons why Linux isn’t succeeding on the desktop, and none of them are to do with missing functionality, using the command line or the politics of free software. The first is that there’s too much momentum behind Microsoft Windows and too many preconceptions about the alternatives. Linux is perceived as having too much of a learning curve for relatively few advantages and an unknown heritage. Migrating big business to a Linux desktop is akin to turning a T1-class supertanker around mid-Atlantic. The opposite direction may look brighter, but it’s easier to chug onwards into the storm.

You only have to look at the number of people clinging to Microsoft’s venerable Office suite to see this point clearly. For the vast majority, most of its functional fecundity is wasted. Many people could arguably be just as (un)productive with Notepad, Calculator and Paint, let alone using an open-source alternative such as OpenOffice.org. Its use seems to have more to do with keeping face when attaching files to an email than a genuine operational advantage. Most people will only consider an alternative when there are bigger issues, larger icebergs or uncertain territories on the horizon.

Away from the desktop, Linux is faring better. Smaller, more agile businesses quickly quantify the cost advantages to produce cheaper and more competitive products. This is why embedded Linux has been such a success on everything from Chinese mobile phones to almost every NAS box around. This may mean that success on the desktop is only a matter of time, or it may mean that the Linux desktop is too far removed from the Linux kernel.

The second reason for failure is that Linux lacks centralised marketing. This is because there’s no real Linux Central. It’s just a trademark owned by its creator, Linus, and a term normally reserved for just the kernel of the operating system – hardly the easiest product to sell. There are plenty of people advertising their own Linux endeavours, all keen to push their own angle on its advantages. This divided effort compounds the problem. With the likes of Red Hat, Novel and Canonical all fighting for their own slice of the pie, there’s no one left to push Linux as a distinctive brand. That’s something Apple and Microsoft do extremely well, and something Linux leaves to Tux the penguin.

Many would argue that standards are the answer to this conundrum, and that would mean a single base distribution. This could then be the only distribution called ‘Linux’ – everything else would become ‘Linux-based’. Mozilla manages this well with the use of the Firefox brand. It’s freely distributable and modifiable, but it can only be called ‘Firefox’ in its untouched incarnation. Change anything and you need to change the name. For example, Debian calls its Firefox build ‘IceMonkey’ because it needs to reserve the right to make modifications, thus breaking Mozilla’s standards. This may cause confusion if you look for Firefox on your Debian desktop, but it also sets a precedent for the kind of experience that Mozilla expects its users to have, and Debian hackers still have the code to mess around with if they need to. It’s a compromise, but it might work in a world with hundreds of Linux distros.

The third reason is easy to see but harder to solve. It’s the reason why you’re not using Linux now. The solution would make all other problems redundant. The reason why you’re not using Linux now is because there isn’t a good enough reason to. Sober advantages such as better security, improved performance, rock- solid stability and low cost aren’t going to win converts. These advantages aren’t exciting enough; they’re the equivalent of a spreadsheet of mortgage repayments.

What we really want is a significant upgrade, something you’d normally pay for. Perhaps we should focus on value. Recent analysis of the kernel by Jon Corbet showed that 75 per cent of the 2.8 million lines of code in recent contributions were written by paid-for developers. That puts Linux freedom in context.

But the biggest challenge is sexiness. There’s very little of it in Linux unless you’re an antisocial geek, and products like the Apple’s iPad illustrate this massive divide painfully. As Jim Zemlin, Executive Director of the Linux Foundation, puts it, “Linux can compete with the iPad on price, but where’s the magic?”

Linux has the programmers, the managers, the community, the innovation, the time and the skill. But to succeed in 2010 and the coming decade, what it really needs is a magician or two.

Tags: Apple, business, context, desktop, developers, email, embedded, functionality, geek, Hackers, Innovation, iss, Learning, linux, marketing, microsoft, Microsoft Windows, mobile phones, performance, security, Software, system, Windows, XP
Feb 23

All laptop users have something in common: we want our device’s batteries to last longer. Whether it’s for the daily commute or the flight home for Christmas, an extra 30 minutes of power means an extra 30 minutes of entertainment. If you’re running a Linux-based distribution on your netbook, there’s a lot you can do to squeeze every last negatively charged ion from your power source. Here we’re going to cover the best techniques that we’ve discovered. Don’t worry if you’re not a netbook user, as much of this information can be used on Linux laptops too. However, we’ve specifically tailored our advice for netbooks as these seldom include full-blown distros (and hence any easy way of compiling and installing new software). We’re going to focus on Intel’s Moblin and Canonical’s UNR (Ubuntu Netbook Remix), two of the most popular Linux distributions for netbooks, but there’s absolutely no reason why you can’t use a full-fat distribution on your device and make the same changes to its power management.

You deserve to be able to drag every last tiny drop of power out of your laptop’s battery. It’s only fair.

Netbook Linux is still in its infancy. This means that there’s still a great deal that can be done to make these devices more power efficient, and each release of distributions like Moblin or UNR gets better at it. But it also means that hardware compatibility and power saving is experimental for each distribution, especially when you’ve installed it yourself. Until netbook distributions are built for specific netbooks, though, there’s always something you can change in a generic installation to make it work better on your own machine. We’re not talking about massive improvements, but each incremental change may stretch your battery life by around five per cent. Even if just one or two of them work out, you’ll see some extra life from your machine. Like most things to do with Linux, it just takes a little trial and error.

The easy targets

Sometimes it’s the most predictable power saving options that can reap the biggest benefits. Wireless and Bluetooth are our first targets. Even when you’re not using these connections, the radio device tucked away within your machine is still expending energy, either keeping a connection in contention or looking for new networks and devices for you to connect to. Both Moblin and UNR allow you to disable these devices from the desktop, but these options won’t necessarily completely disable the radio. The best option is to use a hotkey combination that’s dedicated to your devices. These are usually labelled in blue across the laptop’s keyboard, and typically involve you having to press the [Fn] key in conjunction with a number. The number key will normally feature a somewhat ambiguous icon that you’ll need to decode in order to figure out which number is the correct one. If you’re lucky, you’ll also see an on-screen message updating you on any progress once you’ve pressed the key.

However, some netbooks don’t have function keys to disable the wireless or Bluetooth radios, and you can’t take any chances with the software disable function. Samsung’s popular NC10 is one example of a machine that doesn’t have a keypress option. In these cases, your only course of action is to change a setting in your netbook’s BIOS – a setting that will stay fixed until you restart your machine and manually undo the change.

It might sound obvious, but switching off your laptop’s internal radios can give a significant boost to battery life.

Like many desktop machines, you can normally enter your netbook’s BIOS by quickly pressing [F2], although like the hotkeys, this is dependent on your manufacturer (as is what you can and can’t turn off within the BIOS). With the NC10, for instance, you can switch your wireless devices to ‘Always Off’ from the Boot menu within the BIOS. While you’re there, you might also want to disable the ‘Internal LAN’ setting in the Advanced menu, as the Ethernet port can steal power even while not being used. You should also make sure that any power saving modes for your device are enabled.

Screen brightness

Dimming the screen is a great way of saving some power, but this can sometimes be problematic with certain netbooks running a Linux distribution. This is because the hotkey combination may not work from the desktop, and the software isn’t always capable of changing brightness either. The Linux kernel needs to have support for your specific device. If it does, the distribution you use also needs to use the correct version of the kernel and provide a means of changing the brightness. If this isn’t the case, you might still be able to adjust the brightness of your screen from the command line.

The trick is to use a special kind of file that accesses your display hardware. As with most devices, this can be found by typing ls /sys/class/backlight/. If you’ve not encountered the ‘/sys’ series of directories before, it contains dozens of folders and files that refer to each of the devices on your system. Rather than representing the files and folders on a storage device, this structure is a portal for configuring any plug-and-play hardware discovered on your system, and that includes devices like your netbook’s screen, CPU and drive.

To change values in the /sys tree, you will need to switch to the administrator’s account on your machine. Ubuntu users won’t be able to use sudo in the way they might be used to because the command to change values is really two commands, one piping output to another. The sudo privileges will only apply to the first and won’t stretch to allow you to change the parameter in the second. You can get around this by launching a new bash session using sudo, which will start a pseudo-administrator mode where every subsequent command is executed with root privileges. Moblin users just need to type su followed by their root password to get the same thing.

The contents of ‘/sys/class/backlight/’ should look something like ‘acpi_video0’, but this is dependent on the kernel driver for your hardware. Beneath this directory, you’ll find a special type of file called ‘brightness’. If you probe the value of this file by typing cat acpi_video0/brightness, for instance, you’ll see the current brightness setting for your screen. This is usually within the range of 0 to 100, and may jump up in steps that are defined by your hardware’s capabilities. The converse of this probe operation is to pass a value to this special file, hopefully changing your screen brightness in the process. Typing echo 100 > acpi_video0/brightness, for example, will configure maximum brightness, while a value in the region of 15 should be close to your screen’s minimum.

CPU optimisation

We’re going to stick within the /sys subsystem to make a few changes to how the CPU is handled. This can be a rather experimental area to play around with, which may explain why many distributions choose not to enable some of the more optimal modes, but it can be worth the trial and error. It’s also dependent on the features embedded within your CPU. Recent models built around Intel’s newer Atom processors shouldn’t have any problems, but older models may not be so flexible. You should also make sure you’ve got a backup of any critical data on your netbook’s drive before trying things out.

The most important parameter can be discovered by typing cat /proc/sys/vm/laptop_mode. If your machine returns a value of 0, then Laptop mode is currently disabled. You can enable it by typing echo 1 > /proc/sys/vm/laptop_mode. When Laptop mode is enabled, the kernel takes special care only to shuttle data to your storage device when it needs to, saving your battery in the process. You can disable this by swapping the 1 for a 0 in the previous command.

You can get even deeper into how the processor handles tasks by changing how the scheduler works. This is only going to be beneficial if you’ve got a multicore machine, and it changes the way processes are loaded onto each core. Check the contents of the ‘/sys/devices/system/cpu/sched_mc_power_savings’ location. If this is set to 0, your netbook is configured for optimal CPU performance – which is useful for mathematically intensive apps, but not so great if you’re only planning to read a couple of emails. Changing this value to 1 will ask the scheduler to use the threads and processes more efficiently before more are created, effectively saving your other CPU cores from being used and saving energy in the process.

Process pruning

The best thing about a netbook distro is that it is already pruned down to the bare minimum of applications and running processes. There should be very little you can do to improve things here, but there’s never any harm in taking a look. The quickest and easiest way of checking what processes are running is to run the ‘top’ command from the command line. It may look a little perfunctory, but it tells you everything you need to know. It’s called top because it shows you a list of the processes sorted by CPU time, with the highest at the top. This list changes dynamically, and the processes at the top usually include top itself, the Xorg X-Server (which is rendering the graphics on the screen) and maybe the gnome terminal (if this is how you’re running top). You can also remove processes and change their priority, but you need to be careful about this as you could seriously affect the performance of your netbook (and even lose some of your data). The safest option is to look for tasks that are running under your user account: you should be able to see your name in the second column for any tasks falling into that category.

On Moblin 2.0, for instance, we’ve noticed that the Nautilus file manager is used to manage external storage such as USB sticks. Occasionally, especially when you remove a USB stick without first unmounting it, Nautilus is left running, taking up precious CPU cycles. You’ll even be able to see that it’s the process connected to the USB device because this path follows the name of the process. You can remove tasks by pressing [K] to enter Kill mode and then entering the process number. This is listed in the top output below the top line. If you’re running a standard Linux installation, then there are a great number of processes you might want to consider removing. These could include indexing routines, compositing managers, background servers and log file generation. Further information can be found by looking at how the ‘initd’ process works and working out how to disable these services at bootup.

Monitor process power consumption

One of the best tools for monitoring and tweaking your system’s power efficiency is called PowerTop. It’s the electrical power consumption equivalent to the ‘top’ command we used to measure CPU usage, and it should be available through your distribution’s package manager. Moblin users can find it by searching for ‘Power consumption monitor’ in the Add/Remove Software panel. It needs to be run from the command line with system administrator privileges, which means typing sudo powertop for Ubuntu users or su followed by powertop for Moblin.

PowerTop can give you a very accurate indication of how long your netbook will last with its current power usage.

It will take five seconds for the tool to initially monitor your current system, after which it will list the various offending tasks running on your system sorted according to the amount of power they consume. The top section of the tool displays the percentage of time your CPU spends running at a specific speed. More CPU-intensive tasks will switch to a faster power state, which will in turn take more electricity. Ideally, you should expect to spend most of your time in the C4 state (the slowest), with occasional bursts of activity in the fastest state, C1.

PowerTop was originally designed to show which tasks were preventing laptops from entering a sleep state, and it’s still useful for this kind of bug fixing (though hopefully your distro builder has already solved the most serious offenders). This is why you still see the processes listed as ‘Top causes for wakeup’, as these are the events that are interrupting the system.

Unlike nearly every other tool we can think of, PowerTop also displays some useful information that can help you stretch out your netbook’s battery life. If it detects anything that it knows will help, a suggestion will pop up at the bottom of the window. Your adjustment will last for the duration of the current session only, but the tips that PowerTop displays often include instructions on how to make each change more permanent.

Proper sleep function

Suspending your machine by closing the lid and then opening it again seldom has the desired effect with Linux. It’s often easier to just turn the machine off and on again. Things are a lot better than they were, but hibernation is one area of the kernel that remains problematic. The difficulty is that each piece of hardware within your system needs to respond predictably to the sleep call, and this requires well-behaved drivers that have a good understanding of their hardware capabilities.

Unfortunately, this can’t be said for many Linux device drivers – in particular those for graphics cards. The only exception is hardware developed by Intel. Intel has made a big investment in Linux, and it continues to make massive improvements to the drivers for its own hardware. The Moblin distribution is the pinnacle of this work, and you should find that sleep works well with most Atom-based machines, as well as those that use other kinds of Intel processors. If you need to cater for hardware from other manufacturers, the best piece of advice we can give you is to make sure that your kernel is as up to date as possible. Things are changing all the time in the Linux world, and you may find that any problems have already been fixed with a kernel update.

Tags: application, apps, battery, battery life, cores, CPU, cpu time, desktop, desktop machines, device, directory, electricity, email, embedded, energy, generation, Hardware, information, laptop, laptops, linux, network, optimisation, performance, power consumption, power efficiency, power management, processor, Samsung, Server, servers, Software, storage, system, tools, type, WiFi, Wireless, XP