About Me...

Hello world! Me? An eccentric living organism that ponders the supernatural abilities of humanity

Get The Latest Posts

Sign up to get email updates

Tuesday, December 01, 2009

Apache Tomcat: Download, Install and Configure

 Tomcat is a free, open-source servlet/JSP engine that was developed by the Jakarta Project at the Apache Software Foundation and it is the official reference implementation of the servlet/JSP specification set forth by Sun. Tomcat is one of the most popular servlet/JSP engines available for Java web application development. It can be used as both the web server and the servlet engine. I've been using Tomcat for most of my Java web applications. For Tomcat to work properly, it should be able to access the JDK installed on your machine. I assume you are familiar with these and you should have all these components(the Java class library, compiler and the JRE) installed on your machine before you install Tomcat.
 The following procedure is intended for Windows users only but if you are using a different OS, you should be able to install Tomcat with similar steps described here. If you are having trouble with a different OS, I suggest you follow the instructions for that platform.
The current Tomcat version, which is version 6.0.20(at the time of writing) supports JSP2.1 and servlet2.5 specifications.

Follow these steps to install and configure Tomcat

Download and Install Tomcat

  1. Go to http://tomcat.apache.org/ 
  2. Find the Download page for Tomcat6.x 
  3. Scroll down to the Binary Distributions heading(it is also possible to use the source distribution but for the purpose of this article, I'm using the binary distribution)
  4. Under the Core subheading, click on the link for the zip file.
  5. Save it to your hard disk(its name should be something like apache-tomcat-6.0.20.zip).
  6. Extract it and move it to your C drive.
  7. Copy the following .jar files from Tomcat's lib directory(don't move, just copy-paste them) to the JDK's jre\lib\ext directory.
  • servlet-api.jar
  • jsp-api.jar
  • el-api.jar
  • tomcat-dbcp.jar

Set the JAVA_HOME environment variable

In recent versions of Tomcat, the sevlet engine is named Catalina. You will have to change a batch file called catalina.bat in order for this engine to work with JDK.
  1. Open the apache-tomcat-6.0.20(in my case) directory.
  2. Open the directory named bin.
  3. Right-click the catalina.bat file and click "Edit" (this will open the batch file in a Notepad).
  4. Scroll down pass the remarks(they begin with the "rem" keyword).
  5. Immediately after the remarks, enter a "set" statement that sets the JAVA_HOME variable to the directory that contains the JDK of your system.
This is what it looked like when I set it in my machine...(see below)

 set JAVA_HOME=c:\Program Files\Java\jdk1.6.0

you should replace the part in red with the path relevant to your JDK. Don't leave any white space between the assignment operator(=)

     6. Save your changes with catalina.bat file
     7. Start Tomcat and test for some JSP pages.
»»  read more

Monday, November 30, 2009

Changing tomcat's default port

