11 Oct 2007
•
Miscellaneous
It is autumn in Colorado. Actually, it has been for a while but the maple tree outside my bedroom window has really put on it’s fall color in the last couple of days. Somehow that makes it feel more real.
This has to be my favorite time of year.
24 Sep 2007
•
Software Development
I find myself ingesting more and more information in the form of audio and video. This is rather unfortunate since neither well suited for this purpose. The primary purpose of audio recordings are to fill the long silences that otherwise occur while moving from one point to another in a vehicle. The primary purpose of video recordings is to fill the time between when the kids go to bed and when I go to bed with something that does not require much thought. Notice how neither purpose is related to conveying information.
I suppose there probably are some type of information which are best pervade using audio or video (music springs to mind). However, the information density in the average podcast/screencast/videoblog/ videotaped presentation is shockingly low.
For example, I just spend 35 minutes listening to quite interesting podcast of Jon Udell interviewing Beth Kanter. I learned a couple of things and it spurred some interesting ideas. However, neither of them talk very fast, and I kept wondering if I could both meaningfully surf the web and listen. I could not. Which means that they just made me spend 35 minutes to gain what would have been about 10-15 minutes worth of information if only it had be presented in a less voluminous medium. This kind of waste should be embarrassing.
I don’t think there is any way around the fact that I will continue to ingest more video and audio recordings. People seems to have an ever increasing preference for producing information in those mediums. My only hope is prostrate myself at the feet of the god of all web multimedia and plead for the ability to play flash content at speeds faster than normal. If it did pitch correction like the Amazing Slow Downer that would be cool but I would rather have people sound like chipmunks rather than miss all that information completely because I just cannot stand that most people talk so slowly.
21 Sep 2007
•
Miscellaneous
I just finished watching a talk by the new president of the ABA1. It covers a lot of good material. I am particularly interested in the World Justice Project.
I have recently been realizing how deeply important the rule of law is. I have reached the conclusion that both liberty and prosperity rely almost exclusively on the rule of law. This seems somewhat obvious to me now. However, the justice system in the United States is most often discussed in the context of lawyer jokes and complains about “activist judges”. I think it is quite possible that we in the US have mistaken the cause of our success. Rather than democracy being our key asset I think it may, in fact, be the importance we have, traditionally, placed on the rule of law.
I think some of the bad sentiment regarding the US justice system is a result of propaganda intend to weaken the rule of law. Not some grand conspiracy, mind you, just a lot of people who don’t mind the idea getting the best justice money can buy because they can afford it. Unfortunately, the law community has not really helped much. The fact that the middle and working classes are largely excluded from the justice system leads to a lack of respect. That lack of respect is easily exploited for propaganda purposes. What a nasty cycle.
Here’s hoping we can improve rule of law in our country so that it really does provide justice for all, and not just for those who can afford it. It is a worthy, though quite daunting, goal. Certainly, any improvements the ABA is able to foster will greatly appreciated.
18 Sep 2007
•
Software Development
My team ran into this problem yesterday where the a particular, very important, request was failing in one of our Rails apps. The failure did did not make much sense and even more confusingly, the same code worked perfectly in the console. As part of debugging the problem we restarted the mongrel cluster, and suddenly everything worked again.
I hate it when the symptoms go away before you have a chance to diagnose the root cause of a problem. It still out there waiting to bite you again, and you have no idea what actually causes the problem. Well after quite a while looking at the code I noticed a bit of code similar to this.
class Widget < ActiveRecord::Base
attr_accessor_with_default :merge_queue, []
def merge(thing)
merge_queue << thing
end
def do_pending_merges
# shift each thing off merge_queue and merge it into self
end
end
Looks innocent enough. However the attr_accessor_with_default
is the problem. You can normally think of attr_accessor_with_default
as short hand for something like
However this is not strictly speaking true. As written above the default value for all instances of Widget#merge_queue
are the exact same Array object. So rather merge_queue
behaving as a private instance variable it acts like more like a shared class variable. This means that anytime you add something to merge_queue
one instance of a Widget you are adding it to the default value of merge_queue
for all current and future instances of Widget.
This turned out to be our problem. Restarting the mongrel cluster made the symptoms go away because merge_queue
’s default value was no longer erroneously pre-populated, and the code worked in the console for the same reason. We had never noticed the issue because when #do_pending_merges
worked correctly it emptied merge_queue
as it went. However, when more than one merges happened simultaneously or, as in our case, the merging failed, the shared merge_queue
default value contained some erroneous items.
This attribute accessor like should have been written like
attr_accessor_with_default(:merge_queue){[]}
In this form, the block is evaluated each time a default value is needed meaning that each instance of Widget would have gotten its very own brand new empty array.
So the moral is, be very, very suspicious if see an attr_accessor_with_default
with a default value that is a collection. It is possible that it may be correct, but it is not very likely. More likely is that the original author did not realize that the exact same instance would be used as the default value each time the attribute accessors were called.
11 Sep 2007
•
Personal
On Saturday, after riding around with the other kids on our block for a bit, Elliot rode up to the porch and asked me, “make my bike into a two wheeler, please”. I happily obliged and since then he has spent every minute we will let him on his bicycle.
This is the second time the training wheels have been off his bike. The last time Catherine and I initiated it and Elliot was riding unassisted within minutes. However, the next day he did not want to ride his bike. After a couple of days we managed to get him to tell us why he was not riding his bike. “Because I am scared of falling down”, he said. So we put the training wheels back on and he was back riding his bike as happily as ever.
Now, apparently, he has not such fear. He has become a very capable bike rider in just a few hours.