Wednesday, November 28, 2007

.Net documentation missing

Just figured out that the HtmlWriter.AddAttribute() does an encoding based on the HtmlTextWriterAttribute enum you give as the first parameter. How? By inspecting the source code of Mono. With this knowledge I searched MSDN, but couldn't find a thing.

The bottomline: don't use a writer.AddAttribute(HtmlTextWriterAttribute.Href,
HttpUtility.HtmlAttributeEncode(url));
because then you're encoding twice.

The list of attributes which enode is:

HtmlTextWriterAttribute.Accesskey;
HtmlTextWriterAttribute.Alt;
HtmlTextWriterAttribute.Background;
HtmlTextWriterAttribute.Class;
HtmlTextWriterAttribute.Href;
HtmlTextWriterAttribute.Onchange;
HtmlTextWriterAttribute.Onclick;
HtmlTextWriterAttribute.Src;
HtmlTextWriterAttribute.Title;
HtmlTextWriterAttribute.Value;

Monday, November 12, 2007

PowerShell Shutdown COM+

To shutdown a COM+ object, so you can redeploy the binaries it uses, I had a VBS script to do it. I wondered how I could do it in PowerShell, but lacked time to do so. I just stumbled upon some code to do it, though.

The old script was:

Dim oCatalog ' As COMAdmin.COMAdminCatalog
Dim sName 'As String
Dim sMachine 'As String
Set oCatalog = CreateObject("COMAdmin.COMAdminCatalog")
sName = "Tridion Content Manager"
sMachine = "tridionserver"

oCatalog.Connect sMachine
oCatalog.ShutdownApplication sName



And this became:


$TridionAppName = "Tridion Content Manager"
$TridionMachine = "tridionserver"

$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$comAdmin.Connect($TridionMachine)
$comAdmin.ShutdownApplication($TridionAppName)


(Just leave the line with the call to connect out to run this on your local machine).

Saturday, November 3, 2007

Take screenshots of web pages with FireShot!

Take screenshots of web pages with FireShot!
Works with Firefox, and can grab a bitmap of the whole page (and not only from the visible area).
Very handy while debugging the design for your website (and since I'm currently implementing a css design while communicating the bugs back to the CSS designer), this tool can save some time annotating and merging bitmaps.

Friday, November 2, 2007

VS: Copy Sourcecode as Html

Although I've a javascript on this blog running to highlight code, this solution might be a lot easier.

Share