Friday, February 3, 2012

How To: Stop IIS7 from timing out while you’re debugging

Have you ever seen this before while you’re debugging an IIS7 application?

2012-01-19_1306

When you’re debugging code such as webpages, services, SharePoint event receivers, and SharePoint workflow handlers. You only have so long before you get a timeout message from IIS7 and you can no longer continue debugging. 

This is because IIS "pings" it’s Application Pools to see if they are still responsive.  You can either disable this or change the response time from the default 90 seconds.

Bring up IIS7 Manager

  1. Expand the Server in the left pane
  2. Click on Application Pools
  3. On each application pool, right click and choose Advanced Settings
  4. Under the Process Model, change Ping Enabled to False or change the Ping Maximum Response Time to a greater value

2012-02-03_0918

Cheers,

Justin

Friday, January 27, 2012

How To: Disable “Attach Security Warning” of Visual Studio

When you attach to a process, you sometimes get the message confirming whether you want to attach the process.

Warning

This happens for each process you are attaching.  ANNOYING!  This is how to disable it.

  1. Make sure Visual Studio 2010 is first shut down
  2. Click Start > Run... Type "regedit" <Enter>
  3. For VS 2010 navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger
    1. For VS 2008 navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger
  4. Set DisableAttachSecurityWarning to 1

Cheers,
Justin

Tuesday, November 22, 2011

Developing for a specific version of Silverlight

I recently ran into an issue where the version of Silverlight I had installed on my development environment didn’t match my end clients’ version of Silverlight.

I was running Silverlight v4.0.60831.0, they were running Silverlight v4.0.50401.0. (Who would of thought a 0.0.1 difference would of really mattered?)

Anyway I set out to accomplish two tasks

  1. Replicate the issue by uninstalling my version of Silverlight and installing there’s.
  2. Update my development environment so that I could fix the problem.

Here are my notes:

I using Control Panel to Uninstall Silverlight 4 from my test box.

I located an older version of Silverlight by using Microsoft’s “Microsoft® Silverlight™ Release History.” Which I installed on my test box.

I successfully reproduced the error.

I used Control Panel to Uninstall Silverlight 4 SDK from my development box.

I downloaded the SDK for the specific version I needed. Once again, using Microsoft’s “Microsoft® Silverlight™ Release History.” Which I installed on my development box.

I opened Visual Studio 2010, rebuilt the solution, deployed, the error was corrected.

That’s it. I hope it helps someone.

Wednesday, July 6, 2011

Making the selected time of a RadTimePicker scroll to top.

I rely heavily on Telerik’s ASP.NET AJAX tools. Recently I had an issue with the RadTimePicker when we attempted to put it in a scrolling container. Once in the container could scroll we wanted the selected time to be the first item when the picker’s TimeView appeared.

Out of the box this behavior is not possible, so I had to find a solution. After a lot of research, and some help from Telerik, I would like to share my solution:

To allow for scrolling you have to apply the proper styles

   1: <style type="text/css">
   2:     #<%= StartTime.ClientID %>_timeView_wrapper {
   3:             overflow:auto;
   4:             width:83px;
   5:             height:200px;
   6:     }
   7: </style>

The RadTimePicker

   1: <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker"
   2:     Width="78px">
   3:     <dateinput id="DateInput3" runat="server" emptymessagestyle-cssclass="riError" emptymessage=" " />
   4:     <timepopupbutton visible="false" />
   5:     <timeview id="TimeView1" runat="server" columns="1" showheader="false" starttime="00:00"
   6:         endtime="23:59" interval="00:30" />                                                        
   7:     <ClientEvents OnPopupOpening="InitializePopup" />
   8:     <ShowAnimation Duration="0" />
   9:     <HideAnimation Duration="0" />
  10: </telerik:RadTimePicker>

Lastly, I used a bit of JavaScript and jQuery to apply the “scroll to top” behavior.

   1: <script type="text/javascript">
   2:     function InitializePopup(sender, eventArgs) {
   3:         var htmlPopUp = eventArgs.get_popupControl().get_element();
   4:         var jQueryPopUp = $(htmlPopUp);
   5:  
   6:         setTimeout(
   7:         function() {
   8:             var selectedTime = jQueryPopUp.find(".rcSelected");
   9:  
  10:             if (selectedTime.length > 0) {                    
  11:                 selectedTime.get(0).scrollIntoView(true);
  12:             }
  13:         }, 150);
  14:     }        
  15: </script>

You’ll notice I set a delay on line 6. This is because the TimeView html object needs a bit of time to render before we preform the find. Without this delay, the find returns an empty collection, and the scroll will not work.

I hope this helps someone.

Cheers.

Wednesday, June 22, 2011

Grok talk on NuGet 6/22/2011 1800 EST

I will be giving a grok talk about “NuGet” (the Visual Studio 2010 extension) to the Dayton .NET Developers Group. If you’re in area, I invite you to come down. (Don’t forget to point and laugh Winking smile)

Here is my slide deck.

When: June 22, 2011 at 6pm EST

Where: 711 East Monument Avenue, Suite 101 in downtown Dayton, OH

Wednesday, May 18, 2011

jQuery Boxy content will not display / show

Every so often I’ve used the jQuery plugin called “Boxy

Today I ran into an issue: The content I gave boxy would not display / show on the page.

Here was my incorrect code:

   1: new Boxy("Justin Kohnen is the best programmer ever!", 
   2: { 
   3:     closeText: "close"
   4:     , title: "Shout out."
   5:     , unloadOnHide: true
   6: });

After reading the fantastic manual I found: (underline added for emphasis)

The content passed to the constructor can be any valid parameter to jQuery's $() function - a DOM element, an HTML fragment or another jQuery object. Whatever is provided will be set to display: block and have the class boxy-content added prior to its insertion within the dialog.

The key here was raw text is not a “valid parameter to jQuery’s $() function.”

So my fix is simply to wrap my text in a <p> tag. Making it an HTML fragment

Here is the corrected code:

   1: new Boxy("<p>Justin Kohnen is the best programmer ever!</p>", 
   2: { 
   3:     closeText: "close"
   4:     , title: "Shout out."
   5:     , unloadOnHide: true
   6: });

Simple, but silly problem.

I hope this helps someone.

Cheers.

Tuesday, April 12, 2011

Installing and Uninstalling a Windows Service from the Command Line

I develop a windows service every now and then. I always have to dig up the install and uninstall commands. I figured I would post it for all.

Install

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil /LogToConsole=true "<path_to_service_exe>"

Uninstall

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil /u "<path_to_service_exe>"

Make sure to replace <path_to_service_exe> with what works for you.

If you’re on Win7 or Win2008 Server, you’ll need to start your Command Prompt as an administrator.

Cheers.