Archive for August, 2010

Display row number in Mysql Select Query

How many times did want to have the row number or the position of the row in the selected query? I had many cases where I needed this feature. I needed the feature for printing the rank of a person where each row is the mark of the person. So lets see how to implement this in mysql.
There is no straight forward function or query parameter to do it (At least none I know of). So I am writing the query to declare a variable and increment that variable on printing that variable along with printing each row. So it just displays the variable on each row. So here is sql query for it. Try it out and tell me.

Continue reading “Display row number in Mysql Select Query” »

, , , , ,

1 Comment

Automatic Command Archive

The default command storing size of ubuntu is 500 commands. It stores the commands in home folder in the file “.bash_history” .
The problem is 500 commands is too short of a size.
One method is to increase the command size to a large value by changing the $HISTFILESIZE variable using the following command

Continue reading “Automatic Command Archive” »

, , , , , , , ,


How to Save file in vi not opened with sudo

It has happened to me a lot of times that i edit a file in vi. I insert and edit a lot and finally when I try to save it I find that I dont have permission for it. If only I had opened it with sudo. I found a solution for this issue. It was actually a simple command and here it is

Continue reading “How to Save file in vi not opened with sudo” »

, , , ,


Auto Away Notifier for Pidgin in Perl

Whenever I am away from laptop my chat buddies leave me lots message and finally lots of “You there???”. So I thought of making a script that would inform my buddies that I am away when someone sends me a message.
This method works with Pigin API.
I have used /proc/acpi/button/lid/C267/state file to find if the lib of the laptop is closed or not. This file may vary in your laptop. So try to find the find the file in your computer that stores the status of the lid. It should be a file in /proc/acpi/button/lid/ folder and replace the file accordingly in your computer.
The Content of /proc/acpi/button/lid/C267/state is state: open and state: closed when the lid was closed.

Continue reading “Auto Away Notifier for Pidgin in Perl” »

, , , , , , , , , , ,


BSNL Dataone Auto Downloader

Bsnl(India) provides an account that has 2am to 8am unlimited download. It was not easy to wake up at 2am and switch on the computer and sleep again. So I tried to find a method to switch on the computer automatically at 2am and download and shutdown at 8am. Although the I thought the idea was foolish, I found out that there actually is a method for doing it. “ACPI Alarm” was introduced in 1999 or so (Even my old PC had it).

Continue reading “BSNL Dataone Auto Downloader” »

, , , , , , , , ,


Script for Auto Copying of Cds/Dvds

Here is a script that i created for automatically copying all the files in cd to a folder and ejecting and waiting for the next cd.
So here is how it works.
You need to change the folder names and paths accordingly. And the shell script as

Continue reading “Script for Auto Copying of Cds/Dvds” »

, , , , , , , ,

No Comments

Display Reminders In Gnome Panel

It was a long standing requirement of mine to create a reminder software or something which can keep me reminding of things as I always keep forgetting things. So I made a reminder that displays my reminders on the Gnome Panel.
It looks something like this: Continue reading “Display Reminders In Gnome Panel” »

, , , , ,

No Comments

Copy in Linux with Ui

The program here is an UI for cp command. I have used cp in the background but over that I am just monitoring the files copied and speed of copying.
It’s not a perfected program. It’s quick one but works fine.
Create a file named copy and insert the following code and give execute permission

Continue reading “Copy in Linux with Ui” »

, , , ,

1 Comment

Microsoft Servers in Linux

Well this is funny Microsoft has it’s ”” servers running in linux. Good going guys. You people know what’s the best suited ones. But do you know a product of yours called Windows Server edition?

Continue reading “Microsoft Servers in Linux” »

, , , , , , , , , ,


Automatic Desktop Wallpaper Changer for Linux

I have a lot of wallpaper that I wanted to switch automatically. After a lot of search i found that there a command way to control all the gnome settings. So I the command I used is “gconftool-2“.
So code is like:

Continue reading “Automatic Desktop Wallpaper Changer for Linux” »

, , , , , , , ,