Bulldozers and Spatial Cognition

Suppose you want to take a picture of yourself laying down in the mud in front of a bulldozer. What side should the bulldozer be on when you take the picture?

Does the directionality of a person’s primary writing system (left-to-right, top-to-bottom for English) affect the way in which they take in other compositions, such as a photo or painting, creating a “perceptual directionality”? If so, should visual composition be informed by knowledge of the target audience’s perception directionality? After a brief search I came up with this paper, which seems to indicate that I’m not too far off the mark.

Writing Direction Influences Spatial Cognition


Now that doesn’t exactly answer the original question, although it does inform the decision of how to compose the shot.

PHP apparently lacks a function to return the byte length of a string, such as you might need for a Content-Length header. Assuming your PHP internal character encoding is a single byte charset (such as latin1 / “ISO-8859-1″) then the answer is the same as your character count and you could use strlen(). This is the default (in the US anyway) and will of course break should you ever change the internal encoding to a multibyte charset like UTF-8 and use the mbstring.func_overload faculty to transparently replace the non-multibyte functions with their multibyte equivalents.

In that case, mb_strlen() becomes strlen(). mb_strlen() is strlen() with support for different charsets, which may use different byte lengths for a single character. By default, it will use your internal encoding. However, it supports an explicit character encoding as its second parameter. Knowing that latin1 uses a single byte, mb_strlen($string,’ISO-8859-1′) will do what we want and count the bytes in $string regardless of your current internal encoding or the string’s apparent encoding.
Let’s wrap this in a function for clarity, and in case we need to change our counting method because of a change in PHP or some such helpfullness:


function bytelength ($string) {
// Returns: (int) number of bytes in string
// Use latin1 as a alias for "1 byte"
return mb_strlen($string,'ISO-8859-1');
}

MySQL Query Browser: nice fonts with UTF-8 support

Due to (a bug in) the way fonts are rendered in the “SQL Query Area” of the MySQL Query Browser[1], most of the fonts available end up looking clipped. Beyond aesthetics, you might want to change the default font due to its lack of support for UTF-8 characters. You can change the “Code Font” choice under Tools > Options > General Options.
I prefer Arial Unicode MS 8.3pt for default & data, but due to it rendering poorly in the code area I’m using Bitstream Vera Sans Mono 8pt as a tolerable alternative. Both support UTF-8.
[1] MySQL Query Browser 1.2.17 on Windows XP.

Test more PHP!

It’s not just an admonishment, it’s the name of a project I maintain at code.google.com.

test-more-php version 0.1 is out now and ready to help prevent hours of debugging with so little effort it’s ridiculous not to use it. The API is a direct port of the popular Perl Test-More library with some minor PHP adaptations. Both object and procedural interfaces are available, so pick your flavor and get coding!

I started test-more-php after getting sucked into writing PHP full-time and casting about for a testing library with the elegance I knew from Test-More. Eventually I discovered a few, but each was incomplete or failed me by silently bailing on an error that could have been reported appropriately. Test-More.php is a drop-in replacement for those other libraries and provides me with the confidence that, if something goes wrong, I will know about it.

I’ve tested it under Windows XP, Ubuntu Linux, FreeBSD and Cygwin but not OS X, so if anyone with a Mac wants to take it for a spin please let me know how if it passes all it’s tests. (Of course it comes with its own test suite!)

The power of not being all things to all people

The title of this post at dagolden.com really struck me. The post, about a new CPAN client that doesn’t mimic the “swiss army chainsaw” mentality of the Perl community’s approach to software design, is apt in its critique not only of the project itself, but of its reception by the community. There is a religious type zeal some people express when shifting their allegiance from one idea to another that seems to compel them to attack the subject of their former allegiance.

Douglas Crockford — The JSON Saga

This talk by Douglas Crockford, standard bearer of JSON, is an interesting history lesson on JSON’s origins. Douglas provides plenty of amusing perspective on JSON’s position as the popular data interchange format it has become and the landscape it evolved in. He seems to enjoy taking a “heretical” perspective, which is usually more fun to listen to in a tech talk, and this is no exception.One recurring theme that caught my attention was the aspiration to simplicity in the format, especially in comparison to xml. It’s a lesson worth revisiting.

googleapi.com, Firefox 3, <script … /> and security

Public service message: firefox 3 does not play well with self closed script tags.

