2008-12-28

Focus on the Prejudice

Recently, the evangelical group Focus on the Family was promoting a certain book, The Christmas Sweater, written by Glenn Beck. In a nutshell, at least from what I can gather from the Amazon summary and other news reports, it's a book about Christmas, God, family values, and redemption. One that seems to be quite popular, and one that seems to be in line with what Focus on the Family might promote.

Unfortunately, it was "outed" that the author, Glenn Beck, was in fact Mormon (gasp). From Beck's web site here, which ultimately leads to the story at Mormon Times, an anti-Mormon group posted a release to Christian News Wire calling Mormonism a cult, saying they were not Christian, and condemning Focus on the Family for not calling attention to the "differences" between Mormonism and Christianity, and therefore implying that Beck is a Christian and promoting the "false religion".

Focus is headquartered not far from here, and I have heard of Mormons who have been denied working there because of their insistence on their employees being Christian and their rejection of the Church of Jesus Christ of Latter-day Saints as a Christian church. (Might as well "out" myself here as well; I've heard these reports first-hand from members of my own congregation, being a Latter-day Saint myself.) So I suppose this can only be seen as "corrective" action on their part. It's still fairly disappointing, for apparently it reveals them as being more focused on their prejudice against a religion they don't agree with than the message being promoted.

I think the news wire release contains a couple of particularly damning points of these anti-Mormons that I found particularly interesting, in the one paragraph in which they actually reference Mr. Beck.

While Glenn's social views are compatible with many Christian views, his beliefs in Mormonism are not. Clearly, Mormonism is a cult. The CitizenLink story does not mention Beck's Mormon faith, however, the story makes it look as if Beck is a Christian who believes in the essential doctrines of the faith.

I underlined the things that stood out to me. Why do I find these parts so interesting? Well, first off, they fail to take into account that these social views are influenced by the very religion they're attempting to discredit. Likewise, if the story accurately reported on Beck's views (at least as presented in the particular book), and the results of the story are a set of views that "look like the essential doctrines of the faith", well, then, it stands to reason that Beck's beliefs are comparable to "the essential doctrines of the faith".

Are Mormons Christian? We steadfastly believe so. The name of the church — The Church of Jesus Christ of Latter-day Saints — directly names Jesus Christ, and we study the Old and New Testaments as sacred books of scripture. The subtitle of the "controversial" book of scripture, the Book of Mormon, is "Another Testament of Jesus Christ". Our weekly sacrament service, as the name implies, centers around the partaking of the sacrament, in memory of the Savior and his sacrifice for us in body and blood. We pray in the name of Jesus Christ. "And we talk of Christ, we rejoice in Christ, we preach of Christ, we prophesy of Christ, and we write according to our prophecies, that our children may know to what source they may look for a remission of their sins." So from a very simple definition of Christian — a disciple of Jesus Christ — we certainly seem to pass. But for a more scholarly discussion and research, there exists The Foundation for Apologetic Information and Research, which has collected several articles, talks, and responses to the "you're not Christian" accusation.

In the meantime, I'll continue to follow Christ according to the dictates of my own conscious, love my neighbor, be honest and true to my fellow men, and do my best to be a good husband and a father. If someone thinks that makes me or the church that teaches these principles un-Christian, despite evidences to the contrary, I suppose that's the price of discipleship, but in the end, I'll let God be my judge.

I do have to wonder how Focus on the Family managed to promote this book in the first place. From what I can tell, it didn't seem like Glenn Beck had been hiding his religious affiliation before now, so a very simple bit of fact-checking by Focus's PR department would've revealed this "inconvenient truth" well in advance. Perhaps it was a moment of weakness where they were focused more on the message than the specific religion of the author.

2008-12-19

Don't miss it 'til it's gone

When I was growing up, "humidity" was one of those things that was considered an undesirable thing. It made heat hotter and cold colder. It turned days that were just "warm" into miserable, muggy, don't-want-to-move days.

When I first moved to Denver, one of the things I enjoyed was the lack of humidity in this essentially desert climate. Hot summer days were bearable with just a fan. Opening a window was a viable option. Clothes could actually drip-dry. Even my naturally oily and acne-ridden skin started to clear up for the first time in my life.

When my dad got us a deal on a new furnace for our home (he was working in the industry at the time, so it was a good time to buy), I was somewhat bemused as to the existance of the option of a "whole-house humidifier". Why on earth would you want to add humidity to your house? My wife, on the other hand, a Utah native (where they also have a fairly dry climate) and owner of naturally dry skin, was very excited by this attachment, though.

After a couple seasons, I've gotten to understand this concept. The winter can get very dry, especially with the heater running as much as it does to keep the interior of the house above freezing. The extremely dry air ends up being very uncomfortable — it feels like you're living in a desert. Plus, there's an awful lot of static electricity that builds up in everything. The humidifier helps to make it more comfortable. It also makes it feel a little warmer, and it has the nice side effect of lowering static potential.

This winter has been especially bad. The power outlet attached to the furnace is dead. This outlet is powered by the furnace, so that it's on when the fan is on and off when it's off. So the humidifier hasn't had any power. I hadn't made getting that repaired a priority.

Then I noticed the problems. First, my shoulders would itch terribly. Yes, I, the one with the oily skin, had to start putting greasy gel on my shoulders to moisturize them after my shower in the morning. Then, my throat felt sore, the dry, parched sore of eating sand for two weeks. No matter how much water I drank, it always felt dry, and I would wake up in the morning feeling like it was on fire.

Then my oldest son started having the same throat issues. And my youngest was having trouble breathing at night. My wife broke out the portable cool mist humidifier, and that helped the toddler immediately.

That pretty much decided my course of action. Last night, when I got home from work, I ran an extension cord from a working power outlet to the humidifier. Since we run the fan full-time, it doesn't need to switch on and off, so that wasn't a concern. (That's a trick my dad taught me — if you set the "Fan" switch on your thermostat from "Auto" to "On", it runs the fan continuously instead of just when the heater or A/C is running. This keeps the air in the house circulating and at an even temperature, so you don't have the upstairs at 75° and the main floor at 65° and the furnace still burning fuel because the thermostat set at 70° is on the main floor. You do have to clean the air filter more often, but ours are the metal kind you vacuum out and reuse instead of disposable.)

I then had to run to Home Depot to get a new pad for the humidifier, since the old one from last year was scaly and wouldn't hold water (they're only $12 and typically last a winter season). Switched it on and set the humidity level to 20% (the markings have a recommended level based on outside temperature, but I've found that a constant 20% works ok, even if it means the windows occasionally show a layer of condensation on the really really cold days), checked for leaks, and closed it up.

Already, I can tell a difference. I woke up this morning and my throat didn't feel like it was full of sand.

Still, if you had told me a decade ago, before I had moved to Denver, that I would be voluntarily adding humidity to my own home, I would've laughed in your face.

Interesting side note: before we got air conditioning, we would cool our home with evaporative cooling fans. They actually work on the same general principle as the humidifier — a pump pumps water into a pad, and a fan blows across it. The cooling comes from the water evaporating. They actually work quite well in this climate, where water actually evaporates. I hadn't ever seen them before, which isn't surprising, since I had lived in places where it was more common to see water spontaneously condense out of the oversaturated air than evaporate into it.

2008-12-17

I CAN HAS LOLCODE?

One of the guys in my office showed me a list of "If Programming Languages were Religions". I'm sure I had seen it before, years ago, but it had been updated to include some more recent languages. It was pretty good (I was even able to chuckle at the inclusion of my own religion in there, whose reference was surprisingly tasteful).

One that took us both by surprise was "LOLCODE". I forget to what religion it was compared, but we had to look it up, to see if it was as bad as it sounded.

It is.

Observe the following code samples, starting with, of course, the ubiquitous "Hello World":

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
   AWSUM THX
      VISIBLE FILE
   O NOES
      INVISIBLE "ERROR!"
KTHXBYE
HAI
CAN HAS STDIO?
I HAS A VAR
GIMMEH VAR
IZ VAR BIGGER THAN 10?
   YARLY
      BTW this is true
      VISIBLE "BIG NUMBER!"
   NOWAI
      BTW this is false
      VISIBLE "LITTLE NUMBER!"
   KTHX
KTHXBYE

You can read more about it at LOLCODE.COM. Or don't. ;)

School Zones are for Losers

I drive the speed limit. When I see a speed limit sign, I moderate my speed to that number, and I set my cruise control. It's not out of any sense of moral superiority (although I will admit such thoughts do cross my mind when someone starts riding my bumper in an effort to push me above the legal limit); it's simply because I've received two speeding tickets in my lifetime, and I've decided that is plenty. Even if the chances of being pulled over for going a mile or two or five over the posted limit are remote, I've just decided it's not worth any added stress.

Does that mean I sometimes get to my destination later than someone else who might push the pedal down a little further? Sure. I've seen plenty of people speed by me and get rewarded for their transgression by getting through a street light that turns red after they pass but before I do. I've also seen plenty of people speed by me and get caught by street lights or traffic and end up no further ahead for their efforts.

Some people seem to take offense at being forced to follow the speed limit, though. Aside from the aforementioned tailgater who will follow dangerously close when I'm traveling the speed limit (usually when the limit drops or, for some reason, is posted slower than what one would think is necessary for a particular road), is this situation that I encounter each morning:

Traveling left to right (in this picture), I enter a school zone, which at the time of day is almost always active (lights flashing). I approach this intersection after making a left turn on a light from another main street, and it seems the lights are timed such that, after making that left turn and traveling to this point, I nearly always am stopped at this red light (often behind a long line of cars — there are probably about 10 car lengths between the start of the school zone and the light). Shortly after the intersection (just a few yards) is a rather large "Speed Limit 40" sign — however, this is not the end of the school zone, as evidenced by the (much smaller) "End School Zone" several yards beyond it (and the corresponding "Begin School Zone" for the traffic in the other direction at the same point). I have to wonder if the large "Speed Limit 40" sign was placed there with the intent to confuse people and entice them to accelerate to 40mph early — but that's the conspiracy theorist in me thinking.

As I approach the 25mph blinking school zone sign, slowing down is not usually a problem, as, as I've noted, there is usually a long line of stopped cars waiting for the light. Even if there are no cars or the light is green, I can typically slow to 25 without incident, although people in the left lane rarely slow completely to that speed. (I'm always in the right lane, as at the next intersection beyond this, I need to make a right, usually as well as a long line of people that would make trying to push in from the left lane difficult [but not beyond what some people will do to try and save a few seconds].)

What is more common is, after being stopped by the red light, when the light turns green, people will "forget" that they're in a school zone and begin accelerating. I'll get up to 25 and set my cruise control, as people in front pull ahead and people on my left pass me by.

What happens here more often than not is the person behind me will ride my bumper for a while, usually about halfway between the "Speed Limit 40" sign and the "End School Zone" sign. They will then lose patience and speed around me. If they've waited too long (i.e. I've reached the "End School Zone" and started accelerating to 40 myself), they will then slam on the gas to get around me.

And what do they get for their efforts? Well, I've yet to see a cop there in this, my third year of driving this route in the morning, so not even the chance of a ticket. But it does put them in front of me (although pulling away isn't possible — remember the line of people turning right at the next intersection ahead that I mentioned earlier?), and I guess that's all that matters. *sigh*

2008-12-06

Bandwidth for November

Another month, another bandwidth analysis.

The total bandwidth for November was 23,648MB down, 3,843MB up, 27,492MB total. The total bandwidth consumed for November was actually less than that for October by nearly 11GB.

This actually surprised me quite a bit. With the extremely graphic-heavy redesign of the Xbox dashboard, and with what I thought was a lot of videos and demos downloaded over the month, I would have expected a lot more usage. I even watched a couple episodes of South Park streamed from their web site. Sure, I haven't started downloading motion pictures yet, but I haven't exactly been conservative with my internet usage, either.

2008-12-05

PropertyInfo.PropertyType - is it Nullable?

Here's what I learned in school today.

I extended an object in our product with some nullable data types (something that, maddeningly, the previous programmers seemed to have an aversion to using, preferring instead to passing around "magic numbers" to represent null values — nice work, guys). Unfortunately, it bombed in one screen that used reflection to take objects and make datasets out of them.

The offending section of code looked like this:

PropertyInfo[] pInfo = myType.GetProperties();
for (int i = 0; i < pInfo.Length; i++) {
    DataColumn dCol = new DataColumn();
    dCol.ColumnName = pInfo[i].Name;
    dCol.DataType = pInfo[i].PropertyType;
    resultTable.Columns.Add(dCol);
}

The error thrown was that datasets don't support the "System.Nullable" type. Well, technically, they do, in that everything is nullable in a dataset, but that's beside the point. The solution is, I need, when building this dataset, to see if the type is Nullable, and if so, use the underlying type instead. No problem, right?

Not if you happen upon this post by the user "OregonGhost" on StackOverflow.com. He may not have invented the solution, I don't know; I just know that after searching for a bit, his post was the first answer I actually found to my question.

My code now looks like this:

PropertyInfo[] pInfo = myType.GetProperties();
for (int i = 0; i < pInfo.Length; i++) {
    DataColumn dCol = new DataColumn();
    dCol.ColumnName = pInfo[i].Name;
    Type dataType = pInfo[i].PropertyType;
    if (dataType.IsGenericType && dataType.GetGenericTypeDefinition() == typeof(System.Nullable<>)) {
        dataType = System.Nullable.GetUnderlyingType(dataType);
    }
    dCol.DataType = dataType;
    resultTable.Columns.Add(dCol);
}

And it works.

2008-12-02

Try...Catch in WinForms Main() method not Catching

Had a really bizarre and annoying error. I had a .Net WinForms app that started with a code block like this:

[STAThread]
static void Main() {
   try {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new MDIFormMain());
   } catch (Exception ex) {
      using (FormShowException showException = new FormShowException()) {
         showException.Display(ex);
      }
      Application.Restart();
   }
}

The only problem was, after one exception caused a restart (which had a side-effect of detaching the debugger), every other exception would throw a standard .Net "unhandled exception" box. Huh?

The right combination of Google search terms finally brought me to this page. Yes, apparently the above construct is fine running in a debugger, but not so much in stand-alone.

The solution, as described on the referenced page, is instead of using try...catch, bind to the Application.ThreadException event (which works both with and without a debugger attached), like so:

[STAThread]
static void Main() {
   Application.EnableVisualStyles();
   Application.SetCompatibleTextRenderingDefault(false);
   Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
   Application.Run(new MDIFormMain());
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
   using (FormShowException showException = new FormShowException()) {
      showException.Display(e.Exception);
   }
   Application.Restart();
}

Very simple fix for a very aggravating little problem. Thank you, Craig Andera.

2008-11-30

Did Thomas's mouth just move?

I finally got around to replacing the network cable on my wife's MythTV box, and it is back to recording TV shows for the kids again. I started up a new recording of Thomas the Tank Engine for the toddler, and I had to do a double-take when I saw his face actually move when he spoke.

If you're not familiar with the show, it's done with model trains that have faces. The faces change from scene to scene, but never "on-camera". The only thing that you ever saw move was the eyes, which could shift (or spin on some comical occasions). The faces were very expressive, but they were always static plates that would be interchanged when the camera cut away.

Well, no more. It appeared that the faces were now animated, although the rest of the show did appear to be the same model sets. A quick google did seem to confirm this guess, that as of this season, the face plates in filming were replaced with a target that a computer used to overlay with a CGI face. The effect is actually pretty well done; to me, the face does indeed look like it is part of the train.

Oh, and the people, which were before just wooden models, are now completely CGI. They still have the same look as their wooden model counterparts, but now they can move around, although they are animated to be almost robotic — probably to keep the impression of their wooden heritage?

Of course, the internet being what it is, as I was googling, I came across the melodramatic reaction that they've "ruined" Thomas the Tank Engine. I dunno, my kids (after getting over their initial shock of first seeing Thomas "blink" and then actually "talk") thought it was pretty cool.

I'm still a little undecided. Not that I spend a ton of time analyzing Thomas, but it is getting watched a bit more often now that our toddler has decided he likes watching "woo-woo" (train whistle, although the "word" also applies to cars) almost as much as he likes "Wawwy" (that's "Larry" from Veggie Tales). It's definitely different.

What does concern me a bit is that the press release indicates that while the faces are CGI this season, next season the entire show will be CGI. Because they use models now, it has that "model railroad" feel. Going all CGI would make it possible for them to completely change the look and feel of the show to however they want. Hopefully, they won't, because I think that's part of the show's charm.

I can definitely see, though, how it might be almost a little sad to think that there aren't actual model trains behind the show anymore. I grew up with model trains. But I also am a computer geek, and I can understand why they would want to move to using computers to produce their show. I imagine their models need a lot of maintenance, and creating a new character or even a facial expression is a costly amount of work, involving real, physical materials.

But they've always done it so well. Hopefully they don't end up trivializing it.

The press release also indicates they're moving the show Bob the Builder from stop-motion to CGI. I'm surprised they didn't do that sooner. I can't imagine how much time and energy and patience must go into making a stop-motion video.

2008-11-16

Don't say that word!

Religious discussions (particularly on the internet) rarely end well. No matter what forum, someone will bring up the ways religion has been perverted to propagate fraud for someone's financial gain, or how many people have died because of arguments that have led to violence that have led to wars over religious differences, or some other list of atrocities. And, nearly always, someone will posit that religion itself is the cause of those travesties, arguing they would not have happened if religion had not existed, and therefore, the world would be a much better place, and indeed would have been a much better place for all of history, if religion didn't exist.

It's a hurtful thing to say to someone of faith, that the world would be a better place without something that you believe to be important. I don't think it's necessarily said with the intent to be hurtful. It's just an expression of their opinion.

Because opinions differ to such a degree, however, it's considered "conventional wisdom" that, to avoid hurt feelings, one simply does not discuss religion.

I've thought about this, though, and something occurs to me. If I were Satan, and I wanted to stop people from drawing closer to God, it seems that one very effective way to do this would be to stop people from talking about Him. I think that spreading it around that it was somehow "impolite" to talk about religion might be a good way to make people stop talking about it. In fact, it might have the added bonus of making people expect a religious discussion to be impolite before it even began, to make them less likely to respect another's point of view (even if they disagree with it) and more likely to use absolute statements that are hurtful and mean, perhaps without even realizing it.

So that means the only appropriate response is to talk about it.

The argument goes that religion is the cause of so much evil and horror in the world, leading to many of the wars in history. However, I look at our current government. It has ruled under a policy of not governing according to a religion. And yet, it has had plenty of opportunity to wage wars for different reasons. So to suggest that wars were caused by religion would also suggest that, without religion, the wars wouldn't exist. And yet, mankind seems to find plenty of reason to wage war outside of religion.

Some people point to the instances of people using religious influence to swindle people out of money for their own personal gain, or even violations of person. This, too, has plenty of evidences outside of religion to be considered a flaw of religion itself.

The very argument that religion should be thrown out based on these examples is flawed anyway. It is an extreme solution that focuses on the negatives of people misusing the tool. One could make the same argument with governments. Or public schools. Or armies. Or the Boy Scouts. Or the internet. Guns. Television. Oil. You name it; somebody has used it to hurt someone. Maybe even lots of people. Maybe started wars over it. And yet to say "it" is bad is just scapegoating at best.

I'm not sure why someone would say the world would be better off without religion. Maybe it's scapegoating. Maybe it's just that they don't like it and would rather not hear about it anymore (akin to me saying "The world would be better off without rap music," no matter how many people like it). Maybe it really is an attempt to say something so extreme and hurtful that it closes off any further conversation. It's hard to say, considering a statement like that does close the door to any meaningful dialog.

Which, unfortunately, is probably very pleasing to a certain enemy to all righteousness...

2008-11-12

A boycott of United Airlines

Greg Dean of Real Life Comics posted a rant today about some really insulting fleecing from United Airlines. I know this blog doesn't get a whole lot of traffic, but it's something that I think is important to note. This kind of behavior is just inexcusable.

I already avoid flying for the expense. Even when gas prices were at an all-time high this summer, I chose to drive my family out to California rather than battle the airlines and airports who have seemed out to make flying as inconvenient and expensive as possible. You can be sure I won't be flying United if I have anything to say about it.

2008-11-06

Calling a Web Service in a loop

Wow, does this ever suck.

Ok, so here's the problem. I have a service that takes an XML file, which contains a list of parts from another system, and I need to synchronize the list of parts with our system. In order to do this, the service loops through the list of parts, and for each one, it attempts to look up the part in our system. If it exists, it gets it, and updates its properties with data from the file. If it doesn't, it creates a new one, with properties from the file. It gathers all these creations/changes into a collection, and then saves the batch to the database.

Seems pretty straightforward, right? The catch is, the interface to our system is through an authenticated web service.

Well, gee, that's not so tough, right? After all, in .Net, you just create a reference to the web service, and it does most of the work for you, creating all the wrapper classes and so forth. And, most of the time, it's as simple as that.

The problem, though, is that in this sample data set, we had about 5,000 parts. For each part, a query had to be made to the web service: Give me this part. (It'll return either the part, if it exists, or a null, meaning it doesn't, and I have to create one.) And for some reason, after about 3800 or 3900 calls to the web service in rapid succession, it would just quit. "Unable to connect to web service." The inner exception revealed a little more detail: "Only one usage of each socket address (protocol/network address/port) is normally permitted."

Huh?

After considerable digging and googling, I finally unearthed this blog post by Durgaprasad Gorti, which reveals the problem. An authenticated call closes the connection, but the Windows TCP stack holds the socket in a "TIME_WAIT" state for four minutes by default before it can be reused. While he does offer a registry hack to tell Windows to cut that time shorter, I wanted to find a way to do it in code, so it's one less variable to keep track of on a client's machine.

Unfortunately, all of my experimentation proved fruitless. No matter how I played with the ServicePoint, trying to forcibly close it, setting its timeouts to minimum values, whatever, the sockets stayed open too long.

So much for trying to out-think the Microsoft guy.

His code-based solution, therefore, is the one I'm using. Unfortunately, it's not great in that it basically just delays the problem — by expanding the range of sockets it can use, instead of crashing in under 4,000 calls, the limit is raised to 60,000.

He gives the basics of how to implement it, but unfortunately he doesn't indicate where the code needed to go. Fortunately, I found another blog post, by Kamil Pakur, that gave me just the clue I needed. (Incidentally, he's trying to solve the same problem, but his solution — forcing the KeepAlive to false and the HTTP protocol version to 1.0 — didn't change anything in my scenario; it still crashed in under 4,000 calls. In fact, it would seem that KeepAlive=false, which is automatic in an authenticated scenario, is the source of the problem.)

So, here's what I did:

  1. Copied the "namespace" and "public partial class" lines from the auto-generated Reference.cs file representing my web service into a new code file.
  2. In that file, copied Gorti's public static IPEndPoint BindIPEndPointCallback method.
  3. Added to that file a protected static int m_LastBindPortUsed = 5001; line (which is used in the "BindIPEndPointCallback" method).
  4. Added a method to override the service's GetWebRequest event that set the ServicePoint.BindIPEndPointDelegate to the BindIPEndPointCallback method (the first line on Gorti's code block).

My entire class file looks a lot like this:

namespace ProjectName.ServiceName
{

 public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol
 {
  protected override System.Net.WebRequest GetWebRequest(Uri uri) {
   System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
   webRequest.ServicePoint.BindIPEndPointDelegate = new System.Net.BindIPEndPoint(BindIPEndpointCallback);
   return webRequest;
  }
  //protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request) {
  //    if (request is System.Net.HttpWebRequest) {
  //        System.Net.HttpWebRequest httpRequest = (System.Net.HttpWebRequest)request;
  //        System.Net.WebResponse response = base.GetWebResponse(httpRequest);
  //        httpRequest.ServicePoint.MaxIdleTime = 1;
  //        httpRequest.ServicePoint.ConnectionLeaseTimeout = 1;
  //        httpRequest.ServicePoint.CloseConnectionGroup(httpRequest.ServicePoint.ConnectionName);
  //        return response;
  //    } else
  //        return base.GetWebResponse(request);
  //}
  protected static int m_LastBindPortUsed = 5001;
  public static System.Net.IPEndPoint BindIPEndpointCallback(
   System.Net.ServicePoint servicePoint,
   System.Net.IPEndPoint remoteEndPoint,
   int retryCount) {
   int port = System.Threading.Interlocked.Increment(ref m_LastBindPortUsed);
   System.Threading.Interlocked.CompareExchange(ref m_LastBindPortUsed, 5001, 65534);
   if (remoteEndPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
    return new System.Net.IPEndPoint(System.Net.IPAddress.Any, port);
   } else {
    return new System.Net.IPEndPoint(System.Net.IPAddress.IPv6Any, port);
   }
  }
 }
}

(I left in the code for the GetWebResponse override, just so you can see some of the things I tried to clear up the sockets. It's all commented out now, of course, because it, quite simply, just doesn't do a blasted thing.)

The service now completes the run on our test data. However, I'm still not comfortable with the solution. There is an upper limit to the amount of data that it can process at a time.

Maybe a better solution is to ship the file across to the web service and do the processing there. (It would certainly make for a cleaner interface, an actual web service that does tasks, instead of the glorified and bloated data access layer we have now.) But that, too, is a double-edged sword. Web services have limits on how much data can be shipped, plus timeouts on how long the client will wait for a response.

What really surprised me in researching this is how little information there was on this problem. I guess calling an authenticated web service in a loop isn't a common scenario. It was only when I googled the text of the inner exception that I found it, amongst a lot of results pointing to people actually opening a lot of TCP connections manually.

I did come across a few posts of people complaining about web services failing in a loop, but the responses (when there were any given) were nowhere near the actual solution (suggesting a timeout issue with the session or authentication cookies). Maybe this post will be of more help, since I tried to bring the problem and solution together.

2008-11-05

Cell-ing Out

This MSN Tech article asks the question, "Are all the extra features really necessary? Or should a phone just be a phone?"

An interesting stat mentioned is that "camera phones … outsold regular cell phones for the first time in 2007", but what it doesn't say is why. Last time I looked at cell phones (which must've been four or five years ago, as that's at least as long as I've had my current phone), you had to look hard to find one without a camera, whether you wanted one or not. It's almost like Microsoft bragging about how computers with Vista are outselling XP, when it's extremely difficult to find a computer with XP anymore.

Personally, I don't even use my phone for text messaging, let alone email; but that has more to do with cost than with preference for the feature. I would love to surf or instant message from my phone, or use it to play music. But a full-featured phone like that starts at over a hundred dollars, and a data plan would increase my monthly cell phone bill by close to 50% (just for my line, and if I got it, my wife would want it, too, thus doubling the cost). Even text messaging plans are getting expensive (as I've ranted about before).

I've used a Pocket PC for a time (before the battery stopped holding a charge), and I thought it was wonderfully convenient, even if it lacked connectivity. I think one with a built-in phone and Wi-Fi would be the cat's meow. But, it's just not a need, certainly not compared to not spending the extra money per month.

Makes me wonder about these people who do use the extra services — "the youth", the article says. Are they paying their own cell phone bills, or is it coming out of mommy and daddy's account?

The winds of "Change" stink

Well, media's darling boy has been elected president.

It's being said that this was a historic day, as it was the day when America finally elected a black man as president, thus proving that the color of your skin doesn't matter. (Looks to me more like the day we elected the wrong man president, chosen by the media months in advance, thus proving the content of your platform doesn't matter if you have a buzzword, a logo, and a catchy motto; but let's MoveOn, shall we?)

I don't think prejudice is out of the picture at all. To satisfy my own morbid curiosity, I snuck a peek at a certain online community I know of that is extremely left-leaning in its membership, just to see how hard they were patting each other on the back (and mentally compare it to the prophecies of doom and gloom of four and eight years ago).

Among the comments of smug satisfaction, I noticed one referring to "the new monkey in the White House". This post was followed by calls for moderation and censoring for such a racist statement.

What's very interesting, however, is that our current president, George Bush, has often been compared to a monkey. How many pictures have we seen with Bush's face side-by-side with faces of monkeys showing strikingly similar expressions? I know I've seen a few, probably had the same set in my email box a dozen times in the past eight years. However, to extend this same metaphor to president-elect Obama ("the new monkey" definitely alludes to there being an "old monkey") is now taboo because of the color of the man's skin.

This point was brought up in the forum. The administrative conclusion was that the initial comment would be allowed a pass, but a repeat comment would be considered malicious and subject to disciplinary action.

I predict we'll see a lot more of this during the next four years. Criticisms and jokes that would've brought cheers and howls of laughter levied against the Bush or Clinton presidencies will, when made against the Obama Administration, bring howls of protest and accusations of racism. Dis the president now, and you're not just unpatriotic, but a racist.

If this is used to shut down right-wing media outlets (at worst, or "merely" as a way to institute the "Fairness Doctrine"), it wouldn't surprise me.

2008-11-03

Bandwidth for October

Just to continue the analysis, bandwidth usage for October was 32,094MB down, 6,580MB up, 38,674MB total. Aside from the extra video watched one weekend earlier this month, there were a lot more demos to download from the Xbox Live Marketplace for my Xbox 360.

Still, the total bandwidth consumed was only 10GB larger than my September "baseline", and over 200GB shy of the cap.

Even the psychological effects of the cap are starting to wear off at this point.

I wonder if there's something I can torrent, to see what kind of effect that has on bandwidth.…

Morpheus, Grokster, Limewire and Kazaa!

