Thursday, December 17, 2009

VS 2008 SP1 Annoyance

I just realized that when I installed VS 2008 on my new machine, I incorrectly decided not to install Visual Basic. So this morning, I went into the VS 2008 Setup to add Visual Basic and was presented with a nice and cryptic little error message that my installation path was not valid. After a quick Google search, I found this little gem of a MS Connect posting. It appears that after you install VS 2008 SP1, you cannot update the installed features of VS 2008 without first uninstalling and re-installing VS 2008 SP1. Based on the comments in that post, this is not sitting well with a lot of folks. I can sort of see why that would be… because then I would have one set of features installed and updated with SP1 fixes and then I would go an install another set of features that had not had the SP1 updates applied to them. But come on, at least allow me to install the changes and let me know that I need to reinstall SP1… That would have been nice instead of the message that I did get. Anyhow, about 30 minutes later, I have uninstalled VS 2008 SP1, added Visual Basic and reinstalled VS 2008 SP1.

I am hopeful that this will not be an issue with VS2010. Plus I will just always install VB and C# by default from now on…

Monday, December 14, 2009

Setting the Default Browser for a Visual Studio web site

Since I never seem to be able to remember how to do this when I re-install Visual Studio. I am putting this up here so I can easily find it.

  1. Right click on the Web Project/Application
  2. Chose Browse With…
  3. Select the browser settings that you desire in the dialog as shown below.

image

Thursday, November 5, 2009

Visio Viewer 2007 and Windows 7

I ran into an issue today where I was unable to get the Visio Viewer 2007 working on my Windows 7 (64bit) installation. After some digging around on Google, I discovered this post that outlines the install the steps below. I added the direct links to the downloads for ease of use.

  1. Install Visio Viewer 2007
  2. Install Visio Viewer 2007 Service Pack 2 (SP2)
  3. Re-install Security Update for Microsoft Office Visio Viewer 2007 (KB973709)

After I followed these steps my Visio Viewer 2007 started working correctly on Windows 7.

Friday, October 23, 2009

Ninite – Application Installer

Just ran across this cool application installer tool called Ninite. (Thanks to a tweet from Scott Hanselman) This tool will download and install applications for you. This should make getting your machine setup after a repave much easier. In looking at the categories and software currently being offered, this appears to cover about 80% of the applications that I want/need to install.

The following categories are currently being offered:

  • Web Browsers
  • Messaging
  • Media
  • Imaging
  • Documents
  • Anti-Virus
  • Runtimes
  • File Sharing
  • Other
  • Utilities
  • Compression
  • Developer Tools

I would encourage you to go check out the list and see what essential applications you use are listed. And if you do not see one of your applications listed, there is even a form at the bottom of the list where you can request that your application be added.

With a lot of folks moving to Windows 7 now that it is officially released, this tool looks to be a great time saver. I know I trying it out when I move from the Windows 7 RC to RTM in the near future.

Friday, October 16, 2009

Video on the Web

Found this really good overview of Video on the Web.  Being that my only real use/knowledge of video on the web is YouTube, I found this information to be very enlightening and useful. I currently work for a media company and should probably be more familiar with the use of video on the web, but I must confess that I am not. So reading this was hopefully the starting point for me to broaden my understanding of video on the web.

Thursday, October 8, 2009

The power in reading source code

Scott Hanselman has been posting a series for a while now called the Weekly Source Code where he is pointing folks to good source code to check out. Scott makes the following comment at the end of this post “Nothing makes me realize what a crap programmer I am like reading a good programmer's code.” And I have to agree with him completely. Unless you are looking at someone else’s code you will never realize that what you believe to be great code, maybe really is not. It is not until we compare what we have done with someone else, that we realize

I have always liked the analogy of programming being art and therefore a programmer is an artist. Every programmer brings their own style and flair to the design and creating of code. This is evident when you give 5 different programmers the same problem to solve. They will most likely all arrive at the same solution, but how they got there will be completely different. In my opinion that is a very good thing, you want to have diversity, not robots! And a great way to learn and grow your programming skills is by looking at the code that other people have written. You may be surprised at some of the things that you see and what you can learn. Plus I enjoying getting some insight into how a programmer approached a solution to a problem by looking at the code they employed.

So I strongly encourage all developers to make it a habit of checking out source code. There are lots of places to get source code from… other projects where you work, it can be from open source projects, third-party tools you have licensed, etc. Just go get some and start reading, learning and maybe even be inspired!

