Jan 26, 2009

Simple Travian Calculator

I wrote a simple attack time calculator for travian.
All it does is calculate the time when you need to send an attack, knowing the arrival time, and the time needed to get there.


Jan 5, 2009

Building Web Application using Struts framework

Pošto pretpostavljam da nikome u našoj zemlji neće biti zanimljivo da pročita ovaj post, napisaću ga na engleskom kako bi barem nekome koristio. Ovaj pristup ću primenjivati sve češće jer, sudeći po statistikama, ovaj blog posećuje znatno više stranaca. Možda je to zato što linux zajednica nije pretrano razvijena u našoj zemlji, a kao što možete primetiti, veliki broj tekstova jeste o linuxu.
U tekstu koji sledi ću upisati šta je sve potrebno od softvera kako bi se izradila jedna web aplikacija, i kako taj softver instalirati na najlaksi mogući način.

In this article you can find all needed information about software needed to build a web application using Struts framework. So lets get it done step by step...

First of all you will need to choose an IDE to make ur app in. I chose NetBeans because i had very pleasing experience in making desktop application with it, and i hope its a good solution for making web apps.
All you need to do is install it using Synaptic manager in ubuntu or, if you prefer using Terminal, you could use apt-get, dpkg or whaterver package manager you like the most. I recommend using NetBeans version 6, as it has gone miles ahead of previous 5.x release. Also, i recommend using automatic update in NetBeans to update it to the current version.
edit: After having some problems with netbeans when installing it from the repos (incomplete install, and deprecated version), i recommend you to download the current version from their site and install it as root. The command for doing so would be something like:

sudo sh NetBeansCurrentVersion.sh

Now you should add some plugins for Web Apps and struts. Here is the complete list of plugins i have installed, so you can find and install them yourself (tools->plugins).

Now its time to setup Apache Tomcat webserver (servlet container). We'll use the current version 6.0.18.
Although there is Tomcat 6 in Ubuntu repos, this version doesn't work correctly so i recommend installing it from the source.
First of all you will need Sun Java SDK. You can check if you already have it installed by typing in your terminal:

dpkg –get-selections | grep sun-java

If you have it listed in the results you're ready to continue. If not, install it now:

sudo apt-get install sun-java6-jdk

After doing so, download Apache Tomcat and unpack it:

wget http://apache.cs.utah.edu/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
tar xvzf apache-tomcat-6.0.18.tar.gz

The best thing to do is move the tomcat folder to a permanent location. I chose /usr/local/tomcat, but you could move it somewhere else if you wanted to.

sudo mv apache-tomcat-6.0.18 /usr/local/tomcat

Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in your .bashrc file. Run this:

gksu gedit ~/.bashrc

Append the following line:

export JAVA_HOME=/usr/lib/jvm/java-6-sun

save, close, and restart your terminal for changes to take effect.

If this is your first Struts web application i recommend reading this article.