Monday, May 26, 2008

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

  • Create a directory, say /home/joshuago/, 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/

  • Run apache-tomcat-6.0.16/bin/ script as usual.

  • Start developing at /home/joshuago/

Change the directories as convenient or as suits best practices for your particular environment.

If you have multiple sites (and multiple instances of Tomcat) you'll need to edit conf/server.xml to make them listen on separate ports.

Thursday, May 15, 2008

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.

Thursday, May 8, 2008

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 to the users and programmers of open source software, and the weaknesses plague them. Switch this around to the point of view of a company and you can actually get the opposite scenario: the strengths of open source software make it difficult for traditional software companies to make money, while the weaknesses in open source present an opportunity for an enlightened or creative software company to step in and fill the value void.

The strength in open source software is drawn from its unrestricted use and the consequences of unrestricted use. Anybody can just take the software, make changes to it, and repackage it. There are no restrictions on the use and distribution of the software. And since anybody has access to change the software, they often do — and the software often experiences a lot of change in a short period of time. In short, open source software is pretty great if you're a user: you can take it and do with it what you like, and there are always new features coming out so you never get bored or have to be stuck with the same old thing for long.

The weaknesses of open source software are analogous to its strengths. You could say that it's just picking up the other side of the same stick. Sure, open source software is easy to change and great for sharing, but when everyone's allowed to do this, there's a strong tendency towards chaos. Some efforts, like the Linux kernel or Mozilla, have very strong centralized cores that have survived challenges, but many others like XFree86/XOrg and FreeBSD/DragonFlyBSD have had very public internal debates. The fast pace of development also has its downside: frequent updates to existing software come out, but they come at such a quick pace and have not been well-tested. It's a hit or miss proposition when upgrading any reasonably important server to the latest version of a software package: it could break other software packages that haven't kept up. How does one get access to bug fixes or security patches and be assured that there are no unintended side effects?

Based on these observations and what Red Hat (and others in the industry) have done, here are a few guidelines on trying to make money from open source software.

Don't try to sell value that you didn't create

It's not a moral recommendation but a practical one: even if you tried to sell a repackaged version of what other people produced, nobody would buy it, because it's available elsewhere for free. You shouldn't just repackage the software and sell it like you would a traditional software package. Technically, you could repackage it for convenience, but you won't be able to make much money by charging high prices for your software. So there goes that plan.

Don't expect to sell value that someone else in the community can create/duplicate

Now, it's fine if you want to make enhancements to a piece of open source software to contribute something back to the community. Many companies do this: IBM, Red Hat, Novell, and Sun, just to name a few. Users really win big with open source software, because any feature in it will be available for free. Unfortunately, if you as a company try to tack something on to the project and sell it, your competitive advantage quickly erodes because you have to open up the source code (at least when using the GNU General Public License).

I say don't expect to sell value here because you can certainly try, and in some cases, succeed. But I'd say don't count on it. If you do want to try, make sure you enhance software that's covered by the BSD license, not the GNU GPL. If you choose the latter, you'll certainly have to open up the source code to any modifications you make. With BSD licensed software, you can keep it closed but include a note of acknowledgment in your software's licensing information.

Focus on what open source software finds difficult or impossible to address

With that said, open source software still has its weak points. All the openness can and does lead to fragmentation and inconsistency. Because people working on a project work only on what they want to rather than have a boss dictate items to them, a lot open source software lacks that extra polish that you'd expect from a consumer- or business-ready product.

I have a hunch that this is why open source programming tools are so clever and refined, while open source products meant for consumers seems to have a hard time getting past alpha or beta quality. Pretty much any open source program that a programmer would use on a regular basis and use heavily is bound to be very well done. Any rough edges are quickly smoothed out. But when a tool is built for non-programmers, the overwhelming tendency is for it to languish in mediocrity and stay under the radar of the wider community.

The business opportunities in open source software are rooted in the fact that open source developers overwhelmingly favor working on things that they want to work on. This means that the parts that aren't so fun are left undone. There is this desert where a programmer's passion only occasionally meanders — but it is wide open for businesses to step in, where another incentive which many of us are very familiar with, money, can take hold and flourish like native desert flora.

Where grassroots open source development stops, profitable enterprise begins. Here are some ways to make money from open source.

Client interactions and case-specific integration/support. It's fun to write new software, but not so fun to make sure that it works for every single person out there. Fortunately for the businessperson with an interest in open source, there are people who are willing to pay in order to get open source software working for them. Someone once said that open source software is only free if your time is worth nothing. There's truth in this, but that time can be dramatically reduced while avoiding being locked into closed source, proprietary software. Red Hat, Novell, IBM, and Sun make some decent cash through support contracts and servicing.

Subscriptions to updates that are well-tested and certified. There are software updates, and there are software updates that are guaranteed to work. I think Red Hat was extremely clever to set up their subscription system, and I admire it because I know that the updates coming from it aren't going to break anything. They do the hard work and make 95% margins on subscriptions. I can get on with my day rather than worrying about properly upgrading my server. It's unquestionably a win-win situation.

