Category Archives: .NET

New Month’s Resolutions: May 2015

It’s the time for review my April’s resolutions and write the new ones:

– Write posts about JavaScript and Artificial Intelligence  [pending]
– Improve ClojJS [complete] see repo
– Add npm modules support to ClojJS [pending]
– Improve Chip8 emulator [pending]
– Improve BScript [complete] see repo

Additionally, I worked on:

– Improve AcquarellaJS, first operators in match dynamic object [complete] see repo
– Improve AjErl, refactor type utilities [complete] see repo
– Improve OStore, first operators in match [complete] see repo
– Improve SimpleLists, intersect operation [complete] see repo
– Improve MeteorSamples, using Windows version 1.1 [complete] see repo
– Participate in Google Code Jam, pre-round [complete] see repo
– Liqueed Project coding [complete] see repo
– Record Liqueed Project team programming session using TDD [complete] see post/video
– Write posts about Liqueed Project [complete] read English posts read Spanish posts

The new month’s resolutions are:

– Improve ClojJS
– Add NPM support to ClojJS
– Write posts about JavaScript and Artificial Intelligence
– Give a talk about Meteor
– Prepare a talk about Clojure or ClojureScript
– Improve BScript
– Improve AjErl, distributed features
– Improve Liqueed Project, kudos features

Stay tuned!

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

New Month’s Resolutions: January 2015

A new year begins. Time to review past month’s resolutions:

– Add distributed features to AjErl, Erlang-like interpreter in C# [partial] see repo
– Improve ClojSharp [complete] see repo
– Improve SimpleLisp [complete] see repo
– Code generation with AjGenesis for Node [pending]
– Start Basic Script Language for C# [complete] see repo

Additionally, I was working on:

– Improve ScalaSharp [complete] see repo
– First operations in Chip8 emulator [complete] see repo
– Write Clojure samples (Ring, Compojure) [complete] see repo
– Work on Liqueed project [complete] see repo
– Improve AjScript [complete] see repo

This new month’s resolutions:

– Continue add distributed features to AjErl, Erlang-like interpreter in C#
– Improve ClojSharp
– Improve ScalaSharp
– Improve Chip8 emulator
– Code generation with AjGenesis for Node
– Improve Basic Script Language for C#
– Write JavaScript and Artificial Intelligence posts

Stay tuned!

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

Aktores: Implementing Actor Model In C# (2) A Simple Sample

Previous Post

Let’s review a simple sample that creates two actors, and sends messages to them. The code is at:

https://github.com/ajlopez/Aktores/tree/master/Samples/PingPong

As usual, this is “work in progress”, and could be change in the future. I’m following TDD (Test-Driven Development) workflow, so some API calls could be change when I add new use cases (as distributed samples).

In this solution, we have an actor:

using Aktores.Core;

public class PingActor : Actor
{
    private int messagecount;

    public int MessageCount { get { return this.messagecount; } }

    public override void Receive(object message)
    {
        messagecount++;
        this.Sender.Tell("ping", this.Self);
    }
}

An actor inherits from abtract class Actor. The method to implement is Receive. This method receives a message (sent by other actor, or by other object in the system). Internally, Aktores sends only one message to our instance, we don’t worry about concurrency. The above actor, when receives a message, increments a counters and sends another message to the original sender. This sender is referenced by this.Sender, DURING the process of THIS message. This property can change in the process of another message.

We have another similar actor:

using Aktores.Core;

public class PongActor : Actor
{
    private int messagecount;

    public int MessageCount { get { return this.messagecount; } }

    public override void Receive(object message)
    {
        messagecount++;
        this.Sender.Tell("pong", this.Self);
    }
}

The main program creates an actor systems, creates two actor instances, one of type Ping and the other of type Pong, and sends to them many message to process:

public static void Main(string[] args)
{
    ActorSystem system = new ActorSystem(2);
    var pingactor = new PingActor();
    var pongactor = new PongActor();
    
    var ping = system.ActorOf(pingactor);
    var pong = system.ActorOf(pongactor);

    for (int k = 0; k < 10; k++)
    {
        ping.Tell("pong", pong);
        pong.Tell("ping", ping);
    }

    // ....
}

There is additional code to show the message counters. The parameter 2 in the constructor of ActorSystem indicates the number of internal threads to use to process message. I should review if such info should be specified here. Two threads are enough becase we have only two actor instances, but we could have more actors.

Stay tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

New Month’s Resolutions: December 2014

It’s time to review past month’s resolutions:

– Give a talk about JavaScript and Artificial Intelligence [complete] see repo see talk read Spanish post
– Neural network in JavaScript example [complete] see repo
– Genetic Algorithms in JavaScript example [complete] see repo
– More Code Generation using AjGenesis for NodeJs [pending]
– Basic Script Language for C# [pending]
– Improve SimpleScript for JavaScript [complete] see repo

