jQuery UI DotNetNuke integration#

I just launched a new project at codeplex aiming at the integration of jQuery UI in DotNetNuke: http://jquidnn.codeplex.com/. The first releases are already available in form of DNN module packages containing the core functionality, including infrastructural code to include jQuery and jQuery UI, two web controls for the Tabs and Datepicker widgets, and the smoothness theme.

Also available are module packages for three more themes: Cupertino, UI Darkness and UI Lightness. Further skins are actually quite easy to package and will follow over time, or when someone issues a request for one ;-)

So please, start grabbing the releases and giving me feedback.

Friday, April 03, 2009 12:04:47 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Bogus errors from ASP.NET compiler#

I just wasted another hour, trying to figure out, what exactly ASP.NET was trying to tell me, when giving me an "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)." message on compiling my ascx file.

Ok, so I used a custom namespace, but I've done that hundreds of times, so that shouldn't be the problem. I also had a custom base class inheriting from UserControl. Also, nothing I haven't done before. So what was the issue now?!

I basically retyped everything concerning the namespace and class names in all files, but nothing helped. So I reverted to commenting out my code. This helped me find the issue: I used a

<% if (somethingOrOther) { %> Some code here <% } %>

construct in my ascx-file (Please don't start an argument on whether this is good practice or not. I know it's not the cleanest way to do things, but that is not the concern here :-) ), and actually forgot to put in the closing <% } %>. Ok, my fault, but shouldn't you get a better Compiler message than "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)."?!

So, if you encouter this error (and believe me, I've had it more than once due to typos), and are 100% positive you've spelled everything correctly, check for unbalanced parentheses!

 |  |  |  |  | 
Wednesday, March 18, 2009 5:43:48 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Be careful when reusing ListItems#

Yesterday, I had one of those WTF moments. I had a page with a form for entering two addresses. Both had the same fields, including a RadioButtonList with identical items. Since the items are resourced, I decided to optimize the performance by reusing the ListItems like so:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation.Items.AddRange(items);
this.salutation2.Items.AddRange(items);

Simple eh. Everything seems to be ok. And was I amazed, when I tested it, and I always got the SelectedItem to be the one selected in salutation2. I double-checked every location were I was storing the values, in case I forgot to change the field name after copy/pasting. But everything was correct, as far as I could tell. I even checked the values submitted by the browser, they were also correct.

Finally, it hit me: The ListItem has a Selected property, and it is used to find the RadioButtonLists SelectedItem property. And since I reused the items, the first list parses its items on postback, sets the appropriate ListItem's Selected property to true. Same thing happens with the second RadioButtonList. And since the ListItems are used in both lists, the last one wins.

So, I changed my code to look like this:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation.Items.AddRange(items);
items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation2.Items.AddRange(items);

Now everything works as it should. So next time, be careful when reusing your ListItems!

 |  |  |  | 
Tuesday, March 17, 2009 12:12:24 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Monty Python's Spamalot musical#

Last night, I went to visit Monty Python's Spamalot musical in Cologne. I had no idea, what to expect from it, and I was quite sceptical concerning the german translation. I was very surprised by the job, the whole team has done. It was very funny, in typical Monty Python style, many unexpected gags, and very ludicrous. I actually believe, they got some gags in german, that weren't in the english version. At least, I wouldn't know, how to translate it, to make it funny :-) I'm very interested in the english version, though. Humor is definitely best in the original language. Nonetheless, the musical is definitely worth seeing.

Thursday, January 29, 2009 1:29:07 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Upgrade hassles with SQL Server 2008#

Yesterday, I wasted a few hours trying to upgrade my SQL Server 2005 installation to 2008. Actually, upgrading is a simple process. You can simply select, which instance to upgrade, and the installer does the rest. It worked absolutely fine for my regular instance. I got some installation errors for a component, but didn't mind that at first. Everything seemed to be working.

At least I thought so, until I noticed, WHAT component got the errors. The SQL Server Management Studio was not installed. And the older 2005 version isn't able to connect to 2008. Bummer.

So I thought, let's try to reinstall it. Same error: "The error code is 2349." When you copy the details to the clipboard, you at least find the URL http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1600.22&EvtType=0xF45F6601%25401201%25401, that gives you the information, that the SQL Server Native Client is causing the trouble.

So I tried upgrading my SQL Server Express instance, but that was also dismissed with an error. Next, I uninstalled my SQL Server 2005 express instance, uninstalled the native client, and now added the Management Studio feature to my SQL Server 2008 instance. Same error, this is really getting frustrating.

So now, my last resort is to uninstall the whole d*rn thing and try to reinstall it. At least the installation only takes about 2 hours *cough*.

UPDATE: Even the complete uninstall did not help. As the error message states, the Native Client is supposedly not installed from the sqlncli.msi package. Well, I even uninstalled and reinstalled ONLY THAT package, to no avail. I'm still getting the same bogus error, when I try to install SSMS. Any help is welcome! I'm out of ideas.

But at least I'm not all alone with my ss2008 install problems. A friend of mine had other issues, but at least he was able to resolve them: http://www.entwicklungsgedanken.de/2009/01/28/installation-problems-with-sql-server-2008/comment-page-1/#comment-252.

UPDATE 2: I have found out, that it's the Visual Studio Tools for Applications 2.0 installer, that is causing the problems. But I still have no idea why.

UPDATE 3: Rollback all rants :-) I found the issue. A file could not be replaced/updated by the installer. This was due to the fact, that my hard disk seems to be defective. The file could not be read, even less replaced. After renaming it, the installation went fine. So now, I have performed a scandisk, the errors have been cleared, and everything is in order. Guess I'll be backing up more often now, though.

