Singleton in C#
To implement Singleton Pattern in C#, that is easy. I like to static class. For example:
Code
public static class GobalData | |
{ | |
public static Group Group {get;set;} | |
} |
HOWTO: Find a Physical Path in ASP.Net from URL
In a number of situations, we need to know a Physical Path in a server from URL. For example, we need to upload some photo. Thus, this is a very common task, and is very easy to do in C#
Code
string serverPath = Server.Map("~/Photo"); // e.g. it returns "C:\site\Photo" |
ADO.Net is still being used
I am still using ADO.net and very simple applications. ADO.net is more flexible. I got more control to translate sql into objects for the presentation. Moreover, for simple applications, that is too much for using LINQ or other ORM. This is a bit over kill. I still recommend you to consider to use ADO.net, that is classic and useful!
Umbraco Contact Us Form
I am started to use Umbraco. But I found there is no form engine. I cannot create a contact form without coding. But I found there is a good contact form package, Cultiv Razor Contact Form. That is easy to use too.
You just need to this line into your template:
Code
<umbraco:Macro FileLocation="~/macroScripts/CultivContactForm.cshtml" MailFrom="[email protected]" runat="server" /> |
windows 8.1 preview
Recently, I went a microsoft meeting. There were a number of people tried Windows 8.1 Preview. According to what I heard, although it will be not very stable in some situations, they are happy about the improvements, such as better sky drive and windows store. The most interesting thing is everyone mentioned the "Star" is back!