How to know exactly which Linux distribution you are using

I myself usually have to connect to a lot of Linux server to troubleshot. As you know, different Linux distribution has different config file location. For example, Apache config file in CentOS server is /etc/httpd/httpd.conf but in Ubuntu/Debian is /etc/apache2/apache2.conf It would be easier for us if we know exactly the distribution name from the beginning. Here are several solutions: 1. From the boot time message dmesg | head -1 You might see something like this: Linux version 2.6.31-14-generic (buildd@crested) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) ) #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 2. Using /proc/version cat /proc/version You might see something like this: Linux version 2.6.31-14-generic (buildd@crested) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) ) #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 3. Using /etc/issue cat /etc/issue You might see something like this: Debian GNU/Linux 6.0 \n \l 4. Using /etc/*-release cat /etc/*-release You might see something like this: Gentoo Base System release 1.12.9 Disclaimer: The results are different because I’m using different machine when testing. have fun :)

CSS: How to add width and height attributes to anchor tag

You might face this problem sometimes: You want to add width and height to an anchor instead of giving these attributes to its container. Surprisingly, width and height attribute are not works. For example, consider the following codes: a.ansok { width:86px; height:41px; line-height:41px; background-image: url(../images/layout/button.png); } And here is what you will get (instead of beautiful buttons): So, what is the reason and how to fix it? Well, anchor tags are not block level HTML elements but rather inline elements. So what is the difference between the two? Here is the definition of the two items: Inline Element definition: Inline elements typically may only contain text and other inline elements. When rendered visually, inline elements do not usually begin on a new line. Block Element: Block-level elements typically contain inline elements and other block-level elements. When rendered visually, block-level elements usually begin on a new line. So, all you have to do is just add display:block to CSS class of anchor. And here is the result: Some useful links: HTML inline elements HTML Block Elements

How to install Ant correctly on Ubuntu

When using Ant the first time, you might notice that it return errors ant -version Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar Is it because of wrong jdk version? You probably tried to locate tools.jar and found this: locate tools.jar /usr/lib/jvm/java-6-sun-1.6.0.06/lib/tools.jar Is it the same tools.jar required by ant? How can you point to this file so ant will not return any error? Here is the solution: Make sure you have the “multiverse” repository Install all Sun Java 6 packages sudo apt-get clean sudo apt-get update sudo apt-get install sun-java6* This process might take a while, so you might need to grab a cup of coffee and wait. Check that you are using the newly installed jdk javac -version The output should be something like this: javac 1.6.0_06 Check that you are using the correct jre java -version The output should be something like… java version “1.6.0_06” Java(TM) SE Runtime Environment (build 1.6.0_06-b02) Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing) If you find you are not using the correct Sun Java 6 jre you can fix it by: sudo update-alternatives –config java The above command will let you choose which jre to make default if you have multiple jre installed.

How to make Cufon works in IE9

IE, and probably Microsoft, has a lot of surprises for you. As you know, each IE version has its own behavior. And don’t surprise if IE9 does not render Cufón at all Meaning that every beautiful things you see in Firefox, Chrome, … will not even show up in IE9. Nothing. You will only see a blank space. Then, how to fix it? First, you need to download the latest version of Cufón. It’s 1.09i, which has support for IE9. Download here Second, add the following lines to your code: And it works. Combination of the two method will give you a great look of your website in IE9. Have fun.