Day to day good stuff I find regarding my work

Tuesday, December 11, 2007

On Microsoft

Some intresting Webcasts http://www.informit.com/podcasts/channel.aspx?c=3761c00b-ef8f-4385-9b08-a6e1c7a9a35f&rl=1

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

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


Value Objects


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

Wednesday, September 19, 2007

Coalesce



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

PDF http://svnbook.red-bean.com/nightly/en/svn-book.pdf

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)

http://www.cornerstone.se/expertzone/dev07/sessions_java.aspx

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

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.

Losning
Macro se
http://www.mvps.org/dmcritchie/excel/fillempt.htm

Wednesday, April 11, 2007

Best Practise in error handling webparts in Sharepoint 2007

Uploaded as an article to CodeProject
http://www.codeproject.com/useritems/Errorhandling_in_Webparts.asp

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
try{
base.CreateChildControls();
.....}

catch (Exception exp)
{
HttpContext ctx = HttpContext.Current;
ctx.Trace.Warn(ex.ToString());
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);
try
{...
...
...

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

where

private void displayErrorMsg(HtmlTextWriter writer, Exception ex)
{
this.Controls.Clear();
this.Controls.Add(new LiteralControl(ex.Message));
if (ex.InnerException != null)
{
this.Controls.Add(new LiteralControl(ex.InnerException.Message));
}
this.Controls.Add(new LiteralControl());
base.Render(writer);
HttpContext ctx = HttpContext.Current;
ctx.Trace.Warn(ex.ToString());
}

Sharepoint Event handlers explained

See http://blogs.msdn.com/brianwilson/archive/2007/03/05/part-1-event-handlers-everything-you-need-to-know-about-microsoft-office-sharepoint-portal-server-moss-event-handlers.aspx

Thursday, January 25, 2007

Another UML tutorial


UML Tutorial - Class Diagrams
http://pigseye.kennesaw.edu/~dbraun/csis4650/A

powered by performancing firefox

Wednesday, January 24, 2007

UML

http://www.agilemodeling.com/artifacts/classDiagram.htm

http://www.isk.kth.se/kursinfo/6b2030/lektioner/for2/uml1/association.shtml