Thursday, August 28, 2008

Don't FILTER Data in a Grid

I've seen several postings on the forums lately where people ask about how to FILTER data displayed in a grid. This is a very bad idea as the scroll bars and thumb don't work correctly. Look at this form, that uses a filter.




The underlying table has over 200,000 rows. I appyled SET FILTER TO Lname = "SMITH". The result is not good. Notice the postion of the thumb. When I pull the thumb to the top of the scroll bar, it jumps back to the postition shown in the screen shot because that's where the current record is based on the entire table. This is very confusing to a user.
Now look at what happens when you use a query or a view.



In this form, I set up a local view and set the grid to use the view as the data source. I then requeried the data using a View Parameter. Notice where that the thumb is located at the top of the scrollbar when the record pointer is on the first record. This is because the data for the grid only contains rows where Lname = "SMITH" rather than the entire table.

Writing applications this way may require a retraining of the users as they won't have all the data at the same time, but will always need to query the data they want. My experience shows that users prefer this type of application. YMMV.

An added bonus is that you're preparing yourself to work with SQL Server as it only uses sets of data. You always need to query for the data you want and get back only that data rather than everything.

Labels:


Why Vista is more stable than XP

Windows Vista has been much maligned by the press and users alike, mostly because of UAC, but when you start to look at improvements in Vista and understand why they are there, Vista becomes more and more attractive. One of the big changes in Vista was with device drivers. Note that I'm not a hardware wonk. I'm sure someone will correct me for any incorrect information here.

For years, Microsoft has used the "Dr. Watson" tool to get back information about system crashes. You are probably familiar with the dialog that is displayed. You know, the one that says, "This application has performed an illegal operation. Would you like to send information to Microsoft?" Turns out, that information had lots of good stuff in it. Microsoft learned that 80% of crashes were caused by third party software and a very high percentage of that was caused by misbehaving device drivers. The result was often a system crash, the dreaded blue screen of death.

Many times, the reason this happened is because the Windows kernel and the device driver were running in the same ring on the CPU. The rings are numbered 0-4 on Intel chips. Ring 0 is closest to the hardware, meaning anything running in ring 0 has the most direct access to the hardware. Anything in ring 3 has the least direct access. Under Windows XP and earlier, the kernel and the device driver both ran in ring 0. User applications ran on ring 2. Rings 1 and 3 were unused.



You may think this is crazy. Why not run device drivers in a different ring? Well, it all comes down to the early days of Windows. There were more than Intel and AMD chips around. Windows also ran on the Alpha computer from Digital Equipment Corp. (DEC). Turns out, the CPU in the Alpha only had two rings, not four, so to simplify coding, Microsoft decided that they would only use two rings on the Intel chips. However, in 1998, DEC was acquired by Compaq (which later was acquired by HP) and eventually the Alpha was killed.

Now, when Microsoft was designing Vista, one of the goals was to make the OS more stable. They looked at all the data on blue screens. Even though the large majority of them was caused by third party drivers, most user blamed Microsoft for them. With the Alpha out of the picture, the decision was made to move device drivers to ring 1.


The benefit is that if a driver crashes, it is now less likely to cause the entire system to crash. The downside is that vendors had to rewrite many device drivers so they would run correctly in ring 1...and that led to many people saying that Vista device driver support was horrible. They still blamed Microsoft for it, but did so without understand why Microsoft changed how device drivers were to be implemented.

Today, most of the device driver issues have been resolved, unless you have really old hardware. There are still other areas that people hate about Vista, particularly UAC, but again, it's there for a reason. So, before you just throw in the towel and bash Vista, think about what the design goals may have been for the "feature" and try to look at it from a different perspective.

Update: Andrew MacNeill posts "Craig - this is what they should be doing instead of Mojave...yes, it's techy - but it explains it right." I meant to put this in my original post.

Wednesday, August 20, 2008

Speaking tonight in Utah county

I will be speaking tonight at the Utah County .NET User Group. The topic is Continuous Integration for .NET Development. The meeting is at 6:00 at NuSkin Operations Center, 1175 S. 350 E., Provo.

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]