First run on Visual Studio 2010!

by cisterni 23. June 2009 19:02

Big news! VSLab is running on Visual Studio 2010! Ok, this is rather big statement, so far we just managed to run the very first simple example as shown in figure. We expect a lot of work to update VSLab integration with Visual Studio, there are many differences between Visual Studio 2008 and Visual Studio 2010. But the very core mechanism still works, and it wasn't obvious since it is rather delicate. Now we have to find a way to rearrange source code so to have the two versions of VSLab.

Newer versions will target both environments as F# does.

Currently rated 3.3 by 7 people

  • Currently 3.285714/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


General | Shell

Wall-E release is out!

by cisterni 19. June 2009 21:08

Hi everybody, first of all we should apologize for our long silence. But we work at a University and the second term has been tough and we delayed the VSLab release in the hope of concluding several on-going parts. But now the May CTP of F# is out and people was asking for un updated version. So today we have released VSLab Wall-E which is also planned to work on Visual Studio 2010 (which is something we are working on).

In this release the major step has been the consolidation of the foundation (of the hack would be more appropriate perhaps...) of the system. We are currently using it for real scientific projects now and we are really happy! We are building a machine for micro-fabrication of tissues in collaboration with biomedical engineers and everything works with VSLab better than with Matlab.

As for the development, we are working on a general purpose viewlet for data drawing with vectorial support (even if developed in Windows Forms) so that non-computer scientist may easily plot data. We are improving the lightweight controls library, and the overall Visual Studio integration (though this must cope with the new upcoming release).

From now on you'll hear more often from us, we're back!

Currently rated 3.3 by 8 people

  • Currently 3.25/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Community | Shell


by cisterni 14. February 2009 10:32

A frequently asked question about VSLab is "ok, this is nice and I see the library can address many Matlab/Mathematica scenarios, but how about math?". My typical answer is: you can look for .NET math libraries out there, there are many. However often people looks for hints on how browse the jungle Web out there.

I suggest a couple of libraries that may address many of common situations: the Math.NET library, a very large library featuring a lot of features and it is LGPL and GPL and easily embeddable into VSLab projects; and dnAnalytics a library less complete but with merits, especially because of the attention to performances.

In the meantime we are working to a WPF viewlet (though with different architecture with respect to Viewlets) and Data Visualization viewlets to be used in experiments. We are also considering to add a CopyClipboard feature to viewlets so that it is easy to capture views and insert into papers.


Currently rated 2.7 by 6 people

  • Currently 2.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



Next VSLab release upcoming

by cisterni 19. January 2009 22:51

