mushinnoshin

teh internets

Gallery::Remote::API

by Jon on Jun.15, 2010, under Babble, General Tech, teh internets

Awesome… all my futzing around with Gallery has led me to release my first perl CPAN module — Gallery::Remote::API, a perl module for interacting with a Gallery installation via Gallery’s remote protocol.

Funny thing was, halfway through writing it I realized the remote protocol itself didn’t let me do what I set out to do in the first place … it actually doesn’t let you do much besides fetch info and add images. Oh well, maybe someone will find it useful. It was a good exercise for me just to get a handle on packaging a module for distribution.

Leave a Comment :, , , , more...

wordpress, gallery, and canonical urls

by Jon on Jun.12, 2010, under Babble, General Tech, teh internets

I just know you wanna know what sort of fun I’ve been having this morning.

OK, so I’m playing around with an installation of WordPress featuring an embedded installation of Gallery2 via the excellent WPG2 plugin. And I’ve got all my fancy url rewriting set up on both platforms.

So what happens is, when you go to “site.com/galleries”, you’re going to a wordpress page, at which point wpg2 does some fancy footwork to embed the appropriate gallery page, so when you go to “site.com/galleries/myalbum/” it shows that album’s page, and “site.com/galleries/myalbum/myphoto.html” shows that photo’s page, etc., all wrapped up inside your usual WordPress header, sidebar, and footer. So far so good.

Here’s the thing: Gallery’s url-permalink stuff correctly writes out the album links as “site.com/galleries/myalbum/”, but I kept getting 301 redirects to “site.com/galleries/myalbum” (notice the trailing slash difference). Now that’s not a completely insufferable thing — it does get you the correct content. But there are both performance and SEO considerations. On the one hand, you don’t want to 301 if you don’t have to (waste of bandwidth and slows down the user experience); on the other hand, you do only want one version, whichever it is, to be the “accepted” version, while the other 301s back to the first, otherwise you split your ranking juice between the two urls, and may get penalized for duplicate content.

