IIS Express
Web development on the Microsoft platform has always had it's hurdles. With Windows XP, your development environment would use IIS 5 where as the server that would host the production site would be IIS 6. Additionally, there was the issue where we were limited to a single website running on that machine (this was a pain when working on multiple projects at the same time).
Microsoft's virtual web servers that would get kicked off by Visual Studio alleviated some of the hardships by allowing each one of your web projects to run on an individual site. With the release of IIS 7, and particularly the rewrite rules that they provided, we ran into another issue where our production environments supported rest-full, SEO friendly URLs but the virtual web servers initiated by Visual Studio would not be able to process the URLs.
Recently, Microsoft addressed many of these issue with IIS Express. Scott Guthrie blogs about this new tool here: http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx
Custom Event Tracking with Google Analytics
Here is a link for the asynchronous event tracking scripts for Google Analytics: http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html. Keep in mind that to work with this code, you need the 3rd generation of Google Analytics scripts on your site. If you are using urchin.js or ga.js then you need to updated your scripts.
You need to dig around the Google Analytics dashboard to find the event tracking reports.
- When you access the main page for Google Analytics, click the View Report link for the profile you are tracking the events for.
- On the left navigation, select Content
- Under Content, select Event Tracking and Category
Subversion Repository Crash
svnadmin dump d:\SVNRepositories\
SVN-fs-dump-format-version: 2
UUID: 21a194ee-da73-c443-af0d-4b52d073379e
Revision-number: 0
Prop-content-length: 56
Content-length: 56
K 8
svn:date
V 27
2008-06-26T00:04:33.388345Z
PROPS-END
* Dumped revision 0.
Revision-number: 1
Prop-content-length: 97
Content-length: 97
K 7
svn:log
V 23
Created folder remotely
K 8
svn:date
V 27
2008-06-26T00:06:05.949068Z
PROPS-END
svnadmin: Berkeley DB error for filesystem 'd:/SVNRepositories/
DB_RUNRECOVERY: Fatal error, run database recovery
svnadmin: bdb: page 0: illegal page type or format
svnadmin: bdb: PANIC: Invalid argument
svnadmin: bdb: PANIC: fatal region error detected; run recovery
Any ideas as to how to resolve this are welcome.
HTML5
I want to stay ahead of the curve when it comes to HTML5 and everything it has to offer so I'm using this blog entry to chronicle my research and any cool tools I find around the interwebs.
I found this nice sandbox the other day http://rendera.heroku.com/. They have some nice example and am learning a lot from it.
W3Schools has a nice primer. You can find it here: http://www.w3schools.com/html5/html5_reference.asp
Some questions I have and would like to answer for myself are...
- What is the purpose of the <address> node? What do I gain from using it?
- How can I integrate HTML5 with ASP.NET Web Controls?
More questions to come.
Enterprise Library Data Access Application Block + SQL Optional Parameters
The Enterprise Library Data Access Block provides a number of ways of calling a stored procedure.
Database _db = DatabaseFactory.CreateDatabase(<Connection String Name>);
Let's now assume that we have a stored procedure usp_MyStoredProc that takes a single parameter @param1. If this is a require parameter, both of the following statement blocks will result in the same outcome:
public DataSet CallMyStoredProc( int value ){
return _db.ExecuteDataSet( "usp_MyStoredProc", value )
}
public DataSet CallMyStoredProc( int value ){
DbCommand command = _db.GetStoredProcCommand("usp_MyStoredProc" );
_db.AddInParameter( command, "param1", value );
return _db.ExecuteDataSet( command );
}
However, now let's assume that @param1 is an optional parameter that we don't want to pass in from our data access method, we are limited in our options.
public DataSet CallMyStoredProc(){
return _db.ExecuteDataSet( "usp_MyStoredProc")
}
This method will fail with an exception because the parameters provided to the stored procedure (none) don't match the parameter count for the stored procedure (1).
Creating an actual DbCommand and executing it, however, will not cause an exception. In this scenario, the following code block will work without causing an exception:
public DataSet CallMyStoredProc( int value ){
DbCommand command = _db.GetStoredProcCommand("usp_MyStoredProc" );
return _db.ExecuteDataSet( command );
}
Setting up Cruise Control .NET 1.5 on Windows 7 + IIS7
- Download the installation package from Sourceforge.net. As of writing this article, the latest version is available here.
- Run the installer. This will copy the files you need and create the IIS site/virtual directories needed to access Cruise Control .NET from your browser.
- Open your Internet Information Services (IIS) Manager (Start -> Run -> inetmgr )
- Create a new website point the site to <INSTALL PATH>\webdashboard.
- Change the bindings for the new site to a unique port. ( I use port 90 and the CCNET is then accessed via http://localhost:90)
- Open the application pool created for this site and change the 'Managed pipeline mode' to 'Integrated'.
- Open the services manager (Start -> Run -> services.msc) and start the Cruise Control .NET service.
jquery, ajax, and .NET Web Services
Recently, I have been working on a few projects that require an ajax friendly life cycle for an ASP.NET web application. Much of the work I did is based on Rick Strahl's post: http://www.west-wind.com/weblog/posts/896411.aspx.
Working on top of what I learned from this article, I decided to leverage the rich capabilities of .NET's Web UI components as part of my ajax implementation using HTML injection. I used jquery to bind a standard button to make a call to my Web Service method.
The service created and populated a standard GridView object. The service would then render that object and return the HTML that was generated. This HTML, once returned by the service call, would be injected into a DIV tag that served as the container for the results table.
My initial implementation is a naive solution that renders full HTML on the server side and passes that back to the client-side. My ASP.NET page already has a script manager so I added a reference to my web service (simple .asmx in this scenario).
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Services/MyService.asmx" />
</Services>
</asp:ScriptManager>
namespace Client.Project.Services
{
/// <summary>
/// Summary description for ConceptServices
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, Name = "MyBinding")]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class ConceptServices : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod]
public String Foo()
{
return "<table><tr><td>Hello World!</td></tr></table>";
}
}
}
var i = 3
var s = "bar"
Client.Project.Services.Foo( i, s, successMethod, failureMethod )
Continuous Integration with Cruise Control .NET + NAnt
UPDATE CruiseControl.NET 1.5 RC1 has been release and is available here.
My Cruise Control .NET implementation consists of numerous development projects each with multiple different CCNET projects associated with it (one per environment per branch). In order to make the projects more maintainable, I have created a separate configuration file for each development project.
Defining variables and separating ccnet.config configuration file into smaller files allows for easier maintenance as the number of projects as time went on.
Defining and using variables
Variables can be defined using the following format
<cb:define KEY="VALUE" />
To reference that variable later in the configuration file, simply use $(KEY)
Check out the Cruise Control .NET website for complete explanation of variables using the pre-processor.
Separating the configuration files
<!DOCTYPE cruisecontrol [
<!ENTITY PROJECT_NAME SYSTEM "file:project.xml">
]>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
&PROJECT_NAME;
</cruisecontrol>
project.xml would, then, contain the regular xml configuration for a Cruise Control .NET project:
<?xml version="1.0" encoding="utf-8"?>
<project name="My Project" category="A Category">
<workingDirectory>MyProject</workingDirectory>
<artifactDirectory>MyProject</artifactDirectory>
<webURL></webURL>
<triggers>
<intervalTrigger seconds="900" buildCondition="IfModificationExists" />
<scheduleTrigger time="04:00" buildCondition="ForceBuild" />
</triggers>
<labeller type="svnRevisionLabeller">
<pattern>Version {major}.{minor}.{build}.{revision}</pattern>
<major>1</major>
<minor>0</minor>
<url>$(SvnBaseUrl)</url>
</labeller>
<sourcecontrol type="svn">
<trunkUrl>$(SvnBaseUrl)</trunkUrl>
<workingDirectory>$(BaseDirectory)</workingDirectory>
<cb:SvnOptions />
</sourcecontrol>
<tasks>
<nant>
<executable>$(NAntExecutablePath)</executable>
<baseDirectory>$(BaseDirectory)</baseDirectory>
<targetList>
<target>dist.deploy</target>
</targetList>
</nant>
</tasks>
<publishers>
<xmllogger />
<cb:include href="EmailConfig.xml"/>
</publishers>
</project>
On caveat with this idea is that changes to the separate configuration files are not recognized until the cruise control is restarted by either restarting the service or modifying the ccnet.config file.
Building and Deploying ASP.NET Web Applications
The NAnt target below is a full parameterized call to MsBuild.exe to compile any solution. ThoughtWorks.CruiseControl.MsBuild.dll provides an MSBuild logger that allows Cruise Control .NET to report the bulid output.
Parameters
MSBuildPath - The path to the MsBuild executable.
For .NET Framework versions 2.0 and 3.5 on a 32-bit Windows OS, use C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MsBuild.exe
For .NET Framework version 4.0, use C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe
SolutionFile - The relative path from the build file to the solution file. Fully qualified paths are also allowed.
SolutionConfiguration - "Release" or "Debug".
BootBootReboot.com
I have been working on a website to aggregate funny technology related content across the internet. So far, I have been able to integrate pictures, YouTube videos, and some RSS content from fmylife and clientcopia
I have created the site using ASP.NET and SQL Server. I made this decision solely because I use Microsoft's platform every day for my professional work.
Picture Uploads and Thumbnails
The pictures page (http://www.bootbootreboot.com/pictures) allows visitors to add their own pictures. Upon uploading a picture, a thumbnail is also generate for that picture. The code below shows how to create a thumbnail of an uploaded image.
{
Ajax using jquery + .NET Web Services
Recently, I have also been introducing some new ajax functionality using jquery and .NET web services. This combination has allowed me to easily introduce a "preview" feature for uploading images and YouTube videos.
Content Management
Youtube Videos
The site is being updated to use the Youtube play list as the content manager for the videos page. Comments and ratings will be retrieved for the detail page and visitors to bootbootreboot.com can add their own comments and ratings.
Performance and Load Testing with WebLoad
Recently, I had to perform a load test on our new project. We are using WebLoad to test the performance at different levels of load to see how it holds up. While WebLoad offers its own set of analytics, I am also using perfmon to see how each tier is performing under the stress.
I originally planned on using WebLoad 8.4 for the performance testing but have decided to stick with version 8.1. The free license for 8.4 limits you to 10 virtual users (the load size) where as V8.1 does not have any limitation.
WebLoad 8.1 can be downloaded here.
Perfmon Counters
The following counters will give the most pertinent results.
ASP.NET
- Requests Queued
- Requests Current
- Request Execution Time (lower is better)
- Request Wait Time (lower is better)
- Requests Rejected (lower is better, is best)
System
- Context Switches / sec
Memory
- Pages / sec
- Available Bytes
- Committed Bytes
Processor
- % Processor Time
- Active Server Pages
- Request Wait Time
- Requests Queued
Web Service
- Current Connections
- Bytes Send / sec
- Connection Attempts / sec
- Current Blocked Async I/O Requests
- Current Blocked bandwidth bytes