Focus on first form input field or textarea onload page using jQuery
Posted on Thursday 9 April 2009

This Javascript basically only sets the focus on the first form input field or textarea of a form when the page is loaded. i use this in my CMS because I hate it when I e.g. have to manually type in a list of emails in a form always click in the first input field to start typing again. This script uses jQuery.
Limiting the length of characters in a textarea using javascript
Posted on Wednesday 8 April 2009

I use a javascript that‘s very easy to use. All you need to do is include the JS file and add a maxlength attribute to a textarea element with the amount of characters you want to allow. That‘s it. I use this to limit the input of characters for page meta-tags to 160 characters.
e.g.
< textarea cols="60" name="field" rows="3" maxlength="160">
And add onload=‘setMaxLength()’ to the body tag:
< body onload="setMaxLength()">
How to make a simple jQuery Ajax request
Posted on Monday 9 March 2009

jQuery is an amazing javascript framework. It‘s makes Ajax so easy. You don‘t have to know anything about Ajax to use it. I‘ve made a simple example on how to use jQuery to make an Ajax request. First, start with creating a database with the name jquery_ajax. I‘ve included the sql dump in the example. In the database there‘s 1 table, called comments. Then we‘ll need to include jQuery in our html file. Next, add a div with a class loading. In the css file the loading class is hidden so we‘ll use
to hide it. You can call the jQuery.approve() function on whatever DOM element you like. Here we‘ll pass on 1 parameter (the id of the comment to be approved) to the function.
input id=“1” onclick=“jQuery.approve(1);” type=“submit” value=“Awaiting approval”
Database table with all the countries, Belgian cities and dropdown with all the countries
Posted on Tuesday 3 March 2009
Below you can download a zip file with SQL dumps of all the countries and another SQL dump with all of the Belgian cities with their postal code, longitude and latitude. I‘ve also included a dropdown with all the countries. I found this on the Snipplr website.
The new safari 4 (beta) browser features
Posted on Wednesday 25 February 2009
Yesterday I installed the safari 4.0 beta. The latest safari version works on windows, as well as mac. There are about a 150 features according to Apple. Some are new, some old.
First obvious changes are the top sites and the new tabs. The UI now has a more windows-like feel to it (in a good way :). It has the look and feel of the chrome browser. Opera and other browsers already had something similar to top sites. Top sites is like a 3D gallery of your most visited websites. It monitors changes in websites since your last visit and marks changes by adding a blue star icon in the right hand corner. That way keeping yourself up-to-date was never easier. Too bad it‘s not as responsive as I‘d want it to be, so I won‘t use it as my start page yet.

The new tabs take a bit of getting used to but gains you about 20px of space because the tabs are on top now. The full-page zoom is a cool feature which allows you to zoom in on a page without any loss of quality of the fonts. Images are being upscaled whilst zooming. Another added feature is the cover flow to browse through your favourites. In my opinion this looks fancy but is quite useless.
Creating views with MySQL instead of filtering out records with SQL
Posted on Wednesday 18 February 2009
I was just reading Pro PHP security and I‘ve learned something very handy. When you‘re, for example using an active field which marks active pages in your table, Instead of including “WHERE active=‘1’” every time you want the get the active pages you can create a view table that filters out these records. In my example, I‘ve used a table ‘pages’ and created a view table ‘pages_view’. My pages table contains these fields:
ID (PK, INT)
title (varchar)
text (varchar)
active (ENUM 0,1)