Thursday, February 16, 2006

ActiveNick is coming to townnnnnnnn...

...he knows when your phone is sleeping, he know when your PDA is awake, he knows what's bad and good about the Compact Framework, so come to his sessions for goodness sake! Oh, you better watch out...

Yep, that's right, Nick Landry (a.k.a. ActiveNick) is coming to San Francisco on March 8th to speak at the Bay.NET User group.

Nick is a good friend of mine and a very dynamic speaker. He'll be giving us a crash course on developing mobility solutions so come on out and see us if you're in town!

Wednesday, January 25, 2006

Binary Serialization of DataSets in .NET 2.0

Last week I mentioned that I would post some test results on the different options we now have with serializing DataSets; Binary (new in 2.0), XML, and custom serialization surrogate. First, let me direct your attention to an updated surrogate class that I used in the test that can handle the new DateTimeMode property on columns.

Now before you read these numbers I'd like to be clear about the scenarios I tested. To make it easy on me I set up the internet test to work with one of our current product's test beds already set up with some real test data. There are two servers in this test bed, one is the application server hosting remote components in IIS (HttpChannel) and accessed by the client using the BinaryFormatter. The second server is the database server. So what I was measuring was also including the time it took to select the records from the database through the components (no business logic, just filling an untyped dataset from a stored proc simple select -- about 19 columns with various data types). The servers are in Florida and I work from home in California where I was running the client. I was accessing them over a cable modem. In the local test I had the exact same code and databse running in all tiers on my local development machine to simulate no network latency.

That said, we don't want look at the numbers per se, look at the trend -- that is what is important here. There are also a lot of factors that affect serialization over the internet on a cable modem and you'll notice that there are a few anomalies in the local numbers with small sets of data, probably because my dev machine hiccupped at that moment.


So to recap, this is what we're measuring;

1) The time it takes to make the remote call to activate the component,
2) The time it takes to select the records from the database and create the dataset,
3) In the case of the surrogate class, the time it takes to convert the dataset to a series of byte arrays,
4) The time it takes to transmit the data,
5) In the case of the surrogate class, the time it takes to convert the byte arrays back into a dataset.

My conclusion is that native Binary serialization of datasets is only better over a long wire when the number of rows are in the thousands. Our application is 99% data entry forms so we would never be returning that much data. The surrogate class does have a slight overhead if your network is not congested/not the internet, however nothing that the user would notice. Therefore, for now, I'm sticking with the surrogate class for our application. I'll let you know if I change my mind later based on more formal load testing.

Okay here are the performance numbers:

LOCAL TEST (Low Network Latency)      
# Records Size (bytes) Transmission Time (ms)
  Surrogate Binary XML Surrogate Binary XML
2 13,761 56,198 11,673 15.63 31.25 15.63
10 15,261 57,419 15,754 15.63 31.25 15.63
20 17,133 58,972 21,018 31.25 31.25 15.63
100 32,233 71,626 63,434 31.25 31.25 31.25
500 107,336 134,641 276,350 62.50 46.88 62.50
1000 203,943 216,285 550,832 93.75 78.13 109.38
2000 392,296 374,665 1,087,187 171.88 125.00 250.00
4000 772,451 694,776 2,174,403 343.75 265.63 515.63
8000 1,521,110 1,323,693 4,383,707 734.38 531.25 968.75
   
INTERNET TEST (High Network Latency)      
# Records Size (bytes) Transmission Time (ms)
  Surrogate Binary XML Surrogate Binary XML
2 13,761 56,198 11,673 312.50 578.13 312.50
10 15,261 57,419 15,754 328.13 640.63 390.63
20 17,133 58,972 21,018 343.75 655.43 343.75
100 32,233 71,626 63,434 421.88 671.88 593.75
500 107,336 134,641 276,350 906.25 1078.13 1875.00
1000 203,943 216,285 550,832 1484.38 1562.50 3531.25
2000 392,296 374,665 1,087,187 2640.63 2515.63 6750.00
4000 772,451 694,776 2,174,403 5312.50 4500.00 13312.50
8000 1,521,110 1,323,693 4,383,707 9687.50 8406.25 26609.38

