Friday, June 12, 2009

Mounting a hard drive on my laptop battery

Mounting a hard drive on my laptop


I got a portable hard drive and ran into an issue of being afraid toEV087AA move my laptop while it was running.  I also almost had it drop while giving a presentation which would have been a very bad thing as it was running 2 virtual machines at the time.  This had to be fixed ASAP.


With about $4 worth of 3M removable poster mounting Velcro, I was able to mount it and remove it if I chose to.  Here are some pictures.


Laptop HackingLaptop HackingLaptop Hacking


laptop battery


Coming from an ASP.Net and WinForm background, XAML seems like it would be fairly easy to get a handle on but I’m having to take a bit more cautious approach to it.


Win32 Button From DrunktenderXAML is XML as is HTML and kind of has some CSS like attributes but at the same time they are different.  For thisEX942AA

reason, I’m taking baby steps to port my old bartending application over.  The first thing I’m going to attack is the button.  Here is the button from the Win32 application.  Yes, I know it looks WPF like but that is just chrome my friend and myself helped paint onto a default Win32 button.


Since I’m a developer, I’ll be using Visual Studio 2008 but Expression Blend will do this far better.


To recreate this in WPF, I have to do a few things to do and a new requirement.  I need an image / XAML glass, text at the bottom, and the new requirement is to have it scale.  With a XAML glass image, I can change the liquid color dynamically along with resize it with no fidelity lose since the image is vector.


WPF Button The current button (on the right), I have isn’t fully worked out as it can’t import XAML into 337607-003 it but that is just a small issue.  I’ve done this in Silverlight so I know I can do it.


This seems pretty straight forward on how to get everything to work correctly, but let me show you how I did this.  Right now this is pure XAML, no C# or VB.Net exists yet.


For the XAML, I used a Grid, Label, Image and some RowDefinitions to get this worked out.  I can do this since in XAML, I can nest objects within one another’s container.  This lets me put an image / placeholder for XAML and a label within the button so I can extend out the button extremely easily.







  1. <Button Name="bigButton" Height="250" Width="250">  

  2.     <Grid>  

  3.         <Grid.RowDefinitions>  

  4.             <RowDefinition Height="*"/>  

  5.             <RowDefinition Height="30"/>  

  6.         </Grid.RowDefinitions>  

  7.         <Image Grid.Row="0" Name="image1"    

  8.             Stretch="UniformToFill" Source="Koala.jpg"    

  9.             StretchDirection="Both" VerticalAlignment="Center"    

  10.             HorizontalAlignment="Center" Margin="10" />  

  11.         <Label Grid.Row="1" HorizontalAlignment="Center"    

  12.             FontSize="20" Padding="0">test</Label>  

  13.     </Grid>  

  14. </Button>  



<Button Name="bigButton" Height="250" Width="250">   <Grid>    <Grid.RowDefinitions>     <RowDefinition Height="*"/>     <RowDefinition Height="30"/>    </Grid.RowDefinitions>    <Image Grid.Row="0" Name="image1"      Stretch="UniformToFill" Source="Koala.jpg"      StretchDirection="Both" VerticalAlignment="Center"      HorizontalAlignment="Center" Margin="10" />    <Label Grid.Row="1" HorizontalAlignment="Center"      FontSize="20" Padding="0">test</Label>   </Grid>  </Button>


WPF Wire FrameWhat this produces (I removed the koala image) PB991A is a grid system that looks like this.  Breaking down the XAML, we see I have 2 rows I defined in the grid.  I have one that is floating and the other is a fixed height of 30.  Then I can say Grid.Row="X" to the element I want to attach to this Row.  In this instance I made the Label to stay at 30 and the Image to take up the rest of the space.  When the button grows or shrinks, the image will be effected, not the text.


Other things I had to do was tweak a bunch of settings on the Image.  I set Stretch to UniformToFill and ScretchDirection to Both along with centering both the vertical and horizontal alignment so when the image grows, it stays centered and in proper proportion.


Up next is dynamically loading and setting a property (or properties) from that XAML!  And PB994A with Expression Blend 3.0, my designer can hand me Illustrator files and I can directly import them in!

No comments:

Post a Comment