Angel \”Java\” Lopez on Blog

July 23, 2014

Node.Js: Links, News And Resources (24)

Filed under: JavaScript, Links, NodeJs — ajlopez @ 6:22 pm

Previous Post
Next Post

Links from my collection. Recent links at http://delicious.com/ajlopez/nodejs

Multi-Room Chat Application — made by Udi Talias
http://uditalias.github.com/chat-nodejs/public/

Chat-nodejs by uditalias
http://uditalias.github.com/chat-nodejs/

japh(r) by Chris Strom: Quick Dart Benchmarking Follow-up
http://japhr.blogspot.com.ar/2012/11/quick-dart-benchmarking-follow-up.html

02×03 node.js con José F. Romaniello, Matias Woloski y Hernan Garcia – 32minutos.net
http://www.32minutos.net/?p=32

Singly (Singly)
https://github.com/Singly

Singly
https://singly.com
Singly Data Fabric pushes unified data from any apps or devices your users have authenticated directly to your database.

es.joseoncode.com – Un tutorial de node.js en castellano y en github
http://es.joseoncode.com/post/35272597285/un-tutorial-de-node-js-en-castellano-y-en-github

Why You Should Pay Attention to Node.Js – tecosystems
http://redmonk.com/sogrady/2010/05/13/node-js/

Installing Node.js via package manager · joyent/node Wiki
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

OpenROV goes to Node.js Conference in Italy – OPENROV
http://openrov.com/profiles/blogs/openrov-goes-to-node-js-conference-in-italy

OPENROV
http://openrov.com/
Robotics, Raspberry Pi, Node.js

bobrik/pupergrep
https://github.com/bobrik/pupergrep
Real-time grep for your logs right in your favorite modern browser made with Twitter Bootstrap

Table of Contents — An Introduction to libuv
http://nikhilm.github.com/uvbook/index.html

collectivemedia/node-avro
https://github.com/collectivemedia/node-avro
Avro serialization format support for Node.js

TooTallNate/node-time · GitHub
https://github.com/TooTallNate/node-time
“time.h” bindings for NodeJS

qraftlabs/node-workshop · GitHub
https://github.com/qraftlabs/node-workshop

A Gentle Introduction to Ember
http://www.infoq.com/presentations/Ember-Demo

balderdashy/sails
https://github.com/balderdashy/sails
Realtime MVC Framework for Node.js
http://sailsjs.org

Cloud Foundry Supports of Node.js Node Package Manager
http://www.cloudcomputingdevelopment.net/cloud-foundry-supports-node-js-node-package-manager/

My Links
http://delicious.com/ajlopez/nodejs

Stay tuned!

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

July 22, 2014

ClojSharp Implementing Clojure In C# (1) The Project

Since the past decade I’m interested on Clojure. It’s a return to Lisp, but in modern times.. Clojure is implemented on the Java virtual machine, but is also implemented on. NET (AFAIK, using Dynamic Language Runtime). The version of Java compiles to Java bytecodes. There is also a version of JavaScript, called ClojureScript. The community is very active, and has brought an air of renewal within Java. It has features like immutability of his work-oriented structures in multithreading, avoiding concurrency problems. It supports Software Transactional Memory, but has been less used by what I see. Web frameworks have emerged, and has a project and dependencies manager called Leiningen. Some links in my Clojure posts.

To deliberate practice TDD (Test-Driven Development) and C#, I was building an interpreter (not a compiler to bytecodes, yet). The project:

https://github.com/ajlopez/ClojSharp

Current status:

It has a class library project, and a test project. There is also a REPL (Read Eval Print Loop) simple console application.

In Lisp, an expressions is composed by a verb and arguments, written in a list enclosed by parenthesis. For example, a list that at evaluation returns the sum of 1, 2 and 3:

(+ 1 2 3)

