Category Archives: Cloud Computing

ClojureScript: Links And Resources (4)

Previous Post
Next Post

More (historical) links about ClojureScript. Updated links at end.

ClojureScript Core.Async Dots Game



A Shorter Path from Clojure to ClojureScript

ClojureScript Source Maps

cemerick/austin · GitHub
The ClojureScript browser-REPL rebuilt stronger, faster, easier.

FRP in ClojureScript with Javelin

David Nolen: ClojureScript: Lisp’s Revenge on Vimeo


Functional Programming Is A Scam!

Language Extensions for Clojurescript

Clojure Cup 2013

tailrecursion/javelin · GitHub
Spreadsheet-like dataflow programming in ClojureScript.

Introducing Javelin: an FRP library for ClojureScript – tailrecursion

clojure/core.logic · GitHub
A logic programming library for Clojure & ClojureScript

ibdknox/ChromaShift · GitHub

ibdknox/gambit · GitHub
An entity-component-system framework for building games in ClojureScript

xavi/noir-auth-app · GitHub
A complete authentication web app based on Clojure/ClojureScript, Compojure, lib-noir, Enlive and MongoDB.

Chris Granger – A new Light Table experience

bodil/dogfort · GitHub
An experimental web server framework for ClojureScript on Node.js

My Links

Stay tuned!

Angel “Java” Lopez

Azure: Links, News and Resources (3)

Previous Post

More links I collected during my work and research.

Cyan – Simpler than Azure
Cyan is a .NET dynamic client for the Azure Table Storage REST API.

Azure Table Storage & Dynamic TableServiceEntity

richorama / AzureSugar
Syntactic sugar to make Azure development a little sweeter
Support is also available for using dynamic types (or dictionaries) to insert and query table storage.

Azure Table Storage with dynamic entities objects

WindowsAzure / azure-sdk-for-node

Accessing Azure Role Environment information from NodeJS

Windows Azure Startup task to run npm install to avoid deploying node modules

Leveraging Node.js’ libuv in Windows Azure

Getting the samples to work on the Azure Node.js SDK

Microsoft will add Linux virtual machines to Windows Azure

Create Hosted Service using Windows Azure Management API

Microsoft Windows Azure PaaS Gets Node.js Update

How to deploy WordPress using the Windows Azure SDK for PHP WordPress scaffold

Advertising Company Adopts Cloud Computing, Gets 400 Percent Improvement

Game Developer Meets Demand and Prepares for Success with Scalable Cloud Solution

What is Windows Azure?

Azure On GitHub

Azure: Running Multiple Web Sites in a Single WebRole

Deploying independent web applications to Windows Azure using single web role

Modificar el tiempo de vida del token proporcionado por Windows Azure AppFabric Access Control

Windows Azure Multi Application
Windows Azure Multi Application is a complete sample solution that allow deploy dinamically aplications to existing role instance.
After deploy admin tool new application can be deployed, without modify initial azure deployment. Each application can be deployed independently and can be of different types; ASP.NET WebForms, ASP.NET MVC, Windows Service, Console Application…

How to combine a Worker Role and an MVC4 Web Role into a single Azure instance

Hadoop Streaming and F# MapReduce

Windows Azure Architecture Guide – Part 2 – Code Samples

Windows Azure + a pinch of UK

Using Amazon and Azure Cloud Services in your Delphi XE2 and C++Builder XE2 Applications

What’s new in Windows Azure

Microsoft Azure gets an open source rival

Introduction to the Hadoop on Azure Interactive JavaScript Console

Node.JS in Windows Azure

Azure price cuts, bigger databases, now with node.js and MongoDB support, Hadoop on its way

Improved Developer Experience, Interoperability, and Scalability on Windows Azure

Azure Node.js Developer Center

Deploying Node.js Applications to Windows Azure via Blobs or Git Sync

Ten Basic Troubleshooting Tips for Windows Azure

Now Available! Updated Windows Azure SDK & Windows Azure HPC Scheduler SDK

My Links

What is Windows Azure?