I discovered this when I was repointing my jQuery libraries toward the googleapis hosted versions, to take advantage of their speed. I tested the switch in Opera, where it looked fine. Later, doing some debugging with firebug, I noticed those pages were no longer executing any javascript. Chrome had no problem loading them, and initially I thought the jQuery lib was the issue, but curling a new copy proved it was identical to my locally hosted version. Finally I noticed the difference in how I had self closed the script tags, which is perfectly legal… firefox 3 just doesn’t like it.

So I like the ajax.googleapi.com hosted libraries, although I don’t buy that using the google.load() method is better than pointing to the hosted library directly. Profiling the difference between two pages that do nothing more than load jquery shows that using google.load() adds about 0.2 seconds to the load time. Try it yourself:
Pointing directly vs Using google.load(). Which only makes sense, since loading the google api takes time… so where is the extra “power” they boast you receive by using this method? The only potential advantage I see is the ability to load the library conditionally, avoiding the load unless you need the library. I say potentially because I’ve yet to make use of that kind of just-in-time loading. If you have, or I’ve overlooked some strength to this method, I’d love to hear it.

One last googleapi related note: using a script tage to call your library, you can use https to load the file. The google.load() method appears to load files using http, which is quicker but poses a security risk by injecting insecure code into a supposedly secure environment. This is the same reason secure method pages should use the secure-only flag on cookies: you are only secure as your weakest link.

One install, multiple deployments: phpMyAdmin

I’ve been running more PHP apps for virtualhosts lately, and one thing I dislike about such bundles is having a config file in the app root. For one, it’s sitting in the web root, and if improperly configured the server could serve it as content, posing a security risk (as they tend to hold database login information, passwords, etc.) The other reason is that I like to maintain a single copy of the app (via the FreeBSD ports tree, or from a single repository checkout.) I don’t want to make copies, because then I need to maintain each copy too, and I can’t just set the primary installation directory as the server document root, or alias a subpath to it, because each deployment would receive the same default config file. Any modifications to the application code, to make it look elsewhere for the config, would likely be lost in the next upgrade. So how can you share a single installation for multiple deployments?

The key is that the config file itself is usually left as-is during upgrades, as it is supposed to be altered by the user. We use this file to include another config file from elsewhere based on webserver variables.

For example, here is my config.inc.php for phpMyAdmin:


<?php
/*
Delegate to another file.

Set web server variable PHPMYADMIN_CONFIG_FILE to the file that would normally be located here (config.inc.php).
Under Apache, it would look like this:
SetEnv PHPMYADMIN_CONFIG_FILE /usr/home/rj/.phpmyadmin
Include the absolute path, or make sure the file is in the PHP include path.
Ensure that the file is readable by the account the web server runs under.

*/
include($_SERVER['PHPMYADMIN_CONFIG_FILE']);

?>

You now just need two lines in a virtualhost config to set up a new installation:

SetEnv PHPMYADMIN_CONFIG_FILE /usr/home/$USER/.phpmyadmin
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"

Of course, you still need to set up each .phpmyadmin file, but that’s easy enough. Of course, if you’re deploying lots of similar database setups, you could also use the virtualhost config to set up the configuration and re-use a common config.inc.php tweaked to use server variables (PHPMYADMIN_HOST)… but I’ll leave that as an exercise for the reader. Avoid passing passwords this way, however, as server configuration variables are another potential data leak.

Computer Clubhouse

Started by the MIT Media lab in 1993, Computer Clubhouse is a computer focused after-school program with 100 chapters worldwide.

The Computer Clubhouse provides a creative and safe out-of-school learning environment where young people from under-served communities work with adult mentors to explore their own ideas, develop skills, and build confidence in themselves through the use of technology.

Their learning model principles:
1) Learning by designing
2) Following your Interests
3) Building a Community
4) Respect and Trust

Computer Clubhouse also has programs focused on women, and guiding participants on college/career paths.

Computer Clubhouse Site

Scratch: Programming language for 8 and up

Here’s a neat tool created by the MIT media lab. It makes creating little flash type animations simple enough that a literate person with no programming experience could do it, all the while learning the basic concepts of programming. Calling it “Logo 2009″ wouldn’t be far off.

Scratch is a new programming language that makes it easy to create your own interactive stories, animations, games, music, and art — and share your creations on the web.

Scratch is designed to help young people (ages 8 and up) develop 21st century learning skills. As they create and share Scratch projects, young people learn important mathematical and computational ideas, while also learning to think creatively, reason systematically, and work collaboratively.

Scratch website
Introduction to programming and Scratch (Harvard CS50 Lecture 2)

Drizzle: a patchy MySQL

