Temporary Password Generation

I am working on registration for a system where it generates a password and then emails to the person registering. Here is the method I used to come up with short, unique and somewhat complex passwords.

I did it in php, but you can use the algorithm in any language.

<?php

function generate_password() {
    return substr(md5(time() . rand()), rand(0, 24), 8);
}

?>

It takes a random eight character slice of an MD5 of the time plus a pseudo-random integer, which will give you an alphanumeric string. It is a short but complex enough of a password to give someone until they can change it to whatever they want. I thought this was pretty clever, so I wanted to share it here.

Color Scheme Tool

This is a great tool for generating color scheme ideas from a single color. You can generate complements, split-complements, triads, tetrads, analogous and monochromatic colors from your source color. The thing I really love about it is that has a button that will give you a random color to generate a scheme from, this is really useful for brainstorming color ideas.

I used this tool to come up with the colors on this theme (as of the writing) based on the triad colors of the shade of blue. This is one of the many applications that I enjoy that you can’t find anywhere except on Linux.

Project Homepage
http://home.gna.org/colorscheme

Clickable: Pictures

This is a service that aggregates pictures from a number of social networking and news sites. It is a great place to find some visually interesting stuff.

http://www.picurls.com

Free Ubuntu Workshops

With the coming release of their new version the people at Canonical are running some free workshops all through the week of October 22nd through the 27th. I am pretty excited. The schedule looks like it has a lot sessions related to the different derivatives of Ubuntu as well as some Q&A. It seems that they are focused on how to get involved, but I am sure that it will be an informative event even for the casual Ubuntu user.

I am going to try and attend what I can and then just transcribe the rest for later reading.

Information about the sessions.
https://wiki.ubuntu.com/UbuntuOpenWeek

The workshops will be done over IRC. Below is a list of IRC applications for the different platforms, so you can join in. I would encourage anyone looking for volunteer opportunities to consider giving time to worthwhile open source projects.

Linux
Konversation - http://konversation.kde.org
XChat - http://www.xchat.org

Mac
Colloquy - http://colloquy.info

Windows
XChat - http://www.xchat.org

Browser Based Javascript Code Compactor and Formatter

This is a simple tool that can help you compact or cleanup your Javascript code without having to worry about it breaking by random code obscurities. I came across this a while ago when I was trying to compact some Javascript files into one line and I was running into errors. There are some random issues where a bit of code cannot share a line with another.

It is based on the toString and toSource methods. It gives you a glimpse of how the browser sees the code. I believe this tool only works in Firefox, but the code it produces works the same as it was originally written in all browsers.

Paste your Javascript code in the box below.

Default Value for Input Text

This is a Javascript that will erase and replace a string of default text for an input element on a web form when the users clicks into or out of a field. I have probably written forms of this script about a thousand times in about a thousand different ways, however this is one of more elegant ways I have done it and I wanted to record it here. You can see a working version of this script by clicking here.

<script type="text/javascript">

/**
 * Maintains a default value for any number of input elements in a form.
 *
 * More details at http://www.finefrog.com/2007/10/07/default-value-for-input-text/
 *
 * @author Jordon Mears <jordoncm at gmail dot com>
 *
 * @param object element Reference to the input element.
 * @param string status Whether it was called onfocus or onblur.
 * @param string text The default text.
 */
function default_text(element, status, text) {
    switch(status) {
        case 'focus':
            if(element.value == text) {
                element.value = '';
            }
            break;
        case 'blur':
            if(element.value == '') {
                element.value = text;
            }
            break;
    }
}

</script>

<form action="" method="post">
<input type="text" value="default text"
onfocus="default_text(this, 'focus', 'default text');"
onblur="default_text(this, 'blur', 'default text');" />
</form>

Anyone is welcome to use this script, all I ask is for you to maintain the credits (and maybe leave me a comment).

{
}