Thursday, December 20, 2007

CentOS 5 + Tomcat5 + Java 6

I just installed a CentOS 5 server and I wanted to run Tomcat5 with the Sun Java 6 JRE, not the JRE that's packaged with CentOS 5. Naturally everything broke. It took about an hour of poking and debugging, but in the end the fix was surprisingly simple. Here's how I did it:
  • Removed all of the original java packages (java-*, gcc-java glib-java)
  • Installed the JDK 6 RPM downloaded from the Sun website.
  • Create two symbolic links:
    • ln -s /usr/java/latest /usr/lib/jvm/java
    • ln -s /usr/java/latest /usr/java/default-exports
That's it.

If you want to run Tomcat5 on port 80, it needs to have root privileges to bind to a low order port. In its default configuration Tomcat5 cannot do this because it is a pure Java application and must run cross-platform. Dropping privileges is not platform agnostic so Tomcat5 does not support it.

It is dangerous to run Tomcat5 as root, so only do it if you know what you are doing! I took this approach on this server because it is an intranet application server that is not exposed to the outside world. Do not do this if you are exposing a Tomcat server to the outside world...

Here's what to do:
  • Update the /etc/tomcat5/server.xml file and look for <Connector port="8080" Change the 8080 to 80.
  • In the file /etc/sysconfig/tomcat5 change "#TOMCAT_USER=tomcat" to "TOMCAT_USER=root"

If you are exposing your server to the outside world, your best bet is to do it in a way that it is only root while it is binding to the low order port. Here is a tutorial that appears to explain how to do this. Your other option is to run Apache on the same server and use it as a proxy. The upside to this approach is that you can use Apache to serve static content, like images, more efficiently than with Tomcat.

Monday, November 05, 2007

Daylight Savings Discovery

I was resetting the clock on our stove yesterday and noticed that it had a "Sabbath Mode" setting. I've never heard of this before so I googled it (source: http://www.star-k.org/kashrus/kk-cooking-ovenyomtov.htm):


Sabbath Mode Ovens
(The Following Applies to Yom Tov Only)

Sabbath mode ovens are designed to bypass many of the practical and halachic problems posed by the modern oven.

For the Sabbath mode ovens with the random delay feature, one may raise or lower the temperaturet of the oven without concern for the heating element or glow plug. This is because the computer does not directly react to the change in settings. The oven will randomly look to the setting and adjust the temperature. This means that turning on the heating element or glow plug is only an indirect result of your action (grama). Therefore, since a grama is permitted on Yom Tov one may actually adjust the temperature. For the Sabbath mode ovens without the random delay, the temperature may be raised when power is flowing to the oven and lowered when power is not flowing to the oven as indicated by the readout on the display.6

Another issue is that some ovens can be programmed to turn off at a preset time. This feature is known as timed bake. In many models, when the time has elapsed and the oven shuts off, it will sound a bell or buzzer or display a readout (such as the word “end”) to indicate that the oven is off. On some models this buzzer or display will continue until it is manually turned off or until the door is opened, which is not permitted on Yom Tov. On those Sabbath mode models that include the timed bake feature, the buzzer or readout is eliminated. (Please note that once the timed bake goes off, the oven cannot be used again for that Yom Tov.)

As a safety feature new ovens are designed to shut off after being on for twelve hours. Although this safety feature is very important, it creates a problem when preparing food for the daytime meal which is more than twelve hours after the onset of Yom Tov. For all types of Sabbath mode ovens, the twelve hour cutoff is bypassed.

In Sabbath mode ovens, the door plunger switch is disabled so that it will not directly cause any electronic reaction.

The oven cavity light for some Sabbath mode ovens will remain on or off, depending on how Sabbath mode was entered. For other Sabbath mode ovens, the light must be turned on at the control panel before entering the Sabbath mode, or the bulb must be unscrewed.

It is important to note that not all Sabbath mode models offer the same features. If you have a Star-K certified Sabbath mode oven, please check the appliance section of our website at www.star-k.org to see which features are available on your model, or contact our office at 410-484-4110.7

The following are some commonly asked questions about oven and stovetop use on Yom Tov:

  1. Why is one allowed to push a button on the keypad of a Sabbath mode oven on Yom Tov?

    Pushing a button on an oven, when in Sabbath mode, on Yom Tov that starts a process internal to the computer without any heat, light, sound, movement or anything tangible that can be perceived, is not considered a melacha and is permitted on Yom Tov. When a melacha is finally accomplished, namely turning on the heating element in the oven, it is accomplished through a grama, (an indirect act because there is a random delay of between 15 and 25 seconds before the heating elements can be activated). This grama is permitted on Yom Tov, but not on Shabbos.

  2. Can one turn on a Sabbath mode oven on Yom Tov or Shabbos?

    Not on Yom Tov, and certainly not on Shabbos. This is because it directly causes the display to change which is prohibited.

  3. Can I set the timed bake feature on Yom Tov?

    For those ovens that have the timed bake feature included in the Sabbath mode, it can only be set from before Yom Tov. This will allow for a one time usage. Once the oven shuts off, it cannot be used again for that Yom Tov. One may not set the timed bake on Yom Tov (and certainly not on Shabbos).

  4. May one turn off their stove or oven to conserve energy on Yom Tov?

    No. One is only permitted to lower the setting when it is necessary for the preparation of the Yom Tov’s food.

  5. May one lower the setting on a Sabbath Mode oven even when it is not for the benefit of the food?

    Those Sabbath Mode ovens that are equipped with a random delay may be lowered on Yom Tov. This is because the random delay makes the reaction of the oven to lower the temperature a grama (indirect action). Although we only permit extinguishing or lowering a flame where it is needed for food, this only applies where one does the action. Here, where the computer will lower the temperature later on as a reaction to your instructions, it is called gram kibui and it is permitted.

  6. Can I open and close a standard oven door at any time on Yom Tov?

    One may open and close the door of an oven on Yom Tov to process the food as needed if this does not cause a light or icon to go on directly because the door was opened. On Shabbos there is a problem with opening the door because you will cause additional burning in the oven. This is prohibited on Shabbos8 and permitted on Yom Tov.

  7. Must I wait until I see the glow plug glowing to open the door to my gas oven on Yom Tov?

    As a rule the oven will not immediately go on because of the reduction of heat created by your opening of the door. Therefore, even though the oven will eventually go on because its door was opened, this is not a direct result of your action. The additional burning is permitted on Yom Tov.


Regarding raising the temperature of a gas oven on Yom Tov, one may not do so unless they know that the glow plug is glowing and the display will not change. This is because raising the temperature setting will direcly cause the glow plug to go on if it is otherwise off, creating a problem of molid. However, if the oven is cerified with sabbath mode that has a random delay feature built in, and this was initiated before Yom Tov, one may adjust the temperature on Yom Tov.

Friday, June 01, 2007

Optimal Shop Temperature

According to Jim Whipple, most QA manuals indicate that the optimal machine shop temperature is 68 degrees F.

Saturday, May 05, 2007

Prospect Theory

I've been doing some reading about prospect theory lately. Prospect theory basically says that people tend to risk more to keep something than they risked in acquiring it in the first place. It also says that people are more willing to accept incremental gains that are a sure thing than they are willing to accept a chance at a huge gain. I'm sure a true connoisseur prospect theory will cringe at this over simplified explanation, but I think it makes the point.

To me, prospect theory is just another good example of the concept of least cost, plain and simple. Over billions of years of evolution, humans have gained the ability to determine which path will require the least amount of energy. When viewed objectively in the context of the modern world, where resources such as food are plentiful, some decisions that people make, which would seem perfectly rational 50,000 years ago, seem downright comical today.

Wednesday, May 02, 2007

Thursday, March 15, 2007

Learned something new today...

I was trying to do a shallow copy rather than a deep copy of a Java HashMap. As far as I can tell, you can't use clone() in Java 5 without getting unchecked cast warnings, period. The solution is to either ignore the warnings, or forgo the shallow copy and instantiate a new version of the object with the old version of the object as an argument (copy instantiation). Generics are cool and suck at the same time...

Reference: http://forum.java.sun.com/thread.jspa?threadID=559703&messageID=2982374

Saturday, January 27, 2007

What the Terrorists Want

Reprinted with permission verbatim from the September 15, 2006 issue of Bruce Schneier's most excellent monthly newsletter CRYPTO-GRAM:


On August 16, two men were escorted off a plane headed for Manchester, England, because some passengers thought they looked either Asian or Middle Eastern, might have been talking Arabic, wore leather jackets, and looked at their watches -- and the passengers refused to fly with them on board. The men were questioned for several hours and then released.

On August 15, an entire airport terminal was evacuated because someone's cosmetics triggered a false positive for explosives. The same day, a Muslim man was removed from an airplane in Denver for reciting prayers. The Transportation Security Administration decided that the flight crew overreacted, but he still had to spend the night in Denver before flying home the next day. The next day, a Port of Seattle terminal was evacuated because a couple of dogs gave a false alarm for explosives.

On August 19, a plane made an emergency landing in Tampa, Florida, after the crew became suspicious because two of the lavatory doors were locked. The plane was searched, but nothing was found. Meanwhile, a man who tampered with a bathroom smoke detector on a flight to San Antonio was cleared of terrorism, but only after having his house searched.

On August 16, a woman suffered a panic attack and became violent on a flight from London to Washington, so the plane was escorted to the Boston airport by fighter jets. "The woman was carrying hand cream and matches but was not a terrorist threat," said the TSA spokesman after the incident.

And on August 18, a plane flying from London to Egypt made an emergency landing in Italy when someone found a bomb threat scrawled on an air sickness bag. Nothing was found on the plane, and no one knows how long the note was on board.

I'd like everyone to take a deep breath and listen for a minute.

The point of terrorism is to cause terror, sometimes to further a political goal and sometimes out of sheer hatred. The people terrorists kill are not the targets; they are collateral damage. And blowing up planes, trains, markets, or buses is not the goal; those are just tactics. The real targets of terrorism are the rest of us: the billions of us who are not killed but are terrorized because of the killing. The real point of terrorism is not the act itself, but our reaction to the act.

And we're doing exactly what the terrorists want.

We're all a little jumpy after the recent arrest of 23 terror suspects in Great Britain. The men were reportedly plotting a liquid-explosive attack on airplanes, and both the press and politicians have been trumpeting the story ever since.

In truth, it's doubtful that their plan would have succeeded; chemists have been debunking the idea since it became public. Certainly the suspects were a long way off from trying: None had bought airline tickets, and some didn't even have passports.

Regardless of the threat, from the would-be bombers' perspective, the explosives and planes were merely tactics. Their goal was to cause terror, and in that they've succeeded. Imagine for a moment what would have happened if they had blown up ten planes. There would be canceled flights, chaos at airports, bans on carry-on luggage, world leaders talking tough new security measures, political posturing and all sorts of false alarms as jittery people panicked. To a lesser degree, that's basically what's happening right now.

Our politicians help the terrorists every time they use fear as a campaign tactic. The press helps every time it writes scare stories about the plot and the threat. And if we're terrified, and we share that fear, we help. All of these actions intensify and repeat the terrorists' actions, and increase the effects of their terror.

