Wednesday, November 14, 2007

Why I won't stay with Virgin Mobile


I signed up with Virgin Mobile because a rarely use my cell phone, and paying $30 per month for my little bit of use was wasteful. I initially bought the SE-47 Slider phone, and with a data cable I added a few simple MIDI ring tones and some wallpapers images. When the antenna broke on my slider, I decided to shop for a replacement. Target has some, and I chose the Super Slice because it has a USB port, and I thought this would allow me to put the couple things on the phone that I want. I might even be able to add my contacts list without entering it on the phone.

However, the UTStarcom Super Slice phone for Virgin Mobile has a USB port that is deliberately disabled, and I found this out only after I bought it. I never thought a manufacturer would be so inconsiderate as to deliberately disable the USB port, but I guess Virgin Mobile wants me to pay $2.49 for their ring tones, all of which are unappealing (kids these days!), so they feel they just cannot let me do what I want to do with my own phone since I would then not be paying them for ridiculous stuff like ring tones and fake calls from celebrities to impress my friends (really!). The device will appear momentarily on the USB bus before it is immediately disconnected. I can watch this happen in /var/log/syslog


Nov 12 20:04:40 localhost kernel: [17444684.280000] usb 2-2: new full speed USB device using uhci_hcd and address 6
Nov 12 20:04:41 localhost kernel: [17444684.472000] cdc_acm 2-2:1.0: ttyACM0: USB ACM device
Nov 12 20:04:41 localhost kernel: [17444684.472000] usbcore: registered new driver cdc_acm
Nov 12 20:04:41 localhost kernel: [17444684.472000] drivers/usb/class/cdc-acm.c: v0.23:USB Abstract Control Model driver for USB modems and ISDN adapters
Nov 12 20:04:43 localhost kernel: [17444686.560000] usb 2-2: USB disconnect, address 6


and in /proc/bus/usb/devices (only momentarily)


