>
 Monday, August 16, 2004

While researching how to select unique rows from an existing DataSet I ran across many Google references to the following knowledge base article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;326176

NOW THAT YOU KNOW WHERE THE LINK IS, FORGET ABOUT IT!!!! In ADO.NET 2.0 this is now part of the DataView class built-in functionality, and the following article encapsulates this extended functionality in a more object-oriented manner for 1.x:

http://www.aspheute.com/english/20040123.asp

In 2.0, this functionality is available through the DataView class. Consider the following XML file stored as a string resource to indicate supported languages for a Web site:

<?xml version="1.0" encoding="utf-8" ?>
<supportedCultures>
<culture>
<culturecode>en</culturecode>
<language>English</language>
<country></country>
</culture>
<culture>
<culturecode>en-CA</culturecode>
<language>English</language>
<country>Canada</country>
</culture>
<culture>
<culturecode>en-US</culturecode>
<language>English</language>
<country>USA</country>
</culture>
<culture>
<culturecode>es</culturecode>
<language>Spanish</language>
<country></country>
</culture>
<culture>
<culturecode>es-EC</culturecode>
<language>Spanish</language>
<country>Ecuador</country>
</culture>
<culture>
<culturecode>es-ES</culturecode>
<language>Spanish</language>
<country>Spain</country>
</culture>
</supportedCultures>

If I want to populate a DataList with all supported languages, there are dupes in the file. But, I need the dupes to associate language with Country, for another purpose.

As the following code demonstrates, if I load a DataSet with XML (shown below using a StringReader to demonstrate how to load XML from a string resources, another hidden gem), grab the default view for the (only) table, set a filter on the view to exclude <language> elements that are empty, sort by language, then invoke the DataView.ToTable() overload that supports passing in DISTINCT requirements:

DataSet ds = new DataSet();
System.IO.StringReader rdr = new StringReader(cultures);
ds.ReadXml(rdr);
rdr.Close();

DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter="language <> ''";
dv.Sort="language";
string [] distinct = {"language"};
       
DataTable tbl = dv.ToTable(true, distinct);
this.dlLanguages.DataSource = tbl;

this.dlLanguages.DataBind();

This is very useful if you are working with offline DataSets from within a smart client, or a cached DataSet supporting a Web application, and you want to bind different perspectives of the data to controls using consistent binding methods. No need to roll your own code to populate rows, or requery the data source.

8/16/2004 7:28 PM .NET | ADO.NET  | Comments [13]  |  View reactions  |  Trackback

What The? happened to WinZip functionality? This is a silly little post but something that annoyed me so I figured a few other readers might care. Now that XP has this cool new shell extension for generating ZIP folders, some of the features of WinZip appear to be obfuscated by this integrated Explorer experience. I was puzzled by the need to run the original WinZip classic experience just to create a password protected ZIP file, but I finally figured out that there actually is a way to do this within Explorer. Create a ZIP file, open it in a new Explorer window, from the File menu select Password Protect...que bueno!

 

8/16/2004 5:48 PM What The?  | Comments [1]  |  View reactions  |  Trackback
 Tuesday, August 03, 2004

Tonight I'm presenting at our local .NET Developers Group in San Diego how to secure your Web services with WS-Security and WS-SecurityPolicy using WSE 2.0. I will post any new code samples or slides here for reference after the talk, but my current resources page on this subject can be found here:

http://www.dotnetdashboard.net/resources/wse.aspx

After spending the past week *immersed* in mostly ASP.NET 2.0, primarily using all the new localization features for a whitepaper I just completed (cool stuff, more on that later), today I'm *immersing* myself in my WSE 2.0 presentation content. Surely I will soon have new things to share on that subject...just a matter of time to post them between deadlines :)

 

8/3/2004 9:13 PM .NET | Speaking/Events | Web Services | WSE  | Comments [9]  |  View reactions  |  Trackback
 Wednesday, July 28, 2004
Tablets are cool, except for mine. I entered this contest to see if I can win a better one. You should too.

http://www.franklins.net/dnrforms/tabletcontest.aspx

7/28/2004 10:47 PM Speaking/Events  | Comments [3]  |  View reactions  |  Trackback

Sometimes we take for granted that everyone knows the productivity tricks available to developers in Visual Studio .NET 2003. One of the coolest tricks provided through Class View is a built-in feature that will generate shell functions for any interface your class implements. Here’s how it works. Add a new class to a project, and create a class definition that includes the interface implementation list. In this example, I'm creating a new HTTP Module:

public class ErrorsGoHomeModule: IHttpModule

{

     public ErrorsGoHomeModule()

     {

     }

}

Then, go to Class View:

Right click on the interface, in this case, IHttpModule, and select Add/Implement Interface…

This generates the following code in my example:

     #region IHttpModule Members

 

     public void Init(HttpApplication context)

     {

        // TODO:  Add ErrorsGoHomeModule.Init implementation

     }

 

     public void Dispose()

     {

        // TODO:  Add ErrorsGoHomeModule.Dispose implementation

     }

    #endregion

Now you’re ready to implement required members!

7/28/2004 8:20 PM .NET  | Comments [4]  |  View reactions  |  Trackback
 Saturday, July 24, 2004
Some great discussions are going on regarding the choice of Enterprise Services, .NET Remoting and Web Services for .NET applications. I'm adding on, so sit yourself down...this has really long blog written all over it...
7/24/2004 5:05 PM .NET | Architecture | Web Services  | Comments [4]  |  View reactions  |  Trackback
Ok, so I haven't blogged in a while because I'm consumed with several white papers that unfortunately haven't left me much (read: any) spare time to write some new code or answer questions. However, I did attend a small meeting with the leader of the mother ship, and I've concluded he's a pretty cool guy. Read on...
7/24/2004 12:05 AM  | Comments [3]  |  View reactions  |  Trackback
 Sunday, July 04, 2004

Slight delay posting this, had a little trouble with the wireless in my Amsterdam hotel, and have been flying for a day to get back home!

I have resource sites related to the topic of this session, they are listed here in my post from Tech Ed San Deigo.

Thanks so much for the great feedback I received so far on this talk. I will be posting an update to my sample code in a few days, as soon as I get caught up on some seriously pressing deadlines. Right now, the code sample has everything I demonstrated with the exception of the HTTP handler that forces "Save As" download for configured resources such as XML files.

If you have other ideas for modules, handlers and SOAP extensions you are completely welcome to ask me, I may have some code lying around that I haven't cleaned up and posted yet!

Cheers!

7/4/2004 9:01 PM .NET | ASP.NET | Speaking/Events | TechEd  | Comments [2]  |  View reactions  |  Trackback
 Friday, July 02, 2004

Thank you for attending this chalk talk yesterday! Feel free to send me any further questions beyond what we had time to cover in the session :)

I will clean up and post my slides here shortly. Also in a previous blog entry I provided the link to my MSDN article that discusses some of the architectural benefits of Enterprise Services for building scalable ASP.NET applications. This blog entry also provide an updated code sample with more detailed installation instructions.

7/2/2004 7:30 AM Architecture | ASP.NET | Speaking/Events  | Comments [9]  |  View reactions  |  Trackback
 Thursday, July 01, 2004

Thank you for attending my session last evening. As I mentioned, I gave this talk previously at Tech Ed San Diego, but since then I have actually added some more code samples and discussion points that I unfortunately didn't have time to explore during the session.

My globalization resource page can be found here:
http://www.dotnetdashboard.net/sessions/globalization.aspx

Look for a new sample with a script for versioning and deployment shortly. I'll update this blog entry when it is finally there. Thanks for coming to the session!

7/1/2004 8:45 AM .NET | Globalization | Speaking/Events | TechEd  | Comments [71]  |  View reactions  |  Trackback
    ON THIS PAGE
    SEARCH
    CATEGORIES
    ARCHIVES
    BLOGROLL

Designed by NUKEATION STUDIOS