Archive for January, 2006

Published by Niels on 28 Jan 2006

Upgrade time

A new day a new look. NanoBlogger version 3.3-RC4 has been released yesterday. Always ready to try out new things I upgraded this site to that version as well. I followed the steps mentioned at the NanoBlogger User Manual and some extra steps and now everything seems to be working fine again. Steps taken:

  1. Renamed the directory where this site is stored to something else. In my case: mv ~/Projects/www ~/Projects/www.org.
  2. Downloaded the new release, unpacked it and set my PATH to the new NanoBlogger directory. Tested with nb --version if that went well.
  3. Created a new weblog using nb -a. This assumes that $BLOG_DIR is set of course.
  4. Deleted the default entry from NanoBlogger: nb -d 1.
  5. Copied the data/ directory from the original directory to the new directory.
  6. I have a local copy of my plugins. So the plugins/ directory from the distribution have been copied to $BLOG_DIR.
  7. Copied some personal plugins (google.sh, gallery.sh and code.sh) to the correct places in the local plugin directory ($BLOG_DIR/plugins).
  8. The stylesheet for this site is base on the nb_clean.css stylesheet. So that stylesheet was copied to to heirbaut_nl.css. From the original’s site stylesheet the additions for the gallery and code plugin were added. See the result here.
  9. GViM was started in diff-mode with the original and the new blog.conf files. All personal settings were also put it the new blog.conf.
  10. GViM was started in diff-mode with the original templates/main_index.htm. All personal settings (navigation menu) were put in the new templates/main_index.htm.
  11. Same for templates/main_links.htm.
  12. Run DirDiff on the old and the new directory and checked if anything was missing. There was: images/galleries. So that directory was copied to the new location as well. Other diffing tools would do as well, of course. I just like ViM :).
  13. Ran nb -u all. Checked that everything was fine.
  14. Added this entry and uploaded the site using sl (which can expect some additions in the near future).

And now I am going to have some coffee…

Published by Niels on 25 Jan 2006

The meaning of…

Once in a while I check the website statistics for this site. They tell all kinds of neat stuff like who visited when and how did they come here. For example it tells that people visited through a link on another webpage or through a search engine. It even tells, in case of the search engines, what the search terms were that lead to here. To my surprise someone found this site searching for ‘ebo no kata meaning’. The only place I ever mentioned the Ebo-no-kata is here.

Being intrigued by this search term I got the feeling that I could tell about my view on the Ebo-no-kata.

Short Introduction
The Ebo-no-kata is a Dutch national kata that is mandatory for every Dan exam. It is performed by two persons where one does all the attacks and the other
does all the counters. There are twenty different attacks divided into four groups:

  1. Grabs
  2. Holds
  3. Punches/Kicks
  4. Weapons

It was created by Mario den Edel and Wim BOersma (EBO :) ) to represent their view on contemporary jiu-jitsu. As I understood it it serves not only as a kata (or a teaching tool, which most katas are), but also as a framework to start technique training from. One of its shortcomings is that it has little ground techniques but that is compensated by another Dutch national kata called the Ne-Waza-Jitsu kata which consists purely of defenses on the ground.

The following items are my personal views and motivations on the Ebo-no-kata. To me the kata is:

  • A great way to start an exam. Both as an examine and as an examiner. As examine it gives you a nice warming-up and a sort of constant factor that can help to overcome nxiety.
  • A good excuse to work on my technical skills. Just take it slow in an constant pace an try to improve my technique. This is how I think all katas should be performed. Fluent, clear and skillful.
  • A good excuse to take a slow pace in training. Perfection does not allow rushing.
  • A starting point to develop technical skills like the correct distance and moving in the right position and direction. My main problem is that the more I learn about that the more a get the feeling that I have to start all over again with my kata training.
  • Discussion material. People often debate the way a technique in the kata should be performed and sometimes go as far as to declare their way the one and only correct way. I think this is a mistake. Their is more than one way to arrive at a technique as long as you can make the technique work for you without using ‘force’.

Like I said I like to discuss stuff like this. So if anyone has more or other viewpoints, or would like more information, I would be glad to hear from you.

Published by Niels on 25 Jan 2006

ViM, ViM…

Editing entries in NanoBlogger appeared a bit cumbersome to me. But as with any open source solution this is primarily my own fault. Anything can be customized…

