NUnit - ExpectedException with Custom Exception

While the NUnit docs give a good example of how to test for system exception types, it leaves you hanging on how to capture the custom exceptions that you are throwing. For instance, you might do something like:

throw new Exception("SSN should be formatted 123456789");

How do you set up your test attributes for this exception?

In VB:

<Test(), ExpectedException(GetType(Exception), "SSN should be formatted 123456789")>
        Public Sub ValidateSSNFormat()
        ' code that will cause the routine to throw the expected exception

In C#:

[Test]
[ExpectedException(typeof(Exception),"SSN should be formatted 123456789")]
public void ValidateSSNFormat()
// code that will cause the routine to throw the expected exception

DIY PVC Flute

Have you been thinking about learning to play flute but the cost of purchasing a flute has been holding you back. Well if you're a do-it-yourselfer check out Mark Shep's website and book. Following Mark's instructions I was able to build a PVC flute in no time at all. I've been having some fun playing with it. Next week I'll build one from CPVC.

RSS Bandit

Well, after the issues I had with NewsGator I explored some other news aggregators. I used Attensa for a while now and have been fairly happy with it. However, it is tied to a single machine. Then a recent update broke it and after several attempts at figuring it out and getting it going again, it was just easiest to drop it. I tried the NewsMonster aggregator that works (s'posedly) with FireFox but no go. It wouldn't install and work correctly. I did check out some of the RSS readers on www.codeproject.com but had some issues with one that appealed to me. So, now I'm using RSS Bandit. Having it not tied in to Outlook has actually been a good thing. It has a handy configurable synch feature. I used it to save settings/state to a flash drive. Then when I got home, I installed RSS Bandit on the home machine and downloaded from the flash drive. RSS Bandit went out to the web and pulled the content. I was good to go. Ironically, I should be able to synch with NewsGator OnLine too. Since I've already paid for that, I might give it a go.

MS Word 2000 and Visual Studio 2003 Interop

The other day a friend of mine was asking me about reading content from a Word document. To me, this was an interesting question. I'd previously been exposed to Excel Interop and was somewhat intrigued by his problem.

After a quick search of the web I came across numerous solutions on how to write to a Word document but nothing on reading from one.

So, I put together a small VS2003 solution in VB with some NUnit 2.2.2 tests as a "spike" solution. I am making available the solution at http://www.dbbear.com/WordInterop.zip for a limited time? (maybe) I hope that other's might find the simple class and unit tests handy.

Note: updated based on feedback. Better clean up with finally block.

NewsGator sucks

Right now I am harboring a lot of ill will towards the Newsgator folks. I was one of those that bought the Outlook version early on. You know the one that you'll never have to update again? Well, it didn't take 'em long to figure out that wasn't going to work so they switched their business model to where the Outlook version is part of the business package. But hey, we'll give the existing users a "free" upgrade to the 2.5 version and 2 years of service. After that though you have to pay every year. In a bit of a revolt? many people were sounding off with, whatever, I'll just keeping using this version with out all of the other new features. I simply don't need them. That's the camp I fall in to. Well the folks at NewsGator put their thinking camps on and figured out that they could turn off service to 2.0 clients.
The online synchronization support for NewsGator Outlook edition 2.0 will be switched off on Tuesday, November 8, at approximately 5pm MST.

If you are using Outlook edition 2.0 in synchronized mode, you will need to upgrade to Outlook edition 2.5, which has greatly enhanced synchronization capabilities.

Existing 2.0 customers can get a free upgrade to 2.5, along with a free 2-year premium NewsGator Online subscription, by following these instructions.


But, hey, what am I complaining about, they gave me a whole 34 or so hours notice from the date/time on the email to turning the service off. To frustrate me even further the install process nuked all of my default folder settings for the feeds I'm subscribed too. Nice huh? Then, they proceeded to download the ENTIRE CONTENTS of ALL the feeds. Only about 800 items to wade through. GRRRRR. And guess what else, they didn't fix the post to Blogger bug. I'll have to reinstall that. IS THIS THE FUTURE OF WEB SERVICES? You thought Microsoft had a monopoly with Office, etc. At least they can't turn off your Office 97 installation.

I'll definitely be looking around for a different service.

Update: Now neither of my Outlook Edition machines are synching. Lovely.

Update 2: After having the synch fail, ALL of my specified folder settings have been lost AGAIN.

Update 3: After 3 days, I got an email back from NG tech support. They pointed me to "Greg's" blog where he says it's just the synching which will quit working. One of the main reasons people bought the lifetime Outlook version.

My favorite part of the response: "If you still have 2.5 installed can you describe the problems which you have?" I thought I had outlined them pretty well here. But as of this moment, I don't have NewsGator installed.

NewsGator really screwed up on this whole deal. They should have just sucked it up and let the 2.0 folks continue on with what they have. And then try and entice them to switch to one of the newer plans with better features and service. Depending on what we see in OutLook 12 or Windows Vista RSS, the need for NewsGator Outlook edition will be obviated. The NG WebEdition and Synch Service is where they will be making money down the road. That's why they had to figure out a way to pull the plug on the existing lifetimers. It all smacks of the PayPal "free now and free forever"

Extreme Programming in St Louis, MO

We had a meeting Monday night and did some testing of "untestable" code. Brian Button briefed us with a simple problem he'd run into and presented us with a sample project to tackle. The problem was not so overwhelming that you got lost in what it was that was trying to be accomplished by the code, but you could focus on the testing part. (It was a simple problem dealing with putting together a string based on the AppDomainName.)

We broke up in to small groups. Mixing up some with people we don't usually work with. (Which I really liked.)

The first thing we had to do was put together a VS2003 C# project. The VS2005 solution format isn't compatible with VS2003.

Brian had already briefed us that two of the tests weren't passing and it was obvious that this should be the case. However, the fun part was that two of the test may or may not pass depending on the test runner you ran them with. Initially, NUnit was passing two of the test and ZaneBug was failing all of the tests! It turns out that NUnit creates an AppDomain with a much longer name than does ZaneBug. I liked being able to switch between the two different test runners and see how things were behaving.

    The interesting things for me out of the evening:
  • My team got to see TDD on "untestable" code.
  • We got to practice mob/pair programming.
  • We got to interact with other people that are doing/working towards XP.
  • The different groups came up with 3 or 4 other solutions than what Brian had coded.
  • Although we didn't go this route, I saw where an interface would have been handy in creating a mock object.
    Things to keep the same in the future:
  • Mixing up the groups with people that don't usually work together.
  • Simple problems that let you focus on the TDD as opposed to the algorithm, etc.
  • Open networked environment
  • Brief presentation to entire group
    Things I'd do different:
  • Let someone else drive?
  • Have beginning/starting point code available printed.
  • Give TDD guidance up front or at the end, but not during session. (Only answer the business rules questions.) Maybe preferably at the end? I'm pretty sure we would have implemented things differently if we didn't know how Brian had implemented it. Although, we did discuss the various alternatives and their pros-cons and opted for the route he went. Partly for the sake of time, too. But once you had an inkling of how it was solved it seemed a bit like being told the ending to the movie.

Overall, I enjoyed the meeting and I look forward to future meetings and "hands on" nights.

Recent Command Post Deployments

I was Incident Command at our local "Ham and Turkey Festival" this past weekend. Luckily only a few minor incidents. We had our EMA command post set up and had multiple Law, multiple Fire, EMS and 911 in the structure. Good activity for all involved. I won't say exercise or training, because it was the real deal. We had real issues with the real people responding. As part of it, we were testing all features of the new command post and working with a prototype CAD software I'm developing. Numerous tours were given and feedback was gathered for review. 153 hours were logged for the event. Last night we had our first rapid deployment. We hadn't fully rehab'ed from the weekends activity, but we had worked out some kinks Saturday at the Ham and Turkey Festival. We responded with the Command Post to an overturned propane tanker. Ironically? while enroute, another ham from the neighboring county gave us a holler on our local UHF repeater to ask about our status. He was out with the HazMat Comm team from that area, which serves a wide area including our county. Luckily we didn't need that resource. It was estimated that 80 gallons of diesel and 8900 gallons of propane were onboard the truck. We set up on the road blocked highway in the cold zone. The incident commander took up residence at the command post and we established communications with the Law, Fire and EMS units on scene via mutual aid channels. The central dispatch center was able to clearly copy our traffic on one of the mutual aid frequencies. This freed up two of the county wide repeaters for other use. (Did I mention we also had another active incident in the same area a result of an earlier tornado warning?) We had numerous entities involved and multiple locations. Approximately 70 hours were logged during the time the command post was on scene. It was a somewhat extended deployment but overall very successful and rewarding.

Katrina window open and closed.

Well, I came close to deploying to Katrina several times. Actually had the green light once and was then disregarded. The last round I was scheduled for a third rotation with a comm team and the second team was released, mission complete.

Long Weekend

Complete Universal kits are never complete nor universal when you are 30 minutes from the hardware store.

A loose (inaccessible) battery cable is all it takes to make all your gauges wacko and finally leave you stuck on the side of the road.

No one stops for a big biker guy on the side of the road. Unless you've just about got the bike strapped down in your buddy's cattle trailer. Then the police stop to check things out.

The indicated gasket that you picked up before the bike died doesn't fit.

Finally, universal air conditioner install kits are not designed for the metal frame and concrete sash of a dorm room.

Do you have ICE in your mobile?

Putting ICE along with a name and telephone number will enable the emergency services to contact your family in the event of an emergency. I highly encourage everyone to put ICE in their mobile phone.

Radar Widget for Konfabulator

Here is a link to the Radar Widget I hacked up. Fun stuff.

Konfabulator

I recently heard of Konfabulator www.konfabulator.com when reading that Yahoo had bought them and they're going to be renamed Yahoo! Widgets

Konfabulator implements a pretty slick concept of "widgets" that are what you want them to be.

Combining the use of XML and JavaScript for implementing widgets definitely speeds up development.

Messing around with a widget I downloaded last night proved to be highly addictive.

They have a lot of widgets in the widget gallery.

I intend to release the updated Radar widget that I worked on last night.

Check 'em out, you'll like 'em.

I am Kung Fu Master

What Video Game Character Are You? I am Kung Fu Master.I am Kung Fu Master.

I like to be in control of myself. I dislike crowds, especially crowds containing people trying to kill me. Even though I always win, I prefer to avoid fights if possible. What Video Game Character Are You?

Willing to go?

The other day I was out fishing.  I was trying out some new tackle I'd received for father's day.  I had made a couple of casts when one hit.  I could tell that it was a good size fish by the way it was fighting and it was pulling line back out too.  I was playing it and hoping that it would show itself. Then it did one of those flying through the air like a ballerina moves.  It was beautiful.  We continued our struggle.  I was giving it slack when it needed it and reeling in when it tired.  Then, it decided to bolt for the open water.  This would typically have not been a problem.  I would usually let it run and give it the slack it needed.  But this time, I felt I couldn't.  If I would have given it the slack to run it have taken the line under a low foot bridge (that I couldn't pass under) and I would have had a heck of a time playing it then.  So, I grimaced and tried to bring it in the last couple of feet.  Then with the extra tension on the line the fish did a 180 degree turn and freed it self.  Retrieving the expelled lure intact was my only consolation.  Nothing else was biting that day.