Here, the plus + sign is a symbol that in Lisp/Clojure refers to a form. A form receives arguments, operates on them, and returns a result. A typical form receives its arguments as evaluated expressions: the expressions are evaluated BEFORE the evaluation of the form:

(+ 1 (- 3 4) 3)

In the above example, the first argument to plus is a constant 1, and the second argument is an expression that is evaluated to –1 before the evaluation of the outer list.

But there are forms that not need evaluated arguments. They receive the arguments without evaluation. They are called special forms. I have implemented:

And I have implemented some (non special) forms as primitives in C#. Most of them could be implemented in Lisp itself, but being so basic that I preferred to implement them directly in C#, using TDD as usual:

Next topics: the Machine implementation, Context, how to use Parser and Lexer, more about expression evaluation, macros, tail recursion, etc.

Stay tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

July 21, 2014

Aktores Implementing Akka Actor Model in C# (1) The Project

Filed under: .NET, Akka, Aktores, C Sharp, Open Source Projects — ajlopez @ 4:11 pm

It’s time to write about the project:

https://github.com/ajlopez/Aktores

Estoy implementando los primeros pasos hacia un modelo de actores, con pasaje de mensajes, tomando ideas de Akka. Ya había trabajado algo en Node.js, y en C# directo, teniendo actores que se mandan mensajes entre sí, pero esta vez quiero seguir el camino de Akka, paso a paso, como por ejemplo, tener nombres de actores, en un árbol, sistema de actores distribuidos, y la supervisión de agentes.

El estado del proyecto a hoy

I’m implementing the first steps towards an actor model, message passing, taking ideas from Akka. I had worked something in Node.js, and C#, having actors sending messages to each other, but this time I want to follow the path of Akka, step by step, for example, have names of actors, in a tree, distributed system of actors, and monitoring agents.

The status of the project today:

The current actor implementation:

First, an Actor is an abstract class, to be implemented in each use case. The rest of the system would not talk to an actor directly, but through a ActorRef. For example, to send a message, there is a method Tell in ActorRef. Internally, no process sends messages to the actor directly, but each actor has a Mailbox. And the mailbox is used by ActorRef to send a message to the final Actor. The Actor object is a passive object: it not manage the Mailbox directly, but there are threads that will take pending tasks, get message from Actor mailbox, and send it to the Actor. The system internally ensures that the actor receives and processes messages one by one. The actor does not have to worry about competition from multiple threads. Notably, the Actor has no direct reference to the Mailbox. More details in upcoming posts.

Stay tuned!

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

July 20, 2014

AjErl Implementing Erlang in C# (1) The Project

Filed under: .NET, AjErl, C Sharp, Erlang, Functional Programming, Open Source Projects — ajlopez @ 10:49 am

Some time ago, to practice TDD and C # and explore ideas Erlang, I started an Erlang-like interpreter in C#:

https://github.com/ajlopez/AjErl

The solution structure:

It has the core class library, draft tests, project and I am putting together a REPL (Read Eval Print Loop) as console program. The interesting thing is that Erlang internally has lightweight processes, implemented in the virtual machine itself, which can communicate with each other by sending and receiving immutable messages. I do not intend to implement a virtual machine of this type, but have processes in threads. They will never be as fast as Erlang, but it’s a first "baby step" to explore, before trying to improve implementation.

Messages can be sent to a queue per process (thread here), and I have implemented the acceptance of messages, and turn his rejection process, as in native Erlang.

But today I wanted to briefly discuss how to implement transforms input text into Erlang expressions and forms:

:

The Lexer returns tokens, and these tokens have a value and a type. It can already recognize an atom (a name that begins in lower case), a variable, delimiters, operators, integers and real numbers, strings. The Lexer is consumed by a Parser, which has two public methods: one that parses expressions, used from the REPL, and another that parses what Erlang is called a form, would like a function definition in a module of Erlang. There are also ways to declare the name of the module, or other forms exported with name and number of arguments. In these modules will not accept expressions, only statements such form.

