Lame Blog: The Official Entry

by Miguel de Icaza

This is the official blog entry for the spicy Lame Blog an under-powered, static content, C# and rsync based blog system.

LameBlog is powered by almost nothing, the idea is that you edit text files with your favorite text editor on your computer, and when you feel like publishing your blog entries you type "make push".

Configuration of LameBlog is done through an XML file and editing a Makefile. It contains enough so you can hook reddit/digg and plug your Google Analytics, Google Reader sharing and to do posts with Google groups.

Ismael Olea has modified LameBlog for using Haloscan for comments and include a bunch of "flag me as a cool cat" options.

To download LameBlog, click on "download as tarball" on the link above, read the README file for details on how to install this.

Update: folks, I need your help. Please link to this blog entry, there are tons of Google matches for "Lame Blog", but only a piece of software deserves to be at the top spot, not some lame entry about blogging.

Posted on 24 Mar 2007


Second Ad

by Miguel de Icaza

A follow up to yesterday's spoof ad from Novell. This is part 2. Click here for watching it at YouTube.

Alternatively, you can get the mpg or ogg files directly from Novell's site.

Posted on 21 Mar 2007


Novell Linux Ad

by Miguel de Icaza

Yesterday at Brainshare Novell had this video spoof on Apple's campaign.

Direct link

Mhm, it seems to go down (some "high database load" message or something). If you have problems go here: http://www.novell.com/video and then click on "PC Mac Linux (0:55)".

Or you can download the mpg file or ogg file.

Other videos from Brainshare are here.

Posted on 20 Mar 2007


Shader Languages

by Miguel de Icaza

The other day I wrote:

The other day Cody Russell was asking on IRC what we could do in the Mono universe to take advantage of some special instruction sets like SIMD or how to use C# to generate code for pixel shaders or vertex shaders.

One idea that we discussed was the creation of a library that would be able to expose this kind of functionality.

jeevan.james pointed out on the comments to that blog entry that there is already a project that is working on precisely this idea.

The project is called Brahma-FX and is hosted at SourceForge. And its implemented in a similar spirit that I described on that post.

They use C# as the language to express the shading operations, they decompile the code at runtime and compile that to the hardware specific shading system.

For example to invert an image, they write:


	public override void Compute (Vector2 kernel_position)
	{
		Vector4 color = Sample2D (0, kernel_position);
		Output = new Vector4 (1.0f - color.X, 1.0f - color.Y, 1.0f - color.Z, 1.0f);
	}
	

Currently they have a compiler only for DirectX (and stubs for OpenGL and XNA) it looks like a great project to contribute to.

Ananth's blog is here.

Posted on 19 Mar 2007


SIMD support in Mono

by Miguel de Icaza

The other day Cody Russell was asking on IRC what we could do in the Mono universe to take advantage of some special instruction sets like SIMD or how to use C# to generate code for pixel shaders or vertex shaders.

One idea that we discussed was the creation of a library that would be able to expose this kind of functionality. Take for example the following Cg example:

// input vertex
struct VertIn {
    float4 pos   : POSITION;
    float4 color : COLOR0;
};

// output vertex
struct VertOut {
    float4 pos   : POSITION;
    float4 color : COLOR0;
};

// vertex shader main entry
VertOut main(VertIn IN, uniform float4x4 modelViewProj) {
    VertOut OUT;
    OUT.pos     = mul(modelViewProj, IN.pos); // calculate output coords
    OUT.color   = IN.color; // copy input color to output
    OUT.color.z = 1.0f; // blue component of color = 1.0f
    return OUT;
}
	

A C# rendering of the above would be:

class MyShader {
	struct VertIn {
	    [Position] float pos;
	    [Color]    float color;
	};
	
	// output vertex
	struct VertOut {
	    [Position] float pos;
	    [Color]    float color;
	};
	
	// vertex shader main entry
	public VertOut main(VertIn IN, [Uniform] float4x4 modelViewProj) {
	    VertOut OUT;
	    OUT.pos     = mul(modelViewProj, IN.pos); // calculate output coords
	    OUT.color   = IN.color; // copy input color to output
	    OUT.color.z = 1.0f; // blue component of color = 1.0f
	    return OUT;
	}
}
	

The above is a direct translation. Now, the value of the library would be basically a method that generates a delegate with the proper signature:


	Delegate Compile (MethodInfo method)
	
	

It would be used like this:

	delegate VertOut main_delegate (VertIn In, [UniForm][float4x4] model);
	...
	main_delegate shader;
	shader = (main_delegate) Compile (typeof (MyShader).GetMethod ("main"));
	...
	shader (my_in_data, model);
	

The Compile method would use the Cecil library to decompile the code, perform flow analysis and ensure that the code in the method passed (in this case main) meets the restrictions imposed by the target (in this case Cg's target).

In some cases (SSE instructions) you might want a delegate back, or a method token that you could then Reflection.Emit call. In some other cases you might want the code to give you some handle back that you can pass to your graphics hardware.

(Cecil has a very nice flowanalysis engine, the one used by db4objects to provide the LINQ-like functionality with today's C# compilers).

The above model can be extended to other operations, and in some cases the return value from Compile could be just a delegate to the original method (if the hardware is not supported).

Today a student interested in doing something very similar for the Summer of Code emailed me, so I decided to dump here some of the ideas.

Posted on 15 Mar 2007


Mono and the Google Summer of Code

by Miguel de Icaza

The Google Summer of Code has started. Students interested in participating in the Summer of Code need to submit their applications in the next ten days.

Some ideas of interesting things that can be done with Mono are available in our Student Projects page.

If you think that you have a good idea for a project to be implemented for Mono, but is not listed on that page, feel free to submit your idea.

We are looking at improving Mono's OSX support (Winforms, debugger support, improving Cocoa#); new ports and improving existing Mono ports; Profiling Mono, Gtk#, MonoDevelop; low-level optimizations; New Windows.Forms widgets; Work on 3.0 components and libraries; Improving MonoDevelop and creating new C# class libraries for Mono.

Other Apps: We are also interested in tasks improving popular Mono-based applications for the desktop to showcase how great building applications with Mono is. Make sure you send your submission on time.

Posted on 15 Mar 2007


Eiffel now Open Source

by Miguel de Icaza

One of my favorite books is Bertrand Meyer's Object Oriented Software Construction

The book explores object oriented programming using the Eiffel language and one of the things that I always loved about Eiffel was the defensive programming techniques that it teaches and the strong focus on contracts and preconditions (a technique that is used extensively in Gnome).

Until very recently I had not noticed it, but the Eiffel compiler and the Eiffel suite of libraries and even the development IDE (EiffelStudio) were open sourced (Emmanuel mentions this to me during the Lang.Net conference and I do not remember any big news about it).

They have just launched a community site Eiffel Room.

There are a bunch of Flash-based presentations on Eiffels here.

In this presentation you can see a demo of the IDE. In particular see the "System Metrics" section.

Posted on 13 Mar 2007


Value Types and Null

by Miguel de Icaza

Anyone has any idea of what is going on with value type comparisons against null in the Microsoft C# 2.0 compiler (and also the Orcas compiler exhibits this problem):

The compiler allows code like this:

	DateTime dt = DateTime.Now;   // this is a value type

	// Compare value type to null, invalid in CSC 1:
	if (dt != null){
		// ...
	}
	

The problem is that the above is always known to be false (dt can not be null), so CSC generates generates the equivalent to "if (true)" every single time (it becomes a no-op).

Adding support for this to the Mono compiler is simple enough but this sounds wrong. Because those testing a value type against null are doing a pointless test and they might be under the mistaken impression that the test is guarding them from an invalid state which it is not.

A few folks have reported this, but I can not find any rationale for this in the ECMA spec, it sounds like a bug in Microsoft's compiler related to the nullable-type support in their compiler.

Posted on 13 Mar 2007


Mono on the Nokia 770 and 800

by Miguel de Icaza

Everaldo and Wade have now published packages for Mono on the Nokia 770 and 800.

Visit our Maemo page to install the packages on your device.

The packages feature single-click install, and will add the repositories to your system so you can install only the pieces of Mono that you need to run specific applications.

Posted on 12 Mar 2007


Must Blog This: Bush in Latin America

by Miguel de Icaza

As I said two days ago Bush is not really loved in Latin America.

Wonkette asks the question: "Are the protesters hot?" on their "South Americans Welcome George W Bush -- With Style".

The answer: not safe for work.

This is the first time I link to Pravda, but they got photos of the welcoming.

Posted on 09 Mar 2007


« Newer entries | Older entries »