There is a lesson here and it has been sticking with me so I feel compelled to put it in bits.  In contract work we are always out fishing for clients.  Sometimes we get a bite, a requirements gathering meeting and a request for quote.  As we're getting into the details of the requirements and design we see the prize.  The big bass in mid-air.  As we continue working on the quote, we have to struggle with do we want to go where it's taking us?  Are we willing to stretch and work under the foot bridge?  Or are we going to pull too hard and lose the client?

 

What areas of our life do we need to evaluate our willingness to go where we're being pulled?

The fish aren't biting.

Well, last night the fish weren't biting at all.  It's been over a year since I've gone fishing and not caught at least one or two fish.  I was fishing in a new area for me at an odd time.  I tried several different lures and varied the presentation.  No go.  Last Sunday, I pulled a 16" 2lb bass from the same waters.  So what was different?  Different time of day, different temperatures and slightly different lures.

Reflection

What can I learn from this?  That even though yesterday we used a technique and it paid off big doing the same thing today may not have the same return on investment.  We need to be constantly changing, improving adapting.  (Different lures and presentations.)  And even then we still may not see the return we want.  However, giving up isn't an option.  If anything the lack of result kept me out longer than I had intended.  Maybe the lesson there was cut your losses and get on to something more productive.  I keep thinking if I had gone back to a more familiar location I would have at least caught something.

