Buying a Laptop

I’m been asked a few times to give some general advice on buying a laptop for light personal use. As a "computer person", I’m expected to know these sort of things, and over the course of several months built up a stock e-mail, which provides some hints and tips.

I’ve decided to post it here, just in case people find it useful in the future, plus I will always know where to dig it up from should I ever need it again.

General advice on buying a laptop information can be found here.

Sometimes it’s Cool to be a Geek

This weekend has been predominantly spent rebuilding my PC following the installation of a RAID 10 array which is used to provide extra security for our numerous pictures and HD home videos. That, along with keeping Lucy entertained and generally healthy.

We’ve recently had some pretty high temperatures for May (mid 20s), which has meant the back bedroom has become a bit of a furnace at times. Messing with the PC has left the side of the case off for a while, and the sight of the large cooling fans gave me an idea.

Every PC builder worth his salt always ends up with a box of bits, to be used at an indeterminate time in the future. I dug out an old 80mm fan, along with a couple of internal PC power cables and hey presto: I have had a very cool, quiet fan running in front of me.

Being geeky is sometimes cool.

Back in Time (A Serial Thriller)

I complained at the start of the month about how much of a faff it is to put my mini-ITX PC in maintenance mode. Obviously, it’s Linux, so maintenance mode is used very rarely. In fact, power outages and system reconfiguration have caused more restarts in the past year than software crashes. But I digress.

To sort things out following an unscheduled reboot when it encounters problems, I need to unplug from the mini-PC:

  • the power
  • the network cable
  • the USB printer
  • the USB HDD
  • the power to the external HDD itself

I then need to move everything across to the computer desk on the other side of the room, swap the keyboard and power leads over from the main PC, plug in the external HDD again, plus dig out the analog VGA cable from the cupboard so I can connect it to the monitor (normally connected to my PC through DVI cabling). Understandably, that’s a pain in the backside.

So what can I do about this? Normally, everything is remotely administered over the network, but during boot time, the network isn’t available, so I can’t monitor startup messages. The solution lies in technology that literally pre-dates me: an RS-232 serial connection.

My main PC does have a serial port, but it’s hidden away round the back of the tower which is hard to get to. A better solution was to purchase a USB to serial port convertor. This was bought from DealExtreme.com for the small sum of $7 (about £3.50) delivered. This means I can just plug in the convertor as and when required.

Next up, we need to run a cable, so I bought a 2m null-modem cable and a 5m extension cable (£5 delivered for the pair) which ought to cover the space between my main PC and the mini-ITX. A bit more messing later with Windows Hyperterminal and I managed to get the boot messages scrolling up on my main PC via the serial link.

So there you go, 1960’s technology finds a useful place in the home of a techno-geek some 40 years later. Laughably, the link only runs at 115,200kbps, which isn’t even enough to stream an MP3 track. Some progress.

Don’t Be Mean With the Bits

While I may be occasionally described as “fiscally prudent”, I’ve never been one to skimp on space for storage of digital media.

Take, for example, my CD collection. I mentioned ages ago that my music is all MP3-encoded these days. We don’t use CDs anymore because I have a little device which streams music from my Linux server across the wireless network. Things are simple – no more changing disks, no more hunting around to find the right case, no need to find room for 8ft of CDs somewhere in the living room. Plus, it’s just as high-quality and access is instant.

There is a generally-accepted theory that MP3s encoded at 128kbps are “good enough” for most ears. Many portable MP3 players tend to use that bit rate, and that works out fine for 95% of the population (figure pulled completely out of the air there!). 128kbps means that for one hour of music, you will consume 56.25MB of space.

My ears are far from being the hi-definition models fitted to some of my friends, so why do I go for encoding at 192kbps? Ages ago, I sat and did a fairly careful experiment with encoding a range of music, at a variety of bit-rates and found that I could possibly tell the difference between 128kbps and 160kbps in certain bits of music, but I couldn’t be sure. I couldn’t tell the difference between 160kbps and 192kbps at all. So why go for the bit rate that uses of 50% more space than I really needed to?

