Aug 8, 2009

Cool CSS Tricks

1. Center verticaly using line-height


div {
height:100px;
}

div * {
margin:0;
}

div p {
line-height:100px;
}



2. Center horizontally


div {
margin:0px auto;
}

3. Reset Stylesheet

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}

/* remember to define focus styles! */
:focus {
outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}




4. Font Sizing


body {
font-size: 62.5%;
line-height: 1.5em;
}


5. Wrap around the containing divs


#container {
overflow:auto;
}

OR

#container {
overflow:hidden;
}


6. CSS3 border-radius property

Firefox:

#container {
-moz-border-radius: 20px;
}


Safari, Chrome:

#container {
-webkit-border-radius: 20px;
}

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.

http://dusan.iz.rs/skripte/travian-calc.php

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.