M G Harish

Showing posts with label Tips and Tricks. Show all posts
Showing posts with label Tips and Tricks. Show all posts

Saturday, September 25, 2010

Solution for Orkut worm Bom Sabado!

Today orkut users were flooded with scraps telling Bom Sabado!. Unlike other malware, this doesn't need you to click a link. Just by opening Orkut profile of the affected user, you will be affected. So I suggest you not to use orkut till this problm is fixed. However, if you are already affected, you can get rid of this using the following steps. (This is applicable only for Firefox users. If you are using any other browser, see below):
  • Download AdBlock Plus add-on for Firefox and install it.
  • Restart the browser to enable AdBlock.
  • You will see a red icon with ABP on the right hand side of the search box in Firefox.
  • Click on that, and select Preferences.
  • Click Add Filter and enter *tptools.org/*.

Now you can safely open orkut.

You may have to remove yourself from the communities added by the worm, such as saadzin, meu miguxinho, O vírus que contagia, Eu tenho um grande AMOR, Juizo eu TENHO, só não USO!, Dino ♥ etc.

Note: The "Old Orkut" users are not affected by this worm, and are safe.

If you are not using Firefox, then you can follow the following steps:

Update: The website tptools.org is down now. Orkut is beautiful, again :-)


If you have a browser other than firefox, or to ensure that site won't get accessed by any other way, you can edit hosts file and adding the following lines:

127.0.0.1 tptools.org
127.0.0.1 www.tptools.org

hosts file is found in:
  • C:\Windows\ - Windows 95, 98, Me
  • C:\WinNT\system32\drivers\etc\ - Windows NT, 2000, XP Pro
  • C:\WINDOWS\System32\drivers\etc\ - Windows XP Home, Vista, 7
  • /etc/ - Linux

Wednesday, December 03, 2008

Code for Factorial, without Recursion

After having been declared to be an impregnable procrastinator by all my close-circle friends, after being connoted to update it by those who I didn't even know were reading my blog and after being told "Enough is enough, now update it buddy" by a few friends, I am in the same situation as the Indian government after the Mumbai attacks. I have no other go than updating it, at least for the sake of hushing them up till the next terror attack near my house. So here I go...

As you might already be knowing, I prefer calling programming an art to calling it a process. That's the reason I enjoy it.

Coming to the point, my friend cum colleague was trying to write a program for generating Pascal Triangle. I decided to play along and wrote a code. In the process, I wrote a function to calculate factorial for a number in an unusual way, without recursion.

Generally an incremental loop is used from 2 to N. But I used decrementing loop and here is the outcome (Code written in C programming language):

unsigned int fact(unsigned int n)
{
unsigned int f=n;

while(n---2)
f*=n;
return f;
}

Main thing I wanted to convey in this code is the while loop, which uses the unusual "--" & "-" operator pair.

It works similar to this loop:

for(f=n;n>=2;n--)
f=f*n;

Not a great piece of code, but I found it to be a little interesting. Hence the post.

Tuesday, September 09, 2008

Face Recognition - Ultimate feature of Picasa

A picture speaks thousand words. The internet is becoming full of images. Google seems to have found future in the cutting edge face recognition for the images. It has introduced face recognition for the photos uploaded by the users. If you have not explored this feature, I say, the right time is NOW! I am balled over in the first attempt itself!!

  1. Select New Features at the top right.
  2. Select See name tags in action.
  3. Click Get started with name tags.
  4. Click Try It in the right pane.
  5. Click Start Processing photos.
Wait for some time. Picasa will scan all your photos and index all the faces found. It starts asking you the name of the person in the photos. The best thing is that it selects a bunch of photos, and all of them will be of the same person and its Suggestion is just marvellous. Most of the times, you don't even have to think before selecting the first suggestion. I can't explain the greatness of this feature in words here. Just use it and experience!!

PS: Google has already rolled out a hidden feature of face recognition in its image search. When you search for an image, say Sachin, the url of the image will be something like http://images.google.com/images?q=sachin. You can add &imgtype=face at the end of the URL, i.e., http://images.google.com/images?q=sachin&imgtype=face to find only images containing face.

Tuesday, May 06, 2008

Google introduces Hindi translation

It has was a long wait, but well deserved. So far we were not able to dynamically translate text to any Indian language. Google has finally done it by introducing translation for Hindi. You can now translate any text or web page from English to Hindi or from Hindi to English. We can expect translation to and from other Indian languages also soon.

Although it is not perfect, I'm sure it will improve quickly. Be sure to improve the translation if you find a better word/sentence when you are using it!

Earlier introduced transliteration tool, which supported dynamic transliteration to Indian languages like Hindi, Kannada, Tamil, Telugu and Malayalam, which reduced the popularity of software based transliteration tools like Baraha.

I hope to see the translation expanded to include other languages also.

Thursday, February 28, 2008

How to stop or reduce Spam Emails

One can be as happy as he wants. But the same statement may not apply to Internet users, thanks to spam emails. Although there is no foolproof way to stop spams, we can reduce the amount of spams by being a bit careful.

The first thing before attacking is to understand the enemy and its strength. What is spam? We may call it junk mail, spam or whatever else you fancy, its property remains to be the same: it's unsolicited and it's useless. Most often than not, spams get generated from bots, viruses and automated mailing lists. In the rare cases, they are also caused my human users which, quite often, happen to be the most irritating kind of spam generators. It is observed that around 80% of the email messages exchanged are spams!. How disgusting!!

Take, for example, an incident which happened recently. One of my friends sent a mail to a large number of recepients. But one of those recepients was not an intended person. That person used Reply All and asked my friend to remove him from his mailing list. Well, you can guess what happened. All of us got the reply email which was intended only for my friend. Thankfully the chapter ended there itself. To get a hint of what can happen in such cases, see how to look stupid.

What is the solution for this? It's simple: We have to be in the right mind and know when to use Reply and when to use Reply All. As a rule of thumb, we should NEVER use Reply All unless we are 100% sure about what we are doing.

Instead of relying on others, another way to prevent such incidents is to be cautious enough not to disclose the email addresses to the recepients at all. It can be easily done by adding the addresses to BCC (Blind Courtesy Copy or Blind Carbon Copy) field instead of TO or CC fields. Unfortunately BCC field ranks top among the most obscure and unused standard feature of email!

The features discussed above are only for mails generated by humans. What about those spam emails which get generated by malwares and bots? Such spam emails are mainly the means for advertising products. More the number of recepients, more the number of customers. But how do they get the email ids? It's directly or indirectly by ourselves. We may have inadverently given our email ids to some website or it might have gone there by one of our friends. We need to be extra careful if we want to be at a distance from spams.

Also it is a good idea to remove the sender's information while forwarding an email to others. It not only protects your privacy, but also prevents any potential spammer to use the email addresses in the body of the mail to be used for unsolicited mailings.

Virtually there is no way to stop such emails if you are already receiving them. Precaution is better than cure is the mantra to be followed here. When we give out our email ids to some third party web sites, we need to be extra careful. Never give your email id to any unknown public mailing lists. You never know who shares your email id with spammers!

Another way to detect and filtering out spams is to give plus or minus addressing. You can use different tags for different mailing lists and if you start receiving spams, you can come to know who shared your email address with the spammers. Read more about spam control by plus addressing technique here.

Is that all? Not quite. One of the most common mistakes done by many people is to use their email addresses in their signatures. You may think that is going to make you more famous in the online world. But remember, for one genuine email you get by displaying your email id there, you start receiving hundreds of spams. Never ever make the mistake of putting email id in web pages, forums or social networking sites. Also, remember never to give away your friends' email ids to sites which ask you to invite them to join it. You may think you are being courteous to your friends by giving their email ids but, in reality, you are making them victims of spam emails.

Last but not the least, as a rule of thumb, don't forward any email message if it explicitly asks you to do so! Stopping spams may not be in our hands, but reducing them really is!

Thursday, September 27, 2007

Free SMS for Karnataka Spice Customers!!

With all the Cell phone operators increasing the charges for SMS, it has been a difficult time for the students and those who rely upon SMS for the communication most of the times. Spice, Airtel, Hutch all have increased their tariffs to 5 paise or above. But a week ago, my friend RJP sent me a message telling a trick to get free SMS. This works only for Spice customers in the Karnataka circle.

Change your message centre number in the message settings from default number to +919810051913 +919840011055 +919810051873.

A few notes about this trick.
  • It works only for Karnataka Customers.
  • All messages are completely free.
  • This works only for Spice numbers which start from 9964.
  • You can't recharge your mobile by sending SMS with this message centre. You have to revert to your old message centre, recharge and then put this number back on.
  • The specified message centre is Broadway II Gateway number.
  • Even interstate messages are also free.
Just enjoy the free messages as long as Spice finds this out and corrects this bug. I owe you a lot RJP :)

Monday, September 24, 2007

One-liner ABS Function using Binary Operators

A few days ago, my friend TJ, who always keeps finding innovative programming challenges, asked a question: "Can you implement abs() function without using any relational operators in C?". But he also insisted to do it without using if, for, while etc., any control and loop structures for that matter.

I immediately came up with this:
abs_x = sqrt(x*x);

But he is not a guy to get contented with such an answer. He told that sqrt() internally uses relational operators in its implementation. Well, true. The sqrt() function that is included in math.h uses series expansion methods, which use if() statement in one or the other way. So I had no choice but to find some other way. After struggling a lot, I came up with this which uses only binary operators and arithmetic operators:
abs_x = (x^((((x&(1 << (sizeof(int)*8-1))) >> (sizeof(int)*8-1)&1)*-1)) + (((x&(1 << (sizeof(int)*8-1))) >> (sizeof(int)*8-1))&1);

The sizeof() opeator is necessary only to generalize the expression for any size (16 bit or 32 bit) of the integers. Otherwise a smaller version of the same would suffice.

For 32 bit integers:
abs_x = (x^((((x&(1<<31))>>31)&1)*-1))+(((x&(1<<31))>>31)&1);

or
abs_x = (x^((((x&0x10000000)>>31)&1)*-1))+(((x&0x10000000)>>31)&1);

For 16 bit integers:
abs_x = (x^((((x&(1<<15))>>15)&1)*-1))+(((x&(1<<15))>>15)&1);

or
abs_x = (x^((((x&0x1000)>>15)&1)*-1))+(((x&0x1000)>>15)&1);

Does it seem complicated? As we know, in C, numbers are represented in Two's Complement method. In 2's complement method of representation, the most significant bit represents the sign of the number. This bit will be 0 if the number is positive and 1 if it is negative.

The idea is to first check the most significant bit of the number. If it is 1 we need to negate the number. To negate a number, we should find the one's complement the number and add 1. That is what is done in the above expression!!

Do you think it's a great piece of one-liner code? It would have been, if it was impossible to simplify it further like swapping code posted before. Yes! It can further be reduced! Look at this code:
abs_x = x*(-2*(((x&(1<<(sizeof(int)*8-1)))>>(sizeof(int)*8-1))&1)+1);

For specific length, it looks like (for 32 bit integer):
abs_x = x*(-2*(((x&(1<<31))>>31)&1)+1);

All this code does is to multiply the original number with -1 if it is negative and with 1 if it is positive! Short and sweet one-liner, isn't it? But I can't say it's the shortest like I did in my earlier post. Feel free to express your opinions!

UPDATE
I guess thinking a lot certainly helps! I was able to find a still shorter one-liner!!
abs_x = x+2*x*(x>>(sizeof(int)*8-1));

Can I say this is the shortest? I still doubt!!

Wednesday, August 22, 2007

Annoying Pop-up: ilead.track.it

What can be more annoying for a blogger or a web-master than a pop-up that appears out of his web page, without him being aware of it? Nothing, probably. Recently I was experiencing the same problem. Advertisement window of ilead.track.it would pop-up occasionally in my blog, displaying some ads. I haven't put any ads purposefully on my blog so far, and hence, each time it protruded, I kept thinking that it is the result of some other web page I have opened.

Some of you might have experienced this already. A pop-up would show up with address ilead.track.it and display ads which won't facilitate the owner of the web page in any way. What is more disgusting about this irritating ad pop-up is that, it would show up only sometimes, not always and hence making it difficult to track where it originates.

Thanks to Nirmal T V, a fellow blogger, who informed me that the pop-up is caused by WebStats4U traffic tracker. I just had to remove the code pertaining to that tracker to get rid of this annoyance. Thanks to all those who had informed me about this pop-up being displayed in my blog as well.

The webstats4u website doesn't say anything about the resulting pop-up while registering and offers ad-free service for quite some time. It only unveils its true colour when your website has got significant number of visitors. It can really be a pain in the neck if you do not notice it soon. Now that I have removed it, there should be no pop ups arising from my blog.

Friday, August 10, 2007

Secure your Computer - The Best Things in Life are Free

Lately I have been hearing a lot of complaints from my friends about virus attacks. We all know that precaution is better than cure. It is easy to protect our PC from malwares than scratch our head to get rid of them after they get in. So here are some tips which won't cost you anything, but make your PC as safe as it can be:
  1. Web Browser: Most of the malwares and adwares find their way into the PC from the Internet and if your browser application is not good enough to block the harmful contents, what good is that for? Almost all the browsers have pitfalls, but Mozilla Firefox is the most secure web browser till date.
    Download Firefox here

  2. Antivirus: A good antivirus will always keep your PC clean. But it should not eat up most of the PC resources scanning each and every wanted/unwanted files. Avast Home Edition is a simple and easy to use antivirus, that has automatic updates. Its requires a key that is obtained by registering in the site for free.
    Download Avast here

  3. Antispyware: There are many antispywares which brag about their features. Honestly, most of them are useless. SpyBot S&D is a good one, which provides immunity from known threats and registry tweaks. It also has update feature, which enables you to be insusceptible to the most recent vulnerabilities.
    Download SpyBot S&D here

  4. System Optimization Tool: Registry Cleaners, Duplicate / Unnecessary / Temporary File Managers, Internet History / Cookie Managers all fall under this category. But CCleaner and EasyCleaner are two such tools, which provide almost everything you want.
    Download CCleaner here
    Download EasyCleaner here
You can protect your PC from 99% of the attacks if you have the above mentioned softwares. There are some other tools such as Firewalls and Internet Security Suites which, I think, are unnecessary for personal use. Trust me, I've not got any virus in the last two years, apart from w32.USBWorm which can be removed manually using the steps given here. All these tools are freewares, which means you can download them from their site free of charge. The best things in life are free.

If you have anything to discuss about these or have a better solutions/tips, you are welcome to share them.

Tuesday, June 19, 2007

Why can't we create a folder by name CON?

I've been asked this question many a times: Why can't we create a folder by name CON? Although it seems a wonder or magic that we can't create a folder by that name, in reality, it is not so. It has a definite reason, and in fact, a folder can be created using that reserved name.

Gone are the days when computers had only CUI OS, that is, Character User Interface Operating Systems, like MS-DOS. When I joined my first computer course nine years ago, Windows 95 was ruling. You could see Windows 98 here and there. We were in 8th standard, and working on a computer was like a dream coming true. Microsoft's Paint Brush was the only known (for us) GUI software and was the greatest means of entertainment. The instructors taught us only MS-DOS commands and how to Shut Down the computer. Remembering such weird names as DIR, CD, MD, RD, CHKDSK, FDISK, VER, ATTRIB, REN, DEL etc. along with their syntax and usage was a great accomplishment. But I had a problem understanding this: DOS has a separate dedicated command for every action; literally every action, except... creating a file!

Yes, we used COPY CON filename to create a file with name filename. Anyone can say that it is a form of COPY command. So, why was creating a file different than all other commands? I didn't understand it, till I found out how to print using DOS, almost four years later.

DOS uses different names for the attached devices, I learnt. PRN was one such name. TYPE filename would display the contents of a file and TYPE filename > PRN would print it instead of displaying. Curiosity brings many hidden matters out. PRN would surely mean Printer and will redirect the output to the printer instead of console. Console (monitor) is the implicit default output device, and it can be bypassed if needed. So, how to put it explicitly? There must be some means to do that. Yes, there is! TYPE filename > CON performs exactly same function as TYPE filename. These special names for the devices really mean something special for the operating system and those names can not be used as folder or file names: CON, PRN, NUL, COM1 to COM9, LPT1 to LPT9, which stand for CONsole, PRiNter, NULl, serial COMmmunication ports, Line PrinTer ports.

The time has changed and Operating System can also be fooled! But still, many people think that it is not possible to create a folder by name CON. Using the path of network drive, these special names can also be used as folder names! Here is how:
  1. Goto DOS
  2. Type MD \\.\C:\CON. The folder will be created. You can check it in Windows Explorer also, but you can't access it
  3. To delete the folder, type RD \\.\C:\CON
In short, use the network path syntax instead of absolute path syntax.

Now on to the practical aspect of this. Why can't we create it directly but using the network path syntax? The answer is simple. A computer can have only one default console, printer, null etc. So, if it is accessed from a network, theoretically, the console should belong to another node in the network. Since that node may not have a device which can be referred using the name CON, it will no longer be considered as a reserved name. Hence, the folder can be created.

The next time when someone asks the question why we can't create a folder by name CON, say with confidence that it is not true...

Wednesday, May 30, 2007

Download Yahoo! Messenger Installer to PC

It may seem as trivial as it can. But have you tried to install Yahoo! Messenger? Read on, and you will find the problem. Yahoo messenger installation, as given in the website, involves the following steps:
  • Save msgr8us.exe to your desktop
  • Once downloading has completed, go to your desktop, double-click the msgr8us.exe icon
  • Follow the instructions to finish the installation
Well, what's the problem with that? Consider that you want to install messenger on multiple PCs. Of course, you can follow the same procedure on every PC, why waste bandwidth on every PC?. But consider doing it on a dial up, or a slow connection. At that time, it is really a pain to download it every single time. Instead, why not have a direct installer? Sounds feasible right? Here is a little hack just to do that:
  • Save msgr8us.exe to your desktop
  • Once downloading has completed, go to your desktop, double-click the msgr8us.exe icon
  • Now, don't just keep watching till the wizard finishes the installation. Instead go to C:\Program Files\Yahoo!\Installs folder on your computer
  • You will see a temporary file. As soon as the download reaches 100%, that temporary file will be renamed to ymsgr8us.exe
  • Now you have to be really quick. Just copy that ymsgr8us.exe file and paste it somewhere else. You have to do this as early as possible, because the wizard will delete that file soon after the installation
Now, you can use the copied ymsgr8us.exe file to install it on any PC. If you have a fast connection, you can share it with your friends who have a slower connection, so that they don't have to wait for an hour to install Yahoo! Messenger

Monday, May 14, 2007

I DNT HATE MOZILLA! ORKUT IS BANNED!!

I was asked by my friend that he is the only user in his computer, his account is having administrative rights, but he is not able to open Orkut, and it says Orkut is banned. Another friend had told that he is not able to use Mozilla Firefox and it asks him to use Internet Explorer. I just told it must be some virus, but really didn't care much about that. But none of the antivirus software could detect or remove this malware.

My friend had given me a pen drive. I remembered it while browsing net on Firefox. When I put that in my PC and double clicked, it didn't open. I knew at once: I had activated a virus. But I didn't have any idea about the kind of virus that might have come to my PC, until I switched back to Firefox. Immediately a message box was displayed: I DNT HATE MOZILLA BUT USE IE OR ELSE... with title as USE INTERNET EXPLORER U DOPE. I just remembered the experiences of my friends. I tried to locate the virus by running the Task Manager. But there were no suspicious entries there. I had to bow the owner of the virus. I used Internet Explorer to search about it. The first entry in Google took me to the Mozilla Forum page, and after going through some pages, I came to know that the same virus also displayed another message when you opened Orkut. Orkut is banned you fool, The administrators didnt write this program guess who did?? MUHAHAHA!! with title ORKUT IS BANNED. Well, a similar message was displayed for YouTube also. So I went through all the posts, and finally found a solution given here:
  1. Press CTRL+ALT+DEL and go to the processes tab
  2. Look for svchost.exe under the image name. There will be many but look for the ones which have your username under the username
  3. Press DEL to kill these files. It will give you a warning, Press Yes
  4. Repeat for more svchost.exe files with your username and repeat. Do not kill svchost.exe with system, local service or network service!
  5. Now open My Computer
  6. In the address bar, type C:\heap41a and press enter. It is a hidden folder, and is not visible by default.
  7. Delete all the files here
  8. Now go to Start --> Run and type Regedit
  9. Go to the menu Edit --> Find
  10. Type "heap41a" here and press enter. You will get something like this "[winlogon] C:\heap41a\svchost.exe C:\heap(some number)\std.txt"
  11. Select that and Press DEL. It will ask "Are you sure you want to delete this value?", click Yes
  12. Now close the registry editor.
Now the virus is gone. But be sure to delete the autorun.inf file and any folder whose name ends with .exe in the pen drive.

UPDATE
It seems that they have named this malware as w32.USBWorm and according my friend, Avast is able to detect and remove it. I hope the other antivirus software will also be able to remove it soon.

This virus is not responsible for disabling Folder Options in the Tools Menu and not allowing hidden files to be shown. It is some other virus, and the solution is explained in the post Hidden Files Not Shown

Sunday, May 06, 2007

Magic - What's behind it?

Magic - Everyone gets fascinated by the very word itself. Does it really exist? I don't know. But most of the tricks involve deception in one or the other way, or some strong mathematical foundation known to not many. Let us go through both of these...

Just try this mind reader:



Well, if you are wondering how it works every single time, just get to the mathematical basics

Assume xy be the two digit number, x being the first digit and y being the second. So, the total value of the number is x*10+y. Now, it asks to subtract the sum of the two digits from the original number. That is, x+y should be subtracted from 10x+y. What is left is 9x. Which means, the answer is independent of y and will always be an integral multiple of 9, that is, 9, 18, 27 etc.. up 81. Now see the flash again, and go through the symbols of 9, 18 etc.. They are all same!! And every time you click the crystal ball, it just displays the corresponding symbol. Since x can not be greater than 9 (remember, it is the first digit of the two-digit number you take) the answer can not be 90 or 99.

Now go through this video showing glass illusion:



Wondering how it is possible? Go through the video once again, or till you get the clue. If you are still wondering, I will give a hint: Observe carefully when 42 seconds are remaining. You will see there is another cylinder inside the glasses, and obviously it is filled before in hand with water!

Don't you agree that there is either mathematics or cheating in every magic trick? If you don't, go through this one to know it! Enjoy...

Saturday, January 13, 2007

Do you know about your system?

Sometimes ago, I came across a utility in Windows XP, which allows you to see many details about the system. This is systeminfo command, which is run in DOS window. It shows detail about Operating System, processor, network, hot fixes etc. It is a really a good utility that is not known to many people. It also gives information like when the operating system was installed, for how long has the system been on etc. To use this utility:
  1. Goto Start --> Run
  2. Type cmd /k systeminfo
  3. Click OK
Or, goto DOS, and just type the command systeminfo

[See the details of the command here]