Convert txt-list to HTML-list

The following PHP code converts a txt list to at html list. Look at example below. Nothing new in this… alot of Wiki pages can do that, I just thought it was cool. After using alot of time to figure out how (new to regular expressions) it makes you wanna show it to the world:

/*
 * This function isn't supposed to be called directly
 * But through encodeList()
 ************************************/

function encodeListElements($text) {
    return preg_replace("/^\s?(([\*|\-]) (.*?))\n/m", "
<li>\\3</li>", $text);
}

function encodeList($text) {
    return preg_replace("/\n((\s?(([\*|\-]) (.*?))\n)+)/sie", "'
<ul>' . encodeListElements('$1') .'</ul>'", $text);
}

Note: Your browser might split up the code lines, so make a double check.

Example

txt:

* Milk
* Water
* Coca Cola

html:

<ul>
<li>Milk</li>
<li>Water</li>
<li>Coca Cola</li>
</ul>

Response to Art of computernaming

After reading Random thought: Art of computer naming and Random thought: Art of computer naming, part 2 I wrote Lars Wirzenius to tell him about the names I use at work if he ever was to make a part 3 :)

(All this happend a while back while my server was down - 29 April)

For those of you who just can’t wait for a part 3 I use fable animals and I have put a list together here.

Fable animals

  • Unicorn
  • Hydra
  • Pegasus
  • Griffin
  • Cyclop
  • Minutaur
  • Mermaid
  • Pixie
  • Gnome
  • etc.

Debianguiden reloaded

Yesterday I worked with Morten Brix Petersen to implement user comments on the Danish Debian guide. User comment functionality like the one found on PHP’s documentation. While we where at make enhancements we also redesigned the frontpage to look like the rest of the guide.

First the front page was designed using tableless design but IE and Konqueror (incl. Safari) couldn’t handle it. Now the page useses two tables :( not something I’m proud of but hey now it works.

Next target is the layout of the search functionality (ht://Dig), which should be integratede with the rest of the guide.

Finally my server is up and running again

The reason for the break down was not big (at least not in gigabyte). It was an old IDE 1.8GB Maxtor harddisk which contained my server OS, homepages and databases. Thank god I have recovered all my data. It is impossible to boot from the harddisk and data transfers are very slow sometimes unstable. It has now been replaced by two 200GB Seagate disks. They are supposed to run RAID1 but so far only a data drive with the websites and the databases is a RAID partition.

For the RAID I used the following debian packages: mdadm and `raidtools2. Use google to find some guides…

Stay tuned for updates… I have been away for while ;)

New design of my blog

I have be thinking og making a new layout for my blog (and my emcken.dk) homepage. I have drawed a draft for a logo. The face should resemble me and if it looks okay ins SVG I’ll use it as a “signature” / “trademark” / “I-was-here” thing. I’ll try make it in SVG later this week. Perhapes I will soon update my blog to the 0.6(RC1) version. Who know?!

The next few days I will be at a net party with a lot of my friends :)

Just letting you know that I’m still alive and kicking