If you look at the history of commits, you will see that not everything went ahead, but grew slowly, as small raised me to implement use cases.

Upcoming topics: discuss the implementation of expressions, forms, processes and threads with mailbox for messages, and the REPL. And keep working on the implementation of messages and distributed processes.

Nos leemos!

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

July 19, 2014

SharpGo Implementing Go in C# (1) The Project

Filed under: .NET, C Sharp, Go, Google, Open Source Projects, Programming Languages, SharpGo — ajlopez @ 5:06 pm

There is another project of mine to practice TDD (Test-Driven Development) and C#, at:

https://github.com/ajlopez/SharpGo

It is an interpreter (not a compiler) of Go programming language, written in C#. It has a class library project, and a test project. Go is a typed language, so I cannot follow the path of build an expression tree, and evaluate it, as in RubySharp, PythonSharp and Mass. Instead, the interpreter should have many phases, as in ScalaSharp, to detect type inconsistencies, and use the declaration of unknown types at the parse process.

The AST is implemented:

The AST (Abstract Syntax Tree) nodes are in two groups:

- Command Nodes, where they should generate commands to be executed.

- Expression Nodes, that generates expressions to be evaluated. They have an associated type.

The commands declare variables with types. By now, I have all in place to start:

- Declare the types of some declarations of variables and functions
- Control that types are the right ones, ie, an integer variable should not be assigned to an string expression
- Start to emit commands and expression

As in other projects, I want to add access to native .NET types, libraries and objects. I should research how many features of Go I could implement in this approarch. An example: the implementation of Go structures, and their original semantic in C#. I could implement channels (years ago, I implemented channels in C# and AjSharp).

Stay tuned!

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

July 17, 2014

ScalaSharp Simple Scala In C# (1) The Idea

Filed under: .NET, C Sharp, Open Source Projects, Programming Languages, Scala, ScalaSharp — ajlopez @ 6:32 pm

I wrote something in this blog, but it’s time to introduce it to society. Last year a few months ago, I started the project:

https://github.com/ajlopez/ScalaSharp

A simple interpreter for a simplified Scala, C #. I do not intend to implement all Scala as a compiler for CLR. NET. My intention is to explore an alternative implementation of interpreter, adopting only some “light” features of Scala.

Without being a Scala programmer (or amateur or professional) my impression is that Scala as a language and library, is something like "too much", a bit overwhelming. People adopts Scala because it is more flexible, less need "boilerplate" etc.. But it seems like Scala went too far. Having programmed in Java and C#, I think the latter, adding a few things (delegates years, lambdas, extension methods, "generics" in the VM, and recently, in asynchronous input/output, async, await), has managed to stay healthy, without major complications. See how easy it has been to implement LINQ with evaluation "lazy" and others.

Instead, Scala seems to me like it’s too many things, all together. From what I saw, type inference is a feature that is not so necessary in the real projects. And yet I can not accept that the list of operators in Scala occupies more than one web page. But hey, that’s the current state of things. People Scala is working on a new implementation, called Dotty. But if you are just doing after years of language definition, I have to declare: "too little, too late."

That does not preclude recognizing that Scala has great triumphs, non-trivial applications like Play Framework and Akka. Akka is a very interesting project. I think we don’t need so many new language features (just the ones I mentioned for C #). We need more libraries that solve some issues (such as the implementation of an asynchronous HTTP message distribution server or distributed processing among actors).

To experiment with a simplified Scala, and to deliberately practice TDD (Test-Driven Development) in C #, I started the project ScalaSharp.

It is a challenge for me, because it is not a simple interpreter. I want to implement an AST (Abstract Syntax Tree) that detects inconsistencies between types. In my previous experiences, as RubySharp, PythonSharp, and Mass language, it was only necessary to assemble a tree expressions / commands and evaluate it. Now I’ll have to check that the types are correct. For example, one variable that is typed, and that their assignments, the expression to be evaluated and assigned for the type of the variable. You can see some of the work in progress:

https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Ast

where there is a node tree with types, versus commands and expressions to be executed and evalauted:

https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Commands
https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Expressions

Upcoming topics: implementation details, control types in the AST transformation commands / expressions. The good thing to do with TDD is that it allows me to go implemented the solution as I define use cases.

Stay tuned!

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

July 16, 2014

RubySharp, implementing Ruby in C# (3)

Filed under: .NET, C Sharp, Open Source Projects, Programming Languages, Ruby, RubySharp — ajlopez @ 4:43 pm

Previous Post

In RubySharp, we can define new functions (methods of the current object), and invoke them. There are some built-in functions in C#:

Every function should implement the interface:

public interface IFunction
{
    object Apply(DynamicObject self, Context context, IList<object> values);
}

On apply, each function receives the object (self), the context for variables (locals, arguments, closure….), and a list of already evaluated arguments.

An example, the implemention of puts:

public class PutsFunction : IFunction
{
    private TextWriter writer;

    public PutsFunction(TextWriter writer)
    {
        this.writer = writer;
    }

    public object Apply(DynamicObject self, Context context, IList<object> values)
    {
        foreach (var value in values)
            this.writer.WriteLine(value);

        return null;
    }
}

It receives the object to which it is a method, the context, and a list of arguments. Each of the arguments was evaluated. The implementation simply sends the arguments to a TextWriter, one argument per line. The TextWriter is provided when the function object is created (in the Machine object, that represents the current running environment). This injected facilites the test of the function, example:

[TestMethod]
public void PutsTwoIntegers()
{
    StringWriter writer = new StringWriter();
    PutsFunction function = new PutsFunction(writer);

    Assert.IsNull(function.Apply(null, null, new object[] { 123, 456 }));

    Assert.AreEqual("123\r\n456\r\n", writer.ToString());
}

The above code was born using the TDD workflow.

Let’s see another built-in function, require:

public class RequireFunction : IFunction
{
    private Machine machine;

    public RequireFunction(Machine machine)
    {
        this.machine = machine;
    }

    public object Apply(DynamicObject self, Context context, IList<object> values)
    {
        string filename = (string)values[0];
        return this.machine.RequireFile(filename);
    }
}

This time, the job of loading a file is delegated to the Machin object, injected in the constructor.

And finally, let’s review the code of a defined function (defined in RubySharp):

public class DefinedFunction : IFunction
{
    private IExpression body;
    private IList<string> parameters;
    private Context context;

    public DefinedFunction(IExpression body, IList<string> parameters, Context context)
    {
        this.body = body;
        this.context = context;
        this.parameters = parameters;
    }

    public object Apply(DynamicObject self, Context context, IList<object> values)
    {
        Context newcontext = new Context(self, this.context);

        int k = 0;
        int cv = values.Count;

        foreach (var parameter in this.parameters) 
        {
            newcontext.SetLocalValue(parameter, values[k]);
            k++;
        }

        return this.body.Evaluate(newcontext);
    }
}

In this case, a new contexts is built, containing the new arguments to the defined function, but with the original closure, injected in the constructor. The context provided in the Apply is not used.

Next topics: some command implementations, the Machine object, the REPL, etc…

Stay tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

July 15, 2014

Meteor: Links And Resources (2)

Filed under: Links, Meteor, NodeJs, Web Development — ajlopez @ 1:54 pm

Previous Post

Bikestorming/lightsaber
https://github.com/Bikestorming/lightsaber

Meteor – YouTube
http://www.youtube.com/user/MeteorVideos/videos

An Introduction to Meteor | Stephen Walther
http://stephenwalther.com/archive/2013/03/18/an-introduction-to-meteor

EventedMind/iron-router
https://github.com/EventedMind/iron-router

sqow/multiple-view-example
https://github.com/sqow/multiple-view-example

javascript – Questions Meteor about changing view and putting array in collection – Stack Overflow
http://stackoverflow.com/questions/15278756/questions-meteor-about-changing-view-and-putting-array-in-collection

Run Meteor Apps Anywhere with Demeteorizer
http://blog.modulus.io/demeteorizer

Hosting a Meteor App on Nodejitsu | Proper
https://properapp.com/meteor/hosting-a-meteor-app-on-nodejitsu-2/#.Uv-mn_ldUms

Setting Up Tests w/ Meteor | Proper
https://properapp.com/meteor/setting-up-tests-w-meteor-2/#.Uv-m-fldUms

Simple Routing in Meteor | Proper
https://properapp.com/meteor/simple-routing-in-meteor-2/#.Uv-nAfldUms

properapp/advanced-routing-start
https://github.com/properapp/advanced-routing-start

javascript – How do I create multi-page applications with Meteor? – Stack Overflow
http://stackoverflow.com/questions/11740368/how-do-i-create-multi-page-applications-with-meteor

Advanced Routing in Meteor: Navigation State w/ Handlebars Helpers and Route Functions | Proper
https://properapp.com/meteor/advanced-routing-in-meteor-navigation-state-w/#.Uv-lvfldUms

meteor – How to install atmosphere packages without meteorite? – Stack Overflow
http://stackoverflow.com/questions/18159924/how-to-install-atmosphere-packages-without-meteorite

python – How do I access Meteor’s mongodb from another client, while meteor is running? – Stack Overflow
http://stackoverflow.com/questions/10293781/how-do-i-access-meteors-mongodb-from-another-client-while-meteor-is-running

My Links
https://delicious.com/ajlopez/meteor

Stay tuned!

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

July 14, 2014

Node.Js: Links, News And Resources (23)

Filed under: JavaScript, Links, NodeJs — ajlopez @ 7:27 pm

Previous Post
Next Post

More links from my collection. More updated links at http://delicious.com/ajlopez/nodejs

V8 javascript VM and Node.js memory management options | O sNAp
http://code.osnap.us/wp/?p=21

jkutianski/meetup-api
https://github.com/jkutianski/meetup-api
meetup-api is an Meetup.com API library written in JavaScript for Node.js

Synchronizing HTML5 Slides with Nodejs – Bocoup
http://weblog.bocoup.com/synchronizing-html5-slides-with-node-js/

pgte/node-kinect
https://github.com/pgte/node-kinect
Kinect in Node

Chrome Apps Office Hours: NodeJS in Chrome packaged apps – YouTube
http://www.youtube.com/watch?v=gkb_x9ZN0Vo&feature=g-all-lsb

Express.js by Dan Zajdband – Comunidad Nodejs Argentina – YouTube
http://www.youtube.com/watch?v=Uw46_Mub6t8&feature=youtu.be

Empezando con node.js « Working Software
http://cpaezdev.wordpress.com/2012/10/23/empezando-con-node-js/

smith
https://github.com/c9/smith
Smith is an RPC agent system for Node.JS used in vfs

SenchaCon 2010: Server-side JavaScript with Node, Connect & Express on Vimeo
http://vimeo.com/18077379

einaros/ws
https://github.com/einaros/ws
RFC-6455 WebSocket implementation for Node.js

visionmedia/axon
https://github.com/visionmedia/axon
message-oriented socket library for node.js heavily inspired by zeromq

dominictarr/JSONStream
https://github.com/dominictarr/JSONStream
rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)

paddybyers/anode
https://github.com/paddybyers/anode
Android framework for node.js applications

Creating a REST API using Node.js, Express, and MongoDB
http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

.:ceiboo:. – software development
http://www.ceiboo.com/

LearnBoost/engine.io-client
https://github.com/learnboost/engine.io-client
This is the client for Engine, the implementation of transport-based cross-browser/cross-device bi-directional communication layer for Socket.IO.

InstantWebP2P/node-httpp
https://github.com/InstantWebP2P/node-httpp
Run HTTP over UDP with Node.js for P2P and Peer Web

flatiron/blacksmith
https://github.com/flatiron/blacksmith
A generic static site generator built using flatiron, plates, and marked

Node based static site generators – Boris Mann
http://blog.bmannconsulting.com/node-static-site-generators/

PageDown – pagedown – A JavaScript Markdown converter and editor – Google Project Hosting
http://code.google.com/p/pagedown/wiki/PageDown

Micro Templates Are Dead… forget about it.blog.nodejitsu.com – scaling node.js applications one callback at a time.
http://blog.nodejitsu.com/micro-templates-are-dead

My Links
http://delicious.com/ajlopez/nodejs

Stay tuned!

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

July 13, 2014

SharpBus in C# (1) First Steps

Filed under: .NET, C Sharp, Open Source Projects, SharpBus, Test-Driven Development — ajlopez @ 11:54 am

