8 May 2013, 6:37pm
Work:
by

leave a comment

  • How To Incorrectly Track The Progress Of A Project

    The next time a manager asks you the percentage progress of a task, make sure you reply with a float rounded to 2 decimal places, and say it with full confidence.

    Sometime in mid 2000s, the manager of a project I was working on had to take an emergency leave, so another manager filled in for him. It was an agile project, but somehow this other manager managed to come up with a magical Gantt chart for the rest of the project. The project was waterfalled!

    The task in question was titled “Create HTML”, a bucket task to dump all UI related tasks from the look of it. Unfortunately I didn’t have the guts to answer with 83.62% back then, and I replied with a magical whole number divisible by 10 instead.

    I know that there are still people believing in waterfall methodology to this day (yes, in 2013, believe it or not), and if it works for them, good on them. But whatever the methodology is, asking for a percentage is not going to give you the right idea of how the project is actually progressing.

    It makes a good practice for generating magic numbers in your head though :).

    7 May 2013, 12:10am
    Projects:
    by

    leave a comment

  • Voice-Controlled Lamp Using Ninja Blocks + MacBook

    Here’s a video of my latest quick weekend hack, using voice to switch a lamp on and off:

    Ok, so it’s actually a combination of Watts Clever + Ninja Blocks + Node.js + Automator + Speakable Items. Speakable Items takes the voice commands via MacBook’s internal microphone, then calls the Automator applications, which then runs a Node.js script (which output gets spoken by Automator applications), which then tells Ninja Blocks to actuate Watts Clever power socket.

    Here’s how I set it up:

    Configure Watts Clever remote RF signals on Ninja Blocks dashboard (/hattip: @james and @Jeremy over at the forum).

    Create this simple Node.js script file. I saved it as rf433.js .

    var ninjaBlocks = require('ninja-blocks'),
      app = ninjaBlocks.app({
        user_access_token: 'your-ninjablocks-token'
      });
    
    app.devices({ device_type: 'rf433' }, function (err, devices) {
      var subDevices = app.utils.findSubDevice({ shortName: process.argv[2] }, devices);
      console.log('Switching ' + name);
      Object.keys(subDevices).forEach(function (key) {
        var subDevice = subDevices[key];
        app.device(subDevice.guid).actuate(subDevice.data)
      });
    });
    

    Create two Automator applications, one called ‘Lamp on’, the other ‘Lamp off’, each containing:

    • Run Shell Script, which is used to run rf433.js .
    • Speak Text, which is used to notify when device#actuate is about to be called (that’s the console.log('Switching ' + name); line from the above Node.js script).

    These applications must be available from ~/Library/Speech/Speakable Items/ .

    Configure the Mac’s System Preferences -> Accessibility -> Speakable Items on Lion and Mountain Lion, or System Preferences -> Speech on Snow Leopard.

    Done.

    Overall, this is just an experiment to prove that it can be done. Speakable Items is obviously _not_ Siri, so you can’t expect the same quality of speech recognition. And having to open a MacBook every time I want to use this is obviously too troublesome.

    It would be awesome for Ninja Blocks to have / work with something like Ubi. Every home automation solution needs at least a voice or gesture based input mechanism :).

    Note to self: I’m totally looking forward to the future where every single thing in the house is powered by renewable energy-based wireless electricity, each running a tiny low-powered Node.js server which talks to one another via HTTP. Life would be much more efficient!

    8 Apr 2013, 12:37pm
    Projects:
    by

    2 comments

  • Jenkins Build Status On Ninja Blocks RGB LED

    Nestor v0.1.2 is out and one of its new features is nestor ninja for monitoring Jenkins and displaying the latest build status on Ninja Blocks RGB LED device (if you have a block, it’s the ninja’s eyes).

    Here’s a usage example:
    export JENKINS_URL=<url>
    export NINJABLOCKS_TOKEN=<token_from_https://a.ninja.is/hacking>
    nestor ninja

    Red for build failure, green for build success, yellow for build warning, and white for unknown status. The yellow light looks quite similar to green, and the white one does look blue-ish.

    And the best place to run nestor ninja? On the block itself of course!

    ssh ubuntu@ninjablock.local
    apt-get install upstart
    npm install -g nestor
    cat /usr/lib/node_modules/nestor/conf/ninja_upstart.conf > /etc/init/nestor_ninja.conf
    vi /etc/init/nestor_ninja.conf # and change JENKINS_URL and NINJABLOCKS_TOKEN values
    shutdown -r now

    Log messages will then be written to /var/log/nestor_ninja.log

    23 Mar 2013, 6:03pm
    Etc:
    by

    1 comment

  • Akio Morita On Management

    For the past few weeks, I’ve been reading Made In Japan, a story about Akio Morita‘s life and the first three decades since the founding of Sony Corporation.

    I haven’t finished this book, but the last chapter titled ‘On Management’ was very interesting and it struck a chord with me. I’ve seen enough management decisions that were short sighted and proven to be wrong in the long run, throughout the 12 years I’ve been in the industry, and some of them could’ve been avoided or at least improved had the people behind them had better insights. I think everyone can learn a thing or two from these quotes…

    I

    pg 144
    The most important mission for a Japanese manager is to develop a healthy relationship within the corporation, a feeling that employees and managers share the same fate.
    pg 153
    What we in industry learned in dealing with people is that people do not work just for money and that if you’re trying to motivate, money is not the most effective tool. To motivate people, you must bring them into the family and treat them like respected members of it.
    pg 158
    In the Japanese case, the business does not start out with the entrepreneur organizing his company using the worker as a tool. He starts a company and he hires personnel to realize his idea, but once he hires employees he must regard them as colleagues or helpers, not as tools for making profits.
    pg 158
    The investor and the employee are in the same position, but sometimes the employee is more important, because he will be there a long time whereas an investor will often get in and out on a whim in order to make a profit.
    pg 162
    At our company we are challenged to bring our ideas out into the open. If they clash with others, so much the better, because out of it may come something good at a higher level.
    pg 163
    If you and I had exactly the same ideas on all subjects, it would not be necessary for both of us to be in this company and receive a salary. Either you or I should resign in that case. It is precisely because you and I have different ideas that this company will run a smaller risk of making mistakes.

    II

    pg 165
    Who could tell us better how to structure the work more than the people who are doing it?
    pg 167
    Go ahead and do what you think is right. If you make a mistake, you will learn from it. Just don’t make the same mistake twice.
    pg 168
    In Western countries, management lays off workers when a recession sets in. In Japan we just do not do that unless we have been brought to the direst point.
    pg 170
    And when a company is in trouble, it is the top management who take salary cuts before the lower-level employees.
    pg 171
    Despite the work of the Harvard Business School and others, and the increasing number of holders of advanced degrees in business administration, management is an elusive thing that cannot always be judged by next quarter’s bottom line. Management can look good on the bottom line but at the same time may be destroying the company by failing to invest in the future.
    pg 171
    To my mind, the performance of a manager is measured by how well that manager can organize a large number of people and how effectively he or she can get the highest performance from each of the individuals and blend them into a coordinated performance.
    pg 173
    In my view, profit doesn’t have to be so high, because in Japanese companies our shareholders do not clamor for immediate returns; rather they prefer long-term growth and appreciation. Of course we have to make a profit, but we have to make a profit over the long haul, not just the short term, and that means we must keep investing in research and development.
    pg 174
    I learned that an enemy of this innovation could be your own sales organization, if it has too much power, because very often these organizations discourage innovation.
    pg 174
    If you are nothing but profit-conscious, you cannot see the opportunities ahead. And where compensation is tied to profits, very often management will say, “Why should I sacrifice my own profits today for the guy who is going to follow me a few years from now?” Too often management will abandon work on a promising product because development costs seem to high. That can be short-sighted and can lead to the inability of a company to compete.

    III

    pg 186
    People who are running a business ought to know their business very well. If the accountant had been in charge of our little company in 1946, our company would be a small operation making parts for the giants. Likewise, someone who is only a scientist is not always the best person to have at the helm.
    pg 187
    Whether the design, the technology, the merchandising, or the promotion was bad, the failure was a failure of management.
    pg 187
    Managers who do not have the capability to judge from a technical standpoint whether a product is feasible or not are at a tremendous disadvantage. I have always felt that the idea that professional managers can move from one industry to another is dangerous. Even being in the business and being knowledgeable about it is no guarantee that all the possible opportunities will be exploited and that mistakes will not be made.
    pg 188
    It is possible to have a good idea, a fine invention, but still miss the boat, so product planning, which means deciding how to use technology in a given product, demands creativity. Only with these three kinds of creativity — technology, product planning, and marketing — can the public receive the benefit of a new technology. And without an organization that can work together, sometimes over a very long period, it is difficult to see new projects to fruition.

    The above came only from one chapter of the book, the rest of it was even more fascinating, the story of his childhood, the second World War, the people behind Sony, the technical and business sides of their product development, and the comparison between Japanese and Western philosophies.

    I picked up this book after learning from Steve Jobs biography that both Akio Morita and Sony were inspirations to Steve and many people at Apple, I was curious, and now I understand why the legend is such an inspiration.

    Note: If you’re a geek interested in reading the book, please also note that it contains lots of chapters on business and management.

    16 Mar 2013, 4:04pm
    Work:
    by

    leave a comment

  • Private NPM Registry Replicator Document

    For my future reference and to help others trying to set up a private NPM registry which sits behind a [corporate] proxy and requires authenticated CouchDB admin access, here’s the replicator document that I ended up using:

    {
       "_id": "registry",
       "source": "http://isaacs.iriscouch.com/registry/",
       "target": "registry",
       "user_ctx": {
           "name": "myadmin_username",
           "roles": ["_admin"]
       },
       "continuous": true,
       "owner": "myadmin_username",
       "proxy": "http://proxy:8080"
    }
    

    For those who are not familiar with CouchDB, the above is a document that needs to be created in _replicator database, so that the replication rule from public NPM registry to your private NPM registry can be persisted and runs continuously.

    The key here is the user_ctx, owner, continuous, and proxy settings, which after several trials and errors, I managed to get them right with several clean full replication runs (always monitor CouchDB log during replication!).

    Have a look at CouchDB Replication wiki page and this gist on the new replicator database (introduced in CouchDB v1.2.0) for explanation on those fields and how CouchDB replication works.

    Tip:

    If you tried to be smart by copying the design documents from the public NPM registry to your private NPM registry before replicating the documents, you would see some errors in CouchDB log file due to some rules in the latest design document that would fail the older documents. For example: module name must be in lower case, but there are old modules with name containing upper case letter(s).

    My suggestion is to start from empty registry and public_users databases, then kick off the replication, and refresh the indices nearing the end of the replication, followed by compacting the databases and views to save some disk space.

    Tip 2:

    Public NPM registry sets require_valid_user = false in its CouchDB configuration file, which allows database read access without CouchDB admin authentication. If you set require_valid_user = true instead, then CouchDB will require authentication when you fetch any module (a document from CouchDB’s point of view). Unfortunately, as of NPM v1.2.15, there’s no authentication info on its fetch request, so you might find this monkey patch and this issue handy.

    Tip 3:

    And if you want to make the private NPM registry available over SSL:

    1. Generate self-signed SSL certificate
    2. Enable SSL on CouchDB via local.ini configurations
    3. Configure registry URL in .npmrc file to use https://
    4. npm install

    If you get DEPTH_ZERO_SELF_SIGNED_CERT error, you might want to check this issue for workarounds.
    If you’re connecting via a proxy, you might get ‘tunneling socket could not be established, cause=Parse Error’ error.

    Recent Posts

    Recent Comments

    • Ddroberliga.De: If you are having a baby, Aetna Family Health Insurance Company has interactive tools to help you...
    • Alicia: Hello Emma, Hello…, I read your message and wanted to help you, because I have been in Siem Reap a lot of...
    • Alphonse Gallegoz: Psy likened the Gangnam District to Beverly Hills, California, and said in an interview that he...
    • Hans: Your snippets have inspired me to go out and buy a copy. I hope it lives up to the quality quotes you’ve...
    • abu: bakmi gm is the most famous restaurant in indonesia especialy noodles..nice and you must try..

    Most Commented Posts

    Linkroll