Thursday, November 08, 2007 Registration open

For all of the email address squatters out there. The (and a lot of other domains) addresses are open for registration. Check out this post, real quick, to get you preferred email address in Microsoft live services.

kick it on Shout it

Sunday, October 28, 2007

Regular Expression Library and Cheat Sheet

I was writing some validation expressions for my pages and started to get lazy. So here is a library of commonly used - and tested - regular expressions that can save time from writing them from scratch. There are also many other useful resources around the site.

Regular Expression Library

kick it on Shout it

DataFormat Strings with GridView and BoundField

Like Rick I find myself forgetting all those little tricks that have to be done to get a project working. So here is my reminder...

Formatting fields with GridView and BoundField

kick it on Shout it

Friday, October 26, 2007

URL Rewriting in ASP.NET

Here is a good reference for the options available for Url rewriting. I have ended up using a Url Rewriting dispatch mechanism. Hopefully I'll have time to write about it!

URL Rewriting in ASP.NET

kick it on Shout it

Tuesday, October 23, 2007

Frustrating Error: No Corresponding Start Element Open

If you have been searching and have found this then you have probably had a frustrating hour or more with an error of "No Corresponding Start Element Open". No doubt you have rebuilt your WCF service, updated the service reference, maybe even removed and re added the service reference. Still you'll have the error.

So maybe one of a couple of things are happening. If your client is not WCF then maybe the generation of the service proxy is making some parameters optional in the request or response. In this case have a read of this article to get a better idea of what is happening.
Eugene Osovetsky's Blog : Solving the "disappearing data" issue when using Add Web Reference or Wsdl.exe with WCF services

However, in my case I have WCF as the client - something else is awry. One thing to check is if you have a Dataset in your method signature. If the service call is returning null instead of a Dataset instance then this error will come up. There are a couple of options - return an empty Dataset or set the EmitDefaultValue attribute on the argument. Read more about that here No Corresponding Start Element Open

kick it on Shout it

Monday, October 22, 2007

Implementing network credentials for ReportViewer

When the reporting control is not hosted under the same credentials as the reporting server, the network credentials need to be set for a ReportViewer control. Here is an easy way to do that.

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials readonly - MSDN Forums

kick it on Shout it

Tuesday, October 16, 2007

Easily refresh an UpdatePanel, using JavaScript

Another way to refresh an Atlas AJAX UpdatePanel from a client side event. This also mentions other ways, such as hidden submit buttons, which can be used.
Easily refresh an UpdatePanel, using JavaScript Encosia

kick it on Shout it

Tuesday, August 28, 2007

Computer Zen - Scott Hanselman's 2007 Ultimate Developer and Power Users Tool List for Windows

If you are anything like me, then sometimes you just don't have the time to keep up with some of the niftier little tools that can make a developer's life easier.

Once again Scott Hanselman has compiled his list of Windows utilities and developer tools that will make your life easier. Even if you only start using a couple of these utilities you'll be forever thanking yourself for it. I do...

Scott Hanselman's Computer Zen - Scott Hanselman's 2007 Ultimate Developer and Power Users Tool List for Windows

Some of my favorites:
Lutz's Reflector, SysInternals, FireBug, TestDriven.NET, WinMerge, IE Developer Toolbar, Fiddler, and so many more. Give it a good look.

kick it on Shout it

Tuesday, August 14, 2007

Tips and Tricks with Microsoft AJAX

Wicked Code: UpdatePanel Tips and Tricks -- MSDN Magazine, June 2007

Recently I had my first experience with Microsoft AJAX. In previous incarnations I have written many websites with 'traditional' AJAX using Xml-Http and some client side scripting.

The first thing that struck me about Atlas was that is wasn't lightweight. At all. Sending complete page state and a full page lifecycle. It seemed to me that it was a recipe for writing a really unscalable website without even knowing it. If you don't know what type of load this will place on our bandwidth or server, then I would suggest not doing anything with UpdatePanels and update timers! The use of these controls should be well thought out rather than liberal.

Take for example the task of updating a control when a value is selected in another control. Using Microsoft AJAX this would involve a complete postback of page state and page lifecycle on the server. Now consider when the user is using the keyboard to scroll through the contents of the controlling listbox. That's one postback and page lifecycle for each value that is scrolled over. Eeek! Not my idea of scalable.

In this case it might be better to consider a more traditional AJAX approach. Note that this doesn't mean writing all of the client-side script and the webservice yourself. The Microsoft AJAX toolkit can provide some features to help you. This article presents some options for hooking up a client-side event with a more traditional lightweight approach using the ScriptService and PageMethods.

These are something that are well worth the investigation if you are considering using Microsoft AJAX toolkit extensively on your site. A little bit of fore-thought can go a long way.

kick it on Shout it

Monday, August 13, 2007

Language Log

Language Log is an interesting collection of quirks and constructs of the formal and informal English language.

kick it on Shout it

Wednesday, June 06, 2007

Agile Development Processes

After 6 months of non-Agile development, I am now trying to kick start a short, but potentially large project. While getting back into the Agile mindset the following links proved useful. Sometimes all it takes is reading a few articles and talking about the methodology to once again become enthused by it.

Agile Development Processes: An Interview with Jeff Patton
The Pros and Cons of Short Iterations

kick it on Shout it

Thursday, May 24, 2007

On the virtues of crap code