Kind of like Extreme Programming versus Waterfall.  Even if you don't get to the target you had hoped you at least have some deliverable for the effort that was put in.

Life lessons from fishing

Goals Say you start the outing with the goal of bringing in a big bass. This could be like the life goal of landing your dream job with better salary. Changing the lure You get to fishing the lake and you're not having any luck bringing in the fish of your dreams. This is like trying to get that dream job. So, you have a couple of options; change your location, change your goal and self improvement. Changing your location This is pretty self explanatory. If you're fishing the bank, keep moving around. If you can get out on the water. If that's not working change lakes! Life story, work the job, angle for promotions. Move to another department or division for promotion or change jobs to get that raise. Changing the goal Maybe you are satisfied to not get the big bass. You've resigned yourself that they just aren't biting right now. Change your goal to fishing for panfish. Land one and be happy. This is like a soft job market. It's going to be tough to increase the income level for now so change the goal to be do the one thing I need to do that will best increase my marketability when the market firms up. Self-Education Read and study up on knots, lures, equipment and techniques. Practice before you get to the water. Life story, while you're away from work learn new skills that improve your marketability and potential wage earning capability. Maybe these new skills will give you the edge in landing that big bass (job). Networking Talk to other fisherman. Learn from them. They know the lay of the land. They have a feel for what lures work, the times of day and the hazards. In life your network can help you improve your work skills, tell you how to get through the red tape and warn you about the politics of the situation. And they can help you land that big bass. Success When it's all done, you can rest satisified. You did the best you could. You landed three bass and two crappie. None of them the dream bass you're after but you've learned, built relationships and had fun.

