Posts

Sort according to the nth Column in Shell Script

You have a file that has multiple columns separated by a specific delimiter and you need to sort it according to a specific column which need not be the 1st column. If its not the 1st column then ordinary sort wont work. So we need to use the parameters of …

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  …

Simplest way to remove trailing zeros of decimal numbers

This is a simple method I found to remove or strip trailing zeros of a decimal number. The function accepts the decimal number and return the trimmed value back. It removes all the redundant zeros in the number after the decimal point and if no number othe …

Important MySQL DBA Interview Questions

Here are a few sets of interview questions expected for MySQL DBA position.These are compilation of the usual questions from various DBA texts: What is Log Switch? – The point at which ORACLE ends writing to one online redo log file and begins writing to …

Generate Date from a range in Mysql and pad the results where no date is present

If you want to generate dates, MYSQL doesn’t have a range function, so I wrote a work around for the same. So how  it works is I have reused a code to generate numbers from my previous post. So I added date function to that query and reduce the generated  …

Get the nth Word from a text field in mysql

I had a requirement to get the nth word out of a string and sort or order by the same. This is used when the text is stored in a purticular format and you would want to order it according to that or group it or so on. So how is it done? We do it using a  …

Group by Date when Stored in Mysql DataBase as Date Time

I have a table called date_count with 2 columns one is a value and another is a date time, say called date_time in mysql. Date Time in mysql is stored as dd-mm-yy hh:mm:ss. The issue comes when I need to get the number of rows per day. As its stored as dat …

“Send To” in Linux for Nautilus

It’s been a common practice among the windows users to right click and search for “Send To” option when a file needs to copied to the USB or any other Drive. Why spare me, even i used to do this while using windows, when to my astonishment i found that the …

Service Engineer/System Administrator Interview Questions

This is not my code alone.  It was the group effort of Vivek Ram, Cijo George, Sandeep Unni and mine during our epic preparation for Yahoo!. I am just putting it open for others who would be looking for this information. Convert all lower case to upper  …

Download PHD Comics,XKCD and DogHouseDiaries for Offline Viewing (E-book Reader)

If you are like me who wants to read comics on kindle then this is the script for you. You can download all the comics to read it in a kindle. So here is how you do you do it. Download all the comics into 3 different folder s for each comic set by running …