Archive for category Tips

Connecting Visual Studio 2008 to TFS 2010

We have an environment that requires both Visual Studio 2008 and Visual Studio 2010. Our repository is in Team Foundation Server 2010, and that holds both 2008 and 2010 data.

VS 2010 was working fine, but I could not get VS 2008 to connect to TFS. Looking for a solution, I saw blogs that mentioned there should be a “Team” menu, and a “Connect to Team Foundation Server” option under the Tools menu, among other things. I didn’t have that. I had installed Team System 2010 Team Explorer, but it wasn’t working.

So I finally figured out (i.e. found an article) that I needed Visual Studio Team System 2008 Team Explorer to get it working.  Hopefully, I can save someone that “duh” moment by pointing it out.

Leave a comment

Putting a line break in an resx resource file

I had a Label control that I wanted to populate from a resource file, like so:

 <asp:Label ID="lblNote" runat="server" Text="<%$ Resources:AppInfo, Note%>" />

I needed to put a line break in the middle of the text.  To do that, I wanted to put a “<br>” in the text, but since the resource file complained when I tried to put greater than and less than symbols, I had to be sly about it. So in the AppInfo.resx file, I had this entry to add a line break:

   <data name="Note" xml:space="preserve">
    <value>Note: I want this to be the first line and &lt;br&gt;this to be the second.</value>
  </data>

Leave a comment

Sorting numeric value in a SQL VARCHAR column

We had some sorting issues with records coming back from our database. Nothing major, just something like this:

10, 100, 110, 120, 20, 30, 40, 50, 60, 70, 80, 90

That just ain’t right. What we wanted, of course, was this:

10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120

No problem, just add an ORDER BY clause and everything was fine. The only minor issue was that the column we were sorting was a VARCHAR, so adding a simple sort did nothing because as far as SQL Server was concerned, the first list was the correct way to sort a VARCHAR column. In order to override SQL Server’s method of sorting, I had to first cast the line number as an INT using the CAST function, and all was well:

     ORDER BY CAST(LineNumber AS INT) ASC

Leave a comment

_visibilityMode is null or not an object

We have an ASP.NET site that uses a plethora of Telerik controls – RadGrids, RadWindows, RadMenus, RadHamburgers – we have it all. In this case, our issue was with the RadTabStrip.

First off, it wasn’t a Telerik problem, it was an issue with our setup. We have Button controls that are global for the application, and six tabs to hold our various pages. Four of our six pages were working fine, but two of them were displaying this message when clicking on one of the application-wide buttons:

_visibilityMode is null or not an object

Cutting to the chase, the four tabs that worked had a RadWindowManager in each. So, I added one to the two tabs that were not working, and that did the trick:

<telerik:RadWindowManager ID=”RadWindowManager1″ ShowContentDuringLoad=”false” VisibleStatusbar=”false”  ReloadOnShow=”true” runat=”server”>
<windows>
<telerik:RadWindow ID=”myWindow” runat=”server” />
</windows>
</telerik:RadWindowManager>

Leave a comment

Service unavailable and the stopped application pool

Have you ever watched Jeff Dunham? Specifically, do you know Achmed the Dead Terrorist? His go-to line is “I’ll kill you!”, which he says… whenever. That is how I felt after dealing with the latest “Service unavailable” error on my local ASP.NET site.

We use WSPBuilder in our current environment to deploy our web application. Usually, it works fine, but I noticed that I was getting the dreaded “Service unavailable” message. Nothing in the Event Viewer helped me, and setting my browser settings to hide the “friendly error messages” did nothing, and I was about ready to turn to alcohol or violence – I was kind of on the fence to which one.

Then, during my searches on Bing, I found a forum post on Issociate, and this quote is what got my attention:

“When a website is stopped, its icon changes, and at the Websites level, you see a “Stopped” state. When an Application Pool is stopped, its icon also changes, and at the Application Pools level, you see a “Stopped” state.”

Application pools have a stopped state, too? I know what an web site looks like when it’s stopped, but I wasn’t sure about an application pool. So I opened IIS and looked into the Application Pools folder and saw this:

 Application Pool in IIS

Application Pool in IIS

If you click on the image you can see the stopped pools have a few pixels that are red, and the started pools has a few pixels that are green.

AAAAHHHHHH!!!!!!

I spent an hour deploying and redeploying and running IISRESET commands and (almost) throwing things at bystanders because of that half-dozen pixels? Who came up with that idea? How about a great big STOP sign on it? I know I’m creeping ever closer to 40, but come on, that’s is way too small an difference to just casually notice.

Leave a comment

FYI – refreshing a Silverlight XAP file

Something that will save you some hair and time, I know that I have very little of the former left. No, really – most of my hair left me in my twenties.

Anways, I was experimenting with a Silverlight application on my  hosting provider, and I would make a change, upload the XAP, and refresh the browser, but nothing would happen. I would close the browser tab and reopen it, and the change I just made wouldn’t appear.

That was because I needed to open a whole new browser, not a new tab. After I opened the new browser window, then my changes were displayed. I would have liked to have remembered that earlier in the morning and saved myself an hour, but this time the lesson has really sunk into my brain.

Leave a comment

Refreshing SQL Express database clears Session variables

I can’t vouch for the validity of this tip under all conditions, but while testing a Silverlight / ASP.NET  project, I queried the SQL Express database that was the main data source for my project, and when I went back to the ASP.NET page I was viewing, I received an “Object reference not set to an instance of an object error ” exception.

 Apparently, refreshing the database – in my case, the table that stored user information – will clear the Session variables. This is a very useful thing to know – it makes it easy to dig deep into the application, then clear the Session variables, and keep on trying to work in the application. It will let me know what the heck will happen if something really goes wrong.

Leave a comment