|
|
Wednesday, July 16, 2003 |
Unintentional Revisionism."We gave him a chance to allow the inspectors in, and he wouldn't let them in." -- George Bush, referring to Saddam Hussein, July 14, 2003. So now we're faced with a choice:
You decide! 5:23:10 PM |
Marriage != Children.I think the focus on "marriage equals children" as society's primary interest is dumb. The main good thing about marriage, from society's standpoint, is the creation of bonds that can substitute for government. If a person has no connections to other persons, then the government ends up picking up the tab for whatever happens. If there are strong bonds between persons (of whatever gender mix), then there are solid mechanisms in place to do the heavy lifting of responsibility. Marriage is really about creating bonds of duty and caring, between the two people, backwards and forwards through generations, and across families. Plain ole hetero marriages don't need to be the only way to do this. 5:04:26 PM |
Kata 6.Joey did it too, and I just couldn't resist. Here's Dave's Kata (Dave Thomas is a prof of mine from umpteen years ago). I was more interested in how fast I could get it to go under Java, since Java doesn't have a great reputation as a "cruncher" language. I haven't done all the tricks yet, but I think that this is pretty acceptable:
You can see the VM heats up after the first run...gets going nicely. Curiously, Dave says that there are 2530 there. I guess I found four more. Or maybe there's a criteria I'm not aware of. Pretty fast! Each of those runs also includes reading in the entire file -- I didn't optimize out the read. My machine is an AMD 2.5Ghz. Those times are using JDK 1.4.2. When you consider that this is also doing full character translation (byte-->char), it's pretty impressive. Here's my slightly scrambled answer, in case you want to do it for yourself first. Just format this in your favorite editor and you can read it. import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; final public class Anagramer { public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.gc(); go(); } } public static void go() { try { HashMap letterCounts = new HashMap(); ArrayList anagrams = new ArrayList(); BufferedReader b = new BufferedReader(new FileReader("c:/wordlist.txt")); int wc = 0; long startTime = System.currentTimeMillis(); String word = b.readLine(); while (word != null) { word = word.toLowerCase(); if (word.length() > 0) { wc++; //if (wc % 1000 == 0) { // System.out.println( // "Process " // + wc // + " words; found " // + anagrams.size() // + " so far."); //} LetterCount check = new LetterCount(word); LetterCount lc = (LetterCount) letterCounts.get(check); if (lc == null) { letterCounts.put(check, check); } else { if (lc.addWord(word)) { anagrams.add(lc); } } } word = b.readLine(); } System.out.println("Discovered " + anagrams.size() + " anagrams in " + (System.currentTimeMillis() - startTime) + " ms in " + wc + " words."); b.close(); //for (Iterator iter = anagrams.iterator(); iter.hasNext();) { // LetterCount lc = (LetterCount) iter.next(); // System.out.println(lc.toString()); //} } catch (FileNotFoundException e) { } catch (IOException ie) { } } static private int[] generateCount(String word) { int[] ret = new int[26]; for (int i = 0; i < word.length(); i++) { char c = word.charAt(i); if (c >= 'a' && c <= 'z') { int code = (int) c - (int) 'a'; ret[code]++; } } return ret; } final static class LetterCount { String firstWord; int[] counters; ArrayList words; int hash; public LetterCount(String word) { counters = generateCount(word); firstWord = word; int h = 0; for (int i = 0; i < counters.length; i++) { h = 31*h + (counters[i]+'a'); } hash = h; } public String toString() { String result = firstWord; if (words != null) { for (Iterator iter = words.iterator(); iter.hasNext();) { String word = (String) iter.next(); result = result + " " + word; } } return result; } public boolean addWord(String word) { if (words == null) { words = new ArrayList(); } words.add(word); return words.size() == 1; } public boolean equals(Object obj) { if (((LetterCount)obj).hash == hash) { for (int i = 0; i < counters.length; i++) { if (counters[i] != ((LetterCount) obj).counters[i]) { return false; } } return true; } else { return false; } } public int hashCode() { return hash; } } } 4:59:03 PM |
The War on Criticism.That is freakin' funny. Read and die laughing. 3:10:32 PM |
Don't Go!Mike: What you perceive as your own "bone shaking" the rest of us perceive as vigorous argument. I think you are applying far too rigid of a standard to yourself. A vehement discourse is fine and proper, if accompanied by an open mind. You seem to come complete with open mind. Therefore: No problem. The Right has had its day/year, since January of 2000 -- dictating what they felt was the truth, disparaging what they thought they should. The timeline is starting to catch up to them. It's becoming easier and easier to apply the scientific method...what did they say? Were they right? What were the consequences? This is a good level of discourse. A properly functioning opposition in government works that way. In this society, YOU are the properly functioning opposition. There is dignity and responsibility within that role. 2:16:40 PM |
Just4Log.I need to agree with the BileBlog. All this class modification crap is going on because there's some basic stuff that's just missing from the Java VM. In the case of Just4log, it's all about the fact that the VM doesn't do lazy evaluation of what's passed in. The VM certainly could do this, although that might break the Java spec. Is the VM allowed to NOT evaluate an argument to a function if it can prove that it is not needed? Does the spec require that the side effects occur? Languages like Haskell explicity make every expression lazy. The compiler and runtime are free to avoid evaluation of just about anything they want to. Of course, you can force evaluation. 2:03:23 PM |
Short Term Memory.Thanks to Calpundit for the link to Walter Pincus' timeline of Bush Administration statements on Iraq's nuclear capabilities. It's become more and more apparent to me that developing some kind of longer term attention span is critical to the functioning of this democracy. What Bush and company say really matters. When they say it matters too. We need more timelines like Walter's. This isn't about a game of "gotcha". It's about figuring out in more detail who's spinning, making it obvious, and pointing it out when it happens. It's about creating a little noise when distortions are occurring. The reason we want to do this is obvious: If distortions of the past become more obvious and more embarrassing, then they'll happen with less frequency. We'll have more honesty from our politicians. Right now these folks have been counting on short term memories to do their dirty work. Blogging is one mechanism for routing around that problem -- the larger analysis and memory of the blogging community is doing wonders. I believe that more direct methods may be important. Not coincidentally, some of my own research work is oriented in this direction. I am very interested in interlocking timelines and dependencies. How do we manipulate this kind of information effectively? How do we visualize it? Stay tuned. 1:58:54 PM |
Overclocking.There are two conventional barriers that apply to overclocking mainboards. First, the circuits usually have timing limits that prevent them from being used beyond certain boundaries. Errors often increase as these boundaries are approached. Second, there is the heat dissipation problem -- as chipsets are run faster and faster, they lose their ability to discard all the heat being generated. I was just thinking that what we need is a "continuous" overclocking feature, as a standard part of the motherboard. Rather than operate at just one speed, set in the BIOS, the OS monitors the usage state. When the system is idle, processor and bus speed can be "idled down", to save power and reduce heat. My laptop computer already does this with processor speed; why can't it be applied to the bus speeds as well? If heat starts to become a problem, the system can automatically reduce the speeds and dissipate heat faster. The advantage here is that when the system is under heavy load, we can deliver a "burst" of extra power right when it's needed, perhaps speeding up the CPU and bus by a significant percentage. At the conclusion of the activity or when measured conditions merit, both are retarded. Most computers spend most of their time idling. During idling we could potentially dramatically reduce bus speed and processor speed. Let's hope that a motherboard manufacturer tries this! The only question is, what parts of the OS need to be aware of a continuously variable timing on the bus? Most should already be largely immune to changing processor speeds, because laptops have been doing that forever. 1:16:16 PM |
Above the Law.Seems like Paul Bremer is about to establish military tribunals in Iraq, the purpose of which is to prosecute war criminals. I recognize that some sort of justice system is going to have to be imposed here, and that it's very hard to avoid it being a messy affair. At the same time, it's something of a minefield. First, military tribunals are something that a civilized nation should really try to stay away from. This administration has moved swiftly to use them, because they're more convenient. It's something of an affront to justice, though, and to my mind really needs to be a last resort. Second, the Bush administration refuses to participate in any agreement on war crimes that might put US officers at risk for trial. How can the US government talk out of one side of its mouth, declaring its intent to put Iraqis on trial for "war crimes", and out of the other side of its mouth, proclaim that no US citizen can be prosecuted in a similar manner. If the US is going to opt out of war crimes, it ought to opt out of prosecuting them as well. What this all points to is the fact that the Bush administration is not particularly interested in the letter or spirit of the constitution. They're interested in what they (probably honestly) see to be the best available path. They truly cannot understand why the entire country just doesn't "trust them" to do the right thing. They don't intend to trample of freedoms; it just happens from time to time. A skeptical observer notes that just about all the broad strokes of the Bush administration are based on the notion that we must do counter-intuitive things to achieve good results. We must provide extensive tax cuts to the rich in order to get economic growth. We must defy and anger the world to achieve success in the war on terror. We must ignore the concerns of the world on environmental issues to create a cleaner environment. The problem is that this "faith-based" political movement is beginning to break down. We take the President's word that his programs will create jobs; he has a right to try them. We take the President's word on a lot of things. What we're finding is that there is a significant probability that they're just plain wrong. They've been wrong on the economy. None of the job gains predicted have materialized. The recession is as bad as ever. Unemployment is at a 20 year high. Much of the world distrusts the US, an astonishing change from only two years ago. We have spiralling deficits, that are predicted to go ever larger. We have an ascending cost of occupation in Iraq. Looks like they're wrong about a lot of things, and maybe it's time to start treating Presidential pronouncements with an appropriate level of doubt. 11:23:29 AM |
Selecting Facts.Yes, SUVs now have defenders (http://www.suvoa.com)! These are people who can't really think of anything much better to do than declare their allegiance to vehicles that are wildly inappropriate for most of the tasks that they're put to, and directly contribute to a whole host of problems that we face today. I will grant that absolute tailpipe emissions and absolutely mileage really do make a difference -- if someone produces an SUV that acts essentially like a car in this regard, I don't really have too much of a problem with it. Let's examine some of their "facts": "Federal government and insurance industry safety data show SUVs are considerably more protective of their occupants than the average passenger car in the most common types of crashes" -- sure they are. They're big steel cages. What they're NOT saying is that those same federal studies show an overall INCREASE in highway deaths...because SUVs do a much better job of killing the OTHER guy in an accident. Yes, a single man in a Ford Expedition can very easily kill off an entire family with a lower income, who couldn't play in the safety arms race. "Americans enjoy the fruits of their labor with almost 24 million boats, ATVs, horse trailers, towed RVs, snowmobiles and off-road motorcycles" -- sure, and a very small number of these same vehicles actually require any sort of large towing capacity. Most small vehicles are easily capable of towing smaller recreational vehicles. What we would really like to know here is how many SUV owners actually use their SUV to tow anything. I personally can't think of one person I know who uses the SUV for anything other than a trip to the mall. "About half of the respondents in a recent poll use their SUV regularly to haul tools, appliances and other bulky items that just won’t fit into cars." Without defining "regularly", we know nothing. The fact is that somehow people got along for fifty years without having SUVs, and somehow their tools and toys got to where they needed to be. "hospitals often put out the call for volunteers with four-wheel-drive vehicles" -- This is a reason that we should have everybody driving SUVs? Please. This is such bottom-feeding. The vast majority of SUVs on the road are pieces of crap and don't handle in snow significantly better than an AWD car. Why? They're all running on all-weather tires. I'll take a car with snow tires over an SUV anyday, if I'm driving in the snow. "Since the mid-1970s, the fuel economy of SUVs and light trucks has improved by nearly 60 percent". Super fantastic. So they've improved nowhere near as well as other segments of the fleet of vehicles. Do we really want to be benchmarking ourselves on 1970s vehicles? "Replacing all of the SUVs to be sold in 2003 with passenger cars would save one day’s worth of oil in this country. But because SUVs are more protective of their occupants in the vast majority of crashes compared to cars, the death rate on our nation’s highways would unquestionably increase" - Bullpucky. It has been well established that SUVs do a better job of protecting their occupants, at the expense of killing other people. With smaller cars on the road, we'd save oil AND have fewer highway deaths, overall. "A 2004 Ford Explorer or Chevy Trailblazer, two of the most popular SUVs, will pollute less driven from Washington, D.C. to Los Angeles and back to Washington, D.C. than a 1967 station wagon driven one-way from Washington, D.C. to Baltimore" -- The stupidest statistic on the site. How does that same SUV do in terms of emissions and pollution when compared to, say, a Toyota wagon, or a Jetta wagon? Like crap, of course. As with just about everything, it's what ISN'T said that's important. Most people don't really have all that much of a problem with the little SUVs...they suck for gas mileage compared to their car counterparts, but they really don't go around killing people. What pisses a lot of people off are the idiots driving to the mall in Ford Expeditions, for no reason. Those things get around 7mpg, kill people all over the place, and have to be PAID FOR WITH MY TAX DOLLARS BECAUSE WE HAVE TO INVADE STUPID MIDDLE EASTERN COUNTRIES TO KEEP THE GODDAMN OIL COMING. Do you get that? 11:23:02 AM |
