A hideous bug

Just lost a few hours of my life over this so I figured it will be a good thing to perpetuate a relatively distilled form of the problem in hopes that in the future, it will prevent me from repeating it. The problem const fs = require('fs') var callbackCalled = 0 readFile('package.json', function(err, data) { callbackCalled++ console.log(callbackCalled) if (err) { return console.error(err) } throw new Error('something went wrong in this function') }) function readFile(file, callback) { fs. »

Looks can be deceiving

lexic order !== numeric order (dah!) Don't do this: var level = require('levelup') var db = level('db') db.put(Date.now(), 'somevalue1') db.put(Date.now(), 'somevalue2') or this: var level = require('levelup') var db = level('db') var counter = 0 db.put(counter++, 'somevalue1') db.put(counter++, 'somevalue2') If you care about order of iteration being related to the context of the keys. I know I did... and a quick search on github demonstrates I'm not the only one too. Your »

Automate NW.js UI testing

NW.js, previously known as node-webkit is a technology that enables a whole new way of writing desktop applications using web technologies. If you are not familier with it, I strongly suggest you get acquainted, and after you do, get back to this post. Recently I ran into this nifty module called chrome-remote-interface, a Remote Debugging Protocol interface to instrument Chrome. Quite a few of the products we develop at ironSource are based on NW.js (which is based on »

New version for node-regedit

After a very very long coding session a new release for node-regedit (v2.0.0 !!!) is out. Per the 80-20 rule, 80% of the work was fun and quick. The remaining 20% was a gory nightmare spanning several days and composed of issues in unicode characters conversion between processes, codepage difference between shell and console and other super boring stuff I won't even go into because I'm trying to erase it all from my own memory. Here is a summary »

Back to blogging

Its been several years since I actively blogged (last post at august 2011) and I feel the urge to get back to that old habit. Since the days of the old blog and during my haitus some things have changed. Back then, I was coding in Java, .NET and Javascript (just client side js). Nowadays its javascript all over the place (node.js) with small drops of c++ every now and then. I used to be a wild freelancer ninja »