T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0d08 ProdID=0300 Rev= 0.00
S: Manufacturer=UTStarcom, Incorporated
S: Product=UTStarcom CDM1450
C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=84(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms


Searching for help on the Internet only confirms what I have experienced. The phone is deliberately disabled for some reason. Now I'm stuck with a phone that I don't really want because it is more trouble than I want to deal with by reentering all of my contacts, and it has no redeeming features because of its disability. Target will not take back a phone that has been activated. Virgin mobile will not take back a phone purchased from Target unless the phone is defective and is being replaced with the same model.

I suppose I will deal with the phone just long enough for me to validate that T-Mobile is what I want to use. GSM phones and SIM cards mean that I won't have to be locked into a single phone. My advice to you is not to buy the UTStarcom Super Slice for Virgin Mobile because it will just be an semi-expensive annoyance.

Thursday, November 01, 2007

On Daddy's Watch

My child is sleeping now, but the evening was long. On the way home a clichéd advertisement sprang to mind. One dime swallowed by a two-year-old: ten cents. Visit to an ER for X-ray: $250. Sleeping, safe child, well, we all know the cliché. I was planning to post about something else tonight, but life intervenes.

I learned tonight that the clinic near my house closes at 8:00 P.M, and I was thirty minutes too late. I learned that you can't get stitches on a wound if it has been more than eight hours since the injury due to an increased risk of infection. I learned, too late, that Urgent Care Plus, which is also nearby, closes at 9:00 P.M. We learned that lots of kids swallow objects, but even sharp objects are not as dangerous as disc and button batteries. I learned that the doctor in the ER wears exactly the same model of Seiko Kinetic watch I wear, and I learned that people can fracture their wrists in interesting and "unusual" ways trying to play follow-the-leader on their motorcycles.

update: The dime's out.

Thursday, August 09, 2007

Update on Diet Foods

Time has published a new article, "Do Diet Foods Lead to Weight Gain?", on an experiment using rats who are fed diet foods that is related to a previous story I linked about diet sodas being linked to obesity. When rats ate diet foods and non-diet foods that tasted the same, this tricked their bodies into not being able to eat the right amount of food to get the calories they needed.

Monday, July 02, 2007

Weblog feeds

Sometimes I notice a missing negative in a weblog post after I publish. What is worse is when Googlebot grabs the initial, incorrect version that doesn't present what I mean to write. Reader beware, or at least check the website if you think I've written some nonsense.

What I think science is not

I read this article, which is about an interesting model of the universe before and after the Big Bang, or Big Bounce as is the case in the model, and then I read the comments. The comment below struck me as being from someone who does not understand the philosophy of science and who thinks "the scientific community" is supposed to come up with dogma that everyone is supposed to accept. I think it's an easy notion to hold only as long as one does not have a grasp that science should make theories based the evidence, and science is not about making determinations about the physical world from a lack of evidence. It reflects the same desire for certitude whose ridiculousness is exhibited in the "Creationism Museum" to the extent that one is willing even to contradict physical evidence to satisfy this desire: (image from ArsTechnica.com)

staring points (I assume the Creationism Museum promoters prefer the simple arrow rather than the exaggerated, meandering path of empirical knowledge about the physical world which they apparently confound with human reason only on the "evolution" side and not with any regard to their understanding of "God's word". Whether by malice or ignorance, I think it is a mistake.)

This is the comment:

The scientific community is going to have to make up its mind about 'the big bang' theory and black holes. It will have to determine which really exists: big bang, or black holes. As I see it, the two are mutually exclusive and cannot exist in the same universe. If, as postulated, a black hole's gravitational pull is so strong that nothing can escape it, not even light, then the big bang could not possibly have existed, as nothing would have been strong enough to escape it. If the big bang is true, then black holes cannot exist as currently postulated. So, science must make up its mind which one of these theories is valid and which must be discarded as being illogical.

While the universe may be one way or the other, it is not required that the scientific community declare it to be one way or the other at this point by "making up its mind" from a lack of conclusive evidence on the subject.

When people hold such notions that science is supposed to provide these absolutes so that their own world-views are neatly packaged and free from uncertainty, it's easy to see why people rebel against what they mistakenly view as a failure of science when they are simply expecting science to be something it is not. There is clearly something, such as a certainty on which to anchor a worldview, many people are looking for, and directing them to science for that is a solution only as stable as the evidence that science uses, and that evidence is likely to change. Science has no problem with these changes, and science leaves gaps where the evidence is not conclusive, but an attempt to force the universe to obey one's myopic view of how the universe is and was and will be is highly quixotic, especially when playing with a God of the Gaps whose gaps are being filled.

Friday, June 08, 2007

Diet Soft Drinks Linked to Obesity

As reported from a study at the University of Texas Health Science Center in San Antonio, diet sodas are worse than regular sodas. I'm assuming so far that the "regular" sodas are sweetened with high fructose corn syrup, which has it's own metabolic issues, rather than sucrose cane sugar.

In fact, when the researchers took a closer look at their data, they found that nearly all the obesity risk from soft drinks came from diet sodas.

"There was a 41% increase in risk of being overweight for every can or bottle of diet soft drink a person consumes each day," Fowler says.

Antibacterial Products Can Help Breed Superdiseases

According to this Scientific American article, triclosan and chemicals like it help select for resistant bacteria because they have specific targets in bacteria that are shared by some antibiotics, and antibacterial products leave behind a weaker residue that contributes even more to resistance selection because it is not as effective at killing. Products like alcohol and bleach, on the other hand, evaporate leaving less residue, and they do nonspecific damage to the bacteria, so the risk of bacteria developing cross-resistance with antibiotics from traditional cleaners is less.

We are harming ourselves and our children by continued, widespread use of antibacterial products by breeding more resistant forms of bacterial diseases and by the contamination of our crops, streams, food, and water with these products. If this is true, none it should really be surprising despite the SciAm article's title. It makes sense, and the concern has existed for several years.

Saturday, May 26, 2007

Bees

Today a swarm of bees came to visit over the front door of our house. Go away, bees!



Texas Giant Centipede

Scolopendra heros

Texas giant centipede is the common name for it, and it is pretty big. We saw this one in the parking garage at work as we were returning from lunch yesterday. It was moving quickly, so my camera work is not so great.
giant centipede from the top

giant centipede

giant centipede

giant centipede

giant centipede

giant centipede

There is some interesting info from the Dallas Zoo about the sting from being bitten. It's not very dangerous to humans.

Thursday, May 17, 2007

Lament

Here's another interesting quote that seems to relate to the pictured prayer card in "Loss"


Richard Rohr writes

Walter Brueggemann, my favorite Scripture teacher, points out that about one third of the Psalms are psalms of “lament”, but they have been the least used by Catholic and Protestant liturgies. We think, perhaps, they express sinful anger or negativity, when grief and loss are actually something quite different. We think they make us appear weak, helpless, and vulnerable, and most of us don’t want to go there. We think, perhaps, they show a lack of faith, whereas they are probably the summit of faith. So we quickly resort to praise and thanksgiving, even when it is often dishonest emotion. We forget that Jesus called weeping a “blessed” state (Matthew 5:5). We forget that only one book of the Bible is named after an emotion: Jeremiah’s book of “Lamentation”.

Tuesday, May 08, 2007

The Difference Between Premature Optimization and Negligent Design

Computer programmers have all heard the the Donald Knuth quote (ed. paraphrasing something by C.A.R. Hoare) that "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." But just what constitutes "premature optimization" can be a subjective matter. Some coworkers and I were talking about this, and I think we mostly agreed on that point. First, what is "premature"? If I have implemented a similar solution ten times, and experience tells me that the current situation is the same as those, then I may choose to use the optimized implementation that I have used before. If I am a conscientious developer, this will not involve a cut-and-paste of the solution, but a call to an appropriate abstraction for this special case.

Secondly, what is "optimization"? When designing code, good developers will use data structures and other abstractions that semantically fit the problem. This is not optimization; it is simply appropriate design. The opposite of good design is negligence. A good characterization of "optimization" comes from Wikipedia (premature) optimization is "a situation where a programmer lets performance considerations affect the design of a piece of code." The design of the code can be quite low level in the above case.

Here is a simple example of one clarification of the difference between premature optimization and good design. Let us assume that we wish to make a collection of unique objects, such as names of subscribers on ten mailing lists. Some people may be subscribed to more than one of the lists, but we wish to have just once instance of the person in the collection. The code in Java might look like this:
Set extractSubscribers(Collection mailingLists)
{
Set subscriberNames = new HashSet();

for (MailingList mailingList : mailingLists) {
for (Subscriber subscriber : mailingList.getSubscribers()) {
subscriberNames.add(subscriber.getName());
}
}
return subscriberNames;
}
The HashSet is a Set, which means that it enforces that each of the names it holds is unique. That is what we wanted, so the design of the code has clear semantics that match the functional requirement. I could have used a TreeSet in most situations, but that adds a requirement of total ordering on the data items, which I have, but that is not important right now. HashSet is nice because its lookup and insertion complexity is O(1), but that is also not too important right now.

Now let us look at a less desirable approach. Today I came across this quote from a computer programmer.
For most of my programming, I just use ArrayList or Vector and call Contains before inserting. It's lazy, but I've never had to deal with a big enough list to make it worth my time.
I would imagine his code looks something like this:
Collection extractSubscribers(Collection mailingLists)
{
Collection subscriberNames = new ArrayList();

for (MailingList mailingList : mailingLists) {
for (Subscriber subscriber : mailingList.getSubscribers()) {
if (!subscriberNames.contains(subscriber.getName())) {
subscriberNames.add(subscriber.getName());
}
}
}
return subscriberNames;
}
There is only one extra line of code in this case, but that is due to the fact that the ArrayList datatype holding our unique subscriber names does not have the semantics we want. It also means that we would have to write even more code to get the method signature to reflect the semantics of the requirements. If we wanted the return type to be Set, we would have to put all of the subscriber names in a set anyway, but I shall stipulate that literate programming is not important to the person making the quote above. However, it would make putting everything in an ArrayList first look pretty strange.

The code in the second example loses some semantic meaning because the return type does not indicate that the names in the collection are unique, but it also is considerably slower than the code using a HashSet. Because the time complexity of the first example is O(n), and that of the second example is O(n^2), finding the unique set of subscriber names in the second example will be roughly 1000 times slower than for the first example when there are 1000 subscribers.

This complexity issue may not seem important in the age of GigaHertz computing, but a coworker of mine found that the implementers of Apache Ant, a build system for Java, did not seem to appreciate this. The software I develop at my job results in about 15,000 Java class files, and those all have to be copied by an ant "copy" task in the build target directory. Ant 1.6 and ant 1.7 both build a list of unique file names to copy using a Vector (like an ArrayList) collection. In our build, this results in about 30 seconds to one minute of 100% CPU utilization on a 2GHz Core Duo! That is 25% to 40% of the total build time!

Fortunately, Ant is an open source project, so changing the code to use a Set rather than a Vector is almost trivial, and we have done so for our own use. It makes the builds 25% in most cases. All of that CPU time is wasted because the code was written using a datatype that was not appropriate and was also not semantically correct. Optimization could now be done if we decided that the semantically correct code had performance issues. In our example, the HashSet does have more overhead than the ArrayList or Vector, but that overhead is nearly constant for each name, so the performance does not degrade horribly when the number of names increases. However, for small data sets the overhead per name, which is negligible in our example, could be measurably significant compared to the cost of adding each name to the collection. The HashSet has to get the hash code for each name and do some comparisons that take more time than simply setting the next element of an array, but for a good implementation of HashSet, this overhead is not meaningful, and when the number of names is small, the whole process runs quickly anyway. It is only large numbers of names that cause problems, and they cause much worse problems when the wrong design is chosen. Avoiding the overhead of HashSet is one of the "small efficiencies" that is meant by Knuth.

Start with a correct design, and then optimize as needed, but do not mistake correct design for premature optimization.

Wednesday, April 11, 2007

Loss



My father passed away last month. I wrote some thoughts down to remind myself how I was feeling:
2007-03-23

I feel that my father's death on March 18, 2007 has cheated him, me, my mother, my siblings, my child, and my siblings' children of a man who absolutely adored his grandchildren. I did not know where my relationship with my father stood when I told him he was going to be a grandparent, and I wanted my daughter to have him as a loving grandpa. Even though he had made several invitations to my wife and me that we had often accepted, I was completely unprepared for the avalanche of support he immediately sent to me when I told him we were having a child. He was smoking several turkeys for Thanksgiving to give to the many people with whom he shared his generosity, and he announced on the phone to me that he was going to send me a turkey that day! The delicious turkey arrived by express mail in a styrofoam cooler.

When my daughter was born by an unplanned caesarean section delivery, he left Wichita Falls for Austin immediately to see his first grandchild and also Amanda and me.

I do still feel that life's events have cheated us, but I believe that God works through those who surrender their will to God's to love one another as my larger family has done abundantly since my father's death. The edges around this sudden hole in my life are made softer by the love I have been able to give and receive over the last five days since his death. Our faith tells us to comfort one another and know that we are safe in our love and God's love despite the uncertainty of life to which we are acutely aware. Knowing how much love constantly is here for us overrides the uncertainties that are simply a matter of fact.

I had been trying to express my feelings of being cheated, not by God, but by the event of my father's death when I looked up and saw a card that had been taped to his desk clearly for some time. On it was a beautiful summation of what I was feeling: "Trials are not enemies of faith but are opportunities to prove God's faithfulness."

There is still so much for me to be thankful for and sad about. I feel as if my dad's life was taken from all of us too soon. We had recently reconciled after a decade of some estrangement, and I was so happy for the role he took upon himself to reconcile us, and I feel like someone showed me a beautiful thing only yank it from my grasp as soon as I held it. I am thankful for our reconciliation, but sad and angry that simple things such as finishing my deck he helped me build will now have to be done without him, and I'm still immeasurably thankful that he did get to come help me build the deck.
My dad's oldest brother found and bought several copies of the inspirational card pictured and gave one to me on Easter that I now keep in my wallet.

Starcraft and NAT

Getting Starcraft to work for two people behind NAT

Update: Please see Jonathan's comment for v 1.16.1 for an updated set of instructions.

Ed. The symptom that this solves is that when two people are behind the same NAT gateway, they experience lots of lag in the game, and may see high latency in the Battle.net game setup. We work around this by remapping port 6112 at the NAT gateway.

This information is from Jan 18, 2007. (original)

My friend Jason and I have been figuring out how to allow two people behind a single NAT gateway router to play Starcraft through Battle.net. Limited information is found through Google on this topic, and Blizzard offers no help. We each have Linksys WRT54G routers with alternate firmware that supports running iptables. (DD-WRT and HyperWRT Thibor + tofu)

Having two people behind a single NAT gateway router connect to the same Battle.net game typically results in the appearance of lots of lag as the two clients do not communicate with each other. To get around this, the following iptables rules can be inserted on the NAT gateway or router.

In this example 70.100.200.24 is the public IP address for the two people behind the NAT router. 192.168.1.2 is the IP address of one client machine, and 192.168.1.3 is the IP address of the other client machine. On the router, type these commands as root:

(NOTE: Try using 6113 and 6114 instead of 63002 and 63003, respectively. The original rules are not working as of Starcraft version 1.16.1. I suspect that the clients outside the NAT no longer listen or respond to UDP messages on "invalid" ports such as 63002 or 63003. I hope Blizzard did not restrict all traffic to port 6112.)

iptables -t nat -I PREROUTING -p udp -d 70.100.200.24 --dport 63002 -j DNAT --to-destination 192.168.1.2:6112
iptables -t nat -I POSTROUTING -p udp -s 192.168.1.2 --sport 6112 -j SNAT --to-source 70.100.200.24:63002
iptables -t nat -I PREROUTING -p udp -d 70.100.200.24 --dport 63003 -j DNAT --to-destination 192.168.1.3:6112
iptables -t nat -I POSTROUTING -p udp -s 192.168.1.3 --sport 6112 -j SNAT --to-source 70.100.200.24:63003

The PREROUTING chain entries cause the packets to be sent to the Internet with port 63002 or 63003 rather than the standard port 6112 for Starcraft.

The POSTROUTING chain entries cause the packets to be sent on the LAN. It's important to make sure these are the first rules in their chains. I've seen other instructions that use "-A" rather than "-I" to add the rules, and this does not work for me since there are already some global rules in the chains that will handle the packets. For example, the POSTROUTING chain has a MASQUERADE target for all packets. That causes the local packets to be sent to their destinations with a LAN source address, which will be dropped by the Starcraft client because it is expecting the source address on game packets to be the public IP address.

These iptables rules will not allow one of the local machines to host the game. When we've tried that, some clients were unable to connect, so this is an issue still under some investigation. When we have time, we'll look at the Wireshark captures.

Sunday, February 18, 2007

A Notable Quote

Even in human life we have seen the passion to dominate, almost to digest, one's fellow; to make his whole intellectual and emotional life merely an extension of one's own---to hate one's hatreds and resent one's grievances and indulge one's egoism through him as well as through oneself. His own little store of passion must of course be suppressed to make room for ours. If he resists this suppression, he is being very selfish.

On Earth this desire is often called "love." In Hell I feign that they recognise it as hunger.
- C.S. Lewis from the 1960 preface to The Screwtape Letters

It really is too bad that we use just one word for love compared to the three that the Greek used. The above perverse possible definition of love contrasts with that in Paul's first letter to the Corinthians.

Thursday, January 18, 2007

I want a new language

C was great. Then C++ was great. Then Java was great. (Along the way Lisp was neat, too.) Imperative programming, however, just isn't cutting it anymore. I need to make myself do some functional programming, the wave of the future I'm told. New wave or not, functional programming is interesting, and functional features are finding their ways into Java and C#. I propose that I should do something simple in Erlang, Haskell, SML or OCaml, Scheme, and maybe Ruby or Python. My friend René said he always wrote a Mandelbrot set generator on a new platform to get the feel of programming on it, so I'll do that.

Dumb Tag Clouds

The current version of Blogger allows labeling of posts with category tags, but to get a list of the tags on the Blogger-generated pages requires using the layouts template, which requires hosting one's weblog on Blogger's servers, which I do not do. I can live with that, and I might change my own template to include an up-to-date list of links to the label pages, which Blogger does generate. One might think linking to these would be easy, and it is, so there must be some private reason Blogger does not do it.

Perhaps one reason it is not supported is that Blogger would feel obligated to support dumb "tag clouds", (but even this feature does not require more than static HTML.) Tag clouds are cute page content areas that show some or all of the tags applied to weblog entries, but the size of the tag in the cloud represents its popularity. They're cute. They're silly. They're not particularly useful.

They do give an idea at a glance of the more popular tags, but that's the limit of their usefulness. Unpopular tags are invisible or illegible, making their presence useless, and also limiting the readers ability to see what they are or read about them. The space wasted by the popular tags could also be used to present something useful, such as a list of all of the tags, or maybe even the top twenty tags, and that list could be ranked, either ordered by rank or visually marked according to popularity, since that's all a tag cloud provides. For example, the redder a tag would be, the more popular it would be while less popular tags would be shades of blue. Just about anything would be more useful and informative that cute, silly, and dumb tag clouds.

Monday, January 01, 2007

The Season of Christmas

It's over. The War on Christmas has been won, and all we really had to do was wait it out. With the victory in hand, we're safe to discard our prized Christmas trees and wrapping paper. It's hard to see what the hubbub was about now that I've finished the eggnog and most of the ham. It seems now the War on Christmas could never have been lost. But how many people are still celebrating Christmas? In the Christian calendar, it's importance is second only to Easter. It's been said that it's "too big for just one day", so it seems right to continue to enjoy the celebration even into the new year. Traditionally, we're still in the Christmas season until the Epiphany on January 6th, so those enjoying Christmas should feel no need to undeck the halls just yet. Relax a little. Enjoy the spoils. The tree can come down next weekend. You don't have to be really big on church liturgy like an Anglican, Roman Catholic, or Orthodox Christian to enjoy the whole Christmas season, either. My Southern Baptist preacher neighbor seems to keep his decorations up, too.

I want to make a point to slow down. I like to relax and take some slient time to reflect during this time, and I do, but not enough. Leaving the decorations up lets me enjoy this time that's not the hectic preparation or celebration of Christmas.

A priest was telling me that he kind of liked the old penitential observation of the four weeks of Advent before christmas. It's not that he just likes the purple of Lent over the new Advent blue (even though he has a cherished purple stole he could wear), but that he liked the introspection and penitential focus more than what we do now. I couldn't help thinking that maybe twenty years ago, the Christmas marketing barrage was less intense than now, but that's just as likely false. I enjoyed the marketing aspect a lot then.