wuthering thoughts
Another pleonastic blog. Diary of an insomniac. And I always lose my words beyond the second sentence.

Google Calculator: Math Fail

Category: , , , , By Suman Kar
Did you know that you can enter cos (pi/2) and get back a nice 0? The parentheses thingy is a matter you'd like to be careful with though. Because cos pi/2 is treated as (cos (pi))/2. For that matter, log, ln, e are all keywords (just like your pi) with proper arguments. What is surprising, unfortunately, is that there are no hyperbolic functions. Try with arccos, acos -- they don't work. One more of Google's strange omissions. Oddly enough, (9^9)^9 works and so does e^e^e whereas 9^9^9 doesn't! 5/5 returns 1, 1/0 doesn't work. Next, try out tan (pi/2) on your desktop calculator (if you don't know what it is). Mine says 'invalid input for function'. Google is smart, real smart. Check for yourself! Check out more Google oddities on reddit -- here.




Got more of Google bloopers? Post 'em here!

 

The Perverted OS

Category: , , , , , By Suman Kar
I have had the (mis-?)fortune of dabbling in more than a single OS. Windows, Macintosh, Unix, Linux, Solaris -- you get the idea. At different points of time I have independently labeled each of the current OS to be the worst of the lot. Windows for lack of anything remotely resembling a workable shell and Visual Studio (think version 6 and earlier, yeah the 'Dark Ages'), Unix for no GUI and Printers Panel, Macintosh for its resource forks, .app files, bundles, frameworks (oh, hang on! they are just some glorified bundles aren't they?), Xcode, Safari (what else is there?), Linux for lack of Visual Studio, far too many shells of formidable power, and the long unending list of commands and so on. I'm left without a religion; though for what it is worth, I'd any day prefer a *nix one to anything else. It was this realization that also chugged the devil-in-my-empty-mind down perversion street.

Take any *nix system with the usual command set (and probably binutils on Windows) and see what you get. I have long had this feeling Ritchie and friends were upto something, just didn't realise they had a secret chauvinistic gay manifesto. The secret lies in the commands. Read on ...


Command:man
Translation: you have to be a man to help and have to go to one to get any. The oh-so-obvious male chauvinism at play. How could the feminist comp-sci grads miss this? This command is particularly offending when paired with some other seemingly harmless ones. Take unzip for example. How could a self-respecting OS ever yield to the lusty demands of the bespectacled douche-bag typing in 'man unzip'? Or for, be so insesitive so as to let the clueless SysAdmins (who have, I'm sure, only gotten down and closer to hell since) for they commiteth the sin of 'finger'-ing man, woman and every antelope that ever had an account on their networks? And never, ever, and I mean ever in every sense, explain to your fiancee's dad that 'man man' is only a 'man entry on man'-ual. You'd probably end-up feeling very disappointed with yourself very soon. Things get really nasty if know how read the text that's put up. I'll show one such example. Excerpts from the man page of finger (1):
"the default output format [for the former] is the -l style," -- you're going in straight
"and the default output format [for the latter] is the -s style." -- oh, yeah, lets get dirty
"The -l option is the only option that may be passed to a remote machine." -- its like
you only know each other for about 4 hours
The library isn't without its blemishes either. Take for instance, the Holy Trinity of 'open', 'creat' and 'close'. I wonder how many unsuspecting junior programmers have cut their teeth on these without ever seeing the plot. It gets better, if you read the Rationale section over at opengroup's website you see it: "It has been included primarily for historical purposes since many existing applications depend on it." Yes, Dennis, we know.

So, now you know, you too can -- avoid or at least be a little less apparent when in front of a *nix. Just joking!

PS: If there's another command or two I can remember I'll post it here. Feel free to add to this list if you know of any.
 

42:Hypotheses

I'd hazard a guess that very few numbers ever became famous because literature endorsed it. 42 is an exception. Douglas Adams immortalized the number as the answer to the ultimate question of life, the universe and everything. (These days, even Google's calculator would tell you that -- try punching in that question.)

I have thought about it for a while and only found myself satisfied to think that it was an accident that Adams chose what he chose. Wikipedia's entry on the number 42 kind of confirms it. And that Adams rejected every other hypothesis.

But let's go back, why this sudden interest? I was looking up references to 'Looking-Glass' and Carroll (of Alice in Wonderland fame) and bumped on Carroll's life and eventually his favourite number. Guess what number it was? 42! That was that -- I spun around on my chair and pulled a few strands of hair out in sheer excitement. In short, I was having an 'Eureka' moment.

Would it be unfair to wager my money on the fact that Adams, being English himself ,had read Carroll? That he was strongly influenced by his works? Or that he had gone through his biography, his idiosyncrasies? That he knew 42 was Carroll's favourite number? (See 'the Through the Looking-Glass' article on wikipedia and in particular the section on The Chess Problem.) That, that fact had been sowed somewhere deep on the back of his mind? That, when he tried to think of a number, he could think of something he already knew? That, random is not always as random as it seems?

Maybe, just maybe, it was his own way of showing his appreciation of Carroll's works?

Of course, that's a lot of maybes and one could always argue that it's dangerously close to daybreak, and I haven't have had my cup of tea after a long (day and) night and I'm off the edge. That Adam's word on this is final (and yes, I'd be happier to think that way, but ...)

