December 2006 - Posts
Yesterday, Jeroen van den Bos showed me Sphere Online Judge (SPOJ), a site with almost 1200 (!) challenging programming problems / puzzles, and which allows you to upload a solution in sourcecode form and which is compiled and tested on the server. The site exists for over 2 years already and has over 2600 contestants trying to get to the top. That's right, for every puzzle you solve, you get points and the more points you get, the higher your ranking.
.
Although the site runs on a Linux box, you can provide solutions in C# (or in a lot of other languages if you want) which is then compiled and ran on Mono. Every problem gets input from stdin and emits output to stdout, so the site can check if you indeed solved the problem. It also times your execution time, and if you fail to provide a valid answer in the problem's time limit (sometimes you just have 1 second, so often brute force is out of the question), your answer isn't correct as well.
What's so great about the site is that it forces you to think harder than you normally would to solve a problem: you really have to be creative and think out of the box, as the easy-way-out solutions aren't going to help.
So if you have nothing better to do during this holiday or if you need some brain massage, or are just looking for some nerd fun, check out Sphere Online Judge (SPOJ). I haven't registered yet, but are planning to do shortly. Happy coding!
So apparently some people got a free laptop which was payed by AMD and Microsoft. I say: good for them, getting gifts is always nice. (no, I didn't get one, nor would I have accepted it). However a gift from a company has a side effect: there's always a catch.
Though there's some negative buzz about these free laptops and some of the laptop receivers don't understand the negative buzz. Of course there are people out there who are jealous that some blogger got a laptop and others (read: themselves) didn't get one. However the laptop receivers shouldn't focus on these folks. They should focus on another, more important, group of people: their readers. You see, once you get a gift from a company because you apparently participated in a big marketing scheme, as a reward for your part in the evangelization, and you accept that gift, you admit at the same time you're nothing but an astroturfer and your own opinion will never be worth a dime for as long as you live.
People blog for a reason: to get their opinion out in the open so others can read their opinion and use that opinion to formulate their own opinion. They don't blog because they have too much time on their hands and just like to type random text no-one will read (otherwise, why bother publishing it?). So, the core element of an opinion is that it is an opinion, and an opinion of the blogger posting it, not some fragment of a big marketing campaign. As soon as you acknowledge your opinion can be, let's be blunt here, bought, by giving you a nice gift (not a businesscard holder or a coffee cup, but say a ... laptop), you make your own blog worthless. Because, everything you have wrote, what is your opinion? And what is influenced by the shiny gift you got to make you think different?
This morning I read the post written by mr. McLaws: Microsoft Gifts and Ethics. It didn't surprise me that mr. McLaws was one of the receivers of a free laptop, after all, he worked hard to bash any negative word about Microsoft and Vista in the past year or so. However what's so sad is that McLaws doesn't get it, I mean: what he gave away by accepting the gift: credibility.
Of course, there are people who like to waste time on reading marketing goo, however I like to spend my time on a real opinion, real information, not marketing. Life's too short to waste it on reading astroturfer b*llsh*t.
Get it while it's hot: VS.NET 2005 Team suite SP1 RTM download (via Dennis)
Update:Scott Guthrie writes that you should uninstall the Web Application Project add-in first if you have that one installed, as the SP1 installer chokes on that.
At the moment, the SP1 installer is already busy for more than 20 (!) minutes to get started: first preparing, now it's gathering required information, and it's sooooooooo slooooooowww it's unbelievable. It takes 100% CPU usage on my Xeon 3Ghz box and it takes such a tremendous amount of time to even get to the copying of the files, it's hard to come up with any rational reasons why this installer is so awfully slow. The 'gathering required information' stage is now already trying to get information for over 15 minutes and the progress bar is half way!
A 3Ghz CPU is very very fast, this definitely doesn't have to be so incredibly slow. What's also odd is that there's no disk activity. So apparently it's simply doing in-memory calculations and registry searches... wouldn't it be great if data was stored in some kind of database so you could query it and you got response instantly? If only a company would create such a 'database'..... oh wait...
What's odd is that when you do a repair install, it's much faster. So apparently repair knows which elements are installed, but this SP1 has a bit of a problem with finding information. So be prepared to spend a loooooooong time on installing this service pack. With over 2200 fixes, it's well worth it, but be patient.
Update 2: oh no.... I had 2GB free on my C: partition. During installation, it starts whining it has not enough disk space available to install a file, I saw I still had the vista iso downloaded from MSDN on the drive so I removed that. I click the 'Retry' button... But that causes an internal unexpected error
(yeah, ever seen an expected error?) and everything rolls back. Now I have to start all over.
. So be sure you have LOADS of diskspace otherwise you'll be repeating this Bad Excuse for Efficient Software Engineering over and over again...
Update 3: Ok cleaned up some disk space, and I'm running the SP1 installer again. I now see it eats up 450MB (!) of memory. Erm... what? Ok, I'll stop wondering what this installer is doing behind the scenes, it only makes me sadder and sadder, just get the files on the disk, reg the darn dlls and be done with it...
Update 4: After more than an hour, it's finally installed. Hurray... It eats away 1.5GB of diskspace at least, more than 450MB of ram, for over 35 minutes 100% of the CPU time because it had to 'gather information' (I have no clue what piece of code can do that long to gather information. I mean, reading all file information of the complete harddisk takes 1minute 15 on my system...) Also, if it rolls back because of an error (and it's pretty silly so assume the worst: it can't skip actions like skipping the Web Application Project add-in, you have to uninstall that manually), be sure to remove the redundant .msp file from c:\windows\installer, because it eats away 445MB at least and for no reason at all.
So, let's hope the guys who wrote the installer didn't work on the fixes. FWIW, VS.NET 2005 runs fine after installation of this SP1, haven't seen any glitches yet. I do feel sorry for these poor sods who have to re-install VS.NET 2005 some time in the future and have to wade through this remarkable silly installer again...
Perhaps they should add a sudoku puzzle to the installer so you've something to do...
A couple of people (Ayende Rahien, Jeremy Miller and David Hayden) started to wonder why Open Source Software (OSS) isn't that big in Microsoft/.NET land, why the 'big' open source projects in Microsoft/.NET land aren't really big compared to commercial competitors or are dying away without large piles of support from the community and Microsoft.
The reason is simple: Money. Microsoft land and now also .NET land has been and will be for some time to come a land where people are more or less thinking like "Oh, I need a control/tool for this, let's purchase a license of a commercial one I saw in an ad.". In the Java land and also in other areas, like of course the Linux world, people think in general a little different: If you need it, you either download a free, open source one, and if that one sucks, either improve it or write a better one.
Honestly: how many people do you, dear reader, personally know who has actively contributed to an open source project (and with contributed I mean: wrote a piece of code which is now in the main trunk)? If you came up with a number larger than 0, were these projects .NET projects or java/other language projects?
Why is this? There are two reasons. One of the reasons why most Microsoft oriented developers aren't really busy working on open source projects and thus the reason why there aren't that many well supported open source projects for Microsoft platforms is IMHO pretty simple: academics. For a lot of years now, students most of the time learn Java first, and a lot later perhaps a Microsoft oriented language. This leads to a lot of potential open source developers who have no real commercial interest: they just want to code.
The other reason why open source software is more available in other environments than the Microsoft environment is that not a lot of big companies pay a large group of developers to write open source .NET software, like IBM and Novell do for Linux and Java.
A lot of Microsoft oriented developers in general think badly about Java land or for example PHP land. But I think that's a bit sad: "What I don't see, isn't there!". The thing is, in for example Java land, a lot of stuff is simply free, open source, and of very high quality. If you for example check the number of .NET controls which render graphs for you and you check the number of high quality Java controls which do the same, you'll see that on Java there are a couple which are of high quality which are all free, and on .NET just commercial ones.
In Microsoft/.NET land, it's simply paying off to ask money (perhaps even a little) for your work, as most people simply find it normal you won't give away your work for free. In Java land that's much less the case. A large group of very high quality tools and controls is available for every Java developer out there for free, complete with sourcecode. In a sense the opposite mindset is in control there: it's in general normal to give away your work to the community.
The people I quoted at the beginning of this post wonder how this can be solved, but I think it's very hard to solve. The mindset of the Microsoft oriented developer is pretty hard to break, as this mindset has been there for decades already. The other reason, large companies who pay developers to write open source software is also hard to break, unless Microsoft does it themselves, but I really don't think they'll do that, on the contrary: they'll more move towards the opposite. The same for commercial control / tool vendors on .NET for example: why would they start giving their stuff away if there are people willing to pay for it? (Yes that's more or less a chicken-egg problem)
If this really has to be changed, Microsoft/.NET land needs an IBM which employes hundreds or even maybe thousands of developers working on open source software. You see, a lot of the successful open source software projects on Java, Linux (and Linux itself!), PHP etc. are all driven by companies: the developers who write the open source software have to live too, have to pay the bills, the morgage etc. It might sound weird, but to make a project a successful product, or even a product in the first place, takes a tremendous amount of effort, and thus time and the bigger a project gets, the more time it will eat up. If you really want to move forward on a normal speed, you need either a heck of a large group of developers (which creates overhead, and they all do a small part, which creates even more overhead), or you need developers with more time on their hands, namely time payed by the employer: professionals.
It's not strange IBM employes a lot of open source developers and sponsors a lot of others, for example by investments in Red Hat which also employes a lot of open source developers: these companies have a different business model: it's not their core business to sell a lot of licenses. Their core business is to sell support contracts. The more stuff there is to support, and of course, it's key that you control the material supported by employing the developers yourself, the more support contracts you'll sell.
Take for example Hibernate and its little .NET brother NHibernate. These platforms are designed and developed for the most part by JBoss, which is now a part of Red Hat. All main developers (except Ayende
) work for JBoss. This isn't strange, JBoss sells a lot of support contracts each year for Hibernate, so to be able to do so tomorrow and next year, they have to control the life support of these projects and thus fund the main developers by simply hiring them.
As I now live for a long time in Microsoft/.NET land I don't see this happen very quickly in Microsoft land: In Microsoft land, licenses are sold commercially, and support comes with these licenses. So unless Microsoft will sponsor large groups of developers or another large company will support a large group of developers to write open source software, it won't happen: software will stay closed, commercial and not free. Because there's no need to: people will find it normal to pay for a license, so why not ask money for that license?
(for the people who think I'm greedy: I just released a couple of megabytes of sourcecode last week. Though I didn't write that in my spare time. I wrote that during work hours, because it benefits my company and my company's other work. We think that's OK, as everybody benefits, and I also think most of the OSS users think it's OK as otherwise they also should quit using most OSS, as most of it is written by developers employed by (large) companies who work on it full time).
Yesterday, we released HnD, which stands for Help and Discuss, our own customer support system and forums software! HnD has been released as free, open source software under the GPL v2 and uses ASP.NET 2.0, SqlServer and uses LLBLGen Pro v2.0 power for 100% of the data-access functionality.
HnD is meant both as an example what you can do with LLBLGen Pro v2 but also as a functional application for everyone out there. Why a forum/customer support system you might ask? Well, I've been working on LLBLGen Pro now for almost 4 years now, full time, non-stop and after such a long period of time you need to take a step back and perform a reality check: is everything progressing in the right direction, is everything functional enough, are there serious features lacking? etc. etc. So I took a 4 month break and instead of working on new features of LLBLGen Pro I worked on our old forum system, TinyForum, and ported it to ASP.NET 2.0, removed the last old LLBLGen v1.21 code and implemented new features we always wanted to have in our forum system. I didn't do this on my own, I had a big help from a couple members of our support team: Walaa Atef, Jean-Sylvain Boige and Todd Price.
Dogfooding your own work in a serious application is IMHO the best way to test if your own work actually does what you think it does in the way you had envisioned. Of course, during unit-test writing you'll already catch most issues and awkward design decisions but features which take a broarder scope than a single test also have to be able to use easily and efficiently. I must say that I was very pleased to see that I could easily remove any stored procedure and custom view we created in the old forum and replace them with LLBLGen Pro code, enable two-way databinding with the LLBLGenProDataSourceControl and it worked out really well.
Porting the code, written in 'lovely' hungarian coding style (I started the forum in 2002
), from ASP.NET 1.x to ASP.NET 2.0 was fairly straight forward. We chose the default web project style as it's shipped with VS.NET 2005 so everyone can open the sourcecode without installing an add-in, and it worked OK except for deployment where we hit the well-known 'I generate the theme name in every aspx page'-issue. Commenting out the theme directive in the web.config file solved this so if you run into this with your applications, simply comment out the <pages theme="foo"/> tag before pre-compilation and you're set (uncomment it on the production server of course).
We didn't replace all our code with code using new ASP.NET 2.0 features: we kept our own role based security system and didn't use a master page on the main site because we already had a header and a footer control so it was of not that much use while it would imply a lot of work to port every page over to be using a master-page. We did implement theming support though, so creating skins is easy. In the current codebase we still use a lot of tables in the HTML because a forum system is mostly viewing tabular data. Perhaps we'll change that in the future for divs.
We also kept the repeater controls we already used and used the two-way databinding with a grid and the LLBLGenProDataSource control only in the admin section. After all, using a forum is mostly done in a read-only basis so repeaters are excellent ways to dump data into a page.
Porting the hungarian coding style over to modern MS-style wasn't always easy and it became sometimes pretty tedious especially because refactoring support in VS.NET 2005 with ASP.NET is so incredibly slow and, if I may say so: pretty stupid (e.g. renaming a private variable with local scope still triggers the refactor engine to scan every page's code in a terribly slow pace), that we had to use old-skool refactoring techniques (read: search/replace) to get the work done.
Turning a project, which is used internally, into an example to show how things are done is also a task which sounds easier than done. How much extra comments should I add? Is the design straight forward or does it need extra documentation? What can I expect from the reader, is s/he a seasoned developer or does s/he has to learn ASP.NET 2.0 as well at the same time? Should I design this feature with the fastest code possible using feature XYZ or should I use a more general approach so that it explains the more general feature ABC? Questions which answers can help in that process and after a while it became second nature and natural to explain the code I was writing with comments I perhaps wouldn't have added myself before. (I already add a lot of comments during programming, though not in the style of // fill i with 0. )
One of the biggest challenges was to rewrite the LR(n) UBB parser to a new LL(n) UBB parser which was more maintainable. The old forum code used a UBB parser which was generated with my own LR(n) parser generator engine though as the rules and handlers were all defined in code it became very hard to adjust the syntax. Add to that that UBB is a bit cumbersome to parse because it's ambiguistic and you have a parser with shift-reduce conflicts and reduce-reduce conflicts. So with pain in my heart I left my implementation of Aho-Sethi-Ullman's LR(n) parser generator algorithms behind and wrote a new UBB parser which now uses an LL(n) technique. The advantage is that this parser is much easier to extend with new syntaxis or to modify for adjustments to existing syntaxis. The full sourcecode of this UBB parser engine is also included in the HnD sourcecode. It converts any text formatted in UBB to XML.
So what kind of features does HnD pack? Here's a small list of features, there are more, smaller, features not enlisted in this list.
- Unlimited forums can be organised into as many sections as you like.
- Both public and private forums, using role-based security
- Queueing facility for support teams, enabling claiming questions and moving threads between queues. Threads can be auto-queued through forum settings.
- Role-based security system for easy right management
- Flexible attachment system for messages which is configurable per forum and user role.
- Attachment approval system for moderators.
- Editing all messages, editing thread properties and closing and moving threads for moderators.
- Powerful search facility utilizing SqlServer's full-text search.
- Native ASP.NET 2.0 code written in C#
- Using LLBLGen Pro v2.0 for all data-access functionality.
- Standard UBB message formatting with various font styles and sizes as well as allowing quoting, code display, attachments and automatic URL linking.
- Email notification of replies to your topics.
- Allows fine grained control over access to viewing, posting, replying, marking threads as 'done', thread memos and many other options.
- Personal profile creation and management.
- Administration centre with forum and section setup, complete group and member management, extensive ban management, support queue management, role management, mass emailing of groups and users by the administrator and many other options.
- Complete control of fonts and colors by ASP.NET 2.0 theme support.
- Open source, so changes and additions can be easily implemented.
- And many more...
It was a blast creating this piece of software and I hope it will be of help and useful to you all. Enjoy!
More Posts