tips

How to format a disk image

Usually, you won’t create a disk image; in fact most of the times you would download it and then mount it somewhere or burn it to a CD/DVD.
However, there are cases in which you could need to create a disk image of a given size, format it and then mount it as a normal device. This happens for example when you want/need to set up a swap file instead of a swap partition or if you want to get a fake floppy disk drive when you don’t even have the driver.

So, let’s see how can you create, format and mount a floppy disk1 fake image:

  1. Create the file that will contain the image with

    0
    Source: My. Debian.

Restore a broken virtualbox machine

This morning, one of my Ubuntu 7.10 virtualised machines stopped at boot time with the following message

ALERT! /dev/disk/by-uuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx does not exist. Dropping to a shell!

Press ESC at boot time, then enter "Recovery mode"; wait for the boot to complete

Although the message came rather unexpected, it was much clear that it was a “wrong uuid” issue. So I rebooted with a live cd distro (I used Damn Small Linux since it’s light and very fast), opened a virtual terminal, mounted the hard disk root partition and changed /boot/grub/menu.lst so that it would not use any UUID:

From:

0
Source: My. Debian.

Pingus extra levels

pingus extra levels

Pingus is a very nice free Lemmings clone with a single crucial problem: it doesn’t come with a satisfying number of levels. In fact you can normally play only about 20 levels of the so called Tutorial World.
Actually, the levels are many many more but you can’t play them unless you open a terminal and select one after the other.
In this article I will present a simple script that will make it for you.

In Debian/Unbuntu the levels are placed in /usr/share/games/pingus/data/levels. You can load one per time by passing it as a parameter to pingus:

0
Source: My. Debian.

Removing an IMAP folder with Thunderbird

I don’t exactly know how general this problem is, but when you try to delete a “virtual” folder using Thunderbird and a dovecot-based mail server configured with the IMAP protocol, you will likely obtain the following error:

Target mailbox doesn't allow inferior mailboxes

The solution is as quick as effective: get to the server configuration form (Tools->Account Settings->Server Settings) and change “When I delete a message” from “move it to the trash folder” to “Remove it immediately”. When you have finished you can restore the old value.

Reference:

0
Source: My. Debian.

How to store a number with zeros left padding in php

In php we can print/store a number quite easily:

<html><body>
<?php
$number = 33;
echo $number."\n<br/>";
?>
</body></html>

What if we want to left pad each number with a given number of zeros?
Well, in this case we just need to use printf and sprintf respectively for printing and for storing:

0
Source: My. Debian.