Tomcat's default port is 8080(default port for most browsers is 80). Sometimes you may encounter port conflicts when two applications try to share the same port. If this happens with Tomcat, you will have to change the Tomcat's default port to a different one depending on the availability of that port. If a port is causing an error in a web application, you will often see a "Page can not be displayed" error message(but bear in mind that there can be other reasons that cause the browser to display this message). In this short post I will show you how to change the default port of Tomcat using its configuration files.
  1. Open the Tomcat home directory(in my case, this is named apache-tomcat6.0.20).
  2. Go to its bin folder.
  3. Open the server.xml file using Notepad(right click>Edit).
  4. Replace all occurrences of 8080 with a number larger than 1024(although it is not mandatory to select a port higher than 1024 if you are using Windows as your OS, it is a good practice to get anything higher than 1024. There are reasons for this but I'm not going to discuss about them here since it is beyond the scope of this article)
  5. Finally, restart Tomcat and test it for some URLs.
You may also like to have a look at the post about how to download and install Apache Tomcat6.0.20

So that's how you change Tomcat's port manually. It wasn't that difficult was it?
»»  read more

Tuesday, November 24, 2009

Hey, I'm on Twitter!

I just created my Twitter account few minutes ago and now going to study how it works. I wanted to find out what all this hype about and why it has become a great threat to Facebook. Plenty of my friends are already on Twitter and I wanted to get connected with them too. When I joined Facebook, I was not that interested about it and I hardly had time to log into my account due to the busy schedule at my university but now I can't live even a single day without logging into Facebook. So that's what happens when you join a social networking site. I'm not going to write a post about Twitter here. But I'll post a small video that I found on Twitter Help page. It will help you to get started. And don't forget to add me to your list of followers and get updates about new stuff. I would love to follow you guys on Twitter too.






»»  read more

Friday, October 23, 2009

Dear mom

A mother enters her daughter's bedroom and sees a letter over the bed. With the worst premonition, she reads it, with trembling hands.

Dear mom,
It is with great regret and sorrow that I'm telling you that I have eloped with my new boyfriend. I found real passion and he is so nice, even with all his piercings and tattoos, and I love riding on the back of his big motorcycle. But it's not only that mom, I'm pregnant and Dillon said that we will be very happy in his trailer in the woods. He wants to have many more children with me and that's one of my dreams. I've learned that marijuana doesn't hurt anyone and we'll be growing it for us and his friends, who are providing us with all the cocaine and ecstasy we may want. In the meantime, we'll pray for science to find the AIDS cure, for Dillon to get better, he deserves it.
Don't worry mom, I'm 15 years old now and I know how to take care of myself. Someday I'll visit so you can get to know your grandchildren.


Your daughter,
Katie




PS. Mom, it's not true. I'm next door at Wilma's. I just wanted to show you that there are worse things in life than my results sheet that's in my desk drawer... I love you!
»»  read more

Thursday, October 22, 2009

Something about "Paid Surveys"

Paid Surveys have been one of the most popular and proven ways to earn some extra cash. Many people around the world are involved in these programs and I too have been using them for quite a while now.

I'm sure you have heard of such programs and probably some of you might already be involved in those programs. For those of you who have not yet come across the term Paid Surveys, I'll give you a brief introduction of the system and how it works.


Multinational businesses are very much concerned about their target market and customer satisfaction. They need to know what their clientele expects from them and at the same time, fulfill their demands and satisfy them. Every year these global marketing giants spend millions of dollars to find out what their customers really need and how to cater those demands. Knowing these is highly important to them when it comes to embarking on new business ventures and improving the quality of their own products.

In order to find out what their customers think about them, they carry out surveys and other means of gathering information. Surveys are not something new to the world and I hope you have at least taken part in some of them in your life. So likewise, online surveys are also similar to them and as with any other normal survey, all you have to do is take part in them and give your true opinion.

These companies are looking for people like you and me to participate in their surveys. They are looking for public opinion and yes, they are willing to spend millions of dollars for that!


You might think why they are so bounty... well, that's where it gets great! These businesses need your opinion about their products and that enables them to make changes, improvements, alterations and in some cases, get rid of their not so popular products. So in order to get these valuable information, they require us to provide them with our genuine idea about them. Remember, here, we represent their customers and customers are their best asset when it comes to a business establishment. So the bottom line is we provide them with accurate and reliable information on the topic they want to know and they give us a small reward for giving them that little bit of information. Think of it as a win-win situation where both parties are satisfied after the deal.


Now that you have some idea about what these paid surveys are, I'll give you some explanations about how they operate. There are hundreds of market research companies out there and they are the ones who conduct those surveys on behalf of a client (let's say like, Nike, Coca Cola for instance). These marketing research companies have an online representation which allows them to carry out internet-based surveys. i.e they have their own website. So you have to go and register in their websites in order to participate in their surveys. But there are some catches about this too. For example, you might have to pay an initial membership fee and you also have to provide them with your personal information too. Giving them your personal information allows them to pick the most ideal set of participants for a particular survey (So there is a good reason behind it).

