Archive for July, 2009


Christi: I’ve got [Facebook] friends in 6 countries. I bet you can’t say that.
Me: “I’ve got friends in 6 countries.” Gee, that wasn’t so hard.

Using only song names from ONE ARTIST, cleverly answer these questions. Pass it on to 15 people you like and include me. You can’t use the band I used. Try not to repeat a song title. Repost as “my life according to (band name)”

Pick your Artist:
Tori Amos

Are you a male or female:
Real Men

Describe yourself:
Father’s Son

How do you feel:
Bliss

Describe where you currently live:
Home on the Range

If you could go anywhere, where would you go:
Jamaica Inn

Your favorite form of transportation:
Taxi Ride

Your best friend is:
Muhammad My Friend

You and your best friends are:
Strange

What’s the weather like:
Spring Haze

Favorite time of day:
I Don’t Like Mondays

If your life was a TV show, what would it be called:
Pretty Good Year

What is life to you:
Bouncing Off Clouds

Your last relationship:
Heart of Gold

I came across a problem in Internet Explorer (it wasn’t a problem with Firefox) when I was trying to compare two strings. To me, one string looked to have an extra space in the front. No problem, I’ll just call the jQuery trim function. Well, that didn’t work. So I used charCodeAt and found it was ASCII character 160. I looked up char code 160 and saw that it is a “Non-breaking space”. You would think that a “space” character would be trimmed. I looked at the jQuery code that does the trimming and the grep pattern uses \s. So, evidently you can’t use \s to catch the “Non-breaking space” in IE. I wonder why no one else has seen this. I wrote up a test page to illustrate this.

To create the non-breaking space, you can use String.fromCharCode(160) or the Unicode representation “\u00A0″. “ ” doesn’t seem to work when using regular expressions, although it behaves the same when printed.

Browser Evaluates character 160 as white-space
Firefox 3, 3.5 Yes
Chrome 3.0 Yes
Internet Explorer 7, 8 No
Safari 3.2 No
Opera 9 Yes

Here’s my entry for the The Daily WTF‘s Programming Praxis: Russian Peasant Multiplication:

function peasant1(a, b) {
  var value = a & 1 ? b : 0;
  while(a > 1) {
    a >>= 1;
    b <<= 1;
    if (a & 1)
      value += b;
  }
  return value;
}

function peasant2(a, b) {
  var value = a & 1 ? b : 0;
  if(a > 1)
    value += peasant2(a >> 1, b << 1);
  return value;
}

function peasant3(a, b) {
  return a > 1 ? (a & 1 ? b : 0) + peasant3(a >> 1, b << 1) : a & 1 ? b : 0;
}

function peasant4(a, b) {
  return a & 1 ? value = a > 1 ? value = b + peasant4(a >> 1, b << 1) : b : value = peasant4(a >> 1, b << 1);
}

test

test

Unicode character 2026 – “Horizontal Ellipsis”

In Windows: Alt-0133

In Java: \u2026
Example:
String ellipsis = "\u2026";

In HTML: &#8230; or &#133; or &hellip;
Example:
… or … or …

In Javascript: \u2026
Example:
var ellipsis = "\u2026";
alert(ellipsis);

Ricola log: \u2026
Example:
Ricola.log.debug("\u2026")
will output 11:31:08 DEBUG - …

Ricola showPleaseWait: any of the HTML entities: &#8230; or &#133; or &hellip;
Example:
Ricola.page.showPleaseWait("Creating train documents&hellip;");

I love this kind of stuff.


Excerpts:

Wife
It’s a subclass of girlfriend that has unlimited access to your private members but doesn’t make good use of it, hogs all available resources, and spawns child processes that you aren’t allowed to kill off. – Pesto

School

This is the school my kids will eventually go to: http://www.ops.org/district/CENTRALOFFICES/BusinessServices/BuildingsandGrounds/SchoolhousePlanning/SaddlebrookJointFacility/tabid/957/Default.aspx

Our neighborhood had our first “annual” Fourth of July parade on Saturday. There was a much larger turnout than I expected. People lined their folding chairs along the route, which consisted of approximated 4 blocks. (It was down 151st street.) Crystal and Chris wore tiaras while Robb drove them in his convertible. That was funny. The kids rode in Rick’s trailer. The homeowners association gave out ribbons for the best decorations. People threw candy along the route even! Good times…

The weather last night was fabulous! I loved it! And the moon was so full and clear. It inspired me:
The moon is bright
On this beautiful Fouth night