Wednesday, February 22, 2012

XAML Control to Control Binding

I have a control that I want to enable/disable based on a checkbox.  I ended up using a binding with ElementName and Path:

x:Name="Enabler" />

IsEnabled="{Binding ElementName=Enabler,Path=IsChecked}" />

Tuesday, February 21, 2012

Add a ToolTip in Code

Today I had to create many controls in code (not XAML).  I wanted to add tooltips as I created them:
void AddManyControls()
    var control = new Control();
    ToolTip toolTip = new ToolTip 
        Content = "ToolTip Content"

    ToolTipService.SetToolTip(control, toolTip); 

Monday, February 20, 2012

ASP.NET Restarting On Every Request

It turns out I was writing some temporary files to a subfolder in the “bin” (or application) directory.  The server saw that there were changes, and (correctly) decided a restart was required.

Here are some other options on why the server (both WebDev and IIS/IISExpress) may be restarting/recycling too much:

Sunday, February 19, 2012

Reload fstab Without a Reboot

Found this nice post:

After you edit the /etc/fstab, use mount -a.

Add a VirtualBox Disk to Linux

I've started to play around with linux in VirtualBox.  I'm going to start posting things I find useful, since I'm a Windows man by trade.  This is the first:

I was adding a new VirtualBox disk for my data (so I can keep the OS/programs seperate from my personal stuff).  Here's how I did it.
  1. Create the disk in the VirtualBox GUI.
  2. Format the disk in Linux: 
    1. Find the disk (probably /dev/sdb or some such path): fdisk -l
    2. Format the disk: fdisk /dev/sdb
  3. Edit the fstab to mount the disk where you want it:
    • /dev/sdb /home/david                                ext2    defaults        0 0
    • Note that I mounted to my home directory, so I need to move my existing home dir (which has all the crappy Windows type folders) and then create it again so that the mount can find the folder.
  4. Remount: mount -a
  5. EDIT 2012-02-19: Copy all of the .* files from the old user dir to the new one.
  6. Done! (I think, I'm new at this)