Feeds:
Posts
Comments

Posts Tagged ‘Erlang’

Nexus 7

Nexus 7

VM

VM

As you know, for my Ph.D. I’m developing a specialized version of Erlang for IoT scenarios, called ELIoT (ErLang for the Internet of Things); we had it running on some known (or less known) devices, such as the Raspberry Pi or the Carambola, and in the last few days I decided it was time for Android to enter the scene.

So I ported the framework forward a couple of minor versions (from Erlang 15B to 15B03.1), and used the existing patches to cross-compile it on Android. The screenshots show it running on my Nexus 7, pinging a Linux VM running on my computer. Unfortunately, for now it has to be run as root, so the next step is to try this SL4A stuff (which was in the original patch set, but as of now it simply crashes, so being root was the easiest way to try everything).

P.S.: don’t worry about the debugging prints on the VM side, they were there simply to check that no strange bytes were passing as messages on the network.

Read Full Post »

Just a little wrapper around the SPIdev userspace kernel module; it works brilliantly on the Raspberry Pi, but before trying it you need to load the SPI module and chown the devices as follows:

sudo modprobe spi_bcm2708
sudo chown `id -u`.`id -g` /dev/spidev0.*

You can find the code here.

Read Full Post »

Edit: too much rush, looks like the code may need a slight addition, I will update it later…

So, after Martin Odersky’s lesson and its example of phone mnemonics (inspired by this article), I spent a little time and wrote an implementation in Erlang.

It may not be the best one, but it seems to work; you can find it here, for using it you need to fill in the WORDS constant with the strings which you can translate from numbers and call the translate method passing a number as string (i.e., mnemonics:translate(“5828″)).

The code follows the solution provided by Martin in his slides, maybe the code could be even more compact by using a different workflow, but I’m not sure.

Read Full Post »

This slideshow requires JavaScript.

Farò un post rapido e senza estratti di codice, dato che al momento tutta l’applicazione è un po’ messy: questo weekend ho installato una piccola Wireless Sensor Network a casa, così da avere (finalmente!) una misurazione delle temperature presenti sul soppalco e nel soggiorno del posto dove abito, ed allo stesso tempo per testare il software che stiamo per usare in un’installazione per un progetto che sto seguendo in università.

Il giro software ammetto che è lievemente complicato, e sarebbe stato più semplice usare un servizio tipo Cosm per risolverlo in parte, ma dove sarebbe il divertimento? I due nodi della WSN che fungono da sensori rilevano una volta al minuto la temperatura e l’umidità dell’ambiente dove si trovano, utilizzando un piccolo programma TinyOS che utilizza un protocollo di disseminazione sviluppato da alcuni colleghi; un terzo nodo funge da sink e riceve i dati dai primi due, ed è collegato alla porta USB di una Carambola; un secondo programma viene eseguito in quest’ultima, appoggiandosi ad una libreria C già presente in TinyOS, e da un lato riceve i messaggi e li inoltra al server che raccoglie i dati, dall’altro lato permette di modificare alcuni parametri dell’applicazione situata nei sensori.

Il server è un free tier su Amazon, ed un terzo programma, scritto in Erlang, riceve i messaggi tramite la rete, li deserializza (operazione estremamente semplice data la bit syntax del linguaggio) e li salva in un database Mnesia; un Web server poi pubblica tali dati tramite JSON verso una pagina Web estremamente semplice (presente in una delle figure), scritta utilizzando Highcharts, la quale mostra i grafici (con tanto di possibilità di zoom e cose simili).

Tutto questo ha permesso di sperimentare tutta una serie di tecnologie, dall’applicazione TinyOS (che riutilizzeremo altrove) alla libreria C, dalla bit syntax in un contesto reale all’utilizzo di Mnesia come database; ammetto inizialmente di aver pensato ad un NoSQL serio, mentre Mnesia è più una sorta di via di mezzo tra SQL e NoSQL, nel senso che non supporta questo linguaggio ma allo stesso tempo richiede uno schema dei dati (a differenza di altri tipo CouchDB).