MySQL director of architecture Brian Aker provides the scoop on Drizzle in a short video interview. If you’re a MySQL user, and especially if you hadn’t heard about Drizzle, and extra especially if you had any concerns about MySQL’s future due to the recent Sun acquisition by Oracle, you should check this out.

Here are my takeaways:

  • Drizzle uses a modular system akin to Apache to remain light(er) weight and highly tweakable. Sweet!
  • It focuses on convenience of community based development, i.e., Drizzle is viable even if Sun decided to defenestrate the MySQL team.
  • Big names are putting time into supporting Drizzle development too.
  • MySQL is pronounced My-S-Q-L

Post at bartongeorge.net

Oz in the evening

Having found many of the works of Frank L. Baum available as free audio books via the awesome Librivox, we have been downloading them for the kiddos to listen to in bed at night. Check out the wikipedia article for a full list of Oz books (including cover art!) Librivox also provides links to relevent wikipedia entries, archive.org content, and even a “Chapter a day” service you can subscribe to.

The Wonderful Wizard of Oz

Librivox Search for “Frank L. Baum”

OMGWeDisagree! My position on productive disagreements

More than once, especially in discussing something in correspondance, I’ve want to have something I can easily cite that explains my perspective on disagreements, discussions, and how I percieve them. Here’s a rough cut.


We disagree! (Probably. At the moment. About a likely very small subset of topics.)

You think I’m wrong? That’s OK with me! I’ve been wrong before, so this wouldn’t be the first time. You have good reason to assume that you’re probably right and that I’m wrong. So do I, even if I’m actually wrong! But I certainly prefer to be right. Hopefully you want to help me understand why I’m wrong, and can spare a few moments to set me straight; then we can both be right. *High fives!!!*

Here is where I’m coming from:

  • I have opinions. These are like theories, in that they’re simply the a general rule I cobbled together from anecdotal experiences.
  • I have “knowledge” about “facts” which are opinions about “reality” highly corroborated by “evidence.”
  • I find knowledge and opinions useful in making decisions. I want to have useful knowledge and opinions, which means ones that are most accurate. This is why, if I”m wrong, I want you to tell me! Just do so in a helpful way, by pointing out which opinions are wrong and then showing me what refutes them.

This is where we stand:

  • We might not actually disagree. We might realize, in explaining our positions, that we’re just talking about the same thing in different ways. I can’t tell you how many times this has happened!
  • We might question the evidence. Let’s be honest, there is a lot of bad “evidence” out there. I tend to trust certain sources more than others, and you probably do too. Perhaps we can agree on some sources. That would make this a lot easier! For example, I tend to reference snopes.com whenever someone asks me to forward a chain message so they can get a free laptop from Microsoft/Dell/Disney/Facebook/etc. If we don’t agree on a source then it isn’t useful in our discussion. We could debate a source’s validity, but that’s a whole different discussion.
  • We might question the logic used to present the evidence as supporting or refuting our opinions. Let’s be honest, it’s not uncommon for people to make a mistake in logic. Also, lots of people get paid to make highly convincing but fallacious logic (we call them “magicians,” “marketers,” and “con artists” among other things.) I wouldn’t fault anyone for falling prey to a reasonable sounding fallacious argument; sure, I’ve done that too! Perhaps we can take a closer look at the logic behind the evidence.

I’m also open to the idea that it can be useful to hold opinions that aren’t based on evidence. I only oppose these opinions when they contradict legitimate evidence, because then they lead to making bad decisions. That’s not useful… in fact, that’s can be dangerous!

When I’m wrong: it might take me some time to accept that, especially if I’ve invested an time or effort into projects that you’ve now shown to be misguided, flawed, pointless or, at worst, counter to my benefit. While I want to find out if I’m wrong, I don’t enjoy being wrong, and I actively dislike dealing with the consequences, because it might take effort to adjust to my newly enlightened position. BUT! I would rather make the necessary adjustments than continue to put my energy into the wrong investments. Just allow me some space while I’m adjusting. I’ll try not to get too cranky. Note: gloating is an invitation for me to openly question your lineage and olfactory prescence.

If you don’t want to discuss it: I’ll be irritated. You’ve basically said to me “Hey, there’s a problem with your model of the world, which might get you into trouble, and I know what the problem is, but I don’t want to bother helping you get things straight.” It’s frustruating to be taunted like that, and I hope you understand why I dislike it.

So hey, I don’t dislike you just because we disagree. Quite the opposite: I rely on my friends to point out when I’m wrong, because although that’s fair game for anyone, my friends are the ones who help set me straight. Thank you for your time, I appreciate it!

