Click for info using AJAX

There's just one problem with my Ajax. I can only use it to send or receive data ONCE.. :'( so you can only click once, which sucks Okay so that was easy to solve. ALWAYS THROW AN AJAX.OPEN() BEFORE YOU ASSIGN A FUNCTION TO HANDLE THE RECEIVED DATA
Sorry for caps, but it seemed that was the problem, and I don't want any of you to get stuck the same way ;).

Click the Read on link for the source:
Read More...



Posted in Miscellaneous at May 24th, 2008. No Comments.

Hey,

You've probably heard of AJAX. It's an acronym for "Asynchronous Javascript And XML". It basically means you could use Javascript for updating a page, submitting info without refreshing and so forth. I've only just found out the basics of AJAX myself. It's not hard, but it requires (very) basic understanding of Javascript and HTML.

The biggest part about using AJAX is understanding the XMLHttpRequest() object. This object has a wide range of properties, functions and what not. But for basic AJAX you'll only need a couple.

Initializing the XMLHttpRequest object

 
function GetXML() {
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
}
}
}
return xmlHttp;
}

That is the function I'm using to get the object. Usually you could just use the XMLHttpRequest(), but since the (oh-so-loved) Internet Explorer doesn't support it. You need to make a complete function and have it return the object.

You can now use:

 
ajax = getXML();

to get the object instantiated.

Read More...



Posted in Tutorials, Web development at May 24th, 2008. 2 Comments.

I've kinda written a CAPTCHA image file :) Code after the jump.
Code explanation is right behind it; (Please view full).

 
<?php
session_start();
$numlines = 4;		// 4 lines/rectangles
$numcrap = 15;		// 15 bullcrap letters behind it.
$str = md5(microtime());
$crap = base64_encode(md5(sha1(microtime())));
$str = substr($str,0,5);
// Str = the string shown in the captcha
$_SESSION['captcha'] = $str;

Up until here, we've just initialized some variables. They kinda speak for themselves. $crap is merely some random nonsense to be displayed behind the actual text. Also, we've already registered the captcha string in the SESSION.
Read More...



Posted in PHP, Tutorials at May 23rd, 2008. 1 Comment.

After a month and four days, it's finally time to update again! Don't expect daily updates, but about every other day.

This monday, my new computer is scheduled to arrive. It's a huge upgrade over this one:

Intel® Core2 Quad Core Q9300 Processor (2,50 GHz, 1.333 MHz FSB, 6 MB cache)
4.096 MB 800 MHz Dual Channel DDR2 SDRAM [4 x 1.024]
256 MB ATI® Radeon HD 2600 XT gfx card
500 GB (7.200 rpm) SATA harddisk

those are the things that are upgraded most. The processor can be overclocked to 3.3 GHz. I'm gaining 3 Gigs of RAM, a new, good, graphics card and 340 Gigs of disk space.

Two weeks ago, I was on holidays to Tunis. Had a good time and when we got back, the weather over here was about the same as in Tunis. That was a bummer, and the weather only got worse since I got home. Hopefully there'll be sunny beach weather sometime this month...

Anyway,  no time to write :-o. Trying to make an AJAX example work..



Posted in Personal Blog at May 22nd, 2008. 1 Comment.

A holy man was having a conversation with the Lord one day and said,’Lord, I would like to know what Heaven and Hell are like.’The Lord led the holy man to two doors.

He opened one of the doors and the holy man looked in. In the middle of  the room was a large round table. In the middle of the table was a large  pot of stew, which smelled delicious and made the holy man’s mouth  water.

The people sitting around the table were thin and sickly. They appeared to be famished. They were holding spoons with very long handles that were strapped to their arms and each found it possible to reach into the pot of stew and take a spoonful. But because the handle was longer than their arms, they could not get the spoons back into their mouths.

The holy man shuddered at the sight of their misery and suffering.

The Lord said, ‘You have seen Hell.’

They went to the next room and opened the door. It was exactly the same as the first one.

There was the large round table with the large pot of stew which made the holy man’s mouth water. The people were equipped with the same long-handled spoons, but here the people were well nourished and plump, laughing and talking. The holy man said, ‘I don’t understand.’

It is simple,’ said the Lord. ‘It requires but one skill. You see they have learned to feed each other, while the greedy think only of themselves.’



Posted in Personal Blog at May 22nd, 2008. 2 Comments.