Vote 1

Apache Ant: How To Set Property When Initially Unset

August 19th, 2008

Also: How To Flexibly Pass JVM parameters to Apache Ant Java (Runtime) Task

Apache Ant is an excellent Java based build & deployment system using XML configuration file. In Ant properties are extensively used to configure tasks, conditionally run targets and more. In short they are an intergral part of build system. My requirement was simple. I wanted to pass JVM arguments to the Java runtime. However sometime I wanted to invoke it without passing any special runtime arguments. Unfortunately jvmarg element doesn't like it when its value is an empty string or even a string with spaces. Finding no way to fool it, I then tried to find a way to set the property to something when it is initially not set (while invoking). This proved surprisingly hard to do. Here is an elegant (I think) solution I came up with. Read more (231 words) »

Vote 1

Apache Ant: How To Include Multiple Jar Files In A Single Jar File

August 19th, 2008

Apache Ant is an excellent and popular Java based build system. It has several built-in commands (tasks in Ant lingo) one of which allows you to create Jar file from your existing class file and resources. What if you wanted to include not just class files but selective contents of other jar files too and make a single big jar file?

Ant provides an undocumented way to include the contents of multiple jar files within a single jar file.
Read more (180 words) »

Vote 1

Db4o Note: Db4o.configure() != Db4o.newConfiguration()

August 19th, 2008

In earlier versions of Db4o we used Db4o.configure() to configure all Db4o database globally (across all ObjectContainer). However in 7.2 (and above) versions of Db4o Db4o.configure() has been deprecated and it is suggested to use Db4o.newConfiguration() instead. Unfortuanately they do not clearly mention anywhere that these two functions are not equivalent. I assumed they are equivalent like Db4o.set()is equivalent Db4o.store() or Db4o.get() is equivalent to Db4o.queryByExample().

Read more (201 words) »

Vote 3

Nginx: How To Stop Referrer Spam With Keyword Filtering

August 8th, 2008

You can configure Nginx to stop referrer spam by checking for bad keywords like tramadol, phentermine etc. This reduces the load on your server as well as prevents filling your referrer logs with invalid entries. Here is my nginx configuration to stop referrer spam (feel free to copy it):
Read more (139 words) »

Vote 5

Nginx Hacking Tips

July 12th, 2008

Nginx LogoNginx is a high performance web server and mail proxy server written by Igor Sysoev and a good replacement for Apache HTTPD, the market leader. Nginx is rapidly increasing its market share with major websites joining it like wordpress.com. In the June 2008 Netcraft survey LiteSpeed lost more than 600 thousand sites during this survey, while nginx gained more than a million sites; more than doubling in numbers. The WordPress blogging system recently converted all of its load balancers to nginx, using the upstream hash module to serve 8-9 thousand requests per second. We too have decided to move some of our websites to Nginx. Here are few essential tips and general guidelines for configuring Nginx. This is not a substitute for reading the documentation (rtfm). However when you are stuck even after reading and re-reading the nginx documentation then read below. You will understand the value of the tips below only then :)

Read more (1037 words) »

Vote 0

How To Enable Root Account on Mac OSX

April 20th, 2008

1. Login to the Admin account (not the normal account)
Read more (102 words) »

Vote 1

How To Change MySQL Password

April 20th, 2008

Let's look at all the ways to change MySQL password, for root and other users:

Read more (78 words) »

Vote 0

Program (Source Code) to Trim Whitespaces from Files…

April 20th, 2008

PHP is not only a very competent web development language (and part of LAMP stack). It is also a very capable language for writing (command line) scripts. You can write simpler and cleaner scripts with php than perl. Here is a php code which takes a file name as input, trims whitespace from each line of the file and finally saves the result back in the same file.

Read more (149 words) »

Vote 0

MySQL Tip: How To Check, Repair & Optimize All Tables in All Databases

April 20th, 2008

Here is a simple command to auto repair, check and optimize all the tables in all databases running on a MySQL server:

Read more (149 words) »

Vote 0

Solution: Missing Dependency: faad2 < 2.5 is needed by package ffmpeg-libs & Error: vlc conflicts with faad2 >= 2.5

March 22nd, 2008

Linux LogoHave you seen the error while installing a package using yum / yumex?

Error: vlc conflicts with faad2 >= 2.5
Error: Missing Dependency: faad2 < 2.5 is needed by package ffmpeg-libs

The error is because of using freshrpms repository or other repository to install recent version of faad2. Now let's see how you can solve it.

Read more (122 words) »