- El Gouna is a nice, safe, gated town about half an hour's drive up the red sea coast from Hurghada.
- The Moevenpick El Gouna is a nice hotel complex composed of several "clusters" of rooms set around a number of lagoons and pools. However, some clusters are nicer than others. We initially got put in cluster 7 in a grim room and a sewage smell outside. We complained to our Thompson rep and got moved to a great room in cluster 3.
- Downtown El Gouna is good for supermarket shopping but poor for evening eating.
- El Gouna Marina is very nice for evening nosh, especially Bleu Bleu restaurant.
- The TukTuks are everywhere and cheap.
- The Mosquitos are buggers! Bring protection.
- You have to swim out quite a way to get to decent coral, but it is out there.
- The purple jellyfishes are harmless.
- The desert tour to see the bedouin camp is not worth it.
- Hurghada is a sad, ugly post-credit-crunch disaster.
- The Red Sea in April is lovely and warm but not overbearingly hot.
DaddyCode Team Blog
C# , ASP.NET, MVC, SQL, Sharepoint, JQuery and nowt else from a Web Developer in Leeds
27 Apr 2009
Walk like an Egyptian
Ruth and I just got back from a jolly holiday in Egypt. Here's what we found.
Parse CSV files with the MS ODBC Driver
Easy way to read CSV files in .NET just like connecting to an SQL table - just use the standard Microsoft Text Driver.
A note on configuring the Microsoft Text Driver for your CSV file:
If you place a Schema.ini file in the same location as the CSV file, you can declaratively specify the expected columns and datatypes. See this article for info: http://msdn.microsoft.com/en-us/library/ms709353.aspx
A note about System Regional Settings vs Application Culture when using the Microsoft Text Driver:
I noticed something weird when I specified a column as DateTime in my Schema.ini file. The Text Driver was reading the dates in US format (mm/dd/yy). My testing indicates that even though my ASP.NET web app was explicitly set for British culture ("en-GB" in the web.config's globalization section), the Text Driver uses the Windows Regional And Language Options setting. Annoying eh!
Note also that if the Text Driver cannot resolve a DateTime value according the Regional Settings format, it doesn't throw an exception. It just treats the value as Null. Yuck.
public DataTable GetData(string FullPath)
{
string strPathWithoutFileName = Path.GetDirectoryName(FullPath);
string Name = Path.GetFileName(FullPath);
DataSet dsData = new DataSet();
System.Data.Odbc.OdbcConnection conCsv = new System.Data.Odbc.OdbcConnection();
conCsv.ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + strPathWithoutFileName + @";Extensions=csv;";
conCsv.Open();
System.Data.Odbc.OdbcDataAdapter oda = new System.Data.Odbc.OdbcDataAdapter();
oda.SelectCommand = new System.Data.Odbc.OdbcCommand("SELECT * FROM [" + Name + "]", conCsv);
try
{
oda.Fill(dsData);
}
catch (Exception ex)
{
throw new InvalidOperationException("Csv File Read Error: " + FullPath, ex);
}
finally
{
oda.Dispose();
conCsv.Close();
conCsv.Dispose();
}
dsData.Tables[0].TableName = Name;
return dsData.Tables[0];
}
A note on configuring the Microsoft Text Driver for your CSV file:
If you place a Schema.ini file in the same location as the CSV file, you can declaratively specify the expected columns and datatypes. See this article for info: http://msdn.microsoft.com/en-us/library/ms709353.aspx
A note about System Regional Settings vs Application Culture when using the Microsoft Text Driver:
I noticed something weird when I specified a column as DateTime in my Schema.ini file. The Text Driver was reading the dates in US format (mm/dd/yy). My testing indicates that even though my ASP.NET web app was explicitly set for British culture ("en-GB" in the web.config's globalization section), the Text Driver uses the Windows Regional And Language Options setting. Annoying eh!
Note also that if the Text Driver cannot resolve a DateTime value according the Regional Settings format, it doesn't throw an exception. It just treats the value as Null. Yuck.
9 Apr 2009
SqlMetal + Visual Studio Jollity
Whack the following code in a .bat file, register it with Visual Studio's "External Tools" under the Tools menu, and call it whenever you want to regenerate your LinqToSql ORM goodness:
@ECHO OFF
ECHO # GENERATING "MyProject.Classes.ORM" CLASSES - THEY MUST BE CHECKED OUT FOR THIS TO WORK!
ECHO.
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SqlMetal.exe" /server:localhost /database:MyProjectDB /code:MyProject.Classes\ORM\MyProjectDBContext.cs /namespace:MyProject.Classes.ORM /pluralize
ECHO # GENERATION COMPLETE - CHECK ABOVE FOR ERRORS
8 Apr 2009
Subscribe to:
Posts (Atom)
If I helped you out today, you can buy me a beer below. Cheers!