FOSDEM Videos Online 2

I’ve been watching more FOSDEM videos. They are very cool. Watching in 720p is awesome.

Alan McGovern on The Evolution of MonoTorrent – By far the best bittorrent library for .net. Alan talks about the challenges of writing a library that will handle things like hundreds (if not thousands) of simultaneous socket connections, why using threads to do so is wrong, and how good design and the async pattern made it easy and fast.

Stephane Delcroix on Image Processing – I was really looking forward to this one – Mono.SIMD is awesome – but the whole thing is code and the non-bold small font on a white background did not get picked up by the projector. Needless to say that Mono.SIMD is still awesome, but the talk isn’t really worth watching. I’ll be it was cool live though. If you don’t know Mono.SIMD is yet another Mono innovation that is Mono-only. It provides an object oriented api for the underlying SIMD instructions in modern cpus. These are the SSE instructions that you see listed in the spec about your Core2 CPU.

Jeremie Laval on Parallel Fx – This is NOT just another talk on Parallel Fx aka Task Parallel Library+PLINQ. Jeremie actually wrote Mono’s implementation of TPL. While its great to see Stephen Toub show use cases of TPL, the geek in me wants to see what is under the hood. Jeremie gets into some of the challenges in implementing the scheduler and library. He also mentioned that .NET4’s thread pool actually uses the TPL scheduler underneath. I didn’t know that. He also shows a demo of Future<> which I had never considered. Chaining Future<>’s in a tree like manner in order to create parallel delayed evaluation.

Andreia Gaita on Moonlight and You – Why moonlight is important to mono? WOW! They are working on XAML designers for MonoDevelop. I can’t imagine how awesome moonlight development will be on Linux in the future. Moonlight is super close to working in Chrome on Linux. mxap –desktop lets you create moonlight desktop apps launchable with the mopen command. Very cool. Desktop apps in moonlight. Very cool pixel shaders on video in moonlight 3.

Jim Purbrick on Building The Virtual Babel – Mono in Second Life – The virtual worlds in Second Life and how it has progressed for 7 years. Very cool to hear how an existing language LSL and existing virtual machine was moved to a new virtual machine, Mono. I’ve never heard of JavaGoX or Brakes so listening to the description of script migration was rather mind blowing.(very cool)

Joe Shields on OSCTool – learning C# and Mono by Doing – While probably not of interest to a lot of developers, this one hit close to home for me because I was in a position pretty close to Joe’s about 8 years ago. Of course I didn’t know .NET at the time and Mono was still very young, but I do recall playing with some ASMX web services to do things similar to what he was doing. Joe makes a point that python, perl, C and even Java have cross platform difficulties (think HPUX, Itanium, Tru64 etc) of which Mono seems to mitigate much. The audio goes out for a few minutes in the middle, just skip to about 17:00 and watch the demo.

Mirco Bauer on Smuxi – IRC in a modern environment – Just an irc client with some special features. I’ll definitely be looking into this because I’m an IRC junkie, and it also has the exact twitter client that I’ve been looking for since I started using twitter.

FOSDEM Videos online

As a .NET programmer in my day job targeting Windows desktop applications (winforms and wpf), I don’t get to stay on top of much ASP.NET or Mono. The ASP.NET stuff I feel like I have a good enough handle on via channels I use to stay on top of .NET in general (user groups, blogs, etc). Mono gets much less coverage there.

Luckily there are some awesome (720p quality) videos from FOSDEM 2010 of some Mono centric presentations.

Lluis Sanchez Gual on MonoDevelop – I knew MonoDevelop 2.2 had some awesome in it, but I didn’t know about some of the code generation things in it. Think R# mixed with CodeRush. It is very sweet.  Lluis’s Blog is always a good read too.

Ivan Porto Carrero on IronRuby – Poor Ivan had some demo troubles, but overall the presentation was excellent. It is VERY cool to see a Banshee add-in written in Ruby. I don’t think I was reading Ivan’s Blog before, but I am now.

Miguel on Mono – I think this is kind of Miguel’s “State of the Monkey” of the day. Its a status overview with a few deep dives into things. I especially thought it was cool that he went deep (well, deeper than most) into Expression<>.

The videos seem to be coming out slowly. I’m posting these brief summaries of the videos as I watch them, so expect me to link to more as I watch them.

Windows 7 mp3 tag editor

I just accidentally found Windows 7’s built in mp3 (and presumably other metadata, exif perhaps) tag editor.

I looked for this thing for what felt like hours over the past year. Eventually I sucked it up and downloaded mp3tag, but its still nice to know that this is there for the next time.

Normally when browsing my mp3 files I see a window that looks like this:


See that summary pane at the bottom? Select a file with editable metadata, like an mp3 and resize that pane. Then click one of the metadata values.


Wow, I wish that had been more discoverable. –1 point for Windows 7 for making that far from intuitive, but 1 point for Windows 7 for having the feature.

LINQ Abuse with the C# 4 dynamic type

With C# 4 adding some support for dynamic typing one of the first thing that I wanted to do is use it with LINQ.

I want to do this:

dynamic x;
var h = from y in x where y == 1 select y.something;

But I get error messages on both where and select that says

Query expressions over source type ‘dynamic’ or with a join sequence of ‘dynamic’ are not allowed

Major bummer.

But surely there is something I can do. 🙂

*the title of this post starts with LINQ abuse… please don’t comment about how stupid and evil this is. I know it. Instead, consider this an exercise in getting to know C# a little better.

The dynamic type is just sugar for the object type and some attributes to which the compiler pays attention.

Lets use object…

object things = new[] { 0,1,2,3,4,5,6,7, };
var whatIwant = from thing in things
                            where thing % 2 == 0
                            select thing;
// or if you like longhand:
var wiw = things.Where(thing => thing%2 == 0).Select(thing => thing);

How does this compile? Well, by making Where and Select resolve to extension methods on object instead of extension methods on IEnumerable<T> (which is what people USUALLY think of when they think LINQ).

public static IEnumerable<dynamic> Select(this object source, Func<dynamic, dynamic> map)
    foreach (dynamic item in source as dynamic)
        yield return map(item);
public static IEnumerable<dynamic> Where(this object source, Func<dynamic, dynamic> predicate)
    foreach (dynamic item in source as dynamic)
        if (predicate(item))
            yield return item;

Extension methods on object, then cast to dynamic (extension methods aren’t allowed on dynamic).

It should be short work to fill out whatever LINQ methods are necessary to make whatever LINQ expressions you wish work against dynamic (object) and now you can use LINQ with a source that is typed dynamic.