Changed theming to use Crossbrand

I have not blogged in a while due to personal circumstances, like having started on a new job which keeps intensifying, but also because I was unsatisfied with the way my sites handle templating.

Let me explain, I have a shared webhosting account and run multiple domains and subdomains. Some (actually most) of them require the same theme but have different theming mechanisms.

What I needed was a cross-(sub)domain branding solution!

Having looked around on the internet and coming to the conclusion there are none out of the box, I decided to build one myself.
Now, a month later (don’t have much spare time and more hobbies and interests ;)) I can say, I am almost done!

This blog is now officially running on Crossbrand. I will release it to the community once I have ironed out the last glitches and finished documentation.

Check back regularly if you are interested!

A new design!

It was long overdue but I have finally managed to finish the new design for the Naenius.com website. My intention is to use this design in all subparts of this website, as well as the new parts I am concocting in my brain.

With the implementation I did notice a few artifacts. For one, I did not implement a comments form. Actually I already knew about this but I was fed up with the old design and thus I decided to launch ‘prematurely’.
Aside from the above I noticed that the sidebar could use some additional styling. All bullets went missing in the design and this is not really my intent (specifically with the categories widget).

Aside from the things I mentioned above it has been a good launch! Now it is time to test this bird in Internet Explorer and hope all goes well ;)

If you would like to comment on this design, either wait until I have added the comments form or send me an e-mail!

Installing Lotus Notes 8.5 on Kubuntu / Debian Linux KDE

I have recently switched from employer in search of new opportunities, a new challenge and more tech-savy colleagues. After just 2 days I can say that I have found at least the latter two. Although I never expected to find a challenge in the mail system used, namely IBM Lotus Notes.

After leaving my previous employer I had hoped to leave my windows days behind for I was bound to the demonic Windows due to proprietary applications. I have adopted Kubuntu as my new Ambrosium.

Yet the funniest thing happened, I have to use Lotus Notus. Another windows only application by IBM.

As you can imagine I was mortally terrified when I learned no Linux client was there and no IMAP connection could be made (I have been told it is next to impossible with Notes). But then I found the IBM Lotus Notes 8.5 Open Beta 2 for Linux client
(IBM Id needed but can be created for free during the process). This 460mb download is almost all that is needed to get it working.

Here are the steps that I have done to install Notes,

  1. Download the application from the link given in the previous paragraph, choose the Debian package
  2. Untar the downloaded file tar -xvvf <filename><
  3. Install the notes debian package as rootsudo dpkg -i ibm_lotus_notes-8.5.i586.deb
  4. In order to run the application it needs several Gnome packages. If you try to run the application but it won’t start, then you are missing some. To find out which, start the application from Konsole and it will display what it misses. The binary can be found in /opt/ibm/notes.
    I missed the libgnomeprint2.2-0 and libgnomeprintui2.2-0 packages
  5. The installation has now created a folder lotus in your home folder as the user root. Since we will be starting the Lotus application with our own user we need to give it back from root to ourselves. Thus you execute chown -R <youruser>:<youruser> /home/<youruser>/lotus
  6. Run it and configure it just like you would do with the windows version

After figuring out the steps above I was seriously relieved that I could stop reading my mail over a Remote Desktop connection and enjoy all that Kubuntu has to give to me.

Enjoy!

An introduction to Scrum

Whilst attempting to enrich my knowledge about Agile methodologies and Scrum in specific I found the site Learning Scrum. This site turned out to be a jewel and it contained a video of a Google Tech Talk by one of the Godfathers of Scrum, Ken Schwaber.
In this talk he explains the history and purpose of scrum as well as what usually happens when developers get into time shortage. On of my favourite quotes from the video is:

By cutting quality we can produce more crap.

How true…

Below is the embedded video as first seen through http://learningscrum.com/20080315/scrum-et-al-video/

If you like to know more, view this video. It is one well spend hour of your life!

Validating an e-mail address according to RFC 2822

E-mail addresses are bitches!
There, now that is said I can tell why.

Should you ever have time on your hands you should read RFC 2822, it provides an interesting (though somewhat dull) background into e-mail messaging. Alas one can also see why it is so hard to validate an e-mail address, it is an extremely flexible format which is quite hard to check.

Fortunately I found a little gem on http://www.regular-expressions.info/email.html which is all about parsing E-mail addresses with regular expressions. For your (and my own) leasure I have prepared a snippet which you can copy paste right into your code.
One small note: this regexp is not fast! It is designed for accuracy, thus I’d advise so I would recommend to on a high traffic site to use the adaptations proposed on the website above.

$regexp = "/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/";
var_dump(preg_match($regexp, 'mike.vanriel@naenius.com'));

Have fun!

Generating passwords in PHP

There are those things you encounter again and again and again. Generating passwords is one of those. My experience is that whenever an application needs to be created which deals with user account creation, it is best to let my application create a password for the user.

Why? Simply, I am lazy.

Good developers and users alike are and should be thus lazy that they should not want to think of a new password. All they need is to just generate one with a click and jot it down somewhere!
I have now encountered three or four separate applications which dealt with user creation and every time I have turned to Google and find a method for generating passwords which I subsequently adapt for my own specific application.

To help myself and perhaps you (who probably came from the Google website as well) I have posted (one of) my password generating method(s). The code which I have used here is originally from someone else but I forgot to mention this in my source file. If you recognize this code as your own please comment it so I can give recognition where due. Thought I must comment that I have changed it quite a bit..

/**
 * This method generates a random character value between the 33(!) and 126(~)
 * @return int
 */
function getRandomNum()
{
    $rndNum = rand(0,100) *10; // between 0 - 1000
    $rndNum = ($rndNum % 94) + 33; // rndNum from 33 - 127
    return $rndNum;
}
 
/**
 * Check if a character value is a special / punctuation character, if so returns true
 * @param int $num
 * @return boolean
 */
function checkPunc($num)
{
    if ((($num &gt;=33) &amp;&amp; ($num &lt;=47))
    || (($num &gt;=58) &amp;&amp; ($num &lt;=64))
    || (($num &gt;=91) &amp;&amp; ($num &lt;=96))
    || (($num &gt;=123) &amp;&amp; ($num &lt;=126))) {
        return true;
    }
    return false;
}
 
/**
 * Generates a new password, if the length parameter equals false then
 * a random length is chosen between 5 and 15 characters long.
 * @param int|boolean $length
 * @param boolean $noPunctuation
 * @return string
 */
function generatePassword($length = 8, $noPunctuation = true)
{
    $password = '';
    if ($length === false) {
        $length = rand(5,15);
    }
    for ($i=0; $i &lt; $length; $i++) {
        $numI = getRandomNum();
        while ($noPunctuation &amp;&amp; checkPunc($numI)) {
            $numI = getRandomNum();
        }
        $password .= chr($numI);
    }
    return $password;
}

Update 11-01-2009:
As it seems I had to implement a password generator in javascript today.
So I Googled one and found it on http://psacake.com/web/ei.asp. This version funnily looks the same as the PHP version posted above, perhaps they share the same roots?
Anyhow, here it is:

function generatePassword(length, punction, randomLength)
{
    if (parseInt(navigator.appVersion) < = 3) {
        alert("Sorry this only works in 4.0 browsers");
        return true;
    }
 
    if (!length) length = 8;
    var password = "";
 
    if (randomLength) {
        length = Math.random();
        length = parseInt(length * 100);
        length = (length % 7) + 6
    }
 
    for (i=0; i < length; i++) {
        numI = getRandomNum();
        if (!punction) {
            while (checkPunc(numI)) {
                numI = getRandomNum();
            }
        }
        password = password + String.fromCharCode(numI);
    }
    return password;
}
 
function getRandomNum()
{
    // rndNum from 0 - 1000
    rndNum = parseInt(Math.random() * 1000);
    // rndNum from 33 - 127
    rndNum = (rndNum % 94) + 33;
    return rndNum;
}
 
function checkPunc(num)
{
    if (((num >=33) && (num < = 47))
    || ((num >=58)  && (num < = 64))
    || ((num >=91)  && (num < = 96))
    || ((num >=123) && (num < = 126))) {
        return true;
    }
    return false;
}

My current affairs

Teaser of the new Naenius design

Teaser of the new Naenius design

I have neglected some of my contacts and social places. Although I would like to blaim my busy life for it, it is also a matter of just not making time for it.

So to entertain myself and others, I can share that one of the things I am working on is a redesign of my ‘brand’ and website.
The logo was renewed during the last redesign and I will continue to use that. The things that needed improvement (IMHO) was that the colors could be lighter, causing a less depressing feeling and an additional reason was that I was in the mood for some graphical tinkering.

An additional benefit is that I am taking into account the twitter posts on my blog and make them less visible. Thus making actual posts more visible and dominant.

Unfortunately I have much to do and far too little time to get anything done (or so it seems these days). So all I can say is that it is underway but when it will exactly launch.. I do not know yet..

Moving to a new host

What I want is not what I can get at my old host. Thus in order to do get what I want I have decided to move my domains to a new webhost.

I have requested the move to be done monday the 22nd of december at 22.00 hours. I still need to get confirmation but am quite sure all will go ok.

During the move a notice will be placed informing you about the maintenance. This site will be unreachable in the meanwhile.

Now, let’s pray all goes well ;)

Spam has left the building … finally

I have done it, on the 29th of November I finally activated Akismet and begun cleaning up spam which was still remaining on my blog.

Today, I took the time and the liberty to remove the last spam comments AND write a new (perhaps for some quite uninteresting) blog post. When I started my blog I did not expect to be carpet bombed by this much spam but alas, even I had to undergo this torment. Due to the fact I found myself not interesting enough (yet?) to be spammed did I not bother to activate Akismet and forgot about it.
When spam issues arrived I tried several non-interesting and absolutely useless options until MissYeh reminded me off Akismet. I still owe her..

Should anyone be reading this who is thinking about starting his own (Wordpress) blog: install Akismet from day 1. It will save you a lot of headache and it will in the end save you a lot of time fixing your blog.

Again a big warm thanks to MissYeh for helping me remember Akismet and thank you to the creators of Akismet for doing such a fine job.

Until next time!

Spam part II

For some reason I seem to have become popular with the spam bots. Not quite the crowd I was hoping for :)

It is not possible for me to keep deleting all spam until I have time to implement anti-spam measures. It is on my to-do list but other (more pressing) matters have priority. Should you have any good suggestions about anti-spam measures on Wordpress, let me know!

So.. This blog ain’t dead or unmoderated, just temporarily overrun :)

| Log in

  Copyright 2008, Mike van Riel