Wednesday, September 05, 2007

Making Silage

Did you know silos are expensive? So we make a pile right on the ground. To keep it from spoiling, you have to drive it over it with heavy tractors and compact it again & again. It helps to have a nice new tractor like this one! :-) No, it's not ours; we rented it.

 

This is how a silage pile 330x35x12 appears from the driver's seat.

 
Posted by Picasa

Tuesday, August 15, 2006

Cows!

 
Yep, we have heifers now. And the children are fascinated. Looks like a cow is too! Posted by Picasa

Tuesday, July 18, 2006

SmartFormat the entire solution

At work, we recently decided to all use the same c# formatting options in Visual Studio 2005. (Yes, it would be nice to have hooks in the version control package so we each could see the source with our own formatting, but svn doesn't have that.) So, I've been looking for an easy way reformat thousands of files without opening each file manually. I finally gave up looking and cobbled together a quick macro. Here it is.

Let me know if you improve it, ok?

Option Strict Off
Option Explicit Off

Imports EnvDTE
Imports System
Imports System.IO
Imports System.text

Public Module Tools

Sub SmartFormatSolution()
Dim project As Project
Dim projects As Projects = DTE.Solution.Projects()

For Each project In projects
Dim pi As ProjectItems = project.ProjectItems()
If Not (pi Is Nothing) Then
SmartFormatProjectItems(pi, Level + 1)
End If
Next
MsgBox("Reformat Done", MsgBoxStyle.Information)
End Sub

Sub SmartFormatProject()
Dim projects As System.Array = DTE.ActiveSolutionProjects()
If projects.Length > 0 Then
Dim proj As Project = CType(projects.GetValue(0), EnvDTE.Project)
Dim pi As ProjectItems = proj.ProjectItems()
If Not (pi Is Nothing) Then
SmartFormatProjectItems(pi, Level + 1)
End If
Else
MsgBox("No project selected", MsgBoxStyle.Critical)
End If
MsgBox("Reformat Done", MsgBoxStyle.Information)
End Sub

Sub SmartFormatProjectItems(ByVal ProjItems As ProjectItems, ByVal Level As Integer)
Dim ProjItem As ProjectItem
For Each ProjItem In ProjItems
If InStrRev(ProjItem.Name, ".cs") <> 0 Then
Dim ActiveWin As Window = ProjItem.Open(Constants.vsViewKindCode)
ActiveWin.Activate()
Dim txtDoc As TextDocument = DTE.ActiveDocument.Object("TextDocument")
Dim StartPoint As EditPoint = txtDoc.StartPoint.CreateEditPoint
Dim EndPoint As EditPoint = txtDoc.EndPoint.CreateEditPoint
EndPoint.SmartFormat(StartPoint)
ActiveWin.Close(vsSaveChanges.vsSaveChangesYes)
End If
' Recurse if the project item has sub-items...
Dim projitems2 As ProjectItems = ProjItem.ProjectItems()
Dim notsubcoll As Boolean = projitems2 Is Nothing
If Not notsubcoll Then
SmartFormatProjectItems(projitems2, Level + 1)
End If
Next
End Sub

End Module

Tuesday, July 11, 2006

Rafting on the Juniata River 2006



This past weekend 74 fathers & sons traveled the Juniata River in homemade rafts. Our goal was to spend time with our sons in the outdoors, creating memories and learning to know them better. However, my 9-year old spent most of the time on the river swimming or on inner tubes like this one while my preferred place was on the raft! We took our neighbers, the Bergs, along as guests. It was a rough-and-tough father-son weekend and the boys loved it!

We even had a visit from the PA Game Commission to check if we had one life-vest per person. Thankfully, most of us did. The $70/person fines for those who were short was a test of character and submission to authority, for sure!

You can see all my digital pics at Flickr.

 Posted by Picasa

Sunday, January 08, 2006

Visual SourceSafe RSS Generator Bug Fix

I've downloaded Greg Reinacker's c# source to generate RSS feeds from Visual SourceSafe and improved it by reducing the working set. Following is the unified diff. (Be careful of wrapped lines when you select it into a text file.) If you need a tool to apply this diff, I recommend Tortise Merge which is a part of TortiseSVN which is a Windows shell extension for Subversion.



Index: GenRss.cs
===================================================================
--- GenRss.cs (revision 12)
+++ GenRss.cs (working copy)
@@ -91,29 +91,37 @@
foreach (SourceSafeTypeLib.IVSSVersion ver in versions)
{
i++;
- if (i > maxItems)
- continue;

- string action = ver.Action;
- string file = ver.VSSItem.Name;
- string user = ver.Username;
- string vernum = ver.VersionNumber.ToString();
- string comment = ver.Comment;
+ // Kevin Greiner (2/22/2005) The following loop is
+ // specifically written to allow the foreach to completely finish. Testing has
+ // shown that aborting the foreach prematurely increases the working set
+ // 10-fold.
+ if (i <= maxItems)
+ {
+
+ string action = ver.Action;
+ string file = ver.VSSItem.Name;
+ string user = ver.Username;
+ string vernum = ver.VersionNumber.ToString();
+ string comment = ver.Comment;

- DateTime dt = ver.Date;
+ DateTime dt = ver.Date;

- w.WriteStartElement("item");
- w.WriteElementString("title", String.Format("{0}/{1}", action, file));
- w.WriteStartElement("guid");
- w.WriteAttributeString("isPermaLink","false");
- w.WriteString(String.Format("{0}:{1}:{2}", file, vernum, action));
- w.WriteEndElement();
- w.WriteElementString("description", String.Format("{0}",comment));
- w.WriteElementString("pubDate", dt.ToUniversalTime().ToString("r"));
- w.WriteElementString("creator", "http://purl.org/dc/elements/1.1/", user);
- w.WriteEndElement(); // item
+ w.WriteStartElement("item");
+ w.WriteElementString("title", String.Format("{0}/{1}", action, file));
+ w.WriteStartElement("guid");
+ w.WriteAttributeString("isPermaLink","false");
+ w.WriteString(String.Format("{0}:{1}:{2}", file, vernum, action));
+ w.WriteEndElement();
+ w.WriteElementString("description", String.Format("{0}",comment));
+ w.WriteElementString("pubDate", dt.ToUniversalTime().ToString("r"));
+ w.WriteElementString("creator", "http://purl.org/dc/elements/1.1/", user);
+ w.WriteEndElement(); // item
+
+ }
+
+ Marshal.ReleaseComObject(ver);

- Marshal.ReleaseComObject(ver);
}