Ok, we are close to a new release of VSLab. It will contain two major changes that are very very important. The first one is, as far as I know, the first implementation of Lightweight Controls for Windows Forms, made available for programming viewlets with ease but also available to all .NET applications. Wonder why are Lightweight Controls so important? Let's start with an example in C#:

    public partial class Form1 : Form    {

        public Form1()        {


            var lc = new LightweightContainer();

            var lb = new LightweightButton();

            var rb = new RoundButton();

            var rb2 = new RoundButton();

            lc.Dock = DockStyle.Fill;

            lb.Position = new Point(0, 0);

            lb.Text = "Hello World";

            lc.BackColor = Color.AliceBlue;


            rb.Position = new Point(0, 100);

            rb.Size = new Size(50, 50);

            rb.Text = "Hello with very long text";


            rb2.Position = new Point(0, 110);

            rb2.Size = new Size(50, 50);

            rb2.Text = "Hello 2";





This is a simple code meant for creating three buttons into a canvas. The LightweightContainer class is a sort of panel capable of hosting lightweight controls (classes derived from LightweightControl). The library features a number of predefined controls such as buttons (in Vista style) and scrollbars. In the example the lb variable holds an instance of a LightweightButton. The lightweight control container is docked within the form. The other two buttons are instances of RoundButton class which is a simple example of how to write a lightweight control:

    public class RoundButton : LightweightControl    {

        public string Text = "";

         public override void OnMouseMove(MouseEventArgs e)        {


            BackColor = Color.Red;



        public override void OnClick(EventArgs e)        {


            Position = new Point(Position.X, Position.Y + 10);



         public override void OnPaint(PaintEventArgs e)        {

            var g = e.Graphics;

            using (var b = new SolidBrush(Color.FromArgb(40, BackColor)))            {

                g.FillEllipse(b, e.ClipRectangle);

                g.DrawEllipse(Pens.Black, e.ClipRectangle);

                var sf = new StringFormat();

                sf.Alignment = StringAlignment.Center;

                sf.LineAlignment = StringAlignment.Center;

                g.DrawString(Text, Font, Brushes.Black, new RectangleF(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height), sf);




 The RoundButton is written as a standard UserControl except for the fact that it inherits from LightweightControl (and that not all the features of UserControl are available). The output is shown in the following picture: 

Here is a more complete screenshot of one of our regression tests running inside VSLab:

Lightweight controls are important for viewlets because it is not possible using the standard controls, therefore having user control abstractions makes viewlet development a lot easier. One of the example is the addition of a button over the Chart and the 3D Chart viewlets as shown in this screenshot:

The other important update in this new release is the implementation of double buffering for Viewlets (the Chart viewlet sample does not flicker anymore once enabled) which has been challenging to implement because of the internals of VSLab. The overall code has been cleaned up and reviewed in order to offer a more consistent programming API.

Now we are getting back to the original ideas of featuring new viewlets for data visualization and system shell replacement. In the meantime we are using VSLab in projects involving biomedical engineers.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

General | Shell | Viewlets

Piping processes, VSLab Shell foundations

by cisterni 16. September 2008 09:40

VSLab provides the foundations for using Visual Studio as an interactive environment, a sort of big environment for Domain Specific Languages in which you can issue commands interactively to control virtually anything. Now that this foundation is in place we are working to provide the set of packages that shows this potential and transform VSLab into something that is usable for people, not only by F# programmers. Of course this is also a way to find the right abstractions you need when developing packages so that we can possibly extend the core to support new functionalities.

One of the coolest packages I'm working on is the VSLab Shell package, a mean to turn VS into next generation interactive shell, in which text and GUI mix together to obtain a new environment in which point-and-click is used in conjunction with text-based scripts to get the best from the two environments. We are currently defining the core operations of a traditional shell, such as process management and piping, and I want to share with you a neat piece of code we wrote this night to express process piping using F# and F# interactive. Here is the code:

open System.Diagnostics

open System.IO

let pwd = Directory.GetCurrentDirectory

let createProcess exec args =

  let pi = new ProcessStartInfo()

  pi.Arguments <- args

  pi.CreateNoWindow <- false

  pi.RedirectStandardInput <- true

  pi.RedirectStandardError <- true

  pi.RedirectStandardOutput <- true

  pi.UseShellExecute <- false

  pi.WorkingDirectory <- pwd()

  pi.FileName <- exec

  let p = new Process()

  p.StartInfo <- pi  p

let (^>) (out:Process) (pf: bool -> string -> unit) =

  out.ErrorDataReceived.Add(fun d -> pf false d.Data)

  out.OutputDataReceived.Add(fun d -> pf true d.Data)





let (^|) (inp:Process) (out:Process) =

  inp.EnableRaisingEvents <- true

  inp.ErrorDataReceived.Add(fun d -> out.StandardInput.WriteLine d.Data)

  inp.OutputDataReceived.Add(fun d -> out.StandardInput.WriteLine d.Data)

  inp.Exited.Add(fun _ -> out.StandardInput.Close())





let p = createProcess @"c:\Windows\System32\Robocopy.exe" "/?"

let s = createProcess @"c:\Windows\System32\sort.exe" ""

let q = createProcess @"c:\Windows\System32\sort.exe" "/R"

p ^| q ^| s ^> (fun out d -> printfn "%s: %s" (if out then "out" else "err") d)


This code shows a limit of .NET API, we have to coordinate the piping process explicitly because we cannot specify the handle to the streams in the ProcessStartInfo structure (in Win32 would be possible). We define two overloaded operators using the ^ prefix to have right association. The callbacks provided by the Process class allow to avoid polling of streams. This code has requested an amount of spelunking of System.IO namespace, I was surprised to find that using the general Stream class it is not possible to multiplex IO operations as the select system call would have permitted. Some day I will post considerations about this design that at a first sight may seem weird but after some thoughts I decided that is reasonable though far from elegant.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

General | Shell

VSLab Shell

by cisterni 27. July 2008 17:26

I think that one of the most interesting areas of VSLab, partly unforeseen, is the project of developing a next generation system shell as a package. System shells have a long history and there is always an attempt to find the new one, but I think these are here to stay, but they also are the past. We are living in a world where the stream-based composition of software is far from satisfactory, and also the completion forms provided by shells are inadequate.

In 2001 I defined a shell called ObjShell, attempting to exploit the component-based nature of COM for software composition. At that time I realized that Unix shells are just a simpler version of this where each program was a component with a well defined interface and an associated process, and the shell was the mean by which these components were integrated. ObjShell were a very nice project and today I can say it's a pity I didn't find the time to work on it for the .NET version, otherwise the Power Shell would have arrived several years before. And in fact I was contacted by the PS team (I spoke to Jeffrey Snover when He was in charge of PS) though I didn't succeded in trying to convince on some basic design principles of the ObjShell that I would have loved to see in the PS. I'm not a PS fan, I like the object streaming metaphor, but I didn't feel need for another unreadable language full of switches and dollars.

I think that programming languages and the associated toolchain have grown enough to blur the distinction between the program and the shell, it was true for VB and COM and it is more true nowadays with .NET and languages such as F# using the interactive top level. Now with few lines you can read system counters as PerfMon does and do several other things. VSLab Shell will be a package designed to be next generation shell, where statements are highlighted to be executed and a single file may contain several scripts. Intellisense it is far better than Tab-based completion. At the moment we are working on the core functionalities of the shell, but also designing interfaces to hardware such as ILO featured by HP.

More about VSLab Shell will be available in the next release of VSLab.

Currently rated 2.3 by 7 people

  • Currently 2.285714/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Design | Shell

Powered by BlogEngine.NET
Theme by Mads Kristensen

VSLab blog

VSLab is a Visual Studio extension designed to support Visual Studio interaction from F# interactive. It is a Microsoft product developed at University of Pisa, by a team lead by Antonio Cisternino.


Recent comments

Comment RSS


The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008