Sunday, January 18, 2015

New Blog Home

Just FYI: a few months ago I moved my blog to https://blog.such.computer. Sorry for not having posted this notice before =(

Sunday, February 9, 2014

The Wild West Needs Order

Without beating around the bush, if the world of crypto currencies is to stay for the long term there needs to be a shift in the community toward an even, fair playing field and a concerted effort to fringe the malicious and the ill-willing. In my opinion, this thriving "shadow" economic world needs the following changes, in no particular order:

  • A complete security audit of all the tools needed to mine, trade and exchange crypto currencies. From the OS, mining software, GPU drivers, exchanges, etc. Currently the vast majority of participants are trusting in the good will of the people who develop and maintain these tools, but there's nothing to say that the linux distribution we are using doesn't have a backhole or a trojan. Same goes for mining software, wallets, etc. 
  • An exchange network infrastructure. Currently all exchanges are disconnected and often prices completely out of sync. This allows for people with time and resources to exploit the price difference to their advantage.
  • Faster way to confirm transactions. One of the theoretical advantages of crypto currencies is the minimal cost of transaction. However, this point is moot if it takes the network hours to confirm the transaction -- depending on the currency.
  • Developers need to have a "covenant" with the community assuring the following:
    • Zero changes that affect the coin after coin public release. 
    • Only bug fixes and maintenance to wallets.
    • Will not act as central banks and make monetary decisions after coin public release.
    • Will at least stick around for 6 months after coin public release.
    • Will make sure ALL required parts to use the coin are working before public release (i.e. wallets, miners, strata, etc.)
  • A volunteer-based arbitrage board to resolve issues that arise between exchanges and their customers. 
If the issues above are addressed, the world of crypto currencies will attain wide acceptance and increased legitimacy with the "mainstream" economies. Until that happens, crypto currencies will keep being seen as a monopoly economy mainly used for illegal activities.

Sunday, September 29, 2013

ChoreMonster: It Works.

If you believe in the parenting philosophy of "Reward for Effort", especially when it comes to house chores, then ChoreMonster.com is a web service you should consider. It currently is advertising-free with premium subscription options. You can use the service for free indefinitely, all the premium subscription gives you is extra virtual "rewards" for your kids. The service is divided in two main sections, one for parents and one for kids. The parents section has all the tools needed to create chores and rewards list as well as tracking and approval thereof, all in a very intuitive fashion. The kids section includes the list of chores, the choice of rewards, and, the premium-only section of monster carnival mini-game where kids can trade earned tickets for a chance to "unlock" new monsters. The customer service is top notch and very prompt, in our experience.

It has worked fantastically in our family. Our oldest kid is totally into it, almost not caring what the rewards are, but just the sense of accomplishment and the chance to unlock monsters provides him with more than enough motivation to not only do his chores, but make sure he does them correctly (the parent has to approve each chore marked as complete). The parenting section also has something for numbers-oriented parents as well: chore tracking and velocity (i.e. you can see how many chores/day or points/day your kid is burning through) so you could determine and project forward your kid's baseline effort.

All in all, I highly recommend using the service and if you find it useful, purchase a premium subscription. And just to be clear, I'm no way associated with them. I don't know anyone who works there and I have nothing to gain or lose. I just think it's a great service and deserves patronage.

Wednesday, September 4, 2013

For Schema Migrations Use App Engine Task Queue instead of Backends

Every application under iterative development, eventually is going to need a schema migration of some sort. In our case, we needed key/id field re-alignment as well as adding new common fields to all our models that needed to be populated. Given that even the most innocuous of migrations will probably take longer than the maximum time allowed by an HTTP request, our inclination was to resort to a GAE backend to do the hard work in the background independent of the HTTP requests deadlines. The problem with GAE backends is two-fold: the setup overhead and the dismal documentation and examples that the App Engine team provides -- although, to be fair, the former is exacerbated by the latter. 

