Archive for the 'C#' Category

Weekly Links – node.js, Processors, Microsoft, and more

Since I’m having trouble producing full-length articles at the moment, I thought I’d try a different track to at least get some value out of my blog hosting costs. I’ll try to post a handful of links that have caught my attention each week.

.less – Dot Less Dynamic CSS Processor for .NET

Of the three textual formats that make up the main pillars of web development (HTML, CSS, and JavaScript), CSS has had the least attention in terms of server-side processing. HTML is obviously well covered, with frameworks such as ASP.NET. JavaScript is starting to be covered with compilers such as Google’s Closure Tools. Until now however [...]

Forcing The Browser To Cache Dynamic Content In ASP.NET

Usually, you don’t want the browser doing any kind of caching on dynamic content served from a generic handler (.ASHX) in ASP.NET – afterall, the content is usually changing (dynamic). Sometimes however, it’s handy to use a handler to serve content that effectively never changes. Here’s how.

Using WPF To Generate Web Images

Recently I needed to display rotated graphics within a web-page. Since there’s no way to do that cross-browser using CSS, I needed to auto-generate a collection of pre-rotated images that could be displayed as CSS sprites. I’ve found that WPF (Windows Presentation Foundation) is great for generating batches of images suitable for use in web [...]

Closures: Simplify Event Handling Code

Closures are a really useful programming construct, but as they’re only just appearing in the C-family languages, they’re relatively new to me. In this article I show how they can be used to vastly simplify event-handler code in web development.

Controlling Browser Content Expiration in ASP.NET

Correctly controlling content expiration is a tricky thing. You need to balance two goals: getting the browser to cache as much as possible to reduce page load times and bandwidth, versus not showing the user stale content. In this article I’ll cover a simple technique (with code) to solve this issue in ASP.NET for stylesheets [...]

How-To: Delete a cookie in ASP.NET

Deleting a cookie from ASP.NET is something that trips up a lot of people (myself included when I first started ASP.NET coding). Here’s how:

LINQ-to-Entities: Follow-Up

There’s been a bit of discussion about my last article, “LINQ-to-Entities: The Blackberry Storm of ORMs?“. I thought I’d try to clear up a bit of what I was trying to say, especially with regards my statement about LINQ-to-Entities returning differing values depending on code order.

LINQ-to-Entities: The Blackberry Storm of ORMs?

(In case you missed the reference, the new Blackberry Storm has been widely slammed as an inferior copy of the iPhone, and was released basically unfinished to try to fend off its better rival).
Note: the first part of this article is a bit of an opinionated rant – if you want to skip to the [...]

A Quick C# Teaser

Look at the following C# code, and work out why it compiles:

namespace X
{
class Foo
{
void Bar()
{

http://www.hackification.com

System.Console.WriteLine();
}
}
}

(Hint: it’s not an error, but it is a warning.)
Idea originally from here.
Oh – and please, please, [...]