Sometimes you just have to wonder what people are thinking. What level of software engineering degree does it take to completely misunderstand a concept and write this very special code?

SqlConnection conn = _db.GetConnection();
SqlTransaction tx = conn.BeginTransaction();
SqlCommand cmd = this.GetCmdRemoveField(conn);
cmd.Transaction = tx;
cmd.Parameters.Add("@ID", id);
cmd.Parameters.Add("@FieldName", field);
try { tx.Rollback(); }
catch { }

My eyes bleed and my heart sunk as I found this code from an external development group that was developing part of the previous application I worked on.

kick it on Shout it

SQL Deadlock Troubleshooting

SQL deadlocks can happen in the funniest places and when you least expect them. Take for example one website that had no problems with 1-2 users, but when 'scaling' to even 4 users SQL deadlocks would start. The blog entry below is well worth the read to help debug those pesky deadlocks.

Bart Duncan's SQL Weblog : Deadlock Troubleshooting, Part 1

kick it on Shout it

Thursday, May 17, 2007

Can Agile Methodology be adapted for stand-up comedy?

The age old question. Once you feel the power of the Agile methodology you may too find yourself looking for other parts of your life to apply it.

kick it on Shout it

Continuous Integration with Subversion and AssemblyInfo

Building a continuous integration environment is becoming easier every day. How nice is it to have all of your source code automatically versioned with each build from continuous integration?
Here are some steps that might help when using Subversion:

A task to retrieve the latest subversion change number from the repository

<echo message="Retrieving Subversion revision number"/>
<property name="svn.revision" value="not_available"/>
program="c:\program files\subversion\bin\svn.exe"
commandline="log ${code.trunk} -r HEAD --xml"
<echo message="Using Subversion revision number: ${svn.revision}"/>

Now add a task that will update all of the CommonAssemblyInfo.cs and AssemblyInfo.cs files that have the AssemblyVersion attribute defined.

<target name="SetVersions" description="Stamp the version info onto assemblyinfo.cs files">
<foreach item="File" property="filename">
<items basedir=".">
<include name="**\AssemblyInfo.cs"></include>
<include name="**\CommonAssemblyInfo.cs"></include>
<script language="C#">
public static void ScriptMain(Project project)
StreamReader reader = new StreamReader(project.Properties["filename"]);
string contents = reader.ReadToEnd();
string pattern = @"\[assembly: AssemblyVersion\("".*""\)\]";
if (Regex.IsMatch(contents, pattern))
string replacement = string.Format(
"[assembly: AssemblyVersion(\"{0}.{1}.{2}.{3}\")]",
string newText = Regex.Replace(contents, pattern, replacement);
StreamWriter writer = new StreamWriter(project.Properties["filename"], false);

And now tie it all together with this little task before executing your build, and you should have an accurately versioned build every time!

<property name="build.version.major" value="1" />
<property name="build.version.minor" value="0" />
<property name="" value="0" />
<property name="build.version.revision" value="*" />

<target name="UpdateVersions">
<call target="RetrieveSVNChangeNumber" />
<property name="" value="${svn.revision}" />

<call target="SetVersions" />

Of course the next step could be to check in all of those updated assembly info files...

kick it on Shout it

Sunday, February 25, 2007

Humping USB Doggie

Could this be the most useless USB gadget yet?

kick it on Shout it

Saturday, February 24, 2007

Adding Pre and Post build events to Web Projects

It is amazing how often I come across things in Visual Studio that seem like they should be simple enough.

Recently, one such thing was adding a post-build event to a Web Project. Of course the first place to look is the project properties. But there is no sign of it there. A little odd, why shouldn't I be able to have events on my build for a Web Project?

You can! A quick investigation of the .csproj project file in your project path shows the PreBuildEvent and PostBuildEvent configuration values sitting there. And you can edit them with your favorite editor and add in you pre and post events as you wish.

To easy - when you don't try to use the Visual Studio IDE!

        <!-- Your Build Events Here -->
        PreBuildEvent = ""
        PostBuildEvent = ""
        <!-- RunPostBuildEvent = "Always" | "OnBuildSuccess" | "OnOutputUpdated" -->
        RunPostBuildEvent = "OnBuildSuccess"

kick it on Shout it

New adventures in Continuous Integration

It has been a while since I have setup a continuous integration environment from scratch, but here again I find myself doing it.

Each time I setup an environment there is something subtly different, or there are better ways to do things based on new releases of CruiseControl, NAnt, NUnit and friends.

Luckily there are blog entries like this one that can help with parts of the process.

Continuous Integration Setup

kick it on Shout it

VS2003, ASP.Net and Subversion

Subversion and the ASP.Net Hack

I was recently converting the source control for a product over to SubVersion and this little funny came up. The problem is with directories in the ASP.Net Web Project folder that start with a '.' - directories such as .svn.

Now with that minor inconvenience it is not possible to load the Web Projects into Visual Studio 2003. Luckily the developers of Subversion have coded around Microsoft's stupidity by adding a compatibility flag for the Windows version of Subversion. Set the SVN_ASP_DOT_NET_HACK environment variable in your profile to the value '*' and re-checkout all of your code. The .svn directories will have become _svn directories.

One gotcha is that this is only supported in the Windows version of Subversion. Just be aware that using any other platform on your 'Windows-fied' checkout directories won't work!

Of course you can always avoid the problem by steering away from Web Projects and implementing web solutions as standard class libraries.

kick it on Shout it