Posts

Showing posts from 2008

The trouble with budget surpluses

The trouble with a government (or any big organization) running a budget surplus and sitting on a big pile of cash is that people start asking questions like, "Why don't we do something with that money, especially since there's so much to fix?" At that scale, having some cash ready for a rainy day is not an excuse that people are able to handle, especially when the quoted figure is in the billions of dollars. Surpluses may seem like a lot of money, although when divided on a per-person basis, they seldom amount to much at all. In this deficit-infested time, it's easy to rail against profligacy in our budgets. I'm not trying to engage in what-ifs here. I'm suggesting a way we can avoid this same problem in the future. We've been told that it's wise to save up for the future, to have some cash on hand just in case — folk wisdom that was reinforced by the big collapses this year. We also know that it's hard for most people to hear about a surplus ...

Small business owners: don't be a jerk

My girlfriend Sophia is an assistant manager at Abercrombie and Fitch , and is thus bombarded with more than her fair share of rude customers. One story she told me this week was about a woman who went ballistic after asking to try on one of the mannequins' jackets and being told no. Now, people are just crazy, and Sophia has told me many stories like this before. What was so different this time? Well, the crazy lady played the business owner card: if it were her store, she would have gladly taken the jackets off the display mannequins. This know-it-all "business owner" then proceeded to hound Sophia for her full name and pressed her for her employee ID so she could file a formal complaint, and refused to go through the normal channels. It is precisely this self-serving arrogance and provincial, narrow-minded ignorance that keeps small business owners from being taken seriously. As a former small business owner myself, I know that the burden is heavy: you've got to ...

Conceptual tools for allocating finite resources

I have lived and worked in Greater Los Angeles for over a year now. Since the area is one of the world's major population centers, it only makes sense that I'd come across plenty of opportunities to observe the interplay between two forces: lots of people and limited resources. It's a common problem, but always a multifaceted one. Coming up with a solution means that planners (who could be church volunteers, business managers, or software engineers) must consider various factors. Having to stop and think about this can slow down decision making, and even when there's time to ponder and plan, thinking of a solution from scratch is more error-prone than referring to a proven set of guidelines and rules. Pricing Consider the situation when lots of people are elbowing each other to buy concert tickets. There's no increasing the supply of these tickets since a concert hall or stadium can only hold a set amount of people without the Los Angeles Fire Department throwing a...

Look where you're baby stepping

When you're starting out from scratch, it's hard to predict what you're going to need. I just moved into a new apartment, and my kitchen cupboards are empty because I've decided that I'm not going to even try to predict what I might need in the future. The way I intend to re-acquire the supplies I'll need is by doing stuff. I mean, sure, there's cooking oil, salt, and pepper. But for a little more exotic Chinese cooking, I'll need some sesame oil or star anise. Beyond the basics that I'm certain I'm going to actually use, it's impossible to predict what other odds and ends I will personally end up using. And soliciting advice from others in the past hasn't been good for me: what works for other people often does not work for me. For me, the only way I have been able to know — with certainty — what I'll need is to actually start trying to do things. If I'm trying to figure out which ingredients I'll need to cook a meal, I just...

Getting more out of a sentence

There's a very simple, effective, and systematic way to amp up the amount of insight you get from the things that you read. It's probably best to explain with an example. The following is from Ed Catmull's article for the Harvard Business Review, "How Pixar Fosters Collective Creativity." We must constantly challenge all of our assumptions and search for the flaws that could destroy our culture. How much thought can this spark in your mind? If we just read this sentence several times, each time with an emphasis on only one word, we get a new angle on the general idea being conveyed. Something different is emphasized. We must constantly challenge all of our assumptions and search for the flaws that could destroy our culture. The emphasis is on the we . This tells me that whatever this sentence is talking about involves a team effort. Everyone on the team must be involved. It's a "we" rather than a "me." But does that necessarily have to be ...

Ruby on Rails: optimizing a slow-rendering page

Recently at work, I was faced with the problem of fixing a slow-rendering page. The page is part of an internal content management system, where the content includes video, images, and text. We have over a thousand pieces of content being managed with this tool and the slow page was a listing of all the content along with key overview-type information for each content package. Everyone was fine with this page loading slowly, since we knew that there was a lot of content. The problem arose when the page would only show around 50 items and then stop loading; the server configuration was set to automatically stop requests that took too long to process. I knew that the best course of action would be to start measuring. I took a look at the logs to see how long the request was taking and the approximate tasks where time was being spent. At JibJab , we take pride in caching the hell out of everything. Only a tiny fraction of time was spent hitting memcached . And it looked as though memcache...

