Quantcast
Channel: .NET – The Blog of Colin Angus Mackay
Browsing all 14 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Building messages in parallel

I recently saw some code where the developer was attempting to build up messages inside tasks that were being reported outside of the task. In a sequential system it is easy enough to do this. You have...

View Article



Image may be NSFW.
Clik here to view.

Tip of the day: Splitting a string when encountering whitespace

In .NET the string class has a Split method that splits the string at the separator character(s) that you specify. However, if you want to split the string at any instance of whitespace you don’t have...

View Article

Image may be NSFW.
Clik here to view.

LINQ query performance

A while ago I was reviewing some code and I came across some code that looked like this if (corpus.Where(a => a.SomeProperty == someValue).Count() > 0) { // Do Stuff } And it got me thinking that...

View Article

Image may be NSFW.
Clik here to view.

Installing a web site on a new server

Here are some blog posts that have been useful to me lately when I got caught out installing a website on a new server (I will eventually get that automated build and deploy process actually performing...

View Article

Image may be NSFW.
Clik here to view.

Tip of the day: Expire a cookie, don’t remove it

I recently found a bug in my code that I couldn’t fathom initially until I walked through the HTTP headers in firebug. In short, you cannot simply remove a cookie by calling Remove(cookieName) on the...

View Article


Image may be NSFW.
Clik here to view.

First(OrDefault) Vs. Single(OrDefault)

There are two mechanisms (each with an …OrDefault variant) in LINQ for getting one item out of an enumeration. They are First and Single. There is a difference between the two and you can produce code...

View Article

Image may be NSFW.
Clik here to view.

Sending more than a basic email with Amazon SES

Previously, I wrote about getting started with Amazon’s Simple Email Service, and I included details of how to send a basic email. The SendEmail method is excellent at sending basic emails with HTML or...

View Article

Image may be NSFW.
Clik here to view.

Verifying Senders with Amazon SES

I’ve already written a couple of pieces about Amazon Simple Email Service (SES) on sending Email and sending emails with attachments. Why do you have to verify senders? It is important to note that...

View Article


Image may be NSFW.
Clik here to view.

Handling bounces on Amazon SES

If you send to an email that does not exist, Amazon SES will perform some handling of the bounce before passing the details on to you. When you send email through Amazon SES you may notice that the...

View Article


Image may be NSFW.
Clik here to view.

Checking for NULL using Entity Framework

Here is a curious gotcha using the Entity Framework: If you are filtering on a value that may be null then you may not be getting back the results you expect. For example, if you do something like...

View Article

Image may be NSFW.
Clik here to view.

A better tracing routine

In .NET 4.5 three new attributes were introduced. They can be used to pass into a method the details of the caller and this can be used to create better trace or logging messages. In the example below,...

View Article

Image may be NSFW.
Clik here to view.

Debugging a process that cannot be invoked through Visual Studio.

Sometimes it is rather difficult to debug through Visual Studio directly even although the project is right there in front of you. In my case I have an assembly that is invoked from a wrapper that is...

View Article

Image may be NSFW.
Clik here to view.

But why is the iterator operating in multiple-threads

Background Recently, I had a bit of a problem with NHibernate when I was converting some code into parallel tasks. (If you have no interest in NHibernate, then don’t worry – it is just background to...

View Article


Image may be NSFW.
Clik here to view.

Round Robin class

We recently had need of a round robin functionality and since there is no round robin class built into .NET I needed to build my own class. It is a fairly simple algorithm, each call returns the next...

View Article
Browsing all 14 articles
Browse latest View live




Latest Images