CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

February 2007 - Posts

  • A blog is not a helpdesk

    Please forgive me when this appears a little rude, but I just have to get this of my chest.

    I do answer every email question but recently I am bombarded with comments asking for help on some this or that. I know my blog has a lot of hints to solve many a small tidbit you just have to get solved to get your app up and running. Nothing special but they can be the end of a long search for something stupid. Some of these posts have become a hang-out place for a whole community. That's very nice and I am honored to serve as a host for that. But recently I feel some comments are turning into a direction I can no longer manage. With all kinds of questions which are off topic (how to send email form asp.net on a post on a linkbutton), easier to find with google (YFGI) or already contain the answer. Not all comments are written that clearly (there is no .NET 1.4) and/or contain dead links. The good thing is I can edit comments with CS. Did you know you can even contain an image in a comment? This is the result after my edit. I didn't change the 1.4 part..

    But now the hard part. What am I to do with all these questions/comments? Delete them ? Shout JFGI ? Write a new post on them ? What may sound quite OT to me is somebody else's serious problem of the week. Where and how to draw the line ?

    Any advice is more than welcome.

  • Management on steroids in Vista

    In my last post I wandered why the component service manager was so hard to find in Vista. This appears to be a feature. The component manager is a snap-in for Microsoft Management Console (mmc). This mmc.exe application can be started directly, Vista search will also find it.

    When started the tree is empty. In the file menu is the option Add/Remove snap-ins. And here is a full list of management snap-ins. Including serviced components.

    The nice thing is that you can save a collection of selected snap-ins. Which results in an msc document with an appropriate icon. In the image above there's one in the upper left corner.

    The ability to configure mmc this way is not new, but the process and the dialogs have had a great overhaul in Vista. In 2003 and XP the control panel contained lots of preconfigured mmc's, like serviced components, in Vista you have to assemble these yourself.

  • Locating the Component services manager in Vista

    Com (plus) is not dead (yet). But the component services manager seems to have disappeared from the administrative tools in the Vista control panel. Nevertheless you can start the management console straight from windows\System32\comexp.msc.

    It took some searching to find it. Why is it hidden?

  • Resources in an asp.net site, MissingManifestResourceException and custom tool

    In my last post I described a problem I had with localized resources in an asp.net site. Investigating another side of the matter I found out what really went wrong with my resources. Here's the real gotcha:

    When you add a resource file to a project it is assigned a custom tool:

    Now what the custom tool is depends on the location the resource file is created. Adding the resource to the App_GlobalResources folder it will be GlobalResourceProxyGenerator. With this tool the resources do work right both in markup and in code. Adding it to the project root the tool will be ResXFileCodeGenerator. This tool will result in the MissingManifestResourceException. Moving the resource around in the project does not change the custom tool. Having changed the tool setting by hand my site now completely works as expected.

  • Globalization of an ASP.NET site is easy. But has a catch..

    Making an asp.net website multi-lingual is, at first sight, no big deal. But there is quite a gotcha in the tail. I will rush you through the easy part, try to explain the gotcha and hope somebody can help me to find a fix.

    I have an asp.net site. Most users are Dutch but an English version should be available as well. By default the pages are presented in Dutch but a visitor whose primary browser language is English should see pages in English. This is a setting in the web.config

    <globalization uiCulture="auto:nl" culture="auto:nl" />

    The text of the pages are stored in resource files. These are added in the special App_GlobalResources folder. This also applies to a web-application project. In my project I have two resourcefiles TekstStrings.resx contains the default (Dutch) values and TekstStrings.en.resx contains the English version. For a visitor issuing an en browser request the latter resources will be used.

    Adding support for another language now boils down to adding another resource file, TekstStrings.fr.resx would add support for French.

    The resources are compiled into the app. You can use them by name in markup. For instance as an attribute of a control:

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxNaam" ErrorMessage="<% $ Resources:TekstStrings, LoginUsernameRequired %>"></asp:RequiredFieldValidator></div>

    Using the resource content as plain text requires a literal control:

    <p><asp:Literal ID="LiteralLoginPrompt" runat="server" Text="<%$ Resources:TekstStrings, LoginPrompt %>"/></p>

    You can also use the resources in code.

    LabelError.Text = Resources.TekstStrings.LoginUserNameUnknown;

    The text on the label now depends on the culture of the browser request.

    So far the good news. On the web you will find many variations on the theme, one of my favorite stories is here on MSDN

    I had to experience two catches. The first one is IIS and Cassini (the local development server) behaving different. In my case it was tempting to embed the resources in the application. This is the "Build Action" setting on the resource file. This works very well when testing on the local server but does not work at all when the app has to run under IIS.

    What was worse, and where I do not have a solution for, is using the resources from code. The example using strongly typed resources only works when the namespace of the application has a flat name. On this page the code snippet works:

    namespace ResourcesTester

    {

        public partial class _Default : System.Web.UI.Page

        {

    On this one it does not:

    namespace HHS.DigiRooster.DigiRoosterSite

    {

        public partial class Login : System.Web.UI.Page

        {

    Only because of the namespace. The code will hit an System.Resources.MissingManifestResourceException. A manifest describes the resource-assembly. One way or the other the manifest does not match the namespace which is expected. Googling around tells me it is a bug and that a solution is simple. But I didn't manage to get it right. Any suggestion is very much appreciated.

    <Update>

     The latter is an artifact resulting from the real catch: You have to watch which custom tool is used to compile your resources. See here for the details.

    </update> 

     

  • Vista for the tablet PC

    This weekend I finally installed the final Vista on my tiny tablet. Which is an old notebook with (these days) unimpressive specs but just refuses to retire. Easy to carry, runs XP and VS 2005 quite well and so far behaved well under the Vista beta's. Beside Vista I installed the "Vista experience pack for Tablet PC and "Ink Desktop". Pen and ink integration were already quite good and now I have this:

    Some observations

    • Multilingual handwriting is installed by default. I run an English OS with regional settings set to Dutch. Both handwritings are recognized very, very well. I just wish my primary school teacher, with whom I had a continuing struggle on my handwriting, could see this. He was right, my handwriting is terrible. But Vista understands.
    • Switching recognition language is in the menu of the input panel. The input panel itself is a big improvement over the one in XP Tablet PC edition. The two way interaction with any text input control is great.
    • Ink desktop lets you scribble right on the desktop. The content is saved over sessions, no need for loose notes, just use the desktop itself.
    • The equation writer not only recognizes individual characters but also their relative position in the equation. It requires a tidier hand writer than the input panel, as recognizes on a character instead of a word base.
    • Vista requires a good graphics card. My old tablet does not have DX9 in hardware which shows off. No Aero is not the main point. The response of the machine is good but when it's busy the repaint of the desktop can lag behind for a very long time. The good thing is that Vista smoothly multitasks, the bad thing is that it really needs good graphic hardware.
More Posts

Our Sponsors

Free Tech Publications

This Blog

Syndication

News