<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-22286259</atom:id><lastBuildDate>Thu, 12 Jun 2008 23:24:08 +0000</lastBuildDate><title>chris bennett - the blog</title><description/><link>http://chrisrbennett.com/</link><managingEditor>noreply@blogger.com (Chris Bennett)</managingEditor><generator>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-7987125193082870433</guid><pubDate>Mon, 21 Apr 2008 05:55:00 +0000</pubDate><atom:updated>2008-04-20T23:08:31.919-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>django</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>code</category><title>Python logger config thread safety</title><description>Yes, the python logger is &lt;a href="http://docs.python.org/lib/node424.html"&gt;thread safe&lt;/a&gt;, but don't configure it programmatically (i.e. not via config file).  Adding handlers to a logger with &lt;code&gt;getLogger().addHandler(handler)&lt;/code&gt; does just that - and it will add handlers ad infinitum, even if they are already added.&lt;br /&gt;&lt;br /&gt;So if you want to set logger options, in say, a Django settings.py file:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import logging.config&lt;br /&gt;logging.config.fileConfig("logging.conf")&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Your logging.conf might look like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[loggers]&lt;br /&gt;keys=root&lt;br /&gt;&lt;br /&gt;[handlers]&lt;br /&gt;keys=errhandler,filehandler&lt;br /&gt;&lt;br /&gt;[formatters]&lt;br /&gt;keys=formatter&lt;br /&gt;&lt;br /&gt;[logger_root]&lt;br /&gt;level=NOTSET&lt;br /&gt;handlers=errhandler,filehandler&lt;br /&gt;formatters=formatter&lt;br /&gt;&lt;br /&gt;[handler_errhandler]&lt;br /&gt;class=StreamHandler&lt;br /&gt;level=NOTSET&lt;br /&gt;formatter=formatter&lt;br /&gt;args=(sys.stdout,)&lt;br /&gt;&lt;br /&gt;[handler_filehandler]&lt;br /&gt;class=handlers.RotatingFileHandler&lt;br /&gt;level=NOTSET&lt;br /&gt;formatter=formatter&lt;br /&gt;args=("/var/log/django/my.log", "a", 1024*1024)&lt;br /&gt;&lt;br /&gt;[formatter_formatter]&lt;br /&gt;format=[%(asctime)s] - %(levelname)-8s - "%(message)s" (%(filename)s: %(funcName)s - %(lineno)s)&lt;br /&gt;datefmt=%Y-%m-%d %a %H:%M:%S&lt;br /&gt;class=logging.Formatter&lt;br /&gt;&lt;/code&gt;</description><link>http://chrisrbennett.com/2008/04/python-logger-config-thread-safety.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-6905806323503671719</guid><pubDate>Tue, 05 Feb 2008 01:50:00 +0000</pubDate><atom:updated>2008-02-04T18:17:26.182-08:00</atom:updated><title>Linking out of Flash embedded on MySpace, et. al.</title><description>&lt;span style="font-weight: bold;"&gt;Don't get your hopes up - you can't link directly from a Flash object in MySpace&lt;/span&gt; (Bebo, Facebook, etc.) or any other profile site that adds &lt;code&gt;allowScriptAccess="never"&lt;/code&gt; to your embed code.  &lt;br /&gt;&lt;div&gt;But what if you want to create a link in a Flash widget that works when it can (like, on a blog), but display the URL and a "copy to clipboard" button when it can't (on MySpace)? This way, you don't have to force a user to choose between the version that links properly and one that doesn't (risking that the click-through-rate will be lower on the fallback solution.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the best way to detect the linking limitation, cross-browser:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Make sure your embed code has &lt;code&gt;allowScriptAccess&lt;/code&gt; set to &lt;code&gt;"always"&lt;/code&gt; (it defaults to &lt;code&gt;"sameDomain"&lt;/code&gt;). Be sure this is specified as an object-tag parameter as well as a param-tag name-value pair. MySpace will convert this to &lt;code&gt;"never"&lt;/code&gt; properly.&lt;/li&gt;&lt;li&gt;In ActionScript, call &lt;code&gt;flash.external.ExternalInterface.call("eval", "window.location.href = '[full url]';")&lt;/code&gt;&lt;/li&gt;&lt;li&gt;The &lt;code&gt;ExternalInterface.call&lt;/code&gt; method only works when &lt;code&gt;allowScriptAccess&lt;/code&gt; is &lt;code&gt;"always"&lt;/code&gt;, otherwise it returns &lt;code&gt;null&lt;/code&gt;, so check for that.&lt;/li&gt;&lt;li&gt;If &lt;code&gt;null&lt;/code&gt; is in fact returned, implement your fallback strategy (such as the one mentioned above.)&lt;/li&gt;&lt;/ol&gt;Don't waste your time with shenanigans involving &lt;code&gt;window.open()&lt;/code&gt; and pop-ups either — some pop-up blockers don't take clicks sent to embedded objects into account when determining whether a &lt;code&gt;window.open()&lt;/code&gt; was generated from a user-initiated event.&lt;/div&gt;</description><link>http://chrisrbennett.com/2008/02/linking-out-of-flash-embedded-on.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-3498860673288968569</guid><pubDate>Tue, 04 Dec 2007 08:50:00 +0000</pubDate><atom:updated>2007-12-04T01:01:17.750-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>seo</category><category domain='http://www.blogger.com/atom/ns#'>facebook</category><category domain='http://www.blogger.com/atom/ns#'>responsibility</category><title>Why am I seeing this web site?</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/snowboarders_outlet-795900.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/snowboarders_outlet-795897.png" alt="" border="0" /&gt;&lt;/a&gt;The bottom of this search spam / black-hat SEO / domain squatting page raises the question certainly in your mind "Why am I seeing this web site?"&lt;br /&gt;&lt;br /&gt;This question is especially important when you consider that this page was linked from an Ad placed in Facebook. The idiot that posted this ad needs to be fired.&lt;br /&gt;&lt;br /&gt;Answer: the second "s" in the ad link should not be there.</description><link>http://chrisrbennett.com/2007/12/why-am-i-seeing-this-web-site.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-241592260972206872</guid><pubDate>Sun, 25 Nov 2007 23:06:00 +0000</pubDate><atom:updated>2007-11-25T15:09:12.521-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>social networking</category><category domain='http://www.blogger.com/atom/ns#'>hacks</category><title>Hacking The "Is" Status Paradigm</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/facebook_is_paradigm-788262.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/facebook_is_paradigm-788258.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;It was short lived, but I suspect a more permanent gift from Mark and the Facebook team in the near future.</description><link>http://chrisrbennett.com/2007/11/hacking-is-status-paradigm.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-2354310770166806775</guid><pubDate>Fri, 14 Sep 2007 07:47:00 +0000</pubDate><atom:updated>2007-09-14T02:01:11.016-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>respect</category><category domain='http://www.blogger.com/atom/ns#'>restraint</category><category domain='http://www.blogger.com/atom/ns#'>anecdotes</category><category domain='http://www.blogger.com/atom/ns#'>responsibility</category><title>Line Picking and Platinum Cards</title><description>A past weekend I was at Bed, Bath, and Beyond in Fashion Valley to buy a new shower curtain. I think it was move-in weekend at &lt;span style="font-style: italic;"&gt;the State school&lt;/span&gt; in America's Finest City. It was pretty full with freshmen and women that were dressed like they should be at the beach instead of shopping with their parents. Of course, these youngin's avoided being seen with them to maintain their perceived &lt;span style="font-style: italic;"&gt;coolness.&lt;/span&gt;  Because parents can be embarrassing.&lt;br /&gt;&lt;br /&gt;Needless to say, I didn't want to hang around. I got my shower curtain and dodged the kids while heading for the exit. Lines everywhere, like most places in San Diego on a Saturday.&lt;br /&gt;&lt;br /&gt;When I pick a line to check out in, whether I'm at a retail or grocery store, I have a few selection criteria that I evaluate registers within my line of sight:&lt;ol&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Length of line&lt;/span&gt;: this is a function of the total number of items yet to be scanned as well as  total potential transactions. Shorter lines always win. I have things to do.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Appearance of clerk&lt;/span&gt;: I'm shallow, I know, but I'd rather be checked-out by someone who looks like they are having a good day. They are more likely to give me favorable discounts when I'm chatty.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Entertainment factor of last group in line&lt;/span&gt;: This is highly variable and subjective, it's impossible to tell ahead of time when someone will do something stupid, hilarious, or objectionable. If you know me, you know about my ability to read people in a short amount of time.&lt;/li&gt;&lt;/ol&gt;This time, the choice came down to the third criterion. I picked the line with a wannabe-Gothic Hot Topic-clad freshwoman with two seemingly well-to-do parents. They were doing their darnedest to embarrass her, histrionic folk, looking around to see if anyone was witnessing their pain of a daughter that clearly wanted to be somewhere else.  In Orange County, these kinds of parents would just give the kid an American Express Platinum Card.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/img_ben_plat_140x90-783898.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/img_ben_plat_140x90-783897.gif" alt="" border="0" /&gt;&lt;/a&gt;Instead, this pair of nouveau-riches parents decided to show off their plastic Platinum Card. Cheap thrills from the $625 annual fee for two or more cards.&lt;br /&gt;&lt;br /&gt;When I complete a transaction, I pull out my non-Platinum card and swipe it or hand it to the cashier. I &lt;span style="font-style: italic;"&gt;do not&lt;/span&gt; wave it around and loudly ask my significant other, "Should I put this on the Platinum Card??!!" I &lt;span style="font-style: italic;"&gt;do not&lt;/span&gt; delay in swiping it to make sure everyone in line gets a glimpse at my piece of plastic with magnetic stripe, coveted or not.&lt;br /&gt;&lt;br /&gt;At least when you swipe a Platinum Card, you never have to worry about it declining, because it simply doesn't decline. I mean, the ability to afford the $625 annual fee is the paragon of fiscal responsibility and success beyond measure.&lt;br /&gt;&lt;br /&gt;So needless to say, when the mother's Platinum Card declined, the only thing keeping me from laughing out loud was the forced seal of my lips. I think they heard the involuntary guttural part of my response so I started looking at the ceiling as if I wasn't paying attention.&lt;br /&gt;&lt;br /&gt;"That's a Platinum Card! It isn't supposed to decline!" exclaimed the father, with a tone of indignation to the poor girl behind the counter.  "Try it again!"&lt;br /&gt;&lt;br /&gt;She did. It declined again. Now the daughter is laughing - either at my visible attempt to avoid cracking up or the fact that people at other registers were now watching the drama unfold.&lt;br /&gt;&lt;br /&gt;The father knows best, so he pulls out his own Platinum Card.  "It must be something wrong with your reader, try &lt;span style="font-style: italic;"&gt;my &lt;/span&gt;[emphasis his] Platinum Card," he says, loud enough for everyone paying attention to hear.&lt;br /&gt;&lt;br /&gt;She does. It goes through. I smile at the daughter, nonverbally agreeing on how pathetic her parents were.&lt;br /&gt;&lt;br /&gt;Clearly still embarrassed, the father &lt;span style="font-style: italic;"&gt;continues&lt;/span&gt; his rant about the declining of his wife's card.&lt;br /&gt;&lt;br /&gt;"There's something wrong with your machine. Look! Both cards have the same number!"&lt;br /&gt;&lt;br /&gt;At that point I was about to get instructional about how those things actually work, but decided against. They briskly departed after their failed attempt to save face.&lt;br /&gt;&lt;br /&gt;It was my turn at the register. The girl, obviously relieved that her previous customer was gone, scanned my curtain.&lt;br /&gt;&lt;br /&gt;"I hope this doesn't decline..." I joke as I hand her my American Express &lt;span style="font-style: italic;"&gt;Blue&lt;/span&gt;. She smiles while swiping it.  &lt;span style="font-style: italic;"&gt;Approved.&lt;/span&gt; "...Whoa, it went through! And it's not even Platinum!"&lt;br /&gt;&lt;br /&gt;She laughs. "Well, unlike them, you actually have the money."</description><link>http://chrisrbennett.com/2007/09/line-picking-and-platinum-cards.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-6254990426231849432</guid><pubDate>Thu, 26 Apr 2007 23:07:00 +0000</pubDate><atom:updated>2007-04-26T16:08:47.182-07:00</atom:updated><title>Ideas?</title><description>I should really add more to this blog... any ideas? Does anyone actually read this at this point?</description><link>http://chrisrbennett.com/2007/04/ideas.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-7580417755853418655</guid><pubDate>Tue, 27 Feb 2007 08:43:00 +0000</pubDate><atom:updated>2007-02-27T00:48:49.651-08:00</atom:updated><title>Overflow</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/treadmill-789748.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/treadmill-788300.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;So I like to run. A lot. Last Friday I wanted to see what the treadmill display would do if I ran over 99:59 (99 minutes, 59 seconds). It autostarted a "cooldown" at 98:00 and kept counting up.  After 99:59 it started back at 0:01 and counted up until 1:00, when it shut down.&lt;br /&gt;&lt;br /&gt;Yes, that 10.9 number represents miles.</description><link>http://chrisrbennett.com/2007/02/overflow.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-604471033856672584</guid><pubDate>Tue, 27 Feb 2007 08:32:00 +0000</pubDate><atom:updated>2007-02-27T00:34:57.370-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>cool</category><title>AdSense Test</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/gmail_test-705544.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/gmail_test-704361.png" alt="" border="0" /&gt;&lt;/a&gt;"cool" - the AdSense here is particularly relevant.</description><link>http://chrisrbennett.com/2007/02/adsense-test.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-8760338601026890680</guid><pubDate>Wed, 31 Jan 2007 09:43:00 +0000</pubDate><atom:updated>2007-01-31T01:50:05.719-08:00</atom:updated><title>Colbert YouTube Irony</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/colbert_youtube-749980.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/colbert_youtube-749980.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm pretty sure Comedy Central waited a bit to take &lt;a href="http://www.youtube.com/watch?v=5LFXi17d1cI"&gt;this particular clip&lt;/a&gt; down to avoid the irony.</description><link>http://chrisrbennett.com/2007/01/colbert-youtube-irony.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-853787308648535236</guid><pubDate>Wed, 31 Jan 2007 08:45:00 +0000</pubDate><atom:updated>2007-01-31T00:49:31.398-08:00</atom:updated><title>Pyachex is Awesome</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/evnetful-705014.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/evnetful-703904.png" alt="" border="0" /&gt;&lt;/a&gt;</description><link>http://chrisrbennett.com/2007/01/pyachex-is-awesome.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-4869505690785925651</guid><pubDate>Tue, 16 Jan 2007 05:10:00 +0000</pubDate><atom:updated>2007-01-15T21:17:59.494-08:00</atom:updated><title>Cold in SoCal</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/ice-778134.jpeg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://chrisrbennett.com/uploaded_images/ice-776964.jpeg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is from my car's onboard computer/compass. Usually it would show temperature in the position where "ICE" appears. Needless to say I was surprised when it changed from "33 &amp;deg;F" to "ICE".</description><link>http://chrisrbennett.com/2007/01/cold-in-socal.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-6751215446048391060</guid><pubDate>Fri, 15 Dec 2006 03:34:00 +0000</pubDate><atom:updated>2006-12-14T14:33:47.591-08:00</atom:updated><title>Weather widget divides by zero</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/dashboard_fubar-769733.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://chrisrbennett.com/uploaded_images/dashboard_fubar-767808.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;Wow.</description><link>http://chrisrbennett.com/2006/12/weather-widget-divides-by-zero.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-5830905362233735850</guid><pubDate>Tue, 21 Nov 2006 06:32:00 +0000</pubDate><atom:updated>2006-11-20T22:53:19.790-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>technology</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>code</category><title>ISBN Check Methods</title><description>&lt;span style="font-style:italic;"&gt;Note: From now on, I'm likely going to be posting code on here in addition to personal blog entries. Don't get scared off.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I wrote some Python code to handle ISBN verification and ISBN-13 conversions.  ISBN-13 is the mandatory update to all ISBN numbers that takes effect January 1, 2007.  In general, an ISBN-13 - which is, at its core, EAN-13 - can be computed from an ISBN-10 number by dropping the end check digit, adding "978" to the beginning (the EAN code for "Bookland" in the US), and recalculating the check digit, then adding it to the end.&lt;br /&gt;&lt;br /&gt;So here's the code that does it, not the best I'm sure, but the algorithm is there:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;"""&lt;br /&gt;isbn.py&lt;br /&gt;ISBN helper methods to handle validation and conversion&lt;br /&gt;&lt;br /&gt;"""&lt;br /&gt;&lt;br /&gt;def validateisbn(isbn):&lt;br /&gt;    isbn = isbn.replace("-", "")&lt;br /&gt;    return isbn.endswith(str(calc_checkdigit(isbn[:-1])))&lt;br /&gt;       &lt;br /&gt;def calc_checkdigit(isbn):&lt;br /&gt;    """&lt;br /&gt;    Input an isbn without a checksum (or punctuation) and returns&lt;br /&gt;    correct check digit.&lt;br /&gt;   &lt;br /&gt;    """&lt;br /&gt;    if len(isbn) == 9:&lt;br /&gt;        # Do the old ISBN-style check generation&lt;br /&gt;        products = [(10 - n) * int(isbn[n]) for n in range(9)]&lt;br /&gt;        remainder = (sum(products) % 11)&lt;br /&gt;        if remainder == 0:&lt;br /&gt;            check = 0&lt;br /&gt;        else:&lt;br /&gt;            check = 11 - remainder&lt;br /&gt;            if check == 10:&lt;br /&gt;                check = "X"&lt;br /&gt;        return str(check)&lt;br /&gt;    elif len(isbn) == 12:&lt;br /&gt;        # Do EAN-style check&lt;br /&gt;        products = []&lt;br /&gt;        for digit in range(12):&lt;br /&gt;            if digit % 2 == 0:&lt;br /&gt;                # Even digit (zero-based) is weight factor 1&lt;br /&gt;                products.append(int(isbn[digit]))&lt;br /&gt;            else:&lt;br /&gt;                # Odd digit is weight factor 3&lt;br /&gt;                products.append(int(isbn[digit]) * 3)&lt;br /&gt;        remainder = (sum(products) % 10)&lt;br /&gt;        if remainder == 10:&lt;br /&gt;            check = 0&lt;br /&gt;        else:&lt;br /&gt;            check = 10 - remainder&lt;br /&gt;        return str(check)        &lt;br /&gt;    else:&lt;br /&gt;        raise Exception("Length of input ISBN is incorrect.")&lt;br /&gt;   &lt;br /&gt;def convert_to_isbn13(isbn10, code="978"):&lt;br /&gt;    """Assumes a valid isbn10 and EAN Bookland code (could also be 979)."""&lt;br /&gt;    isbn = isbn.replace("-", "")&lt;br /&gt;    isbn = code + isbn[:-1]&lt;br /&gt;    return isbn + calc_checkdigit(isbn) # Generate new check digit&lt;br /&gt;   &lt;br /&gt;def convert_to_isbn10(isbn13):&lt;br /&gt;    """Assumes a valid isbn13."""&lt;br /&gt;    isbn = isbn.replace("-", "")&lt;br /&gt;    if isbn13.startswith("978") or isbn13.startswith("979"):&lt;br /&gt;        return isbn13[3:-1] + calc_checkdigit(isbn13[3:-1])&lt;br /&gt;    else:&lt;br /&gt;        raise Exception("ISBN13 not a Bookland ISBN.")&lt;br /&gt;&lt;/pre&gt;</description><link>http://chrisrbennett.com/2006/11/isbn-check-methods.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-116149867233521744</guid><pubDate>Sun, 22 Oct 2006 06:27:00 +0000</pubDate><atom:updated>2006-10-21T23:31:12.346-07:00</atom:updated><title>IT'S A TRAP!</title><description>11:13:26 PM Emily: how long before wine goes bad after you open it if you put the cork back in it?&lt;br /&gt;11:13:37 PM Chris: you know i think it depends on the wine&lt;br /&gt;11:14:04 PM Emily: ok bc the kid next door gave me the white wine he just opened&lt;br /&gt;11:14:18 PM Emily: and he had like one sip&lt;br /&gt;11:14:57 PM Chris: what kind of wine exactly&lt;br /&gt;11:15:02 PM Emily: cheap stuff&lt;br /&gt;11:15:06 PM Chris: lol tell me about it&lt;br /&gt;11:15:07 PM Emily: charles shaw white wine&lt;br /&gt;11:15:10 PM Chris: OH FUCK&lt;br /&gt;11:15:11 PM Chris: LOL&lt;br /&gt;11:15:14 PM Chris: THROW IT THE FUCK AWAY&lt;br /&gt;11:15:17 PM Chris: THROW IT THE FUCK OUT&lt;br /&gt;11:15:18 PM Emily: lol bad/&lt;br /&gt;11:15:19 PM Chris: OMGOMG&lt;br /&gt;11:15:21 PM Emily: ?&lt;br /&gt;11:15:23 PM Chris: DUDE&lt;br /&gt;11:15:29 PM Chris: THROW IT OUT THE NEAREST AIRLOCK&lt;br /&gt;11:15:40 PM Chris: ITS A TRAP!!!&lt;br /&gt;&lt;br /&gt;Anybody who has tried Two Buck Chuck Chardonnay knows exactly what I'm talking about.</description><link>http://chrisrbennett.com/2006/10/its-trap.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-116041670646794263</guid><pubDate>Mon, 09 Oct 2006 16:14:00 +0000</pubDate><atom:updated>2006-10-09T10:58:33.176-07:00</atom:updated><title>How Chris Sees cnn.com</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/images/cnn_20061009.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px;" src="http://chrisrbennett.com/images/cnn_20061009.png" alt="" border="0" /&gt;&lt;/a&gt;</description><link>http://chrisrbennett.com/2006/10/how-chris-sees-cnncom.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115946260312605772</guid><pubDate>Thu, 28 Sep 2006 16:09:00 +0000</pubDate><atom:updated>2006-09-28T09:56:43.186-07:00</atom:updated><title>IRC is no longer The Vogue</title><description>&lt;span style="font-style: italic;"&gt;This is my take on the #sdcolleges "drama," mostly written last night and refined this morning.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Everyone is upset that people are leaving the #sdcolleges channel ostensibly because it's all computer-talk and no fun.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some of the false assumptions about IRC:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;IRC is a Social Club. Wrong.&lt;/span&gt;&lt;br /&gt;   At some point, somebody decided that #sdcolleges would be a good idea for everyone to congregate and talk about stuff, organizing events and such.  Is IRC really an appropriate venue for this kind of thing? No. Most channels on IRC are not geocentric, yet we are the anomaly. Most channels on IRC are about computer related topics, yet we strive not to be?   A while ago IRC was inaccessible to all but the UNIX elite (except for those mIRC guys).  Now, Colloquy and gaim make it accessible to the masses. Inevitably, it became really easy to invite the non-technical people into the channel.  This had the effect of shifting channel topics and alienating the technical channel members.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Everyone on IRC has a valuable opinion. Wrong.&lt;/span&gt;&lt;br /&gt;   Every group has someone who thinks that he/she is right about everything all the time, they are arrogant.   There is always someone who tries to lead the group and claim ownership.  There is always someone who is a n00b. There is always someone who contributes great things. Someone who brings people together. Someone who is a catalyst for social relationships. Someone who breaks hearts. Someone who makes grandiose claims that are unrealistic. Someone who is a flake. You know who you are.   I know who I am. Not one of these people can be authoritative on all subjects.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;People are entitled to discuss the topic of their interest. Wrong.&lt;/span&gt;&lt;br /&gt;  Coming on the channel and starting a topic of your own when there is clearly one already is rude. Yes, I'm sure we've all done it, but it gets annoying with frequency. Enough said about that.&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;IRC is not the place for the group that meets for dinner. It is not a place to socialize.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I certainly do not advocate isolating people from a group, but maybe this group was not for them in the first place.  The IRC channel was certainly not the place for Stephi and Hanna, but I think the other social context of dinner and &lt;span style="font-style: italic;"&gt;social&lt;/span&gt; interaction was.  Am I the only one who is going to admit this?  I know I'm not authoritative in "the group," but I can certainly try to analyze what I see happening from my somewhat limited perspective. (Limited in the sense that I'm not always involved with the group, but I still see what's going on.)&lt;br /&gt;&lt;br /&gt;I think [some people] have to go from the social group.  And Stephi and Hanna are not included in that grouping.  They brought more to the dinner parties than [some people].  This group is going to die unless [some people] leave. That likely will not happen. Only time will tell.&lt;br /&gt;&lt;br /&gt;Also, some of us need to learn what is and is not fair.  Expecting me to pay $15 for a burger is not fair. Period.</description><link>http://chrisrbennett.com/2006/09/irc-is-no-longer-vogue.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115913314213057152</guid><pubDate>Sun, 24 Sep 2006 20:58:00 +0000</pubDate><atom:updated>2006-09-24T14:25:42.143-07:00</atom:updated><title>Never Better</title><description>I don't know what's going on, but I've never felt better.  The last few days have been great for me. It all started early in the evening on Thursday, I was driving through San Diego and everything started to get a little brighter, almost literally. Since then it seems my vision of the world has completely changed, everything looks and feels different. It almost reminds me of how I felt over two years ago before some relationship drama started. I'm feeling things that I haven't felt in a long time.&lt;br /&gt;&lt;br /&gt;I haven't been able to explain these new feelings. The best physiological reason I can come up with is that pseudoephedrine is somehow mucking with my serotonin levels (much in the way  amphetamines would - I know that pseudoephedrine is chemically similar to methamphetamine, and also affects the CNS, but I'm not sure how it all ties in.)&lt;br /&gt;&lt;br /&gt;Have I been depressed because of low serotonin levels? Or are things just looking up? Rest assured, I'm on this.  If I have to see a neurologist or psychiatrist then that's what I'm going to have to do -  I don't want to go back to that state of lacking almost all feeling.</description><link>http://chrisrbennett.com/2006/09/never-better.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115696761119022341</guid><pubDate>Wed, 30 Aug 2006 19:53:00 +0000</pubDate><atom:updated>2006-08-30T12:53:31.230-07:00</atom:updated><title>On Lunch</title><description>&lt;p&gt;So I finally realized that I was spending too much on my daily Subway lunches. My meal was $7.53 every day, which included a double-meat turkey wrap, apples, and a diet coke.&amp;nbsp; That works out to $37.65&amp;nbsp;per week and $150 per month.&amp;nbsp; Needless to say, thats a lot of dough (but not really since I get the wrap- haha okay not funny).&lt;/p&gt; &lt;p&gt;This week I realized that I could probably make the same lunch by myself for much less. I went to the grocery store and bought turkey, tortilla wraps, a bag of pre-shredded lettuce (yes!), some condiments including jared tomatoes, olives, and peppercionis.&amp;nbsp; It turns out that I bought two weeks of supplies for $20. (Not including soda, which is cost negligible anyway.)&amp;nbsp; The way I look at it, thats a savings of over a hundred bucks a month.&amp;nbsp; I can think of a lot of better things to do with that money - like go out to a decent restaurant once a week.&lt;/p&gt; &lt;p&gt;I'm sure we all have some inefficient or cost-ineffective things we do on a daily basis that can be easily changed for the better.&lt;/p&gt; &lt;p&gt;(Oh yeah, this post is an excuse to test &lt;a href="http://ideas.live.com/programpage.aspx?versionId=4372c8c2-b76f-4d44-aea1-9835b61d8dc1"&gt;Windows Live Writer Beta&lt;/a&gt;. If the formatting looks horsed, you know who to blame.)&lt;/p&gt;</description><link>http://chrisrbennett.com/2006/08/on-lunch.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115649374228917242</guid><pubDate>Fri, 25 Aug 2006 08:12:00 +0000</pubDate><atom:updated>2006-08-25T01:15:42.300-07:00</atom:updated><title>No more audit!</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chrisrbennett.com/uploaded_images/yay-790938.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://chrisrbennett.com/uploaded_images/yay-788999.jpg" alt="" border="0" /&gt;&lt;/a&gt;I can finally return to my life of not worrying about getting seriously audited. Lesson learned: make sure you always file a 1040 Schedule D when you sell shares of a stock whether you earn income or not. Otherwise the IRS will assume that you paid -0- for your shares and sold them for X, making X profit and wanting to tax X amount of capital gains. Oh how I love income tax. What ever happened to Forbes' Flat Tax?</description><link>http://chrisrbennett.com/2006/08/no-more-audit.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115523354030119942</guid><pubDate>Thu, 10 Aug 2006 18:09:00 +0000</pubDate><atom:updated>2006-08-10T11:13:42.740-07:00</atom:updated><title>MTA Bus 1: Super Bowl...</title><description>...or, the things you see at 1:30 AM after leaving the gym.  The bus clearly had "1 SUPER BOWL" on its electronic signage on the front and sides.&lt;br /&gt;&lt;br /&gt;I've also seen someone switch all the starting 3's for gas prices at the Costa Verde station to 9's. (A glimpse of the future!)&lt;br /&gt;&lt;br /&gt;I think the point here is, people like to do crazy things when it's late and no one is watching. Why do I never have my camera with me for these things?</description><link>http://chrisrbennett.com/2006/08/mta-bus-1-super-bowl.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-115508790100888637</guid><pubDate>Wed, 09 Aug 2006 01:30:00 +0000</pubDate><atom:updated>2006-08-08T18:46:39.053-07:00</atom:updated><title>To sum it up in one word...</title><description>To sum up my life since my last blog post in one word:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;blockquote&gt;&lt;/blockquote&gt;Busy&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;To sum up my life since my last blog post in bullets (no particular order):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Had to tell someone that I never wanted to talk to or see that person ever again&lt;/li&gt;&lt;li&gt;Made it a goal to lose weight, I ran every night for about an hour since April&lt;/li&gt;&lt;li&gt;Started hanging out with #sdcolleges people more&lt;/li&gt;&lt;ul&gt;&lt;li&gt;They're awesome&lt;/li&gt;&lt;li&gt;Shout outs to all of you. You know who you are.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Had a great Sun God, far exceeding expectations&lt;/li&gt;&lt;li&gt;Moved into my own apartment&lt;br /&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Life is beautiful&lt;/li&gt;&lt;li&gt;But I don't have a television (and that's okay because I don't have time for it anyway&lt;/li&gt;&lt;li&gt;I do have a great Stereo&lt;/li&gt;&lt;ul&gt;&lt;li&gt;The Stereo has 7.1EX surround. Only useful with a television&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Met and partied with neighbors&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Actually lost a lot of weight ~ 30 lbs. I went from a ~34 inch waist to &lt;30&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Because of that, I've had to buy all new clothing. I like the way I look though, but I fear it's going to be high maintenance.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Since I've been going to the gym every night, I've had to blow off a lot of friends.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;I have few friends now, but the friends I do have are great&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Went on a "business trip" to Mashpit in San Francisco&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Came up with a great business plan with Jim Paulos&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Set that plan into (slow, incremental) motion&lt;/li&gt;&lt;li&gt;Learned about business legal structures&lt;/li&gt;&lt;li&gt;Learned about trademarks and patents&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Came up with a good business plan for a small project on my own&lt;/li&gt;&lt;ul&gt;&lt;li&gt;That plan is being executed at a frightening pace. I have a deadline for August 24th.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Learning &lt;a href="http://python.org"&gt;Python &lt;/a&gt;and &lt;a href="http://djangoproject.com"&gt;Django&lt;/a&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Python is awesome&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Learned a good deal more about UNIX&lt;/li&gt;&lt;li&gt;Learned Flash and ActionScript&lt;/li&gt;&lt;li&gt;Got audited by the IRS for FY2004&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Learned a lot about the IRS, Taxes&lt;/li&gt;&lt;li&gt;Corrected 2004 return by adding the right Schedule D&lt;/li&gt;&lt;li&gt;Expecting $20 back (as opposed to paying $300)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Finished with Java&lt;/li&gt;&lt;li&gt;Rode in Jim's Ferrari's (yes, plural)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Turned 21&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Bought alcohol at:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Bar (12:01AM) with Scott, who is awesome&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Showed Scott the La Jolla Secret Onramp&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Restaurant (Red Robin w/EVDB, 12:01 PM; Jimmy Love's w/family, 8:00 PM)&lt;/li&gt;&lt;li&gt;Market (11:50 PM)&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Had class at 10AM the next day =[&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Planning to go to Vegas soon&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Still trying to figure out when I have some time to relax&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt; &lt;/div&gt;</description><link>http://chrisrbennett.com/2006/08/to-sum-it-up-in-one-word.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-114402782009264998</guid><pubDate>Mon, 03 Apr 2006 01:29:00 +0000</pubDate><atom:updated>2006-04-02T18:30:20.100-07:00</atom:updated><title>Thanks California</title><description>&lt;a href="http://chrisrbennett.com/uploaded_images/castaterefund-718998.jpg"&gt;&lt;img style="DISPLAY: block; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://chrisrbennett.com/uploaded_images/castaterefund-716414.jpg" border="0" /&gt;&lt;/a&gt;It turns out I overpaid my California taxes by a dollar. I knew this when I was working on my return so I put down -0- on the line that said tax refund (although very clearly subtraction of tax liability from tax withheld was a dollar) because I didn't want it. Am I seriously supposed to deposit a one dollar check? It probably cost more than a dollar for the paper and postage associated with this check. I think my point here is, when I say zero, I mean zero, California you can keep your money&amp;nbsp;&lt;a href='http://picasa.google.com/blogger/' target='ext'&gt;&lt;img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' style='border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;' align='middle' border='0' /&gt;&lt;/a&gt; </description><link>http://chrisrbennett.com/2006/04/thanks-california_02.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-114091089266028092</guid><pubDate>Sat, 25 Feb 2006 23:40:00 +0000</pubDate><atom:updated>2006-02-25T15:41:32.670-08:00</atom:updated><title>ZGallerie</title><description>I can only afford ZGallerie.  Galleries A through Y - too expensive.</description><link>http://chrisrbennett.com/2006/02/zgallerie.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-114090824762215313</guid><pubDate>Sat, 25 Feb 2006 22:56:00 +0000</pubDate><atom:updated>2006-02-25T14:58:18.016-08:00</atom:updated><title>Some guys at UCSD can edit</title><description>Found this on the UCSD LiveJournal:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=dUto_zdvb90"&gt;"Yellow Fever"&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Funny stuff.</description><link>http://chrisrbennett.com/2006/02/some-guys-at-ucsd-can-edit.html</link><author>noreply@blogger.com (Chris Bennett)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-22286259.post-114039579392116735</guid><pubDate>Mon, 20 Feb 2006 00:15:00 +0000</pubDate><atom:updated>2006-02-19T16:36:33.926-08:00</atom:updated><title>Dammit</title><description>&lt;a href="http://chrisrbennett.com/uploaded_images/DSC00942-792760.JPG"&gt;&lt;img style="DISPLAY: block; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://chrisrbennett.com/uploaded_images/DSC00942-790234.JPG" border="0" /&gt;&lt;/a&gt;  So I'm driving to Krispy Kreme's for some doughnuts and I was going a nice 35-40 in the right lane.  Some idiot decides to make a turn into my driver's side door.  He didn't have his license or insurance (supposedly his girlfriend had both) but he was able to recite his drivers license and SSN.  I'm not sure if I've been scammed or not yet, but he seemed fairly legit.  I would have called the cops had it not been for his passenger being a large tatooed (I noticed one tatoo was of a Marijuana leaf - classy) man.   We'll see how this turns out.  Luckily I was driving a '98 Chevy Blazer and not a new BMW and the only damaged part was my driver's side door panel.&amp;nbsp;&lt;a href='http://picasa.google.com/blogger/' target='ext'&gt;&lt;img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' style='border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;' align='middle' border='0' /&gt;&lt;/a&gt; </description><link>http://chrisrbennett.com/2006/02/dammit.html</link><author>noreply@blogger.com (Chris Bennett)</author></item></channel></rss>
