# Friday, October 24, 2008

I've been working on a small Windows Mobile app and I had a really weird problem. While working in the emulator everything worked fine. However, when I deployed it to my Smartphone (HTC S710), it didn't show the labels. Textboxes etc. worked fine, but the labels didn't show up, no matter what I did. Some of the things I tried:

  • redeploy
  • changing the font of the labels
  • making sure there was no overlap between labels and textboxes

It took me about an hour to get it working. I went into the settings and because there wasn't anything about screen/font settings I finally looked at those of the startup screen (option 4), thinking that this didn't have anything to do with my app. As it turned out the culprit was a color scheme that I downloaded from the Windows Mobile site called EarthView.

Friday, October 24, 2008 12:13:18 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, October 20, 2008

I while ago I created the control shown below. It acts a multi-select ListBox from the API perspective, but works by selecting items and moving them over. Pretty much all elements can be styled, such as the headers, the ListBoxes and the buttons. I'd love to have one with some JavaScript that allows drag-n-drop, but that's too much work for me. Feel free to copy and extend the source code(3.15 KB).

Monday, October 20, 2008 9:38:33 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, October 06, 2008

Microsoft heeft ten aanzien van jQuery een opmerkelijke stap gemaakt. In plaats van zelf iets jQuery-achtigs te maken, heeft Microsoft aangekondigd jQuery zelf te gaan ondersteunen en nieuwe onderdelen van ASP.NET AJAX op jQuery te baseren. Dit is zowel door jQuery als door Microsoft bevestigd. Ik ben hier persoonlijk zeer verheugd over en ik hoop dan ook van harte dat Microsoft deze lijn doorzet. Ik heb veel liever dat Microsoft ondersteuning biedt voor (toonaangevende) bibliotheken dan er zelf een (vaak minder goede) kopie van te maken. Overigens is het niet alleen zo dat Visual Studio jQuery technisch gaat ondersteunen, maar ook dat klanten van Microsoft support kunnen krijgen via Microsoft. Ik ben benieuwd of er nog meer gaat volgen in deze richting.

Monday, October 06, 2008 9:16:03 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, August 30, 2008

I run a a development team and we're working on some functionality that we're likely going to share between different projects. The problem is that part of the functionality are some adminstration pages that we want to be able to develop separately, deploy as part of customer's. The requirements we have are roughly the following

  1. We can version the pages separately, so that when we patch the shared functionality, we don't have to rebuild/redploy the entire site.
  2. We don't have to copy files from one project (the project with shared functuionality) to another (the project that is customer specific).
  3. In our source control the customer's website is really a separate project and not a branch of the project with shared functionality.
  4. The administration pages should be themed to the customer's site and additional admin pages may be added custom for the customer's website.

The best way, we figured, was to deploy the shared functionality as a seprate assembly, similar to a precompiled website. A precompiled website however is one thing, AFAIK you can't dump two precompiled websites into the same application. I did figure out a way to deploy the site as an assembly, by putting the admin pages inside an assembly as an embedded resource. We then pull the pages out using a VirtualPathProvider. There are great implementations out there using the VirtualPathProvider, such as serving a website from a ZIP-file and from a database (which is what SharePoint does).

If you don't know what a VirtualPathProvider is, let me quickly fill you in. When ASP.NET gets an aspx page for the first time, compiles that page and stores the result in a system directory. Only when you change the file will ASP.NET recompile the page. Now, the file system that ASP.NET gets the page from is virtualized, which means that ASP.NET does not know how the underlying file system is implemented. By default this is the normal Windows file system, but you can create a provider that uses another storage mechanism. As long as it works just like the file system, this will work fine. You can use a database, XML file, ZIP file, web service, or whatever as the underlying file system. All you have to do is create a few classes, including an implementation of the VirtualPathProvider, register the provider in global.asax, and you're off. The great thing is that because you're supplying ASP.NET with the page, your page benefits from ASP.NET (pre)compilation. This means that if you build a CMS with content in a database, the database is only hit the first time the page is requested and the content is compiled into the page.

