foreach image in a resource file

Today, I was working with artificial intelligence. In order to perform the training I had to load images. Well, surely I wasn't going to go through every instance of the image and learn like this:

Instead, I used ResourceSet like so:

Much neeter

Get freezes when making Push

Today I had to upload files to a remote Git repository and I encountered a very annoying error. Being on windows I used TortoiseGit to help me. So I had a workspace which I had to push to the server. The problem was that I was getting to 61% and the whole thing started freezing...

Useful Linear Trendline Class in C#

I've searched and searched trying to find a simple class to calculate a slope and intercept from a set of points. Here is the outcome, but I probably modify it to use LINQ rather then loops

Displaying an image from binary source (like a database)

Today I had to display an image from the database on the website. Here is the code:

This expression should be of type 'unit', but has type 'int'...

Today, I started learning F# to use Infer.NET. It's a shame MS doesn't support it any more. The second line and already got an error. Not a good sign...

This however is useless. Unlike Haskell, F# doesn't print the result unless explicitly stated. So we need to be a bit more clever than...

Splitting Web.config into multiple files

Reading large XML isn't fun and that's kind of what started happening to my web.config file: tracing, entity framework, database connection strings, service endpoints definition etc, etc, etc... Thankfully there is a way of splitting the web.config into multiple files so that it is easier to read and modify. Create new config file: preferably with...

Using Tracing with WCF Service Log

Using tracing can be very beneficial especially when the application has already been deployed and we need to figure out why it doesn't work. Useless errors of type: 500 don't give any meaningful results, so I decided to use System.Diagnostics to help me track down the errors. Logging There are two important (and very simplifed...

“An existing connection was forcibly closed by the remote host” error in WCF service

That was an interesting one. There was only one method in the service that was causing that. On stackoverflow there were several pointers, but all of them were pretty useless. It turned out that its all about iheritance of [DataContract]. I had a simple service that was returning an object:

From there there was...