Saturday, January 21, 2006

I LOVE SQL-EXPRESS

One of the key features of our products is the ability to support multiple deployment scenarios without recompilation. Scenarios ranging from desktop single user to few user workgroup to client-server to web-based n-tier with the option of NLB. This is all done with configuration files. All of our deployments up to now have been web-based n-tier against SQL-Server 2005. So yesterday the owner of the company asks me to load a single user demo system on his laptop. No problem, this should be fun and a good test of SQL-Express.

I didn't realize how easy this was going to be. First thing was to load SQL-Server Express edition on his machine (which also loads .NET Fx 2.0). Since he wanted some demo data, I needed to grab the database on our test DB server. I fired up SSMS, connected to the the test server, detached the database, took a copy the physical Mdf file, then reattached the database. I placed the copy of the database file in the same folder with all our application files and then changed the application connection string to:
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\MyAppFolder\DBNAME_Data.mdf;Integrated Security=True;User Instance=True
This sets up a single user file-based connection string. That's it! You don't have to perform an attach or run any sql scripts if you just want single user file-based access. Wow. I love it! This is a REALLY REALLY REALLY nice feature of SQL-Server. This same database file can be attached to a SQL-Server 2005 database server as the scalabiltiy needs of our customers change. Added with our own application deployment options, our product provides solutions for a very broad customer base. Good job Microsoft!

Thursday, January 19, 2006

Serializing data across time zones in .NET 2.0

This week I've been implementing support in our framework for the new DateTimeMode setting on the DataColumn class. This property is used on DateTime columns to determine a couple things; 1) it specifies how dates should be stored in the column and 2) how a date should be serialized when marshalling across time zones. Setting the DateTimeMode to Local or Utc will not only affect serialization but will also affect how the data is stored in the column. Setting to Unspecified or UnspecifiedLocal does not affect the storage, just the serialization. In .NET 1.x the dataset would always serialize dates as UnspecifiedLocal. This means it would apply the appropriate local time offset when it deserialized. So if you entered the value 12/1/2005 00:00:00 in Florida and passed that dataset to California it would show up as 11/30/2005 21:00:00. This can be a problem depending on the meaning of the datetime value. If you are say storing this in a database and/or not using the time part, when you display the date part to the user you have a problem.

One way to solve this in 1.x is to use a surrogate class which also provides the added ability to serialize the data as true binary. When wrapping the dates up in the surrogate before serialization, you can have it not apply the offset to the DateTime columns. However this approach works across the entire set of columns in the dataset; there's no granularity.

So here comes the DateTimeMode in .NET 2.0. You can set each individual column to the mode you want and the serialization will behave exactly how you want. Great. So lets start designing our typed datasets and you'll notice a DateTimeMode property in the property sheet in the designer. Set that to the mode you want and regenerate your typed datasets... right? WRONG. There's a bug in the designer (and XSD.EXE) where it refuses to code spit the DateTimeMode even though it's properly declared in the xsd file. Well that totally sucks. For more info see the bug report.

So the work around is that you have to set the DateTimeMode at runtime before serializing. Also be careful if your merging an untyped dataset into a typed dataset because the DateTimeMode on the typed dataset will prevail in that case. (See the documentation on compatible merges.)

So with all the workaround code I now have running I turn my attention to the new binary serialization support in the 2.0 DataSet. My initial performance numbers are NOT impressive at all. In fact, the Xml serialization is much faster for small sets of data. This is in drastic contrast to the surrogate class I was using in 1.x. The surrogate class performs better in all cases. I'm updating the surrogate to include the new DateTimeMode support and once I have it all tested I'll post a new GotDotNet sample. I'll also post some more formal numbers once I finish my tests.

Thursday, January 12, 2006

Happy New Year and all that jazz....

HAPPY NEW YEAR!

