KP Solutions

Solutions for Day to Day Technical Problems

September 22, 2009
by Ketan Patel

How to sync time in Linux, Unix

Very often, one would have seen that the server/desktop time goes off by some seconds/minutes than the standard time.

It’s very easy to sync up the time in Linux/Unix. Issue the following command as ‘root’ to update the time.


To automate this time update, you can set up a cron job to run once every week.

July 23, 2009
by Ketan Patel

GoDaddy NameServer not registered

Recently, I moved over to a new host with a dedicated box and I had to setup the nameservers for my domain In Godaddy’s domain manager, I tried to change the nameservers to my domain like and, but got an error that “Nameserver not registered“. This was puzzling as I had setup the slaves dns entries on my server correctly but Godaddy complained that “Nameserver not registered”.

Then I found that in the lower left corner, there’s a box with “Host Summary”. You have to add your nameservers entry in that box first. So click on “Add” besides “Host Summary” and it will present you another dialog where you can enter your subdomain and the ip address to point to your server. Once you have added your nameservers in Host Summary, then you can click on “Manage” besides “NameServers” and add your nameservers and there and Godaddy will happily accept it!!

Hope this saves you your time and help you avoid pulling your hair!!! ūüôā

January 31, 2009
by Ketan Patel

Google reporting site may harm your computer

Today, 31st January 2009, 10 AM EST, Google has been reporting all sites whatsoever as a malware sites with the error “This site may harm your computer”. Even sites like microsoft, google, yahoo, cnn were all affected because of this bug.

Google Error - This site may harm your computer

Google Error - This site may harm your computer

As you see in above screenshot, I saved the snapshot of the “yahoo” search keyword on google and all sites were reported as malware sites and when you click on any urls, it would redirect to a page warning you of that site. This is ridiculous and it is giving badname of your site to your visitors. Google has got no right to do so.

January 21, 2009
by Ketan Patel

Use RSYNC to backup data on a second hard disk

On a production server, if you have two hard disk and do not want to spend extra $50 each month, then you could use rsync to backup the data from your main disk to the second disk. It’s very easy to setup. All you to do is use to the following scripts. Save the following script as /disk3/

unset PATH

BACKUPDIR=/disk3                            # Folder on the backup server where the backups shall be located
#KEY=/root/.ssh/id_rsa                        # SSH key
#MYSQL_BACKUPSCRIPT=/root/        # Path to the remote mysql backup script    # The user and the address of the production server
EXCLUDES=/disk1/backup_exclude                # File containing the excluded directories
DAYS=60                                        # The number of days after which old backups will be deleted

SH=/bin/sh                                    # Location of the bash bin in the production server!!!!

CP=/bin/cp;                                    # Location of the cp bin
FIND=/usr/bin/find;                            # Location of the find bin
ECHO=/bin/echo;                                # Location of the echo bin
MK=/bin/mkdir;                                # Location of the mk bin
SSH=/usr/bin/ssh;                            # Location of the ssh bin
DATE=/bin/date;                                # Location of the date bin
RM=/bin/rm;                                    # Location of the rm bin
GREP=/bin/grep;                                # Location of the grep bin
MYSQL=/usr/bin/mysql;                        # Location of the mysql bin
MYSQLDUMP=/usr/bin/mysqldump;                # Location of the mysql_dump bin
RSYNC=/usr/bin/rsync;                        # Location of the rsync bin
TOUCH=/bin/touch;                            # Location of the touch bin

##                                                      ##
##¬†¬†¬†¬†¬† —¬†¬†¬†¬†¬†¬† DO NOT EDIT BELOW THIS HERE¬†¬†¬†¬† —¬†¬†¬†¬† ##
##                                                      ##

NOW=`$DATE ‘+%Y-%m’-%d_%H:%M`


#$RSYNC                                                            \
#¬†¬†¬† -apvz –delete –delete-excluded¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† \
#¬†¬†¬†¬† –exclude-from=”$EXCLUDES”¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† \
#¬†¬†¬†¬†¬† -e “$SSH -i $KEY”¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† \
#       $PRODUCTION_USER:/                                        \
#        $CURRENT ;

// No Compression
$RSYNC                                                            \
-apv –delete –delete-excluded¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† \
–exclude-from=”$EXCLUDES”¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬†¬† \
/                                \



for FILE in “$( $FIND $OLD -maxdepth 1 -type d -mtime +$DAYS )”
#    $RM -Rf $FILE
exit 0

Save the following to /disk3/backup_exclude. Essentially, these are the files/folders you do not wish to backup using rsync.


January 5, 2009
by Ketan Patel

Open ODT file in Microsoft Word 2007/2003

Many times you may have to open the openoffice documents (.odt) in microsoft office. To do so, you will have to install the SUN ODF Plugin for Microsoft Office and then you would be able to open the open officie documents in microsoft office.