(I am not saying that the politicians and press are terrorists, or that they share any of the blame for terrorist attacks. I'm not that stupid. But the subject of terrorism is more complex than it appears, and understanding its various causes and effects are vital for understanding how to best deal with it.)

The implausible plots and false alarms actually hurt us in two ways. Not only do they increase the level of fear, but they also waste time and resources that could be better spent fighting the real threats and increasing actual security. I'll bet the terrorists are laughing at us.

Another thought experiment: Imagine for a moment that the British government arrested the 23 suspects without fanfare. Imagine that the TSA and its European counterparts didn't engage in pointless airline security measures like banning liquids. And imagine that the press didn't write about it endlessly, and that the politicians didn't use the event to remind us all how scared we should be. If we'd reacted that way, then the terrorists would have truly failed.

It's time we calm down and fight terror with anti-terror. This does not mean that we simply roll over and accept terrorism. There are things our government can and should do to fight terrorism, most of them involving intelligence and investigation -- and not focusing on specific plots.

But our job is to remain steadfast in the face of terror, to refuse to be terrorized. Our job is to not panic every time two Muslims stand together checking their watches. There are approximately 1 billion Muslims in the world, a large percentage of them not Arab, and about 320 million Arabs in the Middle East, the overwhelming majority of them not terrorists. Our job is to think critically and rationally, and to ignore the cacophony of other interests trying to use terrorism to advance political careers or increase a television show's viewership.

The surest defense against terrorism is to refuse to be terrorized. Our job is to recognize that terrorism is just one of the risks we face, and not a particularly common one at that. And our job is to fight those politicians who use fear as an excuse to take away our liberties and promote security theater that wastes money and doesn't make us any safer.

Incidents:
http://www.dailymail.co.uk/pages/live/articles/news/news.html?in_article_id=401419&in_page_id=1770 or http://tinyurl.com/k5njg
http://news.bbc.co.uk/2/hi/uk_news/england/5267884.stm
http://www.cbsnews.com/stories/2006/08/17/national/main1906433.shtml
http://www.cbc.ca/story/canada/national/2006/08/18/doctor-winnipeg.html or http://tinyurl.com/emnox
http://www.heraldnet.com/stories/06/08/16/100wir_port1.cfm
http://www.miami.com/mld/miamiherald/news/local/states/florida/counties/broward_county/15321870.htm or
http://tinyurl.com/s5oxe
http://www.usatoday.com/news/nation/2006-08-20-fbi-passenger_x.htm
http://www.theage.com.au/articles/2006/08/17/1155407916156.html
http://www.guardian.co.uk/uklatest/story/0,,-6024132,00.html
http://news.bbc.co.uk/2/hi/europe/5283476.stm
http://forums.worldofwarcraft.com/thread.html?topicId=11211166

There have been many more incidents since I wrote this -- all false alarms. I've stopped keeping a list.

The chemical unreality of the plot:
http://www.theregister.co.uk/2006/08/17/flying_toilet_terror_labs/print.html or http://tinyurl.com/eeen2
http://www.interesting-people.org/archives/interesting-people/200608/msg00087.html or http://tinyurl.com/etrl8
http://www.boingboing.net/2006/08/14/tatp_about_that_pyro.html
http://www.timesonline.co.uk/article/0,,2-2306994,00.html

http://www.cnn.com/2006/US/08/10/us.security/index.html
http://www.wondermark.com/d/220.html
http://kfmonkey.blogspot.com/2006/08/wait-arent-you-scared.html

This essay also makes the same point that we're overreacting, as well as describing a 1995 terrorist plot that
was remarkably similar in both materials and modus operandi -- and didn't result in a complete ban on liquids.
http://www.salon.com/opinion/feature/2006/08/17/airport_futility/

My previous related writings:
http://www.schneier.com/essay-096.html
http://www.schneier.com/essay-038.html
http://www.schneier.com/blog/archives/2006/08/terrorism_secur.html
http://www.schneier.com/essay-087.html
http://www.schneier.com/essay-045.html

This essay originally appeared in Wired:
http://www.wired.com/news/columns/0,71642-0.html

Wednesday, January 17, 2007

Exponential Growth

Just read a great article by Dr. Albert Bartlett on Arithemetic, Population and Energy. The main take-away is one that I'd learned a long time ago, but definitely needed a refresher.

Dr. Bartlett shows that if you want to figure out how long something takes to double, divide 70 by the annual growth rate and you'll get the number of years until you're doubled. An example of this is to consider inflation. At an average of 3% annual inflation, it will only take 23.3 years for all prices to double. Another example that Dr. Bartlett uses is population growth. At a nominal growth rate of 1.3%, the earth's population will double to 12 billion people in 53.86 years. The natural conclusion is that we'll need double the infrastructure that we have now in order to support the population in 53.86 years.

I did a few calculations of my own. In 53.86 years, given an average inflation rate of 3%, everything will cost 4 times more than it does now. Will wages follow this trend?

Fortunately, according to the US Census bureau the population growth of the US is 1.1% and is expected to drop to .54% between 2040 and 2050 with a final population projection of 392 million by 2050. Taking into account economic globalization and the fact that the global growth rate is higher than the US growth rate, it's readily apparent to me that the US isn't going to remain at the top of the heap forever in terms of resource utilization. This is causing a shift that's been apparent for many years where we see the manufacturing jobs leaving to other countries where they are cheaper. The consequence is that there is a greater and greater emphasis on education in the United States.

Interestingly, this all leads me to predict that eventually all manufacturing will come back to the US and that we'll be a global manufacturing superpower. Why? Consider that as the US population growth declines and levels off, our emphasis leans more and more towards being educated and using our minds to create things. Over time, the US will take the lead in lean process automation to the degree that we can manufacture things far cheaper than even the cheapest labor because we'll be able to do it without labor. Other countries will follow suit of course, but as long as we have an intelligent and informed workforce, the lead we gain while other countries lap up our manufacturing jobs, will enable us to permanently stay one step ahead of the rest of the world.