Archive for June, 2010

My latest user requirement with my on-going accordion control application: the user wanted the DIV containing the navigation, tree view, user control must always be in view.

So, here’s how I went about it, along with some of the pitfalls I found along the way.

Scrolling a Div
  1. var scrollId = 0;
  2.            var SCROLL_DELAY = 500;  // Acceptable delay for scrolling to stop
  3.            $(window).scroll(function() {
  4.                setTimeout('moveNavigationDiv()', SCROLL_DELAY);
  5.            });
  7.            // Moves the navigation div relataive to the page on scroll of the main window
  8.            function moveNavigationDiv() {
  9.                var now = new Date();
  10.                if (scrollId == 0 || (parseInt(parseInt(scrollId) + parseInt(SCROLL_DELAY)) < now.getTime())) {
  11.                    $("div[id$='navigation']").css({ 'position': 'relative' })
  12.                    $("div[id$='navigation']").animate({ "top": $("html").scrollTop() }, "1000", "linear");
  13.                    scrollId = now.getTime();
  14.                }
  15.            }

Firstly, I though this would be fairly straight forward. However, what I never realised was that the windows.onscroll event fires constantly as you are scrolling, not once as I thought. I suppose, when I think about it, this makes sense.

Because of this I had to try and pre-empt when the scrolling has stopped. For this I added a delay of 0.5 seconds.  If you don’t add this delay the control does move to the correct position, but it does it in a jerky motion, which doesn’t look very good.  Adding the delay allows the function to know what the final position is before it moves, making it a smooth movement.

To ensure the animating part of the  moveNavigationDiv()  only gets called once I’ve added a variable, scrollId,  which is updated in the if statement after a comparison with the SCROLL_DELAY and the current time.

I could have just used the CSS top: property to update the position of the div, but I had a little extra time and decided to use the JQuery animate instead to make it a bit easier on the eye.


When using Visual Studio namespaces as directory names in conjunction with Sub Version I came across the following error when i was trying to copy some files – this also happens when trying to delete or move.


This happens when the NTFS maximum path length of 255 characters is exceeded.  To resolve this problem you can map a network drive to the path you want to copy/move to, or delete by running the following dos command .

net use x: \\NameOfPc\share\FolderToCopyToOrDelete

NB. If you have admin access to the machine you can use the drive$ admin share.

Recently, when trying to publish from within Visual Studio 2008  to  three existing virtual directories, located under an existing site, I was repeatedly prompted for credentials.  This was something I had completed successfully earlier that day.   I tried just about every configuration in Visual Studio to resolve it.

In the end, I had to remove the existing virtual directories and re-publish to allow Visual Studio to create the virtual directories. It seems there is some sort of caching in the Front Page Server Extensions or something. Anyway, deleting them and re-publishing done the trick.

In debug mode, you can hover over an item and drill down through its properties using the ‘+’ button.

In VS2010, if you look at the right hand side you’ll find a pin which can be used to pin a particular field to that line of code.

This can be done on several lines of code so you can see what the values of fields are as you move through the code. A pin appears in the left hand margin.


After the debug is finished, if you hover over the pin it shows you the last value held in that field during the debug session.