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

Peter's Gekko

public Blog MyNotepad : Imho { }

July 2006 - Posts

  • Visual Studio 2005 and Firebird

    Firebird is an open source database which is pretty popular. Own of the downsides of open source stuff is imho the fragmented support. Firebird is a good example of this. You can use it in Visual Studio 2005, but all documentation is mainly directed inward and deals with working on the Firebird for .net project and not on using a Firebird database in your app. Googling around mainly leads to this blogpost or (partial) copies of it's content. These contents might be OK for developing the FireBird support but are both in- and over-complete. As a first step it tells you to install the Visual Studio SDK. Don't do this!  It has several downsides. You can only find it under MSDN subscriber downloads, there is a risk you'll download the wrong version (there's still a Whidbey beta floating around there) and you'll arrive in a licensing fog. Not quite open source :)

    This is what does work:

    • Download the ADO.NET 2.0 Firebirdclient Make sure you have a very recent copy, an essential update was published quite recently.
    • Install it
    • Register the FireBird provider in machine.config, the instructions are in the ReadmeDDEX file, found in the Firebirdclient directory.
    • Edit the FirebirdDDEXProviderPackageLess registry file, found in the Firebirdclient directory.
    • Register the FirebirdDDEXProviderPackageLess registry file.
    • Check that all setting in the FirebirdDDEXProvider registry file are deleted from the registry. Else VS will slap you with error messages.

    Now you will see Firebird in the list of dataproviders of Visual Studio.

    Many thanks to Firebird afficionado Leon, who was stubborn enough to try every variation and got things working.

    Posted Jul 27 2006, 07:07 AM by pvanooijen with 4 comment(s)
    Filed under:
  • Fixing a broken asp.net installation. (The Web server

    This is my third post with this title. What started as quick command line fix has grown into something huge, including top numbers of hits and comments here on Codebetter. So it's worth continuing. An asp.net 1.1 installation on IIS can get broken resulting in the error message in the title. When you're lucky a fix can be done in a couple of seconds from the command line, as described in my first shot. This post was the start of an enormous discussion, making me wandering about a wiki. My second post was a round up of all comments and suggestions, which reached as far as reinstalling Windows itself. Which is another wiki by now. (You can do that on msdn these days)

    The main problem in a lot of scenarios are the security settings. In this post I'll discuss these in more detail.

    When developing web applications there are two users which are important. First there is the aspnet machine account. This is the account under which an application runs in the IIS web server. The account is pretty restricted, to prevent as much damage as possible in case the app is compromised. The other account is the VS developers group. You, working in Visual Studio, are part of that group.

    The security setting on the wwwroot directory are crucial. For the share

    VS developpers need full control here. To create a new web app for instance.

    The security settings for the directory itself: the ASP.NET machine account needs the right to read, execute and list the folder's contents.

    The Visual Studio developers groups needs a more complicated set of rights. To set these click the advanced button and select the VS developers in the advanced security settings dialog.

    Check allow for every entry except Full control, take ownership and change permissions.

    Having done all this you and your web server should have the rights necessary to build apps again.

    Some people reported problems with COM+, the DTC and IIS. I cannot check this but bet you another blogpost there is a related solution for that. Of course you can reinstall everything but I think the only essential part in the installation script is setting the permissions right. Doing that by hand is faster.

  • Connecting to the local network from the Smart Device emulator

    Mobile apps make great consumers for a webservice. But debugging such a scenario can be hard to set up. I lost some hair in getting it to work right; but in the end it was simple. There are loads and loads of good manuals how to setup your device, this one on Akhune's blog tells all, up to connecting to the internet from the emulator. All except how to connect to the web server of the PC your emulator is running on. Which didn't work for me and that's what I really needed to debug my app.

    In a typical scenario you have one solution with a webservice and the "smart device app"; where the latter has a web reference to the service. The first problem is the URI the smart app needs to contact the service. The emulator has an emulated network card and so becomes part of your network. It will not be able to find localhost, what works well is using the IP address of the PC hosting the emulator. The emulator and the PC are two nodes in the network. To the PC the emulator is an external source trying to access your local web server. By default the Windows firewall prohibits this. I had bumped into this before, this time I had to add the web server (HTTP) protocol to the settings of the Local Area Connection.

    Now the emulator runs as intended. Another great setting of the emulator is zoom under the display options.

    It will result in a giant PDA, very readable, very easy to navigate.

    Posted Jul 11 2006, 04:05 AM by pvanooijen with 6 comment(s)
    Filed under:
  • Working with .NET 3.0

    Over the last days I've been working with the .NET 3.0 framework (or whatever you want to call it). Starting from the perspective of a real world application, not a bunch of cool solutions looking for a problem. The idea was to create a WPF tablet PC inking app which stores and retrieves images through a WCF webservice. It worked out pretty well, of course with some beta bumps, and I would like to share some of my findings. These are based on the "official" Vista beta2 and the current CTP of WinFx..

    Which platform to use as development platform

    The 3.0 framework is the API to build apps for Vista. But using Vista as a development platform is a different ballgame. Building the presentation part works like a charm but building services on Vista is no fun. Vista is far stricter in rights than XP, to circumvent that you can start a program, including Visual Studio, as administrator. But whatever I tried I never managed to create a new service under Vista. The best result was a dialog like this.

    Which looks like old horror in a new coat. I gave up and went on using XP as a development platform. After all not a big deal. One of the nice things of .NET 3.0 is that it also runs on XP and server 2003. This separates the development and deployment of Vista applications from the Vista OS and does make the migration path easier.

    Hosting services

    There are several ways to host a service and the VS additions provide several templates for that. I used the WinFx website template which works pretty well. The template generates a skeleton service including a description of the configuration in the comments. You can also add a service to an existing Windows (WPF) or console application, in this scenario the application itself will host the service. The VS additions contain templates for these which spit out another variation of a skeleton service with another configuration in the comments. The configuration settings for a service have changed over the last releases of WCF, the bad thing is that the configuration settings generated for a self hosted service are those of a previous version. Nevertheless, after some fiddling  I managed to get a WPF hosted service up and running. The bad thing is that trying to generate a proxy to consume the service, I encountered a bunch of quite exotic error messages. MSN search was blank on them, Google found them in a couple of very deep digging MS blogs; all of them were security related. My conclusion was to stay from all of this till I have a huge amount of spare time or a new release of the framework. But the IIS hosted service worked well and was a pleasure to work with.

    WPF

    I can be quite short on WPF: it's a plain delight. The additions give you three views on a wpf-form: a visual designer, a XAML markup view and the code-behind. My advice is to forget about the visual designer. Dropping and dragging components from the toolbox will leave you with fixed layout forms and markup which is complete spoiled with unnecessary attributes. Imho WPF is a way to get rid of hard to design fixed layout winforms and brings the ease of flowing web-layout to Windows apps. Besides that the visual designer will give up on you sooner or later. When the markup needs members from the code-behind, for instance for a custom command, you have to add your assembly to the namespaces of the markup. The problem is that the designer is not able to find this assembly and will quit on you. The error message is nice though:

    Resharper has a similar problem with XAML. In the build process out of the XAML an assembly is generated. But in the code editor this assembly is not available yet, as a result Resharper will mark all xaml components in red and fails on code-completing the objects. But it doesn't crash.

    Tablet PC

    Tablet PC functionality is integrated in .NET 3.0. You no longer need to install the Tablet PC SDK to develop Ink aware applications, it's all in the InkCanvas control. Inking itself is also far better integrated into the runtime. You will notice this when drawing with a mouse. This is far smoother than the former, COM based, tablet runtime. Tablet code is not source code compatible with the old API. The architecture and spirit of the API is the same but a lot of methods have new overloads, encapsulating the old versions. Also the Ink property has disappeared, the collection of strokes itself is a main property of the InkCanvas.

    To conclude

    The result is an application which could have been built using classic asmx webservices and classic winforms. As a matter of fact I had already done that some time ago. But building the apps this way required less and clearer code. And the possibilities to add cool things to the app are enormous. For instance I would like to add peer to peer picture exchange using a self hosted service. Which would have been quite difficult to implement using the classic tools. Now it seems just a bug-fix away. I'm really looking forward to a next release.

More Posts