Thursday, December 18, 2008

The Difference between "const" and "readonly" in C#

It has been baffling me for a while since I've used the two keywords for pretty much the same purposes, but after reading a little of the documentation, the difference between the two became much more clear (emphasis mine):

The readonly keyword differs from the const keyword.

A const field can only be initialized at the declaration of the field.
A readonly field can be initialized either at the declaration or in a constructor.

Therefore, readonly fields can have different values depending on the constructor used.

Also, although a const field is a compile-time constant, the readonly field can be used for run-time constants, as in this line:

public static readonly uint l1 = (uint)DateTime.Now.Ticks;

Thursday, October 30, 2008

SubWeaver: a Subversion plugin for Dreamweaver!

Awesome... a Subversion (SVN) plugin for Dreamweaver! Exactly what I was looking for!

SourceForge.net: SubWeaver


The cool thing about it is that it integrates with TortoiseSVN (at least mine did), so that part of the interface feels very familiar!

Way to go, guys!

Wednesday, October 8, 2008

WPF: Getting at information entered in Assembly Information dialog

Had a perplexing problem with Getting at information entered in Assembly Information dialog in a WPF application, and it was very quickly answered by Krisha Barghav on the MSDN forums:

WPF: Getting at information entered in Assembly Information dialog

anything you enter inside Assemblyinformation dialog sits in the AssemblyInfo.cs

You can access these values using Assembly.GetExecutingAssembly.GetCustomAttributes(true/false);

If you print the types of attributes returned, you can see something like shown below.

System.Windows.ThemeInfoAttribute
System.Diagnostics.DebuggableAttribute
System.Runtime.CompilerServices.CompilationRelaxationsAttribute
System.Runtime.InteropServices.ComVisibleAttribute
System.Reflection.AssemblyFileVersionAttribute
System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
System.Reflection.AssemblyTitleAttribute
System.Reflection.AssemblyDescriptionAttribute
System.Reflection.AssemblyConfigurationAttribute
System.Reflection.AssemblyCompanyAttribute
System.Reflection.AssemblyProductAttribute
System.Reflection.AssemblyCopyrightAttribute
System.Reflection.AssemblyTrademarkAttribute


So if you want to access the Description entered in the Assembly, you can do something like this.


foreach (object o in Assembly.GetExecutingAssembly().GetCustomAttributes(true))
{
if (o is AssemblyDescriptionAttribute) Debug.WriteLine((o as AssemblyDescriptionAttribute).Description);
}

That is just an example.

Hope this helps.


Worked great for me!

Thursday, September 4, 2008

Echominder is even cooler than I thought!

A while back I wrote about Echominder from Intuit Labs, and I discovered a really cool feature that I didn't even know was in there...

Not only does echominder call you when you want it to, it also keeps a queue of your reminders on the website, and you can re-remind yourself by telling it to send you a particular message at a specific time (again).

Previously I was under the impression that the messaging was just a one-time event. Turns out I was wrong (and can't read documentation)! Awesome!

Kaxaml - Great Lightweight XAML Editor

So after checking out some of the WPF Bootcamp sessions at MIX08, I decided to install and try out Kaxaml...

Kaxaml

...and it's great! It's really nice to be able to try out the default snippets that are in the tool, and then to be able to grab XAML code blocks off the web and try them out on-the-fly without having to create a Visual Studio 2008 project - which is just too time consuming to try stuff out.

A very nice, and in my opinion, agile development tool!

Thursday, August 28, 2008

CLI - The next new old interface paradigm:

Seems like there have been quite a few incarnations of the new (old) command line interface - in particular, Ubiquity from Mozilla Labs:

Introducing Ubiquity

...which seems to be based on work done by the same guys who did Enso (in fact Aza Raskin is on both demo videos):

Humanized - Enso

...but transformed from an OS utility into a browser mashup utility. I'm sure it's not for everyone, but it could make life simpler for some folks.

Thursday, July 17, 2008

WinForm Tip: Setting Opacity on Panel Control

This is a little hokey, but interesting.

I'd really like to have genuine opacity in my panels and other controls (a la WPF), but this will work OK for now:

drawing Opacity For Panel Control