Sunday, November 15, 2009

Other Radio Services

There has been some discussion in my local Amateur Radio community about what qualifies as "public service." A lot of the debate concerns a phrase in the FCC rules governing Amateur Radio. It states that amateur radio should not be used for
(5) Communications, on a regular basis, which could reasonably be
furnished alternatively through other radio services.
I just wanted to tell a story about when communications could not be furnished by any other means.

We were supporting the annual ("on a regular basis"?) Multiple-Sclerosis Society's MS 150. The rest-stop where lunch was served was up a canyon (Blacksmith Fork Canyon). One of the riders was run over by a small trailer being towed up the canyon by a pickup truck.

There were EMTs at the rest stop who were able to see to him, but he required a trip to the hospital. Cell phones weren't working in the canyon. A sheriff's depute wasn't able to reach his dispatcher. Only my ham radio could make it out of the canyon.

Scary - yet inspiring.

Monday, July 27, 2009

Sometimes I amaze even myself!

I built a generic method in C#. One of the parameters to the method was the generic type <T>

Looking at my method, I created some instances of T using the new keyword/operator.

I thought to myself, "some classes don't have a constructor... I'll need to restrict that in the declaration. Something like
private static long CreateInstances<T>(List<T> instanceCollection) where T "has a default constructor" {...}


I looked up the where contextual keyword and learned that the syntax for what I wanted to do was:
private static long CreateInstances<T>(List<T> instanceCollection) where T: new() {...}


Just before I hit that last parenthesis I noticed the red-squiggle. It was under some code down in the method body that used the type 'T'

T variable = new T();


I hovered over the squiggled text to see what was the matter:
Error: Cannot create an instance of the variable type 'T' because it does not have the new() constraint.


Ha!! I defeated the red-squiggle before I had even seen it!

Thursday, July 23, 2009

Experiments!

I wasn't sure if the C# is operator would throw a null-reference exception if I gave it a null object. (Katie, a null object is simply an empty placeholder - think of someone's name in your address book, but without an address. When you try to mail them something, you wouldn't just send a blank envelope to them, you're smart enough to recognize the "address not found exception". Null-reference exception is the same thing.)

So, I built an experiment:

static void Main(string[] args)
{
object foo = new System.Xml.XmlDocument();
object bar = null;
System.Uri zap = new Uri("http://fake.uri.nategrigg.com");

try {
Console.WriteLine("foo.GetType(): {0}", foo.GetType().ToString());
Console.WriteLine("foo: {0}", foo.ToString());
Console.WriteLine("bar: null");
Console.WriteLine("zap.GetType(): {0}", zap.GetType().ToString());
Console.WriteLine("zap: {0}", zap.ToString());
Console.WriteLine("foo is object: {0}", foo is object);
Console.WriteLine("bar is object: {0}", bar is object);
Console.WriteLine("zap is object: {0}", zap is object);
Console.WriteLine("foo is XmlDocument: {0}", foo is System.Xml.XmlDocument);
Console.WriteLine("zap is Uri: {0}", zap is Uri);
Console.WriteLine("bar = zap");
bar = zap;
Console.WriteLine("bar is Uri: {0}", bar is Uri);
} catch ( NullReferenceException nullex ) {
Console.WriteLine("Null reference exception: {0}", nullex.Message);
}

Console.ReadKey();
}


Conclusion: When given a null variable, the is operator simply returns false. Which is just what I needed!

Also, the program had the following output (in case you're curious):

foo.GetType(): System.Xml.XmlDocument
foo: System.Xml.XmlDocument
bar: null
zap.GetType(): System.Uri
zap: http://fake.uri.nategrigg.com/
foo is object: True
bar is object: False
zap is object: True
foo is XmlDocument: True
zap is Uri: True
bar = zap
bar is Uri: True

Tuesday, June 30, 2009

localRepo

Man... what a hassle!

Why do I bother checking "specific version" if Visual Studio just copies a different version over the top? Maybe it's MSBuild that's doing the copying.

The secret is that the wrong version of the assembly gets cached here (on my vista box, it may be different in XP):
~/AppData/Roaming/localRepo/Cache/wrongDllVersion.dll

I found the path by checking "read only" on the DLL that kept getting overwritten with the wrong version. When I built the project there was a warning about how Visual Studio was unable to copy the dll.

HA! Take that, Visual Studio!

Sorry if you don't care about DLLs or Visual Studio; I had to put this up so I can find it next time I google: ".net dll wrong version cache"...

Thursday, June 25, 2009

M3 Racecar

It's been more than ten years since Gran Turismo came out for the original Sony Playstation.


I'd always liked racing games. When I saw how the ad recommended following a "racing line" through a corner I was already interested. Then I realized that the picture in the middle of the ad was from the game. I called my brother and told him I was coming home with it.


Playing that game has led to my purchasing more than one sporty model of car in the last few years. I even paid extra for the "Speed" channel. The speed channel has introduced me to Formula 1 racing.


While watching some Formula 1 racing I saw this ad:


M3 Racecar


I don't know what it is. There's something with the audio. The video has been messed up a little. Is that Leonard Nimoy narrating?


The ad feels like something from 20 or 30 years ago.


I don't know what it is - but I like it. And it works! I've never wanted a BMW more.

Wednesday, June 03, 2009

Why Bother?

At work we use this system all the time. I noticed that the length of the text in the password field changed whenever I submitted the form.

Some investigation revealed this:


function getScrambledPassword(pwd) {
var cipher = ['k', 's', 'z', 'h', 'x', 'b', 'p', 'j', 'v', 'c', 'g', 'f', 'q', 'n', 't', 'm'];
var result="";
if (pwd == null)
pwd = "";
pwd = encodeURIComponent(pwd);
//alert("encoded password: " + pwd);
for(var i=0;i<pwd.length;i++) {
var cc = pwd.charCodeAt(i);
result += cipher[Math.floor(cc/16)] + cipher[cc%16];
}
//alert("scrambled password: " + result);
return result;
}

Tuesday, March 10, 2009

Microsoft Certified Professional Developer in Enterprise Applications

Microsoft Certified Technology Specialist Logo

The Microsoft Certified Professional web site hasn't received my latest test, so it won't let me have a logo with "Professional Developer" in it.

Anyway, today I passed Microsoft's Exam 70-565: Pro: Designing and Developing Enterprise Applications Using the Microsoft .NET Framework 3.5. Quite a name, eh?

I'm not sure what it will mean for me, besides being able to put logos on my stuff now.

The logo usage guidelines say that I should put it on a white background. So I used my certified skills to modify the template for this blog to give it a white background. (I also had to widen the stupid thing to let me put pictures at the size I want - but that's another story.)

Monday, February 16, 2009

Baby Sweetheart

Hi, all!

Baby Sweetheart (a.k.a. Dorothea Elizabeth Grigg) was born at five minutes to nine on the evening of Friday, the Thirteenth day of February, the year of our Lord Two Thousand and Nine.

They Hate This Part

She weighed 7 pounds and 10 ounces (or 3.45 kg) (or a little more than half a stone).
She was 19 inches long (between 48 and 50cm) (or 4.75 hands).

Mom Sweetheart (a.k.a. Libby) was having some high blood pressure (PIH or pregnancy-induced hypertension). The doctor wanted to make sure she delivered soon, so he planned to induce her Friday morning at 7:30. Around 4 o'clock that morning Libby woke up and noticed some contractions. She decided to start timing them and they were coming regularly at 12 minutes or so.

Around 6 A.M. we were supposed to call the labor and delivery group at the hospital and make sure there was a bed available. We called and told them that we were having contractions about 9 minutes apart; they said that we should come in anyway.

We finally made it to the hospital around 8:30 and the doctor came to check Libby a little while later. When he checked her he confirmed that the process was started and we wouldn't need to induce labor.

Do What Now?

12 "short" hours later and our family had increased in size by fifty percent!

Click on the pictures to see more!