Past year, I wrote many blog post about Azure programming. Maybe, you know about cloud computing in general, but not about Azure in particular. Today, thanks to Windows Azure + a pinch of UK published by Eric Nelson (@ericnel), I found this video, that explain in simple terms the key technical pieces of Azure:

For more information about the video, see Steve Marx (@smarx) post:

What is Windows Azure? (a Hand-Drawn Video)

It has an interesting section title: “How I Made It”.

Notice the difference of compute nodes and storage nodes. Both service can be emulated in your local machine, thanks to Azure tools for Visual Studio.

My links about azure:

A post about Azure, games and Node.js is comming.

Keep tuned!

Angel “Java” Lopez

Azure: Links, News and Resources (2)

Previous Post
Next Post

More links related to Azure:

The Windows Azure Platform[2] is a Microsoft cloud platform used to build, host and scale web applications through Microsoft data centers. Windows Azure Platform is thus classified as platform as a service and forms part of Microsoft’s cloud computing strategy, along with their software as a service offering, Microsoft Online Services. The platform consists of various on-demand services hosted in Microsoft data centers and commoditized through three product brands. These are Windows Azure[3] (an operating system providing scalable compute and storage facilities), SQL Azure (a cloud-based, scale-out version of SQL Server) and Windows Azure AppFabric (a collection of services supporting applications both in the cloud and on premise).

Moving to Windows Azure

Build 2011: Windows Azure Tackles the ‘One True Login’ Puzzle

Microsoft to eat its own cloud dog food with Photosynth

Command-Query Separation on Windows Azure

How to Manage Expiration of Blob Content

Windows Azure Design Patterns, Part 1: Architectural Symbols

Windows Azure Accelerator for Web Roles Version 1.1

Running Processes in Windows Azure

pekkah / AzureSamples

Exercise 1: Using Worker Role External Endpoints

Building Web APIs in Windows Azure with WCF to reach any device

pofallon / node-azure
A node.js library for accessing the Windows Azure REST API’s

Introducing Geo-replication for Windows Azure Storage

Windows Azure Tables: Introducing Upsert and Query Projection

Windows Azure Blobs: Improved HTTP Headers for Resume on Download and a Change in If-Match Conditions

CloudCopy Command Line Tool

Windows Azure Toolkits for Devices – Now With Android!

Microsoft rolls out Windows Azure toolkit for Android

Windows Azure SDK for PHP

Azure Tip: Consider Remote Desktop when Planning Role Endpoints

Memcached in Windows Azure

NodeJS on Windows Azure

Using Windows Azure to use as a TCP Server

Windows Azure Tip: Go Beyond 5 Endpoints per Role, beyond 25 per Deployment

Lightweight Tracing to Windows Azure Tables

Using ELMAH in Windows Azure with Table Storage

Windows Phone 7 Push Notification QuickApp / Web Service (With Azure Publishing Instructions!)–Web-Service-With-Azure-Publishing-Instructions

Various Options to Manage Session State in Windows Azure

Windows Azure & WF 4.0 – Creating a Workflow-Driven WorkerRole

Microsoft announced Windows Azure Storage Analytics

Azure Cloud to Capture RenderMan

igrating SQL server Data to SQL Azure using BCP << Paras Doshi

Using Windows Azure Blob Storage and CDN with WordPress

Practical Testing Techniques for Windows Azure Applications

Daytona: Iterative MapReduce on Windows Azure

Connecting to SQL Azure from Ruby Applications

Ideas about NoSql on Windows Azure: Azure Storage

Architecture of Tankster– Scale (Part 2)

Windows Azure CDN Helpers

Social Gaming on Windows Azure

Extending the Windows Azure Accelerator for Web Roles with PHP and MVC3

Ajax, Cross Domain, jQuery, WCF Web API or MVC, Windows Azure

smarx / blobedit
Simple UI (based on Ace) to edit code files in Windows Azure blob storage

sriramk / winazurestorage
Python client wrapper for Windows Azure storage

Azure BlobStorage Javascript Library

Using Windows Azure Page Blobs and How to Efficiently Upload and Download Page Blobs

Building Java applications on Windows Azure gets easier with the new version of the Eclipse plugin

My Links

Keep tuned!

Angel “Java” Lopez