Bilateral versus multilateral trade agreements

News sources everywhere seem to lament the collapse of the Doha round of trade talks because countries would then have to resort to bilateral or regional trade agreements. For any supporter of free trade this would be understandable, but if we acknowledge the short term havoc wreaked by rapid changes to trade flows that do not give workers and business owners time to adjust, a gradual and stepwise approach to the opening up of markets seems to be a more prudent way to go. One of the major problems cited by those who favor a broad trade policy is the inconvenience of having to keep track of different rules for different countries. I would go about solving this by building a hash table of trade rules. Basically it would mean that given a country and a product as input, we would get the policies regarding that product as output. This would be a large table, but we would ask and receive only what we are interested in. There's also the advantage of isolated policies having limited effec...

Colored bash prompt

The following will set a bash prompt to highlight the name of the directory in yellow, and in bold. export PS1="[\u@\h \[\033[1;33m\]\w\[\033[0m\]]$ " This will also work: export PS1='[\u@\h \[\e[1;33m\]\w\[\e[0m\]]$ ' The escapes have to be in single quotes, however. During a previous attempt, I wasn't terminating everything correctly, and so when my command exceeded the length of the row, it wouldn't wrap around and start a new line. It was not just a Mac OS X Terminal problem; I tried it in rxvt (installed via MacPorts) as well as the xterm that came standard with Leopard's X11.

Doctors and programmers

One evening, I was watching Mystery Diagnosis on the Discovery Health Channel with my brother. The show is about people who have strange ailments, but doctors can't figure them out. It got me to thinking about how people in my profession approach problem solving. The approach that computer programmers take is up to us, and it's pretty open-ended, but it's widely agreed that we use measuring tools — debuggers and profilers — to examine whether each little step is doing what it's supposed to be doing. It's also a widely accepted quip that one should never try to guess where a slowdown or a bug is happening, because one is usually wrong about it. But that sort of guessing without detailed measuring seemed to be exactly what the doctors were doing. For one guy, they drew blood sample after blood sample, but it turned out to be a problem on the genetic level. I wonder if there's some level of professional ego that keeps doctors from doing what would otherwise be co...

Freeways that trick you

I don't like it when freeways trick me. There's I-10 west into downtown LA, when it splits off to US-101 and I-5. Six lanes of I-10 turn into a single pathetic lane if you want to stay on it to keep going to Santa Monica. Most of the rest goes to US-101. Context over consistency, to serve the massive hordes going to Hollywood? Perhaps. But this is the mighty I-10 freeway, encompassing the width of the country and passing through Phoenix, San Antonio, Houston, New Orleans, and Jacksonville. It's not some little country road in the middle of nowhere. Someone should tell this freeway, "Hey, you're not done yet. You reached LA, but the real end is Santa Monica." And then there's I-5 north to SR22 west in Santa Ana. When you're driving on I-5 and you choose the "Exit Only" lane to switch freeways, you should be rewarded for your dedication. But it is not like that at all. It really does mean "Exit Only" — and not to switch freeways. It t...

Meetings are not always toxic

I'm a big fan of 37signals in general, but I remember a time when I went a little overboard with youthful zealotry for one of their philosophical tenets: meetings are toxic . Back then, my business partner Steve and I had just landed our first major client, and this client asked for a kick-off meeting. I curtly dismissed it, telling them I didn't need a meeting — leaving them baffled with my strange behavior (and Steve smacking his forehead). Since then, I've found kick-off meetings with partner companies and clients to be crucial for greasing the wheels of personal exchange. It gets people talking to each other, which is worth pursuing because cross-company communication is a tricky thing. Plus, the stakes are higher: if you have to coordinate with another company, chances are that you're working on something pretty important. I've found in the vast majority of cases that it doesn't take extensive preparation to the standard I would expect of myself if I were...

The introverted leader

