04 Dec 2007

Visual Studio 2008 Install

So I had Visual Studio 2008 beta 2 installed and got my copy of the RTM media from Ryan today, so obviously I had to do the upgrade today. However I did have Ryan warning me of his experience with it (what made it worse was he didn't even have the beta installed). So I uninstalled the beta. Popped the disk in and it told me to uninstall the beta .Net 3.5 framework. Did that, ran the setup again and it worked, perfectly.

Dunno what else to say really. Normally these things are ammo for the annoyance tag but not today! However if you are unlucky like Ryan, read his post as he is getting some lovely info from MS on the comments.

02 Nov 2007

ReportViewer Control: System.InvalidOperationException: Failed to map the path '/'.

I had an odd issue with trying to get the reportviewer control to work on some ASP.NET pages. I was using VS 2008 beta (but it was a 3.0 project so it should be the same as what you get in VS 2005), and running the solution through the VS web server. When going to the pages (which used local reports) I got the error:

Server Error in '/ATL' Application.
--------------------------------------------------------------------------------

Failed to map the path '/'.
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.

Exception Details: System.InvalidOperationException: Failed to map the path '/'.

No idea what caused it but the moment I changed to run it on IIS it stopped. I did get an error on IIS about reporting services not being able to access the web.config file which was fixed by giving Network Service access to it, that didn't do any difference with VS 2008 web server but it did mean the reports worked. I suspect that it has to do with the way that reporting services locates the web.config file as VS 2008 server runs it as http://localhost:<random port>/<project name>/ where IIS runs it as http://localhost:<random port>.

20 Sep 2007

Word for the day: Configurationize

Configurationize - To make a configurable setting in the system for the specific hard coded value.
24 Aug 2007

Looking Good

Through my experiences with software development a lot of time how good (polished) a software looks is almost as important as if it works well. It seems easier to get people to grant an extension on that deadline if the software looks good. A key point for any development on Windows (and in my main area Microsoft CRM) is icons. Be them for tool bars, menus, start menus or (in MSCRM) entities and ISV.Config changes good icons are a must.

To date I've collected around 11000 and sometimes never have the right one but it's a good collection to have and build from. I do share these with my coworkers but a lot of the time they ask me where I get them from so I have decided to share some of the places I got them from.

This is all inspired by the great set of 105 icons released today Sekkyumu so the first item is hers, but these are in no real order. If I can think of anything special about the site I will put it in but some places I just found some icons there. All these sites have free icons available and most also have paid for icons. I do recommend supporting these guys by buying (or getting your customers) to buy icons from them if you use them alot.

  • Developper Icons by Sekkyumu - DeviantArt is also a great place in general to search.
  • IconKits - These guys have some great free ones and there is a points system (each month you get a point and if you recommend someone you get points) which enables access to more icons.
  • Evraldo.com
  • GlyphLab - I got exposed to these guys when they bundled their icons with Delphi 2005, which still beats the pants off of the ones that ship with Visual Studio.
  • FastIcon
  • Icon Experience
  • FamFamFam - Of all the icons I have their Silk ones (and there is over a thousand in the set) have graced more MSCRM deployments than any others.
05 Aug 2007

Dynamically working with Enum's

Enums in .NET are very powerful in defining options. By default when you define an enum it automatically assigns them sequential integer values from 1 (if you don't specify a start value). So how do we work with these dynamically? Well some say you can't, and they are wrong. But first let me cover the basics, if you want to skip over this scroll down to example 6.

Basics Of Enum

Example 1

In this example First would be equal to 1, Second to 2 and Third to 3.
public enum Demo { First, Second, Third }
Example 2

In this example First is equal to 1, Second to 222 and Third by 986.

public enum Demo { First = 1, Second = 222, Third = 986 } 
Example 3

What’s nice is that if you just want to change the start position then you can define that only, so in this example First is 10, Second is 11 and Third is 12.

public enum Demo { First = 10, Second, Third } 
Example 4

Even better is the ability to decorate the enum with the "flag" attribute, set the numbers (Raymond Chen explained why this is not done automatically) and use it as bitflags. Note the integer values are in traditional flag values with None set to 0 and All set to the combined value.

[Flags] 
public enum Demo 
{ 
None = 0, 
First = 1, 
Second = 2, 
Third = 4, 
All = 7 
} 
Example 5

So how do we use those flags? The code below will output:

First, Third

The code is:

static void Main(string[] args) 
{ 
    Demo Enum = Demo.First | Demo.Third; 
    Console.WriteLine(Enum); 
} 


Dynamically Using Flag with Enums

So here we are basics out of the way, and now on to the fun. I continue to use the definition in example 4 above.

Example 6

First I will show how to add a value to the enum variable. What I do is start off by defining the enum to none (0 value) then using the OR concat (|=) symbol I add each enum. This code will output:

Second, Third

The code is:

static void Main(string[] args) 
{ 
    Demo Enum = Demo.None; 
    Enum |= Demo.Second; 
    Enum |= Demo.Third; 
    Console.WriteLine(Enum); 
} 
Example 7

In this last example I will show how to remove an value from the enum variable. I start off by defining all (integer value of 7) and then I use the AND concat (&=) symbol and prefix the enum value with tilde (~). This code will output:

First, Third

The code is

static void Main(string[] args) 
{ 
    Demo Enum = Demo.All; 
    Enum &= ~Demo.Second; 
    Console.WriteLine(Enum); 
} 

Pages