My Blog Links
Site Links
Currently Reading
  • This page is powered by Blogger. Isn't yours?
  • Weblog Commenting and Trackback by HaloScan.com
  • 2RSS.com :: RSS directory
  • Listed on BlogShares
  • Blog Directory, Find A Blog, Submit A Blog, Search For The Best Blogs

Saturday, July 31, 2004

.NET: Interesting Conversion From ASP.NET to Smart Clients 

I just read this interesting post from an ASP.NET proponent (Klaus Aschenbrenner) who is repenting his ways and seeing the benefits of smart client development with WinForms. It's good to see... :)

Not every application needs to be a web application, especially for intranet applications within an enterprise. There are many instances where a WinForms application can be more responsive and easier to implement. However, until now, deployment of WinForms applications has been difficult, but with the ClickOnce feature in Visual Studio 2005, you will be able to easily deploy WinForms applications through a published URL. The user just clicks the link and gets the application deployed down to their machine. There are still caveats, like the right version of the .NET Framework needs to that machine, but that's just a one-time hit to get installed.

But, with WinForms, ClickOnce, and additional GUI features coming in Longhorn, it looks like smarter client applications with connections to data stores and web services will become a viable option for enterprise applications -- perhaps even some applications deployed over the internet...

Wednesday, July 28, 2004

.NET: Descending Comparer 

I was recently working on some code, and came upon an instance where I needed to sort an array of integers in descending order.  I looked at the Array.Sort method, but that orders them in ascending order by default. So, I started looking for an IComparer implementation that would sort in descending order. Amazingly enough, it doesn't appear that the .NET Framework has a comparer to do that (at least not in v1 or v1.1 -- not sure about v2) .

So, I decided to code one up myself.  It's actually a relatively simple concept but very useful. I created a DescendingComparer class that implements the IComparer interface.  In its Compare method, I just take the result of the default Comparer class in the .NET Framework and multiple it by -1.  This causes the array to be sorted in descending order.  So, here's the code:
/// <summary>

/// DescendingComparer is a comparer class the orders items in descending order.
/// </summary>
public sealed class DescendingComparer : IComparer
#region private members
private CultureInfo culture;
private static DescendingComparer defaultCurrent =
new DescendingComparer(CultureInfo.CurrentCulture);
private static DescendingComparer defaultInvariant =
new DescendingComparer(CultureInfo.InvariantCulture);
#region public properties
/// <summary>
/// Gets the default DescendingComparer with its culture set to the CurrentCulture.
/// </summary>
public static DescendingComparer Default
get { return defaultCurrent; }
/// <summary>
/// Gets the default DescendingComparer with its culture set to the InvariantCulture.
/// </summary>
public static DescendingComparer DefaultInvariant
get { return defaultInvariant; }
/// <summary>
/// Constructor that sets the CultureInfo for this class.
/// </summary>
/// <param name="culture">Culture for this comparer.</param>
public DescendingComparer(CultureInfo culture)
this.culture = culture;
/// <summary>
/// Performs a case-sensitive comparison of two objects of the same type and
/// returns a value indicating whether one is less than, equal to or greater
/// than the other.
/// </summary>
/// <param name="a">First object to compare.</param>
/// <param name="b">Second object to compare.</param>
/// <returns>Negative number means a is greater than b; 0 means they're equal;
/// Positive number means a is less than b.</returns>
public int Compare(object a, object b)
Comparer comparer = (culture == CultureInfo.InvariantCulture) ?
Comparer.DefaultInvariant : Comparer.Default;
return comparer.Compare(a, b) * -1;
Then, I use it by calling:
	Array.Sort(myArray, DescendingComparer.DefaultInvariant); 

And yeah, I know I could have just sorted the array and called Array.Reverse to get it in the right order, but that just seemed like a lot of needless operations when this can be done more efficiently with the right comparer class.

Sunday, July 25, 2004

MISC: Fun Game to Waste Time On 

For a weekend reprieve, here's a link to a little online game that I've been hooked on for the last couple of weeks.  It's called Kingdom of Loathing -- it's a self-described comical RPG.  And, besides having lots of funny bits and gags, being a pretty simple page based game, and consisting entirely of stick figures, it appears to be highly addictive.  At least it has been for me... :)

Give it a try, let me know what you think.  Once you've gotten your bearings in the game and are interested in joining a clan, come over to the "Bandit's Outpost".

Monday, July 19, 2004

.NET: Designing an Online Poker Game 

Justin Rogers has been posting a series on the design that he's working for an online poker game and card games in general.  It's been very interesting reading so far as he's worked out issues of reuse for Deck and Hand classes, as well as how it would work for Poker and Solitaire games.  And, there's been some interesting comments on the posts too.
Here's a list of the relevant posts:

Thursday, July 15, 2004

.NET: Printer Margin Bounds in .NET 

There's a very good Code Project article by Philippe Leybaert on getting the appropriate printer margin bounds so that what you print from you WinForms application will appear correctly.
While PrintPageEventArgs has a property MarginBounds, this property doesn't account for the hard margins of your printer for left and right margins -- although they do appear to have the top and bottom margins right.  However, this article describes how you can get this information from the Windows API GetDeviceCaps.
It'll be interesting to see if this is fixed in Whidbey. 

Wednesday, July 14, 2004

.NET: Web Services in Whidbey 

Now that Visual Studio 2005 Beta is out, we're going to start seeing more information about the new Web Services features. Here's an MSDN article about what some of the new features are:
  • Proxy type sharing
  • More extensibility of XML serialization
  • Support for WS-I Basic Profile 1.0
  • Support for SOAP 1.2

Tuesday, July 13, 2004

MISC: Need Redmond Real Estate 

Boy, I really wish I owned some real estate in Redmond near the Microsoft campus. The Seattle Times just reported that Microsoft is planning to buy the Eddie Bauer campus for $38 million. Whoa...

Saturday, July 10, 2004

.NET: New ASP.NET 2.0 controls 

With the release of the VS 2005 Beta, I'm expecting that there will be a lot of talk about the new controls and features that can be found in this latest release. The first interesting post I ran across was from Ohad Israeli who discussed the new security controls and pages in ASP.NET.

These new controls let you put login sections onto your website without having to code up all of the UI and logic for tracking the user. ASP.NET also includes functionality for creating new user accounts, retrieving forgotten passwords, and changing passwords. And, it appears that these controls have a fairly customizable look and feel. This should free up developers to use these controls rather than creating these typical features from scratch.

Friday, July 09, 2004

.NET: Breaking Changes in Whidbey Beta 1 

Here's an article that enumerates the breaking changes that have been made between version 1.1 and the new Whidbey Beta.

[via Brad Abrams]

.NET: Use of Equality and GetHashCode() 

Here's an interesting post by Brendan Tompkins on the use of the equality operators for your own class types and typed collections. If you're going to check for uniqueness in a collection based on anything other than the instance, then you're have to override the GetHashCode() and operator==, so that you can actually check based upon the instance data in the class.

Thursday, July 08, 2004

BOOK: Plan of Attack 

I just finished reading "Plan of Attack" by Bob Woodward over the long weekend. The book made some interesting points, but in the end didn't really change my view of what happened in the lead up to the Iraqi war.

The most interesting chapters in the book were dedicated to the covert operations in Northern Iraq that were going on months before the war started. Some of the revelations about how they started a camp there and recruited intelligence help from within the Iraqi government were actually quite good. And, how they responded to intelligence about Saddam's whereabouts to try a early strike to get him. It was like reading some Tom Clancy novels (only better because it had real-world events as background).

As for describing the war planning, Bob did a good job of describing the timeline, but it was kind of dry and slow-paced. And, there really weren't any major revelations. It basically described that the folks in the administration believed the intelligence they received from the CIA and UK and may have embellished the risk of weapons. However, congress reviewed some of that material and came to the same conclusion when they voted to give the president power to use force in Iraq. The fact that the war planning had been going on for over a year before the actual start wasn't surprising. I would hope that something of that magnitude was planned out well (and it may be that this had already been reported in other venues, so it lost the surprise factor for me).

The one interesting point was that Dick Cheney was really the one with his mind set on attacking Iraq. President Bush actually went back and forth between war and diplomacy several times before making up his mind.

Of course all of this needs to be taken with a grain of salt because Bob Woodward was given access to documents and people that the administration wanted him to have. It wasn't clear from the book how much external research he did in addition to that.

Thursday, July 01, 2004

.NET: Class Designer Blog Discussions 

Rakesh has made several posting about Class Designer and some of the tough decisions and trade-offs that they've had to make for the first release in Whidbey. Here are some links to his discussion: