Cracking the Lab! – 1

Being in the seventh semester has had its pros and cons. However, the labs in this semester haven’t been a good experience, in terms of all the trouble we had to go through just to get the software work at our home PCs for practice. I have tried hard and come close to what you might say, “a working” situation, where everything seems to work for me. Here are the steps I had to take to arrive at this very metastable state, you could try and follow the steps below to make things work for you; however, I do not guarantee that it will always work.

Also, here is the code for the programs I have written. Download it here. (Note: For database related programs, you will have to properly create databases/tables for it to work)

1. Fedora + Apache (for Perl, CGI, PHP, MySQL)

Get the latest fedora from and install it using all the packages selected (this is the safest way to do it; but if you know exactly what you are doing, you are free to select the right packages)

Once you are booted into Fedora, login using the root account (always do this – since you are on localhost, security should not be a problem for you.) and run apache and mysql.

  • Select “System” from the main menu, then click on “Services” in “Administration”.
  • Browse through the list and start (and enable) the “httpd” and “mysqld” services.
  • Now run the browser and point it to “http://localhost” to see if the apache service has started successfully. If it has, you will be able to see a Fedora Start Page in your browser.

You are now finished configuring. For working with apache you’ll have to know the following:

  • All “*.html, *.php, *. htm, *.shtml, *.xhtml” files go in “/var/www/html” directory.
  • All “*.pl, *.cgi” files go in “/var/www/cgi-bin” directory.
  • You’ll have to make the *.cgi, *.pl files executable by right-clicking on them and setting the permissions in their properties or by simply using the command in a terminal: “chmod 777 /var/www/cgi-bin/filename.cgi
  • If you find yourself looking at the “500 – Server Error” page, you might want to look into the logs to debug your errors. The logs are found at “/etc/httpd/logs/”

2. Tomcat + Java (for Java Servlet programming)

Get the JDK from the Java website here. And Apache Tomcat from here. Log into an account with administrative privileges and install them. Once you have installed both of them, you will need to set a few environment variables before you can start writing/compiling the code. I’m assuming that you have installed Java at “D:\j2sdk” and Tomcat at “D:\Tomcat”. (Make necessary changes in the below values as per your installation directories)

Variable Name


PATH D:\j2sdk\bin
CLASSPATH D:\Tomcat\common\lib\servlet-api.jar

You can set these variables by, right-clicking on “My Computer”. Then, choose “Properties”, and in the “Advanced” tab, click on “Environment Variables”. If a variable by that name already exists, you can append the above value to it by using the delimiter semi-colon “;”.

Spot check! Write a sample Java code and try compiling it by opening Command Prompt (Start -> Run: “cmd.exe”) and using the following command: > javac

If you get any error stating that “javac” is a bad command or filename, then there is something wrong with your installation. Recheck the above steps again.

Start the Tomcat server: Start -> All Programs -> Apache Tomcat -> Configure Tomcat. Once the Tomcat tool is running, click “Start”.

Open your browser and point it to: “http://localhost:8080/”. If Tomcat has been properly installed, you will see default Apache Tomcat page. If not, recheck the above steps.

That’s (sadly) not all of the configurations that you have to change in order for things to work. Right now, you will be able to code in Java and also compile it. However, you will not be able to code servlets unless you change the default “web.xml” file or add a custom web.xml file for your servlet. I’m going to tell you how to modify the default web.xml file so that you can get things to work.

Open the web.xml file (Located at: D:\Tomcat\conf\web.xml) in a text editor, and look for the following codes and uncomment them. (Remove the ‘<!–‘ and ‘–>’ around the code)


And this:


!!! One piece of warning !!! Uncommenting these lines will prove to be a security threat if you are doing it on a commercial web server. You shouldn’t really worry about it if you are using it at your home computer.

Once you are done with the above steps, you can be glad to know that nothing stands between you and coding the servlets now. (Phew!) Anyhow, you must know these for the things to actually work: (I’m assuming that you will be using the “ROOT” directory for your servlets, if not, make changes in the following paths accordingly)

  • All the “*.class” files go into “D:\Tomcat\webapps\ROOT\WEB-INF\classes” directory.
  • All “*.html, *.jsp, *.htm, *.shtml, *.xhtml” files go into “D:\Tomcat\webapps\ROOT” directory.
  • Use the “javac.exe” application (in “D:\j2sdk\bin”) to compile your code, which will create a classname.class file for you.
  • Now copy the .class to the classes directory and you can access the servlet using “http://localhost:8080/servlet/classname

Well, that’s it for now. Its sad that we have to go through all this just to practice five programs for our labs. Anyway, I hope all the settings work for you. If not, let me know; I hope I can help you.

P.S: Configuration for Networks Lab (Fedora + NCTUns) will be out tomorrow. 🙂


Adobe Flex – Redefining Web 2.0

Yesterday, I had been to “Flex Boot Camp” – a seminar on Flex conducted by Adobe.

For people who don’t know what Flex is – it is a framework on the top of Flash which works provides an interface to create complete websites in Flash giving it more OO classes and functions, and HTML components with base coding in MXML (Macromedia XML) and ActionScript.

Initially through the seminar, I liked the idea of a whole website working just like AJAX-amplified. The demos that they showed and the ease in which you could implement everything was amazing. According to the claims, web apps created using Flex, save bandwidth using the HTTPService() call pretty similar to AJAX. Also, Flex adds a semantic accessibility to your web application that a normal HTML page lacks. Though AJAX proves to be a strong competition to Flex, the fact that its a ‘hack’ in JavaScript might just limit its capabilities in the future. (Web 3.0?) Anyhow, Flex proved to be an eye-candy. As I’m writing this, I’m downloading the Flex SDK 3.0. Though I’m not sure how to transcend from my native web programming language (PHP/XHTML/CSS) I’m hoping that this article might help.

