Suddenly for no earthly reason I felt immensely sorry for him and longed to say something real, something with wings and a heart, but the birds I wanted settled on my shoulders and head only later when I was alone and not in need of words.

― Vladimir Nabokov, The Real Life of Sebastian Knight


image source: http://www.panmacmillan.com.au/display_title.asp?ISBN=9780330535861&Author=Storr,%20Will

I’ve decided to stop playing games and pick up books again. My daughter is 10 months old and is imitating everything I do, and I want her to stop patting my 3DS and pick up a book instead. My unread pile isn’t very huge, but didn’t look too appealing. So I made a quick trip to my favourite bookstore and picked up a few new books. Richard Dawkins’ autobiography was one of them. Heretics, by Will Storr, was another. I’m less than a 100 pages in but already liked it enough to write about it.

Heretics is a kinder book than the ones I’m used to. Storr tours the world, meeting people with.. odd beliefs, from creationists to UFO nuts. Anyone who (like me) has spent hours arguing with friends and family on skepticism, the placebo effect, rationality and so on, will notice how stubborn and defensive people can get when pushed to a corner. The facts don’t matter to them, and perversely, make them less inclined to change their minds. It’s not often you see a mind changed when faced with convincing data.

An excerpt stood out, early in the book:

I consider — as everyone surely does — that my opinions are the correct ones. And yet, I have never met anyone whose every single thought I agreed with. When you take these two positions together, they become a way of saying, ‘Nobody is as right about as many things as me.’ And that cannot be true. Because to accept that would be to confer upon myself a Godlike status. It would mean that I possess a superpower: a clarity of thought that is unique among humans. Okay, fine. So I accept that I am wrong about things — I must be wrong about them. A lot of them. But when I look back over my shoulder and I double-check what I think about religion and politics and science and all the rest of it… well, I know that I am right about that… and that… and that and that and — it is usually at this point that I start to feel strange. I know that I am not right about everything and yet I am simultaneously convinced that I am. I believe these two things completely, and yet they are in catastrophic logical opposition of each other.

The book goes on to explore why otherwise intelligent people delude themselves into believing things that are so obviously not true to the rest of us. Well worth a read (so far). As a plus, the book is also a lot funnier than I expected, and there’s more than one laugh-out-loud moment when Storr undergoes some excruciating ritual or the other to get into the minds of these people.

Basic Twisted echo server

Nothing mind blowing here. I’m playing with Python’s twisted engine, and here is a slightly modified server from their home page example:

from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
    def dataReceived(self, data):
        newdata = 'reversed: ' + ''.join(reversed(data.strip())) + 'n'
class EchoFactory(protocol.Factory): #build an Echo object for each connection
    def buildProtocol(self, addr):                                                                                      
        return Echo()
reactor.listenTCP(8000, EchoFactory()) #register a callback

Run the script and telnet to port 8000 of this box. This is what it looks like:

Connected to erdos.
Escape character is '^]'.
reversed: olleh
reverse this!
reversed: !siht esrever

The example is also here, with a more detailed explanation of the basics.

The API reference helps to see what methods need to be implemented while sub-classing one of its classes.

V for Vita

image credit: venturebeat.com

image credit: venturebeat.com

Things have been going well at work for me, so my wife gifted me a cool PS Vita! She’d bought me a 3DS some time back, and I’ve found handhelds are pretty much the only way I can game these days.

The box came with the God of War collection. I sped through part one already, and thoroughly enjoyed it. The memory cards are pretty pricey, so I had to settle for a 4GB card. I’ve signed up for PS Plus as well, and the free games are pretty good (Steamworld Dig, Binding of Isaac).


I spent quite some time pouring over reviews, after which I bought Soul Sacrifice and Gravity Rush. Both seem to have pretty long single player campaigns, but I’ve not spent enough time on either to give a full review.


image credit: forbes.com

As a somewhat-Nintendo enthusiast, it’s nice to see the other platforms for a change. The PS Plus subscription is the biggest change. The catalog seems nice enough to keep me occupied for quite some time, and the cheaper prices definitely encourage exploratory purchases.

Recommendation: Buy.


Selecting a strong password that’s easy to remember and hard to break

