c# (29)


LuceneWrap write.lock FIX

After getting a feedback on an article I’ve posted time ago on Codeproject I’ve updated the source code in order to fix an appended lock created after a search.  I’m posting here the project because the article is approved on Codeproject and to get it changed I’ll need to contact the staff, wait, post the […]




Asp.net user authenticated after signout.

The Asp.net Membership relies on cookies to store the FormAuthentication ticket of a user, this means that we have to remove the cookie in order to signoff from our application. When an user is logged a cookie containing the encrypted ticket is stored on the client machine: public void CreateUserCookie(string username) { //Expiration of the […]




MARS Rover Exercise in C#

The Mars Rover simulation is one of the most popular tests spreaded by companies wich want to screen candidates with a pratical test. Here’s the requirements: ” The problem specified below requires a solution that receives input, does some processing and then returns some output. You are free to implement any mechanism for feeding input […]




Easy Jquery validation in Asp.net 4

With Asp.net 4 comes a new property named ClientIDMode wich allow us to take control over the control ID rendered client side. The property can be applied at: Page level, all the controls within page will maintain the same ID specified by the developer : <%@ Page Title=”” Language=”C#” MasterPageFile=”~/MyMaster.Master” CodeBehind=”NewFeature.aspx.cs” ClientIDMode=”Static”…. Control level , […]




C# Text Encoding and Transcoding in few steps

While developing on a tool that to allow user to enter a message in whatever language and to print it I discovered that I didn’t know enough about character encoding. Character encoding is is a set of unique rapresentations called character: they can be the 26 letters of the English alphabet or even the set […]




Resize image to be web friendly

There’s already a post about this subject on the blog but it is in italian, I want to propose it again because the task of resizing and slim the pictures we got (for facebook, for our blog) is a common task we are all used to. Here’s the code and a small console app you […]




Increase message size in WCF

During the testing of a WCF service, for certain requests I started to get the following error : “The maximum string content length quota (8192) has been exceeded while reading XML data”. While on a classic asmx web service in order to specify the maximum lenght for a request with the tag <httpRuntime> in WCF […]




WCF – Merge WSDL in a single file

It can happen that old clients dislike the way WCF separate WSDL descriptors. By default, a WCF service contains the full WSDL in an external “link” specified by the wsdl:import directive. If I browse the following service http://localhost:8695/GiftMessageService.svc?wsdl i’ll get a description of the service (like ports, address) but nothing about the soap actions and […]




Two easy ways to expose a WCF as a WebService (even asmx)

Assuming we’re all using Visual Studio 2010, start by creating two projects: a WCF Service library project and a WCF The service library will contain the contracts and their interfaces with all the service attributes while the service application will be the project exposed by our web server, it will have the *.svc and *.asmx […]




NUnit factories

I was getting mad to find out how to use factories on NUnit. I’ve been using factory methods with MBunit and they’re definetly helpful when you need to execute a test using several imputs. What was confusing me is the NUnit documentation: I’ve googled something like “NUnit factory” and the first results were pointing me […]