Educating the world

Our blog has over 10,000 readers a month

The internet is one big soapbox

January 16th, 2012

The Internet’s content can be split into many pieces, but it can be characterised into just 2 (well 3 if you count all the porn!): what people know and what people think.

What people know is simple; it includes all the journals, academic papers, research, medical journals, technical specifications and documentation. All of these sources are considered true (at the time of writing). What people think is also simple. These are (but not limited to) blogs, forums, comments sections, Facebook and Twitter.

But wait… is it really that simple? No. If you know my mate Switfy, he talks like it’s true but he has no idea and is generally just making it up. So at the end of one of his explanations we have to ask: “Is that true or Swifty-True?". The Internet is still run by people and everybody lies. In some cases they may not know they are telling untruths they could just be mistaken.

There are many places devoted to collecting peoples opinion. Sites like YouGov ask people how they are feeling about their lives, their aspirations and how they feel about the current state of the country. It also conducts market research.

There are several examples of mistaken truths in action. The UK press reported recently a story about Nadine Dorries M.P. and her blog. She had been keeping a diary reassuring constituents about how hard she was working but caused outrage when it was discovered that about 70% of it was untrue. Another ongoing example is that of Wikipedia. It’s content is generated by people, most of the pages are written by the experts in that field, but a lot of them are not. Wikipedia has started requiring citations to back up each statement made. This reduces the number of vague or inaccurate claims but they can still be indexed, searched and referenced.

Every couple of months I get a scaremongering chain email from one of my friends who seems not to be able to tell the difference between a genuine email and a hoax or spam email. They tend to read the subject of “Let stop baby rabbits being used in underwater mining” think this is terrible and send it to everyone they know. Most of them believe that because they “think” they know who sent the message they automatically trust the contents of the email. Some are not so obvious, for example the Marks & Spencer Voucher Giveaway Hoax is one such email I tend to get a lot around Christmas time. It shows that in some cases the original recipient has not even read the email before passing it along. If you read the email it says that someone will give you £100 for passing the email to 8 friends. In fact they are doing the spammer’s job for them.

Spammers are lazy. They just cut and paste the email which makes it really easy to lookup at Google. Copy one sentence from the middle of the email and paste it into Google. You will always come up with a hit because you are highly unlikely to be the first person who is targeted and most of the circulars are reused from a couple of years ago.

You, as an Internet user, must decide for yourself what is true and what is false. Often there is just opinion which is very subjective and dressed up as truth. Often there is someone trying to con you. In fact, it’s just like life.

Start with just six words

January 13th, 2012

Homework: write opening and first scenes, try to introduce aspects of the characters without explicitly referencing them.

Jeff leaned over the guard rails of the bed. His eyes were bloodshot and his cheeks were wet with tears. The little girl looked jaundice, her skin was getting more yellow. The only colour Jeff could see was the blood stained bandages wrapping her arms and legs. Her body was like a rag doll that the dog had been throwing about.
Dr. Barrett placed his hand on Jeff’s shoulder and in a deep comforting voice said,
“Come on Jeff, there’s not much you can do here. Come into my office and you can go through some of the details of what happened to Emily".
Dr. Barrett helped Jeff to his feet and put his black arm around Jeff’s waist. They walked slowly towards the door. Jeff’s breathing quickened each time he placed his right foot down: Dr. Barrett’s arm muscle flexed as they moved in time.
It was only a small hospital on the edge of the reserve which worried Jeff. Emily seemed too weak to be moved and he wasn’t sure if the facilities here would be enough.


  1. The rag doll reference is a nice simile.
  2. Reader is thrown in a the deep end, harsh on the reader.
  3. Good opening line.
  4. There’s a good example of “Showing” which is describing the picture instead of “Telling” which is explaining what the picture is. Jeff was injured too.

To cut a long story short

This week’s lesson was about condensing a story into the fewest words possible but still include a beginning, middle and an end. Ernest Hemingway said that the best story he ever wrote was:

For sale: baby shoes, never worn

It’s a synopsis of a story.

My effort:

“Excessive drinking with a mystery woman, son”

Homework for next time:
Start with a 6 word story.
Break it up into a beginning of 75 words and middle of 75 words and an end of 50 words.
Split the beginning up into a beginning, middle and end. Include 3 crisis points in the beginning, 6 crisis points in the middle and 2 in the end.
6 word story should be 6 words.
First story draft should be 300 words.
Final story should be 3000 words.

Science Fiction

January 9th, 2012

There are many people who turn their noses up at Science Fiction films and yet the majority of people do like them, it’s just they re-classify them in their mind. I over heard a conversation in the pub on Friday.

John: Don’t like SciFi.
Al: What about Terminator 2?
John: That’s not SciFi, that’s an action film.
Al: Robots coming from the future to change history, how much more SciFi can you get??

rpmdb: unable to join the environment

January 6th, 2012

How time flies? It only seemed like yesterday that I installed CentOS 5.4 at a customer site. This week I needed to update rsync from 2.6.8 to what ever the latest version is. So I typed:

yum update rsync

and got the following message.

Loaded plugins: fastestmirror
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db3 - Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
File “/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/", line 309, in user_main
errcode = main(args)
File “/usr/share/yum-cli/", line 157, in main
File “/usr/share/yum-cli/", line 187, in getOptionsConfig
File “/usr/lib/python2.4/site-packages/yum/", line 664, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File “/usr/lib/python2.4/site-packages/yum/", line 239, in _getConfig
self._conf = config.readMainConfig(startupconf)
File “/usr/lib/python2.4/site-packages/yum/", line 804, in readMainConfig
yumvars[’releasever’] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File “/usr/lib/python2.4/site-packages/yum/", line 877, in _getsysver
idx = ts.dbMatch(’provides’, distroverpkg)
TypeError: rpmdb open failed

I also tried:

rpm -qa

which resulted in:

rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db3 - Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm

Even though the message says Resource temporarily unavailable, it was in fact always unavailable!
Hunted around and found this article which helped a lot.

The problem is caused by an empty database index file in the RPM repository, probably caused by corruption. In my case it was because most of the index files were missing.

[root@host tmp]# ls -l /var/lib/rpm
total 39656
-rw-r–r– 1 root root 5107712 Nov 11 11:58 Basenames
-rw-r–r– 1 root root 12288 Oct 5 2010 Conflictname
-rw-r–r– 1 root root 0 Dec 12 11:42 __db.001
-rw-r–r– 1 root root 1036288 Nov 11 11:58 Dirnames
-rw-r–r– 1 root root 5259264 Nov 11 11:58 Filemd5s
-rw-r–r– 1 root root 24576 Nov 11 11:58 Group
-rw-r–r– 1 root root 16384 Nov 11 11:58 Installtid
-rw-r–r– 1 root root 40960 Nov 11 11:58 Name
-rw-r–r– 1 root root 30818304 Nov 11 11:58 Packages
-rw-r–r– 1 root root 331776 Nov 11 11:58 Providename
-rw-r–r– 1 root root 102400 Nov 11 11:58 Provideversion
-rw-r–r– 1 root root 12288 Oct 5 2010 Pubkeys
-rw-r–r– 1 root root 413696 Nov 11 11:58 Requirename
-rw-r–r– 1 root root 208896 Nov 11 11:58 Requireversion
-rw-r–r– 1 root root 81920 Nov 11 11:58 Sha1header
-rw-r–r– 1 root root 45056 Nov 11 11:58 Sigmd5
-rw-r–r– 1 root root 12288 Feb 16 2010 Triggername

So all I needed to do was remove all the index files and rebuild them.

rm -rf /var/lib/rpm/__db*
rpm -rebuilddb

The RPM repository now looks like:

-rw-r–r– 1 root root 2768896 Jan 6 09:49 Basenames
-rw-r–r– 1 root root 12288 Oct 5 2010 Conflictname
-rw-r–r– 1 root root 0 Jan 6 09:49 __db.000
-rw-r–r– 1 root root 24576 Jan 6 09:49 __db.001
-rw-r–r– 1 root root 1318912 Jan 6 09:49 __db.002
-rw-r–r– 1 root root 450560 Jan 6 09:49 __db.003

-rw-r–r– 1 root root 978944 Jan 6 09:49 Dirnames
-rw-r–r– 1 root root 5267456 Jan 6 09:49 Filemd5s
-rw-r–r– 1 root root 24576 Jan 6 09:49 Group
-rw-r–r– 1 root root 16384 Jan 6 09:49 Installtid
-rw-r–r– 1 root root 45056 Jan 6 09:49 Name
-rw-r–r– 1 root root 25427968 Jan 6 09:49 Packages
-rw-r–r– 1 root root 335872 Jan 6 09:49 Providename
-rw-r–r– 1 root root 98304 Jan 6 09:49 Provideversion
-rw-r–r– 1 root root 12288 Oct 5 2010 Pubkeys
-rw-r–r– 1 root root 409600 Jan 6 09:49 Requirename
-rw-r–r– 1 root root 196608 Jan 6 09:49 Requireversion
-rw-r–r– 1 root root 81920 Jan 6 09:49 Sha1header
-rw-r–r– 1 root root 45056 Jan 6 09:49 Sigmd5
-rw-r–r– 1 root root 12288 Feb 16 2010 Triggername

