Archive for the ‘My Posts and Articles’ Category
Who doesnt need to implement a data validation technique along with every online form?
Bellow is a basic javascript code to check that no form is submitted with empty fields:

Charset Problem
The image above is showing part of a small hack I coded for a phpBB board to show topics from selected sections. Those question marks were suppose to be Arabic letters, but after a recent update to phpBB the hack failed to use the board config file to connect so I had to set up my own direct connection to the DB.
The connection was fine, but I got “?????” instead of something I can read in Arabic. After some tests I figured out, though the MySQL DB is using UTF-8 as a character set, which means it can handle the language efficiently, I had to set the character set to UTF-8 via PHP for every query using the following code:
1 | mysql_query("SET CHARACTER SET utf8"); |
What is even better is setting the character set at once with a single line of code for the whole connection by using the following code:
As part of an experiment for testing a new authentication mechanism for web applications (will post more about it sometime in the future) I needed my users to select only four images out of many while filling a form.
I used a CheckBox beside every image and developed a JavaScript code to limit the number of checkboxes allowed to be ticked.
FileZilla is a great free FTP solution, which has been very useful to me for the last few months. However, after updating to 3.2.0 I started getting the following error: 421-too-many-connections-8-from-this-ip
I got rid of it, by Opening the Site Manager -> Transfer Settings then ticked “Limit number of simultaneous connections” and put “1” for the Maximum number of connections. Obviously, this solves the problem because it limits the allowed connections by FileZilla Client to 1.
Advanced Quick Reply is a nice phpBB Mod by “Z3u5″. I’ve adopted it for many phpBB boards I developed. However, it got this tiney little problem with IE, where users are taken to the buttom of the page everytime they open a topic to read.
You may stop this by taking off:
1 | textarea.focus(); |
To disable this function, open: styles/…/template/editor.js within your phpBB3 directory then add the PHP comment tag infront of it as you see bellow:
1 2 3 4 5 6 7 8 9 | if (is_ie && typeof(baseHeight) != 'number') { //textarea.focus(); baseHeight=doc.selection.createRange().duplicate().boundingHeight; if (!document.forms[form_name]) { document.body.focus(); } } |
Create Favicon(s)
Every time I need to create a Favicon for one of my websites I used to start googling for free or limited software then remove it afteruse only to start searching again after a couple of months once I realize I actually need to create another Favicon!
If you go through this hassle sometimes, say enough and just refer to the following links or scroll more to install a useful and FREE plugin for your Adobe Photoshop to start saving .ico files. Thus, as long as you have Adobe installed, saving .ico files will be as easy as saving JPG and GIF files.
If you have got the following error messages on your website after entering your first event to test the EventList componant.
Warning: Invalid argument supplied for foreach() in
… /components/com_eventlist/helpers/route.php on line 87
Warning: Invalid argument supplied for foreach() in
… /components/com_eventlist/helpers/route.php on line 96
Then you either:

Have you seen a code similar to this before?
An interesting example from real life is the stone of James Leeson, who died in 1792. For a long time, the box-and-dot code at the top of the stone (Figure 1) remained a mystery for the public, but the secret was revealed as Meyer Berger explained in his NY Times column in the 1950s, it was finally decrypted. It says: “Remember death”. It was a Masonic cipher.

Figure 1: Stone of James Leeson 1
Joomla! was released under the GNU/GPL License which means you can indeed clean up the generated code of your website from any Joomla! related links and copyright information. Still you should know that you may not remove them from the source code itself e.g. from the PHP files on your server.
1. To clean your website footer by removing “Powered by Joomla!. Valid XHTML and CSS.” and any other possible copyright notices:
