VBNC Compiles Hello World on Linux

by Miguel de Icaza

Rolf's excellent Visual Basic compiler was able to bootstrap itself a few weeks ago on Windows, but it did not work with Mono yet.

The compiler needed the VB runtime to be upgraded, it required a few fixes in the way we handle interface implementation for generics in the Mono VM, the final bug today was reference file names with their proper casing.

Also Rolf's compiler contained a few MS-specific hacks in the compiler, but those are no longer necessary so this afternoon the VB compiler was able to build Hello World on Linux:


$ mono vbnc.exe a.vb
	
                                                  DEBUG RUN

Visual Basic.Net Compiler version 0.0.0.4706 (last write time: 05/09/2006 21:06:28)
Copyright (C) 2004-2006 Rolf Bjarne Kvinge. All rights reserved.


Starting Scan
Scanning file /home/cvs/vbnc/vbnc/bin/a.vb
File '/home/cvs/vbnc/vbnc/bin/a.vb' scanned in 0.118 seconds
7 lines and 115 characters in total.
After SCAN: True
Starting Conditional Compilation
After ConditionaL True
Starting Parse
Parsing file /home/cvs/vbnc/vbnc/bin/a.vb (1 of 1 files)
3 assemblies were loaded.
73 namespaces were loaded.
2129 types were loaded.
Starting Resolve
Starting Resolve
CreateImplicitTypes compiler (1 of 1 types)
ResolveType compiler (1 of 1 types)
ResolveTypeReferences compiler (1 of 1 types)
CreateImplicitMembers compiler (1 of 1 types)
ResolveMembers compiler (1 of 1 types)
ResolveCode compiler (1 of 1 types)
Finished Resolve
DefineTypes compiler (1 of 1 types)
DefineTypeParameters compiler (1 of 1 types)
DefineTypeHierarchy compiler (1 of 1 types)
DefineMembers compiler (1 of 1 types)
Starting Emit
Emit compiler (1 of 1 types)
CreateType compiler (1 of 1 types)
Creating: compiler
Created:  compiler
Assembly 'a, Version=0.0.0.0, Culture=neutral' saved successfully to '/home/cvs/vbnc/vbnc/bin/a.exe'.
Compilation successful

	

The "DEBUG" run is a tiny bit verbose as you can see, the results are mind blowing:


mono$ cat a.vb
public class compiler
shared function Main as integer
Console.WriteLine ("Dingus")
return 0
End function
end class
mono$ mono a.exe
Dingus

	

Am actually scared of trying to bootstrap on Mono, I do not know if there are enough pixels in my machine to build the 68,000 lines of VB that the compiler has.

Posted on 05 Sep 2006


Italy Trip

by Miguel de Icaza

I think we have decided on what we will be doing in Italy.

We arrive to Pisa on September 16th, and we will head to the Elba island in the afternoon with the other speakers to the Elba island for the LASER Lectures.

After Elba, we will go to Rome on the 22nd or 23rd for the most part of that week.

Our plan is to go from Rome to Firenze and then to Pisa to take our airplane back home.

With this in mind: could we arrange some talks in Rome and Firenze (if there are Mono/Linuxers/.NETers there?)

Posted on 05 Sep 2006


Workflow in Mono

by Miguel de Icaza

A few days ago, Mono contributor Jordi Mas posted on his blog about the work that he has done to create an open source implementation of the Workflow APIs to Mono.

He announced his work here and provided the details about it here.

Scott Guthrie posts a couple of pointers to interesting tutorials on Workflow:

There are no screenshots at this time to spice up this blog entry, but here is the output of running the NUnit tests:

MONO_PATH=`pkg-config mono --variable prefix`/lib/mono/2.0:"../../class/
lib/net_3_0::$MONO_PATH" mono --debug ../../class/lib/net_3_0/nunit-console.exe
/output:TestResult-net_3_0.log /exclude:NotWorking,ValueAdd,CAS,InetAccess
 /xml:TestResult-net_3_0.xml  System.Workflow.Activities_test_net_3_0.dll 
|| ok=false; \
sed '1,/^Tests run: /d' TestResult-net_3_0.log; \
$ok
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov,
 Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Unix 2.6.16.21    Mono Version: 2.0.50727.42

