Pow doesn’t work after upgrade to Yosemite

The last horse finally crosses the finish line.

Yes, I finally upgraded to Yosemite. Unfortunately, Pow didn’t take the upgrade kindly and decided to spew out a cryptic error message. Apparently there was an issue with Pow on Yosemite but had been fixed a while back. So, I reinstalled the latest version with a hope it would fix it but that didn’t fix it either.

The trick is to uninstall pow and then reinstall from scratch to be able to use it again on Yosemite.

Hope it helps.

Leave a comment

Javascript event loops demystified

Don’t understand what Javascript event loop is, then you need to watch the following video: http://vimeo.com/96425312

Totally clarified my remaining doubts on browser – javascript interaction and event loop.

Hope it helps.

Leave a comment

Chrome and the Web APIs

Browser is becoming better by the day and Chrome is at the forefront of this movement. There are a plethora of interesting Web APIs that will redefine the browser in the near future. It won’t be far wrong if we extended the Javascript prophecy to the browsers – ‘anything that can be done in a browser will be done in the browser in the future’, and it’s true to a large extent even now, i.e., Chromebook.

I recently came across Bluetooth API that landed in Chrome canary recently. It doesn’t do much right now, but, it’s a start. To see it in action:

1. I enabled the ‘Enable experimental web platform features’ in chrome://flags for my local Chrome canary installation
2. Restarted the browser
3. Connected the phone to the mac via bluetooth
4. Opened Chrome developer tools and ran the following command:

    function(d) {
       console.log('Found a device', d);
   function(e) {
      console.log('Exception', e);

5. It returned straight-away with the following output:

Found a device BluetoothDevice {instanceId: "E0:CB:EE:84:F7:C2"}

6. requestDevice() returns a promise and you can attach the appropriate resolve and reject callbacks with it.

That’s well and good, but what can I really do with this?

Just off the top of my head:

  • take a phone call on your computer
  • transfer data
  • transfer audio
  • …and lots more, in the future
Leave a comment

Coding exercise as part of interview process

Unless you are a superstar programmer, you are expected to do a coding exercise as part of interview process now days. I had a retired BBC journalist as a colleague at university. Very intelligent, focussed and an impeccable gentleman who could carry garish shirts in style. He gave me priceless advice on preparing my CV. He said, ‘CV is your chance to get to the interview stage, so, keep it to the point.’ You get the whole interview to impress the interviewer(s).

Why am I giving you tips on CV?

Because, the same idea can be applied to the coding exercises one does as part of the interview process. The coding exercise is a way for you to get a face-to-face interview. So, don’t stray away from the requirements. It’d be lovely to hear about how you will architect the system, but that’s not the point of the exercise. There’s absolutely no need to go over the required and miss the pivotal things in doing it. Produce what’s expected and you can impress them in the face-to-face interview.

Leave a comment

Books and Papers I read in 2014

Well, here’s a list of books and papers I read in 2014:

  • Are your lights on?
  • Pitching bible
  • Mixu’s Node book
  • RabbitMQ in Action
  • The Lean Entrepreneur
  • The Lean UX
  • The Lean Analytics
  • O’Reilly’s Graph database
  • SQL performance explained
  • The Cathedral and the bazaar
  • Frenetic: A Network Programming Language
  • HoneyBadger’s guide to machine learning
  • Things computer scientists don’t talk about
  • Mastering Node
  • Kanban and Scrum making the most of both
  • Scalable and Modular Architecture for CSS
  • Java Security Model and Bytecode Verification
  • Unix Shell in Ruby
  • Advanced Git Tutorial
  • Growth hacking handbook
  • Git Community Book
  • Git from the bottom up
  • Pragmatic Version Control Using Git
  • 50 Guerrilla Marketing tactics you should be using
  • 97 Things Every Software Architect Should Know
  • Thinking functionally in Ruby
  • Scalable networking
  • What Matters Now
  • Misunderstandings about state machines
  • Valve – Handbook for new employees
  • Mostly-Unsupervised Statistical Segmentation of Japanese Kanji Sequences
  • Static Aanalysis for Ruby in the presence of gradual typing
  • Where Stellar Messages Come From
  • Formatting and the Essentials of Web Writing
Leave a comment

IE11′s javascript engine doesn’t work correctly with promises

Yes, you read it right!

It doesn’t work correctly. Specifically, if you had an array of promises, then in IE 11 (and any other version), the promises will be worked on synchronously, and it will go through them one by one. In Firefox, and Chrome, it works as expected. The promises are resolved as and when they have finished processing and run independent of each other. Synchronous processing makes IE’s performance worst of all and in some cases, it just errors out. We spent quite a while on this issue, and had to resort to using callbacks in the end just to get it working in IE.

My suggestion for anyone working with the latest HTML5 API’s would be to start developing on IE. Browsers like Chrome have spoilt us developers, which makes it harder and at times, frustrating to put in workarounds for IE.

Leave a comment

Update NVM to latest version

A very quick post as a reminder to self. Running the install script for nvm like this will update nvm if it’s installed already.

curl https://raw.githubusercontent.com/creationix/nvm/v0.18.0/install.sh | bash

I had to trawl through few links to find this solution and don’t forget to change the version number in the command.

Tagged , | Leave a comment

Adding changes selectively with Git

Here’s a scenario for you developers:

1. You are happily hacking on a feature from the beach.
2. But, someone on your team is waiting for your changes to go in because they need few methods on a class you will add as part of your changes.
3. You have written those methods but the whole functionality still needs work so you can’t commit it in.
4. You don’t want the other members of team to wait since time is money.
6. They could work of your branch but that would mean their work will now wait for your work to go in first.
5. Or you just selectively add a couple of methods you have written in the class for them to use.
6. But, is there a way to selectively add and commit files in git?

Yes, you can with git’s interactively adding a file feature. Below is a better explanation of the same feature with a little scenario:

1. Imagine I have a git repository with one file called first.txt. The file’s contents already committed to remote repository are something like:
Screenshot 1

2. I am working through this file and update the contents to something like:
Screenshot 2

3. Now, I only want to commit the last two three lines of this code. I have two options, either, I cut all except last 3 lines that I’ve added since the last commit and check it in and then paste the lines I cut back into this file. That could work, but, imagine, if you have to do the same across 3-4 files. Not very efficient, is it?

4. Or you could use the interactive tag for the git’s add command. We will take the same file (I’ve been talking about) as an example and try to add and commit only the last 3 lines of this file.

5. On running the following in a working directory

git add -i

you will see a menu with a list of files and commands one can run on the file.

Screenshot 3

6. Since, we would like to add only some selected lines we need to enter p(which stands for patch). This will drop you into a patch submenu like the one below. In the patch submenu, you will be able to select the file that you would like to patch. In this case, the letter ‘f’ is the cue for it. Entering ‘f’ on this submenu and returning will show the same menu again, but this time, you will see that there’s a ‘*’ next to the file number on the left. In this case ’1′ became ‘*1′.

Screenshot 4

7. After the file selection has been made, pressing enter at patch update prompt will drop you into the file, like the screenshot below. You can see the lines that have been added since the last commit. At the bottom, you can seen a set of commands that can be run at this stage. You can see the explanation of these commands by typing ‘?’ and pressing enter.

Screenshot 6

8. Since, I’d like to only add the last 3 lines, I would type ‘e’ and press enter. ‘e’ stands for manual editing. This will open up the same file in your default editor. Usually, that’s determined by $EDITOR environment variable.

9. After editing and saving the file, I will be returned to the first menu again. Type ‘s’ and press enter to check the status of the files in the working directory. The status shows that 3 lines have been staged and there are still 7 unstaged lines remaining for file first.txt which is what we set out to achieve.

Screenshot 7

There are a lot of other commands in the menu that shows up on git add’s interactive tag and please feel free to explore them in your own time. It seems like a bit long-winded when you do it the first time, but after a few times it feels very straightforward and easy.

Hope it helps.

Tagged , | Leave a comment

File’s life through Git

I realised a few months ago that I should read more books. I have a ton of them. I could never read all of them unless I start now and that’s exactly what I did. The first one I ended up reading was a short book on git. It was quite basic except a couple of striking things. One of them is this image I found on a blog that clearly and closely depicts the journey a file may take travelling from your working directory to the destination repository.

File's life through Git

Any seasoned Git user will know this by heart, but, it is still a very concise and nice representation of git’s transport commands and the actual journey. By the way, Index is also known as Staging, just in case you get confused with terminology on Google.

I hope it helps new git users to get used to the process and the various stages.

Tagged | Leave a comment

Is character ‘g’ in UUID valid?

Did you know UUID has a very detailed specification? Well, if you did, good for you, if you didn’t, it’s okay, you can read it now.

For some reason, I always thought UUID (or GUID) is a random collection of numbers and characters and randomness guarantees uniqueness. I was pretty sure about the randomness but wasn’t sure that presence of character ‘g’ makes it invalid.

Let’s look at UUID’s definition. UUID is in fact a random 128 bit number and it’s represented using hexadecimal numbers for the sake of readability. Now, let me ask you the same question again:

Is character ‘g’ in UUID valid?

Ofcourse, it’s not valid!


Because hexadecimal digits don’t include ‘g’. Therefore, a valid UUID should always match:


So, presence of ‘g’ in UUID means that UUID specification has not been implemented correctly in the programming language.

Leave a comment