Search This Blog

Saturday, January 23, 2010

Using PropertyGrid in C#

Stupidly easy.

I am going to stop creating generic UI to display data and use the PropertyGrid as my new default to display object properties

PropertyGrid1.SelectedObject = myObject;

Arrays in C#

Switching between C# and VB6 totally messing up my thinking about arrays.....

Examples of C# Arrays

int[] numbers = new int[5] {1, 2, 3, 4, 5};
string[] names = new string[3] {"Matt", "Joanne", "Robert"};

Sunday, January 17, 2010

2010 Winter Hike at Hocking Hills State Park

On saturday, a couple friends and I attended the 45th annual winter hike in Hocking Hills State Park. This is by far my favorite spot in Ohio. I had no idea how many people were going to be at the event -- over 4500 hikers. Here is the line to start the hike at ~10am.
The hike was 6 miles from Old Man' Cave visitor, past Cedar Falls to Ash Cave.
The path ran along the backside of the campground along Rose Lake shown.
The half way point was Cedar Falls.
The Friends of Hocking Hills and the Logan Kiwanas provided a bean soup lunch complete with miffin and hot chocolate.
The hike ended at Ash Cave which is the largest rock shelter in Ohio.
The ice mound at the base of the small waterfall was amazing!
Forunately there were free shuttle buses available for the trip back the car!

Thursday, January 14, 2010

Coolest Mars Image Ever!

From Discover Magazine



To the dust cloud in the central lower left quadrant. Estimated to be 10 meters across. Makes the tree like sand structures at least 30 meters tall!

Wednesday, January 13, 2010

Append to a text blob in SQL 2008

From StackOverflow
Wish I could remember this without google...


update 
  tablename
set
  fieldname = convert(nvarchar(max),fieldname) + 'appended string'


Saturday, January 2, 2010

SharpMap patch

Something novel, fixed my first bug in open source software: SharpMap
Adding this control as part of my DRC rewrite in C#


Index: Trunk/SharpMap/Data/Providers/DbaseReader.cs
===================================================================
--- Trunk/SharpMap/Data/Providers/DbaseReader.cs    (revision 61030)
+++ Trunk/SharpMap/Data/Providers/DbaseReader.cs    (working copy)
@@ -417,7 +417,16 @@
         {
             baseTable = new FeatureDataTable();
             foreach (DbaseField dbf in DbaseColumns)
-                baseTable.Columns.Add(dbf.ColumnName, dbf.DataType);
+            {
+                try
+                {
+                    baseTable.Columns.Add(dbf.ColumnName, dbf.DataType);
+                }
+                catch(DuplicateNameException)
+                {
+                    baseTable.Columns.Add(string.Format("{0}_1",dbf.ColumnName), dbf.DataType);
+                }
+            }
         }

         internal FeatureDataTable NewTable