April 2006 - Posts

Is it a bad sign if you leave home in the morning in a car for a day of racing on the track and come home by train in the evening?

I guess it is :-(

But fortunatly I didn't crash it, all I had was an electrical failure. Still it sucked big time as I really was looking forward to a day of race training on the Zandvoort race circuit.

Actually kind of funny, the Mazda MX-5 I have is supposed to be a very reliable car yet it has given me more trouble in the 18 months I have owned it than all the cars and motercycles I have pervoisly owned put togeteher. O well its still a fun car :-)

Maurice de Beijer
www.TheProblemSolver.nl


Interesting reading at Dr Dobbs! See http://www.ddj.com/dept/architect/186500706?cid=RSSfeed_DDJ_All
for the complete article.

Maurice de Beijer
www.TheProblemSolver.nl

with no comments
Filed under:
The Type.GetType() makes it real easy to get a handle on a Type object. However there is a gotcha here because it might not always work as expected. Try the following code:
 
Module Module1
    Sub Main()
        Dim type1 As Type
        type1 = GetType(MyType)
        Dim type2 As Type
        type2 = Type.GetType(type1.FullName)
 
        Console.WriteLine(type1.FullName)
        Console.WriteLine(type2.FullName)
        Console.ReadKey()
    EndSub
EndModule
 
PublicClass MyType
EndClass
 
If you run this code the type name will be printed twice, no big surprises here. Now move the MyType to a ClassLibrary project and set a reference to it. This time the type2 variable is nothing event though the type exists, after all type1 is still a valid reference.
 
To get this working you need to use the following:
Dim typeName AsString
typeName = type1.AssemblyQualifiedName
typeName = typeName.Substring(0, typeName.IndexOf(", Version="))
type2 = Type.GetType(typeName)
 
So why not just use the complete AssemblyQualifiedName? Well it contains a version as well as public key token name and of the assembly is signed it looks for an exact version match, not a problem in a this small sample but in a remoting scenario that might cause a new set of problems.
 
Maurice de Beijer
One of the things I frequently do is copy VB source code into emails and documents. Now Visual Studio 2005 formats the source code on the clipboard but the resulting HTML is a bit of a dog. Most of the time I just ignored this as a minor annoyance but I was working on a newsletter and the HTML needs to be as clean as possible, clearly not what VS2005 produces.
 
Fortunately there is a solution and it is called CopySourceAsHTML. There is a special VS2005 installer, take a look at this blog post for details on how to download and install it http://www.avocadosoftware.com/csblogs/dredge/archive/2006/01/10/544.aspx
 
Recommended :-)
 
Maurice de Beijer
with no comments
Filed under:
That is the question Steve Lasker is asking in this blog post.
 
Basically he ask for 4 short answers and the outcome could just directly affect the future of SQL Server Everywhere. So if you, like me, are interested in the product go ahead and post a reply.
 
Maurice de Beijer
Yesterday I went paragliding on the Beach near Amsterdam for the first time :-) Took a few tries to get airborne as the start is quite different but once I was up there I had a great time.
 
Paragliding on the beach
 
 
Maurice de Beijer
with 2 comment(s)
Filed under:
If you are like me and have a Visual FoxPro background you might me pleasantly surprised if you take a look at SQL Server Mobile/Everywhere :-)
 
Not only do we get ClickOnce/XCopy style deployment like we used to be able to do we also get a more familiar data model then we get using SQL Server (Express).
 
A few interesting classes and functions:
  • SqlCeResultSet
    This gives us direct access to the underlying data. No longer do we get an in memory copy as well as the original in the database, what you see is what you have :-) Use a SqlCeCommand.ExecuteResultSet()  to create one.
  • Seek()
    Want to work directly against the existing indexes when looking for data? No sweat, the SqlCeResultSet.Seek() works just like the Visual FoxPro seek with a few extra useful options thrown in.
  • SetRange()
    The SqlCeCommand.SetRange() function is similar to the Visual FoxPro SET KEY statement. Just specify the range you want before you execute the ExecuteResultSet() function and you will get only the data in the range specified.
 
Of course this isn’t just nice for Visual FoxPro developers but also Visual Basic 6 developers used to ADO will find this model familiar.
 
Now I am not suggesting that SQL Everywhere is a complete replacement for VFP, after all it is a single user data engine designed for local storage. You can put the data file on a share if you like and multiple connections to it can be opened but only from a single machine. So from that perspective there is a huge difference. That also means that all kind of multi user functionality is not supported, after all what is the need.
 
But still it is a promising little database with a lot op potential when used in combination with SQL Server/Express as the multi-user data store.
 
