Misc. code snippets & dev notes http://code.adamflorin.com From the desk of Adam Florin posterous.com Thu, 30 Apr 2009 15:05:54 -0700 Framebars and framebusters: viewing one site through another http://code.adamflorin.com/framebars-and-framebusters-viewing-one-site-t http://code.adamflorin.com/framebars-and-framebusters-viewing-one-site-t
Amidst all the shrill voices in the resurgence of the old frames debate is an even-handed and meaningfully technical piece by Danny Sullivan and some scattered responses to the community from John Quinn at Digg. While the specific mechanics of the DiggBar have obviously been a valuable touchstone for conversation, the politics of information architecture (is that a field yet?) loom far larger.

The heart of the issue here is the distinction between content sites and aggregators, which can seem blurry at times but in practice is quite stark. The symbiotic relationship between these two classes of site has evolved over the past fifteen years or so, and should perhaps be formalized—in the HTTP spec, even, it seems to me.

As our means of collecting, processing, and re-filing information multiply, I see no inherent reason why you shouldn't look at one site through another. In the 90s, the word "portal" was popular for aggregator sites, and the metaphor is useful: Digg is not a content provider, but a window through which content is found. So a framebar may in fact be a perfectly natural expression of that removed yet enabling position. You look over the sill of Digg into pastures of Engadget, CNN, what have you.

And if the complaint is in fact about SEO link credit, then can't this be solved with richer metadata at the HTTP layer? It seems to me that what's missing is just one HTTP Header. Call it "Content-Source": as part of a 200 response, it's a URL which the browser will not redirect to, but to which the spider will. This way, the spiders credit the correct link, while the user gets the rich experience of viewing one site through another. If this is really about which URL you see in your browser bar (and honestly, is it really about that?!), the browser could have a responsibility to display the "Content-Source" URL.

The nay-sayers and framebusters are bringing in a lot of 90s baggage about what the internet is "supposed" to be that's not very meaningful today. Some of these complaints ("if we let Digg get away with it, civilization will begin a long downward slide") have a bizarre Hobbesian ring to them. "Frames of frames" don't sound dystopian to me so much as they sound apt.

(My thinking on this has much to do with NewsTrust, a news-rating site I develop, and which we very much hope to be a window onto the greater news stratosphere.)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/43181/curious_resave.jpg http://posterous.com/users/1gETNNhwJhf Adam Florin adamflorin Adam Florin
Tue, 31 Mar 2009 15:15:00 -0700 Passenger on a VPS http://code.adamflorin.com/passenger-blog-post http://code.adamflorin.com/passenger-blog-post
Passenger’s default config is set up for shared hosting environments, which means that it revives (to a lesser extent) a problem from the bad old FastCGI days: your processes will go idle by default and after 5 minutes of inactivity will wind down. So every page view that comes in after 5 idle minutes (which, for a very small site, is a large portion of traffic) will take longer to load—on the order of 5-7 seconds on my 256MB slice. Every subsequent page view while the process remains standing will be processed promptly.

What you want is for your Passengers to remain standing like mongrels (but without all the obnoxious proxying). So definitely don’t just set it & forget it if you’re on a VPS. Based on the Passenger docs, you should set these two values in your global Apache config:

# "If your system is a VPS and has about 256 MB RAM, and is also running other # services such as MySQL, then we recommend a value of 2" PassengerMaxPoolSize 2 # "0 is recommended if you're on a non-shared host that's only running a few # applications" PassengerPoolIdleTime 0

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/43181/curious_resave.jpg http://posterous.com/users/1gETNNhwJhf Adam Florin adamflorin Adam Florin
Tue, 31 Mar 2009 13:14:00 -0700 Syntax coloring and newlines in Posterous http://code.adamflorin.com/formatting-tests http://code.adamflorin.com/formatting-tests

It appears that syntax coloring works on Posterous using syntaxhighlighter.

Doesn't quite work with emailed posts from Apple Mail, which inserts a lot of needless <div>s.

UPDATE: I figured out that you can go into the raw HTML editor and replace those <div>s with <br/>s and all should be well. But note that if you type code directly into the rich text editor, it will be wrapped in <p>s, which also must be turned into <br/>s—otherwise newlines will be inserted all over the place.

For kicks, a working sample:

class FakeFace   def whatever(opts = {})     opts[:key] || "nada"   end end

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/43181/curious_resave.jpg http://posterous.com/users/1gETNNhwJhf Adam Florin adamflorin Adam Florin