So, what we can do is put the aspx pages inside an assembly as an embedded resource and serving the pages from there. Because the pages are inside a regular .NET assembly, it can be linked into a project and be updated when there is a patch, without affecting the application's it is contained in. All we have to do is redeploy the assembly. It sounds a bit weird, but it actually works, as you can see in the attached demo (51.54 KB). Be aware that this is really just a demo. It is just meant to prove it works. The logic to get directories is flawed (which has something to do with the fact that directories are not preserved in embedded resources), and possibly more is. However, you can access the following pages:

  • \AdminHome.aspx
  • \Default.aspx
  • \NewFolder1\HTMLPage1.htm (only works in VS webserver or IIS7 in integrated mode)

Default.aspx is kind of funny, because the code behind class is compiled in the class and the page itself embedded. Enjoy!

Saturday, August 30, 2008 10:15:37 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, August 23, 2008

LINQ to SQL ontwikkelt heerlijk als je weet dat je alleen tegen SQL Server hoeft te praten. Maar LINQ to SQL voegt wel weer een extra laagje toe, waardoor de kans groot is dat er vertraging optreedt. Hoewel... LINQ to SQL doet ook aan caching, dus als je veel met dezelfde data moet werken, hoef je niets extra's to doen om code aanzienlijk sneller te laten lopen dan wanneer de database iedere keer benaderd moet worden. Rico Mariani geeft in vijf delen een aardig inzicht in de performance van LINQ to SQL en wat je kunt doen (of niet hoeft te doen) om de performance te verbeteren. Het eerste deel, met links naar de andere delen, vind je hier.

.NET | LINQ | Nederlands
Saturday, August 23, 2008 10:10:33 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, August 15, 2008

Ik kan soms best vergeetachtig zijn. In dit geval wel schandelijk, want ik ben volkomen vergeten te melden dat ik een nieuw boek uit heb: ASP.NET 3.5 - de basis. Net als z'n voorganger ASP.NET 2.0 - de basis een boek om te leren werken met ASP.NET. Het is gebaseerd op z'n voorganger, maar bevat behoorlijk wat nieuw materiaal over o.a. ASP.NET AJAX en Language Integrated Query (LINQ). Uiteraard komen ook de nieuwe ASP.NET server controls aan bod.

Friday, August 15, 2008 9:16:07 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

Op zaterdag 6 september organiseren dotNED, SDN en VBCentral samen Code Camp 2008. Vorig jaar kon ik er helaas niet bij zijn, maar dit jaar zal ik er niet alleen bij zijn, maar ook een sessie doen. Omdat ik heel erg hou van interactie doe ik een zogenaamde Chalk & Talk. Dat is een sessie waarbij interactie met de groep voorop staat en er niet een vooraf vastgestelde agenda is. Het onderwerp van de sessie in Omgaan met data in een Service Oriented Architecture. In een SOA is een service namelijk verantwoordelijk voor een bepaald domein en de data die daarbij hoort. Een join doen met in de database met data van een andere service bijvoorbeeld is uit den boze... of toch niet? Dat zijn het soort vragen die aan bod komen in deze sessie. Hopelijk tot ziens op Code Camp 2008!

Friday, August 15, 2008 8:52:32 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, July 23, 2008

I've now read several books on SharePoint development, such as Developer's Guide to the Windows SharePoint Services v3 Platform , Microsoft harePoint 2007 Development Unleashed, and Programming Excel Services. I've found each of these books lacking, particularly the last two. The Unleashed book is more a reference than anything else and especially in the more advanced topics I really didn't find what I was looking for, which is not what you'd expect from an Unleashed title. The Excel Services book is a disappointment if you are looking for good information about Excel Services. If you want to learn to develop WebParts it is quite good however. In that sense the book has been completely misnamed. I hope that my next pick will be better (that said, two of the three books were given to me).

Wednesday, July 23, 2008 10:37:33 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, July 19, 2008

I just moved my blog to a new server and in the process did a long overdue upgrade of dasBlog. Unfortunately now all download links fail and some images are missing. I will be correcting this, but if you find a link/image that doesn't work, please drop me a line. Thanks.

Saturday, July 19, 2008 7:32:44 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |