2009-09-09

A nullable DataGridView CalendarColumn

A while back, I managed to fix a couple bugs with the sample DataGridView CalendarColumn control that made it much more usable. Today, I came across one more issue. It's pretty well known that the DateTimePicker, despite having support for a checkbox that lets you turn a date on or off, does not directly support "null" as a valid value. There are a bunch of ways to get around this, but what I came across was a need to support this inside of a DataGridView.

I started with the task of making the CalendarColumn configurable in such a way as to be able to turn the checkbox on or off at will (well, at least, at the moment of construction). That part's easy; I added a new constructor to CalendarColumn to take an "isNullable" flag:

public CalendarColumn() : base(new CalendarCell()) { }
public CalendarColumn(bool isNullable) : base(new CalendarCell(bool isNullable)) { }

Then, I added a class-level variable to my CalendarCell class, and initialized it in the constructor:

public class CalendarCell {
    private bool isNullable = false;

    public CalendarCell() : base() { 
        this.Style.Format = "d"; 
    }

    public CalendarCell(bool isNullable) : this() {
        this.isNullable = isNullable;
    }
[...]

The next modification comes in InitializeEditingControl. Immediately after getting the reference to CalendarEditingControl ctl is set:

    ctl.ShowCheckBox = this.isNullable;
    if (this.Value != null && this.Value != DBNull.Value) {
        if (this.Value is DateTime) {
            ctl.Value = (DateTime)this.Value;
        } else {
            DateTime dtVal;
            if (DateTime.TryParse(Convert.ToString(this.Value), out dtVal)) ctl.Value = dtVal;
        }
        if (this.isNullable) ctl.Checked = true;
    } else if (this.isNullable) {
        ctl.Checked = false;
    }

(Note that I added a little checking around the value setting area, because I'm paranoid like that.)

Next, DefaultNewRowValue:

public override object DefaultNewRowValue { get { if (this.isNullable) return null; else return DateTime.Now; } }

Here's what I found out you don't change. The ValueType property always returns typeof(DateTime). If you change this to typeof(DateTime?), what ends up happening is, if you bind to a DataTable, it attempts to insert an actual null into the table. Because (for reasons I have yet to believe necessary) null and DBNull are two completely separate and incompatible things, this fails. Apparently, by leaving the value type as non-nullable, a null value will get translated appropriately in the binding.

We're not quite done yet. In the CalendarEditingControl class, the EditingControlFormattedValue property needs to be updated:

public object EditingControlFormattedValue {
    get {
        if (this.ShowCheckBox && !this.Checked) {
            return String.Empty;
        } else {
            if (this.Format == DateTimePickerFormat.Custom) {
                return this.Value.ToString();
            } else {
                return this.Value.ToShortDateString();
            }
        }
    }
    set {
        string newValue = value as string;
        if (!String.IsNullOrEmpty(newValue)) {
            this.Value = DateTime.Parse(newValue);
        } else if (this.ShowCheckBox) {
            this.Checked = false;
        }
    }
}

And presto, a checkable, nullable DateTimePicker column that works in a DataGridView bound to a DataTable.

2009-09-06

Bandwidth for August

Totals are 55.07GB in, 6.50GB out, total 61.57GB.

This month, numbers went way up, thanks to biting the bullet and activating my Netflix subscription and streaming movies to my Xbox 360. On the 1st, we watched about four hours of video (one feature-length movie, a shorter cartoon movie, and a kid's video), and on the 2nd, we watched close to eight hours (four movies and two TV episodes), all standard-definition. I don't recall all of what we watched on the 8th, but it resulted in even more bandwidth used.

Just taking the numbers for the highest usage day, it does show an interesting point. If I were to stream eight hours plus of standard-def video every day (resulting in 6.25GB of use, including random web surfing and other internet activity that day) for the entire month (31 days max), that still leaves me with 56GB before I hit the 250GB cap. Up to this point, my highest usage month was under 38GB, and the average was 26.85GB.

2009-08-29

ServiceMagic.com, or SpamMagic?

This summer, we had a problem with water in the basement. With our son in the hospital, it didn't exactly take a high priority, but eventually we had to get it taken care of, as it was bringing in a lot of sediment and mildew (and mold is one of my biggest allergy-triggers). I realized, though, that for a problem like this, where I had what appeared to be water seeping into the basement from an unknown source (was it coming in from underground, a broken pipe, or a leaky vent to the outside?), I had no idea who to call. That's when someone directed me to the web site, ServiceMagic.com. "Get Matched to Top-Rated Service Professionals", their site proclaims.

So, I created an account and described my problem. I thought this would be a good opportunity to use my brand new Google Voice phone number, too (720-23-YAKKO :D ), as I wouldn't have to provide my cell or home telephone number, just in case. As you will see, this turned out to be quite a blessing.

I got a call from a company to come out and take a look. Unfortunately (or fortunately), they had one time available that week that didn't work for me, and the next available time was several weeks away. I went ahead and scheduled that other time. I then called my insurance agent, and from them I got a list of contractors they used. (I also checked to see if my homeowner's policy would cover this water damage, which, alas, it didn't.) I called one of their "preferred contractors", and they were able to schedule a time in the much more immediate future.

In the meantime, I got another call from the contractor that ServiceMagic referred to me, asking again if I wanted the time that wouldn't work for me. (Note that these calls were going to my Google Voice number, so they would leave a message and I would call them back.) The contact number was very different, leading me to believe that I first was contacted by a scheduling service before and the local contractor later. Whether the scheduler was a part of ServiceMagic, the contractor, or some third-party go-between, I'm not sure. But in any case, I again verified my appointment for several weeks out.

The contractor I contacted through my insurance agent came out and diagnosed the problem as a leaky drainage pan with the air conditioner. We then scheduled an appointment with the HVAC company to come out and fix that (and reconsidered an annual maintenance contract with them), and the leak was taken care of. (It actually cost us twice as much more for the contractor to diagnose the problem, than it did for the HVAC guys to fix it.) Problem solved, I then called the other contractor — the one referred to me by ServiceMagic — and canceled my appointment.

The contractor has since contacted me a couple more times (once by phone and once in a letter), and ServiceMagic once (e-mail), about that appointment directly. Basically, the nature of the messages have been "if you reconsider, we can still help you". Nothing outrageous, and nothing to get too upset about.

What has been extremely annoying have been the completely unsolicited calls I've received, totally unrelated to this project. I had three calls attempting to schedule a time to install carbon monoxide detectors in my basement (one claiming it was required to meet compliance for rental properties — my home is not a rental; and anyway, I already have a CO alarm in my basement), and one was a plumber that was, as his message said, "calling to verify our appointment in a half an hour" (I of course had made no such appointment).

Again, fortunately, this is all going to my Google Voice phone number, so I'm not bothered at work or at home by these phone calls for random services I did not order or do not want. However, it still bothers me that ServiceMagic.com seems to be giving out my personal information to contractors that have nothing to do with me, without my authorization (I did actually click an OK before the first contractor called me). So far, I only have to listen to and ignore their messages; heaven help them if someone comes to my doorstep claiming they have an appointment.

And how do I know this is coming from ServiceMagic? Well, not only are these contractor-type phone calls that came in after I requested some kind of home service, but they are coming to a phone number that I had never before used or published. Could Google Voice (or, its former name, "Grand Central") have obtained this phone number from a pool of "recycled" numbers from someone who just happened to be a rental property owner who hired a plumber this month? Maybe, but that's an awfully large coincidence. Could my information have leaked out not from ServiceMagic, but from the contractor they worked with or some third party in between (such as the "scheduling agent" who first contacted me, whom I am not certain about)? Again, possibly; but that would reveal a potential danger in the whole process of obtaining a contractor through ServiceMagic.com anyway.

I have since changed my personal information on my ServiceMagic.com account to something more or less random. I most certainly will not be using them again, and I would encourage everyone else to avoid them as well.

2009-08-28

Yakko, Party of Six...

Last week, we welcomed our fourth child into this world. I certainly don't mean to belittle his arrival or how happy we are to have another healthy boy in our family, but compared to our last experience, this one was rather uneventful.

My wife, who had been having a lot of Braxton Hicks contractions this pregnancy, had just sat down to rest, and I had just sent the kids upstairs to get ready for bed while I finished up a couple rounds of a videogame I was playing. After a bit, though, she said, "I think I'm in labor." The contractions didn't go away with sitting down, and they were coming regularly.

She made the required phone calls, and I turned the game off and went upstairs to hurry the kids into their sleepwear and grab the sleeping bags — their overnight bags were already packed. We loaded them up, dropped them off at a friend's for the night, and went to the hospital.

Just as we were pulling into the parking lot, we finally got a call from the obstetrician. He hadn't called yet, as he was in the middle of another baby delivery at the time at a hospital about 10 minutes away, and he had another delivery coming. Knowing how fast my wife tends to deliver, he wasn't confident he could call another doctor and get them to our hospital in time, so he asked if we could come there. The contractions hadn't gotten any faster or harder yet, so we turned the car around and drove down the highway to the next hospital.

We got there and had to fill out paperwork (because we had preregistered only at the other hospital), then got checked into the room as her contractions finally started to get hard enough to hurt. The doctor came in, broke her water, the contractions really started, and before long, we had another healthy baby boy, just about two hours from the time my wife told me "I think I'm in labor."

Yeah, my wife tends to make a lot of women jealous in that respect. Strangely, though, they're not too jealous of her having a baby on the couch. Go figure.

2009-08-14

Arrow of Light Ceremony Box

I was called as the Cubmaster for the Cub Scout pack sponsored by our Church, and last month, I had the opportunity to award the Arrow of Light to one of our boys. I looked up some various ceremony ideas online, and I remembered seeing a couple where the Cubmaster would identify seven virtues with the seven rays coming from the sun on the award. I figured that would be a decent idea to go with, and I found a ceremony that had those seven virtues. But I needed something visual to go with it, something that would make it special and memorable for the Cub instead of just some old guy standing in front of him reading a speech.

I had seen the ceremony before where there was a model of the Arrow of Light, and seven lightbulbs or some other electrical contraption wired up so that each of the rays could light up with each of the seven virtues. The only problem was, I never saw one actually working. Seems like there was always something wrong — a loose wire, a lack of lightbulbs, no access to a power outlet — that it ended up just being some old guy standing in front of the model reading a speech anyway.

I decided to do the same concept, but simplify it quite a bit. I have zero electrical engineering talent anyway, so I doubted I'd be able to wire anything up, but I figured something that wasn't wired at all would stand a greater chance of actually working when called for. My concept was simple: create a box large enough to hold a battery-powered lantern inside, cut out the Arrow of Light in one face, and cover the rays of the sun with something that could be revealed one at a time as the virtues are announced.

I decided to start with a cardboard box, and a Pampers diaper box fit the bill nicely. It was sturdy, had a nice rectangular shape, and was just tall enough to accommodate the Coleman battery-powered lantern I had handy. I removed the top flaps completely, and pried open one of the bottom flaps as an access panel to inside the box. I then covered most of the outside surfaces with black construction paper, using black electrical tape to attach it. (I considered lining the inside of the box with aluminum foil to enhance the lighting effect, but I didn't think about that until the end and decided it wasn't worth the effort.)

Making the Arrow of Light front panel was, naturally, the hard part. I originally thought I would make it out of scrap wood, but my wife, who is far more craft-wise, suggested sheets of ¼" foam core instead. We found an outline picture of the Arrow of Light badge, enlarged it, and printed it out for a guide. The proportions weren't exactly right, but it worked out with only minor adjustments. The rays on the top of the sun obviously don't hit the border of the panel, either; rather, we made them all approximately the same size and shape.

Foam core cuts fairly easily with an exacto-knife, although by the end of the cutting, my arm was good and tired. I cut out the arrow and the sun, and the ray pieces I cut and kept, numbering them so I would know exactly which one went back where for a "perfect fit". I also cut thin strips to create the border.

Next came painting. It took two or three coats of blue craft paint to turn the whole panel blue, but the hard part was painting the ¼" seam inside the cuts (so as not to have a really ugly white border around every opening). Foam core doesn't make a clean cut on the inside, and it involved a lot of jabbing the paint brush into bits of styrofoam to turn it all blue. The border sticks, on the other hand, just took a quick brushing of yellow.

To turn the inside yellow, I used yellow tissue paper and covered the interior side of the panel. My wife suggested using a layer of clear vinyl first, to protect the tissue paper from being destroyed by curious fingers, but I was afraid it would be too shiny and would distract from the effect. I thought it was a good idea, though, so I thought I'd mention it here.

I then put the panel on the box. It actually fit quite snugly on its own, but I secured it from the inside with duct tape. (I don't know how well the tape will hold, though; because I lined the inside side with tissue paper, the duct tape is only holding on to tissue paper glued to the foam core, not the foam core itself.)

I took the ray pieces and tried putting them in and taking them out, using the exacto-knife to shave around the edges until I could take them out easily. I then took staples, stuck them into the top of the rays, and bent them out to create handles for removal. (This turned out to be futile, however, as the staples came out of the ray before the ray came out of the sun. Fortunately, the bottom of the ray is accessible to fingers and very easy to remove.)

I don't know if the kids were really in "awe" of it or not. It didn't light up too much in the light of the gymnasium — although I did leave it on for the rest of the evening. Later, we had a "crossing over" ceremony for a Cub (the same scout, as it happens) who was graduating to the Boy Scouts, and part of that ceremony included turning off the lights; and the Arrow of Light was glowing very nicely during that time. :)

I posted some more pictures of the box from various angles over on Flickr; click either of the thumbnails or this link.

2009-08-08

Netflix Streaming - so *that's* the big deal

As I mentioned in my last bandwidth post, I finally subscribed to Netflix so I could play with the instant streaming option. I've only had it for a week, but I've already collected a few thoughts.

I'll save my bandwidth comments for the end of the month in my traditional bandwidth post (although the numbers so far are encouraging).

I have already noticed that, as far as instant streaming is concerned, the selection is average. If you search the entire Netflix database and start paging through selections (which, unfortunately, you can't do until you subscribe), you can find yourself flipping through pages of items where only 1 or 2 at best (and often 0) are available for instant streaming. (My completely uneducated guess is about 4-5% are available for instant streaming.)

However, even if the selection is limited, there's still some interesting movies worth watching. And the nice thing is, they're available to watch at any time. I've found movies I had been curious about seeing for a while, but just haven't wanted to invest the time in renting from the video store.

There are also a few kids' videos. Again, not everything is available, but it's nice to have a couple Thomas the Tank Engine videos available on demand when the toddler needs some down-time.

There are still some disadvantages to the service. For instance, although having the aforementioned Thomas videos on demand are nice, they're only available when my internet connection is stable, and they're only available on the Xbox 360 in the family room, not, say, on the DVD player upstairs or in the minivan.

Also, Netflix Streaming does not support captions. We've been in the habit of having closed-captioning turned on and the TV not so loud. But when watching a movie on Netflix, we have to crank the volume higher than normal to make sure we don't miss anything.

Another down side, the Netflix Streaming movies include only the movie. There have been no (as far as I've seen) options for director's commentary tracks or any other bonus extras.

My kids have watched Who Framed Roger Rabbit? twice so far, but the second time they tried to watch it, it quit very near the ending as our internet connection hiccupped and knocked the 360 temporarily offline. Every time we watch a movie, even if it's the same one over and over, it must be streamed across the internet anew, consuming bandwidth.

We watched National Treasure 2 over the weekend, and although we enjoyed it, it's probably something we would only watch the one time. The lack of bonus features was missed, but something we could live without. (In fact, when we rented National Treasure on DVD a while back, we almost felt obligated to watch all the extras before returning it; so being reduced to just the movie was almost a relief.)

In summary, I think Netflix Streaming is no replacement for actual DVDs. (In fact, replacing all physical media for all-digital downloads and/or streaming is, I think, a recipe for disaster for consumers; which is something I've ranted about on my gaming blog at length.) But for a quick, no-commitment, no-frills, impulse rental (not to mention for no additional cost once you have a subscription to the service), it does the job well.

2009-08-01

Bandwidth for July

As I continue to monitor my own usage for my Comcast internet service, I note that, at some point, I was intending to compare my numbers to the numbers that Comcast itself reports that I am using. However, it appears, after having implemented this cap 10 months ago, Comcast still has not released a bandwidth meter to their customers. How it is they can get away with limiting your usage without telling you your usage is beyond me, but there it is.

And, as for the July totals, here it is:

Totals are 16.95GB down, 4.97GB up, for 21.92GB total. There's a huge spike on the 31st, which might have to do with watching a lot of YouTube videos of "Literal Videos".

Stay tuned, though; next month is about to get interesting. Microsoft has released an update to the Xbox dashboard that allows you to watch Netflix movies in a virtual theater with friends. Virtual MST3k, here we come! :D

I activated my Netflix free trial today, and seeing all the movies and shows available for my kids, I can already tell it's going to get a lot of use and be well worth it.

2009-07-29

This is not the SelectedValue you're looking for

Oh, here's a fun one.

I have a list of locations that I'm retrieving from a web service, and I want to display them in a ComboBox. I also want to have a blank entry at the top of the list, so "nothing" can be selected. While I'm sure there are ways to do this with less code, creating binding objects and such (especially since the retrieved object list is already pre-sorted in the order I want), I've resorted to just creating a DataTable with an ID and display column and copying the values I want into it. It does make things easier when I have one combo box filter another, as DataTables already have code written for searching and filtering.

Anyway, after I get my data, I have a DataTable that looks like this:

LocationIdLocation
DBNull.ValueString.Empty
2Aurora
7Colorado Springs
1Denver
3Ft. Collins
4Longmont
6Parker

Now, I bind it to my ComboBox like this:

combo1.DataSource = dataTable;
combo1.DisplayMember = "Location";
combo1.ValueMember = "LocationId";

Note that you have to set the DataSource first and the DisplayMember & ValueMember properties second, otherwise you get a ComboBox full of "System.Data.DataRow". Nice.

Now, on this form, when a value is selected, the selected value is used to filter another list; and, when the form is submitted, the selected value is passed off to a web service. How do you find out when a value is selected, and what that value is? Simple; bind to the SelectedValueChanged event, and query the SelectedValue property, right? In theory.

In practice, no. To make a long story short, I dropped a label onto the form so I could see what was going on in "real time". First, the code:

private void combo1_SelectedValueChanged(object sender, EventArgs e) {
     label1.Text = Convert.ToString(combo1.SelectedValue) + " - " + Convert.ToString(((System.Data.DataRowView)(combo1.SelectedItem))["LocationId"]);
}

And the results:

ComboBox selectionLabel1.Text
empty - 
Aurora1 - 2
Colorado Springs2 - 7
Denver3 - 1
Ft. Collins4 - 3
Longmont6 - 4
Parker7 - 6

Incidentally, the SelectedText property was always blank.

On the up-side, as you can see, I found a way to get the real value (using the SelectedItem and casting appropriately). On the down-side, it means I have to use that construction to get the selected value on this and every other similar ComboBox (there are actually four on this form alone), since SelectedValue, apparently, doesn't.

2009-07-23

You have... zero... messages.

As I was attempting to pay my T-Mobile bill this past weekend (a futile endeavor, as their billing system was unavailable — an unfortunately very common occurrence), I decided to look at their offered services. It was mostly just morbid curiosity rather than actual interest, as I find cell phone rates for services obnoxious.

I've ranted about the ridiculousness of text messaging prices before. (As a side note, I have noticed that it does seem that I am not charged for a text message receipt when one is sent to me, but only when I choose to read it. It's still not terribly comforting, considering my phone has a tendency to double-tap the "OK" key, so my attempt to view my message list often inadvertently results in my reading a message, whether I wanted it or not.)

One thing that annoyed me was the fact that text messaging plans were specific to phone lines, not to plans. My wife and I have a phone plan where we share minutes; but we cannot get a plan that allows us to share messages. Well, T-Mobile has added a family messaging plan that — lo and behold — allows you to pay once for messaging on all lines on your account! Unfortunately, the only plan available for an entire family is the "unlimited" plan, which is $25/month. It's still way above and beyond expensive for our usage (which is more like 10 messages per month), but I'll bet for some families, this would be quite a deal.

Another major annoyance I had was that there was no way to block text messages. You couldn't stop someone from sending you messages to potentially run up your phone bill. Well, that, too, is no longer a problem. There are now options for blocking messages, either per-phone or for the entire plan. There are various options for blocking, too, limiting outbound messages only, or limiting inbound messages to those from other phones (i.e. no automated spammers), or blocking all inbound and outbound messages completely. And best of all, all of the options are free!

Needless to say, I turned on all message blocking. As long as they insist on charging per text-only, length-limited email message, I won't be using it.

And while this may come as a disappointment to the two people who actually send me text messages from time to time (which I don't read, and either keep forgetting I don't read them or keep forgetting to remove me from whatever distribution lists they have that I'm in), I can only say: just send me an email. Or call. That's what a phone is for. :P

2009-07-13

The $2 Electric Razor

I've used an electric razor ever since I first started shaving. They're quick, they're easy, and they're safe, especially compared to the standard blade. But where I did use a rechargeable before, I've since gone to just using a plug-in. The problem I had with rechargeables was, whether I left them plugged in all the time or ran them down and "deep cycled" them, it seemed like the batteries would consistently stop holding a charge before the blades would get dull.

The interesting thing about replacing blades, though, is that I never actually do it. I've found that the price for new blades is so expensive, and the price for a simple, plug-in electric razor is so cheap (because only the cheapest models are plug-in; the first feature that gets added as the price goes up is cordlessness), that it's just as cheap and twice as easy to buy a whole new razor than it is to find a set of blades that's compatible with the razor I already own.

Case in point: my last Norelco razor stopped cutting as well as it should. I went down to Wal-Mart to look at razors. Razor blade heads were $29 (and since I didn't know the model number of my razor off the top of my head, I wouldn't know which one to get, if a compatible set was there at all), and a new Panasonic razor was $31. Which leads to the inescapable conclusion that the razor itself — the housing, the motor, and even the flip-up trimmer and the blades contained therein — are worth a grand total of two dollars.

Which sounds about right, considering the flip-up trimmer on my old Norelco had also broken, being driven by a cheap piece of plastic. Buying new heads wouldn't fix that.

2009-07-05

Bandwidth for June

June was also a fairly light month. Total downloaded was 18.49GB, total up was 6.28GB, for a grand total of 24.77GB.

I got the Xbox 360 game Ghostbusters for Father's Day, and I was very close to activating a Netflix trial so I could stream the original movie — which would have been very educational as far as bandwidth consumption is concerned. However, that very next day, my Xbox died and had to be sent in for repairs, so that killed those plans.

2009-06-26

The importance of keeping good records

I'm a bit of a pack rat. Ok, I'm very much a pack rat. I don't like to throw anything away on the off chance that someday, I might have a need for it. It's especially bad when it comes to financial information. I have receipts dating back to the 1900s — which used to sound much more pathetic than it is, but considering they were 9½ years ago, I think we can safely upgrade that statement from "sounding pathetic" to "actually pathetic" now.

Regardless, I finally am able to reap the rewards of not throwing papers relating to money away. I got a letter from the IRS a couple weeks ago that I had been selected for an audit (What, I didn't mention that in my "pity party" post? Hmm, probably should've; it definitely qualifies) and that I needed to gather information about my charitable donations for 2007 (what fellow Geezer Gamer "SlapShotSal", who does taxes for a living, tells me is a "substantiation audit").

I knew the bulk of my donations for the year would be to my Church, so I got the statement I received from the Church for 2007, which had a list of all donation dates and amounts for the year. Then I pulled a report in Quicken for that year and found the check numbers that corresponded to those dates and amounts. With that list, I went to all my bank statements for the year and found the statements they appeared on and the dates they cleared. I figured these dates would be important to get the images of the canceled checks from my bank, since to see old checks, I usually have to select the statement they were on. This could've been a tedious process of having to download each statement from my bank, but I keep copies of my statements on my home network for easy reference. (It worked, too; it was very easy to reference all those old statements.) Yes, the pack rat trait applies to digital files as well — probably even more so.

Now that I had a list of check numbers and dates, I logged on to my bank for what I dreaded would be the most tedious part of this whole process — having to find each check on the old statements and get the images, one by one. Maybe I would take them into Paint.Net (my favorite free image editing program du jour) and stack three or four of them on a page to save paper.

I found the link to prior statements, but much to my disappointment, they only went back 18 months, the earliest one available being January 2008. So that wouldn't work. But there was another link for searching for transactions that indicated check images were available as far back as 2005. (Glad I didn't get audited for any years prior.) I entered a date range of the whole year, a check number range from the lowest to highest number I had, and selected "Check" for transaction type.

I couldn't believe what I saw. There was a list of all the checks, with a checkbox by each one. At the bottom of the list were two options, one to select Large or Small images, and one to select Front only or Front and Back, and a button marked View Images.

Actually, the search results were limited to 100, so I had to do the first half of the year and then the second half, but big whoop. There it was, exactly what I needed. Select the checks I needed to see, and hit View Images to see just those checks.

When I viewed the images, it showed me two checks at a time, with front and back images — so four images total — with some simple navigation at the bottom to move to the next pair of checks. Since the site's not in a frameset, I couldn't tell my browser to just print a single frame (i.e. the one with the images), and I didn't want to print the navigation links (or the rest of the webpage for that matter), so I figured I'd still be copying images from the screen. Just for kicks, though, I called up the Print Preview to see what would happen if I tried to print.

They thought of that, too. Apparently there's a printing stylesheet in place that turns off everything but the content, because in the Print Preview, the only thing visible were the check images. No navigation, no links, no tabs or corporate logos or anything extra.

Here I thought I'd be at this for days, or at least hours, gathering images and printing them out one by one, and all I had to do was click "Next, Print, Next, Print, Next…"

I'd love to publicly praise this bank for their extremely useful website, but at the same time I don't necessarily want to advertise to the rest of the internet where I keep my money. I did make a point of sending a message of thanks to their customer service inbox, though.

So, with that out of the way, now I can go back to playing my Xbox. Except that is currently on its way to a repair center in Texas and probably won't be back for a couple weeks.

Yeah, I guess I forgot to mention that, too.

2009-06-18

The hits just keep on coming

It's a pity party, and you're all invited.

When I picked up my son's medication as we got him out of the hospital, the total bill was close to $500 for a month's worth. I figured they were just having issues with insurance and I'd just need to resubmit the claim later. In any case, it wasn't something I could worry about or negotiate at that time — the treatment required keeping the level of medication in his blood stable, and we needed the pills then. Well, I finally got around to calling my insurance carrier to see what was up.

Here's what's up: that medication isn't covered. The price, unfortunately, is what it is.

D'oh.

A couple weeks ago, a tornado passed really close to our house. We didn't have any damage from the twister, thankfully (in fact, it did surprisingly little damage for touching down in the middle of a shopping mall, causing no injuries). However, there was golfball-sized hail. We have an insurance adjuster coming to look at our roof to inspect for hail damage on Monday. If repair work needs to be done, it's covered, just with a $1000 deductible. Which could be a lot worse, but it's an expense when I don't need any more expenses.

And, my glasses broke this morning. I got these frames that were supposed to be made of this indestructible flexible alloy, and the frames have in fact held up well. The problem is, the screw on the hinge is held in place by this flimsy piece of wire that's barely soldered on to the indestructible frame. This same hinge actually broke twice on me. The first time, it happened so quickly as to still be under warranty that I could have the frames replaced. Not so, this time.

Fortunately, my older pair is still in great shape, and my previous prescription isn't that much different, so getting a new pair is something that doesn't need to happen immediately.

And, I just got a call from my wife, who is right now taking my son (the one with the $500/month medication) to the doctor's office with sharp, stabbing pains in his stomach.

2009-06-15

Wait, what about The Social?

A year and a half ago, I looked at this "Zune Social" thing, and I wondered if it would be possible to "jump in" with just my desktop PC. Having a Zune Card that was just like my Xbox Live gamercard, with a running history of the music I listened to, sounded kind of cool. Gimmicky, sure, but cool. And the fact that I already had a Zune Card simply by virtue of having a gamercard meant the cost of entry was eliminated. (I suppose this is also related to me being a sucker for features, as I had access to this feature that I wasn't using.) But in order to use it, you had to use the Zune Media Player, which, compared to Windows Media Player, was pretty lacking.

I posted a comment in the Zune forums, suggesting it might be nice just to have a WMP plug-in that updated my Zune Card with my stats from WMP. The responses I got back were rather disparaging, saying they couldn't do everything the Zune Media Player did in a mere plug-in. It was also the prevailing opinion that the Zune Social was for Zunes, and it didn't really matter what I played on my PC. (Ok, never mind the fact that I could play things in the ZMP and have it update my Zune Card.)

Back in September, they released a software update, and I decided to give it another look. In short, nothing had changed. I came to the conclusion that the Zune Social was a Zune-only club, and I would just be anti-social until I somehow acquired a Zune of my own.

Two weeks ago was E3, and Microsoft announced that Last.fm would be coming to the Xbox 360. I hadn't really looked at Last.fm before, so I signed up. Not only does it offer streaming music, but it (to quote its home page) "recommends music, videos and concerts based on what you listen to." And how does it know what you listen to? Well, obviously it can track the songs it streams to you and the ones you flag as tracks "loved" or "blocked". But it can also track songs played in Windows Media Player using a plug-in.

So here you have this third-party service that is doing exactly what I was asking for from the Zune Card. And Microsoft is integrating that service into the Xbox 360.

Oh yeah, they did also say that the Video Marketplace on the Xbox 360 would become the Zune Marketplace. But so far, they've only announced that for videos. Not music.

I don't get it.

2009-06-10

I'll handle any key you want... except that one

Here's one of those that makes a little more sense when you think about it, but it still leaves you scratching your head until you figure out what's going on. And then you think about it some more and realize, no, it doesn't make sense at all.

When you want to capture keypresses in a control on a Windows form, the "best" place to do that is the KeyDown event. It gives you the ability to capture keys, the state of the modifier keys (Control, Alt, Shift), and to mark that keypress as being "handled" so the key does not continue on as actually being typed. It also provides access to capturing unprintable keys (like Escape or Insert).

However, one thing it does not do is let you capture the Tab key. This is because the control doesn't even get a KeyDown event when the Tab key is pressed. (Indeed, Microsoft considers it a bug when it does trigger a KeyDown.)

You can sort of rationalize this behavior when you realize that the Tab key is "special". The form uses that key to determine when to move from one control to the next. So, in that way, it would make sense for the Tab key to not even get to the control. However, you can easily debunk that rationalization with two controls: a DataGridView and a TextBox. A DataGridView, with its StandardTab property set to the default of False, will, when a Tab key is pressed, take it upon itself first to move the active cell through the grid, and only when the last cell is reached then let the form move focus to the next control. Likewise, a TextBox that has both Multiline and AcceptsTab properties set to True will take any Tab keypresses and add a tab character to the input, never passing that keypress to the form.

In any case, it seems that, for whatever reason, the Tab key is handled by the form sometime after these possible control overrides, but before the KeyDown event could get fired.

Solution? Well, it turns out, there are two.

The first one I found is to override the form's ProcessCmdKey method. Start by calling the base ProcessCmdKey method, which returns a boolean that indicates whether the key was handled. Then, check to see if this.ActiveControl is the control for which you want to trap the Tab key, and if the keyData parameter passed in to ProcessCmdKey contains the Tab key ((keyData & Keys.Tab) == Keys.Tab). If so, do whatever it is you wanted to do, and set the boolean return value to true, indicating you've processed the key yourself. At the end of the method, return the boolean. (I found a simple example here.)

The annoying part is, if you were trapping for more than just the Tab key in the control's KeyDown event, you now have your logic split in two different methods (control_KeyDown and form override ProcessCmdKey). Also, if you are doing this for multiple controls (as I was for, coincidentally, a DataGridView and a [single-line] TextBox), you have to copy and combine the logic from the other controls' separate KeyDown events into the ProcessCmdKey method, testing the ActiveControl to make sure you know which control you're in.

The advantage, however, is that you only have to test the cases you're interested in. If, for instance, you want to catch a Tab, but still allow a Shift+Tab to default to the standard form's handling, you just test for an un-shifted Tab and do your work, and let the Shift+Tab condition "fall through".

The second solution is to bind to the controls' PreviewKeyDown event. This one fires in that sweet spot before the form claims it as a "command key". The event gets the parameter PreviewKeyDownEventArgs e. If you want to handle the Tab key in the KeyDown event, just check to see if e.KeyCode == Keys.Tab, and if so, set e.IsInputKey = true.

The disadvantage to this method, however, is that now you are responsible for moving the focus as appropriate — you can't just let the handling "fall through" to the form, because it won't handle it anymore. Depending on how confident you are on the structure of your form, you can either call another control's Focus method or the form's SelectNextControl method (and don't forget to set the Handled property in KeyDown, otherwise the new control might receive the same Tab keypress as well, or it might try to type the Tab as input into the old control — either way, the results might not be pleasant).

Personally, I like the second solution better. Although there is more logic required to do what should be standard Tab handling, it means the logic for my non-standard Tab handling is in one place per control, not split across two different events.

2009-06-05

Bandwidth for May

Whoops, forgot to grab the data for the beginning of May. Daily numbers are missing, but the monthly totals are accurate.

Total for May: 19.98GB down, 4.54GB up, 24.52GB total. Not quite a tenth of the cap. This month has the second lowest total since the cap, coming in just ahead of March.

If it weren't for the impending medical bills, I'd sign up for Netflix, if only to see what it would do.

2009-06-04

A sucker for features

Yeah, so a few people have noticed that, despite my general disdain for "social networking" services as a whole, I finally got suckered in and signed up for both Twitter and Facebook.

I was a long-time user of Microsoft's MSN Messenger service. (I even had a "charter membership" to the Microsoft Network, for whatever that's worth. Remember when we didn't have "internet service providers", but signed on explicitly to companies' dial-up networks?) Anyway, eventually I got a job where their "standard" messenger client was AIM. I didn't want to have to run two distinct messenger clients because of the combined resource usage, so I looked for a client that would connect to both services in a single client. The one I selected was Trillian, which I installed and started to use.

When I got it up and running, I noticed there were little icons that lit up with each service to which it connected, and only two of its four lights were lit. I felt like I was missing something, because I was using a program but not all of its features. So I entered my credentials for my almost-forgotten ICQ account, and on came another light. What was the fourth one? Yahoo Messenger? I didn't know they had a client, and I certainly didn't know anyone on it. But I wanted that last light to light up. So I signed up for a Yahoo account, and finally my program was complete.

Now you might understand a bit what feelings went through my head when I heard about Microsoft's E3 press conference this week. Felicia Day (who has a very cute face, but dang that girl needs to eat before she blows away) announced that the Xbox 360 would be integrating with Facebook, Twitter, and Last.fm this year.

New features? On my 360? And I don't have access to use them? Well, I'd better sign up, then!

Of course, I had to be a touch creative with my account names since I waited so long, but fortunately I was able to get away with just adding a "1" to my alias and calling it good. (Except for Facebook, which demands a real name. What do you mean, "Yakko" isn't a valid first name?)

I don't know if my Facebook page will see much action (we all know how infrequently I update my own blog as it is), but I've already found that Twitter is fairly useful for those really quick thoughts I think might be nice to jot down but don't think are worth a whole blog post. (So far, I've resisted the temptation to reply to the tweets of celebrities who will never know I exist, but we'll see if I can maintain that resolve.)

And after listening to the '80s Tag station on Last.fm most of the day yesterday, I already can't wait for this to be turned on in the 360.

They hyped up Netflix again, and I started to feel tempted again. That one, though, costs money, and signing up for another entertainment service right before medical bills start rolling in sounds like a really bad plan.…

2009-05-27

The fundamental interconnectedness of all things

It seems when my son is admitted to the hospital, my laptop reveals a new problem.

Now, my HP Pavilion tx1420us is failing to power on after any kind of software shutdown state. This includes: failing to resume from sleep, failing to power on after hibernate, and failing to power on after shutting down from the menu.

Fortunately, I'm able to get around this by shutting it down with the hardware switch. When I power up the computer and notice it's not starting (the audio and wireless lights both remain orange instead of turning blue, there is no disk activity, and the screen remains dark), I can press and hold the power switch in the "off" position for a few seconds until the system shuts off, and then power it back on. Sometimes, though, I have to do this twice.

Also fortunately, I'm using the Windows 7 RC, and Windows 7 includes a feature called "hybrid sleep". The short of this is, when the system goes to sleep, it also writes the hibernation file; so even though I can't wake it up and have to force the power off and wipe out the sleep state in memory, when I power it up it is able to resume from hibernation.

This could indicate that the wireless failure was not directly a fault between the system and the Wi-Fi card, but just a symptom of a general failure.

More so, though, I see this as a failure on my part for trusting HP to produce a laptop that would last beyond its warranty period.

2009-05-26

Haven't we been here before?

I got a call while I was in a meeting today, from my wife. She's the only person I'll accept calls from when I'm in that situation, and I answer the phone in the same way, with a whispered, "Hi, I'm in a meeting, is everything ok?" Almost always, she'll say everything's fine, and just call her back when I get out.

Not today.

My son was having a really bad day today, having emotional outbursts and not fully processing what was going on or where he was. Since he's on a high-dose steroid, he's been fairly moody and irritable lately, but never to this extreme. Still, it didn't seem like anything more than just a really bad case of frustration and mood swings. My wife finally got him calmed down enough to take a nap, figuring that would do him some good (he has typically been taking a long nap in the afternoon anyway), but after maybe a half hour or so, she happened to look over at him and notice that he wasn't exactly napping — his eyes were open and twitching. She called the doctor, who then advised her to call 911. When he was on the ambulance en route to the local hospital's ER, she called me.

I excused myself from the meeting, grabbed my coat and backpack, and met her there. He was having a mild seizure. They gave him some medication to stop the seizure, and then they did a CAT scan to rule out the possibility of a stroke. The scan came up normal. Of course, I predicted as much — the entire 5-week stay in the hospital, every lab test they could think of came up negative; he just wasn't well, had ferritin levels higher than they'd ever seen, daily fevers over 104°F…

Anyway, with the seizure under control, they transferred him back up to Children's Hospital. I parked in the same parking lot and went to the front desk. I couldn't just flash my wristband and walk in this time, though; I actually had to stop and find where they brought him in. The desk clerk found that he was brought to the ER and offered to walk me there. I was about to object, since I knew the way there, but then I remembered that there is a card-access lock door from the main hospital leading to the ER, and I'd need someone to let me in anyway.

It's sad that I know this.

The primary doctor here in charge of his case was aware of this possibility. The medications he's on, the cyclosporine in combination with the steroid, can raise blood pressure, and the increase in blood pressure can trigger a seizure like this. In fact, he noted this at my son's visit last week. The day after he saw my son, my son had an appointment with the cardiologist, and the doctor said he saw today the blood pressure taken at that appointment and was very disappointed that the cardiologist didn't call him. Although the blood pressure taken wasn't extremely high, it was high enough that he could have prescribed some blood pressure medication to keep it down and prevent this seizure from being a possibility.

It's the doctor's initial opinion that, once we get his blood pressure back to normal and he recovers from the seizure, that he'll be good to go home again, just with some blood pressure meds as well this time. Unfortunately, he's also running a fever now (his first in over two weeks), so they're checking for infection (dollars to donuts they don't find one, again), and hopefully this fever is just a temporary thing that doesn't keep us from going back home tomorrow.

It's really depressing to be back here. On Sunday, we actually started to get close to normal. The whole family was finally able to attend church together. He slept through our sacrament meeting, but he attended his Sunday School classes and was smiling and laughing with his friends. He's even started to get himself up and down the stairs at home. And now… here we are again.

2009-05-24

Why didn't you do what we wouldn't let you?

So while I was in the hospital watching over my son, I signed on to CitiCards.com to pay my Master Card bill. Imagine my surprise when I see a message, saying my account information has been compromised, and for my security web access to my account has been disabled, and a new card is being sent to me.

In the meantime, fortunately, my card still worked for purchases (even online), so I wasn't completely without access to my credit. I just couldn't sign on to my account online.

Now, this did concern me a bit. After all, the reason I was signing on was because I needed to pay my bill. And this was how I paid my bill. Since I signed up for "paperless billing" — a service they provide and encourage — it was also the only way I had to pay my bill. And here they were, disabling access to my account and the means for paying my bill. But surely they wouldn't hold me responsible for not being able to do something they were keeping me from doing, right?

I finally got my replacement card. I lost count, but it was a few weeks later. So I was finally able to register my new card for online access, check my account… and see that finance charges and a late fee had already been assessed to it.

I guess CitiBank got tired of waiting for their bailout and decided to take it out on their customers.

2009-05-14

It's good to be home

After five weeks and a day, we finally took my son home from the hospital yesterday. The doctors with all their tests were able to rule out enough of the major diseases to decide it was safe for him to be at home, and all the medications and treatment he was on could be safely given at home.

Now, granted, he's still not 100% well. He's on a few different medications, and his immune system is still recovering from being sick (and some of the treatments he was on). And he still has a PICC line in his arm, since we'll be making repeated trips back to the hospital for blood tests and checkups. But just the fact that we're all home is a huge relief to all of us.

He is definitely getting better, though. As it so happens, for about the last week, he was no longer getting his daily fever spikes, and without the fevers to drag him down, his appetite and strength has been coming back. If I had to make a guess, I'd say there was an infection (secondary to the Kawasaki disease they did manage to diagnose) they couldn't find, but when they happened to give him a final dose of antibiotics as a precautionary measure while they switched medications that affected his immune system, it probably finally wiped it out and let everything else fall into place.

We did get our first taste of the medical bills, though, when we had to pick up the prescriptions. We're hoping that insurance just didn't get billed properly, but three prescriptions ended up costing us close to $500 (and we had to make a trip back to the pharmacy in the hospital, as the drugs aren't carried at any branch close to home). The cashier actually apologized as she rang it up.

One thing at a time, though. At least we're home, all under one roof, sleeping in our own beds.

2009-05-08

Name them one by one

So with all the crap hitting the fan over the past 4½ weeks, maybe it's time to stop and count my blessings.

  • My son is alive, and is getting his symptoms cared for (even if they can't cure the disease).
  • We live in the suburbs of the city that has one of the best children's hospitals available. (We've met people from as far away as Hawaii, who are staying in the Ronald McDonald house while their child gets treatment here. While we may not be spending much time at home, we can at least go home every day to get clothes, supplies, check on the pets, …)
  • I am employed full-time (not on hourly contract), at a small technology company that has been more than accommodating to my very unpredictable schedule, including my rather reduced hours (although I intend on working some this weekend to catch up on some work, they've accepted my 6- and 7-hour days without complaint). (I'm sure it helps that I'm still meeting deadlines and getting work done.)
  • My job is only a few blocks from where my kids go to school, and so it is very easy for me to pick my older son up and bring him here, where he can do his homework and play his Nintendo DSi until it's time to go. Additionally:
    • my workplace is ok with this arrangement
    • I have an office, so I have space for him to be in
  • My church has been there to provide meals for us, and to take our toddler off the hands of my wife for the day, so he's not confined to the hospital room every single day.
  • GeezerGamers.com — I've been a part of this community for a little over four years now, and the outpouring of support and prayers from these people have given me a huge morale boost I didn't realize I needed. And on top of that, they've also sent me and my son some Amazon gift cards and a care package that included a new Xbox memory card (to replace the one that "mysteriously" disappeared from the hospital room this past weekend). They've been an awesome group of friends, more than I ever expected or ever thought (or hoped, at least in this way) I'd need.

Hopefully the hospital stay is coming to an end. Although the doctors still haven't figured out The Problem for which they can prescribe The Cure, they have at least eliminated enough major issues that they're considering sending us home. He'll still be on medication (they've started switching his IV-based medicines to pill form), and as long as he shows he can eat and drink enough to sustain himself without IV supplements, if his white blood cell count recovers from one of the medicines he was on, and if nothing else major comes up, we may be taking him home next week (a "mere" 5 weeks after he was admitted).

Sure, we'd still need to bring him in for some tests rather regularly (and they may leave his PICC line in while he is coming back for tests), but even if we had to spend, say, 4 hours a day every day going back and forth to the hospital for tests, that's still 20 more hours a day he'd have at home than he has now. And that's another blessing worth counting.

2009-05-01

April in Review

April sucked.

  • Middle son ends up in the hospital for an extended stay. (Resolution: none yet, still there.)
  • Friend and client busted by SEC for running a Ponzi scheme. (Resolution: none. Have had little time to process this myself, let alone follow the case; see above.)
  • Youngest son splits head open at hospital. (Resolution: glued shut, healed fine.)
  • Snow storm kept us at home away from hospital. (Resolution: worked out; my mother had flown in for the weekend and was already there with my son.)
  • Master bathroom toilet seat split. (Resolution: none, haven't been home long enough to fix.)
  • My wife was rear-ended on the way to the hospital one morning. (Resolution: n/a, occurred at such a low speed the only "damage" done was dust in the shape of the offender's license plate that wiped away clean.)
  • My laptop's wireless card died, due to an extremely common problem with this model of HP laptop. HP wants $100 just to look at it before they'll decide what to charge me to fix it, even though they repaired the identical problem on the identical laptop (my wife's) a few months ago. (Resolution: bought a $30 USB Wi-Fi adapter.)

Yes, I know, everything worked out, and some of these are really minor things. It just seemed like everything came crashing down all at once, and especially when you're dealing with something major like having a kid in the hospital and are spending better than 12 hours a day there, it all seems like a lot.

Even when this is all over, it won't be; I have a feeling we'll be paying for this for months, if not years to come. My hospital stay for my appendix cost thousands, and that was only for a couple days.

But that's something to worry about later. Right now, the most important thing I want resolved on the list is still there. My son is still in the hospital, still not getting better to the point where he can come home. My wife and I have spent the night in the same bed precisely three nights in the past 24 (when my mother showed up for the one weekend and sent us home). And what sleep I do get during the week is definitely not quality, considering the inch and a half of foam on a sheet of flat plywood that qualifies as a fold-out bed here.

I know, things could be worse. I just want to know when they're going to get better.

Bandwidth for April

You can see the spike on the first weekend where, again, I watched the streaming video of my church's general conference broadcasts. There are two 2-hour sessions, with two hours between them, during which church news is broadcast. Although we didn't watch for six hours straight, I did let it keep streaming the video, partially because I didn't want to have to restart the stream (I put my laptop up on a high shelf when I connected it to the TV for output and didn't want to climb back up to get it), and partially to see what would happen to my bandwidth numbers. (Sunday, I actually did stop and restart the stream when I found my bluetooth mouse worked as a suitable remote control.)

Although I haven't been home to do a lot of Xbox gaming this month (spending most nights in the hospital with my son), I still use my home network connection quite a bit as my own personal proxy server. I've used this from work for over a year now, mainly to prevent any misunderstandings that might occur if I were to happen to hit the wrong website at the wrong time. I'm also using it from the hospital, since they have an unsecured wireless connection that is also a tad overzealous in filtering out websites that "might" be "unsafe".

Anyway, the total numbers: 27.06GB down, 5.32GB up, 32.38GB total. This month is the second highest, ranking behind the last general conference month (October).

2009-04-30

You uncultured flu bug!

Well, this is highly inconvenient.

I show up at the hospital with my oldest son, to trade places with my wife for the night. I go to enter the hospital, and a security guard stops me. "He can't go in," he says, indicating my son. "The hospital is on lockdown. Parents only, no siblings."

"When did this start?"

"About an hour ago."

Apparently, because of the swine flu, they are closing down access to the hospital to necessary personnel only, and that means only parents, no siblings or other visitors.

I call my wife, who is up there with my middle son (the patient) and our youngest son (the terror that flaps in the night). She hadn't heard about the lockdown yet. I told her she needs to meet us downstairs to do the swap.

As I'm waiting, I realize just how inconvenient this is going to be. When my wife comes to relieve me in the morning, she will be unable to bring the toddler with her. And because I have to work, that means he'll need somewhere to stay pretty much all day. So I talk to the security guard to ask about the nature of the lockdown and how long it'll last. The security guard, after assuring me that there is no instance of flu at this hospital, says they don't know how long. Could be a couple of days, could be a week, could be a month.

My wife calls me soon after. She of course had the same thought, and she was talking with the charge nurse to discuss our options. (The security guard also suggested I could try talking to the charge nurse for the same reason.) Apparently, in talking with the nurses inside the hospital, she learned there was a case of swine flu detected in the hospital. It wouldn't surprise me if the security guards at the entrance were told (or instructed to tell people) there wasn't, but it also wouldn't surprise me if the "fact" that there was wasn't just a rumor that was going around the nurses' stations.

My son (the patient) had just been coming down with a cough and congestion. Wouldn't it be just our luck if it was him who had come down with the swine flu, on top of whatever else had brought him there in the first place? My mother had, after all, just come back from a trip to Mexico before she came to spend a weekend in the hospital with my son.

2009-04-28

WordPad: "Picture" = "End of File"?

There's this annoying bug in WordPad in XP that I'm surprised I couldn't find very much about. But it's hit me on more than one machine (and I never seem to remember it until after it happens, of course).

Whenever I create a document and I paste a picture into it from the clipboard (usually copied out of Paint, as that's a convenient way for me to get an image on the clipboard in a hurry), the picture and any text after it is not saved with the document.

This time, naturally, it happened to be on my set of release notes for a product release, where I happened to add a picture to the beginning of the document. Entire document, gone.

It seems to be a function of WordPad itself adding the picture to the document. If I open a document that already has a picture (e.g. by creating a document with a picture in Word and saving it as RTF), I can do just about anything to the document, including cutting and pasting the picture to other locations. It's just the act of initially adding that picture to the document that makes WordPad stop processing.

Why use RTF at all? Well, RTF is a very convenient format for creating simple text files that have a little bit of formatting. They're also extremely portable — whereas Word documents (or documents saved in "Word-compatible" formats) can sometimes display oddly in different versions of whatever you're using to view them, there's so little in an RTF that you're almost always guaranteed you'll see the text and its formatting as it was intended, without any attempt to dictate margins or other unimportant stuff. It makes it very handy for distributing a simple document to clients that look decent, don't require any extra software to display (they will at least have WordPad, if not something bigger; I can't guarantee they'll even have a PDF viewer, or a DOC viewer for that matter), yet has just enough formatting to be "professional" (as opposed to plain text). It can also be embedded in a Windows Installer, which is part of my goal here.

Why use WordPad when I have Word installed? Well, my goal is to have a very simple file, without extra garbage or formatting codes. Creating a particular file in Word, which includes a single 24x24 picture, and saving it as RTF resulted in a 53kB document, which, if you look at in a plain text editor, you can see over 7k of format codes defining (among other things) fonts that aren't even used in the document, before the first line of actual text. Merely opening that file in WordPad and saving it (which has the effect of stripping out all the garbage, taking it down to the bare necessities) results in an identically-formatted file that is 15kB. (Unfortunately, it doesn't replace Word's "smart quotes" with standard ones.)

I remember taking a Word 2.0 document, opening it up in Word 6.0, and saving it, with no changes, and noticing the file size balloon to four times its original. So the inefficiency in Word's file formatting comes as no surprise.

Workaround: I played with this a bit before publishing this post, and I figured out the solution. If you go to the Edit menu and select "Paste Special…", you can paste the image as a Bitmap, a Picture (Metafile), or a Device Independent Bitmap. It seems the default, Bitmap, is the one that causes the problem, as selecting either other option works fine. Of course, the Edit menu is the only place this "Paste Special…" option is available, as right-click only shows "Paste" and Ctrl-V/Shift-Ins use the default option.

I tested this in Vista and the public beta of Windows 7. Copying a picture out of Paint in Vista, the default Paste in WordPad worked just fine. Paste Special showed "Unidentified", "Picture (Metafile)", and "Device Independent Bitmap", and all of these worked. I was able to get "Bitmap" as an option in Paste Special by taking a screenshot, but that, too, worked without a problem. Windows 7 had almost the exact same results, except that Paste Special with what was copied from Paint actually listed "Paint Picture" as the first option. Everything else worked pretty much the same (except for having to deal with that annoying "ribbon" toolbar in both Paint and WordPad).

So, I guess, the fix for being able to paste bitmaps in WordPad without losing the rest of the document, is to upgrade to the latest version of Windows.

2009-04-20

Fixing the DataGridView's CalendarColumn sample

In a DataGridView, it is sometimes convenient to have a column that is a DateTime that allows a user to use the standard DateTimePicker control for choosing dates. Microsoft has a code sample for a CalendarColumn class that does this, and it's more or less the standard.

Except if you actually try to use it in a WinForms application, you'll find it has two rather glaring flaws:

  1. If you try to type in a date, and you don't type in a full two digits for the month or date or four digits for the year and then tab out of the control, your change won't be committed.
  2. If you type in a date or part of a date and tab through to the same column in the next row, and you start typing, the first field highlighted (month, date, year) will be the last field highlighted when you left the last row. (Example: you type in "04/04/2009", tab until the next row's date column, and start typing "04", you'll find you're editing that date's year.)

I found this forum thread that addresses the first concern. ALight's answer involves adding an event handler to the DataGridView's CellValidating event. Because we use grids all over the application, it would've been very inconvenient to alter every grid and add this code. Instead, since our grids are built dynamically, I did it by adding this code to the CalendarColumn class (that inherits DataGridViewColumn):

protected override void OnDataGridViewChanged() {
    base.OnDataGridViewChanged();
    if (this.DataGridView != null) {
        this.DataGridView.CellValidating += new DataGridViewCellValidatingEventHandler(CalendarDataGridView_CellValidating);
    }
}

protected void CalendarDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
    if (sender is DataGridView) {
        DataGridView dgv = (DataGridView)sender;
        if (e.ColumnIndex >= 0 && e.ColumnIndex < dgv.Columns.Count
            && e.RowIndex >= 0 && e.RowIndex < dgv.Rows.Count) {
            if (dgv.Columns[e.ColumnIndex] is CalendarColumn && dgv.Columns[e.ColumnIndex] == this) {
                if (dgv.EditingPanel != null) dgv.EditingPanel.Select();
            }
        }
    }
}

When the CalendarColumn is added to the grid's Columns collection, its DataGridView property is updated, and this routine fires to bind the method to the grid's CellValidating event. Multiple columns will cause multiple event handlers to be bound, but the dgv.Columns[e.ColumnIndex] == this part of the if statement should ensure that only one instance will run the code for any given column. (Note that I have not tested this in cases where columns may be removed from the grid. It should probably work fine, as the event will still be bound and still fire, but the column will never match.)

To solve the second problem, I did some experimentation with the existing control methods. In Microsoft's sample, there is a comment in the CalendarEditingControl's method PrepareEditingControlForEdit that reads "No preparation needs to be done." I found this to be not quite correct. The following change resets the control so, when you start typing, you start editing on the month, like you'd expect:

public void PrepareEditingControlForEdit(bool selectAll) {
    if (selectAll) base.RecreateHandle();
}

Seems to work so far, anyway.

2009-04-19

When ya gotta go, ya gotta pay

Another old post I for some reason never got around to publishing. I was talking to my mother about her experience flying out here (she was able to fly out for the weekend and give us a break from spending time at the hospital, where my son still is with an unknown diagnosis):

The idea that this is even a question to be considered is reason enough to swear off flying.

Flying out here, my mother did of course have to pay extra for something extra she brought us that she had to check. Compared to a flight down to Mexico she had not two weeks earlier, when they didn't charge for extra weight per person (one of her party did have an overweight bag, but they averaged the weight of all bags for all fliers in their party, and they didn't have to pay), meals on the plane, or even alcoholic beverages for the passengers.

It reminded me of a comment I read on someone's blog a while ago. They wondered when airlines started to charge extra for just about everything and hid behind rising fuel costs as the reason, that, if fuel costs were to go back down, would these extra costs go away? Well, I know I'm back to paying under $2 per gallon of gas, and airlines are still charging for whatever they can get away with.

I know I've said it before, but it's a large part of the reason why, even when gas prices were at their highest, my family and I drove out to California instead of flying. If it's just me for a weekend trip, I might consider it. For my family, no way.

MAPI FAIL

This was an old post I started to write a couple months ago. Not sure why I didn't publish it, but considering the project in question has come to an end, I can pretty much call this issue "closed as unresolved".

I thought I was close in finally being able to send an email with an attachment using the default email client in C#. The code that I found worked great when I gave it a quick test on my work machine with XP Thunderbird. It also worked on my development machine running Vista and Live Mail. But when I set up a vanilla XP virtual machine for testing, Outlook Express failed with a message "One or more parts of this message could not be displayed".

Well, at the very least, I could insert the code, and make it a configurable option so I could switch back to the old crap way of using a mailto: link if it doesn't work for the client.

Just my luck, the client recently replaced his old desktop PC with a Mac, and he had his own vanilla XP virtual machine for running Windows software. Sure enough, the mail code failed just as spectacularly in that version of Outlook Express as it did on mine.

Your mouse has moved. Reboot now?

So, to "fix" the problem with my HP tx1420us laptop that sucks in that it no longer recognizes the fact that it has a wireless network card installed, I went out and bought a USB Wi-Fi adapter. I found some online for about $20, so when I went to Best Buy, that was my target price. Unfortunately, they didn't carry any that weren't under $50. Wal-Mart, however, had a Belkin 802.11g for $30, and that was close enough for me. (The one installed in my laptop is 802.11n, but my access point is only a "g" anyway.)

I first installed it in my Windows 7 beta partition, and the installation went very smoothly. Unfortunately, though, I still had to re-configure my wireless settings — apparently, Windows 7 binds wireless configurations to the adapter, so my home WAP's configuration bound to my Broadcom card was not accessible. Not a big deal, though.

Then, I figured I'd better install the software on my Vista partition as well, before I put the CD away. One of the things they tell you to do is to install the software from the CD first, and then plug in the USB device. So I pulled the adapter out, rebooted into Vista, installed the software, and plugged in the adapter again when it prompted me. Again, I had to reconfigure my wireless settings — the binding of settings to adapter must've been a Vista thing that Windows 7 inherited.

That finished, I rebooted into Windows 7. The network adapter was detected, but it did not automatically connect to my WAP. When I pulled it up, I saw that "Belkin USB Wireless Adapter #2" did not have any wireless configurations assigned to it. Apparently, what happened was, when I was installing it in Vista and re-attached the adapter into one of the two side-by-side USB ports on the back of my laptop, I plugged it into the one other than the one I had first used for Windows 7. When Win7 booted, it found the adapter not in port #1, but in port #2, and therefore it assumed it was an entirely different adapter. (Funny, these things are supposed to have unique hardware addresses; it couldn't detect it was the exact same adapter, just moved?)

So now, when I reboot into the other environment, I have to remember to switch the USB ports for my wireless stick. Or just define the same profile for "Adapter #2". Either way, it just seems obnoxious.

2009-04-15

No more HP laptops

My wife and I got matching HP tablet PCs a year ago. (The HP Pavilion tx1420us, in case you were curious.) They sure seemed like a good deal at the time, at half the price of most other tablets. At first, I thought the only reason for the price difference was the screen — these Pavilions used a "passive" touch screen instead of an "active", so they didn't track the stylus; you had to physically tap the screen for anything to register. Unfortunately, it seems the cheaper cost has more to do with the quality of the components.

Apparently, there are compatibility issues with the components used such that, after some time, the computer will simply refuse to detect the existence of the Broadcom wireless card. Trying to find it in the device manager, it's completely gone. My wife's was the first to go, and fortunately it happened quickly enough that it was covered by warranty. Mine held on quite a while longer, until just after the warranty expired.

Since I dual-boot between Windows Vista and the Windows 7 beta, I can pretty definitively confirm it is not a software issue — the wireless card disappeared from both OSes at the same time.

A quick trip through the HP support forums revealed that this problem is far from uncommon, with this and similar product lines, and HP is somewhat less than forthcoming with support, especially after the warranty period.

I did find a support bulletin that seemed to address this problem and offer extended support, but of course it did not include my exact model. They say there is a BIOS update that will help protect against it if you don't have the problem yet. The speculation in the forums is, this will only postpone the problem until it is out of warranty, not fix it. I take that with a large grain of salt, but my own experience does make me suspicious. I tend to keep my hardware more up-to-date with drivers and patches (except for the video driver, which for some reason seems to make things worse on this machine when I try to update). So, my laptop is already running the most current BIOS. My wife's was not. Her wireless NIC failed in-warranty, mine waited until it was out of warranty. It's certainly a suspicious coincidence.

I did give HP support a chance. Two identical notebooks, purchased at exactly the same time. One's wireless card failed after six months, one at 13. The one that failed at 6 months was repaired under warranty, and the one that failed at 13, they want $99 to repair it.

"No, I'm not going to pay to repair it," I told the US customer service rep with the thick southern Asian accent. In fact, this will be the last purchase I make from HP.

Incidentally, this post was made on a 5-year-old IBM ThinkPad T40p that was at one point dropped on a hard tile floor. Had to replace the battery after that, but it still runs great. :P

2009-04-14

At least he didn't have to go far

So while I'm in transit to the hospital to meet my wife, I get a call. "We'll be in the ER." Apparently, while they were waiting for our son to get prepped for another CAT scan (after one week in the ICU, they still have not been able to positively identify the source of his illness), our toddler slipped, hit his head on a counter, and cracked his head open.

Considering he doesn't have a "slow" speed setting, I had always pretty much assumed it wouldn't be a matter of "if" for him, but "when". I suppose there are worse places for something like that to happen than a hospital.

And maybe it would teach him to slow down and behave? Pfft, not by a long shot. My wife reported that, while they were in the ER waiting room, with his bleeding head bandaged and waiting to be sealed up, he was still running around and climbing all over things.

2009-04-09

Looks like I picked the wrong week...

Well, this week has certainly been… "interesting."

My second son came down with a fever last Thursday. When he had a sore throat, we took him to his doctor, who checked for strep, but didn't find anything. When he broke out in a rash over the weekend, we went to the doctor again, who diagnosed it as a rash that sometimes occurs when the fever breaks — indeed, his temperature had dropped that day. By Monday, though, he was still feverish (his temperature kept randomly spiking), and he had barely eaten or drunk anything since the fever first hit, so I called a friend to assist me in giving him a priesthood blessing. On Tuesday morning, he started having severe stomach pains, and my wife took him to the doctor. She then called me at work to say, "Can you meet us at the Children's Hospital ER?"

We spent most of the day in the ER. They did X-rays and a CAT scan to check for appendicitis and any other internal injuries that might have required surgery, but everything came up negative. Eventually they decided to check him into a regular hospital room, but at some point before admission they changed their minds and checked him into the ICU instead so they could monitor him more closely.

I spent the night at the hospital with him there, and the next morning my wife came to switch places with me while I went back to work. His blood pressure was dropping, so they decided to operate to install a more direct blood pressure monitor. In the meantime, we decided to get him a Nintendo DSi to try and help him get through his stay. After the operation, the DSi lifted his spirits, but only temporarily. He had such difficulty coming out of the anesthesia that he couldn't even hold the stylus.

Later in the day, they ended up putting him in an incubator with a breathing tube and another IV, so they could administer antibiotics, blood pressure medication, nutrients, and sedatives (they say it's common to have to keep kids sedated, since being hooked up to all those tubes is very traumatic; considering how high-strung my son is, I don't doubt they're needed here).

That's pretty much were he is as of now — in the incubator, sedated, on medication, closely monitored. They're pretty sure it's a bacterial infection, but they don't have an exact diagnosis yet. His fever keeps spiking from time to time, but they do a culture every time and find no new growths. At least they're able to gradually reduce his blood pressure medication as that stabilizes.

In other news, I was supposed to help out an old friend tonight with some computer problems. I called to ask if we could reschedule, since I'll probably be in the hospital tonight. He of course said that would be fine. Then he asked if I had heard about a mutual friend of ours. "…What about him?" I asked. He said he was having some personal problems, and that I could google it. I thought that was kind of odd, since I didn't expect to see someone's personal problems on Google. I didn't think I knew anyone who would garner wide internet recognition. Yet when I googled his name, there came up several stories about him being investigated by the SEC, pictures of his home and "assets being seized", etc.

Not only was it a shock to hear this about him personally, but it was also a little unnerving to realize how close I was to the situation. I do some freelance computer work, and I wrote for him an account management program which basically automated some of the tasks he was doing in spreadsheets. As I'm reading these news stories, they mention account statements sent to clients with bad information, and I realize that it's my program that generated these very statements.

I don't expect any harm will come my way. The allegations against my friend have nothing to do with my program directly — my code only took the information he fed it, made calculations based on his specifications, and showed the results; and the allegations are solely based on factors outside of that. I never even received any money for my services — being too much of a perfectionist, I guess, I didn't want to bill him until I felt the product was "finished", and it seemed there was always just one more thing I didn't feel was quite right. So far, no one has contacted me to make any requests for information, but if they do, I can always provide the entire source code for the application and demonstrate that it only works to track the values it's told, not to independently audit or track investments.

It's a good thing I don't smoke, drink, or do drugs, because if I did, this would be the wrong week to try to quit.

2009-04-05

Bandwidth for March

Nothing terribly exciting to report for March, so here are the stats: 15.78GB down, 4.07GB up, 19.84GB total.

As of the writing for this blog post, which is just after another weekend of our church's general conference (probably about 10 hours of streaming video — two 2-hour sessions on Saturday, two on Sunday, and we let it stream video for the two hours in between Sunday sessions as well instead of stopping and restarting), the "all-time total" stands at 221.05GB. Over seven total months, and I still have not reached the limit for a single month.

Of course, I don't do a lot of high-bandwidth activities. Maybe I should torrent this "Bee Ess Gee" show that everyone's been talking about for the past couple years...

2009-03-26

Heavenly Father, I thank Thee for this day...

Got up, drove the kids to school (which happens to be very close to work). The sky was overcast and there was a dusting of snow on the rooftops; nothing that would've even made me think to wonder if school was canceled today. It was. "There's a blizzard coming this afternoon, so they canceled school," the guy there told us.

So I drove the kids all the way back home, and then all the way back to work. (It's about 25 minutes each way, made more annoying by the fact that my work and the kids' school are nearly across the street from each other — so it didn't just feel like back-and-forth, it was.)

Got to work. A big software upgrade that I was working on has been put on hold, but I need to get some new features and bug fixes out soon, so I had to copy off and roll back my changes. Except I slipped and clicked the "check-in" button. Fortunately, it was after I made a list of all the files I would be copying, so I spent all morning going file by file rolling back changes where needed. (Some changes I wanted to keep anyway, since they were themselves bug fixes. As it is, I'm not sure my mistake really set me back much.)

In the process, the promised blizzard rolled in. Our office decided to close at noon and send everyone who could work from home, home. I'm fortunate that I can. But I had to finish my check-out, check-in undo thing, since I wouldn't have access to the network from home. Plus I had a support call that kept me tied up for part of the morning. So I didn't get out until 12:30 — which, all in all wasn't too bad.

Got outside and decided to put chains on my car. This turned out to be the smart move of the day. Although it meant I didn't get started until 1, I didn't slip or slide at all on the entire drive home in my lightweight hybrid. The same could not be said for the rear-wheel drive cars that ended up blocking traffic on the main road — two of which I ended up helping push out of the way. One of them was a rear-wheel drive SUV. I didn't even know those existed. I also saw a rear-wheel drive extended-cab pickup truck slide off to the side of the road at one point.

It took me an hour to go the two blocks from my office's parking lot to the main road (the two cars I helped push happened to be blocking my turn onto that main road, which I'm sure was part of the delay — although how long they were there and/or if they replaced other cars that were stuck there moments before, I couldn't say). It was very slow going down that road. (Interesting side note: normally three lanes, there were four lanes of traffic heading in my direction. Amazing what happens when no one can see the lines.)

I finally got home at 3:30, took about a half hour fighting with my laptop before I gave up connecting it to my wireless network and took it upstairs to plug it in to my office network hub, when my oldest son came up to tell me that his younger brother had thrown up on the couch. Since my wife and the toddler were down for a nap, I went downstairs and started cleaning.

However, except for one kid who's a little sick (no fever), everyone's home and safe. And for that, I thank The Lord for a good day.

2009-03-14

Well, that was painless... mostly...

I noticed that Debian had released version 5.0 Lenny. Considering I was still running my server on Debian 3.1 and had completely missed 4.0, I decided that it was probably time to upgrade.

I went to Debian's site, followed the handy link to the release notes (that was in the sentence "If you are upgrading from a previous version"), went to the chapter about upgrading (chapter 4, if you were wondering), and followed the step-by-step instructions.

When I rebooted my system, I did so directly from the machine itself, which was good, because installing the new kernel did not select it as the default in grub. I also noticed that iptables did not load its rule set, and I quickly discovered it was because I had recompiled the previous kernel myself to include a "TARPIT" rule that didn't exist in a stock kernel image. Updating the rules to just go to a "drop" rule seemed to work, except my wireless subnet was having difficulty connecting. Long story short, I didn't need the extra drop rules (basic ones already existed), and once I removed them, all was right with the world.

I was even able to upgrade PHP to version 5 and finally get the graphs working in the vnstat PHP front-end. (They're still limited to the rolling 30 days that vnstat records, so I'll still be using my own graphs for my reports, though.)

All in all, it was a pretty painless process, most of it I was able to do from the comfort of my laptop.

[edit] Um, mostly. It seems that about a third of my packets between the internet and my wireless subnet are just getting dropped. Figures; it couldn't be that smooth.

2009-03-12

Right-click for everything?

I don't easily remember names. I can meet someone, have an hour-long conversation with them, and completely forget who they are by the next day. It's very embarrassing. When I was younger, I used to daydream about a contact lens or something that would give you a sort of "on-screen display" so when you came up to someone, it would display that person's name.

At the Technology, Entertainment, Design conference, MIT demoed a wearable "sixth sense" computer that would do just about that. And more. Using a camera and a projector, it basically replicates some of the Microsoft Surface technology, except the "surface" isn't a fixed tabletop; it's the world. It's as if you could right-click on anything you could see and be more or less instantly presented with information about it.

Well, and then some. You can also take pictures simply by framing the picture with your fingers, dial a phone by holding out your hand and pushing the buttons that are projected onto it, check the time by holding out your wrist and reading the clock projected there…

The demo video is at the link above, and it's well worth watching if nothing else then just because it's wicked cool.

2009-03-02

Bandwidth for February

Here's February's stats:

22.66GB down, 6.60GB up, 29.26GB total. For being a short month, it comes in barely behind January in total monthly usage. 11.7% of the cap. Since September (6 months), 177.97GB used total, or 71.19% of the allotment for a single month.