Okay I know it's a little late. Sorry I haven't posted in a long while but lots of things were going on for me during the holidays.

For one, I was heads down for the last month upgrading our framework to take advantage of .NET 2.0 and Visual Studio 2005. Things like generics, custom events, ADO.NET enhancements, new WinForms data binding stuff to mention a few. I've also been playing around with the Visual Studio Team System Tester load test tools. Love it.

Also, I was busy in December prepping for my first Christmas dinner. Thank god for my sister. She's a Martha Stewart Wonder Woman. I couldn't have done it without her. She's a scientist (a real one, not computers) and she had the entire Christmas prep and dinner planned out in an Excel spreadsheet. The roast leaving the oven was T-minus zero and everything before the roast was negative minutes and everything after the roast was positive numbers. Of course, at time of execution we ended up drinking too much champagne and the whole planning spreadsheet went out the window and the "Force" took over. We did great though; even Nona said it was a wonderful dinner. I love cooking but I need to watch more Emeril.

Finally, Alan and I threw a NYE party and it was off the hook (do people say that anymore?). Anyways, it was a lot of fun. All the neighbors came and we all got drunk on ice wine martinis my sister was shaking. Some got a little too drunk. Luckily I'm a beer drinker and maintained my cool (and my dinner unlike some people who used my bathroom). Only two broken glasses and no one in the hospital so it was a success.

Resolutions this year? Blog more, read more, get an Xbox 360 and set up media center, get new furnaces, and find a landscaper before the weeds outside grow to "Land of the Lost" size this spring.

Wednesday, November 09, 2005

Boy, were they ready!

What an exciting launch. Microsoft spent a ton of money on this marketing campaign and it showed! They had the guys from the show American Choppers build a motorcycle and Paul Sr. drove it into the crowd and allowed all the attendies to take a photo with him and Mikey. (I love that show so it was exciting for me!) They also got the rock band Cheap Trick to play a concert that evening - they rocked.

I was stationed at the Ask The Experts lounge, the Enterprise Developer cabana and helped out over in the Hands on Lab. I had a lot of positive customer experiences and interesting conversations.

Everyone at the event received a full licensed copy of SQL-Server 2005 Standard edition and Visual Studio 2005 Professional edition packaged to look like two platinum record albums. I ended up with a backstage pass and on my copy I got autographs of Paul Sr. and Mikey as well as the lead singer of Cheap Trick, Robin Zander.

If you can make it to one of the Launch events in your area I would highly recommend attending. Thank you Microsoft for a great day!

Friday, November 04, 2005

Are you ready to rock!?

Visual Studio 2005 Launch Event - San Francisco
This Monday is the SF launch event! I'll be hanging out in the Ask The Experts lounge from 10am-12:30pm and then at the Enterprise Developer copa-cabana from 1:30-2:45pm. Come by and say hello!

Sunday, October 02, 2005

MVP Summit is over...

Ahhhh... I'm still recovering from the MVP Summit "social activities". ;-) It was a great summit. I learned a lot and saw a ton of amazing stuff coming from the Microsoft camp. I'm really excited about the future.

In my search for the answer to the question "What is an Architect?" I realized that even the other architects I spoke with had the same question. It was interesting to hear different views on what an architect is and what the architect MVPs actually did. I don't think there really is a clear definition of what an architect is or does exactly, however, I did learn that all architects have a couple things in common.

Architects are open minded people that can accept other people's solutions to particular problems. As long as the solution meets the problem's performance and scalability needs and the solution is easily maintainable then an architect will buy into your design. Architects balance the needs of the business and the needs of the system. They are sensitive to construction costs and maintenance costs based on the people designing and maintaining the system. They understand (or are at least aware of) the proven patterns of not only software solutions but also business processes.

Regardless of whether you are an enterprise connected systems architect or a software product architect or an infrastructure architect, you are sensitive to the construction and maintenance costs of your solution with your particular group of people and your particular business.

Tuesday, September 27, 2005

MVP Summit here I come!

