Search
On this page
Archives
RSS 2.0 Categories
Blogroll
Disclaimer
Powered by: newtelligence dasBlog 2.0.7226.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Send mail to the author(s) E-mail
Sharing Folders in Remote Desktop#

Today, I was struggling with getting some code deployed to a client's test server and called him to double-check FTP credentials and such.   He casually mentions having the ability to share your hard drive (and other devices) with a Remote Desktop session.  How many times would that have come in handy?!?!   Anyway, I dug into it further and it works! 

Check out Dan Mork's blog posting on the topic as he does a great job of walking you through the process.  (Make sure and check the comments as there is another really good tip there about saving your Remote Desktop connection with your configuration). 

Wednesday, October 17, 2007 7:52:28 PM (GMT Standard Time, UTC+00:00)
  Comments [0]  | 
Deep Dive: CSS for the ASP.NET Developer#

Thanks everyone for the comments and tips offered after I gave this presentation at Alabama Code Camp, as well as, at the Atlanta Cutting Edge .NET group last week.  I received several "so that's how it works" comments and that was exactly the point of this talk.

Here is the abstract of the presentation:

This will be a thorough discussion of all that is CSS.  Whether you know it as the necessary evil or the great enabler (that just hasn’t quite clicked for you yet), you should walk away with something valuable from this discussion.  I will begin with the basic box model and travel all the way to the holiest of grails (the no tables here, two and three column ASP.NET Master Page layout…yours to take home for free!).  Along the way, we’ll touch on some CSS Best Practices and gotchas in ASP.NET and take a look at the new CSS tools in Visual Studio 2008 (Orcas).

Get the download here.

Note:  The solution file provided is from Visual Studio 2008 (Orcas) Beta 2.  There is nothing .NET 3.5 specific (as most of it is HTML anyway).   

Update 04/01/08:  Updated the download to compile under Visual Studio 2008 RTM

Monday, October 08, 2007 6:38:05 PM (GMT Standard Time, UTC+00:00)
  Comments [2]  | 
Time for T : An Introduction to .NET Generics#

Finally able to grab a minute to post my code and slides from the Introduction to Generics presentation that I did this past weekend at the Alabama Code Camp at the University of Alabama. 

This is the abstract from the presentation:

With the release of the 2.0 version of the .NET Framework, Generics became first class citizens

in the Common Language Runtime.  Yet, many still shy away from using them because of perceived difficulty or other misconceptions.   This presentation will seek to dispel a few of these myths and offer a gentle introduction into using Generics on a daily basis.  Along the way, I’ll also demonstrate language enhancements in the .NET 3.5 runtime that lend themselves nicely to working with Generics. 

 

Get the download here.  

Note:  The code is compiled on Visual Studio 2008 (Orcas) Beta 2.  The only project in the solution that uses .NET 3.5 specific code is the Collections project.  This uses C# 3.5 Automatic Properties and Property Initializers. 

Monday, October 08, 2007 6:24:56 PM (GMT Standard Time, UTC+00:00)
  Comments [0]  | 
Visual Studio 2008 (Orcas) CSS tools#

I just returned from speaking at the Alabama Code Camp 5.0 in Birmingham.  One of my presentations was Deep Dive CSS for the ASP.NET Developer and I had hoped to spend some time on the tools in Orcas for working with Cascading Style Sheets.  Unfortunately, I did not get a chance to do that due to the time constraints, so I wanted to post some of my better links on that subject...

How to: Use the Apply Styles and Manage Styles Windows
http://msdn2.microsoft.com/en-us/library/bb398979(VS.90).aspx

            How to: Use the CSS Properties Window
           
http://msdn2.microsoft.com/en-us/library/bb398902(VS.90).aspx

How to: Use the Direct Style Application Toolbar
http://msdn2.microsoft.com/en-us/library/bb398977(VS.90).aspx

 

Monday, October 08, 2007 5:45:59 PM (GMT Standard Time, UTC+00:00)
  Comments [0]  | 
Generic Methods: Find Controls by Type#

Although this was originally part of my recent Generics presentation, I have received several requests to publish it separately. 

 

The reason that I created this originally was that I found myself often-times wanting a strongly-typed list of all the checkboxes / buttons / etc in my code-behind/beside pages.  There is the Page.FindControl(string id), but that only allows you to get a control by id and it returns a Control.  I wanted something more specific, yet generic enough to use as a Utility.  This was screaming for Generic Methods, so below is what I came up with.

 

I use this constantly and hope that someone else gets some mileage out of it.  If you have improvements, please post them.  For example usage, download the full Generics presentation. 

 

 

using System;

using System.Collections.Generic;

using System.Text;

using System.Text.RegularExpressions;

using System.Web.UI;

using System.Web.UI.WebControls;

 

namespace r2musings.Web.UI.WebControls

{

  public static class Utility

  {

    #region FindControlsByType

   

    /// <summary>

    ///   Returns a generic list of controls of a provided type starting at a

    ///    a provided base control (works recursively)

    ///    Example Usage: 

    ///       List<Button> buttonList = Utility.FindControlsByType<Button>(testPanel);

    ///       This would return a list of all Buttons contained anywhere within testPanel

    /// </summary>

    /// <typeparam name="T">Type of control</typeparam>

    /// <param name="parentControl">Base control to start search</param>

    /// <returns></returns>

    public static List<T> FindControlsByType<T>(Control parentControl) where T: System.Web.UI.Control

    {

      // new up our return list

      List<T> returnList = new List<T>();

 

      // loop through all controls and call internal recursion to

      //   add all controls of type T to the returnList

      foreach (Control childControl in parentControl.Controls)

      {

        InternalFindControlsByType<T>(childControl, returnList);

      }

     

      // return our List<T>

      return returnList;

    }

   

    #endregion

 

    #region Recursion Method

   

    /// <summary>

    ///   Should NOT call this method directly

    ///   This is for the internal recursion of FindControlsByType() 

    /// </summary>

    /// <typeparam name="T">Type of control</typeparam>

    /// <param name="parentControl">Base control to start search</param>

    /// <param name="returnList">List to add Controls</param>

    private static void InternalFindControlsByType<T>(Control parentControl, List<T> returnList) where T: System.Web.UI.Control

    {

      if (returnList == null)

        throw new ArgumentNullException("Null List passed to InternalFindControlsByType");

 

      if (parentControl is T)

      {

        returnList.Add((T) parentControl);

      }

 

      foreach (Control childControl in parentControl.Controls)

      {

        // call this method recursively to get all child controls

        InternalFindControlsByType(childControl, returnList);

      }

    }

   

    #endregion

  }

}

Monday, October 08, 2007 3:07:05 PM (GMT Standard Time, UTC+00:00)
  Comments [0]  | 
Google, Live, MSDN Search within Visual Studio 2008#

Since Matt Ranlett has now harassed me several times for removing the Google/MSDN macro from my blog, I decided to repost it.  I have added Live Search to the mix this time and I have tested all of the searches on Visual Studio 2008 Beta 2. 

 

The background on this was that I was spending a lot of time on Google and MSDN (aren't we all?) and was going back and forth from Visual Studio to the browser, so I decided to try and integrate my searches into Visual Studio.  The resultant experience is that you can highlight any text in Visual Studio and press your assigned keyboard shortcut and receive search results from your favorite search engines WITHIN the Visual Studio IDE.  It really comes in handy! 

 

In the code below, I have provided the URLs for searching against Google, Live, and MSDN.  It should be pretty obvious when you look at the macro what you would need to do to configure any other search engines.  Be sure to uncomment one (and only one) of the

url lines in the code when you setup each macro. 

 

For those not familiar with macros, here are the steps to add a macro in Visual Studio:

 

1)      Go to Tools | Macros | Macros IDE

2)      Once in the Macros IDE, you can create a new Module or you can just add this to the default “My Macros” module. 

3)      To add to My Macros, just right click on it in the Project Explorer and choose Add | Add New Item.  (if you don’t see the Project Explorer, try View | Project Explorer). 

4)      When the Add New Item Dialog shows up, select Code File and enter GoogleSearch and click OK.

5)      Paste the Code for GoogleSearch below into this file and save it.

     Make sure that you uncomment one of the url lines in the code. 

6)      Click Debug | Build and then close the Macros IDE.

7)      Once back in VS2005, click Tools | Customize and click the Keyboard button at the bottom of the Customize Dialog. 

8)      In the Show Commands Containing box, type “macros” and look for an entry that looks like this:  “Macros.MyMacros.GoogleSearch.GoogleSearch”.  (This could be different depending on where you created the macro). 

9)      Once you have the correct macro selected, go to the Press Shortcut Keys box and type whatever keys you want to fire the macro (I used Alt-G for Google, Alt-M for MSDN, Alt-L for Live). 

10)  Click the Assign button and then OK and then finally Close back on the Customize Dialog. 

11) Highlight any text in the IDE and fire off your shortcut key to test. 

12) Repeat for each search macro you want to setup. 

 

 

Here is the final code for the macro:

 

Imports EnvDTE

Imports System.Text.RegularExpressions

 

Public Module GoogleSearch

 

    Sub GoogleSearch()

        Dim url As String

        Dim selectedText As TextSelection = DTE.ActiveDocument.Selection()

 

        If Not String.IsNullOrEmpty(selectedText.Text) Then

            ' uncomment below for Google

            ' url = String.Format("www.google.com/search?q={0}", Regex.Replace(selectedText.Text, "\s{1,}", "+"))

            

            ' uncomment below for MSDN search

' url = String.Format("http://search.msdn.microsoft.com/search/Default.aspx?brand=msdn&query={0}", Regex.Replace(selectedText.Text, "\s{1,}", "+"))

 

' uncomment below for Live search

' url = String.Format("http://search.live.com/results.aspx?q={0}", Regex.Replace(selectedText.Text, "\s{1,}", "+"))

 

            DTE.ExecuteCommand("View.WebBrowser", url)

        Else

            MsgBox("No text selected.")

        End If

    End Sub

 

End Module

Monday, October 08, 2007 1:07:39 AM (GMT Standard Time, UTC+00:00)
  Comments [1]  | 
All content © 2008 , Rik Robinson