Azure: Fractal application

In January, I reimplemented my Fractal application, now using Azure (my Azure-related posts). The idea is to calculate each sector of a fractal image, using the power of worker roles, store the result in blobs, and consume them from a WinForm application.

This is the solution:

The source code is in my AjCodeKatas Google project. The code is at:

If you are lazy to use SVN, this is the current frozen code:

The projects in the solution:

AzureFractal: the Azure cloud definition.

Fractal: it contains my original code from previous fractal applications. An independent library class.

Fractal.Azure: serialization utilities of fractal info, and a service facade to post that info to a Azure message queue.

AzureLibrary: utility classes I used in other Azure examples. They are evolving in each example.

FractalWorkerRole: the worker role that consumes messages indicating what sector (rectangle) of the Mandelbrot fractal to calculate.

Fractal.GUI: a client WinForm project that sends and receives message to/from the worker role, using Azure queues.

You should configure the solution to have a multiple startup:

The WinForm application sends a message to a queue, with the info about the fractal sector to calculate:

private void Calculate()
    Bitmap bitmap = new Bitmap(pcbFractal.Width, 
    pcbFractal.Image = bitmap;
    realWidth = realDelta * pcbFractal.Width;
    imgHeight = imgDelta * pcbFractal.Height;
    realMin = realCenter - realWidth / 2;
    imgMin = imgCenter - imgHeight / 2;
    int width = pcbFractal.Width;
    int height = pcbFractal.Height;
    Guid id = Guid.NewGuid();
    SectorInfo sectorinfo = new SectorInfo()
        Id = id,
        FromX = 0,
        FromY = 0,
        Width = width,
        Height = height,
        RealMinimum = realMin,
        ImgMinimum = imgMin,
        Delta = realDelta,
        MaxIterations = colors.Length,
        MaxValue = 4
    Calculator calculator = new Calculator();

The worker role reads messages from the queue, and deserialize SectorInfo:

while (true)
    CloudQueueMessage msg = queue.GetMessage();
    if (msg != null)
        Trace.WriteLine(string.Format("Processing {0}", msg.AsString));
        SectorInfo info = SectorUtilities.FromMessageToSectorInfo(msg);

If the sector is too big, new messages are generated:

if (info.Width > 100 || info.Height > 100)
    Trace.WriteLine("Splitting message...");
    for (int x = 0; x < info.Width; x += 100)
        for (int y = 0; y < info.Height; y += 100)
            SectorInfo newinfo = info.Clone();
            newinfo.FromX = x + info.FromX;
            newinfo.FromY = y + info.FromY;
            newinfo.Width = Math.Min(100, info.Width - x);
            newinfo.Height = Math.Min(100, info.Height - y);
            CloudQueueMessage newmsg = 

If the sector is small enough, then it is processed:

Trace.WriteLine("Processing message...");
Sector sector = calculator.CalculateSector(info);
string blobname = string.Format("{0}.{1}.{2}.{3}.{4}", 
info.Id, sector.FromX, sector.FromY, sector.Width, sector.Height);
CloudBlob blob = blobContainer.GetBlobReference(blobname);
MemoryStream stream = new MemoryStream();
BinaryWriter writer =new BinaryWriter(stream);
foreach (int value in sector.Values)
stream.Seek(0, SeekOrigin.Begin);
CloudQueueMessage outmsg = new CloudQueueMessage(blobname);

A blob with the result is generated, and a message is sent to another queue to notify the client application.

The WinForm has a thread with a loop reading messages from the second queue:

string blobname = msg.AsString;
CloudBlob blob = this.blobContainer.GetBlobReference(blobname);
MemoryStream stream = new MemoryStream();
string[] parameters = blobname.Split('.');
Guid id = new Guid(parameters[0]);
int fromx = Int32.Parse(parameters[1]);
int fromy = Int32.Parse(parameters[2]);
int width = Int32.Parse(parameters[3]);
int height = Int32.Parse(parameters[4]);
int[] values = new int[width * height];
stream.Seek(0, SeekOrigin.Begin);
BinaryReader reader = new BinaryReader(stream);
for (int k = 0; k < values.Length; k++)
    values[k] = reader.ReadInt32();
this.Invoke((Action<int,int,int,int,int[]>) ((x,y,h,w,v) 
this.DrawValues(x,y,h,w,v)), fromx, fromy, width, height, values);

Note the use of .Invoke to run the drawing of the image in the UI thread.

This is the WinForm app, after click on Calculate button. Note that the sectors are arriving:

There are some blob sectors that are still not arrived. You can drag the mouse to have a new sector:

You can change the colors, clicking on New Colors button:

This is a sample application, a “proof-of-concept”. Probably, you will get a better performance if you use a single machine. But the idea is that you can defer work to worker roles, specially if the work can be do in parallel (imagine a parallel render machine, for animations). If you run these an application in Azure, with many worker roles, the performance could be improved.

Next steps: implement a distributed web crawler, try distributed genetic algorithm, running in the Azure cloud.

Keep tuned!

Angel “Java” Lopez

Azure: A simple Application using Tables

Continuing with my Azure examples, this time I wrote a simple CRUD Web applications, using Tables, using Azure Storage Client.

It’s a classic ASP.NET application, this is the view for Customer/Index action:

You can download the solution from my AjCodeKatas Google project. The code is at:

If you want the current frozen version:

The simple entity Customer:

public class Customer : TableServiceEntity
    public Customer()
        : this(Guid.NewGuid().ToString())
    public Customer(string id)
        : base(id, string.Empty)
    public string Name { get; set; }
    public string Address { get; set; }
    public string Notes { get; set; }

I’m using the PartitionKey as the primary key, filling it with a Guid. The RowKey is the empty string. In a less simple application, I could save the invoices of a customer using the same partition key, and identifing each invoice with its RowKey.

A DataContext is in charge of expose an IQueryable of Customers:

public class DataContext : TableServiceContext
    public const string CustomerTableName = "Customers";
    public DataContext(string baseAddress, StorageCredentials credentials)
        : base(baseAddress, credentials)
        this.IgnoreResourceNotFoundException = true;
    public DataContext(CloudStorageAccount storageAccount)
        : base(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials)
        this.IgnoreResourceNotFoundException = true;
    public IQueryable<Customer> Customers
            return this.CreateQuery<Customer>(CustomerTableName);

Note the IgnoreNotFoundException: if true, I can retrieve an inexistent customer, and instead of raise an exception, return a null value.

There is a service to access and manage Customers:

public class CustomerServices
    private DataContext context;
    public CustomerServices(DataContext context)
        this.context = context;
    public Customer GetCustomerById(string id)
        return this.context.Customers.Where(c => c.PartitionKey == id).SingleOrDefault();
    public IEnumerable<Customer> GetCustomerList()
        return this.context.Customers.ToList().OrderBy(c => c.Name);
    public void AddCustomer(Customer customer)
        this.context.AddObject(DataContext.CustomerTableName, customer);
    public void UpdateCustomer(Customer customer)
        this.context.AttachTo(DataContext.CustomerTableName, customer, "*");
    public void DeleteCustomerById(string id)
        Customer c = this.GetCustomerById(id);

Note the Attach using ETag (third parameter) of “*” (any). This way, I can update the customer attaching the “in-memory-created” one to the data context, without retrieving it from the database. This approarch is viable if I have all the data of the customer. In most application you change only some fields, so you should retrieve the object, change it, and then, save the changes.

Using the service to retrieve the customers:

CloudStorageAccount storage = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
CustomerServices services = new CustomerServices(new DataContext(storage));
this.grdCustomerList.DataSource = services.GetCustomerList();

Note: it’s a sample application, simple and direct. A real application should separate the view model from the business model, and maybe, use an ASP.NET MVC front end. I will write this example, using MVC. In another series (out of Azure), I want to write an app using ASP.NET MVC AND TDD.

Next steps in Azure: a distributed fractal application, a distributed web crawler, implement a distributed genetic algorithm, using worker roles.

Keep tuned!

Angel “Java” Lopez

Azure: Multithreads in Worker Role, an example

In my previous post, I implemented a simple worker role, consuming and producing numbers from/to a queue. Now, I have a new app:

The worker role implements the generation of a Collatz sequence. See:

You can download the solution from my AjCodeKatas Google project. The code is at:

The initial page is simple:

The number range is send to the queue:

protected void btnProcess_Click(object sender, EventArgs e)
    int from = Convert.ToInt32(txtFromNumber.Text);
    int to = Convert.ToInt32(txtToNumber.Text);
    for (int k=from; k<=to; k++) 
        CloudQueueMessage msg = new CloudQueueMessage(k.ToString());

The worker role gets each of these message, and calculates the Collatz sequence:

I added a new feature in Azure.Library: a MessageProcessor that can consumes message from a queue, in its own thread:

public MessageProcessor(CloudQueue queue, Func<CloudQueueMessage, bool> process)
    this.queue = queue;
    this.process = process;
public void Start()
    Thread thread = new Thread(new ThreadStart(this.Run));
public void Run()
    while (true)
            CloudQueueMessage msg = this.queue.GetMessage();
            if (this.ProcessMessage(msg))
        catch (Exception ex)
            Trace.WriteLine(ex.Message, "Error");
public virtual bool ProcessMessage(CloudQueueMessage msg)
    if (msg != null && this.process != null)
        return this.process(msg);
    Trace.WriteLine("Working", "Information");
    return false;

Then, the worker role is launching a fixed number (12) of MessageProcessor. In this way, each instance is dedicated to process many message. I guess that this is not needed in this example. But it was an easy “proof of concept” to test the idea. Part of Run method in worker role;

QueueUtilities qutil = new QueueUtilities(account);
CloudQueue queue = qutil.CreateQueueIfNotExists("numbers");
CloudQueueClient qclient = account.CreateCloudQueueClient();
for (int k=0; k<11; k++) 
    CloudQueue q = qclient.GetQueueReference("numbers");
    MessageProcessor p = new MessageProcessor(q, this.ProcessMessage);
MessageProcessor processor = new MessageProcessor(queue, this.ProcessMessage);

The ProcessMessage is in charge of the real work:

private bool ProcessMessage(CloudQueueMessage msg)
    int number = Convert.ToInt32(msg.AsString);
    List<int> numbers = new List<int>() { number };
    while (number > 1)
        if ((number % 2) == 0)
            number = number / 2;
            number = number * 3 + 1;
    StringBuilder builder = new StringBuilder();
    foreach (int n in numbers)
        builder.Append(" ");
    Trace.WriteLine(builder.ToString(), "Information");
    return true;

The code of this example is in my

Next steps: more distributed apps (genetic algorithm, web crawler…)

Keep tuned!

Angel “Java” Lopez

Azure: a simple application

This is my first post here, about Azure programming. An easy start: an application with one web role, and one worker role:

You can download the solution from my AjCodeKatas Google project. The code is at:

In the initial web page you can enter a number to process:

If you send the number 10, this data is send to a queue:

protected void btnProcess_Click(object sender, EventArgs e)
    int number = Convert.ToInt32(txtNumber.Text);
    CloudQueueMessage msg = new CloudQueueMessage(number.ToString());

The worker role is reading the queue. It decrements the number, and if the result is still positive, it is reinjected in the queue:

        public override void Run()
            // This is a sample worker implementation. Replace with your logic.
            Trace.WriteLine("NumberWorkerRole entry point called", "Information");
            CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            QueueUtilities qutil = new QueueUtilities(account);
            CloudQueue queue = qutil.CreateQueueIfNotExists("numbers");
            while (true)
                CloudQueueMessage msg = queue.GetMessage();
                if (msg != null)
                    int number = Convert.ToInt32(msg.AsString);
                    Trace.WriteLine(string.Format("Processing number: {0}", number), "Information");
                    if (number > 0)
                        CloudQueueMessage newmsg = new CloudQueueMessage(number.ToString());
                    Trace.WriteLine("Working", "Information");

You can see the output at Development Fabric UI:

Note the use of AzureLibrary to create a Queue:

        public CloudQueue CreateQueueIfNotExists(string queuename)
            CloudQueueClient queueStorage = this.account.CreateCloudQueueClient();
            CloudQueue queue = queueStorage.GetQueueReference(queuename);
            Trace.WriteLine("Creating queue...", "Information");
            Boolean queuecreated = false;
            while (queuecreated == false)
                    queuecreated = true;
                catch (StorageClientException e)
                    if (e.ErrorCode == StorageErrorCode.TransportError)
                        Trace.TraceError(string.Format("Connect failure! The most likely reason is that the local " +
                            "Development Storage tool is not running or your storage account configuration is incorrect. " +
                            "Message: '{0}'", e.Message));
            return queue;

I borrowed part of this code from Azure SDK samples.

Next steps to explore:

– Add instrumentation to worker role

– Use more instances, and generate more message (an explosion-like pattern)

– Add multithreading support in the worker role

– Example using table and blob storage

And the big ones:

– Inject and run AjSharp (or AjTalk) code at worker roles

– Implements a distributed application using roles (distributed genetic algorithm, distributed fractal or ray-tracer, montecarlo simulation, etc…)

Keep tuned!

Angel “Java” Lopez

Twitter as the Ultimate Service Bus for Applications

I want to describe a proposal about using Twitter from applications. I guess this idea is not new, and that there are some real implementations in twittersphere. My point is to describe something simple and extensible.

Suppose you want to operate in a virtual marketplace. Actually, you are going to a website, enter your offer, wait for replies. An alternative method could be to use a Twitter account to send offer messages.

Something like this:

Every other application could read the feed from @ajmarket and then take action: response, make a counteroffer, publish it in a website, do market analysis, etc.

I propose a message format:

If you need to send more information, you can add links to data (possibly in JSON format, ok, it could be XML, but I prefer JSON):

Each application should define the valid verbs and arguments. The application that reads the messages (or write new ones) can be distributed, no need to have a entry point, in a URL. Twitter account is the more flexible entry point for such kind of applications.

Imagine you can build anything that involves many applications sending messages to possible many applications.

Even more: each application twitter account could be viewed as an agent. If you need to plan a trip, an “intelligent” application could be listen on Twitter, and take conversations with other Twitter agents to resolve your plan or problem.

The underlying application could run in Azure, Amazon, your own center. You can switch or support other message transport, Yammer instead of Twitter, or anything alike in the future.

Abstract: use Twitter as a pubsub channel, with a simple but flexible message format.

It should be something like this out there.

Keep tuned!

Angel “Java” Lopez

NHibernate running in the Azure Cloud

Yesterday, I was talking with Fabio Maulo (@fabiomaulo) about many things, related to software development, teaching programming and, of course, NHibernate. We are living in Buenos Aires, Argentina, and it was a pleasure to talk with him, as usual. Í’m following Fabio in Twitter, and I’m a suscriber of his blog. Fabio is collaborating with NHibernate project for years, and he is a recognized developer in the .NET software community.

He told me details about a site built using NHibernate, and running on SQL Azure. You can see it online (Spanish content, Mexican site):

Fabio and his team worked hard to write this site, in less of a month (I’m waiting the team posts, with more detailed info, so, I’ll write only about the public parts here).

Curiously, the site is running using WebForms, but without ViewState, and without form tags embracing the full body inner HTML. All we are waiting Maulo and his team, explaining the implementation details. The code is based on using Model View Presenter, and it was build using tests, mocks and stubs, from presentation to persistence. Hey, Fabio! Please, write about the process and architecture decisions! 🙂

More info about NHibernate and Azure:

NHibernate on the cloud: SQL Azure Ayende NHibernate test results on Azure

Quick news NHibernate with SQL Azure Fabio’s first steps “All work… even the SchemaExport.” !!

NHibernate dialect for SQL Azure Adjustments for SchemaExport

I’m collecting links about NHibernate and Azure at:

There is an excellent post serie from Brad Adams, explaining Azure, Azure SQL, NHibernate, Silverlight, RIA .NET Service, and more:

Index for Business Apps example for Silverligth 3 RTM and .NET RIA Services July Update

Related to NHibernate and Azure, in that series:

Part 20: NHibernate
Part 23: Azure

Any other project using NHibernate on the cloud?

Angel “Java” Lopez