Collection of Tools

Here is a list of best kept secrets that developers keep under their hats for looking in to what your Windows system is doing:

svchost Viewer – A program to see what all those svchost.exe are running.

AutoHotKey

Launchy

Notepad2

GhostDoc – Make those comments and documenting classes, methods and properties so much easier

SysInternals 
  ProcMonitor

Paint.Net – it goes without saying, probably the best free image editor around

Unlocker – Got a file locked, free that lock 

TestDriven.Net

MSBuild Extension Pack – If you are building a Continuous Integration server, you are going to have to have these tools

Portable Apps – A must when you are working on clients site, means you have all the tools on your portable drive that you can load without the need to install anything on the clients machine

Picasa photos in your BlogEngine site

I’ve been having a play with Picasa API, and come up with this Extension for BlogEngine.

All you have to do is pake the picture.cs file and place it in “\App_Code\Extensions” folder, and it takes care of everything for you.

Picture.zip (1.92 kb)

How it works

First the extension will use the admin email address and then add all the newletter e-mail address to a user list, then check with Picasa to see if they have an account.  The extension then has a list of user with valid Picasa Albums.

When you open an article the extension will go over all the Tags and see if any of the Picasa Albums in your user list has the same tags, if it does then the photos will be added to the article.

I do Cache the objects, so once the initial load of the article has taken place it is stored in Cache, as it can take some time to compile the list of photos depending how many active user Picasa Albums you have.

One enhancement I would like to include is for the loading of the photos to happen behind the scenes and show a wait icon while the extension goes and gets the photos from Picasa.  But I’m not sure how to do this in an Extension, if you know please let me know too.

I’ve got it working on my Village Website

http://www.bromham.org.uk/

Caching from a non Web applications

Okay you are developing a WinForm application and you are looking at performance, one area is Caching of information, but wait a minute I’ve been using caching in my web applications for sometime, but how do you do it from a WinForm application as you don’t have a host to store your cache.

Would you know it you can use the web cache too, just you have to take a few extra steps to retain your cache, either in memory or in temporary files.

You can use the HttpRequest to store the System.Web.Cache objects in your application, and this works well.

I also came across any Blog, providing another method to Caching, however I have a little concern over this method of caching in files as you are likely to get file locking.

Using System.Web.Caching From The Console Or Windows Forms

I’ve written my own simple VB.NET application to show it working and just holding the Cache in memory for the life of the application.

WinFormCache.zip (17.73 kb)

Of course you could run a Windows Service which holds all the Cache information, this way it will be available to all your WinForm applications should you require it.

Entity Framework Issues

I’ve come across two issues with the Entity Framework, one that effects any language and one just for VB.NET

It’s quite simple, the Entity Framework generates edmx files, however that Inherits Global.System.Data.Objects.DataClasses.EntityObject, which means when you create your Partial class you can not Inherit from your own base class.

The second issue is related to VB.NET, as if you are intending to use Dependence Injection or IoC you need to have an Interface defined and to implement an Interface in VB.NET you must add Implements after each Property and Method, which you can not do as the framework generates it’s own code.

I’ve attached both C# and VB.NET examples, none of which compile

Entity Framework Issues.zip (42.58 kb)

HTTP Sniffer

Why can I never seem to remember the name of software I have used before?  Perhaps that is one reason why I try to keep my blog up to date, as I use it as a brain dump of tasks I have been working on, so when my memory fails me I can also revert to my Blog and perform a search or look at the archive and find what I as working on say 2 years ago.  I know softare moves on, but I always find some software no matter how old it is, just can’t be beaten.

One piece of software that I always go back to is Fiddler, HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Of course if you are using Visual Studio and the in built web server, which works without going through the Proxy, at it is running locally.

IE7 and the .NET Framework are hardcoded not to send requests for Localhost through any proxies, and as a proxy, Fiddler will not receive such traffic.  Here is a snippet from fiddler web site which works very well.

The workaround is to use your machine name as the hostname instead of Localhost or 127.0.0.1. So, for instance, rather than hitting http://localhost:8081/mytestpage/, instead visit http://machinename:8081/mytestpage/. 

…Or, if you’re using Fiddler v2.1.8 or later, just use http://ipv4.fiddler to hit localhost on the IPv4 adapter, or use http://ipv6.fiddler to hit localhost on the IPv6 adapter.  This works especially well with the Visual Studio test webserver (codename: Cassini) because the test server only listens on the IPv4 loopback adapter.

Lastly, you could Customize your Rules file like so:

static function OnBeforeRequest(oSession:Fiddler.Session){

  if (oSession.HostnameIs(“MYAPP”)) { oSession.host = “127.0.0.1:8081”; }

}

…and then just hit http://myapp, which will act as an alias for 127.0.0.1:8081.

this and that