Thursday, February 10, 2011

jsFiddle – Not just an editor

I got a sudden urge to gain some reputation on Stack Overflow and went looking for questions with a bounty when I found this particularly interesting one -  Loosing hover when animating with jQuery (without moving mouse).
The author of the question had made a fiddle so there was no effort in trying to reproduce the problem which is often a time consuming business.
I made my own fork and started hacking away. After a while I came up with a solution and saved my fork. The solution might not be the prettiest you seen but what’s pretty is how jsFiddle worked as a playground that everyone can use with only a browser. Combined with Stack Overflow this is pretty powerful stuff for getting help from the community.
In the time of writing I haven’t got any feedback on my answer but I’m happy nevertheless for finding such a useful tool.

How to find nested controls in ASP.Net Webforms

I made a little helper class to find all controls of a certain type on a page or within any control that can contain other controls.

Please use it with care since it could be quite heavy on a page with thousands of control. Do not pass the entire page unless absolutely necessary.

/// <summary>
/// Finds all controls of type T stores them in FoundControls
/// </summary>
/// <typeparam name="T"></typeparam>
private class ControlFinder<T> where T : Control 
    private readonly List<T> _foundControls = new List<T>();
    public IEnumerable<T> FoundControls
        get { return _foundControls; }
    public void FindChildControlsRecursive(Control control)
        foreach (Control childControl in control.Controls)
            if (childControl.GetType() == typeof(T))

Wednesday, February 9, 2011

How to expand/increase the size of an existing virtual hard disk in VMware Player

I guess I was a bit stingy when I initially set the size of my virtual hard disk and had to pay for that later on. But sometimes it’s impossible to foresee a future need.
Don’t you worry now! It’s a piece of cake to expand the virtual hard disk at a later point in time. Just follow these steps:
  1. Make sure to backup your virtual machine before proceeding. Just incase!
  2. From VWware Player (I’m using version 3.1.3), select the virtual machine you want to expand and click Edit virtual machine settings.
  3. Choose the device Hard Disk (IDE), click the Utilities button and choose Expand….
  4. Enter the new maximum size in GB and click Expand. This will take a moment.


     Your virtual hard disk is now expanded but the guest operating system is still not aware of this.
  5. Start your virtual machine.
  6. If your guest operating system is Windows Server 2008, Windows Vista or Windows 7 you could expand the volume in Disk Manager. But if your guest operating system is Windows XP like mine was you have to use a third party utility. I used EASEUS Partition Master which has a free edition for home users.
  7. Download, install and start EASEUS Partition Master – Home Edition.
  8. Choose the partition you want to expand and click Resize/Move Partition. Move the slider to the desired size (probably all the way to the right) and click OK.

  9. Click Apply and EASEUS applies the new size to the volume.
  10. You can now stop using CCleaner every five minutes Smile

Wednesday, February 2, 2011

Forcing UI redraw/repaint in IE7

A while ago I had a nasty problem with an element that got on top of other elements and was not clickable anymore. This happened in Internet Explorer 7 when I changed the position from absolute to static during horizontal scrolling.
I tried several techniques for redrawing the element but none of them were successful until I stumbled upon this method:
var nastyElement = $("#elementId");
nastyElement.css("display", "none");
nastyElement[0].offsetHeight; // redraw
nastyElement.css("display", "block");
Credits go to vasko who wrote about this on