MaisonBisson

a bunch of stuff I would have emailed you about

Working With Spatial Data in MySQL

It’s MySQL spatial data week here, though I am spreading out the posts to, um, ease the pain (or boredom). Anyway, here are some commands/functions I don’t want to forget about later:

Start with an existing table called geometry, add a spatial column and index it:

``` ALTER TABLE geometry ADD coord POINT NOT NULL; CREATE SPATIAL INDEX coord ON geometry (coord); ```

Insert some data; think in terms of POINT(X Y) or POINT(lat lon):

``` INSERT INTO geometry (coord) VALUES( GeomFromText( 'POINT(40 -100)' )); INSERT INTO geometry (coord) VALUES( GeomFromText( 'POINT(1 1)' )); ```

Get those X,Y coordinates back from the table:

``` SELECT X(coord), Y(coord) FROM geometry ```

Get points within a bounding rectangle:

``` SELECT MBRContains( GeomFromText( 'POLYGON((0 0,0 3,3 3,3 0,0 0))' ), coord ) FROM geometry ```

bSuite 4 beta 2

I announced the bSuite 4 public beta not long ago, now I’ve just posted a new version to SVN that addresses some of the bugs and fleshes out some of the features. I have yet to update the bSuite page, but here’s a preview of what’s new or changed:

  • Additional stats reports
  • WP2.5-style tag input tools on the Page edit screen*
  • WP2.5-style category selector on the Page edit screen*
  • WP2.5-style excerpt input on the Page edit screen*
  • For multi-author sites: ability to grant edit permissions by role for each page (with a configurable default)
  • An “include” shortcode that makes it easy to show content from one post or page on another.

About the new shortcode, use it like this:

[inclu``de post_id=“1234” url=“a url to a post or page in your blog” field=“post_excerpt”]

One of post_id or url is required; field is optional and defaults to post_excerpt first, then to post_content if there is no excerpt.

*Why would you want to input tags, set categories, or add an excerpt to a Page? They help readers find and explore our content. What’s so wrong with that?

Calculating Distance Between Points In MySQL

MySQL has some powerful, and perhaps underused spatial extensions, but the most interesting functions are still unimplemented: “Note: Currently, MySQL does not implement these functions…”

Among those as-yet unimplemented functions is DISTANCE(). Alternatives can be found here and here, though neither is clean or simple. I wonder if a simple MBRContains() is good enough, though…

JSON on RHEL & PHP 5.1.6

Stuck with PHP 5.1.6 on RHEL or even CentOS (and a sysadmin who insists on using packages)? Need JSON? I did. The solution is easy:

yum install php-devel<br /> pecl install json

The pecl install failed when it hit an 8MB memory limit, and I was clueless about how to fix it until I learned that the pecl installer ignores the php.ini. Turns out the best solution is to use the pear installer (which does follow php.ini settings):

pear install pecl/json

Many Eyes, Bugs Being Shallow, All That

WordPress 2.5.1 added a really powerful feature to register_taxonomy(): automatic registration of permalinks and query vars to match the taxonomy. Well, theoretically it added that feature. It wasn’t working in practice. After some searching yesterday and today, I finally found the bug and worked up a fix. I made a diff and set off to […] » about 200 words

Where Do They Find The Time?

Clay Shirky recently posted (wayback) a transcript of his Web 2.0 Expo keynote. …If you take Wikipedia as a kind of unit, all of Wikipedia, the whole project — every page, every edit, every talk page, every line of code, in every language that Wikipedia exists in — that represents something like the cumulation of 100 million […] » about 500 words

Anglia Ruskin University Faces Criticism 2.0

Anglia Ruskin University is in Cambridge, but it’s not Cambridge University. It’s likely that none of us would even know of Anglia Ruskin‘s existence if it wasn’t for Naomi Sugai, but she’s not interested in promoting the school.

She’s got complaints, she’s fed up, and she’s taking her case to YouTube.

Well, she took her case to YouTube, and then she got suspended. The video that’s up now doesn’t seem suspension-worthy, but the Telegraph story suggests there’s a different version that may slander an ARU administrator, and that’s the reason ARU gives for suspending her.

2002 Honda Civic iPod/iPhone Install

Last weekend, while I was putting an iPod interface into my Scion I did the same thing for my 2002 Honda Civic. Using Ben Johnson’s story as a guide, I bought a PIE HON98-AUX interface and dove in. Aside from tools (screwdrivers and 8 and 10mm sockets), you’ll need: The interface adapter Audio wiring — […] » about 700 words

Snakes On A Plane

It was only after I’d taken my seat and David Weinberger began his ROFLcon keynote that I realized there was a box of t-shirts at the side of the room with a sign over them that said something along the lines of “FREE: t-shirts from worn out memes.” Thinking that the internet might be old enough now that the old memes might be resurrected in some ironic way, I almost jumped over Jessamyn to rifle through the box and claim a prize. What stopped me was the realization that with about 500 people in the room, anything left in the box must be really, really past its expiration date.

By the time I did get to look in the box, all I found were snakes on a plane t-shirts. And then all my anticipation disappeared with a sigh as I realized snakes on a plane really wasn’t worth resuscitating.

That was before I had a few drinks, remembered I had this old video, and decided to give it a go anyway.

2004 Scion xB iPod/iPhone Install

Based on this story about an iPod interface install I purchased a PIE TOY03-AUX aux input adapter so I could finally listen to my iPhone without using the lousy FM transmitter. Sure, I coulda bought a new car, as the manufacturers seem to have finally come to their senses and started including such inputs, but […] » about 400 words

Barbed Wire, The Deeper History Of

It turns out that, like most everything else, barbed wire shows up at auctions. Not just shiny new stuff, you’ll find used stuff too. Expect it to be at least a little rusty, and look out for clumps of hair or other things stuck to it. Whether that adds value or not is unclear.

Where could we look to find out? The Antique Barbed Wire Society‘s Barbed Wire Collector Magazine might be your best source. Twenty five bucks will get you a six issue subscription. Don’t think there’s that much to know about the stuff? Take a look at these bundles and think again.

Flickr Adds Video

I asked for it in 2004, before YouTube, Vimeo, Viddler, or Revver appeared on the scene, and before MySpace and Facebook added video sharing as a feature. Four years later they finally added it. Neil Rickards should get credit for creating the theme of “long photos” (Neil called them “moving photos”). And anybody who was around then isn’t the least surprised at how angry some are now about the new feature (see sarcastic response to that).