Excluded categories: NotWorking,ValueAdd,CAS,InetAccess
..........

Tests run: 10, Failures: 0, Not run: 0, Time: 0.245039 seconds

	

Exciting.

Posted on 05 Sep 2006


Tangerine

by Miguel de Icaza

Today I finally upgraded my home server which was running ancient software so I could run Tangerine for sharing my mp3s on the home network over DAAP.

Worked like a charm.

Posted on 03 Sep 2006


F-Spot with PicasaWeb Export

by Miguel de Icaza

Gonzalo Paniagua developed a couple of new libraries: google-sharp to access a few Google services, and in particular Picasa and gnome-keyring-sharp, to access the Gnome Keyring from .NET applications.

gnome-keyring-sharp is a completely managed implementation, it basically speaks the keyring protocol instead of using a P/Invoke binding to call into native libraries, which is convenient as it is one dependency less on running applications.

Stephane Delcroix then developed a GUI for F-Spot to register your accounts, manage your albums and upload your pictures from F-Spot, the SVN version now has this fancy dialog box:

My first uploaded gallery from F-Spot is here.

Which reminds me, while traveling in Europe in July, I ran into the 12 Euro computer in a museum. I kid you not.

12 Euros, that is quite a good price. It is going to be hard for the OLPC guys to compete with that 100 dollar price tag, it has a surprisingly similar design, they also fold and they are also have quite an innovative design.

Judge for yourself here.

Posted on 02 Sep 2006


Martin Baulig, super hacker

by Miguel de Icaza

Martin has been working for the past couple of weeks on fixing a bug in the Mono C# compiler: how to properly compile an anonymous method inside a generic method.

The problem started with an innocent looking program:

	
        delegate void Foo ();

        class X
        {
                static void Hello<U> (U u)
                { }

                static void Test<T> (T t)
                {
                        Foo foo = delegate {
                                Hello (t);
                        };
                }
        }
	
	

The issue is that when we generated the anonymous method for "foo", we had to turn the "T" generic method parameter into a generic *class* parameter:

	
  .class nested private auto ansi sealed beforefieldinit 'AnonHelp<0>'
    extends [mscorlib]System.Object
  {
     .field  assembly  !0 'p:t'
  }
	

The code to cope with this in the compiler was fairly ugly, and Martin embarked on fixing the design internals at the end of July. We originally thought that there were two solutions: an elegant solution that required some refactoring and an ugly hack that basically accessed System.Reflection.Emit directly and poked at these internals from the anonymous method code path.

I have never quite liked what I did with the implementation of anonymous methods; I have tried to bounce the ideas off a few people to try to get their feeling on how to redo this code. I explained the design to Federico and Gonzalo hoping to get some feedback on the bugs and to clarify my own thoughts.

So to make a long story short, I did not like what was going on in the internals of the compiler; and in addition there are some annoying side effects and various constructs that crash the compiler when nested anonymous methods are used or when iterators and anonymous are mixed.

On Friday, Martin sent his weekly status report where he officially has removed my design mistakes. He has eliminated CaptureContext's from the compiler, and has eliminated the special-cases that coped with captured variables in the compiler --another part piece of code that worked, but was far from elegant--.

The new code that Martin has written replaced chunks of code that has bugged me for more than a year, so these are great news.

The patch is available here

In addition, cleaning up this code is essential as C# 3.0 will make extensive use of this infrastructure as part of the new lambda function support (This is because in C# 3.0 it is very natural for developers to create nested lambdas and anonymous methods, something that was more of a curiosity with the C# 2.0 syntax).

Btw, Martin just had a birthday, and he likes chocolates ;-)

Posted on 02 Sep 2006


A To-Do list for Bittorrent Sharp

by Miguel de Icaza

Alan has updated the list of TODO activities for BitSharp.

Posted on 02 Sep 2006


BitTorrent, half a tone up

by Miguel de Icaza

This year, during the summer of code three students worked on Bittorrent support for Mono/.NET. Each one was in charge of an independent piece: a bittorrent downloading (Alan), a tracker (Gregor) and the GUI (Piotr).

