Thursday, March 17, 2005

Photo of the Week - 14 Mar 2005

As folks down Shire way know, last Sunday was the Shark Island Swim weekend. Over 1000 swimmers took part in the race, and the great weather and lack of seaweed made a welcome change from the 2003 and 2004 events. I usually stick to surf boats rather than swimmer as they make for more interesting photos and the lack of juniors around surfboats makes my job as a photographer who is mindful of the paranoia about the combination of kids, swim-wear and camera much easier.


Rather than shoot from the beach, I positioned myself waist deep and shot the start from this position. During the 1km fun swim that starts the day, the field actually spilled out behind me, and I ended up near the middle of a couple of hundred charging contestants. It didn't phase me too much at the time, but when I got back into the beach I realised I didn't have the neck strap on, and even if I did, the possibility of getting knocked over was pretty high. The thought of a very expensive repair made me a bit more cautious for the main 2.3km main race.


This shot was taken as the first batch (under 30s I think) was getting started in the main race. While there is nothing spectacular about it, the sea of red caps, the swimmer in the centre of frame nicely in sharp focus, and the guy in the back-ground painted as a cow (not sure how well this gag works for a swim) really make the shot for me.


Wednesday, March 16, 2005

GPL FUDs itself

For folks like me in the closed-source camp that cringe every time companies like Microsoft go off on a FUD mission against open source, I was disappointed to the see that a prominent member of the open-source community has given his adversaries plenty of ammunition with a childish and ill-conceived stunt. The full story is here, but basically what happened (according to the article) was a guy called Harald Welte, who is a Linux kernel developer, served 13 companies with warning letters because he "claimed that the binary code of the companies' products appears to have used GPL code" (emphasis added).



Serving the warning letters is probably fair enough. If they have violated the GPL license, they need to rectify the situation. But then to go out and publicly name and shame the companies for appearing to do something, without even giving them a chance to respond, and to turn the event into a media circus by doing it at the CeBIT exhibit hall is the type of stuff that will be bought up by sales and marketing folks for commercial offerings for many moons to come. Open source has come a long way, and it is disappointing to see it use these college prank antics. It would be interesting to see the reaction if Microsoft pulled a similar stunt for people that appear to have used pirated software. Maybe someone can have a quite word in young Harald's ear about PR and the like.

Tuesday, March 15, 2005

.NET 2.0 Hidden Gems - The Results

Based on the survey and email response, the outline for the article I've decided to go with is:



1a. Lightweight code gen (200) (200)

1b. Better cookiesless support (200) (400)

1c. New Trace features (300) (700)

1d. Strongly-typed resources (300) (1000)

1e. Nullable generic (400) (1400)

2. Debug visualizers (800) (2200)

3. C# refactoring (600) (2800)

4. FxCop Integration (800) (3600)

5. XSLT Debugger (400) (4000)

Word count for each topic in first bracket, followed by cumulative word count.



Results of the survey below. Thanks to everyone that took part - there where 50 responses. If anyone is interested in doing an online survey, freeonlinesurveys.com is quite good.










































































































































  Percentage Responses
New Trace functionality in .NET Framework
5.5


15

Debugger visualizations - allow things like a
DataSet to be shown in a DataGrid at debug time

6.9


19

New hosting APIs - built for Yukon, exposed for
all. Allow very fine-grained control of the CLR when you explicitly load it.

3.6


10

Better NGEN behavior and performance
2.5


7

Nullable
- the nullable type for all languages

5.5


15

GC.AddMemoryPressure - ability to get the GC to
help with memory management of large non-managed memory hogs.

2.2


6

Enhanced X509 support. Better digital certificate
management.

3.6


10

Zip file support
5.1


14

The new C++ - C++/CLI. __No __more __Managed __C++
2.2


6

STL.NET. Generics and templates
3.3


9

C# fixed size buffers. Great for interop and ready
structures off disk.

2.5


7

CLR changes - gritty stuff happening under the
hood.

4.0


11

ADO.NET 2.0 - MARS and SQL bulk copy
3.3


9

VSTS Performance Tools
2.9


8

ASP.NET Data Caching
3.3


9

Code Definition window in Visual Studio - build a
skeleton of what a binary reference would look like if you had the source code.
Removes need for Object Browser.

2.5


7

64-bit support in .NET 2.0
3.6


10

Strongly-typed resources
5.5


15

Per-user configuration settings
4.0


11

C# refactoring support
6.2


17

VB.NET Using statement
2.9


8

C# and VB.NET accessibility modifiers of property
get and sets

2.5


7

C++/CLI automatically generated property stores -
declare a variable like a global, but under the cover the compiler generates a
private variable and exposes a property

1.8


5

FxCop integration in Visual Studio
6.2


17

Compact Framework Improvements
4.7


13

Other.
3.6


10


Responses for Other: OTB, CD, XSLT Debugger, ObjectBinder, Cross form posting in ASP.NET , ASP.NET Client callback support, personalization support,enterprise library compatibility/inclusion?, sgen.exe (and integration within VS), Designer enhancements, window docking guides, save settings, etc, C# Partial Classes

Monday, March 14, 2005

Why I signed the VB.Classic Partition

Those who know my views on VB will probably be surprised to see that I have signed the Classic VB petition at http://classicvb.org/petition/. I have been pretty critical of the way that some member of the VB Classic community have attempted to advance their views over the last couple of years. It has a been a bit like the Greens in politics (in Australia at least - I don't follow the world Green scene closely) - their basic platform is certainly worthy, but their actions in advancing their beliefs have showed intolerance and bigotry towards others who have a different view on the world.



I never liked VB Classic much, and I think VB.NET isn't a great language because its legacy features make it more complex than C# (which is supposed to be more complex). Looking at the objectives of the partition, and the logical and well mannered way they are laid down, I am fully in agreement with their aims and approach. Not supporting the VB6 runtime in Longhorn is crazy. Microsoft support the Win16 runtime in Windows Server 2003 (the 32-bit edition at least), which will mean that it is not going to die until Longhorn in 2006, more than a decade since it was replaced. Supporting the VB6 runtime up to and including Longhorn Server would seem to make sense and gives it the same wither-time as Win16.



Bill McCarthy estimates it would only take one to two person decades to integrate the VB6 compiler and debugger into the VS IDE. I am certain that by the end of my technical career I will need to debug back and forth between VB6 and managed code, so given the very small investment that it would take to make this happen, I can't seen why Microsoft won't do it. The same effort still goes into niche products (in today's managed world) like ATL, MFC and FoxPro. VB seems to deserve the same effort, if for no other reason than fairness.

Sunday, March 13, 2005

AOP Performance Numbers for .NET - Part 1

A question came up on the Australian .NET mailing list about which is the fastest AOP implementation. I committed to running some performance tests on the subject. Over the weekend I did some testing on the AOP.NET Framework's performance compared to not using AOP and manually coding the aspect. Because logging is so often used as AOP's prototypical 'problem-solved' scenario, I used this in the tests. Obviously cross-cutting something heavy like 2PC transactions would give a different result, and cross-cutting a slow method would also dramatically decrease the relative impact of using AOP.NET.


Anyway, enough of the caveats. I ran the test using the benchmark harness I wrote for Maximizing .NET Performance. The test case was calling a virtual method (which was empty). Before the method executed, I wanted the following line to execute:

Trace.WriteLine("Entering method");

I tested three cases: the generation of the Trace.WriteLine call through AOP.NET, the Trace.WriteLine call manual coded before the call to the empty virtual function, and the Trace.WriteLine call without the virtual function call. The result was that using AOP.NET to cross-cut the logging was eight times slower than manually coding it. Again, these results are for cross-cutting a light-weight logging call onto an empty virtual method. For a fatter cross-cut onto a fatter method, the relative impact of the cross-cut will be much smaller. My test case is close to a worse-case scenario, so don't ditch AOP.NET or AOP in general based on this result. On the same token, don't be dismissive of the impact of doing compile-time-like things at runtime. The cost can be high.


Next weekend I'll try to run the test on a Context Bound Attributes-based AOP framework.


Full dump of results:



TraceWriteLineTest
Compares AOP techniques for generating a simple log message before method execution


AOPdotNET Normalised: 8.630499 Median: 00:00:01.6836290 Mean: 00:00:01.6920000 Min: 00:00:01.6729440 Max: 00:00:01.7263870 StdDev: 00:00:00.0220000
Results:00:00:01.7004660 00:00:01.6836290 00:00:01.7263870 00:00:01.6784470 00:00:01.6729440


Inline Normalised: 1.007284 Median: 00:00:00.1965000 Mean: 00:00:00.1980000 Min: 00:00:00.1946380 Max: 00:00:00.2063730 StdDev: 00:00:00.0050000
Results:00:00:00.1950010 00:00:00.1970740 00:00:00.1946380 00:00:00.2063730 00:00:00.1965000


VirtualCallAndTrace Normalised: 1 Median: 00:00:00.1950790 Mean: 00:00:00.1970000 Min: 00:00:00.1936980 Max: 00:00:00.2054330 StdDev: 00:00:00.0050000
Results:00:00:00.1936980 00:00:00.1954910 00:00:00.1950790 00:00:00.2054330 00:00:00.1947720





Test code:
using System;
using System.Diagnostics;
using DotNetPerformance;
using NAop;

namespace TestCode
{
public class TraceWriteLineTest
{
[Benchmark("Compares AOP techniques for generating a simple log message before method execution")]
public static TestResultGrp RunTest()
{
const int numberIterations = 10000;
const int numberTestRuns = 5;

TestRunner tr = new TestRunner(numberIterations, numberTestRuns);
TestRunner.TestCase testCases = null;

testCases += new TestRunner.TestCase(AOPdotNET);
testCases += new TestRunner.TestCase(Inline);
testCases += new TestRunner.TestCase(VirtualCallAndTrace);

return tr.RunTests(testCases);
}

public static void AOPdotNET(Int32 numberIterations)
{
ContextAOP context = (ContextAOP)NAop.AopXmlFactory.Create(typeof(ContextAOP));
for (int ix = 0; ix < numberIterations; ++ix)
{
context.NoOpMethod();
}
}

public static void VirtualCallAndTrace(Int32 numberIterations)
{
ContextAOP context = new ContextAOP();
for (int ix = 0; ix < numberIterations; ++ix)
{
context.NoOpMethod();
Trace.WriteLine("Entering method");
}
}

public static void Inline(Int32 numberIterations)
{
for (int ix = 0; ix < numberIterations; ++ix)
{
Trace.WriteLine("Entering method");
}
}
}
}

/* AOP.NET Code */
using System;
using System.Diagnostics;
using NAop;


namespace TestCode
{

public class ContextAOP
{
public virtual void NoOpMethod(){}
}

public class AspectLog : IAspect
{
#region IFilter Members

public void BeforeInvoke(IAopContext context)
{
Trace.WriteLine("Entering method");
}

public void AfterInvoke(IAopContext context)
{
}
#endregion

}
}

/*AOP.NET Config*/

<AopNet>

 <AspectAssembly Name="TestCode.dll">

  <AspectClass Name="TestCode.AspectLog">

   <CrosscutClass Name="TestCode.ContextAOP">

    <PointMethod Name="NoOpMethod"/>

   </CrosscutClass>

  </AspectClass>

 </AspectAssembly>

</AopNet>

Photo of the week - 7 Mar 2005

Seems like this post is getting latter each week ...

This shot was taken at Mylup in Western Australia. Mylup is a small town west of Harvey (WA's milk capital) and north of Bunbury. The town is dominated by the single caravan-park and general store, and my in-laws have a permanent van in the park that they go to most weekends. Over Christmas last year, I spent a night at the van with my wife and daughter. From a photographic perspective, the place is pretty horrid. Strong on-shore winds blow all day during the summer, there is rarely any cloud to fill out the sky, the beach is long and featureless, and the back of the beach is grassy dunes that run uninterrupted for about 60 kilometers all the way up to Mandurah.

This shot was taken soon after dawn (which is a poor time for photos generally in a west-facing coastline), and I was very hesitant to try and take any shots. The day before the place looked horrid, with sea-spray and howling on-shore winds scattering sand and reflected light everywhere. In the morning, the wind had totally dropped, and the light was quite clean. I tried a few seaward facing shots, but they lacked any single point of interest. The weathered post in the shot was like many that lined the beach-dune divide, and was lit well enough to show detail even with the sun pretty much behind it. I could have used a flash to bring out more detail, but wanted a prominent foreground that prevented my getting close enough to use flash. I also could have used a circular polarizer to bring out the blue in the sky, but this would have killed the detail in the post. In the end, I shot unaided, and left the two could-haves for Photoshop.

The two main edits are a masked screen layer to bring out some detail in the post, and a gradient-screened multiply layer to bring out the blue in the sky. While the image stands up OK without them, the certainly bring it up a notch when added. USM and some leveling have also been performed.

Wednesday, March 09, 2005

.NET 2.0 Hidden Gems

I'm doing an article for Australian Developer on new features in .NET 2.0 that haven't got the love they deserve. Rather than just plucking five features out of thin air, I've decided to ask you, the esteemed .NET community, to guide my virtual pen for this article. I've created an online poll with 25 items that I could cover at http://FreeOnlineSurveys.com/rendersurvey.asp?id=84875. There is also room to add features that aren't on the list.



Please feel free to take the survey and nominate your favourite hidden gems.



As an optional reward for your time in filling out the survey, leave your email address, and I'll shoot you through a copy when the article is done.

Tuesday, March 08, 2005

Eric talks about our upcoming book...

http://blogs.msdn.com/ericgu/archive/2005/03/08/389912.aspx

See you in Wollonong tomorrow night

I'm dropping down to see the great folks at the Wollongong .NET Users Group (WDNUG) to speak about upgrading to .NET tomorrow night (10 Mar). This is a talk more from the business and software/ project management side of the upgrade process, but does drill down into technical areas in the second half. It's a from-the-trenches this-is-what-we-learnt presentation rather than a rah-rah "lets all migrate everything to managed code", and it has been quite popular when I have done it in Sydney.


Directions on the WDNUG site - hope to see you there for pizza around 6.30pm.

Thursday, March 03, 2005

Photo of the Week - 28 Feb 2005

I was going to get this post out on Monday, but had plenty of writing to do for my Code Guru column and MSDN Magazine ANZ, as well as the regular consulting work.


Continuing on from last week's lighthouse theme, this shot was taken at 6.28am on the 5th Feb this year at Wollongong Harbour. I had shot the Interstate Challenge section of the Australian Surf Rower League (ASRL) Open 2005 event the night before, and scoped out the Harbour as a good sunrise location. When I'm shooting a surf carnival, I like to get there really early (I left home before 5am on this day). You get some great shots with the sun lower in the sky, you get a parking spot closer to the event (so if I need to download to the laptop if I run out of batteries on the portable storage device I don't miss many shots), the rowers don't have their club caps on for the warm-up so their face is a lot more visible, and the boats-all-over-the-shop situation that happens during warm-ups can deliver a more pleasing composition. The fact that I'm always the only photographer there before 8am always surprises me.


As can be seen from the shot, the sky was totally clear, which is pretty uncondusive for a colorful dawn shot. Without clouds to hold the red colour of the dawn, it is possible to get a strange mix of cold light from the darkish sky and very warm light when the sun has actually risen, as this shot shows quite well.


I had initially setup on the small beach just out of frame, but the lack of anything interesting in the sky (outside the sun when it finally appeared) gave me the feeling that I needed something stronger than a beach in the foreground to prevent the shot being a pretty boring "here is two lighthouses - how pretty" snapshot. There was a breakwater that run around to the left and out to the lighthouse in front of the sun, and as I walked along this, the potential to use this large plant for foreground became apparent. I was actually trying to frame the left lighthouse inside the leaves of the plant, but limited tripod room and the arrival of the sun spoiled this plan. With a dawn shot on a day with no clouds to hold the color, the amount of time where typical dawn light is available is only a couple of minutes. Before the sun actually rises, there isn't lot of color, and once the sun is fully over the horizon, it becomes too bright to shoot directly, and unless there is a lot of dust or pollution to scatter the blue light, there isn't much colour away from the sun.



As the sun rose, I tried to hide it behind the small lighthouse, but the relative ratios where wrong, and the sun overwhelmed the lighthouse. This turned most of the shot into silhouette, which took a lot of detail out of the boats in the harbour, but took a lot of the distractions away from the lighthouses. The star-burst through the window half way up the lighthouse was an added bonus. The star-burst has undergone no post-editing to enhance it. The symmetry and cleanness of the star-burst yet again confirmed the quality of Canon L Series Lenses, in this case the 17-40.



About 2 minutes after I took the shot, the sky was way too bright to anything close the the direction of the sun, and the direct lighting on the harbour had totally changed the way the scene looked. The ASRL Open was held in really small surf, so this was defiantly one of the best shots of the day, and I'm glad I took the extra effort to get down to Wollongong early to get it.



Technical data embedded in JPEG for those interested.




Aussie .NET Authors and Writers

My previous post got me thinking about how many .NET writers there are in Australia excluding Deepak and myself. Here is the list I came up with. If I've missed you, please drop me a line and I'll add you to the list:


The list of Aussie .NET authors that I know of is (in no particular order):

  • Andrew Parsons - editor extraordinaire and author of the upcoming VBe title: Wrox's Visual Basic 2005 Express Edition Starter Kit
  • Michael Weinhardt - author of Windows Forms Programming in C#, Second Edition (covering .NET 2005)
  • Peter Stanski - co-author of .NET Compact Framework (where's the new version Pete?)
  • John Gough - author of Compiling for the .NET Common Language Runtime
  • Damien Watkins (who I've never meet) - co-author of Programming in the .NET Environment
  • Scott McCulloch - co-author of Professional DotNetNuke ASP.NET Portals
  • Mitch Denny - who has done a ton of .NET articles for Aus Developer
  • Bill McCarthy - who writes all over the place on VB.NET
  • Neil Roodyn - XP and emdedded columnist, and author of eXtreme .NET
  • Greg Low - doing a book on CLR Integration for DBAs and frequent .NET columnist
  • Nick Randolph frequent .NET columnist
  • Tania Bull - used to write a lot for Aus Developer is its prime
  • Brendon Chase - frequent write on .NET
  • Chuck and Andrew - infrequent writers on .NET
  • Ken Schaefer - author of CYA Securing IIS 6.0
  • Chris Peiris - who has been involved in heap of .NET books as an author and editor.
  • Paul Glavich frequent online author at ASPAlliance and other online ASP.NET resources.

  • Deepak joins the ranks of Aussie .NET writers

    I was speaking to Deepak last night at the user group, and his big news was that he got his first article published on MSDN Online - Walking Through Avalon and Windows Forms Interoperability in Code. I get heaps of people asking me how to write .NET articles, and Deepak is the first guy who has followed through and written something. Deepak is right into the while Longhorn thing, so he is looking at stuff years ahead of me. Well done Deepak - great stuff.