-
Formating strings in C#, like in Python
I like Python’s way to format strings because you can use it everywhere, it’s part of the strings. You can do print(“Welcome %s!” % user.name) as you can do Console.Writeln(“Welcome {0}!”, user.Name) But then in Python you can also do randomMethodThatTakesAString(“Welcome %s!” % user.name) In C# it gets trickier, because the call to Console.Writeln takes…
-
File input for forms in ASP.NET MVC
I’m not sure why ASP.NET MVC was shipped without a file input type for forms. Maybe it’ll come in MVC 2.0 or 3.0. Meanwhile, I created one. I spent two or three hours trying to figure out how to go from Object to IDictionary<String, Object> to follow the same ASP.NET MVC style where you have…
-
Converting the ASP.NET MVC project into OpenID
When you create an ASP.NET MVC project it comes with a controller called AccountController that manages logging in, logging out, registering, changing password and so on. Since usernames and passwords are dead I converted it into OpenID and I’m just pasting it here for everybody to use. I’m using the DotNetOpenAuth library which you have…
-
SVGs in .Net using Cairo and Gtk+ (and C#)
If I was using C it would have been simply a couple of calls to librsvg, but on C# things got a bit more ugly because Rsvg, the wrapper around librsvg is not finished. And other bindings are also missing. Just getting a Cairo context out of a Gtk.DrawingArea was not as simple as I…