There is a great deal of tips I need to share with you in this matter but I don't feel like including them all in this post because then this would be a very long article. So for now, I'm ending this short introduction on paid surveys but I'll be revealing other useful information about them in future. So keep coming back...
»»  read more

Wednesday, October 07, 2009

Adding Subtitles to a Movie

Have you ever wanted to watch a movie with subtitles on?

Sometimes, the pronunciation is a little too ambiguous and hard to follow. So in such cases, it's better to have subtitles... Don't you think so?

well, adding subtitles to a movie is so easy and it only takes 5 minutes(at most)!

Here I will explain you how to accomplish it.

But first you need to have a specific software installed for subtitles to work. I suggest you install K-Lite Codec Pack. It's one of the best codec packs available and it works with almost all kinds of media formats. You can download it from this site

After you download it, install the default configuration(this only takes 5 minutes) and you are free to use it for your media files.

Now let's get to the subject :)

Here's what you have to do:
1. Download the subtitle file from the Internet
2. Integrate it with the movie file

Before we get in to the actual process, let me explain what is a "Subtitle file". Subtitle files are files with .SUB/.IDX,.SRT, .SUP, and .SSA. There is also .SMI, .TXT, and about 20 others.
You can download them from a suitable website. I'll list some of the popular sites below

Subscene (what I use)
OpenSubtitles
DivX Subtitles
Any Subs
RDW Subtitles
Subbiee Search

You can download your subtitle file from any of the above sites. Subtitle files are usually 40 to 80kB (when zipped) and therefore downloading takes only seconds!

Ok let's get back to the process ;)

For the purpose of this tutorial, let's say you want to add subtitles to the movie "Twilight" (assuming that your Twilight copy doesn't have any subtitles) ;)

Once you download the zipped file(most of the time, the files are zipped to increase the download speed), extract it and get the file which has a .srt (or any of the above extensions) extension and place it inside the same folder(see the screenshot below)


click on the image to see in actual size


Then rename the subtitle file with the same name as the movie file(this is the most important step). For example, if your movie file's name is Twilight.avi then the subtitle file's name should be Twilight.srt (depending on the type of file that you downloaded).

And there you are! Now you have successfully applied the subtitle file to your movie. :)

Now I'll summarize the steps we have done so far (skipping the codec installation part)
1. Downloading the relevent subtitle file.
2. Unzipping it and obtain the .srt file.
3. Placing it inside the same folder that contains the movie file.
4. Renaming the subtitle file with the same name as the movie file.
»»  read more

Thursday, May 28, 2009

Free JavaScript Hosting for Your Blog

Today, I'm going to introduce you to a really useful website that provides some very valuable services for bloggers for no cost. Nowadays, I see many blogs use some cool animations on their headers and Home Pages. Check this blog, this blog or this blog to see what I mean. Usually, these animations are done using JavaScript codes. So you will have to embed these JavaScript codes to your XML blogger template. But doing that is a little bit ugly because then your blog's source code will be stuffed with all sorts of programming language codes. So the best way to solve this is to keep the JavaScript in a separate file and then link it to your XML template through some HTML. For that you need to find a file sharing website that allows you to upload your JavaScript files.

I tried several free file sharing websites(mediafire, fileqube, filefactory, nakido) but none of the allows hotlinking(that is the feature you need for this) for free account holders. However, if you have a premium account, you are entitled to that feature but unfortunately I couldn't afford to spend my money on that(I was having a low budget while I was in university). So I went in search of a site that allows hotlinking of files for free. After some effort, I came across these two sites called fileave and hotlinkfiles. I created free accounts in both sites and tested  the JavaScript linking. Guess what? It worked!

I think you have seen the fading image effect which is displayed on the Home Page of this blog(if you haven't, then see that cool effect here). That animation is achieved by linking an external JavaScript file to this blogger template. That JavaScript file is hosted at HotlinkFiles - Get Free File Hosting now!

So the next time you need a file host that allows hotlinking of files for free, I recommend these sites

»»  read more