Recycled QWA: javascript case randomize
Tuesday, 14 August 2007
<script type="text/javascript">//<![CDATA[
function curry (n) {
if ( n.nodeType == 3 ) {
n.data = scrambleCase( n.data );
}
var kids = n.childNodes;
var str = '';
for ( var i = 0; i < kids.length; i++ ) {
var ret = curry( kids[i] );
str += ret;
}
return str;
}
function scrambleCase (txt) {
var wordish = txt.split(' ');
for ( var i = 0; i < wordish.length; i++ ) {
var w = new Array ()
for ( var n = 0; n < wordish[i].length; n++ ) {
var letter = wordish[i].charAt(n);
if ( ( Math.random() * 2 ) > 1 ) {
letter = letter.toLowerCase();
}
else
{
letter = letter.toUpperCase();
}
w.push( letter );
}
wordish[i] = w.join('');
}
return wordish.join(' ');
}
//]]> </script>
This snake in the news
Monday, 13 August 2007
AP: Parker says snake in promo photo is real
I must admit skepticism. I mean look at it! So round. So smooth. Such unnaturally perfect curvature. Obviously firm to the touch. Cool with the promise of a hot crushing force once encoiled.
“I’ve been naked quite a bit, actually,” Parker said of posing for the photo. “You Google me, you’ll see it all.”
I’m especially grateful for this invitation. I’ve wanted to Google that woman cross-eyed since 1991.
Republicans + evolution
Monday, 13 August 2007
I don’t know why so many Republicans seem to have a problem with the notion of evolution. It presents pretty clear cut cases for–
- eating meat,
- letting the weaklings die,
- killing those who stand in the way of success,
- breeding, even when it kills the mother, and
- rape being a natural right of the more physically powerful and post-coital mobile gender.
One must assume if they’re still against it it might have something to do with their nature being–
- prey-like,
- weak,
- unsuccessful,
- impotent, and
- submissive in all encounters with bigger dogs.
Rejected because I’m gay?
Sunday, 12 August 2007
No. Because your apostrophes are typographically inept.
Why I can’t link to your site anymore: FriendlyAtheist.com
Saturday, 11 August 2007

