May 2004 - Posts

XP Service Pack 2 Coming...
31 May 04 10:07 AM | despos | 1 comment(s)
Waiting for teh final release of Windows XP SP2, this is an excellent article to learn which sort of calls you can expect from clients if you don't plan things accurately. Read before you move on...
Extend ASP.NET Tracing
31 May 04 09:55 AM | despos | 6 comment(s)

Have you ever desired to have an enhanced trace mechanism in ASP.NET? I don't mean (necessarily) a full listener-based architecture (which doesn't work in ASP.NET--or at least, it never worked for me <g>). I mean the trace output you embed in the page by turning on the Trace attribute in the @Page directive. 

As far as I know (and can foresee) there will be no good news on this in ASP.NET 2.0. My wish list includes:

  • Capture the output to a popup window (or external support)
  • Ability to add new sections (maybe through a provider model à là membership)
  • Ability to collapse/expand displayed sections
  • Ability to select which sections you want to see

Am I missing something important here? 

Rob is on the news today
31 May 04 09:46 AM | despos | 3 comment(s)

Rob Howard, one of  brains behind the excellent provider model in ASP.NET 2.0 (sure, not just that...) leaves MS. I want to wish all the best of luck (and why not, a LOT of fun) to Rob for the new venture: Telligent Systems. As of today, the Web site contains just a GIF but I wonder which technology are they using to build the site. Maybe JSP? <g>

PS: I also wondered why Telligent Systems and not, a more natural for me, Intelligent Systems. Elementary, Dr. Watson! Intelligent Systems already exists; both with .com and .net. It doesn't exist as .it, but who cares :-)

Image Metadata and Comparison
17 May 04 10:34 AM | despos | 2 comment(s)

The digital picture world is exponentially expanding, and so it is the number of pictures on everybody's hard disk. As a Cutting Edge reader pointed out, it is getting more and more frequent that people end up with several different files for just one physical photo. For example, a small thumbnail, a larger thumbnail, one black-and-white copy, one slightly blurred, one with some touch-ups, and so on. The question is,

Is there any way with .NET that I can find similar photos?

It goes without saying that the point here is not finding identical photos, but just identifying related photos after resizing, color correction, and the like.
This has very little to do with .NET itself, I'm afraid. The .NET platform contains thousands of classes but it's an application framework rather than a graphic library. So there's no built-in class to compare images (and it's supposed to be.) There are algorithms in Computer Graphics that try to compare images and can be found in ad hoc books. I don't know if advanced graphics commercial libraries implement any of them. It can be, though.

My point here is different and closer to reality I believe--metadata.

I'm not (yet?) a Longhorn super-expert and I don't know nitty-gritty details of the Longhorn storage mechanism. However, at its core the Longhorn storage engine makes intensive use of metadata to categorize, index, correlate data. LH creates and maintains a database of references and links metadata to files. When you query for certain files (e.g., pictures of kids when they were 6; all copies of a given picture; pictures of your wife smiling; ...) the engine does a plain old SQL query on internal tables and returns a list of JPG files.

No apparent magic behind, but if you don't know anything about underlying tables it might be like magic. On the other hand, there are tables behind the file system since the first day of creation of PCs.

To be able to consume metadata, metadata must be added to each file. In a semi- or totally automatic way. This is something that can be accomplished with smarter folder. The folder must be able to recognize image files and "force" you to enter some metadata whenever you save, edit, copy, delete any files.

Doable today, maybe easier (because integrated with the system shell) tomorrow with Longhorn.

Thoughts?

More on SQL Paging
14 May 04 03:50 PM | despos | 3 comment(s)

In the PDC build of Whidbey, the DbCommand class (the mother of all xxxCommand classes in data providers) has a method named ExecutePageReader with the following signature:

public SqlDataReader ExecutePageReader(
    CommandBehavior behavior,
    Int32 startRow,
    Int32 pageSize);

I was curious to see the implementation of this method. Secretly, I hoped it was better than the one described here--a group of nested SELECT statements. Instead, it declares a server cursor on the query and moves it back and forward until you close the reader. Many SQL gurus (including Microsoft's SQL gurus) disagree with this approach. I don't know whys and whats but I believe that the low-level implementation of paging is still a debatable point.

(Which is what leads me to say that paging LARGE queries is a problem to avoid, rather than solve <g>)

PS: The good news is that ASP.NET data-bound controls (i.e., GridView) support paging as long as the data source control provides that capability. Which means that at least we're going to have forward-compatible controls.

ADO.NET 2.0 broke up in pieces?
14 May 04 03:39 PM | despos | 6 comment(s)

Following up some comments on this post, let me add a few more thoughts and an up-to-date list of features that will not be in ADO.NET 2.0. Of course, the list has a relative value, may be incomplete, and shouldn't be taken as an absolute truth. However, I modified the TOC of my new ASP.NET 2.0 book based on this.

Features in the PDC build that have great chances (so to speak) not to be in the final release:

  • ObjectSpaces
  • SQL Paging
  • Server cursors (SqlResultSet class)
  • Asynchronous connections
  • SqlDataTable class

Features not in the PDC build that have great chances (so to speak) to be in the final release:

  • Ad hoc DataSet/DataTable serialization format for .NET Remoting
  • Protected (i.e., encrypted) connection strings

Features in the PDC build that have great chances (so to speak) to be in the final release:

  • Asynchronous SQL commands
  • SQL command sets
  • Bulk copy operations
  • Sizable batch updates
  • Multiple Active Results sets (SQL Server 2005 only)
  • Enhancements to DataTable and DataRow

AFAIK, asynchronous connections and SQL paging have been cut (for now) to better fine-tune them. Not sure about SQL Server's server cursors.

My understanding (conjecture, more precisely) is that all (most?) of these features will be released as a separate add-on a few months later, and then incorporated in a sort of 2.1 version. Remember what happened with the Oracle and ODBC .NET providers?

Late breaking news at TechED Europe. One of my talks is DAT376--What's New in ADO.NET 2.0.

Hottest ASP.NET 2.0 Features
14 May 04 10:18 AM | despos | 5 comment(s)

Hey Dino, what are the hottest features in ASP.NET 2.0 that we should consider when we plan upgrades to existing applications?

All speakers would begin with "Thank you. This is definitely a great question and I'm happy to have a chance to discuss it publicly!" Usually, this sort of stock phrase serves the purpose of taking some time to think and decide where to start from.

ASP.NET 2.0 counts two types of enhancements: those which require changes to the HTTP pipeline and the page handler and those which are just well-written wrappers around existing functionalities. In my recent Cutting Edge columns, I demonstrate just this. Specifically, personalization, themes, image generation, cache dependency, script callbacks. Paul Wilson and others demonstrated Master Pages.

Here's my list of the hottest features that might lead you to consider an upgrade:

  • Master Pages
  • Data source controls
  • Session and Cache enhancements
  • Provider model
  • Rich controls

One of the most frequently asked questions (for me, at least) is "what's the best way to quickly and effectively prototype hundreds of similar-looking pages?" Master pages is the answer. And is a great answer indeed. While master pages can be emulated in 1.x, or maybe implemented through a sort of visual inheritance pattern, in 2.0 you get a system-level solution optimized and integrated with the rest of the framework. And completely hassle-free.

Data source controls provide a system-level bridge between data-bound controls and data providers. In the field, an extra intermediate layer backing data-bound controls proved necessary. Serious apps already have this custom layer, better yet if connected to a BLL. Again, you now have a system-level solution. And can maintain your BLL intact or just must change the signatures of the methods slightly.

Session and Cache enhancements provide new features that were hard (not impossible) to accomplish with earlier versions. I'm talking about custom and database cache dependencies; and custom stores for session state. The provider model makes possible now to build robust Web apps with a single database. What if in 1.x you have to work with an Oracle database and need database storage of session state? No way: you must install SQL Server too.

Rich controls: treeview, menu, wizard, multi-view, plus the family of data-bound view controls. They save you A LOT of boilerplate coding. Hard to believe? Try security controls (Login, password, user) and let me know. 

PS: Stay tuned to the ASP.NET DevCenter. More on this coming up.

How to update a few thousand records
14 May 04 09:54 AM | despos | 7 comment(s)

I believe that in data-intensive applications (uh, are there really other types of apps?) there are a few problems to avoid, rather than brilliantly solve. One of this is SQL paging. Another one is, maybe, large batch updates. Of the two, the latter looks much more approachable. None of the two, however, find a system level solution in .NET 1.x.

(A system-level solution here means something the framework provides that gives you a good excuse to take it for granted and avoid thinking of a better approach.)

No matter SQL paging is supported in the PDC build of Whidbey (and even in the March04 Community Drop), it won't be in the final product. Rumors say that there will be an add-on or, maybe, a service pack shortly after with some enhancements including SQL paging, server cursors, and more.

What about batch update improvements?

In version 1.x, batch update submits one record at a time. All the overloads of the data adapter's Update method end up calling the one that processes an array of DataRow objects. The implementation simply loops through the array, decides which command to execute, and goes with that. You understand that 5,000 records to batch update are definitely a pain-in-the-neck. At a minimum.

What's a good way out, if any?

My knee-jerk answer is saying "avoid that rearchitecting the app." In alternative, grouping multiple rows in a single batch update step would alleviate the issue. In 1.x, the batch update size is hard-coded to 1. In version 2.0, there's a new property BatchUpdateSize you can use to fine-tune the whole process.

I hoped some hack was possible in 1.x to force a custom batch update size. My hope was for a private, internal property to set using reflection. No way. And in 2.0, the batch update implementation is significantly different and concatenates more statements into a SQL batch.

Have you tried with SQLXML updategrams? Any real-world feedback from large scale projects? 

The Right Words
13 May 04 10:18 AM | despos | with no comments
I think it was one of my teachers at high school who said once that using the right words is essential for everybody to be understood. Sounds obvious? Sure, it is. Look at this joke that I've heard on a TV show a few weeks ago. (For Italians, it is an excerpt from Ficarra & Picone, Zelig Circus.)
 
The joke assumes you're familiar with "mafia" and "pizzo" (the money they ask you to pay for protection).
 

A Sicilian family (where mafia was historically born) decides to spend a day out of town. They drive out to the direction of a far, but known to be really nice, beach. Headed to the region's main highway, they have to stop at the tollgate. The man there asks for a few money--the toll--he says.
 
"What? Are we supposed to pay to drive here? That's weird and absurd. We're just going to the beach..."
 
The poor main at the tollgate explains patiently. No way.
 
"We can't understand why are we supposed to pay to go to the beach..."
 
The man points out: "It's not like this; you must pay to drive on this highway". No way.
 
"We can't understand why are we supposed to pay to go to the beach... What's this toll? Is it a sort of pizzo?"
 
And the poor man at the tollgate agrees: "Yes, if you want to call it this way..."  The family relieves at the news; smiles, pays the toll, and waves at the man saying "Why didn't you say it at once?"
 

Maybe I had to say feedback here.  :-))))
Swiss .NET Users Group (Part 2)
11 May 04 05:50 PM | despos | 1 comment(s)

Many of you promptly reported that presentation and examples mentioned here are available only to users from Switzeland. Of course, an easy (Italian-ish) solution would be to cheat on registration, but ... I think it's much better to wait a few units of time (minutes? hours? days? who knows...) for the same code and slides to be available for download from the Wintellect and DotNet2TheMax sites.

Hopefully, there will be no part 3 on this post...

More Posts Next page »