Thursday, January 28, 2010

Palmistry Articles

Didn't the title of this post wonder you? Whats the point of palmistry in a technology blog??? Well, not a big deal to be fussed about. I've seen many IT people who are too superstitious. Starting today, I'll keep posting articles from an anonymous palmist on irregular intervals here on my blog, interleaving with technical posts. The palmist, aged 26, is brilliant at his subject and moreover I know him personally and he publishes at scribd.

Here are the links to his first three articles.

What palmistry can do for you?

Importance of Hand as a Whole in Palmistry

Little Finger in Palmistry

I would love to have feedback from the article readers.

Tuesday, January 19, 2010

Swap without temp

A few days back, I was asked by one of my friends to swap the values of two integer variables without using a temp variable. Fortunately, I had seen this problem an year ago and I recalled the one liner code and gave him the ans. After he went away and I was all alone, I started thinking of other methods. I derived two of them pretty quickly. And after some research on the net I found a fourth method as well. So here I'm presenting all the four methods to do the magic. I am also including a C implementation of all four methods.

Let the two variables be 'a' and 'b'.

Method 1: Sum and difference

a=a+b;
b=a-b;
a=a-b;


Method 2: Product and division

a=a*b;
b=a/b;
a=a/b;


Method 3: Three successive bitwise XORs

a=a XOR b;
b=a XOR b;
a=a XOR b;


Method 4: One liner code with double assignment

b=a-b+(a=b);



And here is the C implementation of all the given methods


#include <stdio.h>
#include <process.h>
int main(){
int a, b, c;
printf("Enter the value of 'a':\n");
scanf("%d", &a);
printf("Enter the value of 'b':\n");
scanf("%d", &b);
printf("Enter the method for swapping the values:\n1 for sum method, 2 for product method, 3 for XOR method, 4 for one liner method, anything else to exit.\n");
scanf("%d", &c);
switch(c){
case 1:
a=a+b;
b=a-b;
a=a-b;
printf("You chose method 1. The new values are a=%d and b=%d\nThe algorithm used was:\na=a+b;\nb=a-b;\na=a-b;",a,b);
break;
case 2:
a=a*b;
b=a/b;
a=a/b;
printf("You chose method 2. The new values are a=%d and b=%d\nThe algorithm used was:\na=a*b;\nb=a/b;\na=a/b;",a,b);
break;
case 3:
a=a^b;
b=a^b;
a=a^b;
printf("You chose method 3. The new values are a=%d and b=%d\nThe algorithm used was:\na=a XOR b;\nb=a XOR b;\na=a XOR b;",a,b);
break;
case 4:
b=a-b+(a=b);
printf("You chose method 4. The new values are a=%d and b=%d\nThe algorithm used was: b=a-b+(a=b);",a,b);
break;
default:
exit(0);
}
return (0);
}


The third and the fourth methods are geekier than the previous two. I leave it to you to find out how the third method works.

Thursday, January 14, 2010

Facebook gives away 6-months McAfee subscription

Yes!!! Thats true! Facebook is now in an year long partnership to provide a free 6-month subscription of McAfee antivirus to its 350 million users! Here is the official notification from facebook.

One of the best defenses against security threats is a good offense, and we want to help you take the offensive by having the latest security software installed on your computer. Today, we are announcing a year-long partnership with McAfee to offer all 350 million people who use Facebook the ability to download a six-month subscription to McAfee security software at no cost, along with a special discount once the six months are over.

You can take advantage of this offer by visiting the Protect Your PC tab on the McAfee Page on Facebook.

We're committed to doing everything we can to help you protect your account and make your experience on Facebook as safe and enjoyable as possible. We invest in dedicated teams and advanced technical systems that detect and block suspicious behavior. When we find a message with a link to a fake login page or other malicious website, we prevent it from being sent and delete all instances of it from the site. We also work with third parties to get malicious sites added to browser blacklists or removed completely.

For the rare case in which an account is compromised, we've developed a unique process that requires the account owner to take steps to secure the account and learn security best practices. We've also incorporated custom McAfee software into this process for people identified as having infected computers. Now, if your computer is infected, you will be asked to run a scan like the one shown below and clean it before accessing Facebook. We're not aware of another free Internet service that takes this much responsibility for helping people keep their accounts secure.
We have a lot of control over security measures on Facebook. However, we don't control other websites and services you visit that might infect your computer. For this reason, we recommend that you install updated security software, which you can now do at no cost through this partnership, and that you always follow these safe practices:
Don't open attachments in emails that look suspicious or come from an unknown or untrustworthy source.

Don't open attachments unless you know what they are, even if they're from friends.

Delete chain mail and spam from your email and Facebook inboxes.

Be cautious when downloading files from the Internet.

Be cautious of any message, post or link you see on Facebook that looks suspicious, requires an additional login, or asks you to download or upgrade software.

Use an up-to-date browser that features an anti-phishing blacklist. Some examples include Internet Explorer 8 and Firefox 3.0.10.

Choose unique logins and passwords for each of the websites you use.

Check to see that you're logging in from a legitimate Facebook page with the facebook.com domain.

Become a fan of the Facebook Security Page to receive more tips, updates on the latest threats and other information to help you protect your computer and online accounts.


Jake, a project manager for the site integrity team, is keeping his computer clean.

Monday, January 11, 2010

Facebook's move for the advancements in CS

Facebook has started a fellowship program for Ph.D. students studying in US universities. The students will be encouraged to solve the complex problems pertaining to the field of CS in following areas: Internet economics, cloud computing, social computing, data mining, machine learning, and systems and information retrieval. They will pay the tution fees and provide an stipend of $30,000. This, according to me is a very good move by facebook to directly attack practical problems armed with the power of academia and proceed to some real advancements in CS
Their fellowship page contains more information.