Del 4 och 5 är skrivna på pellesoft och kommer att släppas inom kort. Denna gång handlar det om WPF.
Tuesday, November 28, 2006
Thursday, November 23, 2006
Implicit UseSynchronizationContext==true may lead to deadlocks ...
Today I found a little gem on Mahjayar's blog on the use of CallbackBehavior and UseSynchronizationContext. Basically, if you have a duplex contract you might want to switch off UseSynchronization context, particularly if the client is WinForms (or WPF), or you might end up with deadlocks.
Add blogger Labels to Windows Live Writer
It seems that the "Insert Tags..." thing in Windows Live Writer is customizable enough that it is possible to add support for blogger labels by doing the following:
- Insert tags ... -> Choose (Customize Providers...) in dropdown list
- Add...
- Set provider name appropriately so that you know it e.g. blogger
- Set template to: <a href="http://obviously-your-blog-name.blogspot.com/search/label/{tag-encoded}"
rel="tag">{tag}</a> - Set tag separator to ", " (without the quotes)
- Set htm caption to "<span class="post-labels">Labels: {tag-group}</span>" (without the quotes)
If you do that, and add tags using that provider, the tags should work exactly as when blogging via web-ui.
EDIT: it seems that the labels do not show up on the edit posts page in the web ui. I wonder if that matters?
EDIT2: it looks correct but does not work... (
Wednesday, November 22, 2006
HOWTO: Read attributes from an enumeration member
Today I needed to read custom attributes from members of an enumeration type. As the found solution did not strike me as immediately obvious, I'm posting here for future reference:
Thing foo = Thing.Bar;
FieldInfo field = foo.GetType().GetField(foo.ToString());
object[] attrs = field.GetCustomAttributes(typeof(Description), false);
where Thing is an enumeration, defined something like:
public enum Thing {
[Description("Foo thing")]
Foo,
Bar,
[Description("Baz thing")]
Baz
}
Tuesday, November 21, 2006
.NET 3.0 artikelserie på gång
Friday, November 17, 2006
Php and security ...
I recently had the "opportunity" to look for security problems in an inherited php application. I found the following seemingly innocent line of code:
require($_GET['menu'].'.inc');
Well let's think about it a little..
- Imagine there is somewhere one or more users that are not all that friendly ...
- Imagine $_GET['menu'] is something that comes from a user ...
- Imagine that php treats the include():d/require():d code as php and not html
- Imagine that the include():d/require():d file would not have to exist on the same server
- Imagine that there somewhere on the Internet exists text/plain file containing php code
If that was true, then we would have a $h*tload of problems, right? Fortunately that's not true... ..right?
..oh, wait.. *all* of those are true. Oops...
Tuesday, November 07, 2006
.NET 3.0 RTM
Press release
Runtime
Readme
Visual Studio 2005 extensions for .NET Framework 3.0
.NET 3.0 SDK