Friday, 22 February 2008

Vista SP1

I installed Vista SP1 on my PC at home earlier this week. It took an hour to install.  I didn't notice any obvious improvements or changes at first. Perhaps it boots a bit faster now, but that kind of thing is very subjective unless you have bothered to time it beforehand.

However, yesterday I found the first real improvement. I had been having problems saving my game in Football Manager 2006. It would take several minutes to save the 200Mb file and would regularly fail to save. Sometimes I would have to attempt to save the game 5 times in a row before it would work. The good news is, that since installing Vista SP1, I have had no errors saving, and the saving is much, much faster (less than 30 seconds now). Its always nice to see some kind of tangible improvement after installing a service pack.

Friday, 15 February 2008

There is no Spoon

And now since I'm in the mood for writing some XAML, here's something really silly. My 2 year old son always throws his spoon in the bin along with his empty yoghurt pot, which has meant we are regularly buying more spoons. So here is a really useful XAML "No Spoons" sign for the bin. I 'designed' the spoon icon in Blend, and then used a transform group to get it into the right place.

Here's the code:

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Canvas Canvas.Left="20" Canvas.Top="20">
    <Rectangle Width="180" Height="200" Fill="White" RadiusX="5" RadiusY="5" />      
    <Canvas>      
      <Path Fill="#FF000000" Stroke="#FF000000" Data="M438.66803,130.33333 C421.33499,120.1762 422.00165,96.176278 422.00165,96.176278 427.00179,58.843133 452.66745,63.333794 460.00086,94.666778 461.00102,116.50951 455.41396,118.92027 446.00105,130.00013 L450.41981,208.7423 C446.16375,210.81869 441.91328,210.84422 437.66793,209 z" StrokeThickness="2"/>      
      <Canvas.RenderTransform>      
      <TransformGroup>      
      <TranslateTransform X="-350" Y="-60" />      
      <RotateTransform Angle="-45" CenterX="100" CenterY="100" />      
      <ScaleTransform ScaleX="0.75" ScaleY="0.75" />      
      <TranslateTransform X="25" Y="15" />      
      </TransformGroup>      
      </Canvas.RenderTransform>      
      </Canvas> 
      <Canvas Canvas.Left="10" Canvas.Top="10">     
      <Ellipse Height="150" Width="150" Stroke="Red" StrokeThickness="15" />      
      <Line StrokeThickness="15" Stroke="Red" X1="25" Y1="125" X2="125" Y2="25" />      
    </Canvas> 
    <TextBlock Canvas.Top="160" Canvas.Left="30" Text="No Spoons" FontFamily="Arial Black" Foreground="Black" FontSize="20"  />     
  </Canvas>      
</Canvas>

And here's what it looks like:

image

XAML Star Rating

And here's another quick XAML file, this time for star ratings like you see on many websites. By the way, I've been fighting with blogger to try to display code nicely, but it seems to insist on truncating it, and ignoring any styling I try to put on it. I'm hoping to move to another blog platform before too long, but if anyone knows of a simple way to make blogger display formatted code, please let me know.

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Canvas Canvas.Left="20" Canvas.Top="20">
    <Rectangle Width="200" Height="50" Fill="White" RadiusX="5" RadiusY="5" />
    <Canvas Canvas.Left="5" Canvas.Top="20">
      <Path Stroke="#000080" Fill="#FFFF00" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="M 0,0 l 10,0 l 5,-10 l 5,10 l 10,0 l -7,10 l 2,10 l -10,-5 l -10,5 l 2,-10 Z" />
    </Canvas> 
    <Canvas Canvas.Left="45" Canvas.Top="20">
      <Path Stroke="#000080" Fill="#FFFF00" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="M 0,0 l 10,0 l 5,-10 l 5,10 l 10,0 l -7,10 l 2,10 l -10,-5 l -10,5 l 2,-10 Z" />
    </Canvas>
    <Canvas Canvas.Left="85" Canvas.Top="20">
      <Path Stroke="#000080" Fill="#FFFF00" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="M 0,0 l 10,0 l 5,-10 l 5,10 l 10,0 l -7,10 l 2,10 l -10,-5 l -10,5 l 2,-10 Z" />
    </Canvas>
    <Canvas Canvas.Left="125" Canvas.Top="20">
      <Path Stroke="#808080" Fill="#C0C0C0" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="M 0,0 l 10,0 l 5,-10 l 5,10 l 10,0 l -7,10 l 2,10 l -10,-5 l -10,5 l 2,-10 Z" />
    </Canvas>
    <Canvas Canvas.Left="165" Canvas.Top="20">
      <Path Stroke="#808080" Fill="#C0C0C0" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="M 0,0 l 10,0 l 5,-10 l 5,10 l 10,0 l -7,10 l 2,10 l -10,-5 l -10,5 l 2,-10 Z" />
    </Canvas>
  </Canvas>
</Canvas>

And this is what it looks like:

XAML Star Rating

XAML RSS Icon

I haven't had the time to blog much recently, but I thought I would just share a quick RSS Icon I made in XAML recently:

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" >
  <Canvas Canvas.Left="20" Canvas.Top="20">
    <Rectangle Width="50" Height="50" Fill="Orange" RadiusX="5" RadiusY="5" />
    <Canvas Canvas.Left="-1" Canvas.Top="1">
      <Ellipse Width="10" Height="10" Fill="White" Canvas.Left="10" Canvas.Top="30" />
      <Path Stroke="White" StrokeThickness="5" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Data="M 15,20 a 15,15 90 0 1 15,15" />
      <Path Stroke="White" StrokeThickness="5" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Data="M 15,10 a 25,25 90 0 1 25,25" />
    </Canvas>
  </Canvas>
</Canvas>

Here's what it looks like:

XAML RSS Icon

Obviously if you are a graphic designer you could give it some cool gradient effects to make it look 3D.