Tidbits
If you ever encounter this error when compiling your C# program, don't be alarmed! Obviously, arithmetic operations ARE supported for decimal, double, etc... You're just not allowed to mix double/float and decimal in arithmetic operations.
For instance, the following code will generate the above error:
For instance, the following code will generate the above error:
decimal val = 0.45M;
decimal result = 0.15 * val;
Just change the second line as shown below to get rid of the error:
decimal result = 0.15 * val;
decimal result = 0.15M * val;
I recently got my hands on Visual Studio 2008 RTM (release to manufacturing - in other words, NOT in beta anymore) and set out to install it on my machine thinking it would be a matter of popping the DVD in, clicking through a couple of screens and leaving the installer alone do its thing while I took care of other things. Little did I know that there was a world of frustration in store for me.
I came back to check on the install after an hour or so to find out that the install had failed at the very early stages - specifically, the installation of the web authoring tool had failed because of an Office 2007 compatibility issue. So the first thing I did was perform a Google search for VS 2008 installation problems and I came across a number of sites (mainly MSDN newsgroup posts) containing user complaints related to VS 2008 installation issues. After trying a number of suggestions that turned out to be dead ends, I came across a site that provided the answer and a lesson in debugging: always look for log files when you encounter installation problems.
Here's the site:
http://www.hanselman.com/blog/Office2007WontUpgradeFromAPrereleaseVersio...
And here's a summary of the steps I took:
- Look in "C:\Documents and Settings\\Local Settings\Temp" for the most recent file of the form "SetupExe{...}.log".
- Look for the product code of the component that caused the failure. In my case it was embedded in the line: "Catalyst beta product conflict check failed. Office Beta product conflict is detected on the computer, productcode={40120000-00A8-0409-0000-0000000FF1CE}".
- Look in the registry for the GUID ({40120000-00A8-0409-0000-0000000FF1CE} in my case) that you find.
- Uninstall the product using Add/Remove programs.
I came back to check on the install after an hour or so to find out that the install had failed at the very early stages - specifically, the installation of the web authoring tool had failed because of an Office 2007 compatibility issue. So the first thing I did was perform a Google search for VS 2008 installation problems and I came across a number of sites (mainly MSDN newsgroup posts) containing user complaints related to VS 2008 installation issues. After trying a number of suggestions that turned out to be dead ends, I came across a site that provided the answer and a lesson in debugging: always look for log files when you encounter installation problems.
Here's the site:
http://www.hanselman.com/blog/Office2007WontUpgradeFromAPrereleaseVersio...
And here's a summary of the steps I took:
- Look in "C:\Documents and Settings\
- Look for the product code of the component that caused the failure. In my case it was embedded in the line: "Catalyst beta product conflict check failed. Office Beta product conflict is detected on the computer, productcode={40120000-00A8-0409-0000-0000000FF1CE}".
- Look in the registry for the GUID ({40120000-00A8-0409-0000-0000000FF1CE} in my case) that you find.
- Uninstall the product using Add/Remove programs.
Here's a quick and dirty way to retrieve the keys of a hashtable (or generic Dictionary in this case) as a sorted list:
...
public static List<K> GetSortedKeys<K, V>(Dictionary<K, V> table)
{
List<K> sortedKeys = new List<K>();
foreach (K key in table.Keys)
{
int locIndex = sortedKeys.BinarySearch(key);
Debug.Assert(locIndex < 0);
sortedKeys.Insert(~locIndex, key);
} // foreach
return sortedKeys;
}
...
public static List<K> GetSortedKeys<K, V>(Dictionary<K, V> table)
{
List<K> sortedKeys = new List<K>();
foreach (K key in table.Keys)
{
int locIndex = sortedKeys.BinarySearch(key);
Debug.Assert(locIndex < 0);
sortedKeys.Insert(~locIndex, key);
} // foreach
return sortedKeys;
}
...
I was researching destructors and finalizers in Visual C++ 2005 and came across two useful articles.
The first article is quite exhaustive and is sprinkled with some great code snippets, while the second article (on MSDN) summarizes the salient points effectively - in addition to providing a few useful examples.
Here's a quick summary of what's covered in the two articles mentioned above:
