10 posts with tag Programming

.NET: Disabling SSL Certificate validation

Yesterday I wanted to download some content off a website with F#, however unfortunately the certificate of the website was expired. let result = try let request = "https:…

· 2 minutes reading time

DynamoDb & updating objects: it doesn't react like SQL!

Today I stumbled upon the following bug: We had an object with some properties that we wanted to update, but only if a certain property of that object is not set, i.e. it should be null. { "I…

· 2 minutes reading time

When frameworks try to be smart, AngularJS & Expressions

One of my colleagues just discovered this bug/feature in AngularJS. Using an ngIf on a string "no" will result in false. HTML: <div ng-app> <div ng-controller="yesNoController"&…

· 1 minute reading time

Enabling dynamic compression (gzip) for WebAPI and IIS

A lot of code on the internet refers to writing custom ActionFilters, or even HttpHandlers that will compress your return payload for you. For example, see this package (which with its name implies th…

· 1 minute reading time

The impact of SqlDataReader.GetOrdinal on performance

I recently had a discussion about the impact of SqlDataReader.GetOrdinal on execution of a SqlClient.SqlCommand. I then decided to run some code to measure the difference, because I think that's the o…

· 3 minutes reading time

TransactionScope & SqlConnection not rolling back? Here's why...

A while back we ran into an issue with one of our projects where we executed a erroneous query (missing DELETE statement), and then left the database in an inconsistent state. Which is weird, consider…

· 2 minutes reading time

About a dictionary, removing and adding items, and their order.

I had a weird problem today using a Dictionary. The process involved removing and adding data, and then printing the data. I assumed that it was ordered. I was wrong! Let me show you: var dictionary =…

· 2 minutes reading time

Default values and overloads are not the same!

Consider the following class of the Awesome(r) library, using default parameters. public class Foo { public void DoCall(int timeout = 10) { /* awesome implementation goes here */ }…

· 1 minute reading time

C# 5.0 spec is available online now!

A few posts ago I blogged about C# 5.0 and foreach. I mentioned a part of the docs, but those weren't online yet! They are now! http://www.microsoft.com/en-us/download/confirmation.aspx?id=7029 Enjoy …

· 1 minute reading time

When using an enum in PowerShell, use the member's name, not the member's value

Consider the following enum in C#: enum State { Started, Stopped, Unknown } Note that I have not added an explicit value for the enum members. They will be generated by the compiler. As st…

· 2 minutes reading time