Wednesday, January 28, 2009 10:36:10 AM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Developing WCF with HTTPS#

I just ran across a really nice article describing how to create a self hosted WCF service using HTTPS bindings. It's a nice step-by-step instruction on how to create your own certificates, adding them to your store, configuring the Windows HTTP runtime, and configuring your WCF service. You can find the article on CodeProject at this url: http://www.codeproject.com/KB/WCF/WCFSSL.aspx. Really nice article, helped me a lot. Kudos to Chris.

Also, Steve Johnson created a nice little GUI for the httpcfg command line tool, which you can find here: http://www.stevestechspot.com/ABetterHttpcfg.aspx. It's a nice addition to the article, so you are not completely bound to the console :-)

 |  | 
Tuesday, January 13, 2009 9:22:35 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

DotNetNuke now with jQuery#
I have been using jQuery with DotNetNuke for a while now, and was very happy to finally see it integrated into DotNetNuke. What makes me wonder, is that there is no central method for including it in DNN 4.9.1. The library has been placed into the folder ~/Resources/Shared/scripts/jquery, but the one usage I could find does not use the ClientScriptManager to include the script. Instead, it manually creates a Literal script control. This will cause the script to be included multiple times, if different controls use it simultaneously. Perhaps this will be "fixed" in a future release. Perhaps adding a method to the ClientAPI for including it would be a good solution for a global include mechanism.

Wednesday, January 07, 2009 11:06:15 AM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

Outlook 2007 stationeries and image spacing#

Today, I had to make a template for a mailing. I decided to create it as a stationery for Outlook, since this was the desired way of sending the mails. Not much to it, one might think. I created the HTML for the template (of course using the dreaded layout tables, since OL2007 went back to the stone age with its rendering engine), and copied it and the required images to the stationery folder. Having done that, the stationery showed in my list and I was able to create a mail using the template.

But what's this?! Were do the gaps in between the images come from?! And why are my shadows not aligned anymore?! Outlook simply went on and pratically destroyed my layout. I basically tried everything that came to my mind, trying to fix the gaps: modified paddings and margins using css, html attributes, added fixed widths and heights, nothing seemed to work. I even removed all the tables and simply placed two images after one another, no white space in between. Still, I got my gaps.

When everything seemed hopeless, I decided to simply send the mail the way it was. Guess what: everything is in perfect shape, when the mail arrives. No gaps, everything is aligned perfectly. I can even simply forward this mail, and it looks great in the editor. So the gaps only show, when you first create the mail using the stationery. Afterwards, everything is as it should be.

<rant>Now that's what I call a consistent user experience! Great job from the folks at Microsoft. I wasted a whole day trying to work around this bug.</rant>

And by the way, using stationery is probably not the best solution, since Outlook completely reformats your code and places all those unneccessary MSO* css styles in your mail's code. So if something goes wrong with your mail, you might consider NOT using Outlook to send it in the first place.

 |  |  | 
Sunday, December 14, 2008 11:50:02 PM (W. Europe Standard Time, UTC+01:00)
Comments [0]  | 

 

All content © 2009 , Christoph Herold