<?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/' xmlns:georss='http://www.georss.org/georss' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-9714907</atom:id><lastBuildDate>Fri, 12 Feb 2010 14:51:19 +0000</lastBuildDate><title>Speak and Shout</title><description>Faith, technology and life in general.</description><link>http://mysite.verizon.net/bcorfman/</link><managingEditor>noreply@blogger.com (Brandon Corfman)</managingEditor><generator>Blogger</generator><openSearch:totalResults>146</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-242743873191940946</guid><pubDate>Tue, 28 Oct 2008 21:15:00 +0000</pubDate><atom:updated>2008-10-28T20:26:44.513-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>games</category><category domain='http://www.blogger.com/atom/ns#'>raven</category><category domain='http://www.blogger.com/atom/ns#'>checkers</category><category domain='http://www.blogger.com/atom/ns#'>python</category><title>Raven Checkers released</title><description>I published my first public version (0.3) of &lt;a href="http://code.google.com/p/raven-checkers/"&gt;Raven Checkers&lt;/a&gt; to Google Code a few weeks ago. It has been a fun adventure to develop a cross-platform checkers game engine and GUI in Python.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://mysite.verizon.net/bcorfman/uploaded_images/raven-766187.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 349px; height: 400px;" src="http://mysite.verizon.net/bcorfman/uploaded_images/raven-766184.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Some interesting items about Raven from a development standpoint:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;One or two player mode, plus an "autoplay" feature that pits the AI engine against itself. &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt; &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;Cross-platform Tkinter GUI with model-view-controller (MVC) architecture. &lt;/a&gt;&lt;a name="Version_0.3"&gt;&lt;/a&gt;&lt;a name="Version_0.3"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Undo and redo move feature.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;AI opponent uses a standard alpha-beta search algorithm which runs in a background process (using the 2.6 multiprocessing library) with a customizable "think time". &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;Board Setup allows you to configure the pieces on the checkerboard, set the number of players, and select which player goes next. &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a name="Version_0.3"&gt;Flip Board allows you to rotate the board 180 degrees to view pieces from either Black or White's perspective.&lt;/a&gt;&lt;br /&gt;&lt;a name="Version_0.3"&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;As I've mentioned in a previous post, my success in developing Raven owes a lot to &lt;a href="http://www.fierz.ch/"&gt;Martin Fierz &lt;/a&gt;and &lt;a href="http://norvig.com/"&gt;Peter Norvig&lt;/a&gt;, who developed the evaluation function and search code that are used inside the game. Thanks to both of you for making your code open-source so that others could learn from and build on it.&lt;br /&gt;&lt;p&gt;My future plans for Raven involve taking it in a different direction than a typical game engine. Most checkers or chess programs go the route of deep search combined with perfect opening and endgame databases. These techniques are well-explored and not really all that interesting to me. I plan on making a big change in future versions of Raven by relying more on planning than brute-force search. Since Python is not a high performance language, it's encouragement to make Raven work smarter, not harder.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="Future_plans"&gt;Here's my to-do list so far:&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a name="Future_plans"&gt;Implement a hierarchical task network (HTN) planner that will devise opening themes and endgame strategies. These plans will be based on tactics and endings from Richard Pask's books &lt;/a&gt;&lt;a href="http://www.jimloy.com/checkers/pask.htm" rel="nofollow"&gt;Starting Out in Checkers&lt;/a&gt; and &lt;a href="http://www.bobnewell.net/checkers/bookorders/getpbcd1.html" rel="nofollow"&gt;Play Better Checkers &amp;amp; Draughts&lt;/a&gt;, which I use in my own checkers study. The architecture of the planner will be very similar to the one used for &lt;a href="http://www.bridgebaron.com/home.shtml"&gt;Bridge Baron&lt;/a&gt;, featured in &lt;a href="http://www.cs.umd.edu/%7Enau/planning/slides/chapter23.pdf" rel="nofollow"&gt;Chapter 23&lt;/a&gt; of the book &lt;a href="http://www.laas.fr/planning/" rel="nofollow"&gt;Automated Planning&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;Add a transposition table and some move ordering to help with alpha-beta search depth. (I will probably make use of the transposition table code in &lt;a href="http://pychess.googlepages.com/" rel="nofollow"&gt;PyChess&lt;/a&gt; or &lt;a href="http://pypi.python.org/pypi/chesstools/0.1.2" rel="nofollow"&gt;Chesstools&lt;/a&gt;.) Despite my preference for using the planner, I would like to be able to fall back on good search for the early- and late-midgame when play becomes a bit more muddled. &lt;/li&gt;&lt;li&gt;Add a save/load game feature, along with some way of annotating different moves in the game. (My thoughts on the "annotation" feature are a little fuzzy, but it's something I want for checkers study.) &lt;/li&gt;&lt;li&gt;Make the undo and redo work correctly with the background AI processing. Right now, Raven doesn't stop its search if an undo/redo is executed, and it should.&lt;/li&gt;&lt;li&gt;Create some official distributions so a user doesn't have to checkout the code themselves or require Python to be installed on their system. (Although listed last, this is really something I will likely tackle first, so more folks can enjoy Raven.)&lt;a name="Future_plans"&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;There is plenty here, but I'm not in a hurry. This is just a fun side project. I have the vague idea that I'd like to get most of the features above (certainly the planner and its knowledge base) implemented within a year, so I could give a presentation at PyCon 2010. Seems like a good goal to keep in view.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-242743873191940946?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/10/raven-checkers-released.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-6895125338593780190</guid><pubDate>Tue, 20 May 2008 16:08:00 +0000</pubDate><atom:updated>2008-05-20T13:11:43.285-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>ai</category><category domain='http://www.blogger.com/atom/ns#'>checkers</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><category domain='http://www.blogger.com/atom/ns#'>knose</category><category domain='http://www.blogger.com/atom/ns#'>testing</category><title>A checkers game</title><description>I've made a couple different attempts before to write a Checkers program in Python, but for various reasons, the project stalled. This time, I've been quietly working on it behind the scenes, and last night I played my moves against an intelligent computer player. Some reasons why I had success this time around:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="FONT-WEIGHT: bold; FONT-STYLE: italic"&gt;Using existing open-source code as a reference&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;.&lt;/span&gt; Before I was trying to do everything myself from scratch. Sometimes this can be useful for learning purposes, but in some cases it can just be an exceptionally bad use of time. Now I'm taking a look at code that other people have written and reusing it where I can. For instance, &lt;a href="http://www.fierz.ch/engines.php"&gt;Martin Fierz's Simple Checkers&lt;/a&gt; has a good, basic evaluation function that I've been able to use, and Peter Norvig's elegant &lt;a href="http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Faima.cs.berkeley.edu%2Fpython%2Fgames.html&amp;amp;ei=Le7fR_z2NInQgQSUzPmsCA&amp;amp;usg=AFQjCNFuEkIvtFgYHS9DEPomyd_1N_IOUg&amp;amp;sig2=lKRCzWbKw0ufscVPdL8sBQ"&gt;Python implementation of minimax&lt;/a&gt; would be hard to improve upon. There's enough other interesting challenges in trying to develop my program -- there's no need to waste time doing wheel reinvention.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="FONT-WEIGHT: bold; FONT-STYLE: italic"&gt;Testing.&lt;/span&gt; This is the first time I've worked on a personal project where I felt unit testing &lt;span style="FONT-STYLE: italic"&gt;while I developed&lt;/span&gt; was an absolute necessity. (Although I did &lt;span style="FONT-STYLE: italic"&gt;test-after&lt;/span&gt;, not test-driven development. Sorry, agile folks.) I always do testing in the Python shell, but it's somewhat informal. This time it was formal. Checkers has a number of rules about moves/jumps that are important to get right, and almost every test I wrote uncovered a bug or a subtle problem with my data structures. Thumbs up for unit tests.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Focusing on the logic, not the GUI.&lt;/span&gt; &lt;/span&gt;Before I was developing my checkers GUI in tandem with the game model. Now I'm concentrating on getting the logic right first, and my initial "GUI" is simply an ASCII representation of the checkerboard. In the past, with too many pieces of code changing at the same time I was getting overwhelmed, especially when trying to refactor. Focusing on the GUI is seductive but is ultimately the wrong use of time early in the project.&lt;/li&gt;&lt;/ol&gt;In regards to #2 above, the focus on unit testing has also continued to drive the development of my Komodo extension, &lt;a href="http://mysite.verizon.net/bcorfman/knose.html"&gt;kNose&lt;/a&gt;, which is also very positive. I'm working on updating the extension to use nose 0.10.1 and its much improved support for plugins. (And in another major milestone, kNose is now &lt;a href="http://code.google.com/p/python-knose/"&gt;hosted on google-code&lt;/a&gt; and has a new project member, Christoph Zwerschke, who's been a huge help.)&lt;br /&gt;&lt;br /&gt;Once my Checkers game is released, I'd also like to donate it back to the &lt;a href="http://code.google.com/p/aima-python/"&gt;AIMA project&lt;/a&gt; as an example of what can be done with community code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-6895125338593780190?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/03/checkers-game.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-7453325897944304633</guid><pubDate>Tue, 20 May 2008 12:30:00 +0000</pubDate><atom:updated>2008-05-20T08:35:44.770-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>movies</category><title>Movie blog</title><description>From the number of subscribers at Bloglines, it doesn't look like too many people know that &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;a href="http://blogs.suntimes.com/ebert/"&gt;Roger Ebert has a blog&lt;/a&gt;. His latest post is about the new Indiana Jones movie, which sounds like it's worth seeing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-7453325897944304633?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/05/movie-blog.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-2073299247935419434</guid><pubDate>Tue, 01 Apr 2008 16:00:00 +0000</pubDate><atom:updated>2008-04-01T12:09:52.705-04:00</atom:updated><title>kNose 1.1.1 released</title><description>&lt;a href="http://mysite.verizon.net/bcorfman/knose.html"&gt;This release of kNose&lt;/a&gt; updates the extension to work with Komodo 4.3 and nose 0.10.1.&lt;br /&gt;&lt;br /&gt;It also fixes a problem with the interaction of certain directory paths when running nosetests. Also, I include a message and tooltip for when kNose can't find any unit tests in your project. The tooltip specifies the environment variables and arguments passed to the subprocess module, so it should be easier to debug specific problems with any user's system.&lt;br /&gt;&lt;br /&gt;&lt;img style="width: 225px; height: 375px;" alt="kNose screenshot" src="http://mysite.verizon.net/bcorfman/knose-capture.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For those who don't know, kNose is a Python unit testing extension for &lt;a href="http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml"&gt;Komodo Edit&lt;/a&gt;. It is a GUI frontend for the excellent &lt;a href="http://somethingaboutorange.com/mrl/projects/nose/"&gt;nose framework&lt;/a&gt; written by Jason Pellerin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-2073299247935419434?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/04/knose-111-released.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-7310385823034142302</guid><pubDate>Thu, 13 Mar 2008 22:55:00 +0000</pubDate><atom:updated>2008-03-13T19:18:42.918-04:00</atom:updated><title>Happenings at PyCon</title><description>My friend &lt;a href="http://www.devpicayune.com/"&gt;Steven&lt;/a&gt; is busy preparing for &lt;a href="http://us.pycon.org/2008/conference/talks/#proposal_link_117"&gt;his Django talk&lt;/a&gt; at this year's &lt;a href="http://us.pycon.org/2008/about/"&gt;PyCon&lt;/a&gt;. In his spare time, he's also &lt;a href="http://www.flickr.com/photos/wilcoxzone/sets/72157604104235564/"&gt;taking shots&lt;/a&gt; of the conference and &lt;a href="https://twitter.com/swilcox"&gt;twittering&lt;/a&gt; his experiences. He shares:&lt;br /&gt;&lt;blockquote&gt;The geek thing this year is the eeepc -- I've seen at least 5 or 6 already tonight.&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;I was unable to attend the conference, but I'm monitoring Planet Python to keep track of the goings-on. Maybe next year!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-7310385823034142302?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/03/happenings-at-pycon.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-641220118270192775</guid><pubDate>Mon, 25 Feb 2008 23:38:00 +0000</pubDate><atom:updated>2008-02-25T19:02:32.537-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>plugins</category><category domain='http://www.blogger.com/atom/ns#'>knose</category><category domain='http://www.blogger.com/atom/ns#'>testing</category><category domain='http://www.blogger.com/atom/ns#'>nose</category><title>The Impatient Developer's Guide to Nose Plugins</title><description>Eric Promislow of ActiveState has been working with the nose unit-testing framework in order to hook it into the new version of Komodo IDE. Along the way he figured out how to write a nose plugin, and he's documented his work &lt;a href="http://community.activestate.com/impatient-developers-guide-writing-python-nose-plugins"&gt;in this article&lt;/a&gt;. (Poor Eric misspelled my name as Brendan, but otherwise it's a great article! ;D )&lt;br /&gt;&lt;br /&gt;I'm working hard right now on a game, but this information is cool enough that I could be persuaded to update kNose to use a nose plugin like Eric describes. However, Komodo 4.3 could very well obsolete my work. Are there enough kNose users out there that would like to see an update, or would you rather wait for the next version of Komodo and its unit testing support?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-641220118270192775?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/02/impatient-developers-guide-to-nose.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-8377187461702687550</guid><pubDate>Wed, 16 Jan 2008 17:11:00 +0000</pubDate><atom:updated>2008-01-16T12:51:42.904-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>pygame python</category><title>Pygame bookmark rollup</title><description>I've found a bunch of Pygame-related bookmarks lately that I thought I'd post. These don't seem to be all widely linked, so maybe they'll be useful for other Python game programmers out there.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Chapters 5 (&lt;a href="http://www.cpress.com/book/downloadfile/3767"&gt;Making Things Move&lt;/a&gt;) and 7 (&lt;a href="http://www.willmcgugan.com/2007/10/04/free-chapter-of-beginning-game-development-with-python-and-pygame/"&gt;Take Me To Your Leader&lt;/a&gt;) of Will McGugan's Beginning Game Development with Python and Pygame. Personally, I find chapter 5 to be the most valuable of Will's book.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.pyweek.org/d/932/"&gt;pyMunk&lt;/a&gt;, a wrapper around the Chipmunk 2D gaming physics library.&lt;/li&gt;&lt;li&gt;A couple versions of Pygame main loops: Simon Wittber's &lt;a href="http://pypi.python.org/pypi/mainloop/"&gt;mainloop&lt;/a&gt; and Hectigo's &lt;a href="http://www.hectigo.net/puskutraktori/tutorials/splush.php"&gt;Splush&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.nongnu.org/pygsear/"&gt;Pygsear&lt;/a&gt;, a higher-level Pygame framework that takes care of much of the lower level setup of sprites and events and objects.&lt;/li&gt;&lt;li&gt;&lt;a href="http://opioid-interactive.com/%7Eshang/projects/pygext/"&gt;Pygame Extended&lt;/a&gt; and &lt;a href="http://matthewmarshall.org/projects/rabbyt/"&gt;Rabbyt&lt;/a&gt;, both 2D sprite library add-ons to Pygame that use OpenGL acceleration.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/python-game-kit/downloads/list"&gt;Python Game Kit&lt;/a&gt;, plenty of .egg files that contain useful Pygame utilities and addons.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-8377187461702687550?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2008/01/pygame-bookmark-rollup.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-6028608335756448642</guid><pubDate>Tue, 18 Dec 2007 19:02:00 +0000</pubDate><atom:updated>2007-12-18T16:15:37.633-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>regex</category><category domain='http://www.blogger.com/atom/ns#'>python</category><title>Something I hate about Python's re module</title><description>&lt;b&gt;UPDATE: &lt;/b&gt;I've gotten a couple comments about this, and both seem to illustrate (with varying degrees of tact) that my complaint wasn't all that clear. My problem with the &lt;span style="font-family:courier new;"&gt;re&lt;/span&gt; module is this: Python's documentation for the &lt;span style="font-family:courier new;"&gt;re.match&lt;/span&gt; function is &lt;span style="font-family:courier new;"&gt;match(pattern, string, [flags])&lt;/span&gt; where &lt;span style="font-family:courier new;"&gt;pattern&lt;/span&gt; can be either a regex string or a compiled regex object. If it's a compiled regex object, then supplying an optional flag to &lt;span style="font-family:courier new;"&gt;re.match&lt;/span&gt; (in my case, &lt;span style="font-family:courier new;"&gt;re.IGNORECASE&lt;/span&gt;) doesn't work and, more to the point, fails silently. I think this should throw an exception if it's not going to work. However, I really think that it &lt;i&gt;should&lt;/i&gt; work the way I've illustrated, because, IMO, it's the most natural way to use the API.&lt;br /&gt;&lt;br /&gt;----&lt;br /&gt;I've been burned at least three separate times by the following problem: I'll start out with a simple uncompiled regex for testing and then switch over to a compiled regex. Suddenly, the whole thing stops working.&lt;br /&gt;&lt;br /&gt;Here's an example of what I'm doing below. (Example taken from O'Reilly's &lt;em&gt;Regular Expression Pocket Reference&lt;/em&gt; by Tony Stubblebine.)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;import re&lt;br /&gt;dailybugle = r'Spider-Man Menaces City!'&lt;br /&gt;pattern = r'spider[- ]?man.'&lt;br /&gt;if re.match(pattern, dailybugle, re.IGNORECASE):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print dailybugle&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This prints out 'Spider-Man Menaces City!' as expected. So now I want to compile the regular expression now for speed. I change the code to look like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;import re&lt;br /&gt;dailybugle = r'Spider-Man Menaces City!'&lt;br /&gt;pattern = re.compile(r'spider[- ]?man.')&lt;br /&gt;if re.match(pattern, dailybugle, re.IGNORECASE):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print dailybugle&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Looks simple, right? I just surrounded the pattern string with a call to re.compile(). Unfortunately, the whole thing now quietly fails. What the ... ? Take the re.compile out, it starts working again.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;The solution is to move the re.IGNORECASE flag into the re.compile call, like so:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;import re&lt;br /&gt;dailybugle = r'Spider-Man Menaces City!'&lt;br /&gt;pattern = re.compile(r'spider[- ]?man.', re.IGNORECASE)&lt;br /&gt;if re.match(pattern, dailybugle):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print dailybugle&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In my opinion, this solution is very unintuitive and requires more rejiggering of the code than it should. But even worse is that in my first attempt to use a compiled regex, re.match can receive a re.IGNORECASE flag that it subsequently disregards. This type of call should throw an exception, in my opinion.&lt;br /&gt;&lt;br /&gt;Anyone know a reason for this bad (and seemingly buggy) behavior?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-6028608335756448642?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/12/something-i-hate-about-pythons-re.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>11</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-4709962225363117277</guid><pubDate>Mon, 26 Nov 2007 20:46:00 +0000</pubDate><atom:updated>2007-11-26T15:46:58.309-05:00</atom:updated><title>Phil Hassey's Galcon featured on AIGameDev</title><description>UPDATE: There's a second &lt;a href="http://feeds.aigamedev.com/~r/AiGameDev/~3/190852671/inside-galcon-python-ai"&gt;interview article&lt;/a&gt; with Phil that's just been posted.&lt;br /&gt;&lt;br /&gt;AIGameDev &lt;a href="http://aigamedev.com/practice/galcon-ai"&gt;just posted an article&lt;/a&gt; on Galcon's AI framework. (In case you haven't heard, &lt;a href="http://www.imitationpickles.org/galcon/index.html"&gt;Galcon&lt;/a&gt; is an "awesome high-paced multi-player galactic action-strategy game. You send swarms of ships from planet to planet to take over the galaxy.") Galcon is also written in Python and &lt;a href="http://www.pygame.org/news.html"&gt;Pygame&lt;/a&gt;, and it's nice to see both the language and its great gaming library get some more press.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-4709962225363117277?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/11/phil-hasseys-galcon-featured-on.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-5200454055036924962</guid><pubDate>Thu, 01 Nov 2007 16:17:00 +0000</pubDate><atom:updated>2007-11-01T14:22:15.484-04:00</atom:updated><title>Garbage can samurai</title><description>A guy who made a &lt;a href="http://flickr.com/photos/28813576@N00/sets/72157602787207066/"&gt;full suit of costume armor&lt;/a&gt; from a Rubbermaid 32 gal. trash can.&lt;br /&gt;&lt;br /&gt;Via Larry Hollis.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-5200454055036924962?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/11/garbage-can-samurai.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-8325245870238366894</guid><pubDate>Tue, 30 Oct 2007 15:53:00 +0000</pubDate><atom:updated>2007-10-30T12:50:22.912-04:00</atom:updated><title>doctest with Python</title><description>At home I'm translating some &lt;a href="http://www.essentialmath.com/index.htm"&gt;C++ code&lt;/a&gt; to Python for doing 3-D math with vectors and matrices. (Yes, I know about NumPy -- I have my reasons.) Matrix math requires care to get all the indices right, and it's a good application for writing tests to make sure I've done things correctly.&lt;br /&gt;&lt;br /&gt;About the same time as I started this project, I saw the following response from &lt;a href="http://online.effbot.org/"&gt;Fredrik Lundh&lt;/a&gt; (effbot) to a comment on Reddit:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&gt;what was I thinking using self.assertEqual() in Python?!&lt;br /&gt;Yeah, what were you thinking? Here's how it's spelled in Python, when using the One True Testing Tool (wink)&lt;wink&gt;:&lt;br /&gt;&gt;&gt;&gt; foo.bar&lt;br /&gt;3&lt;br /&gt;(where all you actually typed was foo.bar; the rest is just good old cut and paste).&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Of course, Fredrik here is referring to the &lt;a href="http://docs.python.org/lib/module-doctest.html"&gt;doctest module&lt;/a&gt;. I'd seen Peter Norvig use it before in some of &lt;a href="http://aima.cs.berkeley.edu/python/utils.html"&gt;his Python code&lt;/a&gt;, and I should've paid attention then. Fredrik's comment gave me the push to finally try it. I found that it fits my style of Python coding very naturally, since I typically shake down my code at the REPL as I go. I cut and paste my interactions at the prompt into my class, and I've got some tests up and running quickly. The nice thing is that I'm helping to document my code (inline) as I go, which is a second advantage of doctest. I've never been that enamored with writing a separate test class like I've tried with the unittest library, for instance.&lt;br /&gt;&lt;br /&gt;Good stuff. Thanks, Fredrik.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-8325245870238366894?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/10/doctest-with-python.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-2451595240521627694</guid><pubDate>Thu, 18 Oct 2007 15:40:00 +0000</pubDate><atom:updated>2007-10-18T12:15:06.281-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><category domain='http://www.blogger.com/atom/ns#'>mint</category><category domain='http://www.blogger.com/atom/ns#'>ubuntu</category><title>Linux Mint Cassandra</title><description>I bought a new 160GB hard drive from Wal-Mart with a gift card I received for my birthday (Thanks, Dad!), and I decided to install Mint on it. For those that may not have heard of this particular Linux distribution, it is built on top of Ubuntu. The benefit is that it also includes all of the codecs that you would need to hunt for around the web to get your audio/video/movies to play correctly.&lt;br /&gt;&lt;br /&gt;I was expecting to have to do some weird tricks with my hardware setup since I still wanted to be able to boot into Windows. I have two 80 GB Serial ATA hard drives that are hooked into a Adaptec RAID card in a mirrored configuration. I wanted to keep this setup, and this necessitated a separated HD for Linux -- I didn't want to do partitioning, and I've had bad luck with separate partitions getting corrupted anyway.&lt;br /&gt;&lt;br /&gt;Since the Windows hard drives boot off the Serial ATA card and my new Linux HD was a standard EIDE, I was happy to find that the Mint boot loader actually figured out my weird setup. The loader simply intercepts the boot process and offers me a menu on which operating system to choose when I start up. I was a little wary of picking the Windows option the first time, but it worked just fine.&lt;br /&gt;&lt;br /&gt;Mint itself is terrific. The only hitch I had was that my Sound Blaster Audigy wouldn't work without disabling the onboard audio in the BIOS. No loss since I never use the onboard audio anyway. Last night I was coding in Python with PIDA, listening to my music with Amarok, and watching Rear Window (and Grace Kelly!) on DVD with Totem Movie Player.&lt;br /&gt;&lt;br /&gt;Everything works together smoothly. I'm impressed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-2451595240521627694?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/10/linux-mint-cassandra.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-3057470336433766537</guid><pubDate>Thu, 18 Oct 2007 15:36:00 +0000</pubDate><atom:updated>2007-10-18T12:14:26.091-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>atheism</category><category domain='http://www.blogger.com/atom/ns#'>religion</category><category domain='http://www.blogger.com/atom/ns#'>review</category><category domain='http://www.blogger.com/atom/ns#'>christianity</category><title>Skeptical Christian</title><description>I've been meaning to post for a while about Kyle Deming's Skeptical Christian website. He's done current book reviews on &lt;a href="http://www.skepticalchristian.com/r_dawkins.htm"&gt;Richard Dawkins' The God Delusion&lt;/a&gt; and &lt;a href="http://www.skepticalchristian.com/br_breakingthespell.htm"&gt;Daniel Dennett's Breaking the Spell: Religion as a Natural Phenomenon&lt;/a&gt;. He also tackles philosophical viewpoints such as the &lt;a href="http://www.skepticalchristian.com/cosmological_argument.htm"&gt;Cosmological Argument&lt;/a&gt;. Also, one of the best things about his site too is his (somewhat irregular) &lt;a href="http://www.skepticalchristian.com/podcast"&gt;podcast&lt;/a&gt; in which he responds to questions posed by his blog readers. Highly recommended.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-3057470336433766537?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/10/skeptical-christian.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-9004251111423257630</guid><pubDate>Tue, 14 Aug 2007 03:02:00 +0000</pubDate><atom:updated>2007-08-13T23:09:33.914-04:00</atom:updated><title>kNose 1.1 released</title><description>kNose is a Python unit testing extension for Komodo IDE/Edit. It is a GUI frontend for the excellent nose framework written  by Jason Pellerin.&lt;br /&gt;&lt;br /&gt;&lt;img style="width: 225px; height: 375px;" alt="kNose screenshot" src="http://mysite.verizon.net/bcorfman/knose-capture.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This release of kNose fixes several bugs with parsing nose output, and I  hope it solves all the problems that have been reported. Thanks to Christoph Zwerschke and Arnar Birgisson for their help with  testing, use cases and patch submissions.&lt;br /&gt;&lt;br /&gt;Version 1.1:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Added -v option when calling out to nose so that verbose output is returned in all cases, and parsing works correctly.&lt;/li&gt;&lt;li&gt;Scan URIs for the word 'test' before they are passed to nose to increase speed and avoid additional confusion in parsing.&lt;/li&gt;&lt;li&gt;Changed parsing for test names to use regular expressions for speed and more robust behavior.&lt;/li&gt;&lt;li&gt;Improved parsing to handle classes derived from unittest.TestCase correctly.&lt;/li&gt;&lt;/ul&gt;You can &lt;a href="http://mysite.verizon.net/bcorfman/knose.html"&gt;download it here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-9004251111423257630?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/08/knose-11-released.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-9081664821770396085</guid><pubDate>Thu, 19 Jul 2007 15:46:00 +0000</pubDate><atom:updated>2007-07-24T17:21:56.808-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>development</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>testing</category><category domain='http://www.blogger.com/atom/ns#'>nose</category><title>kNose 1.0 released</title><description>kNose is a free Komodo IDE/Edit extension for Python unit testing; it uses the nose unit testing framework written by Jason Pellerin.&lt;br /&gt;&lt;br /&gt;kNose is &lt;a href="http://mysite.verizon.net/bcorfman/knose.html"&gt;available for download here&lt;/a&gt;, along with documentation I've provided on how to install and use it.&lt;br /&gt;&lt;br /&gt;Hope you enjoy it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-9081664821770396085?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/07/knose-10-released_19.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-7629155788564575605</guid><pubDate>Thu, 05 Jul 2007 01:07:00 +0000</pubDate><atom:updated>2007-07-04T21:21:22.734-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>development</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>testing</category><category domain='http://www.blogger.com/atom/ns#'>nose</category><title>A quick kNose update</title><description>Sorry, I promised to keep everyone updated, and I haven't been doing that.&lt;br /&gt;&lt;br /&gt;I've finished working on expanding and collapsing the tree view and running tests in a background thread. I'm currently writing the code to display tooltips in the tree for any tests that had failures/errors. It's been hard to find out how to do this, because it's very hard to google for "tooltip treeview XUL" (and other combinations thereof) and get any meaningful results. However, I finally found some sample code to look at, and I'm hoping this doesn't take me very long.&lt;br /&gt;&lt;br /&gt;I've noticed some small bugs in my parsing of nose's output results, and I also need to save some of the treeview settings inside of Komodo's preferences. Both of these "to do" items, however, are fairly insignificant.&lt;br /&gt;&lt;br /&gt;My plan is to release it by the end of this week.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-7629155788564575605?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/07/quick-knose-update.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-4197210541898807177</guid><pubDate>Mon, 11 Jun 2007 15:47:00 +0000</pubDate><atom:updated>2007-06-12T08:49:20.774-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><category domain='http://www.blogger.com/atom/ns#'>testing</category><title>kNose extension under development</title><description>For about a month, I've been quietly developing another &lt;a href="http://www.activestate.com/products/komodo_ide/"&gt;Komodo Edit/IDE&lt;/a&gt; extension called kNose.  It's a GUI front-end for the &lt;a href="http://somethingaboutorange.com/mrl/projects/nose/"&gt;nose unit testing framework&lt;/a&gt; for Python written by Jason Pellerin. I wanted something that would make it easy for me to jump into testing as part of my normal development. Despite the cool nature of auto-discovery and execution of unit tests with nose, I'm still too lazy to use it if it's not integrated with my IDE.&lt;br /&gt;&lt;br /&gt;Here's a screenshot of how things look so far for the curious:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://mysite.verizon.net/bcorfman/uploaded_images/knose-792840.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://mysite.verizon.net/bcorfman/uploaded_images/knose-792830.bmp" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Yes, that's a red bar to indicate that some of the tests didn't pass. The auto-test feature, when checked, will run the tests each time a file is saved in the editor. When auto-test is unchecked, then the Run Tests button will kick off the unit tests manually.&lt;br /&gt;&lt;br /&gt;Basically, my remaining to-do list is as follows:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;make the tree nodes expandable and collapsible,&lt;/li&gt;&lt;li&gt;handle error reporting properly (whatever that means I haven't decided ... hover over a node to see a tooltip? ... double-click to get a dialog with the error message? I'll probably try both and see which style I like.)&lt;/li&gt;&lt;li&gt;run nose in a background thread so that it doesn't freeze up Komodo while the tests are running.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;test on both Linux and Windows to see that things check out. (I'll be looking for a volunteer with a Mac as I get closer to release.)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;The last, detail stages of the project always seem to be the hardest, so I'm posting to encourage myself to "press on toward the goal". Also, I was curious if other Pythonistas in the testing community would be interested in my extension.&lt;br /&gt;&lt;br /&gt;It will probably be another two to three weeks before I finish since this is definitely a part-time project. I'll keep everyone posted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-4197210541898807177?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/06/knose-extension-under-development.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-3586864748699467290</guid><pubDate>Sat, 19 May 2007 01:17:00 +0000</pubDate><atom:updated>2007-05-18T21:33:22.719-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>komodo</category><title>I won a $150 prize!</title><description>I entered the Komodo Extensibility Challenge, and got a prize for 2nd runner-up with my &lt;a href="http://support.activestate.com/forum-topic/find-in-project-files"&gt;"Find in Project Files" extension&lt;/a&gt;. Honestly, I didn't really expect to win, but I wrote an extension that was useful to me, and I guess others found it helpful too. Cool. I'm going to get a pair of K2 Radical 100 inline skates with my Amazon gift certificate, although the $150 prize only gets me halfway there. Still, I haven't had a nice pair of skates that fit me in a long while, and I'm looking forward to skating the B&amp;amp;A trail again in style.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-3586864748699467290?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/05/i-won-150-prize.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-2157014287068354725</guid><pubDate>Fri, 23 Mar 2007 01:09:00 +0000</pubDate><atom:updated>2007-03-22T21:16:19.369-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>virtualization</category><category domain='http://www.blogger.com/atom/ns#'>windows</category><category domain='http://www.blogger.com/atom/ns#'>vmware</category><category domain='http://www.blogger.com/atom/ns#'>ubuntu</category><title>More on VMWare</title><description>I tried VMWare Server under my WinXP machine after the comments on my previous post. Tonight I'm going back to Player instead. Despite Player's few annoyances, Server has more: several new services run in the background, and I notice the slowdown during boot time and while I'm playing games that require the full use of the CPU.&lt;br /&gt;&lt;br /&gt;That is all. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-2157014287068354725?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/03/more-on-vmware.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-6389702540858467312</guid><pubDate>Tue, 13 Mar 2007 02:12:00 +0000</pubDate><atom:updated>2007-03-12T23:03:37.634-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><category domain='http://www.blogger.com/atom/ns#'>desktops</category><category domain='http://www.blogger.com/atom/ns#'>vmplayer</category><category domain='http://www.blogger.com/atom/ns#'>laptops</category><category domain='http://www.blogger.com/atom/ns#'>ubuntu</category><title>Ubuntu install</title><description>Those who've been following my &lt;a href="http://del.icio.us/bcorfman"&gt;del.icio.us bookmarks&lt;/a&gt; know that I've been recently looking at &lt;a href="http://del.icio.us/bcorfman/linux"&gt;laptops and desktops with Linux pre-installed&lt;/a&gt;. My interest in a new computer coincided with my old computer starting to fail. But wouldn't you know it! Turns out a new power supply and keyboard solved my problems, and I was still left with a serious case of Linux envy.&lt;br /&gt;&lt;br /&gt;Once I got my computer running again, I decided to look at installing an Ubuntu image under VMPlayer for Windows XP. (This is the free virtualization software from VMWare that allows you to run one operating system under another one.) I was surprised how well it worked, although there were some issues that I had to look up on various newsgroups. Here's the process I used:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download the &lt;a href="http://isv-image.ubuntu.com/vmware/"&gt;latest Ubuntu 6.10 image&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Download and install the &lt;a href="http://www.vmware.com/download/"&gt;evaluation version of VMWare Workstation&lt;/a&gt;. (This includes VMPlayer plus VMTools, which you need for getting screen resolutions above 800x600.)&lt;/li&gt;&lt;li&gt;Run Workstation, start the Ubuntu image, and "install" the VMTools (located in Workstation's menu). Confusingly, this just drops a virtual VMTools DVD image on your Ubuntu desktop; you have to then open up the image and run its installer.&lt;/li&gt;&lt;/ol&gt;Now you can change your screen resolution to something higher, &lt;a href="http://www.vmware.com/community/message.jspa?messageID=328738"&gt;set VMPlayer to run full screen on startup (and unpin the annoying toolbar)&lt;/a&gt;, and you're all set.&lt;br /&gt;&lt;br /&gt;If you want, you can also uninstall the eval version of VMWare Workstation, and then download and install the smaller (and free) VMPlayer. Your image (with the VMTools install) will remain intact. This is also &lt;a href="http://www.vmware.com/community/message.jspa?messageID=300296#300296"&gt;perfectly legal&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Having this image has satisfied my Ubuntu lust for the moment. I spent some time downloading lots of cool Python libraries using the Package Manager (even easier than using easy_install!). I'll still probably get a Linux friendly laptop at a later point, but Doris' VAIO is still chugging along, and it's hard to justify a new computer when we're still furnishing our basement.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-6389702540858467312?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/03/ubuntu-install.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>8</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-5487258290591483441</guid><pubDate>Sat, 10 Feb 2007 03:58:00 +0000</pubDate><atom:updated>2007-02-09T22:58:13.346-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>komodo</category><category domain='http://www.blogger.com/atom/ns#'>hack</category><title>Komodo Bonus Hack: Explore Project Directory</title><description>Alright, one more hack ... this is so simple it may not be worth mentioning, but I find it really useful. It's also not Python specific.&lt;br /&gt;&lt;br /&gt;I've written a quick Run Command that brings up Windows Explorer located inside your current project directory. Besides giving you a quick access to file operations on your project, it's also convenient for Komodo Edit users that use TortoiseSVN (or similar tools) for source-control purposes.&lt;br /&gt;&lt;br /&gt;If you're a Unix GNOME user, you're not out of luck: you can change the Run Command to use "nautilus" instead of "explorer", for similar results.&lt;br /&gt;&lt;br /&gt;You can download the Explore Project Directory file &lt;a href="http://mysite.verizon.net/bcorfman/exploreprojdir.kpz"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-5487258290591483441?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/02/komodo-bonus-hack-explore-project.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-8792774488638049755</guid><pubDate>Sat, 10 Feb 2007 03:27:00 +0000</pubDate><atom:updated>2007-02-09T22:54:22.583-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>ide</category><category domain='http://www.blogger.com/atom/ns#'>help</category><category domain='http://www.blogger.com/atom/ns#'>hacks</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><title>Komodo Hacks: Improving Python Help in Windows</title><description>This last hack for the week beefs up the context-sensitive help for Python in Komodo. By default, the Shift-F1 help in Komodo does a Google site search on docs.python.org for the current word under the cursor. I prefer instead to use the HTMLHelp manual that comes with my standard Python installation since it's often much faster and efficient than a web search.&lt;br /&gt;&lt;br /&gt;You can download my Python Help macro &lt;a href="http://mysite.verizon.net/bcorfman/pythonhelp.kpz"&gt;here&lt;/a&gt;. It brings up your local Python reference with an HTMLHelp API call, with the current word under the cursor placed in the Index tab. Simple but effective.&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;This Help macro remaps the F1 key to bring up the Python manual instead of bringing up Komodo's internal help, since I use language help much more than IDE help. You can always change this in the macro Properties if you're used to Shift-F1 instead.&lt;/li&gt;&lt;li&gt;You should also check the macro code to make sure that the local of my Python installation (c:\python24) matches yours, or you'll need to change it.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I've got more ideas percolating but they'll have to wait until another week! Hope these hacks make your work with Komodo and Python more enjoyable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-8792774488638049755?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-improving-python-help-in.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-1596946616517858509</guid><pubDate>Fri, 09 Feb 2007 14:51:00 +0000</pubDate><atom:updated>2007-02-13T21:41:34.484-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>hacks</category><category domain='http://www.blogger.com/atom/ns#'>pylint</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><title>Komodo Hacks: Integrating Pylint</title><description>&lt;span style="font-weight: bold;"&gt;UPDATE: &lt;/span&gt;Todd left a comment on how he didn't like Pylint's verbosity. You can add a -e option to the command line to show errors only instead of stylistic warnings.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;UPDATE: &lt;/span&gt;I see this hack has already been covered by &lt;a href="http://thinkhole.org/wp/2006/01/16/installing-pylint-on-windows/"&gt;John&lt;/a&gt; and &lt;a href="http://mateusz.loskot.net/2006/01/15/running-pylint-from-komodo/"&gt;Mateusz&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'm not enjoying today's hack as much as I'd like. Pylint is great, but getting it installed and configured is much more painful than it should be.  For one thing, Logilab has configured a .egg file  for Pylint so that you can ostensibly use easy_install to get it on your system -- but the .egg doesn't load any of the other dependencies that are needed. Very frustrating. Consequently, we'll go about the install process manually. I'm writing the steps below from a Windows perspective, but I've tried to note where a Unix install is slightly different.&lt;br /&gt;&lt;br /&gt;How to get PyLint installed and configured for Komodo:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download &lt;a href="http://www.logilab.org/view?rql=Any%20X%20WHERE%20X%20eid%20857"&gt;Pylint&lt;/a&gt; and the Pylint dependency modules from Logilab's site: &lt;a href="http://www.logilab.org/view?rql=Any%20X%20WHERE%20X%20eid%20848"&gt;logilab-common&lt;/a&gt; and &lt;a href="http://www.logilab.org/view?rql=Any%20X%20WHERE%20X%20eid%20856"&gt;logilab-astng&lt;/a&gt;. The download links are in the upper-left corner of the page.&lt;/li&gt;&lt;li&gt;Extract all the packages from step 1, preserving the folder structure. WinZip is the best for this on a Windows system; if you have a Unix-based OS, you can use &lt;span style="font-family:courier new;"&gt;gunzip -c [MODULE].tar.gz | tar -xf -&lt;/span&gt; or similar.&lt;/li&gt;&lt;li&gt;Open up a command prompt, make sure your Python executable can be found in your &lt;span style="font-family:courier new;"&gt;PATH&lt;/span&gt;, and type &lt;span style="font-family:courier new;"&gt;python setup.py install&lt;/span&gt; inside the extracted common, astng, and pylint directories in turn.&lt;/li&gt;&lt;li&gt;Change to your Python installation's &lt;span style="font-family:courier new;"&gt;scripts&lt;/span&gt; directory.&lt;/li&gt;&lt;li&gt;Type &lt;span style="font-family:courier new;"&gt;pylint --generate-rcfile &gt; standard.rc&lt;/span&gt; at the command prompt to create a Pylint configuration file. (If you're using a Unix system, you'll need to prefix the &lt;span style="font-family:courier new;"&gt;pylint&lt;/span&gt; command with a &lt;span style="font-family:courier new;"&gt;./&lt;/span&gt; )&lt;/li&gt;&lt;/ol&gt;Now you're ready to download Run Pylint macro &lt;a href="http://mysite.verizon.net/bcorfman/pylint.kpz"&gt;here&lt;/a&gt;. Install it into Komodo by using the Import Package option under the Toolbox menu.&lt;br /&gt;&lt;br /&gt;Additional configuration is needed to set up the macro for your system:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Right-click on the Pylint macro in the toolbox and click Properties.&lt;/li&gt;&lt;li&gt;Change the path to &lt;span style="font-family:courier new;"&gt;pylint&lt;/span&gt; in the Command text box to match the location of your python installation's &lt;span style="font-family:courier new;"&gt;scripts&lt;/span&gt; directory. Also, if you're using a Unix system, you'll probably need to remove the quotes around the %F in the text box as well. (Can someone verify this for me?)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Change both the directory paths in the Environment Settings list to match the location of your Python installation as well.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Usage notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Double-clicking on the Pylint macro in the toolbox will run pylint on the currently viewed file and print a report in the Command Output tab. Each line in the report can be double-clicked, and Komodo will jump to the matching line in the file.&lt;/li&gt;&lt;li&gt;The standard.rc file that was generated in step 5 above can be edited to customize the types of errors/warnings that Pylint will generate. The .rc file is commented thoroughly so you should be able to figure out what's going on with a little study and experimentation. As an alternative, pylint can also be customized with command-line parameters; type &lt;span style="font-family:courier new;"&gt;pylint&lt;/span&gt; (by itself) at a command prompt to see all the different possibilities.&lt;/li&gt;&lt;/ul&gt;Tomorrow's hack: beefing up context-sensitive help for Python under Windows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-1596946616517858509?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-integrating-pylint.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>8</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-2091708300707364262</guid><pubDate>Thu, 08 Feb 2007 01:32:00 +0000</pubDate><atom:updated>2007-02-07T21:20:28.776-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>hacks</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><category domain='http://www.blogger.com/atom/ns#'>refactoring</category><title>Komodo Hacks: Rename Occurrences</title><description>This Komodo hack allows you to rename all occurrences of a variable or method name wherever it appears in your code. This is the last of my macros this week that uses &lt;a href="http://bicyclerepair.sourceforge.net/"&gt;Bicycle Repair Man&lt;/a&gt;; if you missed my previous post on how to get the BRM package into Komodo, it can be found &lt;a href="http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-find-references.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You can download the macro &lt;a href="http://mysite.verizon.net/bcorfman/rename.kpz"&gt;here&lt;/a&gt;. Install it into Komodo by using the Import Package option under the Toolbox menu.&lt;br /&gt;&lt;br /&gt;Usage notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Highlight a variable or method in your code and double-click on the Rename macro in the toolbox. The macro will prompt you for the new variable or method name and then perform the rename operation.&lt;/li&gt;&lt;li&gt;Before refactoring, Komodo will prompt you to save your file if necessary. (This is a requirement of BRM.)&lt;/li&gt;&lt;li&gt;After refactoring, Komodo will tell you that your file or files have changed and prompt you to reload them. Go ahead! You should see your changes in the updated file(s). If you don't like what you see, you can Undo the changes, via the Edit menu or CTRL-Z.&lt;/li&gt;&lt;li&gt;Rename Occurrences may not always work like you expect. As an example, you'll want to rename method names where they are originally &lt;span style="font-weight: bold;"&gt;def&lt;/span&gt;ined; otherwise, the renaming will only be local and not propagate throughout your code. &lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Tomorrow's hack: integrating PyLint into Komodo.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-2091708300707364262?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-rename-occurrences.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-9714907.post-894239646004244215</guid><pubDate>Wed, 07 Feb 2007 04:05:00 +0000</pubDate><atom:updated>2007-02-06T23:04:57.995-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>hacks</category><category domain='http://www.blogger.com/atom/ns#'>python</category><category domain='http://www.blogger.com/atom/ns#'>komodo</category><category domain='http://www.blogger.com/atom/ns#'>refactoring</category><title>Komodo Hacks: Extract Method</title><description>Today's hack allows you to highlight a section of existing Python code in Komodo and refactor it into its own separate method.&lt;br /&gt;&lt;br /&gt;Like yesterday's hack, Extract Method uses Bicycle Repair Man for its functionality. If you didn't catch the procedure for including the BRM package into Komodo, see &lt;a href="http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-find-references.html"&gt;my last post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You can download the macro &lt;a href="http://mysite.verizon.net/bcorfman/extractmethod.kpz"&gt;here&lt;/a&gt;. Install it into Komodo by using the Import Package option under the Toolbox menu.&lt;br /&gt;&lt;br /&gt;Usage notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Just highlight a section of code, and double-click on the Extract Method macro in the toolbox. The macro will prompt you for the name of the new method and then perform the refactoring operation.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Before refactoring, Komodo will prompt you to save your file if necessary. (This is a requirement of BRM.)&lt;/li&gt;&lt;li&gt;After refactoring, Komodo will tell you that your file has changed and prompt you to reload it. Go ahead! You should see your changes in the updated file. If you don't like what you see, you can Undo the changes, via the Edit menu or CTRL-Z.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;One more BRM macro to go, coming tomorrow!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9714907-894239646004244215?l=mysite.verizon.net%2Fbcorfman%2Findex.html' alt='' /&gt;&lt;/div&gt;</description><link>http://mysite.verizon.net/bcorfman/2007/02/komodo-hacks-extract-method.html</link><author>noreply@blogger.com (Brandon Corfman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item></channel></rss>