Yep, I said some dirty words. Or at least according to MTV. Weird Al Yankovic, my most favoritest artist evar, mentions those file sharing sites (two of which don't even exist anymore) in his song "Don't Download This Song" (which he offered up for download upon release), but MTV refused to run the video with those names mentioned.

So, Yankovic obliged by censoring the video. But, he did so in the most obnoxious way possible, with very loud, irritating beeps. Why? In his words:

Instead of subtly removing or obscuring the words in the track, I made the creative decision to bleep them out as obnoxiously as possible, so that there would be no mistake I was being censored.

Techdirt reported on this here. They link to the New York Times article here, although I don't know if the Times will hide their article behind a paywall eventually (the major newspapers seem to be going back and forth on this idea), hence the Techdirt link.

I like Weird Al. :D And, he's a very nice guy in person, too, or so says my lucky brother who happened to meet him and was able to taunt me with this picture.

my brother and Weird Al

No, I'm not jealous. Why would I be jealous? Just because he happened to meet the one musician I happen to be a big fan of... :P

Sex on TV Increases Teen Pregnancy, Says Report

Just another reason why you shouldn't let TV raise your kids.

2008-10-30

Is this file open?

Coding problem of the day: I have a service (written in C# .Net) that monitors a folder for incoming files, and when a file appears, it needs to process it. At the moment, it is using a FileSystemWatcher object. I don't know if I'll continue to use that or not (it was written by someone else before I got here), as it doesn't guarantee any sequence of events, nor does it help if files exist before the service is launched. But that's beside the point.

The problem I discovered is, if the file is coming from another computer over a slow link (e.g. an FTP or other slow network transfer), the FileSystemWatcher will raise its Created event as soon as the file appears, but the file is not yet ready. (I simulated this by writing another program that slowly writes a very large file to the target directory, using a loop and a Thread.Sleep.)

The solution, like a lot of other things in programming, is a little convoluted, but it seems to work for the time being. The gist of it is, in the Created event handler, I first call a function that tries to open the file for exclusive read access. If the file is still open, this will fail.

Testing for this failure is the hard part. The exception that gets thrown is a fairly generic IOException, and while a "file in use" is one condition for which I want to stop and wait, there are other conditions that I would quite definitely not want to wait to magically resolve themselves. The MSDN doc on IOException lists several derived classes that, for example, I would rather treat as critical errors immediately, like PathTooLongException, DirectoryNotFoundException, FileNotFoundException…. If I waited on those, I have a feeling my code would be waiting a very long time.

So, here's my "is this file locked" function:

using System.IO;
using System.Threading;

/// <summary>
/// Makes sure a file is closed before attempting to use it
/// </summary>
/// <param name="fullFilePath"></param>
public void WaitForFileClose(string fullFilePath) {
 while (FileIsLocked(fullFilePath)) {
  Thread.Sleep(new TimeSpan(0, 0, 15));
 }
}

/// <summary>
/// Determines if a file is still locked by attempting to open it for unshared (exclusive) read access.
/// If an IO Exception occurs that includes the text "another process" in the message (i.e. "in use by
/// another process"), the file is assumed to be locked.  Any other exceptions are rethrown.
/// </summary>
/// <param name="fullFilePath"></param>
/// <returns>
/// true if the specific "another process" exception was found trying to open the file, false
/// if no error occurred.
/// </returns>
/// <remarks>
/// May not work on systems in other languages.  There is no specific "file locked" exception to
/// test for, and there are other exceptions that derive from IOException (like FileNotFoundException)
/// that should not be waited on.
/// </remarks>
private bool FileIsLocked(string fullFilePath) {
 try {
  using (FileStream fs = new FileStream(fullFilePath, FileMode.Open, FileAccess.Read, FileShare.None)) {
   fs.Close();
   return false;
  }
 } catch (IOException ioex) {
  if (ioex.Message.Contains("another process"))
   return true;
  else
   throw;
 } catch {
  throw;
 }
}

As I note in the comments, I'm concerned this might not work on other locales, since I'm specifically looking in the exception's message text for the string "another process". Unfortunately, I don't have a better way to determine what IOException got thrown. I set a breakpoint and tested it, and (at least in .Net 2.0 on Windows XP SP3), it was indeed throwing a base System.IO.IOException with that text in the message.

I'm open to any better ideas, though….

2008-10-28

The DMCA, 10 years later

The EFF is "celebrating" the 10th anniversary of the Digital Millennium Copyright Act with a report of the unintended consequences its use and abuse has had on research, trade, and civil liberties. It's a worthy read, even if they do leave out one of my favorites — that Sharpies were suddenly circumvention devices because they could be used to defeat CD copy protection*. :D

*Ok, no legal action was ever taken against Sharpies, or even web sites for describing the process as far as I know; but the fact that this joke popped up around the internet more than once just shows how ridiculous the whole thing is, and how easily it was recognized as such back in 2002.)

2008-10-27

If the MPAA Did Handbags

Continuing the theme I seem to have picked up lately, in linking to random articles I find interesting, was this one I saw via Techdirt. It's from the "Pure Purse Passion" site BagBunch.com, and it's an article that claims to, in its own words, "[show] the bad ethics, hypocrisy and stupidity of the companies behind our TV Shows, our documentaries, our movies, and our music." In short, what would happen if the handbag industry created an "HIAA" and adopted the same practices as the MPAA and RIAA? clicky

Granted, the analogy isn't perfect (and they admit as much in their opening statements). For starters, music these days as a digital good can be copied infinitely, with zero degradation, for essentially zero cost; whereas a handbag as a physical good would still require materials and labor.

Despite the flaws, I think it's a worthwhile article. By applying the *AAs' "logic" to a physical (and non-technical) context, perhaps it'll help make more people more aware of what is going on, instead of just being iTunes sheep who unknowingly lock themselves into whatever draconian DRM rules Apple throws at them.

2008-10-23

Biden's Bungles: A Blatant Bias

Wow. When the New York Post starts to report on media bias (and even Dan Rather is commenting about it), you know there are problems.

2008-10-21

Would the Last Honest Reporter Please Turn On the Lights?

Hear, hear!

How dare you obey the rules of the road

According to the Colorado Driver Handbook, which I just downloaded from the DMV website for confirmation, section 10.1a, if a traffic signal is malfunctioning or not operating, the intersection should be treated as a four-way stop. If the lights are on but flashing yellow, it is a warning of hazard, to slow and proceed with caution (but not "treat as a four-way stop").

For some reason, people in Colorado don't seem to understand these. When they're not completely ignoring them, they get these rules completely backwards.

Last week, I was driving home in the middle of the day to shuttle my wife to the auto shop, as we were down to one car while the minivan was having some maintenance (an $800 repair of the climate control system — ouch), when I noticed a stoplight was completely out. The road I was on was a six-lane divided road, and the intersection was with a small, two-lane road. A pickup was waiting on the cross street.

I slowed to a stop. A truck in the lane next to me blowed through the intersection, and I honked at him — which earned me an irritated honk from the truck behind me. I waited patiently as three more cars blew through the opposite direction before the pickup finally got his turn to go through the intersection, which, as you'll note in my first paragraph above, is legally a four-way stop at this point.

The next street light is also in a "non-standard" mode, but this one is blinking yellow. (The street I'm on has reduced to a two-lane road by this point.) Wouldn't you know it, traffic coming the other way is actually stopping at this blinking yellow light. I slow a bit, to make sure the car waiting on the cross street at his blinking red light doesn't try to pull out in front of me, and cautiously proceed through the intersection.

After I pick up my wife, we head back on the same road. I notice people are now treating the dead light like a four-way stop, but I believe this is due to the police car that has stopped beside the intersection, as a cop is donning an orange vest to direct traffic.

Slow down, so I can cut you off!

My friend, the "Top Hat Rabbit", just made a blog post that reminded me of a driving incident. This happened many years ago, but I still remember it clearly.

I was driving home from work one day, and to avoid traffic, I cut through a neighborhood, taking a route I had taken many times before. At one point, I came around a curve, where a side street joins the main road I was on. A couple guys in a little red convertible were at the stop sign. The driver was talking to his passenger, not paying any attention, and started to pull out in front of me as I came by. To avoid getting hit, I hit the gas and swerve around him. My sunroof was open, so I heard him yell, "Slow down, a**hole!"

Of course, he couldn't let this go. He had to prove to his friend how big a man he was. Up at the street light exiting the neighborhood, I waited to turn left, and he pulled up beside me in the right turn lane, arm and middle finger extended. When I refused to so much as glance in his direction, he tried to get my attention. "Hey a**hole!" he called. Still no reaction. (Nice language to be shouting in a neighborhood, I thought.)

He inched his car forward, I suppose so he could get a look at my front license plate, which I guess he wrote down, because he then started waving a piece of paper in the air, calling, "A**hole!!!"

The light turned green. I finally looked over at him, blew him a kiss, and drove off.

Hope I didn't make his boyfriend jealous.

2008-10-07

SQL 2005 getting too smart?

We had a bug with one of our clients that had just upgraded from SQL Server 2000 to 2005. In the process, we were deploying some new application features to them, and one was crashing. This same feature was working just fine for other clients (and in-house, of course), so we were puzzled.

The problem is actually from something I used to wish SQL Server was smart enough to figure out on its own for a long time. Namely, when you write a SQL statement such as this:

Select U.UnitId, U.UnitName, UT.UnitTypeName
From Unit U 
Inner Join UnitType UT On U.UnitTypeId = UT.UnitTypeId
Order By UnitTypeId

you will get an error to the tune of "Ambiguous column name 'UnitTypeId'", because (in this case) you reference it in the Order By clause but don't indicate which source table you want, since the same column name exists in both tables referenced in the From clause.

Logically, it doesn't matter which one, because you mandate in the From clause that both UnitTypeIds are equal, but SQL syntax dictates you must specify which one you want.

Despite seeing this many times, it's still not automatic that I'll specify the table in my Select and Order By clauses, so I still see this error a lot.

I hadn't seen it recently, but suddenly it popped up on this one client's database. Sure enough, I hadn't specified the table in the Order By clause again. Yet it was working fine on other clients' databases, and working fine internally.

Our QA guy managed to find the "SQL Compatibility Mode" option on the database. Because they had upgraded this database from a SQL 2000 database, it was still in "SQL 2000" mode. Because of this, it was revealing the error in my SQL that was going through undetected on servers running in native SQL 2005 mode. He flipped the switch to "SQL 2005", and it let my bug go through.

Needless to say, my local database is now in the more restrictive "SQL 2000" mode, so hopefully I can catch more bugs before they're revealed by environment. It should also help if we ever decide to migrate to other database servers, such as MySQL.

Impact of video on bandwidth

Continuing the saga of bandwidth, I had an interesting data point come up this weekend. My church has a general conference twice a year, where we have an opportunity to hear from the leadership of the church. This is streamed live over the internet in fairly decent quality video (in my completely unscientific opinion, it looked just as good as any standard TV show might look on a 12" laptop computer screen).

The conference spans the entire weekend, with two 2-hour sessions broadcast each on Saturday and Sunday. At the end of the second Sunday session, the thought suddenly occurred to me; I wondered how much bandwidth I was using up.

Fortunately, this is something I can check without too much difficulty. A quick call to vnstat reveals the following statistics:

DayInOutTotal
Saturday4.68 GB206.82 MB4.88 GB
Sunday3.98 GB123.33 MB4.10 GB

Saturday will of course include some extra bytes for online gaming, which doesn't happen on Sunday.

Interesting thing about those stats: if that happened every day, watching four hours of streaming video, I still wouldn't hit the cap. I'd come far short of it, in fact.

2008-10-01

Bandwidth - the Baseline

September is now over, so I now have my baseline for monitoring my bandwidth, to see how I fare against the bandwidth cap. Total data used for the month of September: 22.36GB down, 5.44GB up, 27.80GB total.

September was a bit of an odd month, though. For about a week and a half, I was without an Xbox 360; and for almost the whole month, my wife was using my laptop while we tried to get hers repaired (the wireless network card was fried). However, even with those odd variables, there are some worthwhile data points.

First off, there is only one day in the entire month of September that shows a total over 2GB (2.24GB used on 1 Sep) — every other day is under 2GB, and only 5 days total are over a gig and a half, with an additional 7 days between the 1G and 1.5GB marks.

There is a definite dip in usage around the time my 360 died, so its effects are noticeable. There's also a spike on the 13th that would represent when I got my new 360 and proceeded to play the heck out of it all day. Another sweep up starts on the 23th, which could represent when I and three others decided to make a speed run at a Halo campaign level for a competition that Friday night (we practiced every night that week). The extra boost starting on the 25th may come from my wife finally getting her laptop back from HP and having to download updates and reinstall software.

Even with the up-ticks, there's still not a lot of bandwidth being used. If you take the heaviest of the days that should represent things getting "back to normal", the 25th, and multiplied that by the entire month, it's only 50GB, or about a fifth of the cap.

But how could that change? If I wanted to ditch the $40+/month "digital voice" service from Comcast and shop around for other VOIP options, I'd be looking at an increase in usage just for using my phone. If I wanted to take advantage of the upcoming Netflix integration with the Xbox 360, that would cause a huge increase in bandwidth, depending on how many movies I tried to watch. For that matter, the "New Xbox Experience" is creating a new paradigm for interacting with friends (i.e. they're ripping off "Miis"); will this have an impact on how much bandwidth is used just sitting in the dashboard, while my friends' avatars are displayed on my console?

I think I've come to the conclusion that it's safe not to worry yet, but it still makes me nervous about trying new and potentially high-bandwidth-eating applications or services. And I still think that's just the way Comcast likes it.

2008-09-16

Zune Software Revisited

The Zune software player has gone through an update or two since I last checked it out at the beginning of the year, so I thought I'd give it another look. Unfortunately, I'm still not impressed.

The player is responding to the media keys on my keyboard, so I can play, pause, and skip quickly. It also does the neat (and useless, but I like it, so there) trick of updating your Windows Messenger status line. And it hasn't caused my computer to blue screen (yet).

However, when I set up the software, plugged in my Sansa media player, and told Zune to watch the E:\MYMUSIC folder, it did absolutely nothing. I thought it was supposed to automatically add the files to the library? I tried dragging and dropping the files from Explorer to Zune, but still nothing happened. It wasn't until I selected the files in Explorer, right-clicked, and said "Play with Zune" that the Zune player would play the files. It still didn't add them to the library, but it did at least create a playlist of all the files.

There are still features that are just missing. Automatic volume leveling, quiet mode, a graphic equalizer, crossfading, a mini-mode... These are all features that I can remember being built-in to programs for years, and are, in fact, built-in to Windows Media Player.

Now, when I first started writing this post, it was about a week ago, and as I was checking the Zune.net forums to see if I was the only one to complain about this, I noticed that Zune 3.0 was to be released very shortly. New features, including crossfading, were coming. So I decided to wait until now to install the new version and finish this post.

Unfortunately, if there are any new features, they seem to be reserved for the Zune device itself, as the desktop player is almost entirely unchanged.

I'm not suggesting the Zune team reinvent the wheel. There's no point. What they should be doing is making this a WMP plug-in. Not only would I, as a user, be able to take advantage of the features that already exist in WMP, but I could also download and/or purchase other plug-ins for WMP that enhance my music however I like, and I'd still have the "Zune Social" connection.

I've posted this suggestion in the Zune wishlist forum, and basically the response I got back was, "The Zune team couldn't do everything they wanted with the software within the confines of a WMP plug-in." To which I say, "Do they have to?" Keep their software with whatever it does as a separate app. Heck, all I really want is a plug-in for WMP that updates my Zune card with my plays, but let me use WMP as my player.

I suppose what I'm asking is not entirely reasonable. The Zune Social is meant for people who own Zunes and is meant to interact with Zunes. I don't expect any sort of DirectX plug-in that adds the PC games I play to my Xbox Gamercard, as that is meant for people who own Xboxes and is meant to interact with Xboxes. Still, it seems almost cruel to have a taste of this "social experience" thing and have it be so crippled when it could be solved by the simplest little piece of code.

*sigh* Maybe I'll check on it again in another nine months...

2008-09-15

Best Buy Store 694 Customer Service

I've had to deal with the customer service desk at Best Buy Store #694 in SE Aurora, CO on four occasions since it opened (about 3 years ago). I have to say, I'm very happy with them.

The first time was when I had to exchange an Xbox 360 that was giving me the infamous "red ring of death". Since this was before Microsoft had owned up to their hardware failures and started fixing problems after 3 months, I decided to invoke the Best Buy product replacement plan. Took the box to the desk, they brought me a new one. I asked if I could keep my old hard drive, and they said it would be no problem. (It was a common request by this point.) They helped me unpack the new console and swap hard drives. Aside from time spent in line, I was in and out in probably 10 minutes.

The second time, I had ordered a game from BestBuy.com, and when it was finally delivered (UPS mis-routed it first, and then severe snowstorms prevented its final delivery another week), it ended up being the wrong game. I brought it to the customer service desk, and the gal working there explained that Best Buy stores and BestBuy.com were separate entities, so they were limited to what they could do. They checked to see if they had the game I wanted in stock, but they didn't (which was why I ordered online in the first place), so she said I'd have to deal with BestBuy.com's customer support. She then picked up the phone and called BestBuy.com's customer support, explained the situation, and turned the phone over to me so I could finish the details. She could've very easily just told me to go home and call them, but the fact that she took an interest in getting me in touch with whom I needed to talk to, to get my issue resolved, really went a long way to winning my respect.

The third issue was when we had just picked up a business points membership or some such promotion. We bought a couple items, and we were supposed to get a certain amount discounted. The register refused to give us the appropriate discount, and the cashier wasn't able to do much about it. (Not surprising. I've been a cashier, albeit in a grocery store, and for better or worse, you're given very little control.) She directed us to customer service. We took our receipt over, and the gal there worked with the register for a bit. Then fought with it. She wasn't able to get it to give us the precise amount of credit back on our credit card, but she figured out a way to coerce the register to give us a discount that resulted in a slightly higher amount (like a buck and a half), so she went with that and called it good. All the while, she had a very positive attitude about helping, even when the system was obviously frustrating.

And then comes the most recent experience. I figured this one might be the most... interesting. Once again, I had an Xbox 360 that needed replacing. Because the hard drive sizes had been increased, I figured this time, I didn't want to just keep my old hard drive; I'd want to transfer my data from the old drive to the new. I'd done the research to see what it would take and invoked the GeezerGamers.com network to obtain a hard drive transfer kit that Microsoft provides for this purpose. I entered the store, armed with the transfer kit and some fresh Krispy Kreme donuts for bribery.

Once I had selected my replacement system (a 360 Elite, which, since the Best Buy replacement plan is based on original purchase price and the console prices had dropped quite a bit, only cost me the price of a new replacement plan if I wanted it -- "You better believe it" was my reply to that), I explained what I wanted to do. I explained that I had the transfer kit with me, and donuts. She politely declined the donuts (saying that, oddly enough, I was the third person to offer her donuts that day) and asked what I would need. Just a TV, and I made a point of saying it would probably take an hour. (I figured it was only fair that she knew exactly what I was asking.) As it so happened, the Geek Squad desk around the corner had a TV monitor that they rarely use, and they were happy to let me use it. They couldn't assist with the actual transfer (a policy that comes from wanting to avoid getting into legal tangles transferring songs between MP3 players), which I understood completely. About an hour later, I handed her the old hard drive, thanked her again, again offered her donuts (which she again politely declined), and walked out with my shiny new Elite.

So I just have to give "mad props" to this store's customer service team. They've really helped me out. I'm not saying I'd expect them to break rules for me, though — before helping me, the gal (who is likely a customer service manager, which is probably why she was able to get me set up on a TV for an hour) had to be called over to explain to someone else that they can't price-match another store's bundle deal. But as far as helping me out with issues, they've been nice, friendly, willing to help, and willing to do what it takes to resolve whatever problem I've had.

2008-09-04

I may be slow, but I'm FIRST!

I've been meaning to add this to my driving posts for a while. I just read an interesting article on Ars Technica, titled Selfish driving causes everyone to pay the Price of Anarchy, which is a pretty interesting discussion about an upcoming research article on traffic patterns and how, when each person is driving according to their own personal best interests, the entire group (including themselves) suffer.

It doesn't really have anything to do with this particular post, but it did remind me of one behavior I've observed and thought worth mentioning.

Many times, I've approached a stop light on a multi-lane road, where my lane is clear, but adjacent lanes have multiple people waiting at the light. Since I tend to accelerate fairly quickly "off the block", I like seeing this, because it means I'll get to reach cruising speed much faster. (One theory is, for better gas mileage, one should accelerate more slowly; however, in a hybrid car such as I drive, the theory is reversed, as faster acceleration is supposed to induce more assistance from the electric motor and actually decrease gas consumption.)

However, quite often, as I'm approaching the stop light, someone from an adjacent lane will pull out in front of me and take the "pole position". (If I'm lucky, it'll happen far enough in advance that I won't have to slam on my brakes to avoid a collision.) There are two possible, logical reasons for this behavior: (1) this person likes to accelerate quickly, and therefore wants to be where no one is in front of him, or (2) they need to make a turn soon and are changing lanes while they have a chance. However, way, way too often, this person will end up accelerating more slowly than the person they just got out from behind, and keep going straight for quite some time (i.e. several miles), even moving back into the lane they just left.

So what was the point of changing lanes? A better view of cross traffic before the light changed? A desire to witness the changing of the light for one's self? Mistrust that the car in front of them would actually be able to go once the light changed? Or that irrational fear of someone passing them, that same one that causes people in the right lane on the interstate to suddenly accelerate as I approach alongside in the left lane (note that I habitually drive with cruise control, so I'm reasonably certain my speed is constant)?

