Angel \”Java\” Lopez on Blog

April 17, 2014

Dynamic Applications in Node.js

Filed under: JavaScript, MyApps, NodeJs, Open Source Projects, Video — ajlopez @ 6:55 pm

Last year I participated in the competition Node.js Knockout organized by Nodejitsu. Working alone, in the Solo Ninja team, I was coding two days in a weekend. My project, largely written using the TDD flow, aims to define one or more online applications. An application can have one or more lists of entities. Each entity can have properties defined interactively. I should add one to many relations between entities.

You can see the video presentation of my work to the judges:

After the competition, I moved my code into my GitHub account:

I found interesting to dynamically define an application, rather than write it or generate code from a model. JavaScript and Node.js is a dynamic duo that helped me to implement this type of applications. My goal is to extend the ideas in order to have a simple implementation of what could be armed with Force, Salesforce. Some ideas:

- Add programming tasks (written in controlled JavaScript)
- More viewers (for web and mobile)
- Public and private application store
- Deploy an application written by others

In recent weeks I’ve been studying SharePoint Online. Now, I have new ideas for implement an Application Store for dynamic applications.

More fun is coming!

Keep tuned!

Angel “Java” Lopez

April 9, 2014

End Of Iteration 2014w14

Previous Post
Next Post

Code Generation

I updated my template engine in JavaScript, with a minor change to skip new lines in some contexts:

Then I consumed the new version in AjGenesis for Node:

I published the first version of my Sinatra code generation tasks and templates:

The simple generated site can manage list of entities, persisted using sqlite3 and data-mapper.

I removed bower from my Express code generation tasks and templates:

because I think it is more clear to have directly the assets in the repository, instead of installing via bower.

And I updated my Php tasks and templates:

so now it is using a first page with Bootstrap.


I wrote a simple library to support complex number operations in JavaScript

As usual, I wrote the code using TDD workflow. You can check the commit history.

Learning Node.js

I updated my

with a simple sample of a web server. I recorded a Google Hangout (see Spanish post)


Additionally, I started new code kata in JavaScript,

I did a minor internal refactor in ScalaSharp my Scala interpreter in C#.

I added a do operation to my simple asynchronous library. The do operation launch a “parallel” function. You can chain do operations, to launch more than one operation. The next then or map operation will receive the result of the do operations as elements in an array, after full completion of the “launched” functions. Usually, those functions perform asynchronous calls.

I was working in two non-public projects, too.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

April 3, 2014

New Month’s Resolutions: April 2014

Review of my March’s resolutions:

- Work on DictSharp [complete] see repo
- Give talk about Node.js Distributed Applications [complete] see repo see online slides
- Improve SimpleGammon [complete] see repo
- Improve Annalisa [complete] see repo
- Add @for to Templie [pending]
- Work on PreciosaAnnalisa online web services [complete] see repo
- Improve my Node.js Distributes Applications samples [complete] see repo see repo see repo
- Work on ScalaSharp [complete] see repo
- Improve ClojSharp [complete] see repo
- Improve SimpleAsync, do operation (functions in parallel) [pending]
- Improve Aktores [pending]
- Distributed messages in AjErl [pending]
- Add variable scope to Mass language [pending]
- Start code generation as a service [partial]

Additionally, I worked on:

- Complexo, simple complex numbers operations in JavaScript [complete] see repo
- Started RustScript, a Rust programming language interpreter in JavaScript [complete] see repo
- Continue RuScript, a Ruby interpreter in JavaScript [complete] see repo
- Continue RubySharp, a Ruby interpreter in C# [complete] see repo
- Started AjLispScala, a Lisp interpreter in Scala, using TDD and SBT [complete] see repo
- Recorded a second video Node.js Spanish tutorial [complete] see post

For this new month, my resolutions are:

- Continue AjLispScala
- Continue AjGenesisNode-Express
- Continue AjGenesisNode-PHP
- Continue RuScript
- Continue RustScript
- Distributed Messages in AjErl
- Give a talk Intro to Node.js
- Publish a new Node.js video tutorial

More fun is coming.

Keep tuned!

Angel “Java” Lopez

March 25, 2014

End Of Iteration 2014w12

Filed under: AjGenesis, Code Generation, JavaScript, NodeJs, Ruby, RubySharp, RuScript — ajlopez @ 10:41 am

Previous Post
Next Post

Ruby Interpreters

I updated my projects

The first in a Ruby interpreter in C#. I started to add the support to detect the local variables in an scope. In Ruby, there is the function local_variables() that returns a list of the names of local declared variables (not only the already initialized).

The second project is the seed to my next talk: it implements Ruby in JavaScript, as an interpreter. I added more support for modules and classes, and function declaration with and without arguments and parenthesis. I’m using my grammar/parser generation:

It was updated to support new use cases (dog fooding!).


I added some simple features to

My Rust Programming Language interpreter in JavaScript. Not, it has function definition with arguments, let and let mut (mutable), some new arithmetic, bitwise and logical operators, with precedence. And a powerful assert! to start writing test programs.


I updated

My Scala interpreter in C#. The additions were simple: more node support. A node is the product of a parser, and define a part of the program. It has a type to be checked. That is the main difference with expression: a node has a type that can be inferred from the rest of the program, or by explicit declaration. As a typed language, an Scala interpreter cannot directly evaluate expression. I should check the types of the nodes, and THEN, generate a correct expression tree.

Code generation

I created

A new global tasks to be used by AjGenesis and related tasks to modify the model using command line. I started the new global tasks

to generate code for PHP and Django. There are only the skeletons, but I want to generate code for these languages/frameworks using a free model. Meanwhile, you can check the simple pages generated from:

The next big step: having a code-as-a-service application, written in Node.js, using AjGenesisNode, and deployed on Heroku.

I worked on two non-public projects, too.

More fun is coming!

Keep tuned!

Angel “Java” Lopez

March 17, 2014

End Of Iteration 2014w11

Previous Post
Next Post


I finished my presentation about Node.js Distributed Applications:

Last week I gave this talk at the JSConf Uruguay Great days, interesting people, projects and ideas. I should post about my experience. In this talk I mentioned my projects:

And I did a quick description of some other basic projects I used to build the demos:


I updated my project

Now it has to samples: one, with position evaluation at browser, and another with position evalution at server side. Next steps: add worker nodes, at server side, to distributed the position evaluation, maybe with a tree search in many levels (now it explores 2 plies), or more levels using montecarlo.


After talking with @LostOracle at JSConfUy, I started an interpreter for Rust Language, in JavaScript:

The hello world is working:

I use and updated my grammar generator

Dog fooding is good!


I added new rules and some refactor to my projects:

I want to add a JavaScript application running at client side, to cover the main use case of Preciosa Project.

I worked on two non-public projects. Now, I’m back at Buenos Aires. More fun is comming!

Keep tuned!

Angel “Java” Lopez

March 10, 2014

End Of Iteration 2014w10

Filed under: C Sharp, Distributed Computing, Iteration, JavaScript, NodeJs, ScalaSharp — ajlopez @ 4:21 pm

Previous Post
Next Post


I added initial slides to my upcoming talk, Distributed Applications in Node.js, for JsConf Uruguay 2014:

I updated my projects: SimpleGA, SimpleActors, SimpleBus, SimpleStorm, SimpleQueue, SimpleRemote, SimpleMessages, and ObjectStream.


I started to parse nodes, with type information, instead of expressions

In this way, I can check the type of the nodes BEFORE generating the expression tree to run. One thing is the node, of an abstract syntax tree, and another thing is the expression to execute. That is, a + b could be represented by a node, but the expression to execute depends on the types of a and b.


I worked on two non-public projects, and some updates on Annalisa, DictSharp, and ScalaSamples. I published the heroku version of PreciosaAnnalisa. And I updated my backgammon evaluation library, SimpleGammon, with a work-in-progress html sample.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

March 5, 2014

End Of Iteration 2014w09

Previous Post
Next Post

More interesting stuff for my neuron, and deliberate TDD (Test-Driven Development) practice.


A lot of new work at

It takes an string and extract information based on rules. For example, it can detect the brand of a product description, its weight, weight unit, etc. I put an online demo in Spanish for analyze or search into Preciosa project data:


I started a simple in-process, in-memory key/value store in C#:

A dictionary with a an internal tree, instead of using hashes. I should complete the node split operation, enumerate the keys, and compress the keys. A key is an string, and the associated value could be typed or a generic object.


Motivated by a use case of Preciosa project, I wrote:

A simple JavaScript module to manage a list of geolocated items (via latitude, longitude), and then retrieve the items near a point in a given radius.


I refactored my in-memory repository:

to support optional autonumeric ids, and tests using SimpleUnit. Notably, I found an issue: SimpleUnit can be installed as global module in NPM (Node Package Manager) but the bin file has a shebang (!#) in the first line, ending with \r\n (carriage return line feed). Then, Linux operating system take the shebang, and use it as the name of the program to execute the script, WITH THE CARRIAGE RETURN in the name. So, I fixed it removing the carriage return. Weird thing in the third millenium. I updated

to have no carriage return in bin scripts.


I worked on two non-public projects, using C#. I started my Python samples I added some nodes to AST (Abstract Syntax Tree) in

More fun is coming.

Keep tuned!

Angel “Java” Lopez

February 26, 2014

End Of Iteration 2014w08

Filed under: C Sharp, Iteration, JavaScript, NodeJs, Open Source Projects, Python — ajlopez @ 5:02 pm

Previous Post
Next Post

More interesting projects and code TDD practices


A new JavaScript project:

to solve some use cases of Preciosa project. Preciosa is written in Django/Python, but I want to explore how to solve:

- Given an string, return associated properties (ie. analyze a product description, then return detected weight (from “10 gr” substring), brand (from “… Axe … “ substring). I create rules to detect some patterns (simple normalized substrings) and return a JavaScript object with detected properties/values.

- Search by word combination (done), and approximated words (WIP)

Now, I’m working on implementing Preciosa use cases, using its data for products, companies, brands, etc.  I’m implementing console programs, and I will to implement a web service with associated test page.


I started:

A new implementation, this time in JavaScript, for my syntax highlighter Acquarella (in C#). I plan to use it to generate colored HTML for my code snippets, and add them to my posts (in blog software that doesn’t allow JS scripts).


Someone asked on Twitter about a template engine in Java, without dependencies, a lightweight version. Then, I wrote

Now, it has expansion of variables in ${variable}, and process of @if commands. Next steps: adding @for, adding ${} using reflection.


My Scala interpreter in C#, in progress:

I was adding more INode concrete nodes. Instead of having expression tree, I want a node tree, to have type checking BEFORE evaluation, according to a typed compiled language.


I modified

It was published to

And created a new one (WIP):

for upcoming JSConf Uruguay 2014. Yes! I’m an speaker.


After attending JavaScript meetup with @getify talk, I wrote, following TDD as usual, a simple async library:

I want to add: .do to launch a “parallel” tasks (many consecutive .do returns an array with the collected result), and .map to process an array in “parallel”.


I wrote a new TDD exercises

this time in Python: syllable separation in Spanish. Good code kata. It was useful to me to learn and practice more Python.


Minor additions to,,

I also worked on two non-public projects. More fun is coming.

Keep tuned!

Angel “Java” Lopez

February 19, 2014

End Of Iteration 2014w07

Filed under: .NET, C Sharp, Iteration, JavaScript, NodeJs, Open Source Projects, Scala, ScalaSharp — ajlopez @ 7:15 pm

Previous Post
Next Post

A lot of interesting topics and code.


I started to explore Meteor:

You can see one of my samples deployed at:

A simple CRUD (WIP) application. Next steps: code generation using AjGenesis for Node.js, mobile look, and wrap up as a PhoneGap application.

I also wrote posts:

Programming Meteor (1) First Steps
Meteor: Links And Resources (1)


My Scala interpreter in C#:

I started to switch from a tree of expression to a tree of nodes (a classical AST). In this way, I could implement type checking, compilation, etc… visiting the node tree. There are differences between an expression and a node. A node could be a name, but that name, in Scala, could be a val, a var, or a def. I have not the full context to decide what kind of expression to invoke. So, I need a previous step. A node is the first parser output. A tree node could be visited, performing type checking and then producing the correct expression.


Inspired by Meteor .autorun method, I wrote a react library in JavaScript

As usual, simple code, using TDD workflow.


I continue adding features to

A simple JavaScript library to process an HTML string. I should add more features, and write a sample, scraping an e-commerce site.


A minor addition in ClojSharp using recur in a function

Completing the model in supporting that an entity references another entity.

I worked on two non-public projects, too. More fun is coming.

Keep tuned!

Angel “Java” Lopez

February 16, 2014

Programming Meteor (1) First steps

Filed under: JavaScript, Meteor, Mobile, NodeJs, PhoneGap, Programming, Web Development — ajlopez @ 7:21 pm

Yesterday, I attended to Meteor meetup at Buenos Aires, a half day of talks and coding. Thanks to organizers, sponsors and supporters: @areatreslab, @4residents, @bikestorming, @html5cat (he co-wrote a function analysis paper), @matikalwill (a.k.a. “my life is bikestorming, ‘senio’”).

Meteor is a framework to build web applications. And it can be used to build mobile applications, too. A meteor application, in general, is a single page application (SPA). The server is based on Node.js. But Meteor is not like another Node.js applications. Visit:

The main difference: the programming language is JavaScript, AND CAN BE EXECUTED at server side or at client side. Yes, the same code. Or you can write code specifically created for client OR server side.

Meteor is based on seven principles:

  • Data on the Wire. Don’t send HTML over the network. Send data and let the client decide how to render it.
  • One Language. Write both the client and the server parts of your interface in JavaScript.
  • Database Everywhere. Use the same transparent API to access your database from the client or the server.
  • Latency Compensation. On the client, use prefetching and model simulation to make it look like you have a zero-latency connection to the database.
  • Full Stack Reactivity. Make realtime the default. All layers, from database to template, should make an event-driven interface available.
  • Embrace the Ecosystem. Meteor is open source and integrates, rather than replaces, existing open source tools and frameworks.
  • Simplicity Equals Productivity. The best way to make something seem simple is to have it actually be simple. Accomplish this through clean, classically beautiful APIs.

Notable, database state is shared by all clients at realtime. If your current view is a list of customer, and somebody adds a new customer to the MongoDB database (the supported database) all the clients are notified, and each view involving customers are automatically refreshed. All this without adding special code, simply using the code that lists customers in a page (using Handlebar as the template engine).

Although based on Node.js, Meteor is not an NPM package. It should be installed manually, read:

It can installed in Linux/Unix and Mac boxes. Supported platforms at:

But if you have Windows (I used Windows in the meetup) you should use another approach:

There are Vagrant –based solutions, too. I installed using the LaunchMeteor.exe without problems, in two Windows machines.

I read:

A Meteor application is a mix of JavaScript that runs inside a client web browser, JavaScript that runs on the Meteor server inside a Node.js container, and all the supporting HTML fragments, CSS rules, and static assets. Meteor automates the packaging and transmission of these different components. And, it is quite flexible about how you choose to structure those components in your file tree.

The only server assets are JavaScript and files in the private subdirectory. Meteor gathers all your JavaScript files, excluding anything under the client, public, and private subdirectories, and loads them into a Node.js server instance inside a fiber. In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

My emphasis. This is a sensitive issue: I’m not sure about the implications of such run strategy. Check my links,scalability

Meteor has an unofficial package manager, called Meteorite:

and “smart packages”

I read:

In addition to the packages in the official Meteor release being used by your app, meteor list and meteor add also search the packages directory at the top of your app. If you’ve downloaded an unofficial package from Atmosphere you should unpack it into that directory (the unofficial Meteorite tool streamlines this process). You can also use the packages directory to break your app into subpackages for your convenience — if you are willing to brave the fact that the Meteor package format is not documented yet and will change significantly before Meteor 1.0…

Meteorite is not running on Windows, so you should use only the builtin packages or use a manual install.

There are many resources to learn Meteor:

For example, there are easy ready to use examples:

During yesterday meetup, I tried some examples, modify and simplify the leaderboard example, add a Bootstrap 2.x top bar, and started to write a new one using many pages and MongoBD (using Backbone routing):

Many links with tutorials, videos, examples at:

The CRUD sample (work in progress) at:

It uses only builtin packages so you can run it as is from Windows.

Yesterday, I published some Meteor-related links. More links at:,tutorial

Ah! Meteor can run in PhoneGap, to have a multi-device mobile experience:,phonegap

My plan: after finishing the mycompany sample, use the base code to generate an AjGenesis module for Node.js. So, I will have code generation of web sites, using a free defined model, tasks and templates. Then, add phonegap support, and maybe, software as a service, using Node.js access to PhoneGap Build API.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

Older Posts »

The Shocking Blue Green Theme Blog at


Get every new post delivered to your Inbox.

Join 56 other followers