Thursday 21 April 2011

Using Apache As Server In A Local Area Network (LAN)

Let's said, you have set up server for LAN usage only. If you have ever come across to a page stating "Could not connect to remote server" or alike, can try out this solution.

1. Open the apache configuration file, httpd.conf.
2. Go to the section that configure the ip address.
3. Make sure it listen to the server's ip (not 127.0.0.1)
eg. Server's ip is 192.168.x.x using port 80, the make sure you have the following line :

Listen 192.168.x.x:80

Monday 18 April 2011

Time Wasted On Nested Javascript Functions With onSubmit()

I want to create nested Javascript functions for my onSubmit() validation. However, it seems that my skill is still not there yet, (or there is javascript rendering problem in Opera?) where the form is still submitted even though the value returned for the onSubmit() is false.

So, the solution is:
Use back the old school method -- Structured programming without calling of nested functions!

And several hours has been wasted...

Wednesday 13 April 2011

Internet Explorer 7 Failed To Render Simple Javascript and HTML DOM

Speechless, where i can use the same portion of code successfully in Opera, Chrome, Firefox and Safari...

Tuesday 12 April 2011

CSS in PHP file

To enable css effects in a php file, just remember to declare !DOCTYPE (for HTML5) and HTML tag inside the php file.

HTML5 iframes line up horizontally

Feel troublesome when want to have several iframes lining-up horizontally? Because at least one of the iframes will move to the next row?

Solution: Make sure that the sum of iframes' "width" is less than 100%. (only applicable if you are using percentage for the width)

To Convert Microsoft Access Table Into MySQL Table - Part 2

There are some common practices to be done when doing this type of conversion:

1. Before converting Access file into CSV file, make sure
a) Data does not contain any backslash (\) and semicolon (;) -- programming common sense.
b) Be careful of the usage of any special characters, because utf8_bin will not recognize it.
c) In Access, when changing column of "Currency", it's better to change into "Text" but not "Number" because the decimal of the data will be removed when changing into "Number" whereas the decimal of data will still be kept if it is changed into "Text".

2. If using phpMyAdmin and MySQL, make sure
a) The format of date/datetime/timestamp and the number/currency/float/decimal in the Access file is compatible with the field formats in the MySQL table -- otherwise you will get something like 0000-00-00 00:00:00 for your datetime, or $123.00 in your price/amount field.
b) My suggestion is to set the date/time into text/varchar format for the conversion, and later change them into date/time format in MySQL using php, and so with the number/currency field.

3. Try to play with it, and you will know what i am talking about.

Monday 11 April 2011

To Convert Microsoft Access Table Into MySQL Table

Currently using: Microsoft Access 2007, phpMyAdmin.

1. In Access, export into csv file.
a) export the table into text format, however in the file name, make sure the file extension is csv.
b) do not specify any export options.
c) choose 'delimited' format, my preference: delimiter - Semicolon, text qualifier - " -- to match with the options in phpMyAdmin later.
d) finish it.

2. In phpMyAdmin, import the csv file.
a) make sure that the database and tables are using collation of "utf8_unicode_ci", benefit: it will avoid the conversion of special characters when importing the csv file.
b) create a table where the field structure types are to be the same as in the Access table.
c) in the table, select 'import' and choose the csv file.
d) 'character set of the file' is 'utf8', 'Format of imported file' is 'CSV'.
d) finish it.

3. There it goes!