Also, I was working on:

– Improve SimpleLisp, Lisp to JavaScript compiler [complete] see repo
– Improve RuScript, Ruby interpreter in JavaScript [complete] see repo
– Improve RustScript, Rust-like interpreter in JavaScript [complete] see repo
– Create SimpleDT, simple decision tree in JavaScript [complete] see repo
– Improve ClojSharp, Clojure-like interpreter in C# [complete] see repo
– Backgammon evaluation page [complete] see repo

This new month’s resolutions:

– Add distributed features to AjElr, Erlang-like interpreter in C#
– Improve ClojSharp
– Improve SimpleLisp
– Code generation with AjGenesis for Node
– Start Basic Script Language for C#

Stay tuned!

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

New Month’s Resolutions: November 2014

Time to review past month’s resolutions:

– Give a talk Aktores intro [complete] see repo see presentation
– Distributed AjErl [pending]
– More Express samples in AjTalkJs [complete] see repo
– Explore neural networks in JavaScript [complete] see repo
– Explore genetic algorithms in JavaScript [partial] see repo
– Explore other artificial intelligence topics in JavaScript [partial]
– More Distributed Aktores [pending]
– Start Distributed Smalltalk in AjTalkJs [complete] see repo

My new month’s resolutions:

– Give a talk about JavaScript and Artificial Intelligence
– Neural network in JavaScript example
– Genetic Algorithms in JavaScript example
– More Code Generation using AjGenesis for NodeJs
– Basic Script Language for C#
– Improve SimpleScript for JavaScript

Stay tuned!

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

New Month’s Resolutions: October 2014

Time to write my technical new month’s resolutions. But first, review of past month’s ones:

– Distributed Aktores [complete] see repo
– Distributed AjErl [pending]
– Web support and example for RuScript [partial] see repo
– Complete Mochy [partial] see repo
– Improve RSharp [complete] see repo
– Work with NodeJs on Deep Learning, Internet of Things, Artificial Intelligence [pending]
– Work on Code Generation using AjGenesis for Node [complete] see main repo see Express repo see Sinatra repo see Laravel repo
– Work on Liqueed Project [complete] see repo

Additional, I worked on

– Improve AjScript [complete] see repo
– Refactor BasicScript tests to use SimpleUnit [complete] see repo
– Create SimpleColls, simple collection functions in JavaScript, alone or a la Linq [complete] see repo
– Refactor SimpleStore tests to use SimpleUnit [complete] see repo
– Improve AjTalkJs, Smalltalk in JavaScript, support for super, Express 4 first sample [complete] see repo
– Refactor MProc tests to use SimpleUnit [complete] see repo
– Refactor AjLogoJs tests to use SimpleUnit [complete] see repo
– Refactor SimpleKeeper tests to use SimpleUnit [complete] see repo
– Refactor SimpleTags tests to use SimpleUnit [complete] see repo
– Improve SimpleUnit, publish new version [complete] see repo
– Refactor SimplePipes tests to use SimpleUnit, and publish new version [complete] see repo

My new month’s resolutions:

– Give a talk Aktores intro
– Distributed AjErl
– More Express samples in AjTalkJs
– Explore neural networks in JavaScript
– Explore genetic algorithms in JavaScript
– Explore other artificial intelligence topics in JavaScript
– More Distributed Aktores
– Start Distributed Smalltalk in AjTalkJs

Stay tuned!

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

New Month’s Resolutions: September 2014

A bit late, time to review my August’s Resolutions:

– Write jQuery mock to be used in console tests/Node.js [complete] see repo
– Write simple functions in JavaScript for array manipulation [complete] see repo
– Continue with Liqueed project [complete] see repo
– Start with Distributed Aktores [partial] see repo
– Startwith Distributed AjErl [pending]

Additionally, I worked on:

– Give an intro talk about Express [complete] see repo see presentation see samples
– Improve AjScript [complete] see repo
– Improve RuScript, Ruby interpreter in JavaScript [complete] see repo
– Refactor SimplePipes [complete] see repo
– Generate Node.js/Express server code from RAML [complete] see repo
– Create Dynamic Site from JSON to Express [complete] see repo
– Improve RustScript, Rust interpreter in JavaScript [complete] see repo
– Create Mochy, test framework a la Mocha [complete] see repo
– Create RSharp, R language interpreter in C# [complete] see repo
– Refactor (and simplify) SimpleRules, rule engine in JavaScript [complete] see repo
– First samples for SimpleMule [complete] see repo
– Improve output for SimpleUnit [complete] see repo

My new month’s resolutions:

– Distributed Aktores
– Distributed AjErl
– Web support and example for RuScript
– Complete Mochy
– Improve RSharp
– Work with NodeJs on Deep Learning, Internet of Things, Artificial Intelligence
– Work on Code Generation using AjGenesis for Node
– Work on Liqueed Project

Stay tuned!

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