KBD

Keith Devens .com

Thursday, November 20, 2008 Flag waving
Would that which we have achieved have been possible if Providence had not helped us? – Adolf Hitler (in a speech at Regensburg on June 6th, 1937)

Archive: July 16, 2003

← July 15, 2003July 17, 2003 →

Daily link icon Wednesday, July 16, 2003

Zope doesn't do conditional GET correctly?

As part of my notify script I use conditional GET. In fact, because all my code needs to know is if the content changed -- it doesn't care what the content is -- if the server supports conditional GET I just do a HEAD instead of a GET to save even more bandwidth.

However, it seems that Zope doesn't support conditional GET correctly. I have two Zope sites in my list of sites I'm checking for updates, one of them Bruce Eckel's, and each of them returns a blank ETag. And even though it does support Last-Modified, and I spit back verbatim both the ETag it last gave me (blank) and the Last-Modified value it gave me, it still doesn't return a 304. Both sites show the same behavior.

Argh... so now I need to keep a flag on sites for which I can't trust conditional get.

Well, ignoring blank ETags or blank Last-Modifieds worked just fine because my code defaults to using an md5 of the site's content to determine if it changed. Now, the only downside to that is that some sites, a very few, have dynamic content on all of their pages (for instance, a "this page took x seconds to generate", or a random quote where everything else is static), so there's nothing stable I can use to do an md5 on. I'll have to do something else to figure out if those changed.

Debugging Tip

One word: logs.

Seriously, if you're writing code that is even marginally complex, I promise you, you will not get it right on the first try. So then when it's wrong, you typically put a few print statements in to see what's going on. But it's all ad hoc. You're not likely to cover every branch of every important conditional. Print statements are ok to debug something small or trivial, but if you're writing something more complex you'll likely benefit from writing out a log file.

Just do it, you'll thank yourself. My code didn't seem to be working correctly in every case, so I sat down, took 20 minutes or so, and wrote to a log file at every important point in the code. I wound up with over a megabyte-sized log file, but was able to go through the logic line by line and as soon as I got to where the error was occurring I spotted it. Turns out I missed a possible case, so I had to add a branch nested a few levels deep in if-then's.

Plus, since I added the logging by calling out to a "log" function, to turn off logging all I have to do is comment out the body of that function.

The depressing end of claymation

It's pretty depressing... with computer animation now, people don't use claymation anymore. The hand thing from Hamburger Helper and the Pillsbury Dough Boy totally aren't as good now as they used to be.

Weblogging pet peeve

Look, if you haven't blogged lately, don't apologize for it. First of all, because it's lame. But really, if you haven't been blogging frequently or at all, people will probably assume you have a life. If you blog about not blogging, people might change their minds...

Felicia Day sighting

Hey, I'm pretty sure I just saw Felicia Day on a "The Anti Drug" commercial, but I only caught the end of it.

← July 15, 2003July 17, 2003 →
November 2008
SunMonTueWedThuFriSat
 1
2345678
9101112131415
16171819202122
23242526272829
30 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

new⇒Calif. Supreme Court to take up gay marriage ban

I would argue the point is not​definitional.  While the word​marriage is su...

Justin: Nov 20, 4:37pm

Java join function

Meh, don't have null strings in​your string arrays imo, but you're​welcome ...

Keith: Nov 19, 7:51pm

Girls, please don't get breast implants

sorry but another thing i have to​make a comment on about you​men...the men...

happynow: Nov 17, 11:36pm

Books by Vincent Cheung

to all Cheung​fans:

read:

http://www.progin​osko.com/aquascum/cheung.h...

Zamir: Nov 16, 9:07am

Spider solitaire

To undo or not to undo that is the​question.
I'm an undoer. 
My dad​was n...

Can Turk: Nov 15, 2:50pm

Generated in about 0.064s.

(Used 7 db queries)

mobile phone