I will explain in this post how to crack this simple code with the help of some Python one-liners (Google’s favourite language). If you are a Google aspirant (who isn’t? ;) ), this might help you clear the interview. So pay attention.
To most people it is immediately obvious that it is a text encoded in binary. Since each binary word is 8 characters long, it is most probably written in the extended 8-bit ASCII code. In fact, it is and you can read this with a simple ASCII chart.
But they have made it slightly difficult for you by writing in binary. Since most charts would provide you a lookup from decimal or hexadecimal numbers to ASCII representations only. So how do you convert from binary to decimal? It’s quite simple:
This line defines a function decimal which works in a manner similar to how we would manually convert binary numbers into decimal. Each position is multiplied by increasing powers of two from the right. Then, these numbers are added together. for e.g. ‘1010’ will be 1 * 8 + 0 * 4 + 1 * 2 + 0 * 1 = 10.
Next, we split the binary part of the tweet string and apply the decimal function on each part
Q. What’s the Difference between Cloud Computing & SaaS?
A. It is the same as the difference between TV and Cable TV. TV is a technology. However, Cable TV is a business model using this technology.
Cloud Computing refers to an architecture where web applications can scale easily to any number of users. Software as a Service (SaaS) is a business model where computing software is provided in a ‘pay as you use’ model. SaaS is often built using Cloud Computing. But all Cloud Computing apps don’t use the SaaS model.
Have to even seen yourself briefly other than in your own reflection? Have you ever wondered if there are other people who are identical to you in appearance but nowhere related to you? There is a word for it - Doppelgänger. As per Wikipedia:
…They are generally regarded as harbingers of bad luck.
In some traditions, a doppelgänger seen by a person’s
friends or relatives portends illness or danger, while
seeing one’s own doppelgänger is an omen of death. In
Norse mythology, a vardøger is a ghostly double who
precedes a living person and is seen performing their
actions in advance.
There also a Malayalam movie called Aparan based on this concept. It is the first film of the actor Jayaram by the acclaimed Director/Writer Padmarajan. In the film, the doppelgänger truly upturns the protagonist’s life. However, there are no double role gimmicks employed. The presentation is very sensitive and gripping.
In this era of cloning, any part of your body - split hair or even saliva can be used to create an entire replica of yours. Gene therapy may soon make this a reality. Will your clone bring you bad luck as some Hollywood movies predict? Most likely, because most people wouldn’t enjoy the company of someone with exactly the same nature as yours. Even worse he or she will covet the same things you would covet. This could mean you will be competing with your clone in many spheres of your life for e.g. dating. And the winner would be, most probably, based on chance because your skills/qualities are evenly matched. A little frustrating isn’t it?
Whoever said Imitation is the most sincere form of Flattery, most certainly didn’t think of clones!
Reddit had a heated debate about the AJAX paging pattern. The debate sidetracked into the benefits of Paging. Nobody seemed to mention the excellent greasemonkey script Autopagerize which is proof that the concept works brilliantly. I find it one of the most indispensable Greasemonkey scripts available today.
The idea is simple. Assume you are reading a blog in blogspot.com. When you scroll towards the end of the blog, Autopagerize realizes that you are really interested in reading more blog posts. In other words, soon you would click on ‘Older Entries’ links. This would have caused a fresh page to load. How terribly annoying! Instead, Autopagerize will silently load the older posts in the background and seamlessly add them to the end of the page. By the time you finish reading the second page, the third page will be added to the end and so on and so forth. This results in a smooth and breezy browsing experience, which has to be experienced to be believed.
Installing Autopagerize
Autopagerize uses greasemonkey plugin and hence works only if you have Firefox installed. The steps are quite simple:
If the page supports Autopagerize, a green square will appear at the top right of the page. Scroll to the end and it will momentarily turn blue to indicate that the next page is loading in the background.
How does Autopagerize work?
Autopagerize works on all kinds of sites which have pages. But how does it manage to understand the structure of them all? The answer is the community maintained SITEINFO database which is the result of hundreds of hours of effort.
Autopagerize is turned on for a particular site if its URL matches the url property. Once the page is loaded, it searches for the next link based on the xpath provided by nextLink property. The next page’s content is identified by the pageElement property. Anything which is not part of this content is discarded. This content is then appended to the existing page either by appending as a sibling to the existing pageElement or if insertBefore is defined, it is inserted before the element identified by insertBefore property.
How to Add any Website to Autopagerize?
Note: This is not for the faint of heart. It involves opening and working with some code (to the extend of editing some regular expressions).
So you would like extend the Autopagerize experience to more and more sites? Don’t worry, you have come to the right place. For this section you would need to install the excellent Firebug plugin. Firebug’s javascript console is the best interactive XPath debugger I am aware of.
First, ensure that Firebug console is activated for your site. Visit the page you would like to Autopagerize say http://www.adobetutorialz.com/articles/2751/1/Professional-Web-Layout-for-Business-Solutions. Click on the firebug icon and enable the Console by checking the first check box (as shown in the figure). Click on Enable. Now the page gets refreshed and the Console appears.
Next, go to the Firefox menu item: Tools -> Greasemonkey -> Manage User Scripts. Select Autopagerize from the list and click on Edit button below.
Turn on debugging by changing line 26 (could be different for you) to var DEBUG = 1. However I could make debugging work only after adding the following 3 lines further down, say after line 85.
if(unsafeWindow.console){
var GM_log = unsafeWindow.console.log;
}
Scroll to the line that starts with var SITEINFO = [, which is around line 40. Copy and uncomment the 6 lines of sample code provided by the author as shown in the figure.
Now, give the appropriate XPATH values to the property variables “pageElement” and “nextLink”. The “url” variable is a simple regular expression and an example link for the fourth variable (this variable is purely for documentation). Save this file and refresh your page. If the XPATH values are correctly found the Autopagerize green square icon will appear on the page, else there will be some error on your Firebug console like:
nextLink not found
Debugging Autopagerize or Shit, Nothing Happens!
As you might have guessed, the last step I mentioned earlier is not so easy. This is where Firebug can help you. Before you start read some XPATH tutorials on the net to familiarize yourself with the XPATH syntax.
One killer feature in Firebug is selecting any element of a page and copying the XPath value of that element. On the Firebug window click on Firebug’s Inspect button and mousing over the page to outline that page element (see fig).
Click on the page element you are interested in and the details of the element appear on the firebug window. Right clicking on any item in the breadcrumb at the very top, you will see a Copy XPath option (see fig).
Now go to the console tab of Firebug and test the XPath by using the $x function. Paste the XPath as an argument to this function and you should get an HTMLElement as the result (see fig).
You will need to find variables: “pageElement” and “nextLink” this way. This is not an exact science and involves a lot of trial and error. Here are some tips I found after several hours of testing:
Escaping - You will need to add a backslash ‘' before each special character like ‘/’ or “. This is not required in the Firebug console, however.
Single Quotes - It is best to use single-quotes as the outer-most quotes in the Firebug console
Firebug gives Absolute Paths - You will find that Firebug gives XPaths based on the position of a child element, which is likely to break even if the smallest change is made to the page. Try to avoid relying on positions.
Use attributes - The best XPaths use the classname property or id property of an element or its parent.
No Array Results - The XPath must always return a unique element. If an array of elements are returned, it will not work.
Watch the Console - After you enable debugging the console provides useful error messages. This helps in identifying the problem.
Read Examples - It is always best to check the huge SITEINFO database to understand how other users have tackled similar or tricky sites.
For the site we were using as an example, the following code should work:
It is the first Onam in our flat and we thought, why not go full traditional? The floral carpet took a couple of hours of dedicated effort in the wee hours of morning. So, was it worth the effort? Check it out:
Math Behind the Scenes
Well, there is a bit of geometry involved in a pookalam unless you are willing to spend a lot of time improvising. Like a good piece of engineering, a good design was essential. Here are some of the mockups made using Inkscape:
The Sadhya this time was at Prestige Hotel. Was pretty good with 3 different kinds of Payasam. Now time to munch some banana chips ;)
This is a quick workaround for people who are using easy_install to install Python Imaging Library on Windows. Many people faced issues while doing this. I found a simple workaround for this.
You must have tried the following
C:> easy_install PIL
Searching for PIL
...
Finished processing dependencies for PIL
C:> python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Image
Now you will need to go to your site-packages directory (typically at C:\Python\Lib\site-packages) and change one line that starts with ./PIL-1.1.6-py2.5-win32.egg to simply ./PIL and change the sub-directory named similarly to PIL
Unfortunately, there is no way to escape the tremendous hype surrounding the latest Batman film ‘The Dark Knight’. It spoils a viewer’s experience by raising the expectations to an unrealistic level. Unbelievably, just after I saw the film yesterday, I realized that even the hype couldn’t prepare me for such a fantastic experience. Christopher Nolan’s creation not only appeals to the average film goer but also to the critics establishing a new benchmark against which comic book films will be judged against. In fact, the term ‘comic book movie’ will no longer be understood as a euphemism for ‘bunch of crap appealing to the comic book fans’ anymore.
This multi-climatic, multi-layered, and multi-thematic film is an excellent cinematisation of an epic struggle between good and evil. Through excellent dialogues and almost heart stopping action sequences, the story unfolds rapidly and constantly keeps you guessing. While most action films try hard to come up with one clever climatic arc, Nolan’s Joker gives the audience a maddening parade of climatic moments one after another.
Joker - Best Villain Ever
The biggest highlight of ‘Dark Knight’ is undoubtedly the character of Joker. Though many phsychotic characters have appeared in Hollywood, Heath Ledger’s Joker is path-breaking in many ways:
He is an absolute. There is a no background story. He himself gives multiple interpretation of his disfigurement. No attempt is made to humanise or even demystify the character.
His disfigurement makes him a freak, which he further relishes and emphasizes with make-up. His unkempt and battered appearance is hardly scary, but add the body language and intonations of a psychopath and the result is disturbingly real.
He is arguably not an evil character simply because he has no moral compass. He master-minds situations which involve dire outcomes yet leaves the details to chance. He, in his own words, is Chaos. He proves that sanity or civility is based on the illusion of order that humans have created. The absence of order brings out the latent insanity in everyone. It is in this chaos that Joker thrives.
As Joker aptly tells Batman in a memorable scene - What would I do without you? You complete me.
Note this currently works only if you have Firefox installed
The Hindu is is one of the newspapers I have great respect for. I am allergetic to fresh newsprint, so I have no choice but to read their online edition even if I have subscribed to the print edition. But their website badly needs a redesign. However, in this Web2.0 era you are not at the mercy of the site admins to do something about it. You can improve your browsing experience in 2 steps:
Point your firefox to the Greasemonkey add-on page and install the add-on. Now restart Firefox before you go to step 2. Don’t worry all your open tabs will be restored.
Sometimes the biggest reason people choose Linux is that they can choose to change Linux they way they want. However, majority of the people believe that no matter how much you change/customize Linux it will never match the eye candy of other desktop OSes. Frankly I never thought that the font rendering in Ubuntu can match that of OSX or even Windows.
Until I came across this tip in Ubuntu Forums. I would say this is the single biggest improvement in the appearance of Ubuntu desktop. By just one command, you can improve the font rendering of virtually every application on Linux. Check out the following screenshot after implementing this tip:
Please note that all the jokes below are in Malayalam. Salim Kumar is a Malayalam film comedian who often pairs with Dileep with a knack for witty one-liners. These jokes are mostly from the Salim kumar communities in Orkut. Many thanks to all Salim kumar fans
»Thilakkam:
onnam class muthal kanjavu valichirunenkil
chalpalannu ippo english parayamayirunnu…
»Chathikkaatha Chanthu:
Q. Ithu aarude kottaramanu?
Ithu madya thiruvitankoor bharichirunna oru rajavinte kottaramanu..peru sasi maharajavu…
»KalayanaRaman
Trying to break the coconut besides the lady and the lady falls to the pool of water and SK says
‘Yenta oru shabdham ketathu???’
‘Thenga odachappo oru piece vellathil poyathaanu’
»Chadikaatha chandhu
“Im Micheal Elias ,JAckson Elias,Vikram Elias”
Thenkashipattanam
salimkumar to dilip:
nammal kaanaan pokunnath devootiyeyalle allathe mammotiyeyallalo.
»
Salim Kumar is reading the classifieds section in the newspaper…“Varanmaare aavashyamundu……………………AASHWAASAM KANDAAL MAATHRAM PRATHIBHALAM. Eh?? Ithu veraiy parasyamaanallaiy…oh..thetti vaayichu”
»
“Iyaal enthu pani aado e kaanickkunne…Thanne kondu njan thottallo..I ALL SO FAILED OF YOU.”
»
nee sahakarikukayanengil ee kalavara namukoru maniyarayakkam…
»
Kannimasam vanno ennariyan pashuvinu calendar nokkenda aavashyam illa (Dileep was trying to flirt with Navya Nair and denying the relationship to Salim Kumar and Innocent).
»
dharalam mudra patrangal vendi varum ..
namakku documentry thayyarakkande…
»
the home appliances of the two families u r the link………………..no…….. no………… no…………u r the link of the link. the two families attached to hte bathroom ur families food and accomodation. wat do u mean……………oh angnonnum illa ……….neymeen…..chalameen…….ailameen…..silopimee……..emmmmmmm………poor boy english polum arinjukooda enittu ennodu speachan vannirikkunnu………..malayalees………………
»
End of the first night
salim: ho neram velutho,itha cash
wife: muzhuvanum undallo alle…
»
In pulivaal kalyana
“sangeetham padikanamenna mohavumayi njaan chennu kayariyathu oru singatthinte madayilayirunnu….- usthad alavaladhi khaan
avasaanam guruvinte vaayil oru pidi manal vaari ittu yathrayayi…by the by njaan vishayattil ninnum pinmaariyo…where is the lyrics….gagapamaaaaa….ahah subash subash…..idadanakkam…gujarathi kalthala kettyiya malayalee pennanu njaan panjabiiiiiiiiiiiiiiiiii…..
»
Ee Bloody Indians and malayalees pranchu nadakkunnu..enikku dufaiyil kooli paniyanennu…
nattil oru image undakiyedukkananu MANAVALAN N SONS enna ee boardum..Eee nhanum ..pinne ee pipe um
Thenkashipattanam
sk: da!! aa kaalede nottam athra sheriyalla..
dileep: athinu ninakkentha??
sk: ninakku prashnam onnum illallo, njan alle purakil nilkunnathu…
»
Ningalku avishyamullathu panamanu.
ente kayyil avishyathinnu kuduthal ullathum pannamanu
»
salim: ee manushyarokke janikkunnathinu munpu aadine(goat) theettichirunnathaaraa??
mammootty: athu………..(thinking)……..ithu orumaathiri mattedathe answeraanu
salim: che njaanathu chodikkan paadillaayirunnu
»
Bus stoppil ninna bussu kittum , full stoppil ninna fullu kittumo.. potte oru pintengilum kittumo???
»
actor:(Tohis dad) Venda pappa.
Salim:O sarinte peru pappan ennano Ente perum pappan ennanu.Nice to meet u
»Thommanum makkalam
ee kadhina pottana kanumbo.. enikku ente achane orma varum…
ente achan oru vedikkettapakadathila marichathe.. (laughs)..entha cheyya..achante oru kaaryam