Busy day with webapp

Well, spent a bunch of time working on an ASP.Net application today. I haven't done much at all with ASP.Net so there was a bit of head pounding. However, by days end I had forms authentication set up. A table with the UserID, Password, etc info was built on SQL Server. Using stored procedures to get what I need. Getting the spike solution integrated into the real application proved to be a little interesting. I was running into issues because I hadn't remembered to abandon my session authentication between test runs. I got the application set up to be cookieless and save all state information with a state server hosted on separate machine. Had to edit the registry to permit non-local users to connect to the service. Then I was able to set some session variables for the application. Then I did some refactoring and created a common logout function for the application. I also set up the application to get configuration (connection) information from the web.config. So finally feeling like I had accomplished something, it was time to go home. It was a beautiful ride home on the Harley. It was extremely hard to keep from flexing the wrist. The icing on the evening was catching a couple of crappie right off the bank (they were nesting). Then I reeled in a nice small mouth bass with my ultra-lite combo. Now to get some rest before getting back at it tomorrow.

ColdHeat Soldering Iron

I just received a ColdHeat Soldering Iron as a gift. https://www.asseenontvnetwork.com/vcc/coldheat/coldheat/115785/  It's a pretty slick little device.  The two big things that caught my attention are that it's cordless and they claim that the tip cools off near instantly.  Well after working with it a little bit I can say the following:

Don't plan to use it for really fine work.   It has a split tip that works more like a welder than a soldering iron.

It works best on smaller gauge wire.  Seems like it would be great for splicing wires in the field.

My initial assessment is I don't think it would work well to solder coax or coax connectors.  Because of the mass involved with the coax braid and the connectors I think it would be tough for this device to heat them up well.  I think with larger wires and connectors we'll see lots of cold solder joints using this device.

Overall, I like it for it's intended use, soldering small gauge wires together in the field.  This will come in handy for antenna work.

Been busy - work, antennas, motorcycle

It's been a little since I last made an entry here. I've been busy on a work project. A conglomeration of VB.Net, Lotus Script, VBA, SQL server, DBF and XML stuff. It's nearing test/production and I'll be happy to move on to the next project. I was working on my motorcycle this weekend getting ready summer and came up short some parts. I made the hour and a half round trip to the Harley dealer only to get home to find out he'd given me a male part that I needed as female. That'll have to wait now. Having to special order some vinyl tubing from another dealer too. I'm really anxious to get the bike going again so I can get to the shop and have a new rear tire put on. So, what to do since I couldn't get going on the bike? I built an antenna. A colinear design from the September 2003 QST. It's about 9' tall (I built it for a higher frequency) and it works gang busters! A friend will be putting it to use out at his farm so I'm looking forward to hearing how well it performs there. I may build another one for putting out on a remote weather station. Tonight I played a little QRP portable. I was outside with a random wire (sort of) antenna with a tuner and RG-62 coax. Worked VE6CQ in western Canada. What a blast! He had a bit of a hard time copying me at first, so I switched to the home rig. Copy there was 59/59. We did a quick swap of mics on the FT-817 to the regular mic with the One Big Punch installed and he said the signal was considerably stronger. However, with the set up I had, RF was definately getting back into the mic. Ah well, it was fun!

ADO.net, the Connection Pool & Garbage Collection

How often do we code something like this:

for each object O in ObjectsCollection
    SharedFunction.Processing(O)
    do some stuff
    SharedFunction.WriteToDb(O)
next
A little background

The SharedFunction.Processing call does some SQL reads. I'm using the SQLHelper from Microsoft.

Problem

The problem is that with the above code after about 120 objects O I'm getting an error. Connection Time Out or Max Pool Size reached.

The Cause

It is such a tight loop that garbage collection isn't having a chance to clean up the left over connections from the Processing and WriteToDb.

Solution

The solution I used was to force a garbage collection. Then everything is honky dory.

Currently their is a "global" of sorts that carries the SQL Connection string. I didn't want to mess with a global connection as that's just asking for problems. However, an alternate solution could be to refactor SharedFunction.X to be instance functions, instantiate a connection in the instance and reuse it with the instance functions.

After looking at this some more, the alternate solution really isn't that nice to implement. It would require modification of two Business Logic Layer code modules and their associated Data Access Layers. I'd rather not be worrying about carrying a connection around and be more focused on what I'm really trying to accomplish.

Zeigarnik effect

I read this with interest.  I would have to agree with it from my own personal observations.

What does this mean to us in terms of software development?  Is it better to end the day (or go to lunch?) in the middle of a task?

The Zeigarnik effect is the psychological tendency to remember an uncompleted task rather than a completed one. Bluma Zeigarnik first discovered this effect in the 1920's while in a viennese coffee shop. She noticed that a waiter was able to...
[Rachel Davies]

Untitled

The audio that spewed forth
assaulted my ears and shook my core.
The piercing highs made me wince.
Mushy bass churned in my stomach,
like a bowl of left out too long cereal.

The Omelet model of Management

Ok, so I believe in looking at the world around you and seeing if there is a metaphor their that goes along with some concept I've learned. The other morning I was cooking an omelet and saw how the steps I was taking fell in line with the primary functions of management. POSLC: Planning, Organizing, Staffing, Leading and Controlling.

Decide what type of Omelet - what you want in it.

Plan
Gather ingredients Staff
Prepare cook area and ingredients Organize
Saute the ingredients w/seasoning Training

Cook the omelet

  • medium to medium-high heatt (so it doesn't scorch)
  • watch the omelet rise
  • flip it over when ready

Management functions

  • Controlling
  • Stretching (working to minimize risk of failure)
  • Controlling and Leading
Eat the omelet and smileAppraise and give feedback

7 Habits & The Church

It's been about 10 years since I last read this book. Now that I am working through it again I am able to internalize it much better. Definitely a book that is worth re-reading. In my opinion it would behoove church leaders to check this book out. From what I have seen the church at large needs to re-examine it's mission and goals and objectives. I think we will start seeing more of this viewpoint with Generation Y'ers. Generation Y people and to some extent gen X'ers are examining their faith's goals and objectives and are finding that they are inconsistent with current practices. One example is the "mega-church" with it's multi-million dollar building and expensive fixtures. The question is, "Why did we spend $10 million on a new church instead of going for a modest structure and planting a lot more new churches?" Counterpoint, how Spartan is too Spartan? I recently attended service at a new church plant. They are meeting in a former grocery store (for now). They do plan to build a "real" church. They purchased chairs for seating and they have a band for the service. This all seems reasonable. But when does reasonable become too much? The gen Y'ers I know would be more than happy to meet, study and worship in someone's house or out in a field. More later...

Pave Hawks go to Sri Lanka

Check out this brief article and some pictures of our Air Force sending some helicopters to help out in Sri Lanka.

Washed my flash drive

Well for the second time I've washed a flash drive. The first flash drive came through ok, although my level of confidence in it's reliability dropped significantly. This drive seems to be sealed much better. We shall see later today how it faired. This has got to happen more often than we'd think.

UPDATE: The drive seems to have made it OK. Both drives are made by SanDisk. One is the Cruzer Micro and the other a Cruzer Mini. The only issue I've had is that the caps don't seem to fit very well now... too loose.

Be careful to make sure that ALL moisture is removed from the drive. Water can real a do job on your device by causing corrosion between the legs on the SMT components. You can try and remove by flushing with rubbing alcohol and placing the USB drive in a container of uncooked rice.

XP and the 7 Habits

I am currently reading Extreme Programming Perspectives and The Seven Habits of Highly Effective people. The thought that really struck me is how 7 Habits is about being principle centered and that's what XP is about. While the waterfall model is all about a rigid framework, XP is focusing on certain key principles and what needs to be done when we stick to our principles. From personal experience it seems like we come with up rigid frameworks and steps when we are trying to get a group of people that aren't operating under the guidance of the same principles to produce something. And not surprisingly, no matter how detailed your process, the person operating outside of those guiding principles will find a way to break the process or bend it in a way that is contrary to the principle that is the fundamental reason for the process. So, my experience leads me to believe that no matter how many processes you put in place and no matter how detailed they are, if the developer isn't committed to the same principles, you aren't going to get the end result you were wanting. On the other hand, if everyone is committed to the same principles it seems like you don't need much of a framework to get the desired end result.