Maurice de Beijer
with no comments
Filed under:
Sometimes I wish I was using C# instead of Visual Basic :-( And anonymous methods are one of the things that tend to bring that wish to the surface. Consider the following code:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
   classProgram
   {
      staticvoid Main(string[] args)
      {
         List<DemoEntity> list = newList<DemoEntity>();
         list.Add(newDemoEntity(1, "one"));
         list.Add(newDemoEntity(2, "two"));
         list.Add(newDemoEntity(3, "three"));
         string theId = "two";
         DemoEntity found;
         found = list.Find(delegate(DemoEntity obj) { return (obj.Id == theId); });
         Console.WriteLine(found.Id);
         found = list.Find(delegate(DemoEntity obj) { return (obj.Number == 3});
         Console.WriteLine(found.Id);
         found = list.Find(delegate(DemoEntity obj) { return (obj.Number == 1 && obj.Id == "one"); });
         Console.WriteLine(found.Id);
         Console.ReadKey();
      }
   }
 
   classDemoEntity
   {
      publicstring Id;
      publicint Number;
      public DemoEntity(int number, string id)
      {
      Number = number;
      Id = id;
      }
   }
}
 
 
Nice and elegant :-) To do the same in VB I would have to write three additional functions and store the variables to search for in fields, yuck :-(
 
Please, please, pretty please can we have anonymous methods in VB 9?
 
Maurice de Beijer
Filed under:
Steve Lasker posted a FAQ sheet on SQL Everywhere  or SQL/e as he calls it. See http://blogs.msdn.com/stevelasker/archive/2006/04/10/SqlEverywhereInfo.aspx for more information.

Maurice de Beijer
www.TheProblemSolver.nl


with no comments
Filed under:
In this last update Paul Flessner announced SQL Server Everywhere Edition.
 
I think this is real good news as this promises to be a small lightweight in process data store that fits the requirements when creating offline applications. And as SQL Server Everywhere Edition is in fact based on SQL Server Mobile it is just a set of DLL's that need to be copied with the application, no registration. In short; perfect for a ClickOnce deployment.
 
 
 
Maurice de Beijer
Filed under:
Microsoft has just announced that Virtual Server 2005 R2 is now available as a free download. Even though I have been using and prefer VMware myself I still think this is interesting news. And for those people using Linux out there the news is even better as Microsoft also announced the Virtual Machine Add-ins for Linux as well. Now you still need Windows 2003 server as the host where VMware has the ability to use Linux as host as well. At a client we have actually used a single Linux host to simulate a network of Windows Server and XP machines with great success.
 
I guess the marketing offensive VMware started has it's effect :-)
 
 
Maurice de Beijer
In the real world deployment to clients directly from a development environment is not exactly the normal or advised way to go. Yet ClickOnce deployment, neat as it is, seems to assume that you deploy straight from development to a production environment. In most applications I work on we take a more sane approach and development deploys to a test/acceptance environment. Only after tests have concluded is the software released to the live production environment.
 
Yet in the case of ClickOnce you need to specify the install location in Visual Studio 2005, hardly the tool to move an assembly from test/acceptance into a production environment.
 
Fortunately there is a tool for the job and it is Mage, or MageUi depending on your preferences and needs. Mage is the command line utility to use when updating or creating a manifest, use this to automate the deployment of ClickOnce applications. To get started MageUi is the more interesting of the two.
 
Lets take a quick look
  • Make sure you have a ClickOnce deployment.
  • Open the .Net framework SDK command prompt.
  • Start MageUi. Starting Mage without any parameters also MageUi.
  • Now open the deployment manifest. This is the ".application" file in the root of the deployment folder.
  • Select Deployment Options.
  • Now you see the URL used to start the application. Here you can change it from a test/acceptance location to the actual deployment location.
 
Besides updating the URL you can also update other aspects of the deployment like update behavior and main application.
 
 
Maurice de Beijer
with no comments
Filed under:
This message is intentionally in Dutch.

Voor iedereen die meldingen en boodschappen in het Nederlands wil hebben is er nu een Nederlandse versie van het .Net framework beschikbaar. Afhankelijk van de situatie kan men of Herdistribueerbaar pakket (x86) voor Microsoft® .NET Framework versie 2.0 downloaden van http://www.microsoft.com/downloads/details.aspx?displaylang=nl&FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5 of het Nederlands taalpakket (x86) voor Microsoft® .NET Framework versie 2.0 van http://www.microsoft.com/downloads/details.aspx?familyid=39C8B63B-F64B-4B68-A774-B64ED0C32AE7&displaylang=nl.
 
De eerste is een complete versie van het framework en kan alleen geïnstalleerd worden als er nog geen andere versie van het 2.0 framework geïnstalleerd is. Indien er al een andere taal, Engels, versie van het framework geïnstalleerd is kan men met het taalpakket de meldingen naar het Nederlands omzetten.
 
 
Maurice de Beijer
with no comments
Filed under:
Maybe I am stupid and all of you already knew this but I just recently discovered this :-)
 
What? O, okay. Well if you want to move files to or from a VMware session all you need to do is drag them from the Windows explorer in the host machine to a second Windows explorer in the VMware session. No need to share folders in the virtual machine and copy them through a shared folder or even a USB pen drive, just drag and drop will do nicely. And it doesn’t even have to be an explorer, the Windows desktop will do just fine.
 
I wish I had known about that sooner :-)
 
Maurice de Beijer