Thursday, October 1, 2009

Sharpening the Saw – Project Euler

I recently ran across the Project Euler site. Here is the synopsis from the site’s About page.

“Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.”

If you are unfamiliar with the term Sharpening the Saw it is from Stephen Covey’s The 7 Habits of Highly Effective People. In a nutshell it is the practice of continually improving your skills and your knowledge – taking time off from the daily grind and getting motivation and encouragement. It could be reading a book, attending a conference, etc. But just recognizing that you need a break once in a while and that you need to improve your continually.

So I started working through the 250+ Project Euler problems this week. I have completed the first few and already I have learned a lot about some of the cooler LINQ extension methods in C# as well as math in general. Mathematics has always been a struggle for me and I think a lot of it has been that I never truly applied myself as well as I could have when I was in school. So these problems are not only challenging me from a programming perspective, but they are also providing me an opportunity to improve my overall Mathematics knowledge.

It may take me a very long time to complete all the problems that are out there, but I am excited and looking forward the challenge. Also, I think there is a great opportunity here to use these programming challenges as a way to learn another programming language as well. As you will see on the Project Euler site, there is a wide variety of languages that other people are using.

Thursday, September 24, 2009

Web Platform Installer

Microsoft has released an update to the Web Platform Installer application. If you are not familiar with this little tool, you need to check it out. Here is the overview from the product’s home page.

“The Microsoft Web Platform Installer 2.0 (Web PI) is a free tool that makes getting the latest components of the Microsoft Web Platform, including Internet Information Services (IIS), SQL Server Express, .NET Framework and Visual Web Developer easy. The Web PI also makes it easy to install and run the most popular free web applications for blogging, content management and more with the built-in Windows Web Application Gallery.”

Scott Guthrie also has a nice blog post about what it can do for you. When I upgraded to Windows 7, I used the Web Platform Installer to install SQL Server Express 2008 and configure my Web Server and IIS settings. It made the configuration very simple and straight forward. I highly recommend the use of this great application.

Friday, September 18, 2009

IIS Modules and Handlers - One web.config for Both IIS 6 and IIS 7

I recently started running my development projects on IIS 7 when I upgraded to Windows 7. I initially created a separate copy of the web.config with modified settings for the <httpHandlers> and <httpModules> sections as these need to move with IIS 7. In IIS 6 the <httpHandlers> and <httpModules> sections are located within the <system.web> section of the web.config file. However, with IIS 7 they need to be configured in the <system.webServer> section. So I did just that, I moved and modified those sections so that I could run in an Integrated App Pool. Please read How to Take Advantage of the IIS 7.0 Integrated Pipeline for more details on the differences between running in Integrated versus Classic mode.

However, I was recently looking into the ELMAH (Error Logging Modules and Handlers) Project and noticed in their demo application that they had thoroughly documented the IIS 6 and IIS 7 settings in their web.config and found this cool little comment:

<!--
    The <system.webServer> section is required for running ELMAH under Internet
    Information Services 7.0. It is not necessary for previous version of IIS.
    In general, it would be best to include it for all .NET Framework 2.0 and above
    configurations in order to have a more portable solution between various
    versions of IIS.

    IIS 5.x, IIS 6 require the modules and handlers to be declared in <system.web>
    whereas IIS 7 needs them declared here and complains if they are in fact
    declared in <system.web>. Fortunately, the
    <validation validateIntegratedModeConfiguration="false" /> entry tells IIS 7
    not to worry about the modules and handlers declared in <system.web>.

    If you only ever want to use IIS 7, then do the following:
    1. Remove handlers and modules from <system.web>
    2. Remove the <validation validateIntegratedModeConfiguration="false" /> element
-->

So I did a little research (Google search) on validateIntegratedModeConfiguration and found this MSDN Article on ValidationSection Class [IIS 7] that explains how this works.

Therefore, since myself and the other developers are still running a mixture of IIS 5.1 (Windows XP) and IIS 7 (Windows 7) I am going to update our shared web.config so that we no longer need to maintain separate versions of the web.config file for the different IIS versions, but can use one common one. This will make things a lot simpler. Then once we are all running on IIS 7, as well as all of our downstream environments, we can turn this off and remove the <httpHandlers> and <httpModules> entries in the <system.web> section.

