Extending MooTools

0 Comments
MooTools makes it pretty easy to extend its core functionality. It wasn't the first JavaScript framework I used. I started with Prototype, and although I don't think Prototype is as elegant as MooTools, I do miss some of the functionality.

For example, I often find myself checking to see if a string is empty or blank. A string is considered empty if it has no value, white spaces included. A string is considered blank if it has no value besides whitespaces.

To build onto MooTools library we will use the implement method built into the Native object. Each type of Native (String, Element, Array, etc) can use the implement function. › Read More

Creating a MySQL CAPTCHA Hash Table

2 Comments
In the last post I covered how to automate Photoshop to create CAPTCHA images. Now I'm going to show you how to take these images and upload them to your MySQL database using PHP.

At this point you should have all of the images in one folder. Create a new PHP file in the same folder. The first thing we will do is prepare the hashing. A hash is like encryption, but is one-way. In other words when you hash a value you can't get the original value back. We will be taking the filenames and hashing them.

define('SALT_LEN', 8);

function makeHash($plain, $salt = null) {
    if($salt == null)
        $salt = substr(md5(uniqid(rand(), true)) 0, SALT_LEN);
    return $salt . md5($salt . $plain . '^jC9|~?4');
}
 

This function uses the md5 algorithm. Also, we are salting our hash. A salt adds a bit of randomness to each hash. Without a salt all md5 hashes of the same string result in the same hash. By adding a few random characters the hash changes every time. This makes rainbow tables much more difficult, thus increasing security. › Read More

Creating a CAPTCHA Photoshop Preset

3 Comments
If you ever want to add a CAPTCHA input to a website you will have two options. The first is to use some opensource solution. You can find one easily online. The second option is to do it yourself. I usually go down this route in order to further my own understanding. I try to do as much as I can on my own to build up my experience. And I suggest doing the same.

The first step is to make the CAPTCHA images. Manually creating each image would take forever. The number of images should be large to reduce chance of showing the same twice.  In a situation like this it is best to create a Photoshop Preset; a script that automates what you need to do. If you go into the Photoshop directory on your computer you will see a folder labeled 'Scripting Guide.' Inside you will find a few useful PDFs explaining how you can do this. And there are also a number of sample scripts you can take a look at. Photoshop supports presets in JavaScript, AppleScript and VBScript.

In this tutorial I am going to show you how to create a JavaScript preset to make your images. › Read More

10 Sites to Find Freelance Work

3 Comments
Every web developer I know has done some sort of freelance work. Some do it for spare cash while others do it to pay for the food on the table. No matter what you reason is, there are always times when you need to find more work.

Here's a list of 10 websites that you can use (if not already) to find freelance (or even full-time) work. › Read More

Creating a Plugin for TinyMCE

0 Comments
TinyMCE is a powerful WYSIWYG (what you see is what you get) web-based editor. It is free, easy to implement and browser friendly. Most importantly, it does the job well.

But sometimes you need to add customized features. Out of the box solutions never seem to be enough. And it can prove difficult figuring out where to start. So, I am going to quickly cover the basics of writing a custom TinyMCE plugin. It's pretty simple, and once you have it down pat you can create a more complex plugin should be a breeze. › Read More
‹ Older