mozart: The Mozart Programming System

January 14th, 2007 edited by ana

Entry submitted by Kari Pahula. DPOTD needs your help, please contribute !

Mozart is an implementation of Oz, a multiparadigm programming language, with a strong support for concurrent and distributed computing and for solving problems involving optimization and inference.

Some of Oz’s distinctive features are single assignment variables and binding. For example, you can do declare A B C and then execute C = A and [A 2] = [1 B] ([] marks a list in Oz) and have A = 1, B = 2 and C = 1 in the end.

Being single assignment variable means that executing A = B would be a runtime error. If needed, you could create new computation spaces where you could safely create condtradictions and examine the failures from outside.

Another one of Oz’s features is transparent support for concurrency. You can try out the next example yourself if you have no aversion towards using Emacs by installing mozart for yourself and feeding it line by line to the emulator. Start the X Mozart programming environment from the menu and go through it line by line and press C-. C-l as you go.

What you type

What you see

declare H W
{Inspect rect(width:W height:H area:thread W*H end)}

rect(area:_ height:_ width:_)

H = 20

rect(area:_ height:20 width:_)

W = 45

rect(area:900 height:20 width:45)

What happens in this example is that the thread started for counting the area suspends until both W and H are bound to a value. Once both are known, the thread continues execution and sets the corresponding field in the rect record.

Any of the above didn’t involve state at all. With Mozart, you can get by quite far within the declarative model itself. But when needed, there are two (equivalent) abstractions available for stateful operations. One is chunks, which operate much like regular variables with destructive updates. The other is ports, which are many-to-one communication channels. If you’re familiar with Erlang, you’d recognize them to be similar to the message passing used in it.

As an example, let’s write an echo server.

declare Echo
   Xs P
   { Xs P}
   proc {Consume Xs}
      X|Xr = Xs  % suspends until a new list item arrives to Xs
      {Inspect X}
      {Consume Xr}
   thread {Consume Xs} end
   proc {Echo M}
      {Port.send P M}

This is only a small scratch on the surface of what Oz and Mozart can do. Even if you’re not going to start writing programs using Mozart yourself, the concepts behind it are well worth knowing for any self-respecting programmer.


Mozart is available for most 32-bit architectures in Debian Woody, Sarge and Etch. The changes between 1.3.1 and 1.3.2 are relatively minor, so you won’t be missing much if you’re using the version in Sarge. It is also available in Ubuntu since Warty.

Posted in Debian, Ubuntu | 2 Comments »

gems: broadcast your terminal

January 10th, 2007 edited by lucas

Entry submitted by Martín Ferrari. DPOTD needs your help, please contribute !

Gems is an unknown, little, but efficient program which enables you to broadcast what is seen in your terminal to any number of clients. It’s great for technical lectures and talks, where people often has to make an effort to see what are you typing in the projected screen. It is terminal-agnostic, communicates by any TCP port using very little bandwith and no CPU power, and obviously, it’s free software!

It is very easy to set up, there is no configuration at all, apt-get it and you’re ready to go. In the master terminal, launch the server, optionally specifying a listening port and maximum number of connections (defaults to 6666 and 25, respectively, see the man page for more information), and immediatly you will be given back a shell:

teacherhost:~$ gems-server -port 9999
gems-server initialized.
gems-server: warning: terminal size is greater than 80x25.
teacherhost:~$ cd tmp
teacherhost:~/tmp$ PS1='Hello world class:\w\$ '
Hello world class:~/tmp$
Hello world class:~/tmp$ ls
Hello world class:~/tmp$

Gems warns you if you are using a big terminal, because clients won’t be able to connect if they have smaller terminals. To connect to a server, just specify address and port:

pupil1:~$ gems-client teacherhost 9999
gems-client: Connection established -- Press 'q' to exit.

Hello world class:~/tmp$ ls
Hello world class:~/tmp$

When a client connects, he sees only what you type after the connection is made, no screen status is maintained. This is key to its simplicity and compatibility with any type of terminal, but you will have to force screen refreshes as new clients connect (usually just pressing ^L). In this example the client connected just before the ls command was issued.


This is a screenshot of a gems session with clients in the same computer, the focused terminal is the server. You can have different terminal sizes for clients and server as long as the server terminal can fit in the clients.


gems is included in Debian and Ubuntu since respectively Sarge and Hoary.

Posted in Debian, Ubuntu | 9 Comments »

rlplot: high-quality scientific graphs made easy

January 7th, 2007 edited by lucas

Entry submitted by Phil Bull. DPOTD needs your help, please contribute !

If you're looking for an easy way to create and edit professional-quality scientific graphs, why not take a look at RLPlot?

When you run RLPlot, you are shown a spreadsheet screen into which you can enter or copy data. RLPlot's spreadsheet is suprisingly fully-featured for a simple graph-plotting package, and many built-in formulae are available. Once you are happy with the way your data is arranged, simply press Graph -> Create Graph to produce your graph.

Choosing a graph type in RLPlot

There are many different graph types for you to choose from (see screenshot), and RLPlot offers an impressive array of options for customising error bars, axes, labels and data-points. When you have finished, RLPlot shows an editable WYSIWYG view of your graph. In this view you can continue to customise your graph and add additional elements such as annotations, a legend, or even another data plot.

Once you've perfected your graph, it's time to output a copy of it. RLPlot offers a good choice of output options, including the SVG format (ideal if you want to do any further editing in another application). It can also print the finished graph directly.

Editing a graph in RLPlot

While not as powerful as gnuplot, RLPlot offers a quick and simple alternative for creating good-looking graphs of scientific data. It appears to be actively maintained, and there are no major bugs currently known for the current version. RLPlot is available from Debian Stable (a more recent version is available in Testing) and Ubuntu (since Hoary).

Posted in Debian, Ubuntu | Comments Off

sysrqd: small daemon to manage Linux SysRq over network

January 3rd, 2007 edited by ana

Entry submitted by Julien Danjou. DPOTD needs your help, please contribute !

sysrqd is a tiny daemon aiming to control sysrq over network.

SysRq stands for System Request, and this are functions mapped to keyboard shortcuts by the kernel. You can use them by pressing Alt+SysRq+[key] (SysRq might be named “Print Screen” on your keyboard), where key can be s (sync), k (sak), 0 to 9 (logging level), b (reboot), etc.
The goal of this keyboard sequences is too be available even if you can’t do anything on your box, because you screwed up everything, or because it’s crashed or under very heavy load.

sysrqd can help you to use SysRq keys when you are not in front of your box,and you need to do Emergency Sync, R/O remount and reBoot.

It is designed to respond under heavy load or half-crashed box, so it might work even if you can’t access to your box for example. In this case, you will be happy to telnet to your box on sysrqd port, enter your password, and then press s, u, b and wait for your server to reboot. You would not have been able to do that since ssh was not responding.

The connection is password protected but not cyphered so you might want to firewall it or to run it on a trusted network.

You can find latest version 8 packaged in both Debian and Ubuntu.

Posted in Debian, Ubuntu | 6 Comments »

Next Entries »