Or maybe this pathological desire to be "FIRST!" extends beyond internet comment boards?

2008-08-30

Bandwidth cap - essential or anti-competitive?

Comcast has recently announced that, in order to preserve their network service, they are going to implement a bandwidth cap of 250GB per month. This, they say, won't affect but a single percent of their users. The first time you go over this limit in a given month, you get a warning. The second time, your service is cut.

So how necessary is this? If only a percent of their customers are using that much bandwidth, and if the vast majority of users are way under this limit (which they loudly claim repeatedly, in an attempt to allay most people's fears that they might be among those cut), how clogged can their series of tubes really be?

If that's not the real reason, what could it be? They aren't currently offering a way to get a bigger limit, even for more money (although if they were to do so, we could simply lump them in with cell phone providers who keep raising rates for text messaging packages that include fewer messages). If the network is not truly clogged, what could be the motivation?

A telling clue is in their response about "Comcast Digital Voice". This is their Voice-Over-IP telephone service. We subscribe to this because it is an alternative to Qwest, and we believe it is the lesser of two evils. (Actually the service was somewhat different, up until just a few months ago when everything was switched over to VOIP. Now a single cable modem provides our internet and phone lines.) Naturally, if internet usage is going to be capped, people were understandably concerned about their phone service, which is coming over the internet, using up valuable bytes. Their answer? "Comcast Digital Voice is a completely separate service and is not a factor." (source: CNET Q&A with Comcast)

Oh, ho. So, Comcast is able to route its VOIP traffic specially, whether on a slightly different signal or just somehow flagged. So, what about other VOIP services, like Vonage? Well, they are just using standard internet protocols, so naturally, they will be subject to the cap.

What about movies? Comcast has also said that movies & TV, including streaming on demand, will not be affected. Whether this is because it's not using IP or because its traffic is also "specially-marked", I'm not sure, but it's not particularly relevant. The fact is, to stream a Comcast movie with your cable box, you don't have to think about bandwidth restrictions or any crap like that. But if you want to stream videos over the internet using Netflix or even YouTube (let alone bittorrent or other ways of downloading full movies), well, the meter is running, buddy.

This fall, the Xbox 360 will be receiving a dashboard update that will enable streaming-on-demand via a Netflix account. I was very close to convincing myself that it might be time to subscribe to Netflix. Now, that draw is gone. How can I want to stream movies to my 360 when I know that it'll possibly end up threatening to cut off my internet?

250GB may be more than enough for casual use of even third-party videos and VOIP. But it's hard to say for sure. Comcast has no intentions of making a meter available so you can see where you are on the bandwidth use for the month, and that's just the way they like it. Because of the fear of a bandwidth cap, even if it is set high, people are going to fear going to their competition for movies and VOIP.

The way my network is set up, everything runs through one Linux box before hitting the internet. Fortunately, I was able to set up the extremely easy to use program vnstat, which monitors network throughput on the interface of your choice. I intend to monitor my usage for September, trying not to vary my usage from typical habits, to get some indication of how much I'm actually using. Only then will I really know if there is a problem.

I'm sure other people won't be so lucky.

2008-08-26

The Smoke Detector Paradox

There are 24 hours in a day. The number of minutes in the day is equally divided among the 24 hours. However, despite this equal division of time, the battery in any given smoke detector will fail to the point where said detector begins emitting its warning chirp only during the nighttime hours, with a higher probability of occurrence during the "wee hours" between 2am and 4:30am — late enough to be deep asleep, too late to get back to sleep for any refreshing length of time, yet way too early to even consider just getting up for the day.

It happened again this weekend. At 4am Sunday morning, I hear my wife scolding my dog for climbing up on the comfy chair in the bedroom. What got him all riled up?

*chirp*

Oh, the smoke alarm. I get up and find the stepstool while my wife goes to the basement to retrieve a 9V battery. Replace the battery, put the smoke detector back up.

*chirp*

Wrong one. It wasn't the one that was installed with the house, but the one installed with the alarm system. The two are side-by-side, so it was an easy mistake — although if I had been more awake, I would've remembered that the alarm system had in fact been warning me that the fire alarm was reporting a low battery for a couple days. Oops.

Climb back up, take that smoke detector down. But it doesn't take a 9V battery; it takes two camera-style "123" batteries — not the kind you'd have sitting on-hand for an emergency change in the middle of the night.

So, I remove the batteries to at least silence the chirping — which immediately sets off the house alarm. My wife runs downstairs to deactivate the panel before the siren starts. Moments later (fortunately, before we are able to get back to sleep), we get a call from the alarm company to confirm the situation.

It took me 20 minutes to get back to sleep. I was lucky. My wife was up for over an hour.

I've complained about this paradox before, and the response I usually get is unsympathetic. "Well, you're supposed to change the batteries in all your smoke detectors twice a year anyway."

Except that would be overkill. Our smoke detectors don't run on batteries; they're connected to the house wiring, and the battery is used as a backup. As a result, the batteries often last a couple years or more. This one is a different case, as it was installed later and does run on batteries, but not your typical 9V, die-in-half-a-year variety. And at $10 a battery (and this thing takes two of them), you can bet I want to use them as long as they last rather than replace them on a premature schedule.

If I ever make a smoke detector, I will ensure that it obeys the following rules for when the battery is low:

  • Do not begin chirping if it is dark.
  • Wait until there has been light for at least two hours before chirping. (Sun comes up a lot earlier than I do in the summer.)
  • Once chirping has started, do not stop until battery is changed. (Annoying, but I'll concede for safety reasons not allowing someone to just deal with it during the day until they can sleep at night; what if they were out all day?)
  • If there has been no light for 10-12 hours, begin chirping. (In case it's not in range of visible light. Yes, there's a chance this could still go off at night.)

At most, this would delay the warning for half a day, which, considering for how long I've heard these things chirp, isn't that long. A little extra cost for the light sensor. Battery drain shouldn't be too bad, as it only has to sample light every half hour or hour or so, and only when it's about to reach low battery stage, and then only for the first half day at most. (And if, like mine, it's on house wiring anyway, that point's fairly moot.)

Perhaps I should patent this idea...

2008-08-20

Not in MY lane!

Driving the kids to school yesterday, we were in the middle lane of a three-lane road (in our direction), behind what looked like one of those rented moving vans, except it lacked any markings whatsoever. Anyway, that was the approximate size and shape of this vehicle. Traffic was a little heavy, as the right lane was blocked due to some road work (morning rush hour being the ideal time to tear up a piece of road, naturally). Up ahead was an intersection with a double left turn. Since traffic in the left lane splits up into people going straight and two lanes of people turning left, the left lane has a tendency to empty a little more quickly. And, since the right lane was blocked off and people needed to merge, the middle and right lanes were moving much more slowly.

I'm usually one who just stays in his lane, because if I try to switch to a faster lane, invariably I end up reliving the opening scene to Office Space, where as soon as I switch lanes, I come to a complete stop as the lane I just left speeds up. And on the rare occasions when I do seem to gain ground, I notice that a car I passed up manages to catch up to me two lights later anyway. So why stress, right?

In this case, this truck in front of me decided he wanted to merge left. Possibly because that lane was moving faster, possibly just to make room for the people in the right lane to merge. Either way, he waited until the left lane traffic lightened a bit. As soon as there was an opening, he'd turn on his signal.

The instant that signal came on, the people in that left lane would hit the accelerator and close the gap, making sure they got across that two or three car lengths of empty space before that truck dared to get in front of them, and then slam on their brakes to narrowly avoid hitting the stopped car in front — but at least they prevented the unthinkable, someone merging into their lane.

I watched this happen two or three times. Different people each time, because it would actually put them in front of that truck, so the next time it was someone else coming from behind to claim the empty space as theirs.

And what did they gain? Despite being two or three cars ahead, traffic as a whole was still moving rather slowly. Whether you are behind a big truck or not, you're still not moving more than 5mph at best, and it's still three light cycles before you get through the intersection.

2008-08-17

IM Convenience, USPS Prices

My cell phone carrier, T-Mobile, just raised their text messaging rates yet again. Once upon a time, when I first had their service, it was 10¢ per message sent or received, but the first 15 incoming messages were free. An unlimited plan was available for $5/month, but I would've needed to have 50 messages for that to be worth it. At some point, when I wasn't paying attention, they dropped the "first 15 incoming free", which thoroughly annoyed me, but again, I still was way below the threshold where the unlimited package would be worth it. They also raised their rates to 15¢ per message (again, sent or received), but my text volume still fell below the threshold to make any package deal worth it.

One charming feature that T-Mobile provides is the ability to send text messages to any phone by using an email address. Send an email to mobilenumber@sometmobiledomain.com, and presto, they get a text message. Well, of course, spammers eventually caught on to this, and we started getting spam. Since T-Mobile charges per message sent or received, that meant we were paying for spam. Words cannot express how angry this concept makes me. Fortunately, T-Mobile's web site provides a very easy way to turn off the option to receive text messages by email. Once I found it (which of course wasn't exactly straightforward, although I don't know it's fair to say it was "buried", either), the spam stopped.

Just this month, though, T-Mobile raised their rates yet again. Now, it's 20¢ to send or receive every text message. Since they charge on both sides of this equation, that means for every text message one T-Mobile customer sends to another, they rake in 40¢. For an instant message. Nearly the same price as a first-class US Postage stamp (currently 42¢).

Oh, and to make matters worse, their $5 plan is now no longer unlimited. I think it is something on the order of 500 messages, and unlimited plans are $10 or $15 per month.

The part that bugs me the most about this is how they charge to receive messages. If someone calls me, I can see who is calling (or maybe Caller ID is blocked and I can't, but that's not the point), and I can choose to accept the call or not, thereby choosing whether or not I am going to use air time to take the call. But if someone sends me a text message, I have no choice. That text message is automatically delivered and accepted, and I am charged, whether I wanted it or not. It means my cell phone bill can be (and is) charged based on actions completely out of my control.

T-Mobile is not alone in this practice. That doesn't absolve them of the fact that they chose to engage in this rip-off.

I imagine some day it might be convenient to just have a portable internet device. Something that just has a constant internet connection, on which I could run an instant messenger client with voice capabilities. (Perhaps like Skype, which can call phones as well with a purchased plan, but even MSN Messenger can do voice chat, which might suffice.) That way, I could have my data pipe, and I could choose whatever services I wanted at whatever cost I decided best fit my needs. (For instance, just having MSN Messenger would mean someone couldn't call me from a land line; could I live with that?) That way I wouldn't be locked into a cell phone provider who tries to find new ways to make me pay for things, such as charging me for services I can't refuse.

2008-08-06

If you don't like my walking, stay off the crosswalk

Idiot driver of the day.

I was out walking today, as I'm trying to get into the habit so I get at least some exercise during the day. I come to a busy intersection, press the button for the crosswalk, and wait. The cross traffic gets a red light, and the left turn lights for the traffic running parallel to me light. The crosswalk light is of course still red, so I still wait. The left turn lights cycle off, and the straight lights go green, and the crosswalk also turns green. I start walking.

Because I'm on the left side of the intersection, the first half of my walk is in front of stopped cross traffic. I get past the halfway point, and this old white pickup truck has come from behind me to make a left turn. Note that I am still in the crosswalk, whose light had turned green (although started blinking red while I was crossing).

He pulls out and starts to make his turn, fortunately stopping just before he hits me. The guy leans out his window and starts yelling something at me. Since I'm listening to an audiobook, I don't know what he says, but I refuse to so much as acknoledge his presence. He's turning left, he must yield to oncoming traffic and most certainly pedestrians in the crosswalk.

Apparently my failure to beg his forgiveness for my existence made him mad, because then he laid on his horn until I had cleared out of his way. I didn't look at him or even alter my pace, but I was sorely tempted to stop and stand still.

2008-07-20

Guido is coming to break your kneecaps and offer a credit card

Debt collectors are either getting really lazy, or someone is using my address or phone number in a very weak attempt at identity theft — weak, I claim, because although we've been getting random calls from debt collectors for a matching last name (but a first name not even close to anyone in this household), my credit report is still clean.

Anyway, I just got an interesting letter in the mail from a debt collector, another matching last name but a random first name on a debt that of course I never incurred. (Seriously, how hard would it be to look up in a phone book and see if a name and address matched?)

Dear <random first name> <my last name>:

company name has been engaged to pursue collections on your above referenced account.

company name is pleased to provide you with an opportunity to satisfy this debt and allow you to qualify to receive a new Emblem® MasterCard® credit card.

The letter goes on to explain how this phantom member of my family can conveniently have his debt charged to this brand new credit card. The borrower must make payments that equate to 36% of the original debt amount within the first year before the credit card becomes active, at least, and there's no interest on that original debt amount; but apparently, defaulting on a debt is now a criterion for obtaining the means to incurring more debt. Genius.

Is it any wonder this country is in a crisis of sorts with people incurring vast amounts of debt, when companies are all-too-willing to offer newer, shinier shovels with which people can dig their own pits deeper?

2008-07-09

The passing paradox

I could probably fill a whole blog by itself with annoyances in relation to being on the road.

As I was driving across some of the western states with my family, I experienced a phenomenon that one would think would be statistically unlikely, yet somehow happens all too often. I can be on the interstate, cruise control locked at the speed limit in the right-hand lane for dozens of miles without encountering a single other car. And yet, it's just as I start to come up on a truck or RV that I need to pass, that suddenly, another car going slightly faster will be passing me on the left, timing it just right that he's right beside me as I'm right behind the truck.

It's almost as if somehow it was orchestrated, that the vehicles were positioned and timed just so, such that all three of us would converge on this single, seemingly random point on the interstate in the middle of nowhere.

Somewhat related, it seems that no matter how many unoccupied miles I pass through, if there is a "construction area" where one lane is blocked off for a few miles (which is another rant; why do they block off 10 miles of road when they are only working on 50 feet at a time?), I will invariably have to go through it stuck behind someone who feels the need to go 30MPH under the posted speed limit.

And somehow, this improbable convergence seems to occur consistently at the very start of the lane closure.

It's almost like I'm stuck inside a video game, the way these events that I would think statistically unlikely to occur as frequently as they do, happen with almost scripted regularity. Except that I can't drop the pedal down and reach unreasonable speeds, crash and respawn, and outrun cops until an indicator on my heads-up display disappears.

Although that would stand a greater chance of keeping me awake driving through the Nevada desert.

2008-07-01

Fresh or frozen?

I have a corn snake. She's about 12 years old now, something over six feet long. When she was little, I used to feed her on frozen "pinkies", baby mice that had not yet grown fur, pre-frozen for convenience. I tried to keep a small supply in the freezer, so that I wouldn't have to rush out and get some for feeding time, and have to figure out when the stores got their supplies in. I would thaw them by microwaving a cup of water, then taking a frozen pinkie in a plastic bag and submerging it until it thawed. She'd eat them right out of my hand.

When I moved to Colorado (smuggling my tiny serpent on board the airplane in a folded handkerchief, a move that I don't doubt would probably get me arrested post-9/11 — and yes, I suppose one could accurately say there was a bleepy-bleepin' snake on that bleepy-bleepin' plane), I was unable to find a store that carried frozen pinkies. In fact, I had a hard time finding pinkies at all, live or dead. But when I did finally track some down, they were live; and, for the next 11 years, my snake ate live mice. (Except for one time when the mouse died on the way home; but that's still a far cry from frozen.)

Tonight, though, I had a problem. I needed to feed my snake, and the local Petco was not going to get any live mice for a while. But, to my surprise, they did have frozen mice in stock. Individually wrapped and costing a little less than live mice, I was able to bring four home. The clerk suggested I try one, and if she didn't eat it, then I could always bring the remaining three back, still frozen, as everything in the store is guaranteed for 30 days.

I thawed out the first one in a sink of warm water. Using a pair of metal tongs, I picked it up by the tail, opened the feeding tank — and the mouse promptly slid out of the tongs and dropped on the floor. My snake started to climb out of the tank, but I managed to prod her back in. She saw the mouse on the floor, sniffed it, and then proceeded to eat. So dedicated to this task was she, that I was able to push the rest of her body back into the tank and close the lid.

The mouse still felt like it had a cold spot on it, so I heated some water on the stove and dumped that in the sink to thaw the remaining three mice. After some time, when I opened the next mouse package, a wave of warm mouse scent hit me. And I heard a *whump* from the feeding tank. I guess she smelled it, too. The remaining three mice, she ate without a problem. I even dropped the last one, and she found it quickly and started eating.

Part of the reason I was so desperate for mice that I tried frozen, was because she was overdue for her feeding. That may be a contributing factor for her eating anything she could find that smelled like a mouse, alive or dead. But I hope this means she's open to the idea on a regular basis, because it'll be so much more convenient to keep a supply of mice in the freezer for her.

2008-06-16

My M4A2MP3 script

I have a Sandisk Sansa MP3 player that I picked up on Woot.com for a song. It's a refurbished unit that has a couple little quirks, but for the most part, I love it. My primary praise for the thing is how easy it is to transfer files to. It identifies itself as a simple mass storage device, so all I have to do is drag and drop my music files to it. And I'm done. Contrast this with the iPod my mother got for Christmas, who after hours of frustration had to call her sister's son-in-law over for help in installing the iTunes software (which has been known to install other software behind your back; but we won't get into that here). Yes, the Sansa can be used in an alternate mode that does an auto-sync thing with Windows Media Player, but I chose not to go with that more confusing route. The Sansa does have a converter that you must use in order to do video, but when it comes down to it, I just don't find video on a 2" screen worth the hassle anyway.

One thing I do wish it had was a bookmarking function, as I like to listen to audiobooks; and if you lose your place in a 40-hour audio file, trying to find it again is frustrating. But since I've taken to using Goldwave to splitting my audiobooks into 1-hour files before transfer (and since playlists are in a standard, text-based format and very easy to create to "bind" the parts together), it's much less of an issue.

Anyway, the purpose of this post isn't so much to praise the Sansa, but to describe one workaround for a common trend. I've noticed a start of a shift from MP3s to M4As in audio, especially in podcasts. Xbox Live's Major Nelson did it for one episode (although he went back to MP3s afterward), and only the first GeezerGamers.com podcast was available in MP3. The Sansa, unfortunately, does not natively support M4A, just MP3 and WMA. Since I'm not yet ready to install Rockbox on it, I had to find another way.

I did some searching on converting M4A to MP3, and I found a pretty simple script here that does the conversion. It does, however, presuppose install paths for your programs (it launches two command-line utilities, FAAD and LAME, to convert to WAV and MP3, respectively). I decided I wanted to put it in a folder on my Sansa (since it's just a USB storage device, it can hold anything) and make it available no matter how it was assigned when it got plugged into a machine.

I have a folder, called M4A2MP3, that contains faad.exe, lame.exe, lame_enc.dll, and m4a2mp3.bat. The contents of the batch file are as follows:

echo off
REM Simple script to convert m4a to mp3, got it from http://pieter.wigleven.com/it/archives/3
REM With edits by Yakko Warner, http://yakkowarner.blogspot.com/2008/06/my-m4a2mp3-script.html
if /I "%~x1" NEQ ".m4a" (
    echo Warning, file doesn't look like an m4a: %~nx1
    pause
)
cls
echo.
echo Converting %1 to MP3
"%~dp0\faad.exe" -o "%TEMP%\%~nx1.wav" %1
"%~dp0\lame.exe" --preset standard "%TEMP%\%~nx1.wav" "%~dpn1.mp3"
del "%TEMP%\%~nx1.wav"

Being a simple script, it does require you have enough space wherever %TEMP% lives, but it does have several advantages over the original script. It uses %TEMP% as the location of the .wav file, which is typically faster, local storage; it replaces the .m4a extension with .mp3 instead of appending it; it allows the executables and script to travel together in a single folder; and no paths are hard-coded. It also, if you give it a file that doesn't have an .m4a extension, alerts you of this fact and presents you an opportunity to ^C and cancel the script.

To execute, it's as easy as dragging an .m4a file onto the batch file and watching it work. Note that it is possible to install this to your hard drive and add to Explorer's right-click menu for M4A files to run this script. I've set that up once, but considering how infrequently I have to convert M4As in general (usually just once a week), it hasn't quite been worth doing that on a regular basis.