blog.devbroker.org author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

CD/DVD/ISO Gravure pour Windows Vista 64 (Vista Burner)

Wednesday, 20 December 2006 23:11 by prabian

Si comme moi vous utilisez Window Vista…vous y avez surement perdu quelques plumes (ou plutôt drivers)…
Pour ma part, j’ai installé une version 64 bits pour enfin exploiter mon processeur AMD Turion 64 mais sans compter sur l’absence de driver pour la plupart de mes périphériques….mais soyons patients, ils arrivent bientôt :) .

En attendant, je souhaitais graver des images iso et…. surprise !! mes logiciels de gravure habituels sont devenus inexploitables (non recommandé pour vista ou pb de détection matériel) !!! Pour le coup, ce n’est pas ici la version 64bits de vista qui pose problème mais bien vista "tout court" :( Pas glop.
J’ai l’impression de me retrouver face à une installation d’une distrib de linux remontant à 5 ans en arrière…

J’ai recherché un peu et voici 2 applications gratuites qui, pour mon cas, ont parfaitement fonctionnées :

- Deep Burner (gravures classiques ou images) : http://www.deepburner.com
- ImgBurn (images uniquement) : http://www.imgburn.com/

Voici les copies d’écran :

et

Merci aux auteurs…
Je vais maintenant me mettre en quête d’une explication sur mes problèmes de synchro avec mon PDA Windows mobile 5 maintenant que Active Sync est passé à la trappe :( ( re-pas glop.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   Windows
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Export a DataTable to CSV format (Excel compatible)

Monday, 18 December 2006 14:41 by prabian

You can use ExportDataTable method to export a generic datatable content to a CSV format.
The following sample is used in ASP.NET context to export the result of a gridview. This code-sample should be place in the handler method of a click button event.

protected void LinkButtonExportAsExcel_Click(object sender, EventArgs e)
{
try

{
DataView dataView
= (DataView)Cache["DataSource"
];
if (dataView == null) dataView =
GetDataView();
char[] bufferedExport = ExportDataTable(dataView.Table, "CSV"
);
if (bufferedExport == null) return
;
Response.Clear();
Response.ContentType
= "text/csv"
;
Response.ContentEncoding
=
Encoding.Default;
Response.Charset
=
Encoding.Default.EncodingName;
Response.AddHeader(
"Content-Disposition", "attachment;filename=Export.csv"
);
Response.AddHeader(
"Content-Length"
,
Encoding.Default.GetByteCount(bufferedExport).ToString());
Response.BinaryWrite(Encoding.Default.GetBytes(bufferedExport));
Response.Flush();
//
Instead of ‘Response.End’
//(cf :
http://support.microsoft.com/kb/312629/EN-US/)

HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch
(Exception ex)
{
//
}
}


public static char[] ExportDataTable(DataTable table, string format)
{
string
fieldSeparator;
string
containerSeparator, containerSeparatorReplace;
string
carriageReturn;
switch
(format.ToUpper())
{
case "CSV"
:
fieldSeparator
= ","
;
containerSeparator
= "\""
;
containerSeparatorReplace
= containerSeparator +
containerSeparator;
carriageReturn
= "\r\n"
;
return
ExportDataTable(table, fieldSeparator,
containerSeparator, containerSeparatorReplace, carriageReturn);
default
:
return null
;
}
}

public static char[] ExportDataTable(
DataTable table,
string
fieldSeparator,
string containerSeparator, string
containerSeparatorReplace,
string
carriageReturn)
{
string
temp;
StringBuilder contentBuffer
= new
StringBuilder();
StringBuilder headerBuffer
= new
StringBuilder();
int rowIndex = 0
;
foreach (DataRow row in
table.Rows)
{
int columnIndex = 0
;
foreach (DataColumn column in
table.Columns)
{
if (row[column.ColumnName] !=
DBNull.Value)
{
if (column.DataType == typeof
(System.String))
{
temp
= (string
)row[column.ColumnName];
temp
=
temp.Trim();
temp
=
temp.Replace(containerSeparator, containerSeparatorReplace);
contentBuffer.Append(containerSeparator);
contentBuffer.Append(temp);
contentBuffer.Append(containerSeparator);
}
else if (column.DataType == typeof
(System.Int32))
{
contentBuffer.Append(Convert.ToString((
int
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Byte))
{
contentBuffer.Append(Convert.ToString((
byte
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Double))
{
contentBuffer.Append(Convert.ToString((
double
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Decimal))
{
contentBuffer.Append(Convert.ToString((
decimal
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.DateTime))
{
contentBuffer.Append(Convert.ToString((DateTime)row[column.ColumnName]));
}
}
if (columnIndex < table.Columns.Count && rowIndex == 0
)
headerBuffer.Append(column.ColumnName);
if (columnIndex < table.Columns.Count -1
)
{
if (rowIndex == 0
)
headerBuffer.Append(fieldSeparator);
contentBuffer.Append(fieldSeparator);
}
columnIndex
++
;
}
contentBuffer.Append(carriageReturn);
rowIndex
++
;
}
headerBuffer.Append(carriageReturn);
contentBuffer.Insert(
0
, headerBuffer.ToString());
return
contentBuffer.ToString().ToCharArray();
}
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   C# sample code | Office
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

How to publish an assembly to the GAC while building VS project

Thursday, 7 December 2006 18:25 by prabian

Open class library project properties > Build events and add this script in post-build command line :

"$(DevEnvDir)..\..\SDK\v2.0\Bin\gacutil.exe" /u $(TargetName)

rem IF NOT $(ConfigurationName) == Release GOTO end

:: Copying assembly to the GAC
echo Copying assembly to the GAC
"$(DevEnvDir)..\..\SDK\v2.0\Bin\gacutil.exe" /i "$(TargetPath)"

:end
echo Finished Post Build Event

 

 

The path could be different (bold text). You may have to change it by something like

C:\Program Files\Microsoft.NET\SDK\v2.0\Bin\gacutil.exe
(…and v2.0 by v1.1 for an older framework version….)

or

C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\gacutil.exe
(for the recent Windows SDK Win32+.NET 3.0) 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , ,
Categories:   .NET Projects
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed