Category: Web Design

Canonical first public mention of Dogpool

Dear my web developer friends: Hi. I’m building an AJAX application and I have some Javascript questions. Yes, if I were an earlier version of myself I’d stop reading now too.

The application is intended for use by small groups of people–say, two to ten–collaboratively, for a few hours at a time. There may be many small groups working simultaneously, but activity won’t overlap among groups, only among members of a given group.

Say Alice, Esha and Mallory are using the application, which means having the page open in a tab or window. Each of them has a panel on that page showing what the other two are up to. Alice has five heads-up tokens, and she flips two of them over; I want Esha and Mallory to see that her tokens now consist of three heads and two tails within a few seconds of her doing so. This should not require any activity on Esha’s or Mallory’s parts except having the application page open.

I’m building this with Javascript and PHP/MySQL, no Java applets or anything. Is there any way to accomplish what I want that doesn’t involve polling–that is, using setTimeOut(XMLHttpRequest(…)) to refresh the activity panels every five seconds? setTimeOut is nonblocking on the client side, but that’s a huge number of requests per time period and it scales horribly.

I’m considering the obvious optimizations (having the client side taper off in request frequency during periods of inactivity, and writing the activity data to static files so I don’t have to hit PHP and MySQL with every request). Like most optimizations, though, they don’t address the central problem of nonscalable methodology. Is there anything in Javascript that would let the client accept pings from the server side when the data updates? I don’t think there is, but I’m hoping I’m wrong.

Three years after switching to NewsBruiser, I finally have NFD looking like I wanted it to look all this time but was too lazy to figure out the CSS. Me, not it.

I’ve been writing HTML for over ten years and CSS for over six, just because it wasn’t hard to learn and I could do fun stuff with it, and now I find myself in the position of the guy who makes a living off his hobby. Admittedly, so far this has been largely the tedious bits–like if I spent most of my day trying to shake a little broken flange out of an O-scale model train–but compared to my previous job of shaking out, say, crusty ketchup from a broken bottle, it’s aces.

The big news!

Today is my last day as a systems analyst in Troveris, the software division of Trover Solutions, an insurance subrogation company. I don’t want to try and explain insurance subrogation and you don’t want to hear it, so let’s just say this: insurance subrogation is not a bad or evil job, but it is boring.

Tomorrow, I start my new job as a consulting web developer for iNDELIBLE, a design firm in Manhattan. Unlike with Trover, there’s no point in trying to hide this blog by never linking or mentioning them, as my boss is already aware of it (he saw it during my phone interview as part of my web portfolio). I’ve been moonlighting on projects for them for the last three weeks, and I already enjoy the work more than what I’ve been doing. I’ll continue working from home while consulting; assuming all goes well for the next few months, I’ll be moving to New York in October to work in their offices as a full employee.

iNDELIBLE’s offices are in the same building as Fog Creek, where Sumana works, and it’s entirely due to Sumana’s agency on my behalf that I got this opportunity. I was and am very lucky to have a friend like her in my corner.

I need PHP to go up one level of a directory, then go back down several more, to include a file. I don’t know how to do this, but I’ve been getting around it by using a URL instead of a path; now Dreamhost is turning off the option of using URLs in include statements, for (good) security reasons, so I can’t do that anymore.

I also absolutely can’t find a way to do it the path way. It won’t work with an absolute path from the root directory, nor from the highest web-accessible directory (I’m in a Linux / Apache environment, if you hadn’t guessed). I can’t use ..s to ratchet up, or do any other kind of relative movement I can think of. Does anyone know how to get what I want?

Actually, Lisa, I think you’re the only PHP programmer who reads this, so maybe I should have just emailed you. But I might be wrong.

Update 0224 hrs: Never mind. I found out how to do it, but it doesn’t help, since I need to have Apache parse the file (a NewsBruiser portal CGI, if you hadn’t guessed) before I grab it, and an internal include obviously doesn’t do that. I’ll have to use the curl library, once I figure out what it is.

And I know I’m a bad programmer for going with this setup in the first place, but I had the choice of frames, meta refreshes or dumping a load on PHP, and it was rocks and frying pans all over.

Embarrassment is anticipated

I finally did what I’ve been threatening to do for over two years: there is now a navigable archive of every single IdiotCam©. I did some horrible things to NewsBruiser’s theme system to make it an image gallery, but it works. You can view things by their post dates or their categories (including the entire Plastic Mullet Series), and you can search for the title text and some other keywords. There’s even an RSS feed, so I don’t have to worry that humans who only subscribe to this site are being deprived of me putting stuff in my nose!

Finally, finally got the front page and chalkboard working again. The culprit was those sneaky scripts that say “Journal last updated (whenever),” which were looking for the old, nonfunctional NewsBruiser CGIs. That, and the fact that PHP functionality has changed since I wrote the scripts. Twice.

If you didn’t notice that those pages stopped working because there’s never any content, go away, kid, you bother me.

Hey, does anybody know how to center a DIV within another DIV in a cross-browser fashion? I’ve been using text-align, which is fine for IE, but doesn’t fly in Mozilla. Since I’m now kind of a Firebird (er, Firefox? Which makes no sense?) zealot, I really should get down to making NFD look right on my own screen.

Anyway, if you know, I’d just smother you in kisses for a note.

I’m glad I have a reason to talk about NewsBruiser again, because I’m on the front page! No, actually I want to talk about NewsBruiser because Leonard’s had version 2.0 (“Master Planarian”) out for weeks and I need to install it. Except I don’t want to install it, because a) NewsBruiser installations have traditionally been nightmarish for me (this is due to my hosts and my own incompetence, not NewsBruiser), and b) it has comments. NewsBruiser with comments! It’ll be anarchy!

Sumana and I had a conversation this morning about said comments, and about Leonard’s implementation of Bayesian heuristics in NewsBruiser. We agree that it’s capable of preventing comment spam, but I argued that it can’t entirely prevent tar pit syndrome, because it can’t filter out stupid. Sumana argued that it can. And then we jousted. No, actually we exchanged spam jokes.

(Yes, I know you can just turn off comments, I’m just whining. And yes, I do have a forum and am thus technically already sinking into a tar pit. However, you’ll note that the definition of the tar pit theory clearly states that “as long as no one actually uses the discussion forum, you are safe.” The only people who actually post there came from AZWP anyway, so I’m totally slopy.)

I do need to install 2.0, actually, so I can do trackbacks. I really don’t understand trackbacks, but they sound like they have something to do with RSS feeds or referrer logs, so I must consume them! Speaking of RSS feeds, I’m turning into an RSS evangelist like all the RSS early adopters, and I should be shot. And speaking of referrer logs, Cody Powell responded just as I planned to my goulash bait, and proceeded to write an entry about Cracked vs. MAD, which is a topic I was thinking about just this morning, during my pseudobreakfast. CODY POWELL CAN SEE INTO MY BRAIN.

Also! Webcomics are maybe the one source of content with the biggest conflict between proposed and actual posting schedule, which makes them PERFECT for RSS feeds… except nobody has one. Okay, Penny Arcade does, but they never miss a day anyway. Even Keenspot and Keenspace, the people who get probably half of all webcomic traffic in the world (and write the software that implements probably 80% of all webcomics), don’t have any kind of update feed.

So they should, basically, is what I’m saying. It’s called Really Simple Syndication, you know, it can’t be that hard to add in.

(Yes, I realize that my comic probably needs it more than anyone’s. I do plan to add one, once I have the time to rewrite my entire site apparatus. But again: I’m lazy.)