Limit the CPU usage of a process (Linux).

There have been times when I wished that I could limit the cpu usage of a process even though it might run slower , There is a simple way to do it on Linux .

Just type the following in terminal.

 cd /tmp
 wget ''
 tar -zxvf cpulimit-1.1.tar.gz
 cd cpulimit-1.1
 cp cpulimit /usr/local/sbin/
 rm -rf cpulimit*

If you are a debain/Ubuntu user you can also do the following in terminal.

$ sudo apt-get install cpulimit

After installation to limit the cpu usage of a process :

cpulimit -p  -l

Happy cpu reduction !!

extraire avec unrar sous (Extract with unrar on) linux

Ever since I switched over to Linux extracting files from win-rar archives was never a pleasant experience especially broken archives  .

Then I recently I discovered the power of Command line and suddenly I realised things got much easier .

So how do we go about Extracting win-rar archives ?

Well there are three methods

  1. Use Ubuntu’s inbuilt archive manager (File roller) , Personally I hate this program.
  2. Use Winrar itself on Wine , Ok but it doesn’t work as good as it does on Windows.
  3. Use unrar from terminal , Pure Brilliance !!

So lets Un-RAR the RARs

Open terminal and navigate to the folder where the archive is and  type

unrar e [filename].[rar]

replace [filename].[rar] with which ever archive you want to extract .

Add -kb switch to extract non-complete / broken archives

So for example to Extract Foo.rar

unrar e Foo.rar -kb

Some may consider this method as too long or not as easy as using a GUI , but once you get the hand of the command line This is the fastest method.

Please feel free to Post your comments and suggestions below

PS: If you are asking why the French title , well the answer is “Simply because I was in the mood to use Google translate” .

Serving Servlets !

When staring web developement now a days many people  start with PHP , Ruby on Rails , or something like that , but there was a Time when Servlets were King .

Servlets are still very Prominent and are also very powerful, and sometimes better than any other web development platform.

To get started with servlets using just Tomcat is very easy , but using Eclipse along with it Required a small bit of effort .

I spent 20 minutes on learning how to configure Eclipse to work with Tomcat 7

So here is a Tutorial for the same .

So Lets get Started…..

The Downloads

2 Things have to be downloaded

  1.  Eclipse IDE for Java EE Developers
  2. Apache Tomcat 7

The Process

I am writing this tutorial for Linux but the concept is the same for Windows and Mac .

After Downloading

Extract Eclipse and tomcat into a folder

After Extracting Eclipse ,

Run Eclipse

open Window->Preferences 

Choose Server->Runtime Environments

Click Add 

Choose Apache Tomcat v7.0

Click Next

Choose the location where Tomcat was extracted 

Click Finish

Now the Server has been successfully added .

The Project

Create a new Dynamic Web Project

After Creating the project

Right click on the project  select New->Servlet

Now you can create your Servlet and run it in eclipse with Tomcat ,  so what are you waiting for  get coding!!

The Unparalleled Awesomeness of The Elegant Theme Pack For…

The Unparalleled Awesomeness of The Elegant Theme Pack For Ubuntu , is Unlike other Theme Packs, Especially the ones for Windows , which requires installing some other Bloated Software .

Themes for Ubuntu and other Linux distros are Native and are easy to Install and UnInstall .

Installation is very easy , Just Type the Following in Terminal

sudo add-apt-repository ppa:elegant-gnome/ppa
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install elegant-gnome

You might also want To consider Installing Nautilus Elementary

Before installing, you may want to read a detailed Nautilus Elementary review.

To Install Nautilus Elementary Type the Following in Terminal

sudo add-apt-repository ppa:am-monkeyd/nautilus-elementary-ppa
sudo apt-get update && sudo apt-get upgrade
nautilus -q

The Above Steps should work Fine For Ubuntu Lucid Lynx (10.4) but I tried it in Ubuntu Maverick Meerkat (10.10) .


» The 9 Universal Goal-Setting Laws

This is probably one of the best and most influential articles i have ever read , A great insight into what has to be done to Successfully set goals  , and get them done .

THE LAW OF SNOWBALL EFFECT. We are motivated a lot more by current problems than by future benefits. Problems are given to us to help us grow and learn valuable lessons. By ignoring one problem we are provoking a snowball effect. One problem drags along another one and then another one, until the pile of problems becomes too huge to be ignored. If we are not motivated to learn our lessons the easy way, we will have to learn them anyway, only the hard way.

» The 9 Universal Goal-Setting Laws.

Random Color for Web Page Background

The simplest way to set a random color as a background is to generate a random color hash and set it using Css

So here is the code for that .

<script type="text/javascript">// <![CDATA[
// ]]></script>
        function RandomColorHash()
            var list=[ '0',  '1',  '2',  '3',  '4',  '5',  '6', '7',  '8', '9',  'A',  'B',  'C',  'D',  'E',  'F' ],Color=’#';
            for(var i=0;i<6;i++)
            return Color;

The above code uses jQuery but this can also be done in JavaScript.

Dynamic table name in MySQL

HOW-TO Create a Table with a dynamic name generated at runtime

  1. DECLARE id_val INT(11) ;
  2. DECLARE table_lnk VARCHAR(255) ;
  3. #Some arbitratry sql
  4. SELECT `<column>` INTO id_val FROM `<table>` WHERE `<condition>`;
  5. #Create the new table name
  6. SET @create_query = ‘CREATE TABLE `?` (<column/s> )’;
  7. SET table_lnk=CONCAT(id_val,‘_table’);
  8. SET @create_query =REPLACE(@create_query,‘?’,table_lnk);
  9. #Prepare the create table statement
  10. # preparation is necessary for dynamic table name
  11. prepare create_table_stmt FROM @create_query;
  12. execute create_table_stmt ;
  13. DEALLOCATE PREPARE create_table_stmt;
What the above code does is, it gets a value from a table and based on the value it creates a table with that name ,
to do this we use the replace function to replace the `?`  with the required table name .
Since we cannot directly execute a sql statement stored in a variable we need to prepare it and then execute .
But make sure to deallocate it immidiately after execution

Learning to code Win32 Native apps

I have been trying to learn how to write native win32 apps for sometime , I don’t know how this happened but I never came across these most obvious Websites that I should have checked out .

Oh well its better late than never as they say .

How-To Create A Cool Html Page to link to Web Apps in 10 minutes


When Google Chrome Rolled out it added the new feature of creating application shortcuts , but you had to have

different shortcuts for different apps like Gmail, Calendar , Facebook … etc . So I created a HTML page using which I can Link to other Apps.

Creating just a HTML Page is very easy ,but I wanted more than Just 4 links that I can click, I needed Animated effects and Icons , so I made it using JQuery .

Click Here to check out the Demo .

Read the rest of this entry »