So, this is where I will rest my case.

Update: Some more ('elementary', pff!) research on the internet shows this has been well researched and DNA himself was 'annoyed' (to quote a poster on an internet forum) with this linkage. So, there goes my early morning theory -- down the drain. Okay, off to the tea now.
 

Google Demography

Category: , , , , , By Suman Kar
Okay, buckle up for 'The Next Google Feature'! Google Search has a secret feature. Type in a country's name and the word population (enter, say 'US population') in the search bar and voilà -- Google snaps an estimate. The country name is hyperlinked to some site from where the data is scraped (for lack of a better word, and want of inside information, on whether Google actually pays these guys or not for getting the data). But this gets better when dig deeper. Have a look at the following screenshots and you'll get it:

Now notice the hyperlinks after the 'According to' text. Yep, they change! And the order and quantity of data and of course, if its not the CIA website, Google's offering you alternatives.

And what happens if you are all watered up? Yes, 'Pacific Ocean Area' works too, but this time again, the source is different. (BTW: area works for countries too, if you notice.)

I could probably go on, and make this post longer and longer still to a point where you'd give up reading. But the true WTF is I couldn't find any information on Google's Advanced Search help. Maybe, I didn't look hard enough ;)

The biggest disappointment of course is when you get smarter. (As it always is!) Type in a continent (say, 'asia population', and Google will spew out a general result-set. So, dear Google, was it really difficult to do elementary addition? With all the funky hardware and over-the-top algorithms you have developed?

Which brings us to the all important question. Is Google out on a mission to scrape every single piece of information from every damn page it sniffs and render them, in due time, inutile? That could be damning evidence of Google's monopolization of the information. For the time being let's just hope I am paranoid.

 

WTF #2: PDF.COM

Category: , , By Suman Kar
PDF is an open standard (ISO 32000-1:2008) file format for document exchange created originally by Adobe Systems. I decided to check-out more on PDF and started off by keying in www.pdf.com in my browser's address bar. Lo' and behold! Turns out the domain belongs to a certain EDA company - PDF Solutions, Inc. Call it identity crisis or lack of foresight, but sure goes down as a classic WTF.
 

WTF #1: Microsoft's ternary boolean

Category: , , , , , By Suman Kar
This one goes into my little red-book of WTFs in all-caps. Epic fail from the behemoth. Look up the MSDN documentation of Win32 GetMessage() function. The section on 'Return Value', you ask? Yeah, right,the warning box. I'll quote them:

'Because the return value can be nonzero, zero, or -1,[...]'


In case you are not too familiar with Win32, I'll post the signature as well.
BOOL GetMessage( 
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
PS: Just so the joke is not lost to the multitude of non-programmers (or even our lucky non-Win32 programmer comrades) I'll try to explain. The 'BOOL' on the left of GetMessage() says that the function (GetMessage) has a boolean return type. Which, for what it is worth, means that the function can either return the value 'true' or the value 'false' after executing. The boolean data-type was never a part of good-ol' C, neither C++ and hence all sorts of folks have had their own interpretation of how these two values ought to be represented. Historically, people have used integers to pose as booleans and treated the value '0' as 'false' and all others (positive or negative) as 'true'. A sin we mortal programmers are committed to, when using a boolean that really are integers under the hood, is to check if the value is '0' or not. And we just ignore the others -- we know they are true. Unfortunately, Microsoft, in this case, couldn't help but further the cause of the already abused boolean to the next step. It suggested that, we'll give you true and false all right, but you know, you'd be better keeping an eye out if you're getting a '-1' as your function's return value. Now that's a royal screw-up. Booleans are booleans. There ain't no way no self-respecting programmer will check for a petty '-1'! Never.

Dear MS, change the type while you still can and save us the ignominy.

PPS: For the historically inclined check out George Boole after whom the type is named.
 

reddit photo gallery

Category: , , , By Suman Kar

Being the avid redditor, I couldn't help writing my custom photo-gallery. An Adobe® AIR™ based application. Here's a screen shot. Want it? Right-click and do a 'Save link as ...' here. (If there's a better way, let me know.)

Of course, you'd need to install the AIR runtime first.

There are some limitations: you don't see more than the top 25 images in each category. But then a 100 images is something of a start. Ain't it mate? Feature suggestions are most welcome.
 

reddit fail

Category: , , By Suman Kar
While still on a bloglific mode. Here's something I find confusing with reddit. What is the up arrow doing up there? Yeah, that's the number one post (and every other number one post). I'd bet they have a similar down arrow for every last post. (I mean I'd have done this differently.)

Main Entry: blog-li-fic
Pronunciation:\ˈblȯg-ˈli-fik, ˈbläg-ˈli-fik\
Function: noun
Etymology: blog + prolific
Date: 2008

Anyway, this prompted a yours truly's creation. So thanks, reddit.


 

what gives?

Category: , , By Suman Kar
Just back from a feast of Coen brothers' movies I treated myself to. And here's what I got: What gives? (The Hudsucker Proxy, to be exact.) Curious expression! Led me hunting the internet and came up with a jewel, a rather formal treatise here at Brian Joseph's.