The code has now moved from our incubator repository to the public and it is available on SVN or you can get a tarball of it.

The code is licensed under the terms of the MIT X11 license, which means, anyone can embed it anywhere.

If you make fixes or improve the code, it would be nice for you to contribute those back. Let the sharp bitorrenting begin!

Screenshots will come later.

Posted on 01 Sep 2006


Authoring File Systems with Mono on Linux

by Miguel de Icaza

On Linux it is possible to write user-level file system by using FUSE, a toolkit to write user-space tools that can be mounted as file systems.

There is a whole scene of Fuse developers, to satisfy the most unique tastes in file system needs. Cryptographic file systems, gmail-as-a-backing-store, and of course a Wikipedia file system.

Jon Pryor has released Mono and FUSE bridge: Mono.Fuse. With Mono.Fuse it is possible to author file system extensions with Mono using any of the libraries or languages supported by Mono.

To create a file system with Mono.Fuse, you must create a class that derives from Mono.Fuse.FileSystem, like this:


  using Mono.Fuse
  class TypeNavigator : FileSystem {

      static void Main (string [] args)
      {
          using (TypeNavigator t = new TypeNavigator ()){
	      t.MountPoint = args [0];
	      t.Start ();
	  }
      }
  }

	

Then you need to implement a couple of methods, you override the directory reading and attribute fetching methods like this:


  protected override Errno OnReadDirectory (string path, [Out] out string[] paths, OpenedFileInfo fi)
  {
          ...
  }

  protected override Errno OnGetFileAttributes (string path, ref Stat stbuf)
  {
          ...
  }	
	

I wrote a small file system to browse assemblies, you can get the source here.

To run my toy file system, do this:

	
	$ mono fuse.exe /tmp/u
	

That will get the file system going (currently you need the Mono.Fuse.dll library in the same directory where fuse.exe lives, and the libMonoFuseHelper.so in your library path).

With this, you can browse the types in your favorite assemblies from the shell (or for the less manly hackers in my readership: a file manager) like this:


	$ ls /tmp/u/mscorlib
	...
	Mono.Security.Cryptography.RSAManaged+KeyGeneratedEventHandler/
	Mono.Security.Cryptography.SymmetricTransform/
	Mono.Security.PKCS7/
	Mono.Security.PKCS7+ContentInfo/
	Mono.Security.PKCS7+EncryptedData/
	Mono.Security.PKCS7+EnvelopedData/
	...
	$ ls /tmp/u/mscorlib/Mono.Security.Cryptography.SymmetricTransform
	CanReuseTransform               GetHashCode          OutputBlockSize
	CanTransformMultipleBlocks      get_InputBlockSize   ToString
	Equals                          get_OutputBlockSize  TransformBlock
	get_CanReuseTransform           GetType              TransformFinalBlock
	get_CanTransformMultipleBlocks  InputBlockSize

	

Once you are done with the exciting world of browsing your assemblies with ls and cd you can umount your file system like this:


	$ fusermount -u /tmp/u
	

Very nice work Jon!

Posted on 01 Sep 2006


Mexico Mess

by Miguel de Icaza

I had not been writing about the state of affairs in Mexico for a while.

Things are not looking any more positive now.

A quick recap: the elections results are contested on many grounds, and various groups have put forward evidence that the results were tampered with (My father, has put together a number of academic studies at the results).

Anyways, the PRD has taken over some portions of the city and "camped out" and there are some beginnings of civil resistance.

The electoral tribunal has turned down the request to revisit/recount the contested ballot boxes which could very likely change the election results.

The government in the meantime has been training some para-military forces, not directly linked to the government and which is supposed to infiltrate resitance groups. These had been barred from existance in Mexico after two massacres, the 1968 Tlatelolco Massacre (lead by the military) and the 1971 Corpus Christy massacre (lead by these paramilitary groups).

With the vote by vote recount request ruled out, the civil resistance seems more imminent.

Fox's government is busy getting a new paramilitary group ready for action for the upcoming State of the Union.

Very much like the 1971 paramilitary group, the new group is supposed to "blend" with the crowd; They will not be wearing uniforms, have been asked to keep their hair long, and dress casually.

Posted on 31 Aug 2006


« Newer entries | Older entries »