Tuesday, May 20, 2008

Boingboing, Pheedo, and Cookie Annoyance


I'm one of those paranoid types who likes to keep precise control over who is able to save cookies, and for which duration. For that reason, I have the "Ask me every time" option set in Firefox, so that I can choose for each cookie (and blanket-ban whole domains) whether it will not be allowed to be set, whether it can be set forever, or whether it'll only last for the session. In particular, any advertising related URLs don't get set.

Most of them are pretty nice in playing with Firefox, and they'll try to set a cookie for something like .doubleclick.net, meaning that the same cookie will be used for foo.doubleclick.net, bar.doubleclick.net, whatever. I reject it once, reject everything from .doubleclick.net ever being set, and we're all happy.

The way they do this is by having a single point of entry to their cookie setting, so that:
  • They always serve ads from a single url (like ads.advertising.com)
  • They differentiate the ad either by cookie or by URL (so serving http://ads.advertising.com/8347283479327482937)
  • They properly set the domain to .advertising.com for other usage.


However, then I encountered Pheedo. Their motto appears to be "RSS Advertising Done Right." I might recommend that it's really "RSS Advertising Designed To Annoy Your Audience." I've only encountered them thus far with Boingboing, but it's annoying enough that I might actually drop BB from my blog roll and only read it on the web in the future as a result. Here's what they appear to do.

Every single link that they put into your feed has a unique domain name (not URL) (like e61225ff1c0b2a237f8fb7b3efbe3dd6.img.pheedo.com). That means that you have to individually reject or accept every single image/ad which, by the way, I've already adblocked out. The cookie itself is properly specifying the domain to be .pheedo.com, but the site its being served from is playing DNS differentiation rather than URL differentiation, meaning that the standard Firefox rules don't apply.

I tried to contact Pheedo on this and ask them to stop, but they didn't reply. C'est la vie.

I guess my annoyance is three-fold:
  • Pheedo, for sucking so hard.
  • Boingboing, for using them
  • Firefox's cookie wrangling (which I otherwise love by the way, and is one main reason why I use it on my Mac rather than Safari or whatever) for not allowing more complicated cookie rejection rules (AdBlock has no problem with blocking pheedo stuff, so I never even see the ads anyway).

Sunday, May 11, 2008

Dynamic vs. Static Generation

I've been doing a fair amount of work recently with large systems dealing with semi-dynamic documents in the financial service space (not having anything to do with web sites BTW). One thing that's an inevitable question that comes up is how much you pre-compute, and how much you rely on your dynamic generation system to work at runtime.

For example, in one of the really old-skool CMS systems (think Vignette circa 1999) you were looking at a pure generation system: text went in, went through a recompute-the-world process, and out came fully formatted linked in HTML. If you've ever looked at CNET, it's clear that they're using at least something based on this technique, because I recognize the classic Vignette-style file names.

However, in a purely dynamic system, all content is in the form of some low-level structured persistence store (e.g. RDBMS) and each page is uniquely generated for each request.

The key differentiations here have to do with what you think is your principle scalability issues:
  • Static systems are ideal for seldom (in the grand scheme of things) updating systems with a massive number of readers (think New York Times or BBC News) and minimal per-user customization
  • Dynamic systems are ideal for constantly updating systems with relatively fewer readers and maximal per-user customization (think web stores)
  • Static systems also have the downside that all your content must be generated before it can be displayed, which in the case of a nearly infinite search space of items means that you have to have everything you might possibly serve on disk. Dynamic systems just generate it as needed.


But is any of that really accurate, particularly with modern page layout technology?

Imagine Jeff Atwood's post on how WordPress gobbles CPU time. I know from experience that when we thought dynamic content was expensive (because CPUs WERE expensive), you spent as much time as possible optimizing away your CPU effort, by statically generating everything you can. How much on a typical blog entry really needs to be properly dynamic?

Well, you've got:

  • The text itself. This changes seldom, and seldom enough that in general you're going to want to have a special annotation that something has been updated as a result.
  • Your little bits on the right. These aren't changing with every post, unless you're doing some sort of randomization or prioritization on your blog roll. But that you can do with a dynamic iframe
  • Comments.


It's the last bit that I think people have gone crazy in terms of purely dynamic systems. How often is someone posting? Even for a super-hot post, I contend maybe once per minute for a few hours. How long does it take you to generate that page? Maybe a tenth of a second on a super-hot posting.

So why not follow what we used to do back in the day for systems like this:
  • Statically generate the world. Disk is cheap. Super cheap.
  • Have an event-based system that takes in new "events" (comment, new posting) and modifies the output content as a result?


The key issue here is whether your "system" is sufficient to capture all external interactions with your underlying data model or whether you are likely to go around and poke your database manually. I contend you're probably going to do this seldom enough with most systems that a "rebuild the world" operation would probably suffice, and the performance gains you get out of a mostly-static system (using things like iframe for dynamic content) are going to be massive enough that it's worth the effort.

By the way, why do I care about all this? Static content can be served fast. Super-duper-ultra fast. sendfile fast. Kernel server fast. And it's something that guarantees that you're not into user-level code that requires a lot of explicit concurrency control, which people always get wrong (meaning not fast enough).

Tuesday, August 29, 2006

NHibernate and ORA-12571 Errors

I've been attempting to apply my Hibernate knowledge to some new C# development that I've been doing with NHibernate, and came into a bit of a crazy situation.

When I was working on the mapping of the first table (to make sure that all my connection setup infrastructure was working), I came upon what seemed like a particularly pernicious bug: ORA-12571 ("TNS:packet writer failure" message string) errors were occurring constantly when I did a query using a named parameter. Googling these errors seemed to imply that there might be some type of networking problem going on, so as I don't have much access to the development Oracle instance that I was using (Oracle 9.2.0.7 for the pedantic), I enlisted our Systems team.

Turns out that on the server we were seeing log messages of "ORA-00600" on the statement in question, indicating that there's corruption or an error in the format on the data being sent to Oracle by the client.

After doing some more experimentation, I came up with the actual issue, completely shrouded by all this networking gobbledigook: NLS. Or, specifically, the difference between DbType.String and DbType.AnsiString in ADO.NET.

In Hibernate, since Java only uses Unicode internally, I got quite used to just saying query.setString("Foo", val) rather than trying to actually figure out the differences between Java/JDBC and ADO.NET. Turns out that ADO.NET has a difference which flows through to NHibernate.

So, to make a long post short, if you run into ORA-12571 errors using parameters in NHibernate, it's probably not your network or machine, but check that you're using the right data binding in your query binding (e.g. query.SetAnsiString() rather than query.SetString()), because if your database is expecting a particular character encoding and you don't send it, it shows up as a network corruption message.

Tuesday, August 15, 2006

Murano Urban Resort: Don't Bother

My partner and I went to Paris to celebrate my 30th birthday recently, and while the last time we were there we stayed at the nearly (save the location) perfect Hotel Sezz, since we were there a new, and supposedly extremely chic, hotel has opened, the Murano Urban Resort. If you follow designer-trendy hotels, you've probably heard of it, since it's had a writeup in every trend-victim bible since it's opened. Here's my writeup on it:


  • The location seems somewhat convenient

    That's what I'll say about that. It's on the outskirts of the Marais and near Republique, but quite frankly, Boulevard du Temple isn't the most scenic of Parisian locations, so unless you really want to be near Republique or the Marais, there isn't a whole heck of a lot about the hotel to like. But enough of my positivity, let's go straight into the complaining!

  • The Rooms are Cheap

    Something that they don't show you in all the pictures of the place are that almost everything you see is made of plastic. Cheap plastic. Ikea-grade plastic. The bathrooms are almost half-done (like they ran out of black slate in the budget, so they just didn't go to the point of making sure that the rooms looked nice, they just stopped putting it up half-way up the walls), and not finished very well. It really looks like they blew the entire room-decoration budget on the fingerprint scanners (which don't really work), the mood lighting (all shades of pink), the B&O television/remote control (with nothing on you might want to watch in English), and the ashtrays (ironic given that ours was a non-smoking room in a non-smoking floor), and just had to make do with the rest.


    And yet the rooms are really expensive. For all that you're paying about EUR 350/night. Without a view.


  • They've Joined the Cult of Dark Public Spaces

    I don't know what it is about design-victim hotels, but so many of them seem to have come to the conclusion that if dark is sexy, than pitch back must be sexier. Thus, much like the Sanderson in London, all hallways and public spaces are pitch black at the Hotel Murano Urban Resort. For example, if you get into the elevator, it's so dark that you can't actually see the buttons, which are not illuminated in any way. When you get to your floor, the hallway is so dark that I actually bumped into a wall, not realizing that the black-painted wall had a bend in it.


    To really mess with their guests, they've made sure that the central area of the bar/lounge (the one with the white sofa and the fireplace that's in all the puff-piece photos of the place) has a massive skylight, meaning that this white space is bathed with light. The hallway leading into there from the residences is pitch black (as are the upstairs hallways and the elevator). What happens when you walk into it? You're blinded. Painfully, painfully blinded. Thanks, designer! Way to think ahead!


  • The Bar is Really Expensive

    You see pictures of the bar everywhere. Fair enough. But EUR 20 for a beer? Surrounded by other patrons who look down on you? And the staff who looks down on you even more (as though to say "how stupid are you to be drinking here?")? Is that a joke? Apparently not.


    And before I hear any of this "you just weren't cool enough," we were all dressed just as victimy and expensively as everybody else, it just seems that the bar exuded snobbery.


  • Rooms Past The Bar

    In order to get to your cheap-finished, insanely-expensive room, you have to walk through the bar. Which means you have to run the gauntlet of the bouncer looking down on you thinking "who do you think you are coming to this bar?" just to say "I'm staying here" and go to your room. Which is part of the reason why I won't ever stay at a hotel in Vegas where you have to walk through the casino to get to your room.

  • They locked us out

    At midnight (yea, we have reached the epitome of old age: at midnight on my birthday, all we really wanted was bed), we returned to the hotel room attempting to get in and go to bed. This is easier said than done, because rather than having keys of any form, they've elected to have fingerprint readers which don't really work all that well, so after both of us trying about 10 times to get into the room, I went downstairs to get the porter to let us into our room.


    This was when I basically hit the roof. Turns out that when Todd checked in, he put down a debit card for the deposit, and rather than getting authorization then, they just took the details to get authorization later. When they later tried to get authorization, Todd wasn't there, and they did a security check, and so there was a hold on the card until they could contact Todd. What did the staff at the Murano Urban Resort decide to do? They decided to remotely lock us out of the room, so that we'd be forced to come to reception to clear this up.


    The following morning when Todd complained, they did actually apologize and point out that this was not standard policy, and they made it up with a bottle of insanely cheap rose wine left in our room that evening, but quite frankly, the fact that they would neglect to do the card authorization when the customer was there, and then immediately lock us out of the room to ensure our compliance is so off-the-charts that I actually had to laugh at what poor service that is.




So if you're thinking of staying at the Hotel Murano Urban Resort in paris, don't bother. By the time you get there everything (already looking dated when we were there 3 weeks ago) will be looking even more dated and dirty and tired than it already was, they'll treat you like crap, and overcharge you for the privilege of staying there. Trust me, stay at the Sezz instead.