– Install Sun ODF Plugin for Microsoft Office.
– Open ODT document using File > Open, or by double-clicking the ODT file and when prompted for the application to open it with, choose Word.

January 4, 2009
by Ketan Patel

PHP Startup: Unable to load dynamic library php_openssl.dll

You might get the error: “PHP Startup: Unable to load dynamic library php_openssl.dll. The operating system cannot run %1“, when you are trying to start the apache server in the error.log file.

Basically what this error is trying to mention that there is an issue with your php_openssl.dll and a possible mismatch with other depending libraries. To resolve this, follow the below steps:

1. Rename ‘ssleay32.dll’ and ‘libeay32.dll’ in c:\windows\system32 to ‘ssleay32.dll.old’ and ‘libeay32.dll.old’ respectively.

2. Copy ‘ssleay32.dll’ and ‘libeay32.dll’ from your PHP folder to the system32.

3. Restart the apache webserver.

This should get your problem sorted!!

January 4, 2009
by Ketan Patel

Not enough storage is available to complete this operation Yahoo Messenger

Recently, I started to get this error message whenever I tried to use IM in yahoo messenger. As soon as I click on the contact to open the Instant Messenger, an error will popup with message that the “Not enough storage is available to complete this operation“. Here’s a screenshot of that error.

Yahoo Error Message

Yahoo Error Message

To fix this issue, you will need to reset your Internet Explorer settings and register the libraries again. Following are the steps to do so:

1. Exit Yahoo! Messenger. Right-click the tray icon and select “Exit.”
2. On your keyboard, press <Windows> + <R> to open the “Run” command.
3. Type in “inetcpl.cpl” and press Enter. This opens Internet Properties.
4. Select the “Advanced” tab, then click the “Reset…” button.
5. In the “Reset Internet Explorer Settings” dialog box, click the “Reset” button.
6. When the reset is complete, click “Close.”
7. Click the “Security” tab, then select “Trusted Sites.”
8. Click the “Sites” button.
9. Uncheck “Require server verification (https:) for all sites in this zone.”
10. In the “Add this website to the zone” field, copy and paste the following text:

11. Click “Add,” then click “Close.”
12. Click “OK.”

Next, please download and install the latest version of Java Runtime Environment:

Last, please register the Java and Windows Script installations:

1. On your keyboard, press <Windows> + <R> to open the “Run” command.
2. Type in “cmd” and click “OK.” This opens a Command Prompt.
3. Copy and paste each of the following commands into the Command Prompt. Press <Enter> on your keyboard after pasting each command.

regsvr32 vbscript.dll /s

regsvr32 jscript.dll /s

regsvr32 nusrmgr.cpl /s

regsvr32 mshtml.dll /s

regsvr32 themeui.dll /s

Restart your computer and your problem will be resolved now!!

November 5, 2008
by Ketan Patel
1 Comment

Enable dark background in Eclipse

I was looking around to find a good source which would allow me to control the background of the eclipse. I like black background with white text as foreground. Doing so in eclipse is not straightforward.

My System setup is:

  • Ubuntu 8.10
  • Eclipse Ganymede (3.4) with CDT

Follow the steps to get black background with white foreground for source code editing part of eclipse.

  1. Select Window -> Preferences -> C/C++ (language editor you need to change for) -> Editor. In the Appearance color options change the following
    • Matching brackets highlight (Color #FFA500)
    • Inactive code highlight (Color #302E2E)
    • Completion Proposal background (Color #000000)
    • Completion Proposal foreground (Color #FFFFFF)
    • Parameter Hint Background (Color #000000)
    • Parameter Hint Foreground (Color #FFFFFF)
    • Source Hover Background (Color #F5F5B5)
  2. Select Window -> Preferences -> C/C++ (language editor you need to change for) -> Editor -> Syntax Coloring
    • In the Code, change all the ones with black color to white and vice versa and leave the rest as they are.

This will give you the colors you want. I know its tedious but that’s the only way to do it at present.

November 3, 2008
by Ketan Patel

How to generate a patch?

To generate a patch for your modified code. All you have to do is generate a diff between original and modified source files using the following command and save the output to the patch file.

diff -rup /home/ketan/unmodified_source.c /home/ketan/modified_source.c > patch.source.c

Now to apply patch to the original unmodified source. Use the following command from the appropriate location (/home/ketan) in our example.

patch -p0 < patch.source.c

October 23, 2008
by Ketan Patel

Readelf – Very useful Command

Till now I have been using ‘ldd’ for checking out the dependencies for a linux executable. But recently I discovered, ‘readelf’. It is really amazing utility and comes in very handy when you are analyzing a utility intended for a different target instead of your workstation. This will exactly tell what libraries it needs and what address it is mounting on.

Check it out today, ‘readelf -a <binary_executable>