Backends have their own .yaml config file with several options that are not entirely clear and what side effect (if any) they have. The documentation for the backends.yaml is here and as you can see chasing down the different choices for a given option can feel like going down the rabbit hole. To make matters worse, you have to "wire" your app's app.yaml with backend.yaml and figure out how they differ and what is their role with respect to backends. Yet another issue that is not entirely clear is how to kick off a backend instance, assuming of course that you have all the pieces in the right place. The docs, again, are dismal, in my opinion. One passage mentions /_ah/start as the way to kick start your backends; however, the docs also mention that a 404 HTTP error code is considered a success. Since there isn't a way to see whether the backend is doing anything or not, is outright confusing to consider a 404 a success. Eventually, after much searching, I came across a way to get the process going via a front-end request; unfortunately this ties the backend to the fron-end deadlines.

As I was about to /flipdesk, I walked through the dark caverns of App Engine's news group, I bumped into a post about best practices for schema migrations. The post mentioned this article posted on Dec, 2012 that lo-and-behold precisely addresses the issues at hand. While it seemed trivial to copy-pasta, I knew this would not apply to our app since we use App Engine's nbd datastore abstraction module. Fortunately, someone put the time to write a ext.db -> ext.ndb cheatsheet that made matters a lot easier. After moving things around a bit and switching the syntax to ndb and adding couple simple lines to app.yaml, I fired up my local dev server and tried it. It worked from the get go. I pushed to our staging server on App Engine's infrastructure, which contains ~40K records. Fired the process up and some ten minutes later, the migration was complete. The best part, I could see its progress and logs thereof through the admin console even how deep the Task Queue was and what task was next in line.

In all, setting up, changing code and testing schema migration thought Task Queue took roughly 1/5th the time I had thus far invested on getting this process running under a backend. So, my recommendation based on my experience is to avoid using backends unless you absolutely have to and instead leverage Task Queue for all other asynchronous/long-running processes.

Wednesday, June 12, 2013

Getting Started With Node.js Modules and npm (for developers)

In spite of node.js' wild popularity, finding good informative docs and tutorials as to how to develop and distribute apps for the platform can be a chore. Google searches on the matter tend to return either out-of-date or end-user results. So, as a service to the community and for my own edification, I'm going to show you how to get started developing node.js and packaging with npm.

This tutorial assumes you have node.js version 0.8.1+ as well as npm version 1.2.18+ properly installed. It further assumes working on a POSIX-ish environment. Also assumed is that the reader has at least passing knowledge of JavaScript.


"Hello Google"

In order to better illustrate the steps, we are going to develop a super trivial app that will send a search query to google, retrieve the results in json format and then print the results to the screen. So, let's get moving:

1. Let's create a directory and cd into it:

   $ mkdir hello-google && cd $_

2. Now the crucial step to get your node module started:

   $ npm init

This will create a file named package.json which should look something like this:

{
  "name": "hello-google",
  "version": "0.0.1",
  "description": "A trivial app to illustrate node.js dev",
  "main": "main.js",
  "scripts": {
    "test": ""
  },
  "dependencies": {
    },
  "repository": "",
  "author": "Ruben Orduz",
  "license": "MIT"
}

3. Install request module (easier to use than the default http client):

   $ npm install request

4. Let's add request to the list of dependencies in package.json:

{
  "name": "hello-google",
  "version": "0.0.1",
  "description": "A trivial app to illustrate node.js dev",
  "main": "main.js",
  "scripts": {
    "test": ""
  },
  "dependencies": {
    "request": ""
    },
  "repository": "",
  "author": "Ruben Orduz",
  "license": "MIT"
}

5. Let's create main.js and write some code (you can use your text editor of choice in place of 'open'):

   $ touch main.js && open $_

6. Now copy and paste the following code in main.js:

7. Now, let's test everything is working (assuming you are inside hello-google directory):

   $ cd ..
   $ node hello-google/