By the way, I tend to assume that this is generally your policy too. If it isn’t, let me know, and why. Perhaps I’ll amend my own policy, if yours is more useful!

Teen Decomposes Plastic Bag in Three Months

Teen Decomposes Plastic Bag in Three Months

“Plastic takes thousands of years to decompose — but 16-year-old science fair contestant Daniel Burd made it happen in just three months.

The Waterloo, Ontario high school junior figured that something must make plastic degrade, even if it does take millennia, and that something was probably bacteria.”

Now in mint

Dirt: The New Prozac

Dirt: The New Prozac

“Some researchers have proposed that the sharp rise in asthma and allergy cases over the past century stems, unexpectedly, from living too clean. The idea is that routine exposure to harmless microorganisms in the environment—soil bacteria, for instance—trains our immune systems to ignore benign molecules like pollen or the dandruff on a neighbor’s dog. Taking this “hygiene hypothesis” in an even more surprising direction, recent studies indicate that treatment with a specific soil bacterium, Mycobacterium vaccae, may be able to alleviate depression.”

[Note: This is from March 2007]

Moon

I am rejoicing in the upswing of philosophical sci-fi. Action sci-fi is nice, but I like cake with my frosting, and sometimes a good cake doesn’t need any frosting. Moon gets extra points for stopping where Sunshine should have.

Also, another great Clint Mansell score.

Back(wards) in the saddle again

Who would have thought working two jobs would impact my opportunities to maintain my own projects? *facepalm* Well, I’ve bought back 10 hours per week… what to do first, hmm… *heads to bed*

Guess the poem!

There was an old mariner of yore,
whose trip started out as a bore,
then the silly old fuck
shot the bird of good luck
and he barely made it back to shore.

There once was a girl who got moany
just because she wanted a pony
but her `rents shook their heads
and the girl’s life force ebbed
and now her parents are aloney.

There once was a guy at the door,
and a confused exchange, and what’s more,
the exactlywatt
had a chain through his gut
and I never could figure what for.

There once was a fridge, and a bear,
and some butter, some paws, and some hair
and soda, and rice,
and noodles, and ice,
and a kid due for more than a scare.

Sorry, I was inspired by Bad Gods’s Famous Poems rewritten as limericks.

Blipfest 2008 was 1k+ chipsterrific

Saturday DJ Quiet and I made our way to NYC for the third night of BlipFest 2008. It was awesome, and next year I intend to secure lodging in the city for the whole shebang.

BlipFest is an annual chiptune music fest. Chiptune is a section of music space where the audio pallettes set forth by the limited capabilities of (early) videogame sound chips is employed. It often blends with less restrictive forms of music composition and performance; instead of a static score, some of the song might be performed live on a (necessarily custom built) instrument that generates sounds in this range. All manner of mixing equipment and community/custom programs is employed. It also lends itself to trippy, pixelated visual art and videogame “remixes.” Blipfest brings together some of the best chiptune artists (some all the way from China) and great visual artists to accompany them for four nights of awesome.

Anyway, after some Googlemap induced mishaps we found our way to the venue in Brooklyn, which was nice if small for what ended up being a sold out show. We came in at the beginning of Bubblyfish‘s set, which I recognized as her cover of Kraftwerk’s “It’s more fun to compute” off the 8 Bit Operators comp although I hadn’t connected the song and the performer until that point. It was my favorite set of the night, probably pushed to the top by the Bubblyfish’s exuberence and the visual mixing backing her up. It was also the most dancable set. What live music I’ve caught since becoming a parent hasn’t gone much beyond inducing the jump and cheer, and I hadn’t even anticipated a mosh pit at this event, but by the end of the (all too short) set I was happy to pay the $2 to check my hoodie and sweatshirt so that I didn’t have to make the homeward journey in the snow while soaked from the inside out.
The rest of the night kept the energy up, with sulumi, Cow’P, nullsleep and Stu gracing the stage before I left in an attempt to make the 1:49 train back to CT. The visual art was also perfectly done for the scene, and the crowd was full of fans there to enjoy the performance, not the venue drinkers who could care less who was on stage or jerks there to start shit as I have grown accustomed to. I even got to see, albeit briefly, the one cousin I seem to share a taste in music with. I look forward to Blipfest 2009 and intend to catch some more chiptune shows in the meantime.

For tons of free chiptunes, make sure to check out the discography at 8 Bit Peoples, a chiptune label that uses the BY-NC-AT Creative Commons license (especially nullsleep, one of the label’s co-founders.)
Here are some samples:


Follow the red dots – music by Bubblyfish, visuals by Raquel Meyers