Angel \”Java\” Lopez on Blog

June 27, 2014

End Of Iteration 2014w25

Previous Post
Next Post

Code Generation with AjGenesis

I published a new version of

https://github.com/ajlopez/AjGenesisNode

My code generation tool, based on Node.js. Now, it can preserve files in generate tasks (if you want one of your files doesn’t overwritten). But the key change was to put models under current project directory, ajgenesis/models folder. In this way, I can put all the AjGenesis-related stuff in only one directory related to current project. So, I refactored and republished the modules and examples of:

https://github.com/ajlopez/AjGenesisNode-Express
https://github.com/ajlopez/AjGenesisNode-Entity
https://github.com/ajlopez/AjGenesisNode-Hello

Next steps: refactor https://github.com/ajlopez/AjGenesisNode-Model to use the new directory, and refactor/complete the generation process in Express, Sinatra, Laravel, Django projects.

SharpBus

I worked on

https://github.com/ajlopez/SharpBus

implemented a simplified Mule-like message flow in C#, using TDD (Test-Driven Development). Now I have: input, output, transform, processors, routers, branches in flow. It was nice to see all in place, using “baby steps”, and the powerful lambdas of C#. I implemented transformer objects too. Next steps: instead of simply process a payload, start to process a complete message.

SimpleCurry

After attending a JavaScript meetup at Buenos Aires, I wrote a simple JavaScript curryfing function library:

https://github.com/ajlopez/SimpleCurry

Since then, I started to add some additional pieces, like partial application, and composition of functions.

SimpleStates

Thanks to @fabiomaulo, I met state machine implementations in C#. So, I wrote my own version in JavaScript:

https://github.com/ajlopez/SimpleStates

It has a fluent interface to define states, with triggers and actions. Next steps: add global triggers, and hierarchical states.

Others

I added some functions to https://github.com/ajlopez/SharpMongo core and REPL. I worked on four private projects, too. More fun is comming.

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

June 20, 2014

End Of Iteration 2014w24

Filed under: .NET, C Sharp, Iteration, Mass, Open Source Projects, SharpBus, SharpGo, SharpMongo — ajlopez @ 6:27 pm

Previous Post
Next Post

SharpGo

My Go Programming Language interpreter in C#

https://github.com/ajlopez/SharpGo

I added typed nodes to Abstract Syntax Tree, and nodes that generate expressions instead of commands. The types will help me to determine if an expression is valid or not, according to Go type specifications.

Mass

The Mass programming language interpreter

https://github.com/ajlopez/Mass

I reimplemented binary arithmetic operations (and string concatenation) without using ObOps, but directly using compiled lambda expressions. Next steps: removing ObOps dependency from compare operations. I think that a compiled lambda is a better outcome for such expression.

SharpMongo

My in-process, in-memory implementation in C# of a document database with a MongoDB-like interface:

https://github.com/ajlopez/SharpMongo

I fixed source analysis issuses, and added .count method to collections and to collection objects in REPL.

SharpBus

I started

https://github.com/ajlopez/SharpBus

A simple message bus implemented in C#, inspired by Mule. Notably, the flow of message can be defined using lambdas (something missing in Mule Java up to version 7). Using TDD, using fluent interface, consuming lamdbas, is the simplest way I found to implement a message bus.

Others

I worked fixing scripts in https://github.com/ajlopez/ajlopezsite. My parser “generator” https://github.com/ajlopez/GrammGen was  converted to VisualStudio 2010I worked on four non-public projects. More fun is coming.

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

October 22, 2013

SharpMongo (2) a REPL

Filed under: C Sharp, MongoDB, NoSQL, Open Source Projects, SharpMongo — ajlopez @ 7:15 pm

Previous Post

I’m working on my document in-memory store project, written in C#

https://github.com/ajlopez/SharpMongo

It tries to implement the same operations as MongoDB: to have document bases, collections, documents, dynamic objects, etc. But with a difference: all is in-memory, and by now, in the same process. Persistence will be added as a plugin.

One of the tools I wanted to build is a REPL (Read Eval Print Loop), a console program that emulates the main functions of the MongoDB console client. The MongoDB program talks againts a server. SharpMongo, in the current version, only works in the same process memory, no persistence is implemented, yet.

The project is SharpMongo.Console. It compiles an assembly named sharpmongo.exe. You can launch it from command line:

SharpMongo 0.0.1
> show dbs
> show collections
> use foo
> show dbs
foo  

Now, we are in a db (document base), named ‘foo’. We can create a collection inserting dynamic documens, in a JSON-like format:

> db.people.insert({ Name: 'Adam', Age: 800 })
> db.people.insert({ Name: 'Eve', Age: 700 })
> show collections
people  