In a few seconds, you should see something along the lines of:

   PRISM (surveillanc -> http://en.wikipedia.org/w

   Nine Companies Tied to http://www.usnews.com/new

   What Is PRISM? - G -> http://gizmodo.com/what-i

   NSA slides explain the http://www.washingtonpost

8. If you have never submitted any packages to npm before, you must register with the following command:

   $ npm adduser

it will prompt you some questions and within seconds you will have your user and machine authorized to publish to npm's public servers. 

9. Once you are 100% ready that you want to publish a module for public consumption, you can run the following command:

   $ npm publish

10. To make sure your module can be installed and run:

   $ npm install hello-google

11. Let's test it through node:

   $ echo "r = require('hello-google');" > test.js && node test.js

Note that the name the module will be published as it's not the name of the directory, it's the name declared in the package.json

Saturday, May 18, 2013

Can you hear me Major Tom? Chris Hadfield's Impact on Space Exploration

Earlier this week, International Space Station resident Commander Chris Hadfield, a Canadian citizen, came back to earth, but not without first creating a series of defining moments for modern space exploration. It was not because what he discovered while in his six month stay, but because he did what not many astronauts had done before: he made the ISS accessible to everyone, from the comfort of our earthly dwellings. He did a social media blitz of sorts. He would post daily pictures of fly-bys across the globe, short videos demoing how things we do on earth differ in space: how flame burns without gravity, how crying looks like in near-zero-G, how they sleep, how they use the bathroom, how they keep in shape and so forth. He did several social media live Q&A events, including a reddit AMA a few months ago.

With millions of followers across the major social media outlets, Chris Hadfield (and a small pre- and post-production team on earth), released his grand finalé, his Opus Major, if you will: a cover of David Bowie's Space Oddity, filmed and performed by Hadfield himself aboard the ISS.



To date, more than 13,500,000 unique viewers have watched the amazing video Hadfield and co. put together. And I sure hope, for the sake of awareness and education that the video continues to spread like a wildfire in a hay farm.

My description of the video, as I previously posted on Google+, goes as follows:

I don't think a music video has moved me so much as Commander +Chris Hadfield 's cover of +David Bowie 's Space Odddity. I've watched it no less than 6 or 7 times since it was first released. It really is perfect, insofar as transporting you there without actually being there. The conflict between sheer beauty of earthly backdrops with the desolate, sterile blackness of space. The human desire to reach and live in space, away from earth, in a parallel dimension unbound from gravity and other quotidian earth-bound forces. The conflicting feelings of enjoying the moment on the station while fully aware the clock is ticking and finally the bittersweet realization that time has come to re-join the human race.

Now, what really matters though, is Commander Hadfield's impact on public and political perception of space exploration. If his sharing his experience with millions on a daily basis persuaded the constituency and politicians that space exploration is a worthy expense, that it's not just for the multi-millionaire elite, or for the erudite, that tangible benefits can be drawn from the mere fact of being in space for extended periods of time, then Chris Hadfield's efforts will not be for naught. The U.S. space program is currently in a fairly poor shape, and I hope what Commander Hadfield has done is the right medicine needed to revivify it.

Saturday, March 23, 2013

PyCon 2013: an exhaustive, painfully comprehensive, encyclopedic, unabridged review

Just kidding. I'm going to make it short and sweet.

PyCon was the best tech conference I've been to. The sense of community that permeated the conference is simply bar none. The emphasis on helping out/charity/education like no other tech conference out there. The sponsor-organized after-parties were a blast and by in large, the talks and tutorials were of great value. As a relatively newcomer to Python, the conference was simply a resounding success, specially when you consider the shoestring budget it runs on and that it is organized and run by small contingent of community volunteers. PyLadies, a women's pythonistas outreach organization, was in large part to thank for a rather sizable female attendance to the conference (about twenty percent). Overall, while it's entirely too early to think about Montreal next year, I'm hoping I'll be able to not only attend but also help the community and organizers in whatever extent I can.

But, I don't want to bore you any further, so below are two links. One is to see the slideshows of the sessions, the other one is to watch the videos of the sessions. Enjoy.

Slides: https://speakerdeck.com/pyconslides/
Videos: http://pyvideo.org/category/33/pycon-us-2013