Category Archives: Linux Apache MySQL PHP

Virus: What is virus on facebook?

If you are a facebook user, please be aware that virus is spreading quickly on facebook. From what I have seen online so far, it seems to redirect to a site which probably is stealing data from you computer and/or installing trojans. Initially it looks like this site allows to create generation tree and looks like a legit domain. This is being spread via messages to you from other friends of yours who are “infected”.

One of the things you can do to prevent getting “infected” is to not click on any links on facebook. Even if it comes from friends you trust.  It would also be a good idea to arm your self with the best virus protection software.  If you do click on a link, make sure you don’t enter any login/passwords  on any sites you end up on.

Here is an article on eHow which talks about avoiding the virus:  how to avoid on facebook

EDIT:  some people have reported that destination url has changed at least once so you may end up on a site which looks like aother “legit” site.

Health: H1N1 Swine Flu Google Map

There has been a lot of talk on the news about the swine flu and how it is spreading fast and a lot of people are affected. Here is something worth checking out, a google map with incidents marked with information on areas affected, how many dead, infection reported, etc.

Watch where you hang out and if you are feeling any symptoms, go see a doctor.

Here is some info from  wikipedia:

Mexican officials state that since March 2009 there have been over 1600 reported cases and put the death toll at 149, with 20 confirmed to be linked to a new swine influenza strain of influenza A virus subtype H1N1.

In the US, twenty-eight cases have been confirmed among New York students, seven in California, two in Texas, two in Kansas and one in Ohio; all have recovered. Kansas state health officials confirmed two cases of swine flu in Kansas on April 25, 2009, just minutes after eight school children in New York City were believed to be infected after a school trip to Mexico. The New York case had been confirmed as influenza A virus, which met the Centers for Disease Control and Prevention (or CDC) definition of a probable case of swine flu. Tests have now confirmed that this flu virus is the new strain of H1N1, according to reports on UK BBC News. On April 25, 2009, Texas closed a high school near San Antonio indefinitely after a third student showed symptoms of swine flu.

In Canada, the virus has now been confirmed in six cases. There are also three confirmed cases outside North America. The first confirmed case in Europe has occurred in a man in Spain, the second and third in Scotland in the UK. In Scotland there are two confirmed cases being treated in a hospital in Airdrie, Lanarkshire. The results from their tests came in at 6.10pm on 27 April 2009 and were confirmed as positive. These are the first two confirmed cases in the UK and the second and third in Europe. On April 26, 2009, students from Rangitoto College and Northcote College, both on the North Shore of Auckland, New Zealand, returned from school trips to Mexico and began exhibiting signs of influenza. Like the US students, they tested positive for influenza A which means swine flu is highly likely, however definite results are pending. There have also been reports of suspected infection in Australia, Brazil, Chile, France and Israel. Airports worldwide are on alert, with passengers from Mexico entering Japan being screened for the virus.

The head of the World Health Organization will lead the agency’s efforts against a deadly swine flu outbreak. The World Health Organization warns this new swine flu has the potential to become an international influenza pandemic. On April 25, 2009, the World Health Organization issued a document called the Swine influenza frequently asked questions. On April 24, 2009, the World Health Organization agreed that the current situation constitutes a public health emergency of international concern. The EU are advising against non essential travel to Mexico and the USA. Experts warn that use of face masks does not provide adequate protection. Face masks only work when dry; after an hour or two the breath causes the fabric to become damp and then it does not provide filtration of infection. A face mask must be replaced every two hours and the one used disposed of or cleaned. The WHO have increased the level pandemic alert to phases 4 on a 6 point scale. Phase 4 indicates a “significant increase in risk of pandemic”.

Telnet: shell script to issue commands to telnet session.

This is a quick post to show how one can issue commands to telnet session from a shell script or command line with out going into interactive mode. I use this to get stats from our memcache servers or issue a flush_all via telnet from a script/cron.

So without further delay, following command will telnet to local memcached server on port 11211 and issue one of the memcached commands, stats

(sleep .5;echo stats) | telnet localhost 11211
You may have to play with the sleep timer to get it to work for your environment but in our .5 was the sweet spot. Good luck and let me know if you have another shell command. Obviously we can do this from perl, php, python, etc but the beauty of this is that you do not need any other dependencies plus its a very short command.

Since “jsled” commented about nc (thanks jsled), here is the syntax to do the same thing with nc:

echo "stats" | nc localhost 11211

RewriteRule: How to avoid passing query string when you redirect.

Today I ran into an issue which I could not figure out for quite a while. I was trying to redirect a url to another url using RewriteRule. It was supposed to be a pretty straightforward redirect which made it even more annoying than complicated ones. Hopefully somebody is able to explain what I am missing here and if my solution is a good solution or not.

I needed to redirect a url: to

So I added this to .htaccess file:

RewriteRule ^testpage\.php / [R=301,L]

This did do a 301 redirect as I wanted but query string passed so my redirected url looked like:

Obviously this is not what I wanted so in order for me to fix it, I had to take a rather lame approach.  My new redirect is:

RewriteRule ^testpage\.php /? [R=301,L]

The only difference is the “?” after / for target url.  I am just curious to know why query-string was passed.  I have not used rewrites for long time but I do not remember this behavior.

SVN: How do you use svn command line on Windows with ssh tunneling?

If you ever used svn command line, you know it is not optimal to type in your password every time you do checkout, checkin, info, etc.  In linux world, it is very easy to setup keys to get around this.  Of course in the world of Windows it is not as easy.  Here are the steps you need to follow to get private/public keys working with your SVN under Windows using ssh tunneling.

Assumptions:  you will be connecting as user “root” to svn server located at “”.  All your files will be saved at c:\ including your svn command line utility

First we will have to generate a key.  We can accomplish this by using a free utility called puttygen.  Run puttygen and click on “Generate” button.  You will have a key similar to below example:

Example of a key generated by puttygen

Example of a key generated by puttygen

Copy this, you will need it in few mins.  At this point, go ahead and create a private key by clicking on:  “Save private key”.  Save this as private.ppk on your C:\. 

Now let us log in to the svn server and add this public key to the authorized_keys2 (see setting up keys for step by step instructions).  I will assume you are using “root” as login.

vi /root/.ssh/authorized_keys2

Make sure when you paste, it is not broken into different lines.  All of the key should be one line.

Ok now back to your Windows machine.  Now we need to set up ssh tunnel to our server.  There are few ways of doing this but for our purpose, we will use another free program provided by the same developers as puttygen: download plink to C:\.  If you do not do this step, you will get following error:

svn: Can't create tunnel: The system cannot find the file specified.

Ok let us set the variables for svn.  Go to command prompt and type (you can also set this in your scripts and inside windows environment.  But since this post is to show you an example, we will just do this):

set SVN_SSH="/plink.exe" -i /private.ppk -l root

Now let’s run this one time manually to cache key:

/plink.exe -i /private.ppk -l root

Press “y” when it asks you to save.  Type exit and get back to your prompt.

Ok now we can test our svn utility.

/svn info svn+ssh://

This should display output similar to:

Path: trunk
URL: svn+ssh://
Repository Root: svn+ssh://
Repository UUID: b9143312-b1a1-11ba-a111-11cdcd1d2222
Revision: 10
Node Kind: directory
Last Changed Author: root
Last Changed Rev: 4
Last Changed Date: 2008-11-18 15:18:47 -0800 (Tue, 18 Nov 2008)

Now you are ready to script your checkouts, do checkin’s with out having to type in your password, etc.

DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.