<July 2004>

On this page...



Member of...

ASP Insiders

MVP Visual Developer ASP/ASP.NET

Enter CodeZone

Blog Categories



Deutsche Resourcen


Sign In

#  Tuesday, July 27, 2004

The book Improving Web Application Security: Threats and Countermeasures (online: Guidelines Corrections) can also be browsed via solutions at a glance. I've been recommending this book for quite some time in the German community, so why not plug it again (and hence start the Security section of my blog).

Categories: Security
Tuesday, July 27, 2004 1:39:18 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


Microsoft has a new site dedicated to SQL Server 2005 (including the Express edition). Note though that only the Express Beta 2 can be downloaded freely.

Categories: SQL Server
Tuesday, July 27, 2004 1:22:02 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


Continuing in the “What’s cool in 2.0” series, I’ll look at a BCL feature today. Imagine you have a Web form, and one of the values a user has to enter is a double. The not-so-ingenious version to accomplish the task is as follows:

void Button1_Click(object sender, EventArgs e)
string val = TextBox1.Text;

// I'm sure: it is a double
double d = Double.Parse(val);

What’s wrong? Well, there are several things that could make your application go south, err, throw an exception: the value is null, the value is not a double, the value is out of range for a double (all three conditions are well-documented). So you rewrite your application like this:

double d = 0.0f;
d = Double.Parse(val);
catch (ArgumentNullException ane)
catch (FormatException fe)
catch (OverflowException oe)

This is how you would do it in 1.1, unless you first do a sanity check using regular expressions (remember: all input is evil until proven otherwise). So what is wrong here? The point is the exception throwing / catching in itself – it involves a stack walk, which equates to lost performance (especially nasty when we are talking heavy-load Web applications). Wouldn’t it be nice if we could get away without exceptions?

Good news! The BCL data types sport a new method – TryParse. Like the Parse method, it takes the input string as the first parameter. The input is followed by an out parameter, which was the return value of Parse – the return value of TryParse is a simple boolean: did the conversion succeed or did it fail. No exceptions.

The following code snippet shows how easy this is:

double d = 0.0f;
if (!Double.TryParse(val, out d))
// handle error condition

My advice: when porting 1.1 applications to 2.0, make sure that you convert all old Parse code to the new TryParse – your applications will perform and scale a lot better.

Categories: 2 Ohhhh | BCL
Tuesday, July 27, 2004 7:47:44 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


#  Monday, July 26, 2004

Thomas (de) picked up the topic of validating multiple forms in ASP.NET 1.1 (de) - and was wondering if / how this is solved in 2.0. Great opportunity to start my series on "What's cool in 2.0". The good doctor is in!

One of the features on the (rather long) list of cool features in 2.0 is validation groups. It allows you to group certain controls - validators and controls that allow (auto-)postback - in a validation group: only the validators in the group that is posted back is actually being executed.

Let me illustrate, take a look at the following "two form page" (contrived as always):

In the old days of 1.1, when you clicked either of the two buttons, all validators would be executed, even though not all are applicable for both forms. In 2.0, all you have to do to sort out this dilemma is to set the ValidationGroup property:

Now when we run our sample application, only the validators associated with the respective "form" (validation group defined by the button) fire:

I'm sure that a lot of my fellow developers can't wait till this feature RTM's!

To wrap up, Stephen Walter wrote the article Changes to the Validation Controls in ASP.NET 2.0, which goes into more depth on the validation control changes.

Categories: 2 Ohhhh | ASP.NET
Monday, July 26, 2004 9:21:40 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]


#  Wednesday, July 21, 2004

{ End Bracket } is a column in MSDN Magazine, and its August 2004 edition deals with the challenge of writing a C# to Visual Basic Translation Tool. John Robbins explains why there is a need for this (Joe Developer: "I really wish all the samples were written in my programming language."), and how it can be done - using #develop!

Now, this is a vindication for the project manager (me) who spent quite some time to coax the programmer (Mike) into implementing this feature.

Wednesday, July 21, 2004 3:13:26 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


#  Monday, July 19, 2004

With regards to my previous blog post Disagreements gone too far, I can say that the FSF's answers have put the discussion to rest and it looks like everybody can live with it. Note to self: do not discuss flame-worthy issues like licensing in public where lots of trolls and not-so-innocent bystanders make it impossible to have a fact-based discussion. Limit to main actors, go public with results - this is they way to go.

On a different note: when a manager asks you how OSS projects / vendors make money, point them to the article Seven open source business strategies for competitive advantage from the IT Manager's Journal.

Categories: this
Monday, July 19, 2004 4:45:18 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


#  Friday, July 16, 2004

I already mentioned that in my spare I double as project lead on the free software project #develop. Recently, a licensing issue came up between the #develop and MonoDevelop teams. Because we couldn't agree, the #develop team decided to ask the FSF for clarification (read the PDF, it contains links to the actual discussion threads).

We thought that, ok, let's wait what the FSF has to say, and we'll submit to whatever they decide in this matter. Todd Berman, MD lead, however decided to go frontal. This I had to rebuke, and make public because it is potentially damaging for my company.

Godwin's Law

Categories: this
Friday, July 16, 2004 8:19:24 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


#  Thursday, July 15, 2004

This tool is a Windows Forms application, which be downloaded including source. It is based on the XMLDiff and XMLPatch classes that come with the XmlDiffPatch API, and shows how to use XMLDiff. To illustrate what this utility can do even for the programmer who doesn't want to use the classes directly, I have included a few screenshots of how differencing might help in everyday XML scenarios.

The main screen: select two files to compare, then click the Compare button.

Comparison control: yellow highlights elements / attributes that were added.

Changes as well as additions and removals are easily visible too.

And in case you want to fine tune, go to the Diff Options menu.

When to use? Ever tried to find out what is different between two web.config files?

Categories: Use the source Luke
Thursday, July 15, 2004 10:55:24 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


Cw (Comega Web site) is a research programming language done by MSR. It is an "extension" of C# in two major areas:

  • A control flow extension for asynchronous wide-area concurrency
  • A data type extension for XML and table manipulation

In plain English this means new constructs for asynchronous concurrency as well as relational and semi-structured data access. If you've previously read about Polyphonic C# and X#, then this is basically the "successor".

You can download a preview.

Categories: MSR
Thursday, July 15, 2004 8:40:49 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


#  Tuesday, July 13, 2004

I knew about Paint.NET (programmed by Rick Brewster, among others) for quite some time. However, now one can not only download an installer for version 1.0, but also the source code which is licensed under a slightly modified MIT license. Get it! (unless you are absolutely not interested in image manipulation and/or Windows programming in .NET)

For completeness one screenshot that includes the translucent floating toolbars:

Categories: Use the source Luke
Tuesday, July 13, 2004 4:24:13 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]


© Copyright 2023 Christoph Wille

newtelligence dasBlog 2.3.9074.18820
Subscribe to this weblog's RSS feed with SharpReader, Radio Userland, NewsGator or any other aggregator listening on port 5335 by clicking this button.   RSS 2.0|Atom 1.0  Send mail to the author(s)

Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.