Sunday, December 14, 2008

Blue Hills Hike

Date: 12/14/2008
Time: 11:30 AM local
Location: Blue Hills Milton Massachusetts
Wx: Sunny, Wind up to 15 MPH, 45 Degrees F
Radios: Dual Band HT, and MTX9000

Notes: The plan was to Hike the Blue Hills today. These plans were cancelled when we got to the entrance (Wampatuck Road) the road was closed. There was a sheet of ice on the road near the gate. Scary. Seems the the Blue Hills was affected by the ice storms from last week. We when back home and did a nice walk around Black Creek in Quincy, MA.

It was fun to observe a duck showing off in front of his Friends. He was walking on the ice. On the radio I could hear fellow hams chatting about how great the new Waltham 900 Mhz repeater is working. I noticed a very large improvement. Kudos to the folks who did the work on the repeater.

Saturday, December 6, 2008

Marijuana is extremely unhealthy

Massachusetts 2008 Ballot Question 2 ("AN ACT ESTABLISHING A SENSIBLE STATE MARIJUANA POLICY") passed.

Please consider your health before you make a choice to try this drug. The same local laws ban use of trans fat in restaurants. This is to protect you.

Please let me try to protect you by advising you to stay away from drugs.

Here is a link on the effects of Marijuana:
WebMd

Friday, December 5, 2008

Names of People converting to Mixed Case and Roman Numbers Using Regex

Our web app takes data from an order entry system. In this data the person's full name is in all upper case letters in one field.

Ex. DOE III, JOHN D For John D Doe the Third

We have a method that converts the all upper case letters to a mixed case.
We found a bug in our logic in respects to the handling of roman numbers inside the name suffix.

Our logic would output the following:

Doe Iii, John D

To fix this it was proposed to use a series of string.replace() method to fix the name suffix after it was set to mixed case. Please see Figure 1

Figure 1:
...
strName = strFormattedName.ToString();


//Handle Roman numerals up to X

strName = " " + strName + " ";

strName = strName.Replace(" Ii ", " II ");

strName = strName.Replace(" Iii ", " III ");

strName = strName.Replace(" Iv ", " IV ");

strName = strName.Replace(" Vi ", " VI ");

strName = strName.Replace(" Vii ", " VII ");

strName = strName.Replace(" Viii ", " VIII ");

strName = strName.Replace(" Ix ", " IX ");

strName = strName.Trim();



return strName;

}

I felt that was wasteful. We were sending the token that contained the suffix to the mix case method, placed the whole name back together and then sending the whole name through the above method (Figure 1) to undo the mix case to the suffix. Also wasteful was the series of 7 string replacement calls.

I thought it would be better to use a regular expression to check to see if a token contained a roman number generation suffix. If a token did contain a roman number, then we could not send it to the mix case method. This code is more efficient and cleaner.

Figure 2 contains a method that checks a string for roman numbers 2 though 4. The downside to this is I have yet to figure out the difference between the name Vi and the roman number 6. If I think of something cool, I will update this post.



Figure 2:

private bool isSuffix(string inName)
{
bool ret = false;
try
{
string sPattern = @"^\W?(II|III|IV)\W?$";
if (Regex.IsMatch(inName, sPattern))
ret = true;
}
catch //todo: add error ex handle
{
}
return ret;
}
According to boston.com:
New parents John Jennifer Davis got a ticket for driving in the breakdown lane.


The Article


Great call taken by the Mass State Police to issue ticket.

John Davis was risking their lives and the lives of others driving in the breakdown lane. Next time call an ambulance.