Dec
18
2005
Okay, when I say “Neocon”, I mean “Neoconservative”, which Republican drones have taken to calling “Big Government Conservatives” now that the libertarian conservative branch has all but completely defected. The revelation that Bush personally turned the military espionage agency against American people in blatant and thorough violation of due process, the Bush administration refusal to compromise on the most abhorrent parts of the Patriot Act, and the Bush nominees for Supreme Court have all driven that wedge deeper and deeper between Republicans and the libertarian “paleocons”.
BTW, the phrase “Republican drones” is not to imply that I don’t believe in Democratic drones…I’m just not talking about them right now.
Popularity: 3% [?]
Dec
16
2005
I just had code handed to me by an employee who wrote during his 2 weeks notice. We encountered a bug in one of his classes, and since I was writing JUnit tests anyways, I figured I would do a bit of clean-up.
What I didn’t realize is that Ocaml has warped me, and my concept of “cleanup” is very different than everyone else’s.
This is the original code:
public static String[] findAvialable(int startValue, int endValue, String[] usedValues) {
ArrayList values = new ArrayList();
int total = endValue - startValue + 1;
for (int i = 0; i < total; i++) {
int currentValue = startValue + i;
boolean used = false;
for (int j = 0; j < usedValues.length; j++) {
if (Integer.parseInt(usedValues[j]) == currentValue) {
used = true;
break;
}
}
if (!used) {
values.add(new Integer(currentValue));
}
}
String[] result = new String[values.size()];
for (int i = 0; i < result.length; i++) {
result[i] = ((Integer)values.get(i)).toString();
}
return result;
}
This is what I did to it after “cleanup”:
/**
* Returns a string array consisting of all the integer values between two points
* whose string representation is not in usedValues.
*
* @param startValue int The minimum allowed value (inclusive).
* @param endValue int The maximum allowed valued (inclusive).
* @param usedValues String[] The String representation of the used integers, or null.
* @return String[] The String representation of the available integers.
*/
public static String[] findAvialable(final int startValue, final int endValue,
final String[] usedValues) {
// Validate some assumptions
if (startValue > endValue) {
throw new IllegalArgumentException(”Cannot have a start value greater than the end value”);
}
// Cache a repeatedly calculated value
final int length = endValue - startValue + 1;
// Handle a simple case
if (usedValues == null || usedValues.length == 0) {
final List out = new ArrayList(length);
for (int i = 0; i < length; i++) {
out.add(Integer.toString(startValue + i));
}
return (String[])out.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}
// Validate usedValues for the complicated case
if (Arrays.asList(usedValues).contains(null)) {
throw new IllegalArgumentException(”Used values may be null, but may not contain null”);
}
// Create a set of used values as Integers.
final Set used = SetUtils.transformedSet(new HashSet(length), new Transformer() {
public Object transform(final Object object) {
return new Integer(Integer.parseInt(object.toString()));
}
});
// Add all the used values
used.addAll(Arrays.asList(usedValues));
// Create a list of values we can use
final List avail = ListUtils.transformedList(new ArrayList(length),
TransformerUtils.stringValueTransformer());
// Add those possible start values that
for (int i = 0; i < length; i++) {
final Integer iObj = new Integer(startValue + i);
if (!used.contains(iObj)) {
avail.add(iObj);
}
}
return (String[])avail.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}
The sick part is that I didn’t even realize how functional that code was until I walked through it.
Popularity: 2% [?]
Dec
14
2005
I’ve been a fan of conspiracy theories for a long time. I don’t buy them — they’re usually a thinly-veiled attempt to validate some already existing opinion. But, despite that, I find them fascinating, because they explore ways in which wildly disparate things could be connected. I find it works like a kind of reality limbering exercise without resorting to drugs. So, because of this, I’ve studied all kinds of wacky conspiracy possibilities, but I never actually encountered the 9/11 conspiracy theories.
Yeah, I knew there was plenty of “Bush chose to not prevent them” talk (strengthening the 9/11 and Pearl Harbor analogies). I knew there was plenty of “Bush was too stupid to address Al Qaeda” talk. I certainly knew there was a lot of “Bush milked 9/11 for all its worth” talk. I even knew there was the ever-popular $20 trick.
I never knew there was “Planes didn’t drop the towers” talk:
http://www.lewrockwell.com/reynolds/reynolds12.html
I didn’t know there was “the Jews did it” talk, although I’m not surprised:
http://www.prisonplanet.com/analysis_lavello_050503_bombs.html
I didn’t know there was “there was no plane” talk:
http://www.asile.org/citoyens/numero13/pentagone/erreurs_en.htm
My second favorite site is the precursors:
http://www.metatech.org/911_conspiracy_world_trade_center.html
My all-time favorite is the “All the Conspiracy Theories are a Conspiracy by the Jews” theory:
http://www.oilempire.us/bogus.html
And I bumped into these people, who seem fun: http://www.csicop.org/hoaxwatch/
Popularity: 2% [?]