Posts

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 …

Print Array in PHP

There are various methods and commands used in PHP to print an array of elements. They are different in the way they print the array elements. I will cover three main ones I usually use. Lets assume an array as follows to explain the various types of print …

Check if a table exists in MySQL from PHP

Sometimes its necessary to execute a query or execute some code if a table exists or not. So a bit of searching got me to the conclusion that mysql doesn’t have a direct query or method for it from php. So there are two methods to do it. Use the mysql c …

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  …

Fix link issue in Twitter client of Fusion theme

When I tried out the Twitter client in fusion theme I noticed that the urls are wrong in that client. The URL in my client were like http://blog.sriunplugged.com/”http://search.twitter.com/search?q=%23Home” . So after a bit of digging into I found that the …

Find Invisible Users In Gmail

Finding who is invisible is something that I always wanted to do.It’s always fun to ping a person who feels none can see him/her online. While studying XMPP protocol I found out that even when the person is offline the chat client knows that person is onli …

User Level Threads

User level threads is created for light weight threads. It needs to be controlled, context switched and swapped by the process. To the Operating System it is only one process without any threads. Here is one implementation of it: q.h





#include  …

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  …

Web page Performance for a Blog – Part 1

I have always under the notion that page performance for big websites or websites that have a sole server and various resources like CDN and load balancers. So I wanted to know if this is true. I set out to try web page performance my blog. I just wanted t …

Installing Django on Dreamhost

Installing Django in Dreamhost and getting it to run wasn’t straight forward at-least to me. There was lot of issues such as python bin directory not accessible as its shared and so. So the initial step in this to setup python yourself so that you can use …