During the course of my two years attending Discovery Christian Church in Davis , I had the chance on several occasions to eat lunch with the pastors, namely Aaron Brockett and John Richert . I still remember the most surprising thing that Aaron ever mentioned to me. He said that a lot of the leaders at Discovery, himself and John included, were natural introverts. From the outside, it seemed that they were anything but. They greeted people left and right, confidently gave their sermons, and coordinated the big picture very smoothly. One of the things that caught my attention at the beginning, and subsequently hooked me in to attending regularly, was how the services on Sunday were so well-run. As for me, I have found that I am quite happy to be a follower, unless there is a leadership vacuum — either no leadership at all, or very poor leadership. To be fair, I've found that very poor leadership can come from both extroverts and introverts. In extroverts, the leadership pitfalls...

Where software developers fear to tread, or why open source fails

Open source has had its triumphs and failures. The most notable wins include Eclipse , Linux, Apache HTTP server , MySQL , and Mozilla Firefox. Developer tools and server software are generally areas of strength for open source. I wouldn't say that Mozilla Firefox is an anomaly. Rather, it shares something in common with developer tools and server software: the programmers who work on it are also its users. Unfortunately, this is not the case with the gaps that open source has so far failed to close. A friend of mine recently asked me about my choice of spreadsheet software. We talked about it for a bit, and agreed that OpenOffice.org Calc is still clunky. I suggested Gnumeric , but I don't really hear anything notable going on with it these days. In short, I don't see an Excel killer in either of these. It's not for lack of vision that these spreadsheet projects have stagnated. It's for lack of sustained passion and developer interest in making these products world...

The music at 24 Hour Fitness

For my morning workout, I switch between two different 24 Hour Fitness locations. One is right by where I live, in Irvine, California, where people tend to be either white or some kind of Asian. The other gym, near Long Beach in the city of Carson, is on my way to work. Most of the customers I see there are either black or Filipino. Each location plays different kinds of music. At my neighborhood 24 Hour Fitness, the music that's played is the angst-ridden punk and alternative that people have come to expect out of Orange County. (To be fair, I like a lot of the songs they play.) In Carson, it's a bigger gym with some sort of Magic Johnson approval. They make a big deal of being tied in with Magic Johnson, and his pictures are plastered over all four of the walls, on both floors. If I were Magic Johnson, I would be a little embarrassed to have so many pictures of me smiling statically at people as they work out. The music is hip hop and R&B. As both workout and leisure musi...

Mexican flower vendors

One my drive home from work each day, I see Mexican guys trying to sell flowers, standing on the curbs by freeway entrances and exits that have stoplights. After seeing them all week, I got to wondering whether any of them ever make a sale: I haven't seen anyone buy flowers yet. And I'm sure they make a sale here and there; otherwise they wouldn't come back. That got me to wondering whether there's some sort of demographic they target. Given that the particular time of day is when most people get off work and then sit in traffic, the cynic in me thinks that the buyers are probably making their purchases for reasons other than being considerate. A man doesn't have to plan the purchase of these flowers in advance, and even if he did, it's not guaranteed that the seller will be there. My hypothesis is that these traffic light flower vendors' target market is men whose wives or girlfriends are upset that they're coming home late from work, and these busy guy...

Foreign key cascade on update dangerous?

In relational databases there's a feature called foreign key cascading. Typically, there's an ID associated with each row, or entry, in a database table. Tables may refer to other tables using a foreign key, which typically refers to the IDs of the rows being linked. There are options to "cascade" on two kinds of operations: delete and update. When a table refers to another table, the table pointing to the other table can be configured to take changes in the ID of the original table and integrate them automatically. This is what happens when ON UPDATE CASCADE is set on a foreign key. When ON DELETE CASCADE is set on a foreign key, deleting rows in the original table will also delete rows that are pointing to that row. So, it's not hard to imagine situations where cascading on delete would be dangerous. Now a while ago, I was talking to a database specialist about cascading updates on foreign keys. He mentioned that they're dangerous, so I took his word for it...

Truth never changes — or, why we're solving the same problems