I use Clipperz as my online password manager, and it comes with an easy option to generate strong, secure passwords. I generate one for each site and forget about memorizing it, since that’s what a password manager’s job is. But there are some passwords I don’t put there, such as my bank’s and my laptop’s. I’ve come up with a simple and effective way to come up with a password that is both strong and easy to remember.

Here’s how it works: pick a song that’s currently ear-wormed its way into your head. For this example, I’m picking Queen’s Bohemian Rhapsody. Pick a few lines from the song, such as these:

Is this the real life?
Is this just fantasy?

Now take the first letter of each word in those lines: 


Since most websites insist on a mix of special characters and numbers, let’s add a comma after the first line, and a question mark at the end, just like in the song:


Now to get numbers, convert a few characters to l33t speak. I usually map A to 4, E to 3, I to 1, and O to 0.  Let’s also capitalize the ‘F’ in ‘fantasy‘ to add some strength to the password. That gives us:


And we’re done! You can make the password as long as you need it to be by adding subsequent lines, and strengthen it further with different combinations of easy-to-remember special characters in the right places. But the general principle remains the same. I tested that password out on https://howsecureismypassword.net/ and it said this:

It would take a desktop PC about 7 thousand years to crack your password

I usually hum the song along as I type the password, so it ties into muscle memory pretty soon. I don’t usually run out of good songs, so for the 2-3 passwords that I have to remember, this method works pretty well.

Java factorial program with recursion and BigIntegers

Another initiative at work expects me to have a certain amount of Java knowledge. Oh well. Here are some good resources I am currently going through:

Learneroo’s first chapter has a factorial method recursively. No biggie. I wrote a quick program, ran and tested it for small values. When I tried it for ‘100’, though:

Enter a number for which I will find the factorial:

Oops. The same program worked fine with Python, what was I doing wrong? A quick check showed that my program returned the result as an int. The highest Int you can get is 2^(31)-1. So, enter the BigInteger class. It is not a native data type and I had to tweak the program a bit to handle it. This is what it shows as the output now:

Enter a number for which I will find the factorial:

And here is the full program:

import java.math.BigInteger;
import java.util.Scanner;

public class Factorial {

    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
                .println(“Enter a number for which I will find the factorial:”);
        int num = read.nextInt();
        Factorial test = new Factorial();
        BigInteger result = test.findfact(num);

    public BigInteger findfact(int n) {
        if (n == 1) {
            return BigInteger.ONE;
        } else {
            return BigInteger.valueOf(n).multiply(findfact(n – 1));


Python for day-to-day tasks: the webbrowser module

An initiative at work requires me to analyze a large spreadsheet of data. One of the columns contains a csv-separated list of bugs that I need to take a look at. Normally, this would be a painful job of copying each defect and pasting it in the browser repeatedly. When hundreds of rows needed analysis, each involving multiple defect IDs,  I switched to python to ease my pain.

I knew where to look because of this cute easter-egg in python:

import antigravity

The help text for this module led me to the library, c:python33libantigravity.py in my case. The webbrowser module imported here showed how easy it is to launch a browser tab by passing a URL from python:

import webbrowser
import hashlib


This was all I need for my job as well. I wrote a 10 line script that basically:

  1. asked the user for input (in my case a comma separated list of defects),
  2. converted the input to a list and stripped unneeded whitespace,
  3. iterated through this list and appended the defect ID to the base URL, and
  4. called the webbrowser module to open the tabs.

The resulting script looks like this:

import webbrowser

bugs=input(‘Paste the list of bugs:n’)

for i,x in enumerate(buglist):

for i in buglist:

And that’s it! A half-dozen tabs open immediately and I can move on to analyzing them. Python has proved to be a boon in my daily job for quick and dirty scripts like this.

Heard joke once

Heard joke once:

Man goes to doctor.  Says he’s depressed.  Says life seems harsh and cruel.

Says he feels all alone in a threatening world where what lies ahead is vague and uncertain.

Doctor says “Treatment is simple.  Great clown Pagliacci is in town tonight.  Go and see him.  That should pick you up.”

Man bursts into tears.

Says “But, doctor…”

“…I am Pagliacci.”

Good joke.

Everybody laugh.

Roll on snare drum.


- Alan Moore, Watchmen.