Archive for January, 2012

Import & Export break points in Visual Studio 2010

“This will change your life”

… reassured my colleague Mr Carmicheal.

Basically it’s possible in VS2010 (Pro, Premium or Ultimate) to Import & Export sets of break points for projects, handy if you have pieces of code you often have to step through for some reason or another.

The original article can be found here: http://msdn.microsoft.com/en-us/library/dd293657.aspx

In case that page goes AWOL as MSDN pages often do, this is what it said;

To export all breakpoints that match the current search criteria

  1. In the Breakpoints window toolbar, click the Export all breakpoints matching current search criteria icon.

    The Save As dialog box appears.

  2. In the Save As dialog box, type a name in the File name box.

    This is the name of the XML file that will contain the exported breakpoints.

  3. Note the folder path shown at the top of the dialog box. To save the XML file to a different location, change the folder path shown in that box, or click Browse Folders to browse for a new location.
  4. Click Save.

To export selected breakpoints

  1. In the Breakpoints window, select the breakpoints you want to export.

    To select multiple breakpoints, hold down the CTRL key and click additional breakpoints.

  2. Right-click in the breakpoints list, and choose Export selected.

    The Save As dialog box appears.

  3. In the Save As dialog box, type a name in the File name box.

    This is the name of the XML file that will contain the exported breakpoints.

  4. The folder path is shown at the top of the dialog box. To save the XML file to a different location, change the folder path shown in that box, or click Browse Folders to browse for a new location.
  5. Click Save.

To import breakpoints

  1. In the Breakpoints window toolbar, click the Import breakpoints from a file icon.

    The Open dialog box appears.

  2. In the Open dialog box, browse to the directory where your file is located, and then type the file name or select the file from the file list.
  3. Click OK.

1 Comment

Quick & Tiny jQuery Drop Down Menus

Note: this has been superseded by the recursive drop down menu script.

The Code:

$(document).ready(function () { // Shawsons' Teeny-Tiny Drop Downs!
    $('.drop-down-menu li ul').hide().mouseleave(function () {
        $(this).hide();
    });
    $('.drop-down-menu>li>a').mouseenter(function () {
        $('ul', $(this).parent().parent()).hide();
        $('ul', $(this).parent()).show();
    }).mouseleave(function (o) {
        if ($(this).parent().has($(o.relatedTarget)).length < 1) {
            $('ul', $(this).parent()).hide();
        }
    });
});

The Markup:

<ul class="drop-down-menu">
        <li>Available Actions : </li>
        <li><a href="">Menu 1</a>
            <ul>
                <li><a href="a.htm">a</a></li>
                <li><a href="b.htm">b</a></li>
                <li><a href="c.htm">c</a></li>
            </ul>
        </li>
        <li><a href="">Menu 2</a>
            <ul>
                <li><a href="d.htm">d</a></li>
                <li><a href="e.htm">e</a></li>
                <li><a href="f.htm">f</a></li>
            </ul>
        </li>
    </ul>

Some CSS:

.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu li a { padding:8px; }
.drop-down-menu li ul  
{
    position:absolute; 
    background-color:#fff; 
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px; 
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul li:hover { background-color:#F68833; }

2 Comments

Conditional logic in ListView ItemTemplate with DataBinder.Eval

Embarrasingly simple, but something I always seem to forget, and then never blog! I needed to show a tick in a repeater when a row value was -1: Simple! In MVC, with the razor syntax and strongly typed views I’ve grown to love, this is a pinch o’ the proverbial piss- In WebForms rreviously I often resort to setting up an ItemDataBound event handler which hides or shows an image, but to be honest I could not be bothered- this seems such overkill for something as simple as this. Anyway, after some faffing I reminded myself the easiest method is to use an ‘in-line if’ in the ItemTemplate, like so;

<ItemTemplate>
        <tr>
            <td><%# Eval("CarReg") %></td>
            ...
            <td>
                <%# (DataBinder.Eval(Container.DataItem, "NewRepeat") != null && DataBinder.Eval(Container.DataItem, "NewRepeat").Equals(-1) ? "<img src=\"../images/tick.png\" alt=\"tick\" />" : "<img src=\"../images/cross.png\" alt=\"cross\" /")%>
            </td>

No Comments