Another comic - 2

19 October, 2014

I am getting better at this, still nowhere near to being any good.

I should buy a tablet to draw more sketches and be able to edit them with GIMP. Anyone willing to contribute?

Anyway, here it is:


Seriously? Is this how you make captchas?

11 October, 2014

So, I have been around Indian Railways website for some time now, mostly checking my PNR status repeatedly.

Guess what? The PNR enquiry form at has a captcha that is pure text embedded in a span.

If you said WTF!, my reaction was not very different.


Someone can easily write a script that fills the captcha and make gazillions of requests leading to a DDoS attack.


I wrote a worried email to CRIS, the agency that maintains the website, though. Hopefully, this gets resolved soon.

Another comic

28 September, 2014

Better than previous one, still, needs a lot of work to reach any acceptable level. <determined face>


Nibbleblog Techie theme edit

31 August, 2014

I recently happened to change my blog's theme and something didn't feel quite right.

The sidebar which pops out when you click the burger-like undefined button will not disappear if you clicked outside of it. That looked odd, considering that the default sidebar size is quite large and covers a lot of the screen.

Thanks to Diego Najar Nibbleblog is Open-source, and anyone can contribute for its betterment. So I did.

The most challenging part to accomplish this was to prevent event bubbling from a DOM element to its parent. Event bubbling means that if a mouse event, like click, hover and others is registered to a DOM element, it will bubble out of that element, and execute the event handlers for that event on the parent elements or the window element if they have one registered.

This event bubbling caused things to break. Upon clicking over the burger-like* button, the click would try to make the sidebar pop out, and the click event will bubble out and cause the sidebar to pop back in because I tried to keep an event handler on the window element (the parent of all.) This happened so fast that the transition animations had no time to complete and it seemed like nothing worked.

For understanding event bubbling, consider this HTML code:

<div id="div-parent">
	<div id="div-child">

If it so happens that both div-parent and div-child have a mouse click event registered to them,

var divParent = document.getElementById('div-parent'),
    divChild = document.getElementById('div-child');

divParent.addEventListener('click', function() {
	// do something
}, false);

divChild.addEventListener('click', function() {
	// do something else
}, false);

then upon clicking the div-child, something else and something, both will be done.

This may seem like a very bad behaviour, but is a very good fallback in case things break.

Fortunately, the folks at W3C have it considered and provided us with a preventive measure. If the above code is modified to:

divChild.addEventListener('click', function(e) {
	// do something else
	// e is the event
}, false);

the event no longer bubbles out of div-child and we are good to proceed.

So I applied the fix and pushed it. Within 2 hours, it got merged! That is fast.

Sidebar now disappears when clicked outside · 3bf4189 · dignajar/nibbleblog


* - I was hungry, alright?

The first comic I ever drew

31 August, 2014

Well, I am not a comic artist, and far from being any good at drawing, but there arose some strange circumstances where I needed to draw one.

Here it is:


Drawn on a Chocolate wrap, it went worse than I expected. Still better than all my previous endeavours.

As you might have guessed by now, it did not serve the purpose it was meant for. [Sighs]

Mozilla, I owe you an apology

29 August, 2014

All kinds of people in this world can be broadly classified into two categories.

And I unconditionally choose to be the second kind. Always. This time, the categories were not-assholes and the others.


Not everyone gets a chance to be selected for Google Summer of Code, and if you do get selected, you work hard to pass it. Well, I turned out to flunk it. It is not a very bad thing altogether as I now have an impetus to curb my procrastinating habits.


Enough of random talk already. Lets come to the point.

I have pushed sufficient code that just works and provides pretty decent suggestions. This is the commit: gargsms/gaia - GitHub

For those who are not going to read, here is a small list of tasks the scripts do:

  • We add a word not present in the static dictionary file, and update their frequency if the user types them over and over making them get precedence in suggestions,
  • We spawn a new thread that checks for words with the nearby keys of the individual letters typed, and return them with their weights if found,
    • For example, consider the input is 'hj', we look into our new database for 'hj', 'gj', 'jj', 'tj', 'hh', 'hk', 'hu' as the nearby keys to 'h' and 'j' are 'g', 'j', 't' and 'h', 'k', 'u' respectively
    • We have limited our number of nearby keys to consider at 3 for better response
  • We seek suggestions from both the dictionaries individually and combine them based on their weights,
  • Bingo!

Here I attach a few screen-shots of the working code:

'Mithai' is a Hindi word meaning sweets. It did not yield any suggestions before it was added into the database:


Once it is in the database, as soon as we type 'm', this happens:


Yay! Sweets.


Few things still remain:

  1. allow numbers to be typed inline. Currently suggestions disappear if you type a number,
  2. add a Settings entry to enable or disable this feature,
  3. add support for keyboard layouts other than QWERTY which we support at the moment,
  4. option to export or import the saved dictionary.
← Older posts