Me (to the office in general): "You know, I think NSString might just be my favorite string abstraction of all programming languages."
Dr. Asplund (who for a chemist is pretty darn computer-savvy and spends a few minutes every now and then talking shop with us): "I don't know what's sadder, that you said that or that I know what you were talking about."
Tuesday, May 20, 2008
Famous one-liners (or at least one of them)
To boldly go where no Dell repairman has gone before...
Last Friday, one of our friends brought her old Dell laptop in and asked if we could fix it, because it wouldn't close. So we looked at it, and the tab holding the screen to the hinge had popped free of the little pop-rivets holding it, and the hinge wasn't turning when the screen moved. And the hinge was _very_ stiff.
So I drilled out the pop-rivets, stuck the tab in place with a whole mess of epoxy and let it dry overnight. Then I re-drilled the holes where the pop-rivets and screws were. A little spray of food-grade silicone loosened the seized hinge a little bit, and 4 machine screws with nuts re-attached the newly re-tabbed screen to the hinge. I cut off the excess length of the screws, but the cover wouldn't go over them, so we lopped off the corner of the cover. She said she only wants the computer to last through her first semester of grad school. So no worries. But I kinda like the whole "industrial" look...
Friday, May 16, 2008
The invisible hand. Seriously.
The straw has finally broken the camel's back. I have seen the one forwarded email about gas prices that is just one too many. (Really Mom, I'm not picking on you, just whoever started that silly forward you sent me, and the gazillions of others I've seen in the last year).
It's called supply and demand, people. The reason gas costs $3.50 per gallon is not because of a government conspiracy. It's not because the Middle-Eastern oil countries are gouging us to pay for expensive, man-made, middle-of-the-desert indoor ski resorts. It's not because the oil companies are price gouging. It's plain and simple, supply and demand. Gas is $3.50 per gallon because you, me and every other one of the ever-increasing car-driving, foreign-made-good-buying population of this world will pay it. That is all.
Yeah, I know people freaked out when gas first went above $.40. I was a little upset when gas first went above a dollar. But guess what? The number of oil-consuming people in the world has more than tripled since then. Oil is not an unlimited resource folks. Economics is the science concerning the production, distribution and consumption of goods and services. Economics deals with the idea of scarcity and resources. That's all. It's not magic, and it's not a conspiracy.
Lets talk about this for a minute. If I have a good or resource and I want to get rid of it, I have a few options. I can give it away for free, in which case I now have nothing. I can keep it forever, in which case I still have it. Or I can trade it for something else, in which case I now have something else that I wanted more than what I originally had. Very simple still. Giving it away and keeping it are uninteresting problems, so lets talk about trading it. First, we'll talk about opportunity cost. Opportunity cost is the cost of the next best alternative. Only. If I buy a pink sugar cookie instead of a Krispy Kreme doughnut, or a Milky-Way bar, or an apple, the cost associated with the pink sugar cookie is not giving up all three alternatives, only the alternative that I would have chosen otherwise. Anything other than the best alternative is nothing. So, going back to my problem, in which I have a resource and I think I want to trade it for something else, the main question involved is not, "How much can I get for this?" but, given that the opportunity cost is now either keeping it or trading it, "For what am I willing to part with this?".
Very subtle difference, but key to our issue of complaining about gas prices. If there is one person in the world that has something I'm willing to trade for my resource, my asking price is limited by him asking himself the same question. If I want what he has enough to no longer have my resource, and he feels the same, we can trade. If not, one or the other of us will have to sweeten the deal a little. However, if there are 2 billion people who all want what I have, now the idea of opportunity cost is very important. If I have a pink sugar cookie (something I obviously place more than $.75 value on) and someone comes to me with a Snickers bar that cost them $.75, they will have to keep looking, since I value a Snickers bar at about $.10. If I have that same cookie, and someone comes to me with a dozen hot, fresh Krispy Kremes, I will be the glad, (temporary) owner of a very happy, very satisfied full stomach, and I will hope they enjoy their new cookie. The opportunity cost of trading with the guy with the KKs is the cost of keeping my cookie, which up to this point was the "best" alternative. It was NOT the cost of a Snickers bar, since I don't want the Snickers bar. However, if the next guy in line is willing (for whatever reason) to trade me a Ducati for my pink sugar cookie, the opportunity cost of owning those KKs becomes _much_ higher.
So lets talk about gas. Just like my single pink sugar cookie, gas is a scarce resource. Once the oil field is dry, that's it. So now, I have a limited amount of gas, and 500 million people are willing to pay me $1 per gallon for it. If I charge more, I will sell less and my opportunity cost is obvious. I have surplus gas, and less money. Now, 15 years later, I still have gas (perhaps not as much as before) and 2 billion people are willing to pay me $3 per gallon for it. My opportunity cost for selling at more or less than where my willingness to supply meets their willingness to buy is high on both sides. If I sell for less, I run out because more people will buy more gas. If I sell for more, I don't sell as much and my profits go down. Yet again, plain and simple. On the other side of the transaction I, as one of those 2 billion people who want gas, have to make an opportunity cost-based choice. The cost of buying that gas is very simple: $3 per gallon. The cost of not buying the gas is also fairly simple: I have to walk to school (for reasons other than exercise) or the grocery store. Or I don't get to go to Newport this fall. A trip to Disneyland and beautiful Newport and Laguna beach is a high opportunity cost indeed compared to $3 per gallon for gas. But that's what it boils down to: I want the trip and the memories, or the convenience of taking a car to the grocery store, more than I want the money. So I pay $3 per gallon for gas.
Economics is no mystery. If I am willing to pay for an item, then I get what I paid for. If I am not willing to pay, I keep my money and go without that item. Sure, the money we pay for gas buys man-made ski resorts in the middle of the Arabian desert. But that's only because we want the gas more than we want our money, and they want our money more than they want their gas. Even with the inefficiencies inherent in the concept of the internal combustion engine it would be possible to build vehicles that are much more efficient than the ones you generally see on the road today. But they would be much more expensive than what we currently drive (tolerances would need to be tighter, etc) and we want our money more than we want a car that costs 5x as much, but gets double the mileage and the auto manufacturers want to sell 50 cars at $25000 more than they want to sell 2 cars at $100000.
So please people, stop the madness. The reason gas is $3.50 per gallon is not because somebody is taking advantage of us, or because the auto industry lobbies to prevent research on alternative fuels/technologies, or because the President was unable to "lower fuel costs" (how he would do that himself is a mystery indeed). It is because that TV that came from Japan or Korea cost a lot of money to ship, and we want the TV more than we want our money. It is because we want to travel and see the world more than we want our money. It is because many millions more people would also like to travel, or spend money on goods that we produce. In short, gas is $3.50 per gallon because we are willing to pay $3.50 per gallon for it. So next time you think about forwarding an email blaming the Arabs, or the oil companies, or the president, or the little purple men from Mars for high gas prices, do the world a favor and just delete it.
And now I will step down from the pulpit and get back to my multi-threaded webserver...
Tuesday, May 13, 2008
Sunday, May 11, 2008
Picasso was a wise, wise man.
Isaac Newton once said, "If I have seen further, it is by standing on the shoulders of giants." My dad once sat my brother and I down and said, "Boys, you want to know the secret to being successful in life? Win if you can; lose if you must; but no matter what happens, always cheat."
Pablo Picasso once said, "Bad artists copy, great artists steal."
Now before you all go crazy, let me explain what my dad meant. (If you want to question Picasso's quote, you can take it up with him someday) Dad was not talking about dishonest cheating. He simply meant to do what it takes, and don't be afraid to use "unorthodox" methods, and I think that unbenknownst to him, my dad really hit on the secret mentioned by Newton and Picasso.
Let me elaborate. Who, in the entire history of the world, has created something useful without some idea that there was something useful to be created? Newton's work in physics and math was the result of a lifetime of studying Pythagorus, Archimedes, and hosts of others who had gone before him. Picasso undoubtedly had his fair share of favorite pieces of others before him. Tolkien and Lewis had centuries of myths, legends and old wives tales that they had studied and read. Ken Thompson, Dennis Ritchie, and the rest of the good folks at AT&T had previous operating systems before them when they wrote Unix. Even "the Steves" (Jobs and Wozniak) had predecessors when the Apple and Apple II were born.
So where is the line between the good artist and the bad one? What is the difference between copying and stealing? I think that line is drawn by our own individual effort. Recently I posted about some idiot in Argentina who copied my friend's blog. There was no effort involved there, a few wget commands, some bad English-to-Spanish translation, and poof!! "check out my cool website everybody". I'll use Nicole as an opposite example. Nicole loves art. And photography. A lot. Nicole is an excellent photographer. She didn't become so by following some pro around and pointing her camera at the same things he did. She became an excellent photographer by, "learning how things will look as a picture, before I take the picture."
I'm currently taking a network programming class. Many of the concepts are pretty much foreign to me, and I've been spending _a lot_ of time on Wikipedia, Google, and in various reference documentation websites. I've "borrowed" lots of code snippets from various locations. I've long since learned the difference between copying and stealing when it comes to code. If you copy code and your program ever breaks, it will be in one of two places: on the border between your code and the code you copied, or in the code you copied. Both of these bugs result in copying code that you don't understand into your program. So I spend lots of time tinkering, modifying the code that I'm "stealing" in various ways to find out how it works, why it does what it does under certain conditions, and therefore figuring out how it _should_ be used in _my_ code rather than dropping it in as-is and praying that it will work.
So, in response to a recent blog entry by Nicole, what is inspiration? A lot of effort involved in turning someone else's previous work into your own original work. The magnitude of originality may in some cases be limited by scope: there's only so many ways in one programming language to implement the ages old, "Hello, World!" program.
So, if I follow Nicole around a little while we're up the canyon taking pictures, she'd notice that instead of taking just one picture of what I think she's taking, I was taking 10 or 15 with various shutter-speeds (I'm keeping things to one variable right now) to see what happened. When Newton figured out the notion that the slope of a curve at a given point is the derivative, he was using his own knowledge of previous mathematicians and physicists. Because everything, in its own little way, is art.
Wednesday, April 23, 2008
Almost there...
I am almost finished. I've taken both CS finals (312 and 340), my guitar final, and my Old Testament final. Thanks to a merciful professor I have a summer to complete the projects that I got _very_ far behind on when I got sick.
But this darn Physical Science final won't go away by itself. It's funny. A class that under normal circumstances I would ace easily (I got 98 on the first midterm, before I got sick), consequently turned into the class that I quit going to in order to not get any farther behind in my (more important) CS classes (since you can use your final exam score as your grade in the class).
I've read half a semester worth of lecture slides tonight. I'll probably get through most of the second half before I go to bed. Tomorrow I'll be reading the book. And when I say, "reading the book", I mean the whole book. 36 chapters. And then taking the final. What should have been one of the easiest A's of my life has turned into, "This will take a miracle, and I'll take whatever I can get."
Ah the wonderful life of a student. bleh.
Thursday, April 10, 2008
Friday, April 04, 2008
The Lunch of Champions

Sometimes when Nicole has stuff to do I get to stay on campus all day. This isn't necessarily a bad thing because at my office or in the CS laptop lab I have an extra monitor to plug in to and I can get lots done with few interruptions. The only problem is that it sometimes gets a little hungry, because the only food I keep at my office these days is some oatmeal that I have for breakfast when I work in the mornings on Tues. and Thurs.
Enter the economics of choosing a cheap, filling lunch that can provide enough calories to last several hours and taste good enough that I want to eat it. If you believe everything you see on TV, a Snickers bar is the perfect answer, except for two problems. First, I can't stand nuts, or any food that contains them. Second, at $0.65 or so the cost/calorie ratio, while not too bad, is literally blown out of the water by the "real" lunch of coding champions: The Granny B's pink sugar cookie.
Your average candy bar has a calorie content of between 150 and 200, so we'll say the average is around 175. at $0.65, that's about 2.7 calories per cent. Now some of you will look at that wonderful pink sugar cookie's package and say, "That's only 113 calories." And that would be because you forgot to look at the serving size: 1/4 cookie. That's right, baby: 452 delicious calories in that marvel of baking ingenuity. At $0.75 in the bookstore, or $0.80 in the vending machines here on campus you have either 6 cents per calorie or 5.65 cents per calorie, respectively.
Add to that a bottle of delicious whole milk (a delicacy I don't get to enjoy much these days), and you have a 602 calorie lunch (enough fuel for about 6-7 hours of programming before I start to get hungry again) for a grand total of $1.50.
I know some of you (Nicole?) are rolling your eyes right about now, but if you can find me a better tasting, healthy lunch that I can get anywhere on campus for $1.50, I'll eat that instead.
Thursday, April 03, 2008
Where have all the "real" hackers gone?
A real hacker is a special kind of person. I'm not talking about the idiot crackers and script-kiddies that break in to networks and who turn your neighboor's great-aunt's computer into a spyware-infested, slower-than-cold-tar bot-net slave. While I'm not in the same hacking universe as a "real" hacker (people like Ken Thompson, Dennis Ritchie, Steve Wozniak, etc...), I like to think of myself as a budding hacker. If I want to learn about something, I start digging through the documentation, source code, whatever I can find. When I see something cool in a website, I'll take a look at the source and see if I can figure out how it works. When I discovered an un-implemented feature in the port of my favorite text editor to Apple's Cocoa Framework, I started going through the source to find where I need to add the code that will make it work. (this got side-shelved by the demands of school, but I'll finish it off this summer)
Part of this is a natural curiosity for how things work. Part of it is the fact that I now have the knowledge to make some semblance of sanity of quite a lot of the 1's and 0's that make the world run these days (given time to look through it).
Given this curiosity, when I got to work today to see everyone gathered around my buddy's computer, I naturally came over to see what was going on. Much to my surprise, it turns out that some lazy-assed idiot has cloned Justin's extremely slick, one-of-a-kind website. (trust me, it actually _is_ one-of-a-kind). Not cloned as in copied the source code, modified it so it's the same but different. Not cloned as in copied the whole thing to his own server and replaced images, blurbs, etc. with his own material. Cloned as in sucking the content off of Justin's server, changing the font, and translating the blurbs to Spanish. Cloned as in using the exact same javascript file from its location on Justin's server. Justin is in the middle of some "minor retaliation", so don't be surprised if there is a little "addition" to the slacker's page if you go look at it. And don't be surprised, Mr. Sebastian Lazy-pants if your web presence takes a turn for the worse... There's an amusing little anecdote to this here.
What the heck? What ever happened to, "gee, I wonder how that works...", or, "hmm, I wonder what I could do with that..." ???? If you're going to go through the trouble of copy/cloning somebody's work, it's not that much trouble to learn how it works and make it your own, with a little note saying, "Thanks to Justin for the ideas".
I just can't understand that way of thinking...
Tuesday, March 18, 2008
It's working! It's working!
For those of you reading my blog who are Mac users, this may interest you. I've been beating my head on a way to have iCal tell me nicely when I have a deadline coming up, and I finally got a working solution this morning. You can read about it on my other blog if you are so inclined.
Sunday, March 16, 2008
Found this quite interesting...
An interesting awareness test. Try it out.
Make sure to let it go all the way to the end. And if you comment, don't ruin the fun for those who haven't yet.
Saturday, March 15, 2008
One down, many more to go...
Well, it's all here. For those of you who are wondering what I'm talking about, let me fill you in on some details.
I hate shaving. My mom took me to Wal-Mart when I was 12 or 13 and we bought me a razor, and I was pretty dang cool. I was only shaving peach fuzz, but it was cool. Then I went to Basic Training. There, if you weren't satisfactorily shaven, a drill sergeant would hand you a Bic disposable razor, and you'd dry shave on the spot. Now there is a very good reason for soldiers to be clean shaven. If you have all kinds of scruff on your face and neck, your protective mask won't seal and gas can get in. So I shaved every night. I wasn't too concerned about the fact that I got about a billion razor bumps and ingrown hairs every day because it wasn't to big of a deal compared to the 120 degree, 90% humidity days at the range, but I quickly lost whatever remains of the "it's cool to shave" idea that had survived the previous 6 years.
Then I went on a mission. 2 more years of shaving every day, with all the accompanying razor bumps and ingrown hairs. By this point I just assumed that it was normal and happened to everyone. I resigned myself to the dragging feeling of 17-bladed razors and figured I was in for a lifetime of hating shaving. So when I got home from my mission, I adopted a "shave for church" policy. That was okay for the next few years, but I still hated shaving. Then a couple of years ago when I started working on campus, I had to adopt a "shave on Wednesday and Sunday" policy, and I still hated shaving. That was when I introduced the policy of a "vacation beard". Whenever I'm away from my on-campus job for more than a week, I just grow a beard until I get back. Now I am totally in favor of this, but Nicole is _not_ a fan. We're talking less of a fan than I am of shaving. Did I mention I _hate_ shaving?
Well. A few weeks ago, I guy I know on a Unix mailing list mentioned he had bought a new shaving brush, soap, and double-edged safety razor (the kind that uses old-school razor blades). Now this didn't come as too much of a surprise from a guy who makes his own soap, but he linked a couple of articles about old-school shaving. Being the curious person I am, I started clicking through them, and was somewhat surprised to learn that it is indeed possible to shave and not get bumps and ingrown hairs by the gazillions. I was also _very_ surprised to learn that there are people who shave and like it.
There had to be something to this. So I started looking around some more and learned that double-edged razor blades sell for about $5 for a pack of 10. That beats the tar out of the $38 I paid for my last pack of 16 blades for my Fusion. So, I decided to give it a try. I made an early investment of my birthday present from us and bought a decent shaving brush and some Italian shaving cream called Proraso. Much better. The brush and decent shaving cream reduced my bumps and ingrown hairs by a drastic amount. Not to mention making shaving a much more relaxing experience. The blades still drag, and I actually notice much quicker when my razor blades are getting dull. So now the Fusion by comparison with the brush and cream is really starting to suck. I can shave 3 or 4 times before I have to use a new blade, 5 or 6 if I'm wearing my patient pants.
So I started looking a lot harder at safety razors and where to get good blades for them, when I came across a link to a website called StraightRazorPlace. Now this was really something I could get on board with. Most of you who know me know I like knives, axes, basically anything with blade. Some of you will remember me sitting in church sharpening my knife after we finished with the sacrament in my younger days. So let me see if I got this right. High quality steel blade, never have to buy razor blades again, and if the good folks at StraightRazorPlace were to be believed, a closer, longer-lasting shave than with my old multi-bladed nemesis. So I ordered a straight razor, a leather and linen strop, and a 3 micron, 8000 grit diamond plate to hone my new friend on. They all arrived, and last night, after a little work on the edge, I had my first try at a _really_ old school shave.
It turns out that sharpening a razor to shave my Brillo pad face with is a whole different story than sharpening anything else. It also turns out that there will be some serious learning curve to follow. But, on my cheeks where the easy part is, I'm quite impressed. I only nicked myself twice, and those were minor ones that had stopped bleeding by the time I finished shaving. This does not count all the razor bumps I shaved off from Wednesday's shave, but I'll just wait a few more days for the next time to let all the aftermath of my 5-blades at a time shave go away. This evening, following some instructions by on of the gurus at another old-school-shaving website, BadgerAndBlade (because good shaving brushes are made of badger hair) I touched up my razor a little more. So now I will wait patiently for a few more days, and give it another shot.
The end. (at least for a couple days)
Monday, March 10, 2008
Priceless Moments In Algorithm Analysis...
I'm currently taking CS 312: Algorithms Analysis. This is quite a class, as we deal with how efficiently computers solve problems, and how well that efficiency holds up as the size of the problem increases. It's largely theoretical, although the projects give us a chance to flex our newly-found algorithmic muscles. Despite the fact that we deal most of the time in abstract, gnarly math that most mere mortals would never need to know exist, I like the class.
This morning, we were talking about using a system called Dynamic Programming to determine to optimal sequence in which to perform a chain of matrix multiplications. Why? you ask? Let's just say that the computer-generated graphics that make Yoda a star depend on it critically.
Anyways, we were about 3/4 of the way through the algorithm, and were talking about how many computations it would take to determine all cells in a diagonal of our resulting optimal solution. And, without further ado, I give you our Priceless Moment In Algorithms Analysis:
Dr. R*: "So we can see where we're getting our optimal solutions from, now we need a simple explanation."
Me (dryly): "At this point in this class, we've gone far beyond the realm of simple explanations."
Dr. R* and everyone else: lots of laughter
Dr. R*: "How about layers of simple explanations"
Me: "We'll buy that."
In Summary: I love what I do.
Sunday, March 09, 2008
It's that time of year again...
Last night I had a devil of a time getting to sleep. Perhaps it was an omen that my cell phone clock would not update with the time change and I'd miss church (which happened, by the way). There are many more "perhaps-es" that I could list, but one of them has been growing more and more annoying. My long, gnarly, brillo-pad-ish hair was curling around into my ears, and even tickling my jawbone.
It's getting warmer, and even though it's almost certain to snow again, the combination of annoying sleep prevention and lack of need for cold-weather insulation indicated that it was time for a hair cut. I'm not a huge fan of paying someone else to cut my hair, so I almost always (except when Nicole really puts her foot down) cut it myself. A few pics for your viewing amusement:


My hat fits much better again now.