Browser Chooser

Browser Chooser is a great little app that I ran across the other day.

Description from the Project Home Page on Codeplex:

“Browser Chooser is a small tool acting as the default browser allowing you to choose what browser to open the link in. It gives you the flexibility to choose what browser to use for any given task. It is developed in VB.Net and geared towards Windows Vista and Windows 7.”

I run Google Chrome as my default browser, but end up getting a lot of emails with links to content stored on SharePoint sites. My pain point before was that if the link was to a Word or Visio document, I cannot open it directly in Chrome and I would need to copy/paste the link into IE or Firefox. But now with Browser Chooser, I can select the browser to use when opening a link. Awesome!

Many thanks to Jan Ole Peek for creating this must have utility.

Go download it: http://browserchooser.codeplex.com/

Thursday, September 17, 2009

Are you a thriving developer?

I recently came across a great website Thrive For Developers. This is a Microsoft sponsored site that provides great resources to Advance Your Career, Enhance Your Skills or Connect With Your Community. We all know that times are tough, the economy is down and the job market is tough. Whether you are looking for a new career/position or to enhance your current one, there is a lot of great content that you should check out here. I am currently listening to the Driving Your Career – Soft Skills to Move You Forward series and have been learning a lot.

I would highly encourage anyone who is concerned about advancing their career (and that really should be everyone), to check this site out and take advantage of the many great resources that are available.

Tuesday, September 8, 2009

Filtering with LINQ

I recently refactored the display of data on a web page (in a Datagrid) from using a DataSet as the source to a List. As part of the original functionality, the list of items being displayed could be filtered based on selections that the user made. I decided to take advantage of the built in LINQ extension features for Lists to accomplish the filtering. The two extensions that I leveraged were the TrueForAll and Exists extensions.

 

In my first scenario, I have an object (Resource) that have a sub-List of times (TimeEntries) that represent their availability within a day. I need to filter the list to include all Resources in the list where their TimeEntries are not off (e.g. not on vacation, jury duty, break, etc.) In order to build that I used the TrueForAll extension that was examining a boolean method on the Resource object as shown below:

 

return resources.FindAll(r => r.Entries.TrueForAll(e => e.IsRegEntry()));





Additionally, I needed to filter the list to include the Resource if at least one of their entries was an Off entry, so for that I used the Exists extension as seen below:


 



return resources.FindAll(r => r.Entries.Exists(e => e.IsOffEntry()));





I am continually amazed at the power of LINQ and how it can make what was once fairly complex seem so much simpler and easier to understand. If you have an opportunity to check it out, I would highly recommend it.

Wednesday, September 2, 2009

SQL Server 2008 – Assign a default value to a local variable

I just discovered today, that SQL Server 2008 allows you to assign a default value to a local variable. I was not aware that this functionality had been added until I had a stored procedure I was working with on my local SQL 2008 database and tried to execute it on the shared development database, which is still running SQL 2005 and I received the following error:

Msg 139, Level 15, State 1, Procedure apGetRollCallData, Line 0
Cannot assign a default value to a local variable.
Msg 139, Level 15, State 1, Procedure apGetRollCallData, Line 0
Cannot assign a default value to a local variable.
Msg 137, Level 15, State 2, Procedure apGetRollCallData, Line 79
Must declare the scalar variable "@StartRange".
Msg 137, Level 15, State 2, Procedure apGetRollCallData, Line 89
Must declare the scalar variable "@StartRange".
  


I had the following declarations in my procedure that were causing the issue.




DECLARE @StartRange DATETIME = @ViewDate
DECLARE @EndRange DATETIME = @ViewDate





Once I changed it back to the following, it worked just fine in SQL Server 2005.




DECLARE @StartRange DATETIME
SET @StartRange = @ViewDate
DECLARE @EndRange DATETIME
SET @EndRange = @ViewDate



From a .NET developers point of view, I like having the ability to set a default value for a local variable in TSQL just like I can do in my programming language of choice.


 


Very nice. Thanks Microsoft.

Friday, August 7, 2009

NAnt .NET Framework 4.0 Configuration

4/14/2010 - Updated for .NET 4.0 RTM and feedback from comments.

For anyone who is using NAnt to build their solutions/projects and is also testing out Visual Studio 2010/.NET Framework 4.0 Beta 1, I have included below the .NET 4.0 Framework entry that I added to my NAnt.exe.config file and have been using to successfully compile my projects.

