Archive | May, 2013

Change your Gmail Background :)

30 May

Just follow these steps and you should be able to change your background

  1. Login to your Gmail Account
  2. Click on Settings option the right hand side

Image

 

      3. Now Click on THEMES option 

Image

 

      4. You should be able to see this option 

Image

      5. Now here you can choose your own pic , Paste image link or Just use any popular image

Image

Convert Sublime Text 2 to Licensed Version

30 May

Hello EveryOne.

Go to this link for Latest version and License

Note:- Sublime Implementations and Versions have been Changed so this fix might not work for you

This is the method to make your  Sublime Text 2 (Licensed Version)

Just Download Sublime Text – the best text editor now:

ps: You need Admin Privileges to make these changes. On Mac OSX and Ubuntu you can do sudo su command and then make the changes
Mac OS X

Open Terminal and enter the following:

1. cd /Applications/Sublime\ Text\ 2.app/Contents/MacOS/
2. edit file ->> “vim Sublime\ Text\ 2″
3. change to hex mode ->> “:$!xxd”
4. find and replace ->> “:%s/5BE509C33B020111/5BE509C32B020111/g”

Now open the sublime and enter the below licence key , it should work like a charm.


WINDOWS

For x64: After install, open sublime-text.exe with hex editor. Find and replace “33 42″ with “32 42″. Save and using this license key to register:

—–BEGIN LICENSE—–
Patrick Carey
Unlimited User License
EA7E-18848
4982D83B6313800EBD801600D7E3CC13
F2CD59825E2B4C4A18490C5815DF68D6
A5EFCC8698CFE589E105EA829C5273C0
C5744F0857FAD2169C88620898C3845A
1F4521CFC160EEC7A9B382DE605C2E6D
DE84CD0160666D30AA8A0C5492D90BB2
75DEFB9FD0275389F74A59BB0CA2B4EF
EA91E646C7F2A688276BCF18E971E372
—–END LICENSE—–

You should copy from Begin License till End License.


UBUNTU:

Follow these to fully and effectively register sublime text 2 in ubuntu

1.Install ghex editor.(in terminal,enter “sudo apt-get install ghex”)..without the quotes.

2.In terminal enter “cd /usr/lib/sublime-text-2″

3.In terminal enter “sudo ghex sublime_text” & enter your password

4.In open ghex window,navigate to Edit>Replace.

5.In the find string section enter 33 42

6.In the replace with section enter 32 42

7.save and exit.

8.run sublime text and register with the above license key.

Shift Windows in Chrome on Mac-OSX

29 May

