Friday, February 29, 2008

Heros Happen {Here} : Virtual Launch!

Yesterday was a great day for Microsoft and for some MCT's!! We had the chance to participate in a 24hr Virtual launch that was seen by people all over the world. Starting on Wednesday 28th Feb at 12 pm PST, Steve Ballmer launched a new wave of products that would dramatically change the way software developers go about their work. His keyote was supplimented with the kick off of the 24hr virtual launch presented by about 20 MCT's from around the world who delivered a 1hr session through live meeting that was free to attend and repeated 24 times!! The recorded sessions can now be viewed again and there is still the chance to get a two hour free online virtual clinic form here too. Scroll down the page for the live meeting recordings. If you didn't get the chance to attend you can also download the slides for the event too.

Wednesday, February 27, 2008

The image file E:\en_SQL2000_Ent_64bit_VL\setup.exe is valid, but is for a machine type other than the current machine.

Just setup a Windows 2003 R2 Server 64bit and then tried to installed SQL Server 2000 64bit edition. Unfortunately I was greeted with this error:
It turns out that this version of SQL server targeted the Itanium 64 processor, where as this server was a Xeon. So it seems I will have to deploy SQL 2000 32 bit edition and make sure to apply SP4 !! The installation cannot be carried out from the autorun, but has to be run from the x86\setup directory.

Friday, February 22, 2008

Windows Vista SP1 for x86 and x64 is here!

Yes Microsoft have released SP1 for Vista. I downloaded it today on DVD for x86 and x64 thru the MSDN site. There is a great 53 page document what has changed with this release, hopefully I'll have time to read it and blog it!! If I don't the link is here. There is also some info on the TechNet site here. Once I installed it I just had to take these two screen shots.

I dig the the caption in this one:

Monday, February 18, 2008

Project 'SilverlightProject1' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file

I've been working fine with Silverlight under my VS 2005 installation but recently I said I'd start doing that work in VS2008. So I installed the Silverlight tools for VS2008 and found a nice new project template for Silverlight projects and class libraries. I clicked it and got a nice Error:

Project 'SilverlightProject2' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file 'mscorlib.dll'.

So I hunted around the web and ended up on ScottGu's blog, surprise:) Some said ditch VB.NET and use C#. Sure enough the C# project worked fine, grrrr. So I uninstalled Silverlight 1.0 and tried the Silverlight 1.1 alpha September refresh. Guess what all is OK. Works a charm in VB.NET.

Accessing resources in a non-typed way in VB.NET

OK so the my namespace is really cool, but sometimes we just want more!! to get at a string in the resources of an app is easy. Go to the project tab, add astring resource with the name CompanyName and then type the value in the field nextdoor. Access the value in code like this

label1.text = My.resources.CompanyName

Now intellisense haspicked up the strongly type property and helps you. The same works for images, add an image to the resource file, browse for it and name it Image1. The following code also works:

Picturebox1.Image = My.resources.Image1

Note no need for the extension and also the intellisense pops up again. You just have to love this!!

So now you want to load a random file from the resources, like a random picture..... hmm this strong typing is getting in the way now grrrr.

Do not fret use the resourcemanager, this lets you get to any resource in the current assembly using a string paramater with its name. YES

So imgine you have 10 pics, called 0.jpg, 1.jpg, 2.jpg etc and you want to load them randomly

so the code now looks like this

Dim intNumber as integer = System.Convert.ToInteger(Math.rnd() * 9 )
Picturebox.Image = CType(My.resources.ResourceManager.GetObject(intNumber), Image)

You can also call the GetString method to pull strnig resources in an untyped fashion!!

Friday, February 15, 2008

Web Parts common Error when getting started

A common error many ASP.NET 2.0 beginner developers make is that when they decide to get into WebParts they drag a WebPartManager on the screen and a WebPartZone and then bung in a control. To their dismay, when they press F5 to run the program they get a nasty error like this:

Error:Server Error in '/WebSite1' Application.--------------------------------------------------------------------------------
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error:

Now this error may appear completely unrelated and confusing but it makes sense when you know why ASP is complaining. Basically the WebPartManager is trying to contact the profile store to save your persoanlisation settings, which happen to default to SQLServer by default. Now your app is clean and you have not specified anywhere that you wanted to SQL as your profile storeor perhaps you don't have SQL even installed. So to get around this just switch off the webpartmanager personalisation by setting its personalisation attribute to false:

<asp:webpartmanager id="webpartManagerSampleSite" runat="server" enabled="false"></asp:webpartmanager>

Friday, February 8, 2008

Windows 2008 Server RTM

It's here, yes 18 days before the 2008 Global Launch Wave, three versions have been RTM'ed and are now available for download to MSDN subscribers:
  • Standard Edition,
  • Enterprise Edition and
  • Datacenter Edition.
All are available in x86 or x64 versions :)

The x86 version is a 1794 MB download. As you can see I couldn't wait to get it installed and try it out!!
BTW, the virtual machine had 800MB of RAM and installed in about 15-20 minson a Core2Duo 2.4Ghz HP laptop. The Hard Disk now occupies 5.7GB of space :)

Saturday, February 2, 2008

ASP.NET 2.0 Dynamic master page switching

I've been delving into master pages this week and found some really neat features that alot of people often ask for. This I think is one of them. In the next three steps I show you how to allow the user to switch masterpages. Basically the idea hinges on the fact that the masterpagefile property of a page can be switched at runtime, but it has to be done in the preinit event of the form with the content. The users selection can be stored in any session management storage. So here are the steps:

  • Create two or more master pages with the same ContentPlaceHolder controls and public properties. These could be straight copies or better still two child masters based on the same masterfile
  • Optionally, provide a way for users to switch between master pages.

Session("masterpage") = "Master2.master"


Assign the master page in the content page’s Page_PreInit method.

Sub Page_PreInit(ByVal sender As Object, ByVal e _ As EventArgs)

If Not (Session("masterpage") Is Nothing) Then

MasterPageFile = CType(Session"masterpage") ,String)

End If

End Sub