I'm working from a downtown Seattle hotel with a beautiful view today -- tomorrow the MVP Summit starts. Someone forgot to tell Seattle that summer is over, it's absolutely gorgeous here!

I'm really looking forward to meeting my fellow architect MVPs. I'm interested to see exactly what other "architects" actually do. Connected systems, business applications, products, infrastructure, databases, all of the above? How much code do they actually write? How many developers do they direct? How much influence do they have on the business? Are they typically consultants or employees? What is an architect anyway? Microsoft's vision for architecture sounds a little fluffy to me. I'm hoping to walk away from the summit with a much clearer picture.

Of course, I'm also excited about seeing the new XBox 360 ;-)

Tuesday, September 20, 2005

Tragedy Hits the Fox Community

On Friday Drew Speedie and his son, Brent, fell a few hundred feet to their deaths from a bridge in Yellowstone Park while vacationing there. My heart goes out to Irene his wife. Drew was a Visual FoxPro MVP and regular conference speaker and writer.

I remember the first time I ever met Drew was at the Visual FoxPro 6.0 DevCon in May 1998 in Orlando. I remember how funny and engaging he was showing off the VFP Grid. Drew was great at showing you the ins and outs and tips and tricks of a particular feature -- things you never thought of.

The first time I ever met Brent was at an Essential Fox conference (I think 3 years ago) in Kansas City. The first thing that came to mind when talking with him was "Wow, this kid is smart. And just like his father." He was very engaging and had the same wit as Drew during our conversation about Arizona. The last time I spoke with Drew he told me about some beautiful places to visit in Arizona -- I think I'll have to go see them now.

For more information please visit the FoxWiki.

Thursday, September 15, 2005

The exciting future of Visual Basic

Make sure you check out the Future Versions section of the VB site for information on LINQ. You can even download a preview of this technology which works with the release candidate of Visual Studio! And if you haven't read this yet, this MSDN paper is a great overview of Visual Basic 9.0. Man! VS 2005 isn't even released yet and I'm drooling over the features of the next version after that! Sigh.

Wednesday, September 14, 2005

A fundamental shift in programming for most, a sigh of relief and a breath of excitement for us!

Paul Vick formally announced Project LINQ yesterday at PDC. LINQ stands for "Language Integrated Query". LINQ brings standard query operations into the .NET platform. Wow, an object oriented language with rich query syntax... hmmmm... sounds vaguely familiar ;-). This is what I've personally been waiting for ever since I moved into .NET programming from Visual FoxPro work. Paul is right; this does represent a fundamental shift in programming for most developers. When you have a language that supports this style of programming, the architecture of your applications change. You start to think about dynamic data (and metadata) as the engine of your application. It's not to say you can't create dynamic data-driven applications right now in .NET, it's just a lot harder. When you can write elegant queries directly into the editor you tend to favor that expressive style when working with data instead of a rigid strongly-typed object approach. For instance you could write a function that performs some complex operations on changing data but apply it inside of a select query for only the matching pieces of data; and you can do it in 5-10 lines of code instead of 100 lines of for each's and if statements.

Now for the people of the Fox this is the only logical way to work with data inside of an application so I think that's one of the major reasons people stay working with Visual FoxPro. However, VFP is not a strongly-typed language, it's execution is slower and it's based on COM. But because VFP is loosely-typed you can get away with a lot of slick dynamic, scripting-style programming.

What the architects of LINQ are doing is amazing. They are bringing query comprehension to a strongly-typed environment. However, I'm personally excited about the future of VB.NET. VB.NET is strongly-typed AND loosely-typed at the same time. In my opinion that will make VB.NET the preferred data-oriented programming language and the language of the future -- especially for information systems.

I hope that Visual FoxPro programmers will take a hard look at VB.NET if they haven't already. There is a lot of opportunity for you here because we already know how data-based applications should be written using query in the language and we can provide invaluable feedback to the architects of LINQ and VB.

Tuesday, September 06, 2005

