Angel \”Java\” Lopez on Blog

November 24, 2013

Ruby: Links, News And Resources (6)

Filed under: Links, Programming Languages, Ruby — ajlopez @ 3:54 pm

Previous Post
Next Post

defunkt / resque
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.

bvandenbos / resque-scheduler
A light-weight job scheduling system built on top of resque

Understanding Rack

The Ruby Toolbox

Fiasco is a thin and modular layer on top of Rack inspired by Flask, Jinja2 and Cuba.

List of Ruby Web Frameworks

Cuba is a microframework for web applications.

An introduction to RSpec – Part I

Getting Started with RSpec – Looking for tutorials

Programming for the Web with Ruby

Ruby Guide

bbatsov / ruby-style-guide
A community-driven Ruby coding style guide

Programming Ruby, The Pragmatic Programmer’s Guide

Writing an API Wrapper in Ruby with TDD

Ruby is the New Smalltalk

Why I love Ruby (Part 1)

Lisp in 32 lines of Ruby

.NET to Ruby: Learning How to Write Tests, Part I

NET to Ruby: Learning How to Write Tests, Part II

A lightning talk by Gary Bernhardt from CodeMash 2012

luciolang / lucio
Lucio is a Lisp-like language running on Ruby

Languages, Verbosity, and Java

Infografía: Comparativa entre PHP, Ruby y Python

RSpec 2.8: The Popular Ruby BDD Tool Goes Supersonic

Slido: markdown to html5 slideshow

Monads in Ruby, Part 1: Introduction

My Links

Keep tuned!

Angel “Java” Lopez

November 12, 2013

End Of Iteration 2013w45

Previous Post
Next Post

I’m exhausted, after my Node.js Knockout participation, last week end.

Node Knockout

It is my main deliverable for past week. I wrote a web application, in two days, from scratch, using Node.js and Express. Video with demo:

It’s running online at:

Now, the repo is private, but I will clone it to my public GitHub account. You can see the votes at:

TDD and JavaScript

I gave a talk at local JavaScript meetup

Code at:

Slides at:

Other works

Minor updates at

Updated require algorithm at

Keep tuned!

Angel “Java” Lopez

October 26, 2013

TDD Rocks! (1) Playing with Ruby

Filed under: Google, Ruby, Test-Driven Development, Video — ajlopez @ 9:41 am

Next Post
Next Post with Ruby

Past July, I recorded a Google hangout, about on of my favorite topic: TDD (Test-Driven Development).

My first one:

TDD Rocks (1) Playing with Ruby

Well, I’m using Anglish, that is, Angel’s English ;-).

The idea is to show my TDD workflow, step by step, and in this video I’m using Ruby (I’m learning Ruby). In the second video I added more tests, like recognize numbers, words and symbols. I will apply internal refactoring, and a better implementation. I already applied that workflow in my public projects in Ruby:

My Lisp interpreter in Ruby, with access to gems

Code generation, like AjGenesis in .NET, but now using Ruby

In this video, I’m adding the minimal code to past the test. I don’t separate the class under development from the tests: they are in the same files. You can check project status:

I will publish posts with more Google hangouts, with TDD using JavaScript, C#, and more Ruby.

Keep Tuned!

Angel “Java” Lopez

October 17, 2013

RubySharp, Implementing Ruby In C# (2)

Filed under: C Sharp, Open Source Projects, Programming Languages, Ruby, RubySharp — ajlopez @ 7:11 pm

Previous Post
Next Post

I’m working on my Ruby implementation as interpreter written in C#

Today I would like to show that I have implemented many expressions that can be evaluated:

I have implemented commands, too. Initially they were separated:

But now, expressions and commands implement the same interface, to compy with Ruby moto “every is a value”

Evaluate method receives a Context:

I should review if I want or not that Context object has reference to self and other fields. But I wrote all with TDD, so, I could refactor it at any moment.

A code sample, NameExpression .Evaluate method:

public object Evaluate(Context context)
    var result = context.GetValue(;

    if (result is IFunction)
        return ((IFunction)result).Apply(null, emptyvalues);

    return result;

Notice that I had to take into account the case: the name argument refers to a function. In Ruby, you can call a function simply using the name, the parenthesis are not mandatory.

Next steps: internal refactor, more commands and expressions.

Keep tuned!

Angel “Java” Lopez

October 14, 2013

RubySharp, implementing Ruby in C# (1)

Filed under: C Sharp, Open Source Projects, Programming Languages, Ruby, RubySharp — ajlopez @ 12:02 pm

Next Post

Every day I write code and push it to my GitHub account. The purpose is training: practice programming, programming languages and TDD (don’t forget TDD!).

I’m working in RubySharp in my spare time:

It is a Ruby interpreter written in C# (like PythonSharp, see posts). There are two solutions, with and without tests, so you can compile the small solucion witn Visual Studio Express. The solucion with tests:

I have commands and expressions. But I learned that in Ruby every is an expression, so now expressions and commands implements the same interface. The programming language Mass derived from ideas in RubySharp.

My tests (now are more tests):

To give evidence about “put my money where my mouth is”, you can check my commits at:

Next posts: implementation details, examples, scripting over .NET.

Keep tuned!

Angel “Java” Lopez

October 13, 2013

Exploring Ruby on Rails (1) Install

Filed under: Ruby, Ruby on Rails — ajlopez @ 1:39 pm

I’m playing with Ruby. As a dynamic language, it is one of the programming languages to explore. I like plain Ruby, and write small programs using TDD (see my video in Anglish Playing with Ruby).

Now, I want to explore Ruby on Rails. It’s not in my comfort zone, because I think it is a “big project”, now in version 4.0. But it could be interesting to see how easy or convoluted could be to program using Rails, and to study the internal implementation.

So, in my Windows machine, some weeks ago, I installed Rails 4.x, using


gem install rails --no-rdoc --no-ri

I added –no-rdoc, –no-ri to skip the generation of local documentation.

It was a long output, see the gems that were installed:

Fetching: i18n-0.6.5.gem (100%)
Fetching: tzinfo-0.3.37.gem (100%)
Fetching: minitest-4.7.5.gem (100%)
Fetching: atomic-1.1.14.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Fetching: thread_safe-0.1.3.gem (100%)
Fetching: activesupport-4.0.0.gem (100%)
Fetching: builder-3.1.4.gem (100%)
Fetching: actionpack-4.0.0.gem (100%)
Fetching: activemodel-4.0.0.gem (100%)
Fetching: arel-4.0.0.gem (100%)
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Fetching: activerecord-4.0.0.gem (100%)
Fetching: mail-2.5.4.gem (100%)
Fetching: actionmailer-4.0.0.gem (100%)
Fetching: thor-0.18.1.gem (100%)
Fetching: railties-4.0.0.gem (100%)
Fetching: bundler-1.3.5.gem (100%)
Fetching: sprockets-2.10.0.gem (100%)
Fetching: sprockets-rails-2.0.0.gem (100%)
Fetching: rails-4.0.0.gem (100%)
Successfully installed i18n-0.6.5
Successfully installed tzinfo-0.3.37
Successfully installed minitest-4.7.5
Successfully installed atomic-1.1.14
Successfully installed thread_safe-0.1.3
Successfully installed activesupport-4.0.0
Successfully installed builder-3.1.4
Successfully installed actionpack-4.0.0
Successfully installed activemodel-4.0.0
Successfully installed arel-4.0.0
Successfully installed activerecord-deprecated_finders-1.0.3
Successfully installed activerecord-4.0.0
Successfully installed mail-2.5.4
Successfully installed actionmailer-4.0.0
Successfully installed thor-0.18.1
Successfully installed railties-4.0.0
Successfully installed bundler-1.3.5
Successfully installed sprockets-2.10.0
Successfully installed sprockets-rails-2.0.0
Successfully installed rails-4.0.0
20 gems installed

It is interesting to note there were native extensions, something to explore.

Now, the rails command is in my path. How the install program added the command? Simply. If you have Ruby in your path, you have the bin folder in that list of directories. In my case, c:\Ruby193\bin. Every gem that has global commands, can put in that folder new files. In my case, rails, and rails.bat.

This is the content of the .bat file:

IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/Ruby193/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
@"ruby.exe" "%~dpn0" %*

It detects if it can use or not a ‘cmd trick’, see

It launch the ‘rails’ file in the same bin directory, using ruby.exe. The rails file has:

# This file was generated by RubyGems.
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1

gem 'railties', version
load Gem.bin_path('railties', 'rails', version)

It use rubygems, the Ruby packaging system, see:

It imports, not directly rails, but railties, using the gem method.

The Gem.bin_path returns the path for ‘railties’, see

In my case, the bin-path returns ‘c:\Ruby193\lib\ruby\gems\1.9.1\railties-4.0.0\bin\rails’. The second parameter ‘rails’ indicates the script to run. It is executed using the ‘load’ command:

load(filename, wrap=false) ? true

Loads and executes the Ruby program in the file filename. If the filename does not resolve to an absolute path, the file is searched for in the library directories listed in $:. If the optional wrap parameter is true, the loaded script will be executed under an anonymous module, protecting the calling program’s global namespace. In no circumstance will any local variables in the loaded file be propagated to the loading environment.

I should study the difference with ‘require’:

require(name) ? true or false

Loads the given name, returning true if successful and false if the feature is already loaded.

If the filename does not resolve to an absolute path, it will be searched for in the directories listed in $LOAD_PATH ($:).

If the filename has the extension “.rb”, it is loaded as a source file; if the extension is “.so”, “.o”, or “.dll”, or the default shared library extension on the current platform, Ruby loads the shared library as a Ruby extension. Otherwise, Ruby tries adding “.rb”, “.so”, and so on to the name until found. If the file named cannot be found, a LoadError will be raised.

For Ruby extensions the filename given may use any shared library extension. For example, on Linux the socket extension is “” and require ‘socket.dll’ will load the socket extension.

The absolute path of the loaded file is added to $LOADED_FEATURES ($"). A file will not be loaded again if its path already appears in $". For example, require ‘a’; require ‘./a’ will not load a.rb again.

require "my-library.rb"

require "db-driver"

Any constants or globals within the loaded source file will be available in the calling program’s global namespace. However, local variables will not be propagated to the loading environment.

That ‘rails’ file contains:

#!/usr/bin/env ruby

git_path = File.join(File.expand_path('../../..', __FILE__), '.git')

if File.exists?(git_path)
  railties_path = File.expand_path('../../lib', __FILE__)
require "rails/cli"

Apparently, the gem loader alters the require path, and the require of ‘rails/cli’ is resolved to ‘c:\Ruby193\lib\ruby\gems\1.9.1\railties-4.0.0\lib\rails’.

Ok, enough for today. Next steps: explore the load of rails, parameters, and create a site.

Keep tuned!

Angel "Java" Lopez

September 3, 2013

New Month’s Resolutions: September 2013

My past month’s resolutions status:

– Update SimpleProlog [complete] see repo
– Update Mass [pending]
– Update AjTalkJs [complete] see repo
– Update AjTalk [complete] see repo
– Update SimpleLisp [pending]
– SimpleLisp web server sample [pending] 
– New Google Hangout using Ruby and TDD [complete] see post 
– New Google Hangout using C# and TDD [complete] see post

Additional items:

– Another Google Hangout using C# and TDD [complete] see post
– Google Hangout using JavaScript and TDD [complete] see post
– Google Hangout about Exploring MongoDB [complete] see post
– Google Hangout about Code generation with AjGenesis for Ruby [complete] see post
– Update AjGenesis for Ruby [complete] see repo
– Update AjGenesis for Node.js [complete] see repo
– New AjGenesisNode module for Entities [complete] see repo
– Start new AjGenesisNode module for Express [complete] see repo
– New SimpleUnit node module for testing [complete] see repo
– Start ScalaSharp, Scala-like interpreter in C# [complete] see repo
– Improve left recursion in GrammGen [complete] see repo
– Update SimpleMongo [complete] see repo
– Give a talk about code generation with AjGenesis for Ruby [complete] see talks

and many node modules refactoring, using SimpleUnit

This month’s resolutions:

– Update SimpleForth
– Give a talk about SimpleMongo, SharpMongo
– Update SimpleMongo
– Update SharpMongo
– Update PageJs
– Update ScalaSharp
– Update JPyScript
– Update AjTalkJs
– Update Mass scopes
– Start Web Server example with AjTalkJs
– Update AjTalk
– Update AjLispJs
– Web Server example with AjLispJs
– Prepare a talk about Scala

Keep tuned!

Angel “Java” Lopez

September 2, 2013

End Of Iteration 2013w35

Filed under: C Sharp, Code Generation, Express, Iteration, JavaScript, Open Source Projects, Ruby — ajlopez @ 9:41 am

Previous Post
Next Post

Many tasks in many projects. Some notes:

Google Hangouts

Code Generation with Ruby

using AjGenesis for Ruby


I updated my implementation in Ruby

But more important, there is a new version of my implementation using JavaScript/Node.js, the 0.0.5 version

with support for:

– Load models from .json file or from .json files in a directory
– Copy files, copy directories
– Invoke local tasks from local ajgenesis/tasks
– Invoke local modules:verb from local ajgenesis/modules

There are two new modules published, version 0.0.1

to add entities and propertis inside ajgenesis/models

And a Work in progress module to generate Express sites:


I added test.async() and test.done() functions for asynchronous processing

New version 0.0.2 published


First steps in my Scala interpreter for C#, lexer, parser first tests:


GrammGen, Improved left recursion, more tests

SimpleProlog, parse “and” structure

SimpleMongo, find with query and projection

A new talk about Ruby code generation with AjGenesis

Cuba hello sample, in Ruby Samples

Published version 0.0.1 argument processor, refactored to use SimpleUnit.

I worked on two non-public projects, one involving Node.js, JSON, Ajax, good experience to add to my personal projects.

Keep tuned!

Angel “Java” Lopez

August 21, 2013

End Of Iteration 2013w33

Previous  Post

This week was extended up to Monday August 19th, public holiday here, Argentina.

Google Hangouts

I recorded one Google Hangout, playing with Ruby and TDD (2):

TDD Rocks! (6) Playing with Ruby



This is an interesting code kata, written on Sunday late morning. I wrote my Node.js modules using TDD. I do it calling builting module assert, or using node-unit. But sometimes, node-unit is GREATER than the module I want to write. So, I wrote my simple implementation, and published it in NPM as version 0.0.1:

I refactored my tests in projects:

to start using simpleunit. Next steps: add asynchronous processing. The first candidate to use it is SimpleProlog: solve facts using callbacks.


My implementation of Smalltalk VM in JavaScript.

I have an implementation in C#

that compiles .st files to JavaScript. But now, I want to compile .st to JavaScript using JavaScript itself. So I added the first tests and implementations of lexer and parser to AjTalkJs. I hope I will present the result at Smalltalks 2013.


My implementation of Prolog language, in progress.

It started to have a lexer.


My C# implementation of SimpleContext ideas:

Now it has a new object, DynamicContext. I should add the inheritance use cases. Notice that C# version has more ceremony than the JavaScript one.


My implementation of MongoDB in memory, using C#, in progress:

Minor refactor/redesign to support read-only documents. Now it has dynamic objects, too. Dynamic documents are dynamic objects with an Id.

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

Keep tuned!

Angel “Java” Lopez

August 4, 2013

New Month’s Resolutions: August 2013

Time to review my July’s resolutions:

– Update Memolap [complete] see repo
– Update GrammGen [complete] see repo
– Update SimpleGrammar [complete] see repo
– Prepare a talk: Intro to Smalltalk [complete] see talk
– Start PHP compiler to JavaScript [complete] see repo
– Write PHP example with Node.js [pending]
– Update AjLispJs [[pending]
– Create a web site sample using AjLisp and Node.js [pending]

Instead of updating AjLispJs, I started another project:

– Start SimpleLisp, Lisp compiler to JavaScript [complete] see repo

Additionally, I worked on:

– Start SimpleContext, associate arbitrary data to simple JavaScript objects [complete] see repo
– Start SimpleProlog, Prolog language interpreter in JavaScript/Node.js [complete] see repo
– First version of KodeTokenizer [complete] see repo
– First version of KodeMutator [complete] see repo
– Publish Obops on Nuget [complete] see repo
– Publish my first Smalltalk samples [complete] see repo
– Create and pubish first version of Plagre, programming language recognizer [complete] see repo see demo
– Updated my TDD Rocks samples [complete] see repo
– Start SharpBase C# in-memory database [complete] see repo
– Start AjForce, applications in Node.js a la [complete] see repo
– Start OStore, in-memory JavaScript object store [complete] see repo
– Added Rack samples to my Learning Ruby [complete] see repo
– Write SimpleMule, simple Mule-like in JavaScript/Node.js [complete] see repo

Also, I published Google hangouts:

TDD Rocks (1) Playing with Ruby
TDD Rocks! (2) OStore with JavaScript/Node.js
Exploring Smalltalk (1) (Spanish)
TDD Rocks! (3) SharpBase in C#
TDD Rocks! (4) SharpBase in C#

My new month’s resolutions, August 2013:

– Update SimpleProlog
– Update Mass
– Update AjTalkJs
– Update AjTalk
– Update SimpleLisp
– SimpleLisp web server sample
– New Google Hangout using Ruby and TDD
– New Google Hangout using C# and TDD

Lot of fun is coming 😉

Keep tuned!

Angel “Java” Lopez

« Newer PostsOlder Posts »

Blog at