Tuesday, December 28, 2010

Fluent API's

Martin Fowler coins the phrase
http://martinfowler.com/bliki/FluentInterface.html

Wikipedia
http://en.wikipedia.org/wiki/Fluent_interface

Monday, December 27, 2010

Enable/Disable Windows Proxy

http://ozansafi.wordpress.com/2009/07/05/enabledisable-change-ie-proxy-by-scriptprogrammatically/

To disable proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000000

To enable proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001

To change proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MigrateProxy"=dword:00000001
"ProxyEnable"=dword:00000001
"ProxyHttp1.1"=dword:00000000
"ProxyServer"="http://ProxyServername:80"
"ProxyOverride"=""

Copy these to a .reg file and double click on them to do the trick. The good part of doing it this way is that it works on every IE version(well, I haven’t tried any IE lower than IE6 and it is able to change it without even opening up anything.

Friday, December 24, 2010

VS2010 Client Profile - Namespace Reference Invalid After Build

So this is the scenario, in a project, add a reference to an assembly, then declare a variable of a type from the newly referenced assembly. Then type in the declaration, and you get the usual blue squiggly line. If you right-click then you get the option to add a 'using' reference to my assembly, and then bobs-your-uncle, all is good...

Until, you try to build the project, then for some ungodly reason VS no longer regards the namepace inclusion as valid, and spits out a

Error 377
The type or namespace name 'xx' could not be found (are you missing a using directive or an assembly reference?)

error, referring to exactly the same assembly ref that it just suggested be included.

This is, apparently, a dotNET 4 Client Profile Issue.

http://www.go4answers.com/Example/lost-references-while-building-project-143531.aspx
http://msdn.microsoft.com/en-us/library/cc668079.aspx

Friday, December 17, 2010

MS Castle Windsor [IOC Container] Cheat-Sheet

Martin Fowler
IOC Containers and the Dependency Injection pattern

Wiki: Castle Windsor

Fluent API
Fluent Registration API

INSTANCE REGISTRATION
- Can you register an existing instance of a type?
- Castle Windsor – Registering Existing Object Instances
- Can you register an existing instance of a type in the container?

REGISTRATION & RESOLUTION OF NAMED INSTANCE

IWindsorContainer.Register(Component.For<ClassType>().Named("instanceKey").Instance(instanceOfClassType));

ClassType retrievedInstance = IWindsorContainer.Resolve("instanceKey");

StackOverflow Thread

REGISTER & RESOLVE BASED ON INTERFACE


Register Types Implementing Specified Interface:

container.Register(
AllTypes.
FromThisAssembly(). // register all types from parent assembly
BasedOn). // that inherit/implement interface IDialogService
WithService.FromInterface(). // allow resolution based on interface
Configure(c => c.LifeStyle.Is(LifestyleType.Transient)) // construct new
);

Resolve Instance of Class by Interface

IDialogService dialogService = container.Resolve();



Note on Registering/Resolving Generic Lists by Instance
I have been unable to register & resolve generic lists, e.g. List, by instance.
However, if you wrap the generic list in a custom class, e.g.

public class IntList : List
{
}

then you can register & resolve by instance with no problems.

Tuesday, December 14, 2010

Techniques for Debugging WPF

http://bea.stollnitz.com/blog/?p=52

Monday, December 13, 2010

Re-Usable Controls in WPF

MSDN Article - Developing Reusable Controls with the Model-View-ViewModel Pattern
http://blogs.msdn.com/b/nathannesbit/archive/2009/03/13/developing-reusable-controls-with-the-model-view-viewmodel-pattern.aspx

WPF: Binding to Properties in your UserControl or Window
http://decav.com/blogs/andre/archive/2007/05/27/wpf-binding-to-properties-in-your-usercontrol-or-window.aspx

Sunday, December 12, 2010

unable to copy file to the process cannot access because in use another process visual studio

ISSUE

vs2010 build error: unable to copy file to the process cannot access because in use another process visual studio

FIX

add following lines of code to the pre-build event command line of your project.

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

Wednesday, December 8, 2010

Product Management

1. automated build server
2. deployment history - date, version number (+svn), feature list
3. bug/issue tracking

Friday, December 3, 2010

Handling Excel Formula Errors

the ISERROR() worksheet function can be used to test whether a cell or formula yields an error, and then by combination with an IF() function allows a branched response.