I'm speaking at the Bay.NET UG on Thursday

I'm speaking on Thursday for the Bay.NET user group down in Pleasanton. So if you rather see me than the Raiders vs. Patriots game (I know it's a tough decision) then come on out!

Wednesday, August 24, 2005

The Fox is out of the bag

In the Visual FoxPro August Newsletter in a paragraph regarding the SouthwestFox conference Ken mentions: "Calvin's presentation will be on great demos of new language features being added to a future version of Visual Basic for data-centric .NET programming significantly based on Visual FoxPro technology."

On a related note, Paul Vick punches up the abstract on his PDC topic Visual Basic: Future Directions in Language Innovation

Hip hip, HOORAY!!!! And the crowd goes wild......

Wednesday, August 17, 2005

Back from vacation

Ahhhh. I love summer. This year we drove up the west coast from San Francisco to Seattle. The first day we made our way through the redwoods up to Humboldt County. We stopped in Eureka and stayed at the Carter House Inn. It was beautiful and lots of fun. It was foggy in the morning but it cleared up and was sunny and mild in the afternoon- typical Northern California costal weather for August.

We then headed up the coast into Oregon, stopping at every tourist trap along the way -- Confusion Hill, Trees of Mystery, and the Enchanted Forest (complete with concrete dinosaurs). We made our way up to a camground near Dune City, OR - 8 miles south of Florence - and camped there for two nights. We hiked to the beach in the morning -- pretty easy walk, actually -- and collected shells and played on the beach with the seal lions. It was just me, Alan and the lions -- no one else for miles. A man did come out of nowhere and strolled up to us. But he gave me some cool agate stones and a whole sand dollar he found on the beach. He was cool.

After our relaxing two days we headed up to Seattle via I-5 through Portland. We needed to meet a friend who was flying in that night for Alan's birthday. Of course the flight was delayed 2 hours (because she flew Alaska Airlines) and she missed the dinner party. I should have figured. Alaska is ALWAYS delayed no matter what time of year. You're better off flying SouthWest (if you don't mind being hearded like cattle).

The rest of the week we spent visiting friends in Seattle and going up to Victoria, Canada (yes we went to Butchart Gardens ;-)). It was cold and overcast in Seattle (naturally!) but Victoria was nice and sunny.

It's nice to be back home. Visiting other places really makes me appreciate where I live. Summer is still in full swing here in the East Bay and I'm looking forward to spending the rest of it at home. Well, maybe I'll go camping on Mount Diablo one weekend with my sister, but that's only a 20 minute drive ;-)

Monday, July 11, 2005

VB.NET as a dynamic, data language

Personally, I am very excited about what Paul says in his post here. This is one of the biggest reasons why I love VB.NET (and VFP), and it looks like there will be some very exciting things to look forward to after VS2005. Make sure to check out this paper (which Paul links to from his post) by Erik Meijer and Peter Drayton.

Monday, June 27, 2005

Back Home from DevTeach

Well I'm back home from DevTeach which was held in beautiful Montreal. If anyone was looking for the rest of the presentation demos and slides they are all up on the DevTeach site now. I met lots of new friends this trip that I hope to keep for a long time to come. Thanks to everyone at DevTeach for a wonderful conference!

Wednesday, June 08, 2005

VS/SQL-Server 2005 Release Date Announced

The release dates for the next versions of Visual Studio, BizTalk and SQL-Server were announced at Tech Ed to be the week of Nov. 7th. A few places to read about it are here, here and here.

Wednesday, June 01, 2005

Bonus Session at DevTeach

If you're coming to DevTeach, you should definately check out the architecture bonus session. I'll be sitting on a panel with a bunch of really cool architecture dudes. Plus Nick Landry is going to be the animator so it should be a lot of fun! Hope to see you there.

Tuesday, May 17, 2005

Make your .NET demos better with a TraceListener

