Latest Post

JQuery Keyboard

For some reason I got it into my head that I would like to create an on screen keyboard that mimicked my actions.

It was also a good chance to get stuck into some more JQuery. There were three main parts to this code.

READ MORE

Dream Team Update

Bloody Crap

It seems I failed to realise that Man Utd right back Rafael is injured and will not be available in the foreseeable future. Well that £3.5 million thrown away.

If you add that to the fact that Babel of Liverpool has hardly started any games so far this season and Eduardo is still being used sparingly then you will then begin to realise why a little behind the leaders at the moment. My current position is 407103

READ MORE


SQL Aggregate Functions

SQL Aggregate functions return a single value, using values in a table column. Below is a list of SQL aggregate functions and how to use them.

AVG() Function

The AVG() function returns the average value of a numeric column.

SELECT AVG(column_name) FROM table_name

READ MORE


Getting submitted form data with JQuery

Acquiring submitted form data with JQuery has always been a bit of a problem for me so I thought I would share how I (still a novice with JQuery) now handle this problem.

My first method is to loop over all the input, select and textarea's within the form.

$.each($("input, select, textarea"), function(i,v) {
             var theElement = $(this).attr('name');
             var theValue = $(this).attr('value');
             if (($(this).attr('type') == 'radio')){
                    if ($(this).is(':checked')){
                        alert(theElement + ' - ' + theValue);
                    }
                }
                else
                {
                    alert(theElement + ' - ' + theValue);
                }
            });

READ MORE


SQL Server Date Functions

In my quest to improve my SQL skills I wanted to get used to some of the date functions that can be used in SQL Server.

year(), month(), day()

Using the following SELECT statement I can extract the month from the date of birth field. I can then order the results by this data in order to get a month by month view of birthdays. The same could happen with year() and day()

SELECT     firstname, surname, month(dob) AS birthMonth, dob
FROM     yourTBL
ORDER BY birthMonth

The results

READ MORE


SQL Wildcards

Ever since I started with SQL i've know about the '%' wildcard. Recently i've had this desire to improve my SQL skills and I found a few new wildcards which are outlined below.

% Wildcard

Using the following SELECT statement I can return all players who's firstname start's with an 'A' followed by zero or more characters.

SELECT    *
FROM    yourTBL
WHERE firstname LIKE 'a%'

The results

READ MORE


Xbox 360 Achievement Generator

Ever wanted to make your own xbox achievements? Use this Xbox 360 Achievement Generator to create your own achievement image.

Why did I make this generator? I dont know. Everybody I've shown it to say "what's the point?". Well there is no point, but I like it.

READ MORE


TA6 Dream Team

Am I going to win the £250,000 first prize in this years sun dream team?

Yes Probably

Am I going to win numerous manager of the week and month awards to top up the prize fund?

Of course

How can I be so sure? Just take a look at my team.

READ MORE


Clearing default input values

Here is a quick and easy snippet to remove default values from input fields on focus.

For each result, it clears the default value onfocus and restores the default if the value is empty onblur.

(function($){
    $.fn.clearDefaultVal = function(){
        return this.each(function(){
            var default_value = $(this).val();
            $(this).focus(function(){
                if ($(this).val() == default_value) $(this).val("");
            });
            $(this).blur(function(){
                if ($(this).val() == "") $(this).val(default_value);
            });
        });
    };
})(jQuery);

$('input.cleardefault').clearDefaultVal();


Shopping cart form with JQuery validation

I thought this would be a good starting point for anyone who is creating a shopping cart and needs a form to process the details.

Although the form comes with some JQuery validation I would recommend that you also add server side validation for those 5% of users that have javascript turned off.

READ MORE


More Entries