<framework
name="net-4.0"
family="net"
version="4.0"
vendor="MIcrosoft"
description="Microsoft .NET Framework 4.0"
sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}"
frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}"
frameworkassemblydirectory="${path::combine(installRoot, 'v4.0.30319')}"
clrversion="4.0.30319"
>
<runtime>
<probing-paths>
<directory name="lib/net/2.0" />
<directory name="lib/net/neutral" />
<directory name="lib/common/2.0" />
<directory name="lib/common/neutral" />
</probing-paths>
<modes>
<strict>
<environment>
<variable name="COMPLUS_VERSION" value="v4.0.30319" />
</environment>
</strict>
</modes>
</runtime>
<reference-assemblies basedir="${path::combine(installRoot, 'v4.0.30319')}">
<include name="Accessibility.dll" />
<include name="mscorlib.dll" />
<include name="Microsoft.Build.Engine.dll" />
<include name="Microsoft.Build.Framework.dll" />
<include name="Microsoft.Build.Utilities.dll" />
<include name="Microsoft.Vsa.dll" />
<include name="Microsoft.VisualBasic.dll" />
<include name="Microsoft.VisualBasic.Compatibility.dll" />
<include name="Microsoft.VisualBasic.Compatibility.Data.dll" />
<include name="System.Configuration.dll" />
<include name="System.Configuration.Install.dll" />
<include name="System.Data.dll" />
<include name="System.Data.OracleClient.dll" />
<include name="System.Data.SqlXml.dll" />
<include name="System.Deployment.dll" />
<include name="System.Design.dll" />
<include name="System.DirectoryServices.dll" />
<include name="System.dll" />
<include name="System.Drawing.Design.dll" />
<include name="System.Drawing.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="System.Management.dll" />
<include name="System.Messaging.dll" />
<include name="System.Runtime.Remoting.dll" />
<include name="System.Runtime.Serialization.Formatters.Soap.dll" />
<include name="System.Security.dll" />
<include name="System.ServiceProcess.dll" />
<include name="System.Transactions.dll" />
<include name="System.Web.dll" />
<include name="System.Web.Mobile.dll" />
<include name="System.Web.RegularExpressions.dll" />
<include name="System.Web.Services.dll" />
<include name="System.Windows.Forms.dll" />
<include name="System.Xml.dll" />
</reference-assemblies>
<task-assemblies>
<!-- include MS.NET version-neutral assemblies -->
<include name="extensions/net/neutral/**/*.dll" />
<!-- include MS.NET 2.0 specific assemblies -->
<include name="extensions/net/2.0/**/*.dll" />
<!-- include MS.NET specific task assembly -->
<include name="NAnt.MSNetTasks.dll" />
<!-- include MS.NET specific test assembly -->
<include name="NAnt.MSNet.Tests.dll" />
<!-- include .NET 2.0 specific assemblies -->
<include name="extensions/common/2.0/**/*.dll" />
</task-assemblies>
<tool-paths>
<directory name="${path::combine(sdkInstallRoot, 'bin')}"
if="${property::exists('sdkInstallRoot')}" />
<directory name="${path::combine(installRoot, 'v2.0.50727')}" />
<directory name="${path::combine(installRoot, 'v3.0')}" />
<directory name="${path::combine(installRoot, 'v3.5')}" />
</tool-paths>
<project>
<readregistry
property="installRoot"
key="SOFTWARE\Microsoft\.NETFramework\InstallRoot"
hive="LocalMachine" />
<readregistry
property="sdkInstallRoot"
key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0"
hive="LocalMachine"
failonerror="false" />
</project>
<tasks>
<task name="csc">
<attribute name="supportsnowarnlist">true</attribute>
<attribute name="supportswarnaserrorlist">true</attribute>
<attribute name="supportskeycontainer">true</attribute>
<attribute name="supportskeyfile">true</attribute>
<attribute name="supportsdelaysign">true</attribute>
<attribute name="supportsplatform">true</attribute>
<attribute name="supportslangversion">true</attribute>
</task>
<task name="vbc">
<attribute name="supportsdocgeneration">true</attribute>
<attribute name="supportsnostdlib">true</attribute>
<attribute name="supportsnowarnlist">true</attribute>
<attribute name="supportskeycontainer">true</attribute>
<attribute name="supportskeyfile">true</attribute>
<attribute name="supportsdelaysign">true</attribute>
<attribute name="supportsplatform">true</attribute>
<attribute name="supportswarnaserrorlist">true</attribute>
</task>
<task name="jsc">
<attribute name="supportsplatform">true</attribute>
</task>
<task name="vjc">
<attribute name="supportsnowarnlist">true</attribute>
<attribute name="supportskeycontainer">true</attribute>
<attribute name="supportskeyfile">true</attribute>
<attribute name="supportsdelaysign">true</attribute>
</task>
<task name="resgen">
<attribute name="supportsassemblyreferences">true</attribute>
<attribute name="supportsexternalfilereferences">true</attribute>
</task>
<task name="delay-sign">
<attribute name="exename">sn</attribute>
</task>
<task name="license">
<attribute name="exename">lc</attribute>
<attribute name="supportsassemblyreferences">true</attribute>
</task>
</tasks>
</framework>