Coherent visual/brand identity that promises a certain expectation of quality. The open source community is vibrant, but it's also prone to fragmentation. Moreover, the traditional business practice of building a sustained competitive advantage through branding still stands in this new world of open source software. A brand still holds sway, and still serves as a focal point for trust. Novell, Red Hat, and Mozilla Firefox are highly respected open source flag bearers. It's really good once you get to that point, but, as in times past, building a brand requires a lot of hard work over many years.

Provide a stable platform: still open, but rarely changed because it has to work. There are two big problems with open source platforms: fragmentation and rapid change. Red Hat and Novell provide Linux distributions that can serve as stable platforms on which to build. They're infrequently updated and tightly specified. Ubuntu also has a Long Term Support (LTS) version of its releases, meant for the same purpose. It can be very rewarding to a company when it has control of a popular platform that holds a lot of developer mindshare. The vast majority of developers just want whatever they're building on to be predictable and for people to use their software. Providing a stable platform, trusted by developers and freely available to users, is a great way to establish thought leadership and make a name for your business. It yields a lot of advantages if you can get to the point where you are the trusted caretaker of a platform, but like branding, it's hard work and it's a long process only for the very committed.

Saturday, May 3, 2008

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. In the political sphere, state governorships, seats in the Senate, and Supreme Court appointments are technically open to naturalized citizens. In the economic sphere, immigrants are increasingly providing the needed brainpower to develop new industries: a quarter of Silicon Valley startups were founded by entrepreneurs with a Chinese or Indian ethnic background.

Things are pretty great for the naturalized American citizen — but they could be better. There are a lot of good reasons to amend the U.S. Constitution to get rid of this last remnant of inequality, and not a single good reason to keep it as is.

Reasons to Amend

What we have now essentially delineates Americans into first- and second-class citizens. Granted, fundamental rights have been addressed thanks to the tireless work of the many who have come before us. And it's true that holding public office as a representative of the people should be viewed more as a privilege than as a right. But to lock people out of the presidency in the Constitution, for circumstances that were completely outside their control, creates an undeniable division of citizens into first- and second-class citizens. That's just the simple fact of the matter. Certain citizens get one more privilege than the others do. This distinction does not mean much to most citizens and does not impact them directly — running for President is not going to be a practical reality for the vast majority of Americans — but to be able to say, with absolute veracity, that our Constitution creates a system of first- and second-class citizens is just downright embarrassing when we claim to be the purveyors of equality and the beacon of democracy to the whole world.

What we have now does not effectively address the original concern with illicit foreign influence, and it is a blunt instrument in attempting to address this concern. The requirement for the President to be a native-born citizen was included in the Constitution during a fragile time for America, where the danger of foreign influence was very real, and whose potential consequences could have destroyed America early on. In short, it was justifiably paranoid and the drafters of the Constitution were right to include it at that time. But we have no justification for keeping it now. Voter sentiment about foreign influence and mixed allegiances presents the biggest barrier to ratification, and I'll expand on this point further in the next section. But in short, the current clause does not serve its purpose — ensuring loyalty and allegiance to the United States of America — and there are better ways of demonstrating loyalty and commitment.

Ratifying such an amendment would do much to integrate immigrants into the fabric of American society. By sending the message that immigrants, once naturalized, are truly equal in the eyes of the law by being eligible for the highest office in the land, this amendment would give them a stake in America's future. It could also lead to a representative figure.

Further Elaborations on Foreign Influence

It's completely valid to ask for a sign or indicator of loyalty to the United States. Where you're born is a blunt and ineffective instrument for doing so. If anything, let one's military service record be the testament of loyalty and dedication, not one's place of birth.

The original intention and the situations surrounding the initial amendment are not valid now. Locking a restriction into the U.S. Constitution was a necessary precaution to very real concerns. Keeping it locked in shows a mistrust in the American people to select a good Presidential candidate.

Accentuating the Positive

For those who are overly pessimistic about the current situation, let me just give an overview and explain why I think the current system is actually quite good. By accentuating the positives, my intention is to frame the debate in more forward-looking viewpoint that's conducive to progress, and not wallow in despair over the hopelessness or xenophobia inherent in the situation.

The current system does allow for children of immigrants to become President. If you're born in the United States, you are automatically a natural-born citizen, even if you are a Gonzales, Zhang, or Singh. That part is taken for granted, and in arguing for something better I certainly don't want to take the current system for granted. Rather, I want to make it a point to celebrate the tremendous opportunities already available.

Closing Remarks

There's some merit in the argument that political energy should be diverted to more pressing concerns like the economy, health care, transportation. There are more important things to address in the meantime.

Some would argue, "If it ain't broke, don't fix it." But I'm saying that it's broken. Leaving rotten parts in the system leads to decay. But I acknowledge that, however simple it is, it's still a small issue compared with the bigger problems facing us today.

Since this is such a no-brainer, then, I suggest that it be put forward for passing as a bipartisan measure to encourage working together across the aisle, especially when more divisive issues take center stage. It will be a symbolic gesture to the American people and good practice for our elected representatives. I would welcome a well-argued case for keeping things the way they are.

A lot of times, the status quo is there for complicated reasons that are unknown to us, and set up in a way that we should not try to tamper with. I do not believe that this is one of those cases. The issue is simple, and all that's holding us back is our own reluctance and inherent mistrust of change, even if it's clearly for the better.


Help not wanted (The Economist)

Should the Constitution be amended for Arnold? (USA Today)