I re-issued the update command:

yum update rsync

and it successfully installed rsync 3.0.6-4.el5_7.1.

Interestingly, CentOS 5.4 has been deprecated and so this version of rsync was for CentOS 5.7, but it didn’t need to install any dependencies.

Format a USB drive under unix

January 3rd, 2012

In order to format a USB device under Unix you need to follow these simple steps under the root user account.

Find out the name of the device file representing the USB hardware device:

  1. If the system is busy I clean out the dmesg to make it easier to find the reports when the USB device is connected. I clear the existing log to a date stamped file:

    dmesg -c > dmesg.`date +%Y-%m-%d-%H-%M-%S`

  2. Plug in the USB device.
  3. Type:


    again and you should get something like:
    usb 1-5: new high speed USB device using ehci_hcd and address 4
    usb 1-5: configuration #1 chosen from 1 choice
    Initializing USB Mass Storage driver...
    scsi4 : SCSI emulation for USB Mass Storage devices
    usbcore: registered new driver usb-storage
    USB Mass Storage support registered.
    usb-storage: device found at 4
    usb-storage: waiting for device to settle before scanning
      Vendor: WDC WD15  Model: EARS-00S0XB0      Rev: 80.0
      Type:   Direct-Access                      ANSI SCSI revision: 05
    SCSI device sdb: 2930277168 512-byte hdwr sectors (1500302 MB)
    sdb: Write Protect is off
    sdb: Mode Sense: 23 00 00 00
    sdb: assuming drive cache: write through
    SCSI device sdb: 2930277168 512-byte hdwr sectors (1500302 MB)
    sdb: Write Protect is off
    sdb: Mode Sense: 23 00 00 00
    sdb: assuming drive cache: write through
     sdb: unknown partition table
    sd 4:0:0:0: Attached scsi disk sdb
    sd 4:0:0:0: Attached scsi generic sg2 type 0
    You can see that the kernel has assigned sdb as the block device (i.e. /dev/sdb). You can also see that the kernel was not able to detect the partition type of the drive

Now that we know the device file we must create a partition on the drive and format it. The tool used for this is fdisk.

  1. Launch the program telling it which device file to look at:

    fdisk /dev/sdb

  2. If you get the following message then ignore it because doing a write will just create an empty partition which isn’t what we want.

    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

  3. Add a partition by pressing n (for new partition).

    Command action
    e extended
    p primary partition (1-4)
    Partition number (1-4): 1
    First cylinder (1-182401, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-182401, default 182401): 182401

    I only want one partition and for that partition to contain the whole drive. If you wanted a different number of partitions then here would be the place to set that up.
  4. Next up, we have to set the type of the filesystem. So hit t.

    Selected partition 1
    Hex code (type L to list codes): 7
    Changed system type of partition 1 to 7 (HPFS/NTFS)

  5. Then look over what we have done.

    Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
    255 heads, 63 sectors/track, 182401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 182401 1465136001 7 HPFS/NTFS

  6. Finally enter w to write the partition table and quit.
  7. Typing dmesg again gives:

    SCSI device sdb: 2930277168 512-byte hdwr sectors (1500302 MB)
    sdb: Write Protect is off
    sdb: Mode Sense: 23 00 00 00
    sdb: assuming drive cache: write through
    sdb: sdb1

Now that the partition has been created we must make it ready for action.

  1. The first thing we need to do is format the drive and create a filesystem. Issue the following command. There should be a longish wait (1.5TB drive took about 20 seconds.)

    # mkfs -t vfat /dev/sdb1
    mkfs.vfat 2.11 (12 Mar 2005)

  2. Now we are ready. We can mount the USB drive:

    mount -t vfat /dev/sdb1 /mnt

  3. For confirmation we’ll check the mounted partitions with the command df -h to give:

    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 388G 30G 338G 9% /
    /dev/sda2 436G 366G 48G 89% /home
    tmpfs 1013M 0 1013M 0% /dev/shm
    /dev/sdb1 1.4T 16K 1.4T 1% /mnt

  4. Don’t forget to edit your backup scripts to reflect the new device name.