Archive for the C# Category

06
oct

Wicd support patch for Banshee

Shameless plug to tell I’m alive .
If you are using Wicd and usually stare at Banshee trying to download cover art or post to last.fm while you are disconnected, the following patch add just the support to fix this.
Here is the associated bug report to get the patch integrated.
In other news, school restarted [...]


free blog themes
16
août

How to get the max out of your PLinq query

Here are some tips you should follow if you want to get the maximum performance out of a Linq query parallelized with PLinq (at least with upcoming Mono version) :

Use an indexed data structure as your source like an array, a list or anything which implements the generic IList<T> interface.
You can also use ParallelEnumerable.Repeat and [...]


free blog themes
27
juil

Follow-up on OpenVG support for Moonligh

Interested by the stuff I demonstrated some weeks ago ?
Check out the following message on Moonlight mailing-list for instructions on how to get the same thing.
Just to make you salivate :

BubbleMark running at ~50 fps without too much visual glitches
(direct link : http://www.youtube.com/watch?v=Ekfb6jCyDmM)


free blog themes
16
juil

Joining the Moonlight fun

Watching my teammate hacking on moonlight was sure to detain on me someday. So when Alan talked about making Moonlight run on top of OpenVG I got pretty hooked.
Two hacking days later, I actually got something to « work ». At the moment it’s quite rough, hacky and it probably kills kitteh too (be careful, it makes [...]


free blog themes
10
juil

Zencomic 0.2.1 : OH HAI!

After fighting a bit with Gtk# widget styling and MonoDevelop tarball deployment, here is a new Zencomic.

Summary

Zencomic is the comic strip-driven productivity enhancer that periodically makes your day funnier by showing comic like Dilbert or XKCD in a bubble.

What’s new aka The Cool Stuff ™

New, window-based, popup

Tired of having some comic showing far too small ? This is for you !

Now, if you go to the preference dialog, you will be able to switch to a window-based popup which shows your comics in all their greatness at the expense of taking more window space and making your boss, who was incidentally passing by, angry at you (in that case, a quick click on the popup will close it).

new-window-popup

Can I haz lolcats ?

Lolcat greatness is here with the addition of a new addin :

zencomic-lolcat

The remaining

  • For the Gnome Do junkie, Zencomic now correctly comes with a .desktop file so that you can launch it from there
  • Made the preference dialog show in a little saner way i.e. by coming up directly at the front (which apparently wasn’t the case with some WM).
  • The traditional round of bugfixes (should you still spot one don’t hesitate to manifest in the comments)

Downloadz

Tarball : http://netherilshade.free.fr/mono/zencomic-0.2.1.tar.gz

If by any chance you feel this is an application that should come in your distribution, don’t hesitate to contribute some packages ;-) .


free blog themes
03
juil

GSoC: the now and the next

As you may recall, I have the great pleasure to participate again in Google Summer of Code this year with Mono.

Since we are nearing midterm evaluation, I thought about doing a kind of status report like last year. Unfortunately, I haven’t been as active as I wanted to this time (exams were more time consuming this semester). However there is still some cool stuff that have already landed and which are described next.

What has been done since last year

Actors and Software-transactional-memory goodness

I took some time to implement rudimentary version of those two parallel programming paradigms earlier this year.

See this post which describes in more details the ideas behind them and some examples.

New more efficient scheduler’s deque

The scheduler’s deque that was used before was quite complex due to the fact that the inherent storage mechanism was based on a doubly linked-list which is rather hard to get right when you add parallel and concurrency constraints (see ABA problem for instance).

The algorithm I was using was mostly designed with C++ in mind where you can mess up with pointers pretty easily and make freely use of CAS on pointers as integers. Since I wanted to avoid any kind of unsafe or native code in the library, I tried to port that algorithm down to C#.

After some mail exchange with a fellow person (hey Susan o/) who was using Mono’s ParallelFx on a big box in a laboratory, we started to see some concurrency problems with my code. Turns out that the ABA prevention code wasn’t really working with my C# rewrite. Therefore I decided to hunt for another, more C#-friendly, type of scheduler’s deque.

Actually, I did find it and it’s the one used now under the CyclicDeque name. It’s particularly swift because it only do integer manipulations that are particularly fast with the C# Interlocked methods and doesn’t suffer of the ABA problem because, using the vast range of values available with 64 bits integers, it’s based on a forward-only algorithm.

With the tests I was able to do, this new deque works more reliably and faster than the precedent. It’s currently enabled by default but I need to do some 32 bits checks to see if it behaves as expected on those plateforms.

New types

Following the new type introduced as part of my first SoC and the two parallel paradigms I described above, I have done some other parallel and concurrent code to be used both internally and publicly.

One of those is a new collection, ConcurrentSkipList that provides a thread-safe implementation of a skip-list (a nice tree-ish list container). This skip-list implementation is also used for the ConcurrentDictionary type.

The other is a stripped down CountdownEvent called Snzi (Scalable non-zero indicator) that basically do the same thing except that instead of keeping a count record, Snzi just tells in a binary fashion if there is or not a count remaining. That weaker semantic opens the door for more scalable and efficient optimizations.

Optimizing, fixing and hardening

The final task that occupied me during the inter-soc period was mostly tuning and bug-fixing the existing parts with a focus on Task reliability and PLinq performance and correctness.

What have I begin to do for this SoC

Currently I’m hard working on the .NET 4 port of Mono’s ParallelFx as it comes with a whole lot of new stuff and API changes.

The ParallelFx team over at Microsot has been publishing posts these last months about the new things coming down the pipe (check out their blog if you still haven’t do so).

At the moment, the System.Threading.Tasks namespace port is fairly complete and Tasks/Future unit tests are all back to green.

I’m now working a bit on the Collections namespace, adapting some of my code to the new API (notably ConcurrentDictionary) and seeing how to implement the new Partitioner pattern.

What to expect next

mono-ireland

First of all, the following weeks are going to be quite more productive as, with big thanks to Alan and Miguel, I’m going to spend a month in Dublin hacking in the Novell offices. Looking forward to this.

As for the next, the plan is to continue porting the existing code to .NET 4, first with the Parallel loops class (with probably some further optimizations on data source partitioning) and then PLinq.

In addition, since Mono recently enabled the .NET 4 profile in SVN, some of the ParallelFx code will also soon transition from the google code repository to official Mono’s trunk for early mass consumption.

Finally, last but not least, I’m going to devote the rest of the summer to testing ParallelFx more extensively with, both, improving the existing test suite with harder parallel stress-testing and the development of a Chess-like parallel correctness checker.

See you at the end of the SoC for another full report ;-) .


