Posts

Long running processes: C# 5, Visual Studio 11, async and await; updating a Winforms UI asynchronously

Image
I recently downloaded Visual Studio 11 Beta  in order to take a look at the new 4.5 .Net Framework and play around with its new features. I decided to take the opportunity to build a "quick" app that I've been meaning to build for a few years; a single form Windows Client that allows me to send out an email merge to the 1,400 agents I have in my outlook contacts list, to let them know I'm available for work. Before now, every time I've needed to send an "I'm available!" email, I've copied + pasted the same email a number of times, attached my CV and BCC'd 100 or so agents at a time (too many and Outlook just falls over). Not only is it a massive waste of my time, but it's very error prone and not a very friendly way of doing things. Unfortunately, the mail merge feature of Word has its limitations, so I've had to look in to my own solution. Anyone who's worked with bulk email systems before knows fine well that any kind of mas...

A learned journey

As a mercenary developer, I come across programmers from many different walks of life; of all skill levels and abilities with varying levels of enthusiasm. Whilst I'm certainly not perfect (and am always learning), I encounter some who are yet to grasp some of the more basic programming concepts. It's very easy to take a blinkered view of the technologies you're familiar with and to become complacent in your current role or too comfortable with your existing skills. On the other hand, some developers I encounter are far keener than I, and therefore usually far exceed my skill; two things which are directly related. I speak from first hand experience when I say that by taking a step outside of your comfort zone and making even one or two small changes to your daily routine as a developer could seriously improve your general programming knowledge and overall productivity. Although not quite ad-verbatim, I think it was Scott Hanselmann who recently blogged that simply stat...

MVC3: Redirect Action to HTML Bookmark

I'm currently in the process of writing my next personal project,  RustyShark  in .Net MVC3. It's a game and films review site, and will hopefully generate a bit of a community. Each review on the website has a comments form at the bottom that readers can use to post their own mini review, or just a simple comment. I'm using unobtrusive client side validation, but (as it should) the validation also occurs on the server side. This means that the user could potentially receive an error message on the comments form after a post-back but not notice it, as they will be redirected to the top of the page, rather than the comments form. The "read review" page is accessed via the fairly standard route /Reviews/Read/{titleURL}, which means the reviews controller exposes the Read action method. The Read method has a single override which is tagged with the [HttpPost] attribute as follows: public class ReviewsController : Controller { public ActionResult R...

Debugging the SSIS Script Component

Image
I've been doing a lot of work with SSIS recently, and learning a lot on the way. One of my tasks over the last week was to convert each row of a result set in to XML and post it to a web service. The web service only accepted one row at a time, and generating XML in SSIS is not the most intuitive of tasks, so I wrote a script component to do the conversion work. Anyone who's tried anything more advanced than a "Hello World" example in a script component will be able to tell you that you cannot use breakpoints in them - making it quite difficult to debug even the simplest of code. For a developer such as myself, it's like having an arm removed in a horrific train accident. I had a bit of a task ahead of me - I had to create an XML document with tags containing attributes and values, attributes and child elements, child elements and values, attributes, child elements and values, then self-closing tags with some of the above... whilst not exactly a daunting task, i...

Tools Round-up

The development world has been coming up with ways to improve productivity for years. However since Visual Studio 2010 was released, with its fully extensible model, things have seriously changed. Most tools have been modified to extend VS2010's already pretty awesome IDE. With just a few extensions, you can fill in almost all of the gaps the Visual Studio team have left in the VS experience. I'm not a massive fan of NuGet; I use it, but not for production sites. It's good for quickly implementing a library in a test project, but I just don't like the "bloat" you end up with. I like to know what every single file does and why its there. The same goes for WebMatrix; although handy, I much prefer to manually create projects... I somehow feel like it makes it easier in the long run, even if it takes you a while to set them up in the first place. I recently purchased ReSharper (after trying trials a number of times over the years and not getting along with it)...

Getting Visual Studio 2008 to work with Team Foundation Server 2010

Recently I've been collaborating via Team Foundation Server 2010 - it's my first time, and I'll be honest... it was very gentle. It eased me in with its promise of improved Source Control (improved over Source Safe, that is) and toyed with me, sporting its ideals surrounding automated builds and work item collaboration. Whilst I've not been directly involved with the set up, using it on a daily basis has been a refreshing change. I'm one of those developers who obsessively refactors code, renames and moves files around until I'm happy everything is in the right place, so when using Source Safe, CVS or SVN, there's quite a bit of repeat work involved when it comes to making sure the source control server is also updated. Suffice to say that TFS 2010 works beautifully in this area, keeping the local, server and project file structure the same as each other. I've been exclusively working in Visual Studio 2010 for a while now, as I've been creating n...

Visual Studio 2010 defaults to an undesired browser when opening MVC projects

A while ago, I set my default browser in Visual Studio 2010 to Google Chrome by using the "Browse With..." trick, and I've been happy with it for some time. Recently I've found that I've needed to do quite a bit of testing in IE, so I wanted to change it back. I went down the "Browse With..." route again, which seemed to work... but every time I close and re-opened Visual Studio, it reset itself back to Chrome. I've been living with it for a while, as I tend to do extended sessions anyway, so it's not been too much of a hassle... but today I've needed to close and restart Visual Studio a few times, so it's become a bit annoying. Anyway, to cut a long story short, it seems that when setting the "Browse With..." option in an MVC project, the settings aren't saved to the configuration file, probably because MVC projects don't actually have physical files to be "Browsed", unlike an ASP.Net project. I'm not ma...