We can find the documents in a collection:

  > db.people.find()
{ "Name": "Adam", "Age": 800, "Id": 4d802e11-a038-468e-bd26-38e96ad6f7d8 }
{ "Name": "Eve", "Age": 700, "Id": b29917f1-70f1-4f6c-95bb-f789fa9bf3c0 }  

We can find documents, filtering them using a criteria, expressed in a dinamic object as first parameter (a la query by example):

  > db.people.find({ Name: 'Adam' })
{ "Name": "Adam", "Age": 800, "Id": 4d802e11-a038-468e-bd26-38e96ad6f7d8 }  

We can insert more documents:

> db.people.insert({ Name: 'Cain', Age: 600 })
> db.people.insert({ Name: 'Abel', Age: 500 })
> db.people.find()
{ "Name": "Adam", "Age": 800, "Id": 4d802e11-a038-468e-bd26-38e96ad6f7d8 }
{ "Name": "Eve", "Age": 700, "Id": b29917f1-70f1-4f6c-95bb-f789fa9bf3c0 }
{ "Name": "Cain", "Age": 600, "Id": a5a3e1af-7e5c-4c16-829e-c07f94bc8697 }
{ "Name": "Abel", "Age": 500, "Id": c1da0055-8ded-4540-876f-5c032f514ed3 }  

We can insert and remove documents:

> db.people.insert({ Name: 'Pluto' })
> db.people.find()
{ "Name": "Adam", "Age": 800, "Id": 4d802e11-a038-468e-bd26-38e96ad6f7d8 }
{ "Name": "Eve", "Age": 700, "Id": b29917f1-70f1-4f6c-95bb-f789fa9bf3c0 }
{ "Name": "Cain", "Age": 600, "Id": a5a3e1af-7e5c-4c16-829e-c07f94bc8697 }
{ "Name": "Abel", "Age": 500, "Id": c1da0055-8ded-4540-876f-5c032f514ed3 }
{ "Name": "Pluto", "Id": 0561864a-470a-4437-9467-773ffb5a438a }
> db.people.remove({ Name: 'Pluto' })
> db.people.find()
{ "Name": "Adam", "Age": 800, "Id": 4d802e11-a038-468e-bd26-38e96ad6f7d8 }
{ "Name": "Eve", "Age": 700, "Id": b29917f1-70f1-4f6c-95bb-f789fa9bf3c0 }
{ "Name": "Cain", "Age": 600, "Id": a5a3e1af-7e5c-4c16-829e-c07f94bc8697 }
{ "Name": "Abel", "Age": 500, "Id": c1da0055-8ded-4540-876f-5c032f514ed3 }   

There are missing parts, the most important one could be the support of operators in query objects, that could allow us to apply more complex criteria, beyond equality, and operators in the update operation. All will be added using TDD, as usual.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

October 20, 2013

SharpMongo (1) First Classes

Filed under: C Sharp, MongoDB, NoSQL, Open Source Projects, SharpMongo — ajlopez @ 5:29 pm

Next Post

I’m exploring NoSQL, specially MongoDB. In a non-public project, my customer is using MongoDB, and I’m writing an in-memory alternative, an extension of my open source project Memolap. I like to implement in-memory storage, so I decided to write a MongoDB-like in C#, work in progress:

https://github.com/ajlopez/SharpMongo

As usual, it’s been written using TDD workflow:

https://github.com/ajlopez/SharpMongo/commits/master

I’m implementing the same ideas in JavaScript/Node.js, check:

https://github.com/ajlopez/SimpleMongo

The current status of SharpMongo hasSi ven el estado actual de SharpMongo, tiene:

– Class project SharpMongo.Core
– Test project SharpMongo.Core.Tests
– Class project SharpMongo.Language, where I’m implementing a simple language for a console program
– Test project SharpMongo.Language.Tests
– And the console program SharpMongo.Console

There are some base classes:

Engine has a list of DocumentBase. A DocumentBas has Collections. The documents and dynamic objects:

A Collection contains DynamicDocuments. A DynamicDocument is a DynamicObject (a key-value dictionary) but with an additional property Id.

I have already implemented the Collection methods:

– Insert
– Find (with query and projection)
– Remove (with query)
– Save (with and without Id)
– Update

And the console project has many implemented commands. Next steps:

– Operadores en Find
– Count
– Nested DynamicObjects and arrays in a DynamicObject
– Pretty print in console program

Then, I should manage concurrency, or at least, serialize the updates (execute them one by one). I could add:

– Server that receives line commands via TCP, with plain JSON commands to be executed, and returning results in JSON

– Clients in C#, JavaScript, PHP?

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Blog at WordPress.com.