…we can’t be sure “there is no God.” Atheists can only say they “don’t believe in God.” Friendly Atheist
We may not be sure that the Star Trek episode “The Trouble with Tribbles” wasn’t the single direct revelation this potentially real God has given to mankind either but I sure as fuck can say whatever I want about it including that it definitively was not. I can be so sure about it because it’s exactly as likely—and as ludicrous, though infinitely less dangerous—as the proposition from which it stems. I don’t have to qualify that jazz with any version of “belief.”
Addendum to the sworn affidavit given by one Max Cady –or– I can out diff you
Friday, 10 August 2007
| I ain’t no white-trash piece of shit. I’m better than you all! I can out-learn you. I can out-read you. I can out-think you. And I can out-philosophize you. And I’m gonna out-last you. | I ain’t no white-trash piece of shit. I’m better than you all! I can out-learn you. I can out-read you. I can out-think you. I can out-philosophize you. And I can out-breed you. And I’m gonna out-last you. |
Catalyst + TT + Unicode in template + Unicode in YAML config + POST = double encoding
Thursday, 9 August 2007
Nerd warning
This very nice module, Catalyst::View::TT::ForceUTF8, is an add and forget for handling utf8 problems with Catalyst and Perl. But even with it as the base for your TT2 view, you will get double encoded utf8 in your web pages on POST if you have utf8 coming into your template from a YAML config file. To fix this simply “use” YAML::Syck in YourApp.pm. It understands how to properly bring in utf8 and the double encoding should disappear.
US military deaths at 4,102
Wednesday, 8 August 2007
Just keeping you honest. Any bets for 5,000? How about March 15th of 2008. That seems philosophically right if overly aggressive.
Speaking of Afghanistan, it’s a great time to get in on the ground floor as a heroin dealer. Any economist will tell you that when production is hopping, the market will bear established prices until distribution channels expand. If we’d just invade Columbia my COCAN stock might finally take off.
PS: Cost of the War in Iraq — (JavaScript error)
Update
US anti-terror military death count JavaScript for your site.
I am totally, totally, totally in the wrong line online
Tuesday, 7 August 2007
As you can see, I am in the wrong line online. I should not be giving the extensible yum-yums away to an actively disinterested collective of myfaced wanna-be-has-beens. That with one post on Ajax I went to the top of 5.2 million web pages is proof positive I’m not just a fool but the kind of jerk-off who busts his anvs doing little graphics and ironic but accurate statistics for hours on end to please the 0.3‰ of surfers who are literate, libertine, and sober enough to understand, appreciate, and forgive the average article here.
I could just be writing simplistic advice and docs for stuff that is already widely covered and easily discovered. I’d probably be making Dooce money by now. So–
If y’all don’t start churning the butter for me, I’m’a closing out the terrah and nuclear bomb fun in favor of Idiots’ Guides to Acronyms1.
1 Oh, Jesus! Initialisms then. Asshat. Abbreviation is a perfectly serviceable word, incidentally, and more accurate for dipshit language maneuvers like PHP and XML.
The tree and the cherry apple and how far it falls
Monday, 6 August 2007
2 Year-Old
What did a pillow say next to a daddy?
Dad
What?
2 Year-Old
Interrupting cherry apple!
Dad
That’s the worst joke I’ve ever heard.
2 Year-Old
(Gleefully.)
I know!!
The Paedofinder General — YouTube week, day 6
Saturday, 4 August 2007
And here is where we separate the moo from the cow. Certainly not something I should admit publicly but Monkey Dust is my favorite show1. I eagerly await the SWAT visit I have initiated.
The show is brilliant but it’s not easy to get that from a clip. You need to see three episodes to understand. It’s not just that it’s the only carnivore out there without corks on its teeth. It’s also using a format—telling the same approximate story with the same characters over and over with different plots and props—which becomes psychologically infectious. But in a good way.
I recommend the Monkey Dust DVD for everyone but as of today it’s only available with region 2 encoding so you’ll have to check back if you’re in the #1 region instead of second place.
Planet of the Apes remixed as a Twilight Zone episode — YouTube week, day 4
Thursday, 2 August 2007
Act I
Act II
Act III
Thou shalt always remember lyrics are what make rock equal Bach — YouTube week, day 1
Monday, 30 July 2007
In the spirit of continuing publications in which I offer no original content–
Name my baby
Sunday, 29 July 2007
Help me avoid another letter from the state of Washington threatening to make a generic label final and legal as it takes another two months to name one of the Pond subdivisions.
This is what I’ve come up with so far–
- Curly
- Perfidy
- Trout Fishing In America
- Chocolate Pie Heart
- Spock
But that is by no means a definitive list and we leave it as an exercise for the reader to determine which the children came up with (hint, it’s only one of them). I am sure there are plenty I missed of which I should be made aware, my interstellar kittens.
OpenDevil » The Open Devil’s Dictionary
Friday, 27 July 2007
The first thing I had read online back in the early days of the WWW, c ’92, was The Devil’s Dictionary; well, that and ASCII schematics for explosives but that’s another tale. This led to The Devil’s Dictionary X, née The Devil’s Dictionary 2000 (DD2K) in late 1998.
The The Devil’s Dictionary X is somewhat popular—moreso than this part of the site. It’s been linked and quoted on other sites a couple of thousand times and even in a national newspaper in Australia; hey, it is a country.
I think everyone has at least one good satirical or humorous definition inside. Go post yours and make me rich, uh, I mean, realize your dream of being funny for once in your life.
The conversation eight months ago
Wednesday, 25 July 2007
Julie
I think I’m pregnant.
Ashley
That’s great.
Well, I’m off to finish your bottle of Scotch.
Blocking Cocks of Certain Persons Who Threaten Invisible Clothes Draped over Iraq
Tuesday, 24 July 2007
Brought to my attention in the stirrups this morning by my gynecologist, Father Dan. The short version–
“I, GEORGE W. BUSH, President of the United States of America, find that, due to the unusual and extraordinary threat to the national security and foreign policy of the United States posed by acts of violence threatening the peace and stability of Iraq and undermining efforts to promote economic reconstruction and political reform in Iraq…
“…all property and interests in property of the following persons, that are in the United States, that hereafter come within the United States, or that are or hereafter come within the possession or control of United States persons, are blocked…
“…(B) undermining efforts to promote economic reconstruction and political reform in Iraq or to provide humanitarian assistance to the Iraqi people…”
The explanation–
If you do anything, at all, the executive branch dislikes in regards to Iraq, they now have another unconstitutional power—all the others are holding up so don’t hope for anything else—to take away everything you own and ever will.
Kids… it’s just not funny anymore. 18 months to go, I believe. Of course, that’s just resetting the timer on another one of them… [read more]
And I thought American cops were bad shots
Monday, 23 July 2007
We already established what horrific shots American cops are, with a short range, enemy hit rate of 3% + a friendly fire rate of 1%. According to the following, US servicemen have a hit rate of 0.0004%. Too low to measure really. The friendly fire statistics might be similarly low but they are also a bit hard to obtain. Just ask Pat Tilman’s family.
Via Reason.
John Pike, director of the Washington military research group GlobalSecurity.org, said that, based on the GAO’s figures, US forces had expended around six billion bullets between 2002 and 2005. “How many evil-doers have we sent to their maker using bullets rather than bombs? I don’t know,” he said.
“If they don’t do body counts, how can I? But using these figures it works out at around 300,000 bullets per insurgent. Let’s round that down to 250,000 so that we are underestimating.”
“US forced to import bullets from Israel as troops use 250,000 for every rebel killed”
Yes, I know they say the rounds are expended in training and such and such. Still it seems to work out to 30,000 rounds per weapon or so. I think it’s taken me 10 years to fire 500 rounds in training. Perhaps the Marines are engaged in a lot of wedding, or its soldierly facsimile, celebratory fire.
Avoiding jQuery Ajax errors from leaving the page in the middle of a request
Sunday, 22 July 2007
I was having a problem with my jQuery Ajax on another site. The request went fine but if the user left the page before the request returned, it would call the Ajax error function. Frustrating since there was not necessarily any error, just the request was getting stepped on before it could return as successful.
Took quite a bit of searching to get the clues to figure out what to do. Since I could not find it as a “complete answer,” I present it here for the next sucker who is getting an Ajax error when the user leaves the page. The solution bits are in bold.
I don’t know for sure it’s cross-platform but it works great in Firefox and the most recent Safari.
<script type="text/javascript">//<![CDATA[
$(document).ready(function() {
function doSomething (arg) {
var myData = new Object({ "data":arg });
var req = $.ajax({
url: "/location/location/location"
,type: "POST"
,dataType: "json"
,data: myData
,success: function(json){ somethingSomething }
,error: function(xhttpreq,err){
alert("There was an Ajax error.")}
});
$(window).bind("beforeunload", function() {
req.abort();
});
}
doSomething("info to send");
});
//]]> </script>