Last night I was writing a sample application for one of my DevTeach sessions and I thought I'd share this little trick. If you've ever tried to fiqure out a speaker's sample code after the conference when you got home you'd appreciate this as well. Usually I just write copious amounts of comments in my code to help people but last night it dawned on me how I could add a very simple TraceListener to my application to easily display the application's sequence of events in a list box. This way the developer could see exactly what was going on at runtime without having to debug the code.

If you're unfamiliar with TraceListeners have a read here.

Trace listeners monitor the output of the Debug and Trace messages in an application. You can create custom listeners and then add them to the Debug or Trace Listeners collection on application startup quite easily:
Imports System.Diagnostics

Public Class Main
 ''' --------------------------------------------------------------
 ''' <summary>
 ''' Main enrty point for the application.
 ''' </summary>
 ''' <remarks>
 ''' </remarks>
 ''' <history>
 '''  [Beth] 5/16/2005 Created
 ''' </history>
 ''' --------------------------------------------------------------
 Shared Sub Main()
  '-- Registers a trace listener 
  Debug.Listeners.Add(New DemoAppTraceListener)

  Application.Run(New MainForm)
 End Sub
End Class
The idea for the DemoAppTraceListener class is very simple. I just want to globally broadcast the trace messages so that they could be displayed by the application anywhere. We can do this by declaring a Shared (static) event:
Imports System.Diagnostics

''' -----------------------------------------------------------------------------
''' Project  : DataCachingStrategies
''' Class  : DemoAppTraceListener
''' 
''' -----------------------------------------------------------------------------
''' <summary>
''' Globally broadcasts the trace messages in this demo which are displayed in the UI.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
'''  [Beth] 5/16/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class DemoAppTraceListener
 Inherits TraceListener

 Public Shared Event MessageReceived(ByVal e As MessageEventArgs)

 Public Overloads Overrides Sub Write(ByVal message As String)
  RaiseEvent MessageReceived(New MessageEventArgs(message))
 End Sub

 Public Overloads Overrides Sub WriteLine(ByVal message As String)
  RaiseEvent MessageReceived(New MessageEventArgs(message))
 End Sub

End Class

''' -----------------------------------------------------------------------------
''' Project  : DataCachingStrategies
''' Class  : MessageEventArgs
''' 
''' -----------------------------------------------------------------------------
''' <summary>
''' This EventArg is used to broadcast messages from the DemoAppTraceListener.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
'''  [Beth] 5/16/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class MessageEventArgs
 Inherits EventArgs

 Private m_msg As String = String.Empty
 Public ReadOnly Property Message() As String
  Get
   Return m_msg
  End Get
 End Property

 Public Sub New(ByVal msg As String)
  m_msg = msg
 End Sub
End Class
Now all you have to do is handle the event and display the messages. Oh, yea you also have to actually put Trace messages in your code now too!
Public Sub Foo
        Trace.Write("Entering Foo method")
.
.
.
End Sub
To display the messages in my demo I created an MDI parent and put a simple list box on the bottom. Then I just added a handler to the DemoAppTraceListener.MessageReceived event. I added the handler in the constructor because this code is hidden in the form designer region and people won't be distracted away from the demo code.
#Region " Windows Form Designer generated code "

Public Sub New()
 MyBase.New()

 'This call is required by the Windows Form Designer.
 InitializeComponent()

 'Add any initialization after the InitializeComponent() call
 AddHandler DemoAppTraceListener.MessageReceived, AddressOf Me.DisplayMessage
End Sub
.
.
.
Finally I added the few lines of code to display the message in the list box and select the last message:
Private Sub DisplayMessage(ByVal e As MessageEventArgs)
 Me.lstMsgs.Items.Add(Me.lstMsgs.Items.Count.ToString + ". " + e.Message)
 Me.lstMsgs.SelectedIndex = Me.lstMsgs.Items.Count - 1
End Sub
Another cool thing about using a TraceListener is that the developer can still copy/paste the code in the demo into their own applications without having to remove the Trace messages if they don't want to.

Now if you come to my data caching session at DevTeach you'll get to see the TraceListener in action! ;-)