Again, keep in mind that is what has worked for me. Your mileage may vary. Hope this helps.

Friday, July 24, 2009

NBuilder – A must have testing tool

I have recently been using NBuilder by Gareth Down. In my opinion, this testing tool is an absolute must for your toolbox. In my current project, we are going through a good deal of effort to create and correctly populate our objects under test. We have built an extensive suite of test helper methods to produce the objects. Now, with very minimal effort (and much less code) I can create a new object. Here is the description of the tool from the website home page:

“Through a fluent, extensible interface, NBuilder allows you to rapidly create test data, automatically assigning values to properties and public fields that are of type of the built in .NET data types (e.g. ints and strings). NBuilder allows you to override for properties you are interested in using lambda expressions.”

The NBuilder website contains a lot of great examples of the flexibility and power of this tool. Also, be sure to check out the NBuilder page on google code for moer examples, the features and bugs list, etc.

Thanks for creating such a great tool Gareth!

Tuesday, July 21, 2009

Are you on the Dark Side?

When you write code and test cases are you on the dark side or light side of testing? Do you use brute force?

Read Jeff’s Atwood’s blog, Testing With “The Force” to find out more…

Improving jQuery Performance

Giulio Bai has a great list of 10 Ways to Instantly Improve Your jQuery Performance. I highly recommend checking this article out if you are using jQuery.

Wednesday, June 10, 2009

Improving jQuery Selector Performance

Dave Ward just posted the great article, 11 keystrokes that made my jQuery selector run 10x faster.

If you are using jQuery in your web application, I highly recommend that you read this article and learn how to ensure that your jQuery selectors are running as fast as possible. Dave also includes some good hard data on the JavaScript performance differences between the older browsers: IE 7 & FireFox 3.0 as compared to the newer generation browsers like IE 8, FireFox 3.4 and Google Chrome.

Friday, May 15, 2009

Go read: What ASP.NET Developers Should Know About jQuery

Dave Ward has written a great a article: What ASP.NET Developers should know about jQuery. If you are an ASP.NET developer and want to know “what’s in it for me” regarding jQuery, you need to check this out. Thanks for the great post Dave!

Thursday, May 7, 2009

jQuery Performance Rules

Ran across this great post today. jQuery Performance Rules by Dave Artz. Dave lists some really good performance tips to follow when using jQuery. Each tip is also listed with an example. if you are using jQuery, I would highly recommend giving this a look.

Tuesday, March 31, 2009

Setting up II7 Remote Administration

The article, Remote Administration of IIS 7: Install, Configure, Connect by Dave Lawlor is a great write up of how to get your Windows 2008 server setup to allow remote administration of the IIS 7 web server. It allowed me to get things setup very quickly on my sandbox server.

Friday, March 20, 2009

ASP.NET Mobile Definition File

In my current project, we are considering creating a mobile page (geared towards the Blackberry) that a set of users can access to validate/actualize some data that the system is tracking for them. I started doing a little research on how to correctly detect that the users are on a mobile device and render the pages. In the course of this research, I came across this hot off the presses blog from Scott Hanselman, Mix: Mobile Web Sites with ASP.NET MVC and the Mobile Browser Definition File. Scott details the cool new Mobile Browser Definition File that has just been released by Microsoft out on CodePlex. if you doing any mobile device development for ASP.NET websites, this is something that you should definitely check out.