La parte messy sta in realtà nell’applicazione Erlang, che è mescolata con una versione precedente che avevo usato accoppiata con un Arduino per raccogliere dati da un accelerometro; tra l’altro, ho anche sperimentato la generazione (semi-)automatica di releases di un programma con Erlang, e l’installazione a caldo degli aggiornamenti: spettacolare!

Read Full Post »

Netduino + Ethernet shield

Netduino + Ethernet shield

Due righe come scusa per pubblicare la foto qui sopra: sto lavorando su una sorta di porting del porting dell’interfaccia Erlang – Java per C# sul .NET Micro Framework, ed in particolare sul Netduino che posseggo; lungo la strada, sto anche debuggando il driver per l’Ethernet shield (questo perchè non ho comprato il Netduino Plus a suo tempo, grave errore)… vi farò sapere!

Read Full Post »

A couple of weeks ago, a new major version of the Erlang runtime system and libraries has been released, and after its inclusion in the Experimental branch of Debian, I have ported it to Ubuntu 11.10 and published the packages on my PPA.

The packages are the same of the Debian release, I have not changed anything; I don’t know if I will have time to backport it to the previous Ubuntu releases, especially because I am not using them anymore. As usual, IWFM:  if you experience any problems, you can report them to me, but as I am not an official maintainer, I don’t know if I will be able to solve them :)

Read Full Post »

Ecco le slides della presentazione dell’articolo prodotto a partire dal mio lavoro di tesi magistrale; la conferenza in questione è TOOLS Europe 2011, tenutasi a Zurigo dal 28 al 30 giugno 2011.

Read Full Post »

I have just published the packages for the latest version (R14B03) of Erlang: as usual, you can find them in my PPA.

As a reminder, they have been backported directly from Debian Unstable, without changes, so they work for me and may work for you, but I have published them “as are“, and I am not taking any responsibility for bad behavior.

Read Full Post »

(Edit: lo davo per scontato, ma meglio chiarirlo: nel grafico sottostante l’asse Y è misurato in millisecondi di esecuzione per ciascun test, quindi un valore inferiore è preferibile)

Uno dei punti di forza da sempre declamati di Erlang è la capacità del runtime di gestire la concorrenza anche di migliaia di processi leggeri, grazie alle capacità del runtime, sviluppato appositamente attorno (tra le altre cose) a questa caratteristica. E’ anche il motivo per cui si dice che linguaggi concorrenti implementati su altre macchine virtuali (ad esempio, Scala sulla JVM) non potranno mai avere le medesime prestazioni.

Ebbene, dopo un post intrigante in una mailing list, ho esplorato le prestazioni del progetto Erjang (Erlang sulla JVM) versus Erlang stesso, utilizzando un programma di test distribuito direttamente con i sorgenti di quel progetto: gli autori di Erjang stesso dichiarano che le performance sono, in media, in linea con quelle del runtime originario; il mio test è stato fatto sull’Atom N270 dell’Eeepc, ed è interessante vedere come in alcuni punti la versione Java riesca ad avere le performances più alte.

Grafico del confronto

Grafico del confronto

Ammetto di non aver fatto i test in modo eccessivamente scientifico, in ogni caso i valori sono stati presi alla seconda esecuzione del test stesso, supponendo che la prima possa essere inficiata dal caricamento o dalla compilazione del codice.

Read Full Post »

Erlang R14B02 has been uploaded a few days ago in Debian Unstable, and I have just backported the same packages in my Launchpad PPA, compiled for Ubuntu 10.10 Maverick. I have also added an additional patch that resolves a compilation problem for 64bit architectures, a solution suggested in Erlang bugs mailing list.

As I said in previous occasions, these packages are a direct backport from the Debian repository, without (almost) any other modification; they work in my system, but they may not work for you. I am not the official Erlang maintainer in Ubuntu, and I may not have time to hunt for bugs, so if you find a problem feel free to report it, but it may not be solved (at least in short time).

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 117 other followers