Archive for the ‘ Programming ’ Category

Implementing the abs() Function in Plain C or C++

This article describes how to calculate the absolute value of an integer without using any built-in functions in C or C++. The problem is based on an interview question that I used to ask candidates every once in a while, and it was not so much about coming up with an algorithm, but rather about understanding why the proposed algorithm works.

Read more

jQuery Plugin to Convert CSS Pixels to em, pt, percent and other Units

This article presents a small jQuery plugin to convert the dimensions of HTML objects to various CSS units, such as em and percent. The code is based on a popular implementation from the internet and fixes a subtle problem with the original conversion calcuation.

Read more

Custom View Engine for Localized Views with ASP.NET MVC Razor

This article describes how to localize ASP.NET MVC page views and partial views by providing separate Razor templates for each language. Used in combination with localization through resource files and metadata, this approach leads to a cleaner project structure and allows for localizing a web page without having to recompile. However, it comes at the cost of some duplicated markup.

Read more

Disabling Client-side Caching in RavenDB

While editing documents in RavenDB Management Studio for testing, it became evident that the changes were not reflected in the website that was using the database. By default, RavenDB caches client queries. This article describes how to disable this feature, should the need arise.

Read more

Custom Display and Editor Templates with ASP.NET MVC 3 Razor

Much has been written on how to create custom templates for ASP.NET MVC 2 and earlier versions, as well as the default MVC view engine. Customizing the default templates in MVC 3 using the Razor view engine is just as easy, but not exactly obvious if one doesn’t know where to start. This article provides some quick example code for replacing the default custom templates for Object view models.

Read more

10 Command-Query Responsibility Segregation (CQRS) Examples in C#

Software architectures using Command-Query Responsibility Segregation and Event Sourcing combine a range of design patterns and ideas from Domain Driven Design. Although the individual concepts are relatively easy to grasp, understanding the entire architecture can be a daunting task, especially for developers who have limited or no experience with DDD and Enterprise Software Architecture. This article has a lists of 10 open source projects on the internet that provide good starting points.

Read more

Persistence Ignorance: The Unknown Ideal

Persistence Ignorance is a fairly new concept that is getting more and more attention amongst software developers, but its implications and the problems with current implementations are still not widely understood or appreciated. This article attempts to shed some light on the topic and questions whether pure PI is even possible with today’s development tools.

Read more

Code Signing ActiveX Controls and Windows Programs

Digitally signing Windows software is straightforward and can be performed in a few simple steps. Unfortunately, the documentation for the overall process is spread across many web sites, which further adds confusion to the terminology, file types and available tools. This article is an attempt to summarize the process under Windows from a practical perspective and without adding too much technical detail.

Read more