Jul 12, 2012

MVC Html helper values and ModelState

Surprisingly, if you do a return View(model); in your postback action, the @Html.EditorFor helper does not use the values from the passed model, but the values from the ModelState are used instead. Supposedly for form input persistence reasons, but does not make sense to me since you explicitly pass on the model. To still use the html helpers and the model, you can clear the ModelState first in your action: ModelState.Clear();

 

May 15, 2012

Mercurial repository migration

Can be used to move a folder from one repository into its own repository. E.g.:
hg convert --filemap migrationMap "C:\Dev" "c:\src\MyProject"

 

migrationMap is a file with:
include MyProject
rename MyProject .

May 8, 2012

Earthlings movie / Фильм Земляне







Certificate access permissions

In Windows Resource Kit there is a utility winhttpcertcfg.exe.

List certificate key permissions:
winhttpcertcfg.exe -l -c LOCAL_MACHINE\My -s "certificate.name"

 

Grant permissions to a certificate key:
winhttpcertcfg.exe -g -c LOCAL_MACHINE\My -s "certificate.name" -a WindowsAccount

 

Grant account permissions to run as a Windows service:
Logon as service policy

 

Grant account permissions to run as an ASP.NET application service:
aspnet_regiis -ga WindowsAccount

 

Give WindowsAccount write permissions to C:\Windows\Temp

If the certificate is not in this store and you want to move it there from another location, you must export the certificate and then import it. Do not drag and drop it in the Certificates MMC UI or it won't work.

Apr 13, 2012

PostSharp

http://www.sharpcrafters.com/

Aspect-oriented framework for .NET.

Name: OnExceptionAspect
Level: method
Note: exception handling in a marked method

Name: OnMethodBoundaryAspect
Level: method, class, assembly
Notes: intercepts certain points in a method’s execution: OnEntry, OnExit, OnSuccess, OnException

Name: MethodInterceptionAspect
Level: method
Notes: replaces method's contents that can be invoked
Example use: wait/retry, automatic thread delegation, lazy loading and validation

Name: LocationInterceptionAspect
Level: field, property
Notes: OnGetValue and OnSetValue
Example use: lazy loading, IoC Resolution