The shortcut Command-` (That’s Command + back-tick ~, the key just above the tab key on your keyboard) is the standard Mac OS shortcut for switching between the windows in the currently selected application, and works in Chrome.

Your top 100 Unix Commands

29 May
history | sed “s/^[0-9 ]*//” | sed “s/ *| */\n/g” | awk ‘{print $1}’ | sort | uniq -c | sort -rn | head -n 100 > commands.txt

Plain English explanation of Big O

29 May

Quick note, this is almost certainly confusing Big O notation (which is an upper bound) with Theta notation (which is a two-side bound). In my experience this is actually typical of discussions in non-academic settings. Apologies for any confusion caused.

The simplest definition I can give for Big-O notation is this:

Big-O notation is a relative representation of the complexity of an algorithm.

There are some important and deliberately chosen words in that sentence:

  • relative: you can only compare apples to apples. You can’t compare an algorithm to do arithmetic multiplication to an algorithm that sorts a list of integers. But two algorithms that do arithmetic operations (one multiplication, one addition) will tell you something meaningful;
  • representation: Big-O (in its simplest form) reduces the comparison between algorithms to a single variable. That variable is chosen based on observations or assumptions. For example, sorting algorithms are typically compared based on comparison operations (comparing two nodes to determine their relative ordering). This assumes that comparison is expensive. But what if comparison is cheap but swapping is expensive? It changes the comparison; and
  • complexity: if it takes me one second to sort 10,000 elements how long will it take me to sort one million? Complexity in this instance is a relative measure to something else.

Come back and reread the above when you’ve read the rest.

The best example of Big-O I can think of is doing arithmetic. Take two numbers (123456 and 789012). The basic arithmetic operations we learnt in school were:

  • addition;
  • subtraction;
  • multiplication; and
  • division.

Each of these is an operation or a problem. A method of solving these is called an algorithm.

Addition is the simplest. You line the numbers up (to the right) and add the digits in a column writing the last number of that addition in the result. The ‘tens’ part of that number is carried over to the next column.

Let’s assume that the addition of these numbers is the most expensive operation in this algorithm. It stands to reason that to add these two numbers together we have to add together 6 digits (and possibly carry a 7th). If we add two 100 digit numbers together we have to do 100 additions. If we add two 10,000 digit numbers we have to do 10,000 additions.

See the pattern? The complexity (being the number of operations) is directly proportional to the number of digits n in the larger number. We call this O(n) or linear complexity.

Subtraction is similar (except you may need to borrow instead of carry).

Multiplication is different. You line the numbers up, take the first digit in the bottom number and multiply it in turn against each digit in the top number and so on through each digit. So to multiply our two 6 digit numbers we must do 36 multiplications. We may need to do as many as 10 or 11 column adds to get the end result too.

If we have two 100-digit numbers we need to do 10,000 multiplications and 200 adds. For two one million digit numbers we need to do one trillion (1012) multiplications and two million adds.

As the algorithm scales with n-squared, this is O(n2) or quadratic complexity. This is a good time to introduce another important concept:

We only care about the most significant portion of complexity.

The astute may have realized that we could express the number of operations as: n2 + 2n. But as you saw from our example with two numbers of a million digits apiece, the second term (2n) becomes insignificant (accounting for 0.0002% of the total operations by that stage).

The Telephone Book

The next best example I can think of is the telephone book, normally called the White Pages or similar but it’ll vary from country to country. But I’m talking about the one that lists people by surname and then initials or first name, possibly address and then telephone numbers.

Now if you were instructing a computer to look up the phone number for “John Smith” in a telephone book that contains 1,000,000 names, what would you do? Ignoring the fact that you could guess how far in the S’s started (let’s assume you can’t), what would you do?

A typical implementation might be to open up to the middle, take the 500,000th and compare it to “Smith”. If it happens to be “Smith, John”, we just got real lucky. Far more likely is that “John Smith” will be before or after that name. If it’s after we then divide the last half of the phone book in half and repeat. If it’s before then we divide the first half of the phone book in half and repeat. And so on.

This is called a binary search and is used every day in programming whether you realize it or not.

So if you want to find a name in a phone book of a million names you can actually find any name by doing this at most 20 times. In comparing search algorithms we decide that this comparison is our ‘n’.

For a phone book of 3 names it takes 2 comparisons (at most).
For 7 it takes at most 3.
For 15 it takes 4.

For 1,000,000 it takes 20.

That is staggeringly good isn’t it?

In Big-O terms this is O(log n) or logarithmic complexity. Now the logarithm in question could be ln (base e), log10, log2 or some other base. It doesn’t matter it’s still O(log n) just like O(2n2) and O(100n2) are still both O(n2).

It’s worthwhile at this point to explain that Big O can be used to determine three cases with an algorithm:

  • Best Case: In the telephone book search, the best case is that we find the name in one comparison. This is O(1) or constant complexity;
  • Expected Case: As discussed above this is O(log n); and
  • Worst Case: This is also O(log n).

Normally we don’t care about the best case. We’re interested in the expected and worst case. Sometimes one or the other of these will be more important.

Back to the telephone book.

What if you have a phone number and want to find a name? The police have a reverse phone book but such lookups are denied to the general public. Or are they? Technically you can reverse lookup a number in an ordinary phone book. How?

You start at the first name and compare the number. If it’s a match, great, if not, you move on to the next. You have to do it this way because the phone book is unordered (by phone number anyway).

So to find a name:

  • Best Case: O(1);
  • Expected Case: O(n) (for 500,000); and
  • Worst Case: O(n) (for 1,000,000).

The Travelling Salesman

This is quite a famous problem in computer science and deserves a mention. In this problem you have N towns. Each of those towns is linked to 1 or more other towns by a road of a certain distance. The Travelling Salesman problem is to find the shortest tour that visits every town.

Sounds simple? Think again.

If you have 3 towns A, B and C with roads between all pairs then you could go:

A -> B -> C
A -> C -> B
B -> C -> A
B -> A -> C
C -> A -> B
C -> B -> A

Well actually there’s less than that because some of these are equivalent (A -> B -> C and C -> B -> A are equivalent, for example, because they use the same roads, just in reverse).

In actuality there are 3 possibilities.

Take this to 4 towns and you have (iirc) 12 possibilities. With 5 it’s 60. 6 becomes 360.

This is a function of a mathematical operation called a factorial. Basically:

5! = 5 * 4 * 3 * 2 * 1 = 120
6! = 6 * 5 * 4 * 3 * 2 * 1 = 720
7! = 7 * 6 * 5 * 4 * 3 * 2 * 1 = 5040
...
25! = 25 * 24 * ... * 2 * 1 = 15,511,210,043,330,985,984,000,000
...
50! = 50 * 49 * ... * 2 * 1 = 3.04140932... × 10^64 

So the Big-O of the Travelling Salesman problem is O(n!) or factorial or combinatorial complexity.

By the time you get to 200 towns there isn’t enough time left in the universe to solve the problem with traditional computers.

Something to think about.

Polynomial Time

Another point I wanted to make quick mention of is that any algorithm that has a complexity of O(na) is said to have polynomial complexity or is solvable in polynomial time.

Traditional computers can solve polynomial-time problems. Certain things are used in the world because of this. Public Key Cryptography is a prime example. It is computationally hard to find two prime factors of a very large number. If it wasn’t, we couldn’t use the public key systems we use.

Anyway, that’s it for my (hopefully plain English) explanation of Big O (revised).

How to Enable Two-Factor Authentication on Twitter (And Everywhere Else)

29 May

Twitter

Twitter has named its two-factor authentication system “Login Verification,” and its announcement provides a straightforward guide on how and why to use it. It directs you toyour account’s settings page, where enabling the option is basically a one-click affair.

Image

Unfortunately, for now Twitter only supports two-factor authentication by SMS, so if you don’t want to attach your phone number to your account, or don’t have reliable or secure phone service, it may not fit. Many of the other services outlined here already offer support for standard and secure offline authentication protocols. Hopefully Twitter will follow suit.

Google

Google was one of the first major services to make two-factor authentication (it calls it “2-Step Verification”) widely available. It’s got a landing page that explains two-factor authentication generally, and a single settings page for configuring it across various Google services.

Image

Because many people use apps and devices without two-factor authentication support to connect to Google services, it’s useful to also understand Google’s one-time password system.

Google’s Authenticator app, which is available on iOS, Android, and Blackberry, can generate login codes for any compliant service (including Facebook, Dropbox, and Microsoft) and is a popular choice.

Dropbox

Image

Dropbox has a very clear tutorial on enabling two-factor authentication within that site, and supports authentication over SMS or over any of the popular authentication apps. You can enable the option in the Security section of your account settings, and it will require an authentication code whenever you sign into Dropbox on a new device or computer.

Facebook

Facebook calls its two-factor authentication “Login Approvals,” and it allows you to use a mobile app to generate authentication codes while offline. You can enable it in the Security section of your account settings — and while you’re there, it’s worth taking a minute to review the other options on that page.

Image

Note that while Facebook only officially supports codes from its own mobile apps, clicking the “Having Trouble?” link will show you a key you can enter into another authentication app, like Google’s Authenticator.

Apple

Image

Apple’s two-factor authentication can be used to secure Apple IDs against unauthorized logins on new devices and changes to your account information. It is only compatible with devices that support SMS or Find my iPhone notifications, and for now it is only available in the U.S., UK, Australia, Ireland, and New Zealand. You can turn it on in the “Password and Security” section of your Apple ID settings.

Microsoft

Microsoft is a new entry to the two-factor authentication game, rolling out the option only last month. It’s a welcome addition, given that a single Microsoft account can access an Outlook inbox, devices like the Xbox console or Surface tablet, and of course Skype. You can turn it on in the “Security Info” section of your account settings.

Image

There’s an Authenticator app available for Windows Phone, and Microsoft’s system is compatible with other authentication apps such as Google’s. Also, as with Google, some devices and apps that use a Microsoft account don’t support two-factor authentication, and use one-time passwords.