Thursday, November 15, 2007

Amazon Goes Ajax - New Interface Today

Well, mark today down in UI design for websites and e-commerce. Amazon.com unveiled their new interface and it is Ajax (particular the Dynamic HTML aspect).

Certified E-Mail

Let it be known throughout the land, I received my first ever CERTIFIED e-mail today in Yahoo Mail. Will this be a turning point in web history?

The e-mail was from Build-a-Bear Workshop, so parents of young children are probably going to be the first to notice the trend.


Also see:
http://help.yahoo.com/l/us/yahoo/mail/yahoomail/context/context-08.html

Thursday, November 8, 2007

Apache losing market share to Microsoft IIS?


Wow, I was startled to see this graph!

Apache has around a 10% market share advantage over IIS now, which is the smallest gap between the two since IIS was launched in 1996.



src: Netcraft

Tuesday, November 6, 2007

Idiot's Guide to Implementing Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

A simple tutorial for VB.NET folks.

Get Enterprise Library 3.0

Install.

In your app, add reference to C:\Program Files\Microsoft Enterprise Library 3.1—May 2007\Bin

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll

If you con't have an app.config file, add one now (you could have this done for you later, but let's keep it simple).

Now open up "Enterprise Library Configuration", a utility installed along with the Enterprise Library that can be found off the Start menu....


Do File/Open... and point to the app.config file in your app.

Right-click the name of your app, select New... and then "Exception Handling Application Block".

Right-click the newly created tree node (it will have a red stop sign with a white X in it) and select New..Exception Policy. Name this "Global Policy".

Save it.

Now, back in Visual Studio 2005, your Try Catch blocks should be changed to the following pattern:

Try
'for testing: Throw New Exception("This is a sample exception.")
'put your real code here


Catch ex As Exception
Dim rethrow As Boolean = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex, "Global Policy")
If rethrow Then
Throw
End If
End Try


You should now be able to compile and start playing with the advanced features of the Enterprise Library 3.0 version of the old ApplicationBlocks.

Also see: C# Tutorial.

Thursday, November 1, 2007

I Hate Overloads

I just started working the the replacement for Microsoft's Application Blocks. ExceptionManagement, called Microsoft.Practices.EnterpriseLibrary. Specifically, I'm using the Logging class. Guess how many overloads there are for the Write method? NINETEEN!!! 19 overloads, that's right. Imagine if you did not have Intellisense. In my opinion, overloads undermine the whole organization of Object Oriented Programming (OOP), and are to be used SPARINGLY.

Monday, October 22, 2007

Speech Synthesis with .NET 3.0

Very simple:
Reference System.Speech.dll

Dim synth As New Speech.Synthesis.SpeechSynthesizer
synth.SpeakAsync("Hello world.")

Wednesday, October 3, 2007

C# Using Using for Using Connections

A wise man said, "The using statement declares that you are using a disposable object for a short period of time.  As soon as the using block ends, the CLR releases the corresponding object immediately by calling its Dispose() method ".

And I just thought "Using" was syntactical sugar for VBers.  *

What this implies is you should do your standard vanilla SQL connection like this:

 string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"]
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connectionString);

using (conn)
{
     conn.Open();
     System.Data.SqlClient.SqlParameter param = new System.Data.SqlClient.SqlParameter();
.... etc etc....


}


* Not to be confused with With.
And I'm not sure if Using was available in .NET 1.1

Also:

SQL Server and Oracle connection pooling use a full-text match algorithm. That means any minor change in the connection string will thwart connection pooling, even if the change is simply to reverse the order of parameters or add an extra blank space at the end. For this reason, it's imperative that you don't hard-code the connection string in different web pages. Instead, you should store the connection string in one place—preferably in the <connectionStrings> section of the web.config file.