I added a ‘modeline’ to my templates/entry.metadata to override my .vimrc settings and also changed the editor setting in my blog.conf.

templates/entry.metadata:

TITLE: $NB_EntryTitle
AUTHOR: $NB_EntryAuthor
DATE: $NB_EntryDate
DESC: $NB_EntryDescription
FORMAT: $NB_EntryFormat
$METADATA_MARKER
BODY:
$NB_EntryBody
$METADATA_CLOSETAG
vim:set sw=4 ts=4 fo=cqt noet:

blog.conf:

EDITOR="gvim -f"

Now editing is a lot more bearable. The only problem now is that :!aspell -c % from gViM is not working properly anymore. Everything stays in in the bottom command line. Ah well, just another item for my TODO list.

Update: Wed Jan 25 21:41:50 CET 2006
Forget about the ‘modeline’. It screws the title of the entries up by adding $NB_EntryDate (literally) to the entry’s timestamp. This will take more time debugging than I have tonight. <schwarzenegger_voice>I’ll be back</schwarzenegger_voice> (on this one).

Published by Niels on 15 Jan 2006

USB Data key problem

Diona just came to me with the message that she couldn’t write to, or remove files from, her SanDisk USB memory stick on the laptop. So I plugged the stick into the PC I am sitting at right now and behold: the same problem. For a moment I was afraid that the memory stick went to memory stick heaven. But after some searching on the internet I found that re-formatting the bugger sometimes helps.

Since the data from the stick could still be read a backup was made, the stick was unmounted and the following command was given to reformat:

sudo mkfs.vfat /dev/sda1

This wiped the entire contents of the stick, but some short tests proved that it was working again.

Published by Niels on 14 Jan 2006

Ideas on blog comment spam prevention

One of the reasons I don’t provide a comment facility is that it is very hard to prevent spammers from abusing your weblog. The easiest way to prevent spamming is to work with a registration system: you can only post a comment if you have registered. This has the disadvantage that anonymous people, or people who accidentally came at your site and found something interesting, can’t post comments.

One method of making it possible for anonymous users to post comments is asking the user to type in the text appearing in a so-called CAPTCHA. But if the captcha is too simple the spammer’s automated systems will recognize the text in the picture and are then still able to log in and put spam in the comments. Captchas also have the disadvantage that people that have to rely on, for example, braille readers, cannot post anonymously.

Apart from the braille readers I think the captchas can be best implemented in the following manner:

  1. Make sure that the letters in the captcha are all of a different color and are overlapping. Overlapping letters make it harder for OCR software to guess the ‘word’.
  2. Don’t always ask the user to type in the whole word, but rather one of the following questions:
    1. Type in all letters from the captcha (mentioned that already, just being complete).
    2. Ask the user to provide a subset of the letters in the captcha. For example the first and the third letter. The subset should not be fixed, but be chosen at random.
    3. Ask the user to provide the color of one or more of the letters in the captcha. Since not all the weblog readers will be native speakers of your weblog’s language, it would be best to provide check boxes so that language mistakes can be prevented.

This ofcourse combined with the possibility to create user accounts so that if a spammer succeeds in breaching these barriers, the decision can always be made to shut off anonymous posting.

Another possibility is to also work with a blacklist that contains words and sites that are not allowed to appear in a comment.

Creating captchas on the fly might not always be possible. Especially not since I will be relying on Bash. So it might be a nice idea to write a tool that can create a lot of captchas and a list with the text and colors that are used in each off-line. These can then be sent to the site and the comments plugin would only have to choose a random captcha and a random question (see above) and check the answer with the information from the file. If these ‘standard’ captchas are refreshed on a regular basis it should provide some nice protection from the spammers.

It seems that the tools from ImageMagick provide all the functionality needed so I will have a look at them this weekend.

Published by Niels on 14 Jan 2006

Boy, does that suck

This blog entry will not be very subtle. So for all Bono and Alicia Keys fans out there:

Stop Reading. I mean it!

Normally I have a live and let live philosophy. But after hearing what Bono and Alicia Keys did to the song “Don’t Give Up” I felt the urge to write a blog.

After hearing the song I came to a simple conclusion: Bono is not able to put emotion into his voice if he is not screaming and Alicia Keys is all bling-bling. And by bling-bling I mean that it is shiny but worthless. She cannot hold a note and always has to ad-lib in between. But to me ad-libbing (can I say that?) is a sign of being a singer of limited capability (unless done by a singer of great capability, ofcourse). The combination of the two sounds really bad compared to the original.

My idea of a cover is always: if you cannot improve on the original then do not cover a song.

A small suggestion to Bono and Alicia Keys: Remove this single from the market and donate the money it would generate from your own pockets. It can’t be that much since no one in their right mind would buy this. So remove it and donate. It is a win-win situation. The charity wins and we win (and you have learned never ever to do this again).

Published by Niels on 14 Jan 2006

Why not…

Use Bourne Shell/BASH/Korn Shell/etc. as your CGI language? To me it would be the perfect fit with NanoBlogger to do my server side scripting. A short (but crude) example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
 
echo "Content-type: text/html"
echo ""
 
cat << EOF
<html>
<head><title>Your environment variables</title></head>
<body>
EOF
 
env
 
cat << EOF
 
</body>
</html>
EOF
exit 0

Put this in in a file called test.cgi and put that file somewhere in a directory where your web page is hosted. Make sure that the following is set on test.sh:


chmod 755 yourdir
chmod 755 yourdir/test.cgi

Now point your browser to http://www.yourdomain.com/<yourdir>/test.cgi and behold, a nice overview of the environment variables your provider provides for you!

I think this is the perfect way to make a NanoBlogger powered site more interactive. Here are some nice examples of the things that can be done using Shell CGI scripting.

Although a comments addition for NanoBlogger can be found here I think I could give it a shot to implement the same functionality using Shell scripting. Not that I am opposed to using PHP and MySQL, but using Shell scripts seems a bit more pure to me in combination with NanoBlogger.

If there are any disadvantages and reasons why Shell scripting should not be used for this I would be glad to hear about it.

Update:
I renamed test.sh to test.cgi as my browser suggested to download the script rather then being executed on the server. And quotes have been put around “Content-type: text/html”. It is probably not necessary, but I like consistency.

Published by Niels on 12 Jan 2006

The first release of the Code Formatting Plugin – Version 0.1.0

As mentioned in a previous blog, a plugin to format code snippets in NanoBlogger entries has been in the making. It seems that a first workable version can be downloaded here.

How does it work
In short: just start a line before the code snippet with ‘CODE(<language>){‘ and start a line with ‘}CODE‘ after the code snippet. No other characters may appear on this line. Example:

CODE(c){
#include <stdio.h>

int main( int argc, char* argv[] )
{
    (void)printf( "Hello, World!n" );

    return 0;
}
}CODE

This results in the following:

1
2
3
4
5
6
7
8
include <stdio.h>
 
int main( int argc, char* argv[] )
{
    (void)printf( "Hello, World!n" );
 
    return 0;
}

Here are some other examples:

C#:

1
2
3
4
5
6
7
8
9
10
11
12
using System;
 
namespace Hello
{
    class World
    {
        public static void Main()
        {
            Console.WriteLine( "Hello, World!" );
        }
    }
}

Bourne Shell/BASH:

1
2
3
#!/bin/bash
 
echo "Hello, World!"

The real XHTML generation is done by ViM, so be sure that that is installed on the PC you use for NanoBlogger. Since XHTML is basically XML where you are expected to do the formatting in a stylesheet, you can add the following to your stylesheet if the code needs to have a black background:

.nbcode { line-height: 120%; }
.nbcode .Comment { color: #00ffff; font-weight: bold; }
.nbcode .Constant { color: #ff40ff; font-weight: bold; }
.nbcode .Error { color: #ffffff; background-color: #ff6060; font-weight: bold; }
.nbcode .Identifier { color: #00ffff; font-weight: bold; }
.nbcode .PreProc { color: #8080ff; font-weight: bold; }
.nbcode .Special { color: #ff6060; font-weight: bold; }
.nbcode .Statement { color: #ffff00; font-weight: bold; }
.nbcode .Title { color: #ff40ff; font-weight: bold; }
.nbcode .Todo { color: #808080; background-color: #ffff00; }
.nbcode .Type { color: #00ff00; font-weight: bold; }
.nbcode .lnr { color: #ffff00; font-weight: bold; }
.nbcode body { color: #ffffff; background-color: #000000; }
.nbcode pre { color: #ffffff; background-color: #000000; }

Or the following if a white background is preferred:

.nbcode { line-height: 120%; }
.nbcode .Comment { color: #8080ff; }
.nbcode .Constant { color: #ff6060; }
.nbcode .Error { color: #ffffff; background-color: #ff6060; font-weight: bold; }
.nbcode .Identifier { color: #00ffff; }
.nbcode .PreProc { color: #ff40ff; }
.nbcode .Special { color: #ff40ff; }
.nbcode .Statement { color: #ffff00; }
.nbcode .Title { color: #ff40ff; }
.nbcode .Todo { color: #808080; background-color: #ffff00; }
.nbcode .Type { color: #00ff00; }
.nbcode .lnr { color: #ffff00; }
.nbcode body { color: #000000; background-color: #ffffff; }
.nbcode pre { color: #000000; background-color: #ffffff; }

Installation:
Depending on the version of NanoBlogger used place the plugin code.sh in one of the following directories:

  • plugins/entry/mod (>=3.2)
  • plugins/entry/body (3.1)
  • plugins/entry (>=2.8 && <3.1)

The plugin combines nicely with for example Markdown, as long as the plugin is called on the entry body before the Markdown plugin. Since code.sh comes before markdown.sh alphabetically this should not be a problem.

If you do not want NanoBlogger to call code.sh for every entry, the plugin can alternatively be placed in plugins/entry/format. If the code formatting plugin capabilities are needed just add code to the FORMAT: meta tag in the entry. As mentioned above, be sure to put it before any other format setting like markdown.

From blog.conf, nb.conf or using environment variables, the following variables can be set to influence the behavior of the plugin:

  • NBCODE_VIM
    Where ViM can be found. Defaults to vim.
  • NBCODE_TABSTOP
    Number of spaces a tab counts for. Defaults to 4.
  • NBCODE_SHIFTWIDTH
    Number of spaces for each indent. Defaults to 4.
  • NBCODE_EXPANDTAB
    Replace tabs with spaces (yes/no). Defaults to yes.
  • NBCODE_NUMBERING
    Add line numbering (yes/no). Defaults to yes.

Since this is the first release expect some bugs. Feel free to contact me for comments, questions and suggestions.

Published by Niels on 07 Jan 2006

Progress…

Being not much of a regular blogger, you should not get here for daily updates, but I suddenly felt the urge to provide a small update on this blog.

I made a nice list of projects I am working on or have planned, but once you start there does not seem to be any finish (that’s called life I guess :) ). So here are two more projects, but contrary to the ones mentioned in the previous blog, these are about to be released. I hope I can release the first one this weekend, or else the next weekend. But no later than that.

The projects:

  1. A plugin for NanoBlogger to ‘automatically’ format and syntax highlight source code in your entries. So you can do stuff like this:

    Hello World
    Only more nicely formatted, with less hassle (this has been inserted using Markdown, ugh!) and without breaking the W3C rules for XHTML as I have done now :(.

  2. A .NET class written in C# to read and write configuration files (ini-files). Not very special, but come nice extras will be provided like syntax formatting.

Update:
I changed the code example above to a PNG to keep this site XHTML compliant.

Published by Niels on 01 Jan 2006

IE6 on Ubuntu Linux

First of all: A Happy New year!

Diona uses the Linux setup we have here at home. Previously all machines were running Gentoo but a couple of months ago the switch was made to Ubuntu as the constant compiling and tweaking took too much of our time. And we have a more purposeful use for our computers than constant downloading and compiling.

Back to installing Internet Explorer 6 on Ubuntu:

First make sure that the following packages are installed:

  • wine
  • xdialog
  • alien

If not, install them using the following command on the command line:

sudo apt-get install wine alien xdialog

Next, download winetools. Grab the .rpm. On the command line go to the directory where the winetools were downloaded and issue the following command:

sudo alien -i winetools-0.9-3jo.i386.rpm

Replace the name of the RPM if necessary of course :).

Winetools needs Xdialog, but on Ubuntu that is not installed in the place where it is expected. So go to the Winetools directory and make a symbolic link to Xdialog:

cd /usr/local/winetools

sudo ln -s /usr/bin/Xdialog

Go back to your home directory (not really necessary, I just like to be there when possibly goofing things up) and start the Winetools using the following command: wt. Everything after that should be straightforward. You get the possibility to install IE6 from here. Do not forget to install all the MS fonts.

Winetools is so nice to create Wine launcher scripts in ~/bin, so IE can be started using the following command:

~/bin/ie6

But you might find it more convenient to make an entry in the main menu of your desktop environment.