jeudi 3 janvier 2008

Aggregate varchar column with PL\SQL

I need to concatenate (Aggregate) all values (nvarchar) of grouped rows in an oracle table :
Table
Column1 Column2
V1 'Chaine1'
V1 'Chaine2'
V2 'Chaine3'
V2 'Chaine4'

The result expected :
V1 'Chaine1;Chaine2'
V2 'Chaine3;Chaine4'

2 Methods :
1. Create a User-Defined Aggregation function :
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402
2. Use this Query :
SELECT Colonne1,
REPLACE(
REPLACE(xmlagg(xmlelement(unusedElem,Colonne2 ||
';'))
,'< UNUSEDELEMENT >')
,'< /UNUSEDELEMENT>')
FROM
TABLE
GROUP BY Colonne1

mercredi 17 octobre 2007

Design Pattern Singleton optimized for .Net

Here is the most popular version of the implementation of this design pattern :

public class Singleton
{
private static Singleton instance;
private object oSync = new object();

public Singleton ()
{
}

public static Singleton Instance

{
get
{
if(instance == null)
{
Lock(oSync)
{
if(instance == null)
{
instance = new Singleton();
}
}
}

return instance;
}
}
}

this version is not optimized for .Net. In .Net we can use a static constructor and this static constructor is ThreadSafe.
Here is the optimized version :

public class Singleton
{
private static Singleton instance = new Singleton ();
private object oSync = new object();

static Singleton ()
{
}
private Singleton ()
{
}

public static Singleton Instance

{
get
{
return instance;
}
}
}

jeudi 27 septembre 2007

SSIS Excel data source values returned as null

This problem occurs when we try to import an Excel file. All values of a column are returned in SSIS as null values but in the document we had values.
The problem is due to the provider : the provider calculate the data type of a column by analysing the first lines of the document.
The solution is to modify the ConnectionString property of the ExcelConnection component (add IMEX=1)
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\data\maroc\import.xls; Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1;"
IMEX=1: indicates the provider to convert data, in multitype columns, to text values.

SEE :http://support.microsoft.com/kb/194124/en-us

Building ClickOnce application from the command line(Without VS2005)

I was looking for an alternative to use VS 2005 for publishing an application, And I found that MSBuild allow us to do that. the solution consists of using the .csproj file generated by visual studio and this command line : msbuild /target:publish.
A detailed explanation is available here : Building ClickOnce Applications from the Command Line

mardi 18 septembre 2007

Nouveauté du framework 2.0

ayant travailler essentiellement sur .Net 2.0, je ne pouvais pas répondre à cette question qui est souvent posé lors des entretient d'ambauche : quelles sont les nouvautés du framework 2.0 ?
Des éléments de réponses sont disponible à cette adresse :

Les nouveautés du framework 2.0

lundi 17 septembre 2007

Welcome to .Net Generation

In this blog you will find essentially, technical postes about .Net technologies.