Coming to the general idea of how the web will welcome Flex, it all seems a little sweet and salty right now. Any webmaster would want his website to conform to high standards of:

  • Functionality
  • Design
  • Reach


As a webmaster, you’d look to make your website incorporating all the functions necessary for your users to get the best experience from the site and when they click the close button of their website, they leave with a satisfaction that their experience with the site was such that it would bring them back again. Having said that, the functionality may be the core navigability, a search feature, security functions or even the basic accessibility feature which lets the user choose the font size of the text that he reads on the website.

Doing all this not really an easy job. Especially if you don’t have a team of developers backing you with every module of the site. Comparing this in reference to Flex, Flex provides an exhaustible set of components and controls which makes the developer’s job much simpler. It combines aspects of component interaction with the end users as well as the interaction between the components themselves.


If “Content is King”, “Presentation/Design is Queen”. The design of a website is very important; in terms of enhancing the aesthetic value and also providing readability to the users. Design also focusses on the content presentation, ease of navigability and color sense. Though most of these are decided by the webdesigner to suit his needs as per his wishes, the feasibility of design increases with the use of Flex. Flex also provides support for Cascading Style Sheets (CSS) for certain elements (mostly HTML elements, rightly so). Some of the designs that were shown in the seminar were really good, seamless and clear.


What is the use of a website which provides perfect functionality and has beautiful design if it does not reach out to its potential users? Yes, I am talking about promoting your website. There are three ways to do this:

  • Peer to peer – Website promotion relies on word-of-mouth, tell-a-friend ways. Though these ways are ineffective in terms of reaching out to large number of users, it will certainly build a loyal readership.
  • Advertising – Publish ads relating to your website, describing its features to woo new users.
  • SEO – Search Engine Optimization is a hot topic in today’s web. Every webmaster’s goal is to have his site properly indexed by a search engine. It would not be wrong if I said a proper SEO optimized site does not need any more advertising. (Of course, this also depends on the site’s services and content)

The disadvantage of using Flash (to design a complete website) is very evident in Flex. SEO is something which hasn’t been thought about by the adobe team, perhaps. However, the community is trying hard to tweak the way the Flex coding appears in a browser to generate a SEO-friendly code on the backdrop of a Flex UI. Efforts such as this and this have certainly caught many a developer’s eyes.

Like I said, after deploying a website, a webmaster expects to reach out for a good slice of internet traffic to come his way. Flex does well is providing an innovative approach to design and develop an amazing web application. However, I really feel there is a lot to be done regarding a Flex site’s visibility on search engines. More research will be necessary into the usage of robots.txt, possibility of coming together with the search engine companies (It may already be underway) to help index SWF better.  Once, Flex is improved based on these lines, I’m sure webmasters will be able to create websites which keep users coming back to it.

To know more about Flex, visit these links:

A word about wordpress

For those who have come to wordpress recently (post v2.5 release), I’m sure you found the design, interface, manageability, and the performance of wordpress a satisfying experience. However, for those who have been with wordpress since its early stages, it has been an extraordinary journey (at, also at wordpress.orgWhat’s the difference?) when looked back at it.

I have been associated with wordpress ever since the v1.5 release – which was instantly adopted by thousands of people. I was a n00b at Webdesigning and PHP back then (not much difference now), and was a mute spectator to the exponential increase of the popularity of wordpress. The response to the wordpress ‘blog’ tool was enormous and everyone wanted to be a part of it. And gradually, the wordpress community grew, the number of coders, testers and website managers. The list would never be complete without mentioning the thousands of theme and plugin designers who have made a world of difference to wordpress as it is.

Having said all this, it would be a crime not to mention Matt. Matt is the creator of WordPress, who nurtured it (and continues to do so) as his child. Hats off to you Matt, for giving us such a good blogging software ( and also a blogging platform (

You can read the wordpress story from the people themselves here.

Installing WordPress

Ok. I made this tutorial to help people who, like me, hate fantastico; and for people who like to do things the hard way. Trust me, you learn quite a lot. 🙂 Kk, enough of my rambling, lets get on with the task.

With little changes, this tutorial can be extended to any script which uses PHP and MySQL. 🙂

Step 1: Acquire the latest release WordPress script package archive.

Step 2: Extract the archive to a location on your local hard disk. Upload the extracted files to your website using a FTP client. (FileZilla)

Note: I’m assuming you have uploaded the files to a directory named ‘blog‘ in ‘‘. So, your WordPress location will be: ‘

Step 3: WordPress requires a MySQL database. So, log into your cPanel and create a database in the MySQL database section. Also, create a MySQL user and add that user to the database that you just created, with ALL privileges.

Note: Before proceeding to the next step, you need to know:
# The database name (complete proper name – “cpanelusername_dbname”)
# The database user (who has complete privileges over the database)
# The password for the database user.
# The database host (for most of the hosts, it is ‘localhost‘)

Step 4: Now in your browser, point to the location: and click on: ‘create a wp-config file through a web-interface

Step 5: Enter the details of the MySQL database that we just created and click on next.

Note: If you encounter any problems here, return to Step 3 and make sure you have entered all the details about the database correctly.

Step 6: Click on: ‘run the install!‘ Now, you will be taken to a page where the script will configure the database and will provide you with an admin ID and password.

Step 7: Log-In with that ID and password, change the password in Users -> Your Profile.

That’s it! You are done installing wordpress for your site. Need any help with the intermediate steps, do reply. 🙂

To know more of WordPress, goto: