The Bag Arrives

Today the Tom Bihn Brain Bag was delivered. The courier delivered it to my home whilst the wife was out and so they decided to throw the box over the garden gate. Amusingly the online UPS tracking certificate had “Signed by: DR SIDE GATE”.

Tom Bihn Brain Bag

The bag itself is a pretty plain affair with the normal array of pockets and compartments that you would expect from a good quality backpack. The shoulder straps, chest and waist fasteners were well fitting and I was quite surprised as to how “natural” it felt to wear – certainly more so than any other backpack I’ve tried.

So is it worth US$140 (without freight)? Well – I dunno? The build quality seems excellent. Although I’m certainly no expert – “The back is made of Dri-Lex Aero-Spacer mesh and is padded with 3/8″, high quality, closed-cell foam” – does sound pretty impressive. But their marketing only just starts there…

I mean the US$140 just gets you the bag itself. There are no laptop pockets, document organisers or anything it it – just two large zipped compartments with custom fastener points. You see you have to buy those as extras – but you don’t but “laptop pockets” and “organisers”. No, for your Brain Bag you buy “Snake Charmers”, “Vertical Freudian Slips” and “Horizontal Brain Cells”. Would I pay a further US$60 for a “laptop pocket” – are you kidding! But US$60 for a “Horizontal Brain Cell” and suddenly I’m scrambling to work out shipping costs .

With the bag came the invoice – complete with details for returning presumably if you find any defects or are otherwise unhappy with it. Printed at the bottom of the invoice was this little gem…

Tom says: “Everyone gets a free cookie!”

Sure enough inside the bag was my very own Cougar Mountain cookie with ingredients including chocolate liquor. I must be special

Couger Mountain Cookie

Even their tag line is priceless: TOM BIHN – Portable Culture.

Tom Bihn Packaging

All this marketing – yet my wife somehow remains immune. She keeps calling it the Tim Bin Bag.

A New Toy

For the first time in around 20 years I’m about to be un-employed. Don’t worry, its not quite as radical as all that – I’ve already signed a contract and am looking forward to starting a new position on the 10th December. But since I finish with my current employer on Friday that means 1 week of un-employment. I am so looking forward to that!

To celebrate the occasion my wife decided we needed to go on holiday. Low stress – so no driving, no busy schedule of activities, no rushing… hmm… in other words just about the opposite of every holiday we’ve ever taken. So she’s picked somewhere fairly remote – with no cars or shops, just beaches, pools and food. Sounds great, “but does it have broadband” I ask?

So last weekend I think about packing and get out my trusty old Toshiba laptop. Now the only time I ever use this thing is when we go on holidays. With horror I discover that the backlight has failed. Now I have a very slow, fully functional notebook with no screen.

I’m still waiting for my .NET Rocks Brain Bag and Monitor so surely a new toy to keep me going isn’t too much to ask right? The wife is in full agreement – at least I think that’s what she means when she rolls her eyes that way? So I’ve spent the past few days looking for a notebook that meets the following criteria:

  • Is fun – this is a toy remember – I’m not planing on doing anything remotely serious (like development) on it
  • Is relatively small and light and doesn’t generate to much heat to use on your lap
  • Powerful enough to run Vista Aero and still feel “snappy”
  • WiFi 802.11g – cause who wants cables
  • Gigabit Ethernet – cause when it needs to be done moving 100Gb over WiFi is tedious. [Why aren’t all Ethernet ports these days Gigabit? Now maybe the difference is less obvious with a laptop hard disk but there is still a significant gain over 100Mb even with just Cat 5e cabling.]
  • Card reader – to backup the holiday photos

I had quite a few contenders that went through consideration.

  • Dells XPS 1330 – great performance, good price and not a bad looker, but I’ve only got 3 days to get my hands on one – bzzz!
  • Toshiba Protege R500 – tiny 1kg notebook with solid state 64Gb hard disk, LED backlight, lots of Vista features but poor performance using ultra low power processor and doesn’t come out till December/January – bzzz!
  • Fujitsu LifeBook T4220s – tablet PC (that’s gotta be fun?), good performance, good specs although a bit chunky, no firewire and low res 1024 x 768 screen. Do we have a winner?

As luck would have it an existing Fujitsu Tablet PC owner contacted me this morning as I was deliberating. He seemed pretty happy with his choice and recommended Hugo Ortega from www.tegatech.com.au. Now it turns out Hugo is in the wrong game – as far as I can tell from the phone and e-mail conversations I had with him he’s human. So why is he selling computers? Beats me – but (pending arrival of my machine on Friday morning) I wholeheartedly recommend him! He’s even a Microsoft MVP – oh turns out he’s the legendary Tablet PC Guy!

T4220S

The King Returneth

I never in my wildest dreams imagined that I would be so happy to see the Microsoft File Transfer Manager. Its amazing what the Horrors of Akamai can do to a person.

I checked the MSDN site again in desperation and it appears they have one SKU at least available for download using the standard transfer manager.

  • I got to pick the download location.
  • I’m reasonably confident it will resume from network glitches.
  • I don’t believe it has some built in 8 hour time restriction that prevents anyone with poor transfer speeds <= 1.5Mb from downloading it.
  • Its easier to install.

Original Download Manager

I managed to have 5 failed attempts using the Akamai Download err… thing. Wasted around 12 Gb of bandwidth. I just love this paragraph from the Microsoft FAQ regarding the “Top Downloads” use of Akamai.

“What is the Akamai Download Manager and why do I have to use it?

To help you download large files with reduced chance of interruption, Top Downloads requires the use of the Akamai Download Manager. You can easily pause, resume, and stop the download process. Use the Download Manager for efficient installations, time-saving features, and automatic restarting if the download process is interrupted.”

So let’s take a quick look at these claims based on my (and other’s experience).

  • Reduced chance of interruption – hmm… by “reduced chance” do you mean guaranteed?
  • Easily pause – yeah sure…
  • Resume – nope…
  • Stop – well yeah I guess so…
  • Efficient installations – ha, ha, ha…
  • Time-saving features – seriously, how?
  • Automatic restarting if the download process is interrupted – simple mistake the spell checker has obviously inserted “restarting” where “corrupting” should be.

Ok – I’m sorry – vent over

More Download Woes

So last night the whole Download Manager thing was annoying and somewhat astonishing in terms of Microsoft being so relaxed about delivering such a dismal download experience for their enormous MSDN subscriber base.

This morning things have gone past annoying – I’m now pissed off. What are the two critical functions of a download manager?

  1. The ability to recover from intermittent network failure with minimal data loss.
  2. The ability to select a download location for the file(s).

So I can now accurately report that the Akamai Download Manager meets neither of these requirements. According to my logs I had a minor network glitch on my ADSL connection last night lasting a few minutes. The download manager recognized this outage – displayed a verbose and unhelpful message and then failed to resume. It gets even better though – I responded to all prompts in an effort to resume the download with no avail – it even deleted the 3 Gb file that it had downloaded (93%). I mean just check out the frequently asked questions page for another idea of how bad this software is.

So it actually turns out that the Akamai Download Manager is as reliable as right-click “Save As…” but with the limitation that unlike “Save As…” you have no option about where the file will be located on your machine.

So how is this a Download Manager – how is it helping anybody? I’ve used 3 Gb of my quota for nothing – Microsoft will have me try again – so they’ve also wasted 3 Gb, it delays me getting the RTM version so I get more frustrated by the Beta 2 instability (working with Cider).

Has anyone had a successful download under Vista?

[Just for the record I run Vista as an Administrator, UAC turned off and no Virus Checker.]

UPDATE: 17:29

Hah! Works sooo much better under Windows XP. You can actually choose the location of your download file! Of course the resume still doesn’t work so there’s little chance of ever actually completing a download…

Akami Download Manager Failure

I wonder who at Microsoft I should be contacting?

Akami Download Manager Do You Want To Keep

Don’t be fooled by that friendly looking warning sign – this is a trick question. It doesn’t matter whether you pick “Yes” or “No” your download is doomed. There is no ability to resume an interrupted download.

Microsoft’s Download Mis-manager

Well – its old news – Visual Studio 2008 has hit the MSDN download site. To herald in the occasion some bright spark from Microsoft has decided to ditch the embarrassingly stodgy download manager and replace it with something much more exciting. Now don’t get me wrong, the old download manager did its job – it could download a file to a location on your hard disk with minimal interaction. No bells and whistles – and it was obviously written by someone with great skills at low level byte encoding and network data transfer. That’s to say by someone that designed butt ugly user interfaces that would have been considered clumsily constructed even back when it was running in Windows 3.1.

So enough about the old download manager… what bright vision of the future do Microsoft have in store for us. Well its got some meaningless name – its delivered via a browser delivered ActiveX and a popup window. Those two reasons alone should have you running for the hills. So disable all security checks and let the thing own your system.

When/if you actually get it to fire up (I couldn’t manage to relax IE’s security settings enough on my server so eventually resorted to using my desktop) it prompts you for a download location. If you’re using Vista don’t be fooled – you have no choice in the matter. Select locations on your hard disk to your hearts content – it will refuse to use all of them and eventually resort to some virtualized folder deep within the Users branch.

That’s just the tip of the iceberg. If you want the full run down on this terribly piece of software then I suggest you read Richard’s post who does a great job of pointing out a few of its many flaws.

Oh – and it even uglier that the previous one – I think the door graphic on the Exit button is circa Windows 2.0! I seriously began to consider that this entire thing was a hoax and that the application must be a Trojan – I mean a download manager released by Microsoft that is difficult to install (ok – I guess that’s a Microsoft trademark) but then fails to let you pick a location to store a 3.3 Gb file, and would look old-fashioned running on any operating system built in the last two decades!

This is was what finally made it so obvious. Someone at Microsoft must have got irked at all the bad criticism aimed at the old download manager – presumably the very bright but user interface design challenged developer that put the thing together. In all that hate mail screaming “use bit torrent”, “ClickOnce” etc. someone must have laid down the challenge…

“…could you find an uglier, less featured, more cumbersome download manager anywhere on the planet!”.

And so the seed was planted and no doubt after years of searching that nameless irked Microsoft employee has found (in places no browser should be forced to go) the Akamai Download Manager.

Download Manager

Fixed Width Fonts are so 80’s

Seriously – why is it that when I walk around the office I see all the developers staring at Visual Studio code windows displayed using “Courier New” font. Trust me – the “new” in “Courier New” ain’t that new!

Can someone please explain to me how using a fixed width font so that your character positions line up is more important that readability gains of using proportional fonts such as Verdana. Ok – the guy using vi down the back of the class – you can put your hand down – I’m sure your hippy editor is just the bees knees but if it don’t support proportional fonts I’m really not interested.

How is this:

/// <summary>
/// Provides a simplified overview of the validation failure in multi-line text format.
/// </summary>
/// <returns>A multi-line description of the validation failure.</returns>
public override string ToString()
{
return string.Format("{0}: \t{1}\r\n\t\t{2}",
Severity,
string.Format(Message, MessageParameters),
string.Format(MessageDetail, MessageParameters));
}

Better than this!?

/// <summary>
/// Provides a simplified overview of the validation failure in multi-line text format.
/// </summary>
/// <returns>A multi-line description of the validation failure.</returns>
public override string ToString()
{
return string.Format("{0}: \t{1}\r\n\t\t{2}",
Severity,
string.Format(Message, MessageParameters),
string.Format(MessageDetail, MessageParameters));
}

I’m mean it’s not like we’re all writing in some old version of COBOL or RPG where the column positions really matter. I know they’ll be some old sticklers that really can’t let go of their last hold of the ‘good ol’ days of 80s programming – but for the rest of us – let’s move on.

I hope Visual Studio 2008 RTM ships with a proportional font as the default editor font.

XAML and WPF – or "I’m seeing stars"

Warning – This post just describes some fun I’ve been having learning about 2D graphics in WPF. There’s certainly nothing very clever going on here, but its been pointed out to me by a prominent Australian blogger that its not the quality but the quantity of blog posts that’s important :-p

But more seriously if you do want to read something of substance check out Paul’s post regarding why he doesn’t believe the Visual Studio 2008 Form Designer (Cider) will help developer productivity.

So anyway – about those stars…

I’m having a hard time at the moment really diving into a serious bit of WPF programming. It seems I’m constantly being tripped by the question of “should I do this in XAML, or should I do this in C#?”. Now traditionally (under WinForms) when writing a custom control I’d just start with a blank class file, determine the most appropriate Control/Component base class to derive from and start coding properties, events and any required rendering.

Now each time I’ve tried that approach with WPF – I end up realising pretty early on that its the wrong approach. Everything apart from the very specific properties and events are already there – or are provided by attached properties/events. The rendering is much easier to do in XAML too – in fact if done property the rendering is almost completely divorced from the control definition anyway and ends up in a theme based or Generic.xaml file.

Ok – so that’s good right? Well it sounds right – but I think I’m just having trouble coming to grips with it. The stumbling block I’m having at the moment with custom controls is realising when to step out of the XAML and into fleshing out the real logic. Trouble is with custom controls most of the logic is related to the UI!

As an example – I recently wanted to create some simple graphics by having some spinning stars. So my first reaction was to just jump straight into XAML and code up a filled polygon path using the System.Windows.Shapes.Polygon.

<Polygon Points="30,0 35,20 55,25 35,30 30,50 25,30 5,25 25,20" Fill="Gold" Stroke="Black"
StrokeThickness="2"/> <Polygon Points="30,0 35,10 45,15 35,20 30,30 25,20 15,15 25,10" Fill="Gold" Stroke="Black"
StrokeThickness="2"> <Polygon.LayoutTransform> <RotateTransform Angle="45"/> </Polygon.LayoutTransform> </Polygon>

SimpleXAMLStar 

Ok – but that’s a pretty lame star… and I want lots of them right – so I should create a custom control inheriting from Shape? Whilst I’m at it add a property that lets me configure the number of points too.

public class Star : Shape
{
// Using a DependencyProperty as the backing store for NumberOfPoints.  
public static readonly DependencyProperty NumberOfPointsProperty = DependencyProperty.Register("NumberOfPoints", typeof(int), typeof(Shape), new UIPropertyMetadata(5)); public int NumberOfPoints { get { return (int)GetValue(NumberOfPointsProperty); } set { SetValue(NumberOfPointsProperty, value); } } protected override Geometry DefiningGeometry { get { return VisualContainer.CreateStarGeometry(NumberOfPoints); } } }

Creating the geometry for an n-pointed star could be done a heap of ways. Mine was the easiest to visualize but certainly not very elegant. Just create a triangle for each prong and keep rotating for as many as required. Then use the GetOutlinedPathGeometry to get the enclosing path.

public static Geometry CreateStarGeometry(int numberOfPoints)
{
GeometryGroup group = new GeometryGroup();
group.FillRule = FillRule.Nonzero;
Geometry triangle = PathGeometry.Parse("M 0,-30 L 10,10 -10,10 0,-30");
group.Children.Add(triangle);
double deltaAngle = 360 / numberOfPoints;
double currentAngle = 0;
for (int index = 1; index < numberOfPoints; index++)
{
currentAngle += deltaAngle;
triangle = triangle.CloneCurrentValue();
triangle.Transform = new RotateTransform(currentAngle, 0, 0);
group.Children.Add(triangle);
}
Geometry outlinePath = group.GetOutlinedPathGeometry();
return outlinePath;
}

Now I’ve got a Shape they’re much easier to re-use – so much so we may as well even add some animation.

<control:Star NumberOfPoints="5" Width="60" Height="60" Stroke="Black" Fill="Gold" StrokeThickness="2"
Opacity="0.5"> <control:Star.Triggers> <EventTrigger RoutedEvent="control:Star.MouseEnter"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard TargetProperty="Angle"> <DoubleAnimation Storyboard.TargetName="starRotation" From="0" To="72"
Duration="0:0:1" AccelerationRatio="0.3" DecelerationRatio="0.3"/> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.5" To="1.0"
Duration="0:0:0.5" AutoReverse="True"/> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </control:Star.Triggers> <control:Star.RenderTransform> <RotateTransform x:Name="starRotation" Angle ="0"/> </control:Star.RenderTransform> </control:Star> <control:Star NumberOfPoints="6" Width="60" Height="60" Stroke="Black" Fill="Orange"
StrokeThickness="2"/> <control:Star NumberOfPoints="7" Width="60" Height="60" Stroke="Black" Fill="Red"
StrokeThickness="2"/>

ShapeStars

So I think I’m getting the hang of it. But hold on, according to the book if I’m going to have heaps of these things then I shouldn’t be using Shapes – I should be using DrawingVisuals within a container.

public class VisualContainer : Canvas
{
private List<Visual> visuals = new List<Visual>();
public VisualContainer()
{
DrawingVisual star = CreateStar(5);
visuals.Add(star);
foreach (Visual visual in visuals)
{
AddVisualChild(visual);
AddLogicalChild(visual);
}
}
public static DrawingVisual CreateStar(int numberOfPoints)
{
DrawingVisual star = new DrawingVisual();
using (DrawingContext drawingContext = star.RenderOpen())
{
Geometry outlinePath = CreateStarGeometry(numberOfPoints);
drawingContext.DrawGeometry(Brushes.Gold, new Pen(Brushes.Black, 2), outlinePath);
}
return star;
}
public static Geometry CreateStarGeometry(int numberOfPoints)
{         ...  as above ...
}
protected override int VisualChildrenCount
{
get { return visuals.Count; }
}
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= visuals.Count)
throw new ArgumentOutOfRangeException("index");
return visuals[index];
}
public void AddStar()
{
Visual visual = CreateStar(5);
visuals.Add(visual);
PositionVisuals();
AddVisualChild(visual);
AddLogicalChild(visual);
}
private void PositionVisuals()
{
if (visuals.Count == 1)
((DrawingVisual)visuals[0]).Offset = new Vector(Width / 2, Height / 2);
else
{
double angle = 0;
double deltaAngle = Math.PI * 2 / visuals.Count;
double radius = Width / 2;
foreach (DrawingVisual visual in visuals)
{
visual.Offset = new Vector(Width / 2 + Math.Cos(angle) * radius, 
Height / 2 + Math.Sin(angle) * radius); angle += deltaAngle; } } } }

So that gives me a container that I can create heaps of stars in and only have one UIElement – the stars themselves are the apparently much lighter weight DrawingVisual instances. The cool thing with these is that Visual Hit Testing actually allows me to respond to click events on individual stars.

<control:VisualContainer Width="150" Height="150" MouseLeftButtonUp="VisualContainer_MouseLeftButtonUp" 
                                     RenderTransformOrigin="0.5,0.5"> <control:VisualContainer.RenderTransform> <RotateTransform x:Name="rotateTransform" Angle="0" /> </control:VisualContainer.RenderTransform> </control:VisualContainer> <Button HorizontalAlignment="Center">Rotate <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard TargetProperty="Angle"> <DoubleAnimation Storyboard.TargetName="rotateTransform" From="0" To="360"
                                                    Duration="0:0:5"/> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </Button.Triggers> </Button>

Of course I couldn’t resist rotating the whole thing too

RotatingDrawingVisuals