free blog themes
24
juin

MD quick feature : switch support in Autotools deployment project

Just to let you know that MonoDevelop’s Autotools deployment projects now allow you to add specific switch for the configure script.

Let’s say for instance that you want to enable at compile time a specific feature in your project. Now what you can do is add a switch to your deployment project which will be turned in something like --enable-super-feature on configure side (i.e. you will be able to run configure like ./configure --enable-super-feature).

This will actually define (as in #define) a symbol that you can use with #if … #endif constructs in your code to activate your specific feature.

Since we are at it, here is a little screenie :

md-switch-defines

I will add support asap for simple makefile projects. The UI is also probably a bit rough, if there are any usability expert out of there I will gladly accept any sensible criticism :-) .


free blog themes
24
juin

Zencomic 0.1.3

This is a release that was lying around on my desk. It contains a little set of new features.

Summary

Zencomic is the comic strip-driven productivity enhancer that periodically makes your day funnier by showing comic like Dilbert or XKCD in a bubble.

ChangeLog

  • Added a ‘Show now’ button for immediate pleasure consumption
  • Image processing is now deferred to a separate thread
  • Tentatively try to see if the screensaver is active

Download

Tarball : http://netherilshade.free.fr/mono/zencomic-0.1.3.tar.gz

Enjoy !


free blog themes
24
mai

Zencomic 0.1.2

Edit: And two releases in the same day. Thanks to goto for discovering the CPU issue.

A bunch of fix and improvements for Zencomic, the comic strip-driven productivity enhancer.

Changelog

  • Fix CPU usage bug
  • Geekscottes addin contributed by Frederic Forjan
  • Added conditional compiling for Timeout.AddSeconds (--enable-timeout-second switch). Fix build error for non-svn Gtk#
  • Intercept SIGINT and SIGTERM signals to save configuration before exiting
  • Added COPYING file

Tarball : http://netherilshade.free.fr/mono/zencomic-0.1.2.tar.gz


free blog themes
18
mai

Mathematical digression : Buffon's needle

Buffon’s needle is a statistic experiment created by Comte George-Louis Leclerc (sounds so frenchie).

The principle is to drop needles on a parquet floor and check if the needle cross one of the parquet line (providing each parquet’s strip has the same height).

The experiment can be modeled as two random variables representing, for the first, the distance between the center of the needle and the closest parquet line, for the second, the acute angle between the needle and the line. Both random variables follow an uniform distribution, respectively of parameters (0, {\frac{length(needle)}{2}} ) and parameters (0, {\frac{\pi}{2}} ).

A needle cross a line when the angle is superior to 0 and, depending on the previous angle, the distance is less than :

{sin(angle)\times\frac{height(strip)}{2}}

Thus, the condition “the needle cross the line” can be summarized by this equation :

{x \leq \frac{l}{2} \sin (\theta)}

Where a is the length of the needle, θ the angle and x the distance.

The cool part is that computing the joint probability of the two random variable with the crossing condition gives you an expression of π :

{\pi = \frac{2aN}{ln}}

Where N is the number of needle dropped, l the height of a strip and n the number of needle that crossed the line.

Therefore, for a good number of needle drop you can get a value fairly close to π.

The following C# source code is doing precisely that :

Which give us a rather good approximate of : {\pi \approx 3,14208745948547}


free blog themes