A couple матрёшки I painted at a Russian culture event a few weeks ago. I started with a koala, and the penguin was suggested by a non-geek, as well as the fox (not pictured).
Karmic Матрёшки
December 12, 2009Kubuntu 9.10 Released!
October 29, 2009After another 6 months of hard work by all the Kubuntu, Ubuntu, and KDE developers, Kubuntu 9.10 the “Karmic Koala” has been released! There have been improvements in many areas from appearance to translations to network management to a general solidifying of the KDE 4 platform. See the release announcement for new features.

Kubuntu 9.10
Thanks to all the developers! Go download! (preferably via BitTorrent)
10.22.09
September 30, 2009I’ve been watching TV a bit recently (It’s stage 3 of dealing with the trauma of not having homework anymore.) and I keep seeing this date pop up, with a little girl talking about “happy words.” It seems Microsoft Windows 7 is coming out soon. I’ve heard about it here and there, but it didn’t really register that the next version is coming in just under a month until I saw the commercials.
So far I haven’t heard anything bad about the upcoming windows release, which is quite a contrast to the months leading up to Vista. I looked around their website and there’s some interesting stuff, but nothing revolutionary. Nothing important we haven’t got, or will have soon in a better form. And it still has that nauseating default theme from Vista.
This makes the timing of the Kubuntu Karmic release very interesting. It really seems like this should be the big faceoff. A lot of good things are coming together for Karmic. KDE 4.3 provides a smooth desktop experience with a lot of little annoyances fixed. Finally most networks work (again) out of the box. Legacy KDE3 things are finally gone from the CD. It would be amazing if Kubuntu Karmic was the release you could pull out at the same time as the brand spanking new Windows 7 and blow away the competition.
And it’s close, but it’s not that release. It’s just the first release where most of the KDE 4 desktop has come together, but there are still some issues to fix, polishing to do, and a couple core apps need to stabilize. Another 6 months. Concidentally, Lucid 10.04 is also the next LTS. Perfect timing to really bring all the pieces together and make a polished release that will put the proprietary competition to shame. I’m really looking forward to Lucid. The drama would just be so much better if it was 9.10.
On Kubuntu hating
September 27, 2009Lots of vague comments lately on how bad Kubuntu is compared to distro X. What I am seeing is a lot of whining and not a lot of doing. These comments aren’t coming from a nontechnical audience (they are, at least, following Planet KDE) or from people who just want to rat on Kubuntu. They are on KDE developers’ blogs by users and developers many of whom claim to use Kubuntu as their primary OS and at least some of whom are interested in seeing Kubuntu do well.
The core Kubuntu team is small and we do our best to keep up with blazing fast development in all parts of the distribution. In order for everything to come out as polished as we all would like, we need more community participation.
So, to the commenters: you are using Kubuntu because you think it offers some advantage over other options, but clearly there are some holes and rough edges so, if you see a problem — do something about it instead of whining. This is open source. Use that little bit of programming you learned to fix a paper cut[1]. Write up a better project summary and feature tour for the website and send it to us[2]. Test a CD image. Create a new website theme[2]. Help us sort out bug reports. Run an alpha release on your extra machine. Talk to a developer to debug your problem. At the very least, file a bug[3].
And this isn’t the dreaded “send patches or we’re not talking to you.” If the complaints amounted to something we could actually ask for a patch for, that would be progress.
[1] Contrary to popular belief, Kubuntu IS participating in the 100 papercuts project, and some bugs have been fixed.
[2] There was a contest for a new website a while back, but almost noone participated. I find it hard to believe there aren’t a bunch of people out there who think the website could be better and know web design. So help out!
[3] In Karmic, go to Help > Report Bug… in any application.
More Impressions of C#: 3.0
September 12, 2009The topic of this post is basically: lambdas are awesome.
C# 3.0 introduced lambda expressions with type inference and a set of generic delegates in the .NET framework. That means you can do this:
event Action<string> MyEvent;
…
MyClass.MyEvent += (s) => { doStuff(s, 5) };
The => operator defines an anonymous method (lambda) taking the arguments on the left to the statements or expression on the right. Types can be specified, but don’t have to be — the compiler can infer them, in this case from the event type. Note that it takes exactly one simple short line to define an event, and one simple short line to connect it. There is no redundancy or boilerplate code, and the function handling the event does not have to be written specifically for that purpose. Sweet.
The above is roughly equivalent to, in PyQt:
self.emit(SIGNAL(“myEvent”),”foo”)
…
self.connect(someObj, SIGNAL(“myEvent”), lambda s: doStuff(s, 5))
In Qt with C++, you would have to define an extra method if you just wanted to pass an extra argument like this. There are of course many other uses for lambdas. One new use in C# 3.0/.NET 3.5 is the LINQ framework, which defines extension methods for common types, in particular IEnumerables that, in the simplest use, allow you to use lambda expressions to execute queries:
IEnumerable FilteredList = MyList.Where(person => person.Name == “bob”);
LINQ also allows you to write these queries using an SQL-like syntax.
The hundreds of other posts and documents online can explain it all better than I can, but finding things like this makes me like C# more and more.
Impressions of C#
August 9, 2009Disclaimer: this post is about my recent experience working with C# and has nothing to do with the Mono debate.
Over the last month and a half I’ve been working on an application using C#, .NET, and Windows.Forms in Visual Studio 2008. I started by learning C# (unfortunately from some outdated materials). At first it seemed like they took the worst instead of the best things from Java and C++, but overall I’ve gotten to like the language. Here are some of my thoughts on it, some more elaborated than others.
I like properties[1]. They get rid of a lot of clutter and allow you to do some neat things. They also tend to much reduce people’s tendencies to use public fields. I really like VS’s “encapsulate field” option that generates a property from a field for you.
I don’t understand the need for the internal keyword or why this is the default visibility.
I like how there are interfaces as in Java. I’m not sure if I like how there is no multiple inheritance as in C++ and Python. I’m not sure if I like how implementing an interface and extending a class uses the same syntax.
Generics are nice, but C# has the same historical wart as Java where the set of Collections in the system library includes old non-generic classes that are still used.
I miss C++’s consts everywhere. No const parameters or const methods or const return types in C#.
I like how you can write unsafe code. I haven’t actually made use of it yet, but I think this is a huge advantage over Java.
The Reflection API can be useful, but it’s not nearly as easy as Python’s getattr() & co.
String comparison with == by value is a great improvement from Java.
C# has operator overloading. Yay.
Events
The biggest thing C# has over Java for me is events.
Events suck in Java. Most of the time you end up having to define a whole extra class to handle one. Since handling an event is so tedious, they are often quite generic and you have to check the arguments for what actually happened. The one good thing about it is it’s clear OOP with no magic.
Handling events in pure C/C++ usually involves callbacks with function pointer voodoo. Qt provides a very nice type safe layer with signals and slots, with an almost ideal syntax, but the implementation is questionable and magical.
C# has events built into the language. A class can have events with specific arguments and can invoke them much like Qt signals. Events have types that identify their signatures, so it’s type safe and no magic. However, that’s also where it gets clunky. For every event with different arguments you need to also declare a delegate for the type (from what I understand but haven’t read into yet, C# 3.0 provides some generics to make this less tedious). When connecting an event, you need to create an instance of the delegate.
In addition, .NET requires that all events take two arguments: a sender object (nice!) and an EventArgs object with the rest of the data (yuck!), which makes the whole thing almost as bad as Java. But without that restriction, which is only for compliance with other .NET languages, it’s almost as nice as Qt signals.
Unfortunately, as with many parts of C#, there are some restrictions on how events can be used that make the language seem incomplete and/or don’t quite jive with what seems like sensible OOP. Only a class that declares an event can call it, not a subclass. Events are null if there is nothing connected to them, and you have to check for this. The race condition implied there is quite disturbing, but I don’t think I’ve run into a problem yet. In most cases, to workaround both problems, you have to declare a separate method that does this check and invokes the event, which makes the whole thing again more tedious and clunky than it should be.
Events seem to be objects. They have a type and operators. But you can’t just use them as objects, can’t pass them around. An event is basically a delegate with stripped down functionality and this stripping down is built into the language, which seems rather wonky. Of course, the only reason I would want to do any of these things is to work around problems in Windows.Forms. Also maybe because I’m spoiled by python where everything is on equal standing as an object.
Limitations and Warts
In addition to the problems with events, there are some other limitations I’ve run into.
virtual keyword: This is one of the aforementioned carryovers from C++ that is not in Java that I don’t undersand why it was brought back in C#[2]. There is probably a good technical reason for it, but API-wise it’s just annoying.
Name hiding: C# allows you to create members in subclasses that hide (no polymorphism) rather than override base class members. The language has the “new” keyword to do this, but does not require its use. I think most of the time hiding methods like this without polymorphism is just asking for trouble, and the keyword seems almost useless if it is not required. The compiler does give a warning when you hide something without using new, so I told VS to report those warnings as errors.
You can have type constraints on generic arguments, but for some reason this type cannot be an enum. It also can’t be object, which, while redundant, seems like a rather arbitrary limitation for a language to make.
I expected C# enums to be fancy like Java’s, but it seems despite being derived from a class, they’re mostly limited to C++ enums.
Extension methods are neat, but why aren’t there extension properties?
I have yet to explore lambdas (C# 3.0), but delegates as anonymous methods seem a bit clunky sometimes.
Unsafe code in C# seems like it could cause a whole new set of problems other than those in C++, since everything is allocated on the heap and objects are managed. There are various keywords to deal with pointers to data residing in objects managed by the VM, but it seems like the combination is just asking for trouble.
Overall, while it has its sometimes strange limitations, I rather like C# and it sure beats Java. When/if I get to writing unsafe code, I’ll see how it really compares to C++. .NET, Windows.Forms, and Visual Studio are another story, but this is getting long enough so I’ll leave them for another post.
[1] I wish the MSDN site would work in Konqueror, but I’m not terribly surprised.
[2] Supposedly C# was based on C++ and not Java, but I find this hard to believe.
Oxygen icon set for OpenOffice.org
June 11, 2009One of the things we discussed at UDS (for the third cycle now) is dropping everything KDE3 from default Kubuntu. In Jaunty we got a new NetworkManager applet. k3b is on its way. The blocker for Karmic is OpenOffice.org KDE integration. Well, work is underway on a KDE4 file picker. That leaves icons — time to make OpenOffice fit in visually, at least a little.
Problem is the OpenOffice.org icon set has over 7000 files. Most of them are named something like this: lc03241.png (that’s the new presentation icon, 32×32). Fortunately most of those icons are for various obscure things, including images for the help and some pixmaps for easter eggs (anybody know how to get into some sort of starfighter game in OO.o?). With existing Oxygen icons and a couple free days it’s possible to get a couple nice looking toolbars in Writer:
Unfortunately that’s as far as it gets with existing artwork. The Oxygen team is only prepared to create office suite icons when the various office suites agree on an icon naming scheme.