So the easy solution would probably have been to hack Gallery and remove the slash wherever it generates links (and where it generates the rel=”canonical” link in the header [which Gallery itself doesn't actually do, I had to put that in my custom theme myself]). Except that IMHO, the slash should be there in this case — in my mind, an album is a directory, as evidenced by the fact that “files” (photo pages) exist beneath it.

So I set about trying to figure out who was redirecting my slash back to no-slash by poking around in all my redirect rules. Now that’s not an easy task, given that wordpress and gallery both write their own .htaccess files, wpg2 writes a modified version of gallery’s mod_rewrite rules into the wordpress .htaccess, and on top of that, apparently WordPress ALSO has a whole set of “virtual” rewrite rules that don’t show up in the .htaccess file. Compound this by the fact that Dreamhost doesn’t seem to let me turn on mod_rewrite’s RewriteLog, and by the fact that the galllery links have to go through some valid rewrites to get them first in a form that wpg2 can understand, and then into a form that gallery itself can understand — well I drove myself nuts trying to figure out where it was happening.

Finally out of sheer frustration I grepped for “301″ in the wordpress source code — and sure enough, I found a sneaky little wordpress function called redirect_canonical was the culprit. Apparently anytime it gets a “site.com/url/” (at least one that doesn’t actually point to a real live directory — I think), it removes that slash and 301s.

Now, normally, that’s probably the right thing to do. If someone goes to “site.com/myblogpost/”, it probably should redirect to “site.com/myblogpost”, and consider the slashless version canonical — since a single blog post/page/whatever is really more like a file than a directory. But it’s not appropriate in this embedded gallery situation. Luckily, wordpress does provide a whole system of filters and hooks with which you can fix this.

So, if you’re in a similar situation, you can add something like the following to your theme’s “functions.php” file, and that should do the trick:

//don't let wordpress "canonicalize" gallery virtual directories
function g2_reverse_canonical($rd_url,$rq_url) {

    global $user_url;

    $pattern1 = "~^$user_url\/galleries\/([^.]+\/)+(\?[^?]*)?$~";
    $pattern2 = "~^($user_url\/galleries\/([^.]+\/)*([^.]+))(\?[^?]*)?$~";

    if (!empty($rd_url) &&
        preg_match($pattern1,$rq_url)
    ) {
        #don't do it!
        return false;
    }
    elseif (empty($rd_url) &&
        preg_match($pattern2,$rq_url)
    ) {
        #reverse it!
        return preg_replace("~(\?[^?]*)?$~","\/${1}",$rq_url);
    }
    #otherwise, let wp do what it wants
    return $rd_url;
}
add_filter('redirect_canonical','g2_reverse_canonical',10,2);

Of course you’ll want to replace “galleries” in those regex patterns with whatever path you chose for your gallery permalinks. It seems to work for me — at least, I haven’t found any bugs so far (if anyone who knows more about this stuff than I sees an issue, I’m all ears). Notice that in addition to stopping wordpress from removing the slash, I also do the reverse and add the slash when it isn’t present. It might be more efficient to move that part to an .htaccess mod_rewrite rule, but I wanted both actions in the same place for the sake of my sanity.

Further, note that it does NOT apply if the final token (prior to any query string) contains a “.” — this lets wordpress correctly do it’s thing and canonicalize the “site.com/myalbum/myphoto.html” pages without the slash. Of course the downside is that you can’t have a “.” in your album names (but since gallery album names — as far as the url is concerned — are the actual directory names where the data is stored, hopefully it’s not a problem. Yeah, you can create directory names that have a “.” in them, but hopefully you’re sane enough not to do so :)

Finally, I also let wordpress take it slashless when just going to “site.com/galleries”. Personally, I think that too should be treated like a directory, but since it’s technically a wordpress “page”, and since in this case Gallery is also generating links without the slash, I’m just going to let that one be.

And I still hate PHP.

Leave a Comment :, , , , , more...

dreamhost–

by Jon on Apr.08, 2010, under Babble, teh internets

Well, dreamhost bit me. Seems they decided to move me to a new server, which is all fine and dandy, but they also seem to have decided it would be a hoot to just delete all my files in the process.

But, the database was fine, so after some finagling  I was able to restore most of the content, but I lost my theme and all my customizations, plus any images or other media some of the old posts may have included.

On the plus side, it gave me a chance to play with a new multi-domain setup I’d had in the back of my head, so I guess it worked out. It’s not like I had anything better to do today.

2 Comments :, , more...

in which I go all google fanboy

by Jon on Feb.08, 2010, under Arts & Entertainment, Babble, Life, TV & Movies, teh internets

Goldni and Aunt B have some thoughtful posts about the omnipresent sexism (if not outright misogyny) in last night’s superbowl ads.

I don’t have anything to add really, but did have a minor disagreement with Aunt B on one tangential item:

I mean, I thought the Google ad was cute, but it seemed like a masterpiece because it was a respite from the “Women suck and they’re ruining you. Only our product can make you more manly.” bombardment.

The disagreement being that I thought the Google ad was a masterpiece on its own without regard to the shittyness of the rest of the ads. (Which is really to say I just wanted to post about the Google ad and this was a convenient segue to do so :)

I really did think it was brilliant — maybe the best superbowl ad since that iconic one from Apple so many years ago. It was simple, thoughtful, intelligent, and emotional — and with that tag line “Keep Searching”, it was even deeply existential.

I’m no marketer, but it seems to this layman that an entire ad showing nothing but the branded product doing what the product does has got to be the gold standard, at least when it can be done this clearly and effectively, and especially when the product is shown profoundly helping the user shape the very fundamentals of his life.

But more interesting to me, and this goes to the bit about it being existential — it made a provocative observation about the human condition, how we *are* all searching. We’re searching for love, for happiness, for acceptance, for fulfillment, and for billions of things unique to the individuals doing the searching.

And back to the marketing aspect, Google just humbly accepted its place as the quiet little tool helping us answer our queries in ways never before possible, and not until recently even imaginable. Without a hint of arrogance they reminded us of just how immense a cultural revolution we’ve seen in the last 10 to 15 years or so, and how they’ve become the focal point through which we find and experience so much of that revolution.

That’s some powerful shit. And they did it without actors, celebrities, dialog — hell, I wouldn’t be surprised if they didn’t even use a camera, just captured it right from the desktop. In this they made a commentary, even if unintentional, about the elemental superiority of substance over style and function over form (the same commentary they began making the day they launched with their simple, no-nonsense prompt).

And then there’s something beautiful in knowing that they didn’t have to do it, it wasn’t part of some well-plotted marketing scheme — they just put it up there because they could, because they felt like participating in the cultural event that superbowl ads have become. And they used a piece they’d already released into the tubes.

It just worked on so many levels. It might be cliche to say it, but this thing wasn’t just an ad, it really was a work of art. Performance art, even.

2 Comments :, more...

I can’t be merry, ‘cuz I’m Hebrew, on Christ-mas

by Jon on Dec.26, 2009, under Arts & Entertainment, Babble, Buddhism / Taoism, Essence, Food & Beverage, General Philosophy, General Tech, Life, Memes, Music, My Trip to Mecca, Politics, South Nashville, TV & Movies, Theater / Opera

so here we go;

sorry I haven’t written much here lately. I have no greater excuse than simply not having been in the right frame of mind.

Well. Don’t know when I’ll be back, but I’m here. And it’s Saturday night, after Christmas. It’s been a decent one. Thursday with the dad, brother, and brother’s family, at Granny’s house, which Dad has now inherited. I think I hit a home run with the Fart Machine I gave my nephew. And another, with a most politically incorrect documentary in which the esteemed civil libertarian boundary-pusher Larry C. Flynt chronicles the accomplishments and exploits of an Alaskan pin-up queen gone rogue. We’ll leave the rest to your imagination or google-fu.

Saturday, pizza, party, and presents with the sister and her husband, which rocked. Never doubt the badassedness of four fresh diced jalapeños and a smattering of mushrooms taking a Digiorno to the next level, especially when you wash it down with a steady flow of a brew-kit bitter and a back supply of the same brew-kit’s dark ale. We backed the food with the Mr. Hankey’s Chrismas Classics dvd, and the beer with Weird Al’s videos dvd, which culminated in the main event of Christmas at Ground Zero. Then to the living room for presents, with Koyaanisqatsi muted, just for the visual, and the TSO playing on on the PC/stereo. Good Times. As far as the gift, my & my sister and I have this long running calendar gag, and I won’t bore you with the details but I think I rocked it this year.

So then today I guess is xmas for me. Cleaned up from the party, then spent the day in lazy, beer-sipping play and exploration. I finally opened up the School of Rock dvd that’s been sitting on my coffee table for months. I can’t tell you how much I love the hell out of that movie. It’s stupid, it’s sappy, but goddamn it it rocks and I love it. Of course I’ve seen it too many hundred thousand times on TBS, so I didn’t need to watch it, but watched it with the commentary from Jack Black and the director, then went back and just watched the “one hell of a rock show” chapter. Man, for a stupid movie song, they nailed it. Just enough Yes, Kiss, Bowie, and Floyd all mixed up and dished out over a plate of AC/DC — fuck yeah. And yes, I fucking cry every time when Turkey Sub struts up to the mike and belts out loud and clear how happy she is to be who she is in a glorious declaration. And though I’ve got my issues with the keyboard kid — I would have liked to have seen a little less Rick Wakeman, a little more Ray Manerik with a helping of Jon Lord (that just would have been more rock and roll to me) — I understand better after the commentary that yeah, Wakeman was probably the perfect archetype given the actor/pianist’s true to life classical upbringing and utter unfamiliarity with rock. And even still I did always like the somewhat-Wakemanesque, but almost more Come Sail Away-era-Denis DeYoung sounding portamento-drenched monotimbral solo he does there. My kinda shit, actually.

Had an awesome dinner (yellow saffron rice, with red onions, fresh jalapeños, and mushrooms, well seasoned and sautéed with a Morningstar Veggie Italian Sausage, if you give a damn), then put on Naqoyqatsi, another dvd I’ve owned for a while but been waiting for the right time to watch. Except that I still haven’t watched it, I’ve just been listening as I typed this post. Well, it *is* Glass, it needs at least one listen by itself without the visual.

And it just ended. Guess I should grab another beer and watch it for real this time.

Leave a Comment :, , , , , , , more...

let’s all go to the lobby

by Jon on Jul.12, 2009, under Arts & Entertainment, Babble, General Tech, TV & Movies, teh internets

Man, Netflix is getting really specific. The first “category” on my homepage is now “Dark Tortured-Genius Dramas”.

On a similar track, I’ve always been annoyed that they only give us 5 stars to rate with, no half stars, etc, and usually when I go to rate one I’m thinking, “well this one’s really a 3.5″, etc… Well it’s almost getting creepy how often their “Average of raters like you” — which does do half-stars — matches how I would have rated had they let me.

And while I’m talking Netflix — I haven’t decided if I like their connection widget I’ve been playing with that posts my ratings to facebook. Or rather I do like it for the ones I want to post, especially now that they’ve added the ability to comment, but I don’t like that it posts everything I rate. And not just the ones I’ve just rented, it posts *everything* you rate. So when they give you a page of recommendations and you go through rating all the ones you’ve already seen it posts those too. I do watch a lot of movies, but not as many as it makes it seem. Seems like it would be simple to add a “don’t post this one” to the little dialog that pops up asking for your comment.

Leave a Comment :, more...

If the devil is 6, then the meme is 7

by Jon on Jan.09, 2009, under Babble, Memes, teh internets

Mike tagged me for the seven deadly sins random things meme. Right-o, lets see what we come up with.

  1. I’ve been known to sometimes (and by sometimes, I mean often) go *weeks* without really talking to anyone, beyond the unavoidable “transactional” speech needed sometimes with a cashier, etc. Weirder, this generally doesn’t bother me, except when I reflect on how weird this makes me.
  2. Mike and the other guys from work already know about this, but — I have a weird thing about my lunch schedule. See, if left to my own devices, I would probably eat the same thing almost every day. Which is probably bad for my soul at least, if not for my health. So, to ensure some degree of relatively even distribution, I adhere to a well defined rotation schedule. We’ll start with Tuesday: sub/sandwich shops, rotate weekly between Blimpie’s, Subway, Quiznos, Jimmy John’s, Jersey Mike’s, Lenny’s, Schlotzsky’s, and Which Which. Wednesday is burito day, with turns taken by Moe’s, Baja Fresh, and Blue Coast. Thursday we go for cafe/deli sandwiches between Bread & Co, Jason’s Deli, Panera, Wolfgang Puck’s, Atlanta Bread Co, and McAllister’s, and Friday is for Asia and the Mediterranean — Royal Thai, Miss Saigon, PF Chang’s, and the Greek Cafe. Back to Monday, that’s cheap day — Subway every week, except for when it’s Subway’s turn on Tuesday, giving me one week at Wendy’s every two months. I’m not psycho-inflexible about all this mind you, I’ll change it up for the occasional social invite or free meal or whatever, but this is my default schedule.
  3. Many eons ago I performed in a somewhat successful play called “The Brady Show From Hell”, in which we took real episodes of the Brady Bunch and performed them on stage re-written basically as a variation on The Aristocrats. I was “Alice” in this incestuous try-sexual family of drug addicts and fecal fetishists, the androgynous dominatrix maid who offset her fishnets with combat boots. She didn’t mind cleaning up after the orgies so long as the family members were all good little slaves during. It was, of course, a comedy.
  4. I wrote my own word processor when I was in 6th or 7th grade or so. OK, well, it was planned to be a word processor, but it really never got farther than a notepad-esque text editor. And being written in BASIC on an Apple IIe, it was slow as hell, almost unusably so. Still I was thinking big — I had this crazy plan to output everything in the high-resolution graphics mode, drawing the text so I could show fonts and such on the screen. I wonder if anyone ever ran with that?
  5. I never was much of one for political norms. I was selected to go to Boys State around 10th grade or so, where I ran for Senator on an anarchist platform pledging that if elected, I would do absolutely nothing. I didn’t win. [Oh! But I did take second I think in the talent show. Played an old improv in A minor, and stuck a pack of burning incense where a candelabra might sit. I'm trying to resist a cheap Sarah Pain flute joke here. ]
  6. I played a mean tuba back in junior high.
  7. I was quite obese through most of my youth. I don’t mean chubby or husky or big-boned, I mean my 6th grade self probably had sixty pounds on the adult me. Needless to say my sense of self-esteem never fully recovered from it, despite having stayed mostly thin to average for not quite twenty years now since. Being the perpetual butt of the joke at lunch time in particular has left me still generally uncomfortable eating around other people. Not enough to keep me from doing so, but enough to set all my neuroses firing when I do.

Oh, right, now I’m supposed to tag. Hmm, dunno. Most of the people who I figure would do this thing probably already have. Well, let’s try Logan.

1 Comment more...

sometimes things suck in awesome ways

by Jon on Jan.03, 2009, under Arts & Entertainment, Babble, Food & Beverage, General Tech, Life, Theater / Opera, teh internets

After stumbling to the computer this morning, as coffee medicated a mild hangover from a kickass shindig the agonyzer hosted with his partners in crime to celebrate their success in a damn fine production of A Christmas Carol — my firefox went batshit and commandeered my morning.

Long story short, over the course of maybe a half to a dozen page loads, the thing just ground to a halt. It wouldn’t respond within the page or in the menus. It acted like took control of X, or at least of KDE, by seeming not to let you switch to a different window, but it was actually just slow, and once switched, you could move between all the *other* windows and terminals with ease. One thing it did leave me was the ability to close the program from the corner ‘X’, and it closed quickly and cleanly. I’d relaunch — no alerts, it was a clean close and didn’t believe itself to have crashed — and as the tabs from the previous session opened, it crawled to the same condition.

Repeat several times, closing out all but the standard dozen or so tabs I keep open 24-7, which I know aren’t likely to have any out of control scripting — no change. No change in safe mode, or after using safe mode launch to restore some program defaults. Try an apt-get upgrade (think “Windows Update”) on the system (running debian testing on a pretty old amd xp-1700), and a dist-upgrade (think “Windows Service Pack”). These installed a new enough firefox that I had to upgrade some plugins. Finally an install –reinstall on firefox, err, iceweasel. Rebooted after each of the last three. All without making a lick of difference.

Exasperated, I closed all the aforementioned always-open tabs, restarted one last time — and everything worked like a champ. Of course I immediately reopened all the same standard tabs, without a hitch.

So it doesn’t seem to have been the pages, but something with the browser’s cache of information about and controlling one or more of the tabs and their content.

As far as the awesomeness goes — well it *was* pretty impressive how consistently firefox reproduced my session tabs, through all those ups and downs and upgrades and even the reinstall. Even if it did suck that it had to reproduce whatever the hell was wrong in the process.

4 Comments :, , more...

Internet Scavenger Hunt

by Jon on Dec.28, 2008, under Babble, General Tech, House & Home, Life, teh internets

Dear Internets,

Once again I must lament the lack of a furniture search engine providing advanced searches by dimension.

OK, so, I’m trying to find a tv stand. TV console might be a better description of what I want. Problem is everything I find is either wide and short, or tall and thin. I need medium-tall and medium-wide.

I like my tv to sit a bit high. So I’m thinking 30″ high at least. Give or take -2/+8 or so… Most everything I’ve found in that range are also around 30″ wide. But I want something probably between 40″ and 60″ or so … 45″ to 50″ probably being the sweet spot.

Open shelving for gear in the middle. I don’t really care what kind of small shelving or storage flanks the sides, but *some*, eg not an all-open shelf thing.

Probably black. Prefer wood, metal/glass/other considered. Straight lines, modern or classical

This “Low Cabinet with Sliding Doors – Antique Black” is sooo very close that I very nearly pulled the trigger — before I found precise specs for the interior space on another site, and found the interior shelves won’t hold any gear. You need at least 15″-16″ depth, and on the width, figure the devices are usually 17″ and you want some breathing room.

If the Kathy Ireland IMTL363 – Tribeca Loft Tall Console has a little cousin it could be a contender. But still, really looking for more open space in the middle, smaller utility shelves/drawers/doors/whatever on the sides. And, uhh, I won’t cripple the search with an exact price requirement, but, umm, not that much. Just figure I already broke the budget getting what goes with it :)

If anyone finds the winner I’ll definitely buy you beer. Two if I like you!

UPDATE: I might have found it. It’s a little more than I want to spend, but maybe not more than I can realistically expect. I’ll sleep on it and give it some time in the morning before I say go. Beer offer still applies if you happen to find the same one. In fact I’ll buy three just in appreciation of your accuracy :)

UPDATE2: OK, done deal, we have a winner.

Leave a Comment :, , more...

hurry up and agree with me, dumbass

by Jon on Nov.21, 2008, under Babble, Essence, General Philosophy, Humor, Memes, teh internets

This is pretty cool. Mother Jones told us about The Typealyzer, which probes your blog and computes your Myers-Briggs type based on content:

INTP – The Thinkers

The logical and analytical type. They are especially attuned to difficult creative and intellectual challenges and always look for something more complex to dig into. They are great at finding subtle connections between things and imagine far-reaching implications.

They enjoy working with complex things using a lot of concepts and imaginative models of reality. Since they are not very good at seeing and understanding the needs of other people, they might come across as arrogant, impatient and insensitive to people that need some time to understand what they are talking about.

UPDATE: I took this quickie online quiz which calls me an INTJ. I’m sure it’s not the most scientific quiz ever, but this does feel more accurate:

Click to view my Personality Profile page

5 Comments :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!