Opening new windows

Some installations/setups of windows/internet explorer seem to prefer to open especially office documents within the browser-window, instead of starting word or excel and showing the document there.

So it turns out, that this is actually a setting of the windows explorer. Just go to Tools\Folder options\File Types select a file type of your choice (preferably a type, which is being opened within IE) and then remove the check from the setting open in same window from the extended properties page.

Yo activities – move it!

OK, so it started as a nice little app, which leveraged Windows Workflow Foundation. So I created an initial workflow and then some custom activities. Later on I figured, that those activities needed some tuning, so I modified them.

That was the point where I realized that custom activities and workflow-definitions should not reside in the same assembly!! All my existing (and persisted) instances could not be deserialized anymore πŸ™

OK – so what do we have refactoring for? So I moved all my custom activities to a newly create library-project. Just in time to figure, that this wouldn’t work either. Workflow Activities cannot reside inside just any c# project – it has to be a workflow-activity-library-project (what else would you expect!?).

After moving the activities once more it finally compiled … πŸ™‚

Defeading reporting services

I had a real hard time installing SQL-Server 2005 Reporting-Services on this one machine …

The MSI was executing just fine, but the step “removing backups” (don’t know the exact wording in english, since I’m using a german installation) seems to fail.

This is what the msi logfile has to offer:

Aktion 15:59:51: RSSP_CAInstall.28B19132_4741_4761_840F_AC515130EC08.
Aktion 15:59:52: RollbackCleanup. Sicherungsdateien werden entfernt
CA MSG : Running RSCustomAction
CA MSG : Launching C:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\rsCustomAction.exe with command line parameter /i
CA MSG : rsCustomAction.exe failed to configure, Error code is: 1
Aktion 16:02:48: Rollback. Aktion wird rΓΌckgΓ€ngig gemacht:

After much struggle I finally figrued something. First I installed SharePointRS.msi without the custom actions, by executing:

SharePointRS.msi SKIPCA=1

OK. So next I just run the rsCustomAction.exe (which is located in my temp-folder):

rsCustomAction.exe /i

This finally produced some logfiles and a more details error message. In my case the problem was, that the web.config of my portal-site was write-protected!!

After removing the write-protection I was able to install SharePointRS.msi just fine.

NHibernatin' composite ids

So I tryed my way with NHibernate today, just doing some plain-old CRUD stuff. So I hooked up ye ol’ Norhtwind Database and tryed to create some objects. Ok, so I came up with Customers, Orders, OrderItems (called Order Details in the database) and Products. But wait – there is a slight problem: OrderItems has a so called composite-id. Although this is covered by NHibernate, this took quite a while to figure out. First of all I had to create the correct mapping file:

<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping
assembly=Business'
namespace=Business'
xmlns='urn:nhibernate-mapping-2.2'>
<class name='OrderItem'
table='[Order Details]'>
<composite-id>
<key-many-to-one name='Order'
column='OrderID'
class='Business.Order, business' />
<key-many-to-one name='Product'
column='ProductID'
class=Business.Product, business'/>
</composite-id>
<property name='UnitPrice'/>
<property name='Quantity'/>
<property name='Discount'/>
</class>
</hibernate-mapping>

After compiling this, I got a nice little error, telling me, that I should override the Equals() method. Ok, so I did how I was told, and came up with:

public override bool Equals(object obj)
{
//return base.Equals(obj);
OrderItem other = obj as OrderItem;
if (other != null) return (order.Id == other.order.Id) && (product.Id == other.product.Id);
else return false;
}
public override int GetHashCode()
{
//return base.GetHashCode();
return order.Id.GetHashCode() & product.Id.GetHashCode();
}

This finally did it πŸ™‚

Feeding the RSS

So I finally got around to enable RSS-feeding of my plone site. Currently this is only limited to the blog … but that’s just a matter of configuration.

In retrospective this wasn’t so hard to do, so I wonder why I didn’t do this before πŸ™‚

OK, so how is this done? First of all you need to enable portal_syndication in the ZMI, and make the portal-action for syndication visible as well. Next you need to enable syndications explicitly for a certain object (folder).

Last you might want to edit the rss-template from the skins-folder (portal_skins/plone_templates/rss_template) to include the content body as well as just the description. To do this you have to add:

<content:encoded
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<span
tal:replace="structure python:
'\074![CDATA['+obj_item.getBody()+']]\076'">
Content
</span>
</content:encoded>

just below the description element.

Pluggin NHibernate into Visual Studio

OK, so you’ve managed to work with NHibernate as well as with the hbm-files; respect!

But after looking at Visual Studio 2008, and at what ease you can create some domain-model using Linq to SQL …

But wait! NHibernate Plugin offers a visual aid to get your mappings done.

As always there seems to be some catch πŸ™‚ I’m running a german localized version of Visual Studio 2005, so my item-templates should reside in a folder below my language-code (1033 instead of 1031). Unfortunatly the installer does not recognize my locale, so the item-templates are placed in the wrong directory. Just move the Nhibernate.zip from C:\Programme\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1031 to C:\Dokumente und Einstellungen\[USERNAME]\Eigene Dateien\Visual Studio 2005\Templates\ItemTemplates\Visual C#\1033 and the item-template will show up πŸ™‚

Configuration of log4net … in class libraries!

When you’re using log4net to do your logging, you want to configure log4net at the earliest possible point in time.

I console- or winforms-applicartion this is easy to do, just add the appropriate code to your static void Main(). Even in web-applications this can be achieved quite easily, since you can make use of the global.asax and the Application_OnStart() event.

But how about a class library? Adding the code below:

// Configure log4net using the .log4net file
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]

to you AssemblyInfo.cs will make sure, that the log4net.config is being read as soon as the class library is access the first time.

Doing the housekeeping

Well, so spring is (almost) there – so it’s time to do some spring-cleaning πŸ™‚

OK, so I’m a little ahead of schedule – so what?

So I wanted to set the archiving feature of my Outlook Mailbox, but I figured, that I cannot apply settings recursively, which is a real pain in the a...

The first thing that came to my mind was: what about a nice little (old-school) VBA-macro? Wow, back then, the world seemed to be so easy πŸ™‚ So I found this blog post about setting archiving (or as I learned, it’s called aging) recursively. So I took the code, modified it a little to meet my needs … and nothing. The archive-settings where not modified πŸ™ So I will have to do some digging …

Analysis this (… in Excel)

Although Excel is a great tool to analyze data, it does not support a native driver to access Analysis Servives 2005. In order to take full advantage of the analysis services you need to install a special addin.

If you want to have even more control about the data you’re accessing, you might want to connect to analysis services using ADO. The apropriate driver is supplied with the SQL Server 2005 Feature Pack.