January 23, 2011

The joy of coding

It's been a while since I enjoyed coding mainly because I felt I was writing bad code. Classes weren't tested, code was duplicated, the tool being developed wasn't reliable (e.g. a change to Class A breaks Class M, N, X, V and Z), etc.

Today I was inspired to change my attitude and I am forever grateful. I learned that I have a big part to play in cleaning up the code base and encouraging my co-workers to do the same. It is part of my responsibility as a developer.

I have to make sure that I don't get drawn into that state again ... where I keep writing bad code and telling myself that it's okay to write bad code ... easier to write bad code because I will lose the excitement in developing if I do.

Writing this blog makes me think about something I read earlier that we (developers) don't get paid to write code - we get paid to produce a product. That product might be something we wrote, something we bought, something we stole, etc. The point is that a client doesn't pay for the code you write ... they pay for the product you produce.

I feel that's a fair statement but writing better code makes developing more efficient and more fun. I feel that most developers can put together something to accomplish a task and I find that boring ... mundane. I derive my coding joys from solving problems with efficient design solutions, exploring ideas, etc. The end product is not what drives me to write code. The journey while writing the code makes it worthwhile.

The right attitude? I don't know ... guess I"ll explore this a little more as time goes on

December 28, 2010

Opening .eml files from SharePoint 2007 in Outlook 2010

When an email is sent to an email-enabled library in SharePoint 2007, the email gets saved as a .eml file. 

Opening the email from SharePoint using Firefox results in the email being downloaded to the client's computer and opened in Outlook 2010 - Firefox doesn't know how to handle a .eml file and defaults to downloading the file. The OS knows to open a .eml file in Outlook 2010 and so the desired behavior is achieved. 

Opening the email from SharePoint using IE results in the email being opened in an IE window - problematic because the user loses the ability to view email attachments, reply to the email, forward the email, etc. The quickest fix to this issue is for the user to download the email (a choice from the ECB menu in the library) but I prefer a fix that doesn't require the user to do anything ... better experience for users, no chance for users to make a mistake, whatever reason suits your fancy.

Turns out that .eml files opening in IE is regulated by the following registry key:
HKEY_CLASSES_ROOT\MIME\Database\Content Type\message/rfc822 

To stop .eml files being opened in IE, delete the registry key on the user's computer ...
  1. Start the Registry Editor - 'regedt32.exe' in a command prompt window
  2. Backup registry key stated above
  3. Delete registry key stated above
This can be done using Group Policy and a startup script.