Day to day good stuff I find regarding my work

Tuesday, December 11, 2007

On Microsoft

Some intresting Webcasts

Sunday, October 28, 2007

Domain driven design

Reading the book Applying Domain-Driven Design and Patterns by Jimmy Nilsson
and are gathering links and commens in this blogpost

Ben Scherman has a good article serie about doing a project using Domain-Driven Design and Nhibernate

10 tips about using Hibernate

Repository, the Foundation of Domain Driven Design
Persistence Last
Evans model-to-work

Value Objects

LINQ to SQL comment
Non-scalar Value Objects aka "Complex Types"

Wednesday, September 19, 2007


Coalesce goes C# « Only Talking Sense

... the null-coalescing operator in C# 2.0.

string name = (userName == null? “” : userName);

There’s nothing wrong with this code ....but the ternary operator ?
you can now write

string name = userName ?? “

Powered by ScribeFire.

Sunday, July 15, 2007



Subversion on Windows quick start

C:\mgns\Visual Studio 2005\Projects> svn import RegAdmin file:///c:/regadminrepos -m "Initial Import"

C:\mgns\Visual Studio 2005\Projects> svn checkout file:///C:\regadminrepos "file://C:\mgns\Visual Studio 2005\Projects\RegAdmin"

Thursday, May 24, 2007

Java Persistence API v1.0 (JPA)

Declarative mappingFramework APIQuery LanguageTransaction Support
Entiteter: skall vara rena
ORM: Håller det hela i synk

Transparent Persitance

JPA 1.0 Declarative Object Relational Mapping
1. Classes are mapped to tables
2. Fields are mapped to columns
3. All types of relationships are supported
4. Support for embedded objects
5. Use either annotation or deployement descriptors

Laxy loading potentiellt problem med många sm@a
Eager loading kan ge stora SQL statements
Guideline Use laxy on relations and "fetch join" on queries
(Select * from Employee e LEFT JOIN FETCH e. phoneNumbers WHERE )

Contructor expressions in queries

Buld update delete

Valideringar - Lifecycle Callback

Wednesday, May 09, 2007

Excel macro

Problem Fylla alla tomma celler i vald range i Excel med dom ovanfor.

Macro se

Wednesday, April 11, 2007

Best Practise in error handling webparts in Sharepoint 2007

Uploaded as an article to CodeProject

When installing a webpart in Sharepoint 2007 you need to have some kind of model how to handle errors. This is the approach I have used.

The entry points in the code are

1. CreateChildControls
Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

2. Render
Renders the control to the specified HTML writer.

The problem is that the user should get somekind of feedback in a readable format telling him OOhps the secound problem is how to communicate this to the System Administrator

My Approach

a) Create a private variable to store the Exception
private Exception childException = null;

b) In CreateChildControls have a try/catch and catch the error in the childException variable

catch (Exception exp)
HttpContext ctx = HttpContext.Current;
childException = ex;
c) In Render check if the have a try/catch and catch the error in the childException variable
and then display the result in the page by using labels..

protected override void Render(System.Web.UI.HtmlTextWriter writer)
if (childException != null)
displayErrorMsg(writer, childException);

catch (Exception ex)
displayErrorMsg(writer, ex);


private void displayErrorMsg(HtmlTextWriter writer, Exception ex)
this.Controls.Add(new LiteralControl(ex.Message));
if (ex.InnerException != null)
this.Controls.Add(new LiteralControl(ex.InnerException.Message));
this.Controls.Add(new LiteralControl());
HttpContext ctx = HttpContext.Current;

Sharepoint Event handlers explained


Thursday, January 25, 2007

Another UML tutorial

UML Tutorial - Class Diagrams

powered by performancing firefox

Wednesday, January 24, 2007