Last month I started to write SharpBus, a simple message processor inspired by ideas from Mule Java project. See:

http://en.wikipedia.org/wiki/Mule_(software)

http://www.mulesoft.org/what-mule-esb

As usual, I’m using TDD (Test-Driven Development), implementing small use cases and API consumption, in the simplest possible way. In fact, the project is a personal exercise of TDD. I hope that some may be useful beyond that. For now, it is an example that I want to share my workflow.

You can see the progress in:

https://github.com/ajlopez/SharpBus

The main ideas to implement are:

- There are Messages containing Payloads and Properties (dictionary of name / value)

- There Flows that process messages

- A Flow is composed of several elements

The elements can be chained in the flow, and can be:

- A Transformer, taking a payload or complete message, and returns a transformed version

- A Processor, taking a payload or complete message, operate on them, maybe accessing the business domain, but without transformation

- Input, a payload/message producer

- Output, a payload/message consumer, at the end od the Flow process

- A Rourter, given a payload/message, it decides with Branch to follow in the Flow. Each Branch is identified by a name.

There will also be items that can issue new posts than the current, and can issue them to different flows in the system. The message producers should be able to run threads (Threads) in principle. And there will be a set of threads (Pool of Threads) attending the incoming messages and deriving them to the respective flows.

A flow can take a message and return a response (Request / Response), or it can take a message, process it without returning an answer.

Some items need complete Message and other items operate over the Payload.

The elements in the world of Mule / Java are objects. Notably, in C #, the simplest way to implement is using lambdas. So, following TDD, the early testing and deployment has come out that way. You can see in some simple tests:

https://github.com/ajlopez/SharpBus/blob/master/Src/SharpBus.Core.Tests/FlowTests.cs

As an example of send a Payload and receive an answer, using an empty Flow:

var flow = Flow.Create();

Assert.AreEqual(1, flow.Send(1));

To send a payload and transform it:

var flow = Flow.Create()
    .Transform(x => ((int)x) + 1);

Assert.AreEqual(2, flow.Send(1));

The .Transform Transform expects a Func<object, object> which may be provided at the time with a lambda. In a classic Java 7 Mule, we should provide an object that implements an interface having a method to transform the Payload. I have to think whether it is worth having a typed Transform <T> (receiving T and returns T), or Transform <T, S> (receiving and returns T S).

I decided to build the flow by code. In the Mule environment Spring is used to set up the flow using XML. I think it is time to explore this other way, build the flow by code, and put it as the "first way", ie, as the way on which everything else could be mounted. If anyone ever needed a DSL (Domain-Specific Language) for creating flows could be implemented this way by having well designed code.

Following TDD, I still have not a case of using a Message (a complete message with content (Payload) and properties (Properties, a name / value) dictionary. All of the above is to process Payload directly.

Upcoming topics: add Message Payload with the output of messages, routing, assembling branches, etc. ..

Stay tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

« Newer PostsOlder Posts »

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 66 other followers