Archives
-
A new approach to Web Forms
Mike Roberts talks about a new approach to WebForms, he is the author of CruiseControl.Net a continuous integration software for .Net.
Extract
'What??' you may cry. 'You've stopped using ASP.NET??' No, I've just stopped using Web Forms. Web Forms are those
http://mikeroberts.thoughtworks.net/blog/archive/Tech/dotNet/GoodbyeWebForms.html.aspx
files you write and their code behinds. They're also the things that use server controls, view state and other such components that make up most of .NET web apps. I'm still using the ASP.NET runtime in the form of an IHttpHandler. This is a much more lightweight way of developing web apps, similar to Java's Servlets.
-
Spam Filter technology to fight AIDS
Microsoft Research has pioneered promising new ways to combat one of humankind's most deadly viruses with advanced software typically used to analyze large computer databases and complex digital images, or to separate spam from legitimate e-mail.
-
Tidbit on VisualStyles in Windows Forms
I wanted to implement theme support for my MessageBox component mentioned in the previous post, I came acorss this excellent post on how Application.EnableVisualStyles() works. So basically it uses the Activation Context API to specify that the v6.0 of common controls should be used.
When I looked at the API, I found that you have to specify a manifest file to specify that information. Now where does that manifest file come from? So I fired up reflector and this is what I found. Below is the code for the method that creates the ActivationContext for your application.
private bool EnsureActivateContextCreated()
{
bool flag1;
lock (typeof(SafeNativeMethods.EnableThemingInScope))
{
if (!SafeNativeMethods.EnableThemingInScope.contextCreationSucceeded)
{
string text1 = null;
FileIOPermission permission1 = new FileIOPermission(PermissionState.None);
permission1.AllFiles = FileIOPermissionAccess.PathDiscovery;
permission1.Assert();
try
{
text1 = typeof(object).Assembly.Location;
}
finally
{
CodeAccessPermission.RevertAssert();
}
string text2 = null;
string text3 = null;
if (text1 != null)
{
text3 = Path.GetDirectoryName(text1);
text2 = Path.Combine(text3, "XPThemes.manifest");
}
if ((text2 != null) && (text3 != null))
{
SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext = new SafeNativeMethods.EnableThemingInScope.ACTCTX();
SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext.cbSize = Marshal.SizeOf(typeof(SafeNativeMethods.EnableThemingInScope.ACTCTX));
SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext.lpSource = text2;
SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext.lpAssemblyDirectory = text3;
SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext.dwFlags = 4;
SafeNativeMethods.EnableThemingInScope.hActCtx = SafeNativeMethods.EnableThemingInScope.CreateActCtx(ref SafeNativeMethods.EnableThemingInScope.enableThemingActivationContext);
SafeNativeMethods.EnableThemingInScope.contextCreationSucceeded = SafeNativeMethods.EnableThemingInScope.hActCtx != new IntPtr(-1);
}
}
flag1 = SafeNativeMethods.EnableThemingInScope.contextCreationSucceeded;
}
return flag1;
}
So the manifest file is called XPThemes.manifest, the intresting thing was how the code determines the directory in which to find the file, the relevant line of code is
text1 = typeof(object).Assembly.Location;
Since object is defined in mscorlib.dll and that is present in the directory where .Net is installed
the code can get the location where it can find XPThemes.manifest
If you search for XPthemes.manifest it will be present in the folder where you installed the .Net runtime.
-
Reusable MessageBox component
I've just posted my first article on CodeProject at http://www.codeproject.com/cs/miscctrl/MessageBoxEx.aspIt's reusable and customizable Message Box component that allows you to add custom buttons, icons, fonts and provides "Don't ask me again" functionality.
-
Tool for analyzing .Net assemblies
NDepend analyses .NET assemblies of an application and generates design quality metrics. NDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability and maintainability to effectively manage and control the assemblies’ dependencies of your .NET applications. Moreover, NDepend helps you to get a thorough view of the topology of your application, at component at type and at member level.
Check out the sample report they have on the site. Really cool indeed.
http://smacchia.chez.tiscali.fr/NDepend.html
It's been developed by the same guy who has written this excellent article on iterators in C# 2.0 that not only talks about iterators but also about some cool ways to use iterators in your applications.
http://www.theserverside.net/articles/showarticle.tss?id=IteratorsWithC2
-
Windows keyboard shortcuts at Neowin
Neowin has a nice post on keybaord shortucts for windows
http://www.neowin.net/forum/index.php?showtopic=251731
-
Cool firefox stuff
Do you want a build of FireFox 1.0 that is optimized for your processor? You can get it at
http://www.moox.ws/tech/mozilla/firefox.htm
Also one cool FireFox wallpaper
http://www.wincustomize.com/ViewSkin.aspx?SID=1&SkinID=21787&LibID=8
-
Richard Grimes has stopped writing on .Net
I was just looking for the great workshop on Fusion written by Richard Grimes I saw on the front page of his site that he has stopped writing about .Net. That was quite odd considering that he has written some great articles and books on the subject and is a regular speaker in various events. Googling revealed that he has written an article in DDJ detailing his departure from .Net.
You can read his thoughts on why he does not want to associate with .Net anymore here. You'll need to register to read the article.
-
Cool class of the day - ISerializationSurrogate
I was doing some research in custom XML serializaton in .Net. The problem is the same as the O-R problem for database persistence, the difference here is the level of support that .Net provides in helping with that serialization. I stumbled upon a great site for XML related information http://www.topxml.com and while going through some tutorials on that site came across this cool class called ISerializationSurrogate. You can read more about it here http://www.topxml.com/xmlserializer/surrogateselectors.asp
Basically it allows you to move the serialization code away from the object being serialized. A class that implements this interface can act as a surrogate for the class that it serializes. So that's another hook you can use to customize your serialization.
-
del.icio.us
A couple of days back i was looking for an online bookmark manager, i found some really good and free ones but the one that caught my eye was http://del.icio.us . It is a social bookmark manager, what that means is that when you add a new bookmark you can see what category other people have added that link in, you can then see other bookmarks in that category to discover new sites related to the one you are bookmarking. The best thing is that all these categories are available as RSS feeds, so you can subscribe to the feed for that category and whenever anyone adds a bookmark in that category you get notified. Not only that you can subscibe to the most popular bookmarks in a paticular category.
Here is the help that describes the RSS feeds that are available
» del.icio.us offers you many ways to view your own and other people's bookmarks. Understanding how del.icio.us URLs work makes it easier to see exactly the bookmarks you want.» Every user has a unique homepage:del.icio.us/geoffrey
» Tags also have their own pages:del.icio.us/tag/politics
» You can filter bookmarks by user and tag together:del.icio.us/geoffrey/literature
» This will show all bookmarks from user geoffrey tagged as 'literature'.» Use plus signs to combine multiple tags into a tag intersection:del.icio.us/tag/politics+france+history
» This will display only bookmarks that have all three of the tags 'politics', 'france', and 'history'. This also works for user/tag combinations:del.icio.us/geoffrey/literature+english
The interface is a bit spartan with almost no images at all. But the site is fully functional. I've already discovered some cool sites using this. It works in Firefox as well as IE and other browsers via a bookmarklet, pretty easy to setup. This is one cool concept.