Friday, April 1, 2011

Free web template - Visit card

I just found this web template pretty nice, it is suitable for those who just want a simple introduction about themselves.
And, it's free!

This is the main page.

When clicking on a link in the main page, a picture gallery will be shown.

A contact form can also be added.

Check this out at Just Free Templates.

Friday, March 11, 2011

Page_Load event triggered twice

Problem:
There is a webpage in my current project, where the Page_Load event was always triggered twice. I realized that the problem occurred because of binding data to a ASP.NET ListView.

Solution:
After researching online for some time only I found that it's because of any Image control that does not set the ImageUrl. I am binding an image to the ListView, and I did not set any ImageUrl.
I just need to set the ImageUrl, that's all, and it solved my problem.

Reference: How Firefox Handles Empty SRC tags

Wednesday, March 9, 2011

My first php file

Finally, I've created my first php file - "Hello World"

The file has to be located in C:\wamp\www.
To browse the file, just type this in the address bar: localhost:81/testphp.php



Create database in MySQL

After setting up the WAMP Server, I need to figure out how to create a database in MySQL. Though it's not as easy as SQL Server management, it's still straight forward.

1. Start WAMP Server.
2. Go to phpMyAdmin.
    (As I have changed the port number, so I have to manually type this in browser address bar: localhost:81/phpmyadmin)
3. The first page allows you to create a new database.
    Just enter the database name, then click on Create button.

4. Next, we'll need to create a table.
    Just enter the table name, and specify the number of fields.
5. Then, we'll define the fields.
6. To insert records, click on the Insert tab, and enter the values.
7. Finally, if you want to view the records, go to Browse tab.

That's all! Here, I have successfully created the database. It's time for me to start learning php. ^_^

To start learning php: Set up WAMP Server

I just received a freelance job, which is to design a website template. All the functionalities should be okay, just that I need to create a login function for the website, which I can't use ASP.NET C# (the language I am familiar with), and I need to learn php for this.

To start learning php, my friend recommended me to install XAMPP. But, I couldn't successfully install the Apache service. Hence, I go for WAMP Server.

Installing WAMP Server is easier, but I still failed to browse the "localhost" page. After searching around, I found that it's actually the port 80 has been used by other applications, though I have stopped some of the SQL Server service. Finally I have found a way to solve this: Change the port number!

To change the port number:
1. Go to C:\wamp\bin\apache\Apachex.x.xx\conf
2. Open the httpd.conf file
3. Look for "Listen 80" and change the number to something else, e.g. 81
It's just this easy.

The trouble is that, every time when I need to go localhost, I have to manually type this in the address bar: localhost:81
It's okay for me, as long as it works! ^_^