The answer is because storage is cheap and it always gets cheaper. I’m pretty clued-up on trends within computing and have a rough idea of where things are heading, so using slightly more storage space now is a no-brainer 5 years down the line. My music collection encoded at 192kbps currently uses about 15GB of storage. I could have got that down to 10GB at a lower bit rate, but why bother? Novatech – my local computer supplies centre currently sell a decent-quality 500GB Samsung hard drive for a shade under £52 including VAT. It’s not hard to work out that the extra 5GB would cost just 52p at those rates.

And this leads me onto the main reason I started this blog entry: home movie files. I bought a Canon HV20 camcorder just before Lucy was born and it is just brilliant. In one tiny, hand-held unit, it records some great quality HD footage that can be easily edited on my PC (that’s a blog post for a different day). It’s an HDV model, which means that it uses tapes in the camcorder and footage is transferred to the main PC via a firewire cable.

In camera, the data is recorded at 25Mbps (which is actually using lossy compression), and this data rate applies when you transfer the footage to the computer. That means it “costs” 11GB per hour of video to store on a disk. This data is monumentally precious to us though – there is absolutely no replacing it should something fail. That’s why things are backed-up everywhere.

To start with, no footage shot on a tape is ever erased or recorded-over. Tapes are very cheap these days – a ten pack of decent Sony tapes is just £13. I keep full tapes at work (which is likely to be a very safe place indeed), and £1.30 for long-term archival is a good price. I also duplicate the footage onto DVDs for extra security – it usually three per tape, but they’re less than 20p each in bulk, so again, who cares? In total, including tape, DVD-R and hard disk storage, an hour of footage costs just over £3 for backup in triplicate.

As I said – don’t be mean with your bits.

So What is Programming

Part three of my occasional series about what I do for a living. Part two was a general description of software – the end-product of my labours. In this part I’ll talk about the process of programming, which is the name of the process used when creating software.

From the previous post, we learned that software is the stuff that takes some sort of input (from a human via a keyboard, from a camera, from another computer, etc.) and applies some pre-determined processing to it. This processing then results in some output, which is presented back to the user, stored, or sent somewhere else. The main point of programming is deciding what this processing needs to be, breaking it down into very small tasks that the computer can easily perform, then entering those tasks in a manner which the computer can understand.

So how do we go about programming? At the heart of programming lies what is known as a programming language. A programming language is a well-defined sequence of letters, numbers, punctuation, plus some other really wierd characters on your keyboard that you’ve probably never used. My wife believes I type gobbledegook for a living and it does look alien if you don’t know what to look for. As with any human language (English, French, German, etc.), the idea of a programming language is that is provides a means for a human to describe the steps required to achieve the end-result in a format that the computer can understand it.

The obvious question is “why not just use English?” Well, for starters, English (like almost all human conversation) is a phenomenally complicated language, has subtle nuances, has times of ambiguity, has regional dialects, and is extremely difficult to generalise. Programming languages, on the other hand, are (usually) very structured, always unambiguous, and has clearly-defined rules. So we stick with pre-defined programming languages.

There are literally hundreds of programming languages out there – some are very old (1960s), some are very modern (new languages are being invented all the time). They all have a name (sometimes just a single letter) and they all fall within a few categories, based on how the language is structured. Each category makes it more useful for a particular type or style of programming. The most common programming language categories (properly called paradigms) are as follows:

  • procedural
  • object-oriented
  • functional
  • scripting
  • markup

So what does programming look like? Well I stated above that programming is a well-defined sequence of symbols and when you combine these, you get a program:

#include <stdio.h>

int main(int argc, char ** argv)
{
   printf("Hello worldn");
}

The above is probably the simplest program you can create using the “C” language. It does very little, apart from send a message out to the screen (known as printing – nothing to do with ink and paper though). It takes no inputs, does no transforms of information, and performs very little work. Here is a program which will do the same job, this time using the Java language:

public MyClass
{
   public static void main(String args)
   {
      System.out.println("Hello world");
   }
}

Now what’s shown above is technically described as source code (often just shortened to “source”). To create a program which can be used (technically, “executed”), you need to do a few things first. The first is to type the correct sequence into a special document – a file on disk which just contains text and no formatting information. This is a very simple file – not a Word document, not a web page, but a plain file containing only those characters.

Remembering the whole idea of a programming language is to provide the ability to describe a sequence of tasks to a computer in a way it can understand, you now need to tell the computer to go and look at this sequence and figure out what is needed. That’s where a special piece of software called a compiler comes in handy.

In my second post, I mentioned that computers can only do a limited number of things, mostly revolving around copying and comparing numbers. That’s what a compiler does – it takes the text you’ve just supplied and converts it into a sequence of very small instructions. As an example, compiling the C version of the program above, produces the following program:

.file "test.c"
.section .rodata
.LC0:
.string "Hello world"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $4, %esp
movl $.LC0, (%esp)
call puts
addl $4, %esp
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.2 20070626 (Red Hat 4.1.2-13)"
.section .note.GNU-stack,"",@progbits

Now you start to see why programming languages are useful – even someone who’s never programmed in their life can agree that the C language version is much simpler than the output of the compiler. And that’s not the main reason for using languages. With a programming language, you tend to get a lot of stuff “for free”. For example, I glibly mentioned above that this program sent a message to the screen. In reality, even the compiler output above doesn’t actually write the message on the screen. What it does it setup a few things and then tells the operating system (itself a piece of software) that it would like a particular message to be written to the screen.

An operating system is the basic bit of software on your computer which “gets it going”. All programs are compiled for a particular operating system and hardware combination (known as a platform). The computer you’re using at the minute is probably running Windows as the operating system, and this is produced by the company Microsoft. The hardware (see post two) will be something based on system devised by Intel a long time ago. Alternatively, on an Apple Mac, you are probably running MacOS written by Apple. Modern systems also use Intel hardware, while older machines use IBM electronics.

One of the main things about programming is knowing what has already been made available for you. As a programmer, you don’t need to know about how to send information to another computer, or write a file to a disk, or send a picture to the screen – certain facilities are made available to you. The simple example above sends a message to the screen, which is achieved through the printf call. Every platform has reams and reams of information made available to you which lists in extraordinary detail what facilities are available and how you as a programmer can take advantage of this. As an example, have a look at the reference manual page for the IBM z/OS V1R9 operating system. This has a vast quantity of information in there – a great deal of this is for programmers.

Taking a step back from the internals now, we can see more about what is involved with programming. A programmer (that’s me!) decides on which language is going to be used, based on a number of factors (more later), breaks it down into a sequence of instructions, compiles it, puts it onto a CD and then sells it to a customer.

So that’s pretty much the mechanics of programming and it’s fairly simple – learn the rules for your given language, know where to find out what services the platform provides you with, and then you’re done.

Programming for a living is much harder though. For example, I am pretty fluent in five or six languages, while being able to have a good go at programming in about a dozen more. I’ve been exposed to maybe another dozen on top of that. Not having to refer to a manual every time you need something makes things faster and that’s really just experience.

Programming well is also down to how you break the tasks down into very small instructions. A classic example is the problem where your program has a list of numbers which need sorting. How do you do that? Well, there’s actually a huge range of ways, each of which has it’s own merits and drawbacks. For example, it might need to be done quickly and for that you would use a sequence called quicksort. Unfortunately, that takes up quite a bit of memory space in the computer. Whether that’s acceptable is up to how you want your application to behave. You may decide that you don’t really care about how fast things are, but memory space is very tight, so you might want to use the bubble-sort sequence (technically, an algorithm).

Hopefully by now, I’ve partially justified my living and the three years at university. In the next part, I’ll write about exactly what sort of software I write.

1 2 3 4 5 7