"Truth does not change. What was true 2,000 years ago is true today, and will be true 2,000 years from now. New truths may be discovered, but that just means that it was true all along." The above is paraphrased from a sermon given by Pastor Rick Warren at Saddleback Church. Very few things are really new, which is consistent with my observation of what's going on in the world, and if they are, chances are that there's some catch. What's new and doesn't last probably doesn't work or just isn't true. Such things lack conceptual integrity and fall apart eventually when reality hits. (I've just started a new job at JibJab , on which I'll write more about later on, but that doesn't mean my mind is completely devoid of all thought dedicated to solving larger problems.) When I see some new file storage startup, or some new effort to create an operating system, or several companies trying to push their respective next-generation platforms, I think...

Proofs by induction and real-world business needs

While I was a young and eager undergraduate computer science student, I was taught the method of proving things by induction. Basically, it's a way of showing that something is true for some simple cases, and then showing how it can be true for more complicated cases. There are two major parts to it: prove that the base case works, and prove that the inductive case works. I see some applications of that kind of thinking in everyday business. Just because I can manage documents on my own doesn't mean that the way I do things will scale to other people. So, to build a solution that grows with the business, I'd have to show first that it works for me, and then assuming it works for X people, show that it will still work when X+1 people are in the picture. The thing with most inductive proofs is that they show that something is true, or if we map it tightly, it would show that things are possible in business -- that something is computable and knowable. But in real-world conce...

Put Apache Tomcat in its own directory, and your web applications in another

I recently took my first look at Apache Tomcat 6.0. I was inspired by Tomcat: The Definitive Guide, 2nd Edition , which covers Tomcat 6.0. It mentioned a way to separate the actual Tomcat distribution and binaries from the webapp data, but described it for environments that had it pre-installed as an RPM or DEB package. As I'm writing this, the latest version is 6.0.16. Here's what I had to do to get my webapp code in a separate directory tree from the Tomcat binaries as downloaded straight from tomcat.apache.org . Create a directory, say /home/joshuago/domain.com , where all the webapps for that domain are going to be. Set CATALINA_BASE to the directory above. (Don't set CATALINA_HOME.) Move conf , logs , temp , and webapps directories to /home/joshuago/domain.com/ . Run apache-tomcat-6.0.16/bin/startup.sh script as usual. Start developing at /home/joshuago/domain.com/webapps/ROOT/ . Change the directories as convenient or as suits best practices for your particular envir...

A fix for LaTeX "Missing $ inserted." console message

While I was running pdflatex on a .tex file containing a math expression, I got this error message: Missing $ inserted. Powering through it would evaluate the math expression adequately, but I included a plus sign later in the same sentence. I followed the directions and made it convert to a PDF beautifully by adding a dollar sign at the beginning and at the end of the math expression. (It's not just at the end-of-the-line, like I would normally guess it meant in a Unix environment.) So, what started off as 9*2^4 turned into $9*2^4$ and produced a beautifully formatted PDF. I should also note that Norm Matloff has a great introduction to LaTeX . EDIT: This one's even better. It just took a while to load and I got impatient.

Observations about making money from open source

Open source is a great thing and I've personally benefited tremendously from it. It has let me deepen my knowledge, given me entire software platforms to invest my energies in, and has opened up a wide landscape of job opportunities. For a company though, it's pretty challenging to make money from it, and I recently I got around to thinking what successful companies in open source have done. Arguably, Red Hat is the most successful open source software company out there. They came to mind not only because their product portfolio is mostly based on open source or that they've been around for a long time (relatively speaking), but because I actually use their products and find value that I willingly pay for. Good for them. But I wanted to figure out what it was they did in very general terms, because I'm definitely not going to try to take them head on. Open source software has its strengths and weaknesses, where the strengths and the value produced often tend to accrue t...

Why the office of U.S. President should be available to all citizens

Under our current Constitution, an American citizen is an American citizen — except when it comes to the presidency. There are American citizens who will never be able to attain the highest office in the land, even with distinguished military service, community involvement, or a track record of political achievements. The one differentiating factor that isolates these citizens from the rest is that they happened to be born in another country, to parents who were not American citizens. This means that foreign-born American citizens — whether they were born in Mexico, the United Kingdom, Canada, Germany, China, or India — can never be President. Nevertheless, the United States is one of the most accepting countries in the world when it comes to citizenship. Acquiring United States citizenship is a long and arduous process, but in theory it is open to all. And as many of us know, there's so much to be done and so much that could be done aside from coveting the presidency....

A pleasant surprise from Pentel

Image
I was raised on Quicker Clicker mechanical pencils from Pentel. Back when I started using them as a wee lad, they felt heavier and sturdier since they were crafted out of more metal content. Now, Quicker Clickers are mostly made of plastic. But like all Pentel products, they still carry a lifetime warranty. For pretty much anything else, I don't care about lifetime warranties. First of all, I'm not going to take the trouble to dig up my receipt for something I bought years ago. Second, I just don't care that much about most of the stuff I buy. But I take my writing implements very seriously. For mechanical pencils, I prefer the Quicker Clicker over anything else. For erasers, I like the Staedtler Mars Plastic but I'll settle for a ClicEraser from Pentel. For ink pens when writing things in my planner, I will go out of my way to get a Uniball Signo RT Gel, 0.38mm in either black, blue, or red. I keep several Quicker Clickers around at all times to ensure optimal perfor...

Growing responsibility on a solid base

People who cannot handle small, easy duties should not be entrusted with more power and responsibility. Basically, be faithful with the small things, and you will be entrusted with bigger and better things. I particularly like this lesson because I love the process of building and focusing on smaller tasks, but at the same time I've always been a big dreamer. As one would expect, though, I also experience that impatience to move on to the next step, even if I'm nowhere near ready. But that's the way the world works. I've been thinking too, that the ability to wield power and responsibility is not entirely intrinsic. True, you can be put in charge of small things as a test of your potential, which is a property that never changes, and it does serve as a way to winnow out the good from the bad. But I realized that the process and experience of handling the little issues and tiny problems is itself critical to bringing out any latent potential or untapped talent in peo...

Reading old translated classics

The past couple of years, I've tried to become a more cultivated person by trying to read the "classics" — old books revered by well-read people far and wide. A lot of literary contributions have been in languages other than English — the French and the Russians in particular have made tremendous contributions to world culture — and in reading some French and Russian classics I've wondered how much I'm missing by not reading them in their original languages. What I've found has been utter genius as far as pure ideas go, and eloquent choices in figurative language. Both translate well, as one would expect. As far as clever turns of phrase, I know I'm missing out because the wording hasn't seemed terribly impressive in the translations of Les Miserables (by Victor Hugo, originally in French) and War and Peace (by Leo Tolstoy, originally in Russian with a lot of French phrases). Even in translation, though, I found Victor Hugo to be frequently poetic ev...

Project idea: structured financial data

As they are, things are pretty good for everyday investors on Main Street. The United States Securities and Exchange Commission makes the filings of public companies readily available on its website. If someone were interested in researching a company thoroughly, pretty much all the information is there: how much debt a company is carrying around, what kind of revenues it's pulling in, what the company's assets are worth, and so on. So, things are pretty good, but they could be a lot better. Now, I say "investors" and not "traders" because traders will typically need more than just information from the SEC. It's also a clear distinction that will limit the scope of the project I'm about to propose so that it's very clear what will be needed (and, more importantly, what will not). The current situation All this data is in HTML. It's great for human readability. Right now, that's exactly what everyone's doing: reading them one by one a...

The gospel for stock market junkies

One of the recurring struggles among people who are part of the evangelical Christian tradition is finding the balance between faith and good works — knowing where each of them fits in and what they're for. Since I've been trying to read three chapters of the Bible every morning to get my bearings before jumping into what are typically full days, I read over something that reminded me of this. Now, the "full days" have been dedicated to learning about stock market investing and exploring various angles for the individual investor to take when selecting stocks. The price of a company's stock takes thousands of factors into account. One way to split up these factors is to consider 1) the book value or intrinsic worth of the company, and 2) the other things like projected growth, macro-economic concerns, takeover speculation, and a host of other factors that are not directly tied in to the numbers that the company is posting. The stocks of most healthy companies will...

Freedom is shabby and inconvenient

As much as we value liberty and tout the virtues of living in a free society, I humbly submit that eternal vigilance is not the only price we pay for our freedom. Anywhere there's freedom, you will find disorder, inconvenience, and shabbiness. We allow our freedoms to be restricted because we want some sort of orderliness, convenience, or good aesthetics. These are good things, but conceding to rigidity often means losing substance or meaning. Take homeowners' associations, for example. With pretty much any HOA, you cannot get away with painting your house bright pink, letting the weeds grow to four feet in your front yard, and then parking your car among the weeds. It may be how you prefer to live your life and run your household, but by joining the HOA you are giving up freedoms that you would otherwise have, in exchange for the assurance that your neighbor across the street will not paint his house a loud pastel purple, because pink is okay but purple is not. You may be fine...