source code bean

Archive for the ‘.NET’ Category

In my previous post I showed you how to compile and install mono and get your MVC site up running using the development web server xsp4. The next step is to serve your site using a real web server, my choice is nginx. First, we need a configuration file for the nginx site. If you [...]

10 Mar, 2012

Deploying your ASP.NET MVC3 site on Mono

Posted by: Peter In: ASP.NET|C#|Mono

In this blog post I am going to show you how easy it is to create a new ASP.NET MVC site and deploy it on Linux/Mono. Step 1 – Create project Create a new ASP.NET MVC 3 project. Compile and run it.

11 Jan, 2012

MongoDB, C# and Mono

Posted by: Peter In: C#|Mono|NoSQL

MongoDB is one of the many free open source NoSQL databases that exist today. I wanted to try out how well the official drivers for C# worked when using Mono. On the MongoDB web site they have pre built binaries of MongoDB for almost every platform, i grabbed the 64 bit binary for OSX. No [...]

07 Dec, 2011

String interning in C#

Posted by: Peter In: .NET|C#

Last week a coworker sent me an interesting piece of code:   const string a = ""; const string b = ""; const string c = "hello"; const string d = "hello";   Console.WriteLine(ReferenceEquals(string.Empty, string.Empty)   ? "Not so surprising…"   : "Oh, the humanity!");   Console.WriteLine(ReferenceEquals(a, string.Empty)   ? "But I thought string was [...]

07 Oct, 2011

Updated version of SignalRChat

Posted by: Peter In: .NET|C#|Web

Yesterday I uploaded a slightly updated version of the test application I have built using SignalR. Besides from looking much better, it now uses the high level Hubs API (instead of the connection API) that SignalR provides. You find it here: http://signalrchat.apphb.com/ And you can find the source on GitHub: http://github.com/moberg/SignalRChat

26 Sep, 2011

SignalR – Real time web for .NET

Posted by: Peter In: .NET|Web

SignalR is a library for .NET to help build real time web applications, in a way it is quite similar to Socket.IO on Node.js. It consists of three main parts: SignalR.Server – .NET code running on IIS SignalR.Js – A SignalR client in javascript SignalR.Client – A SignalR client in .NET. Useful for communicating with [...]

02 May, 2011

Reference types are always passed by value in C#

Posted by: Peter In: .NET|C#

Last week i had a discussion with a friend about C# and passing parameters to methods. My friend asked why it is possible to use the ‘ref’ keyword for a reference type in C# when passing it to a method, he was under the impression that reference types are passed by reference to methods. This [...]

18 Apr, 2011

A simple image sprite generator in C#

Posted by: Peter In: .NET|C#

Last week I posted the source code to a small program I wrote in Java to merge images into a sprite. This week I present the same application but in C#, pretty much translated line by line using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq;   namespace NSpriteGenerator {     class Program [...]

06 Apr, 2011

AppHarbor – Heroku for .NET?

Posted by: Peter In: .NET|C#|Web

I have been reading about this new startup that offers a service called AppHarbor. It seems very much as the same idea as Heroku for Ruby, but for .NET. The basic idea is that you deploy your code by pushing your code onto the server using Git, the server then builds, runs unit tests and [...]

Yesterday I installed Visual Studio 2010 SP1 on my home computer. After the installation I wanted to upgrade MVC3 to the RTM version (I had the RC version installed), so i uninstalled the RC and downloaded the new version. The installation came half way, then stopped, in the log file i found this: Installation failed [...]


Adwords

About

Welcome to source code bean! On this site I post stuff that I encounter in my job and spare time. The content is mostly related to .NET development, but my interest in techonology is very broad, so often you will find posts on totally different subjects!