<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>notes from Ken &#187; Programming</title>
	<atom:link href="http://www.notes.xythian.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.notes.xythian.net</link>
	<description>Links, technical notes, whatnot.</description>
	<lastBuildDate>Sun, 04 Jul 2010 19:01:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The Robustness Principal and internal APIs</title>
		<link>http://www.notes.xythian.net/2010/01/15/robustness/</link>
		<comments>http://www.notes.xythian.net/2010/01/15/robustness/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 04:48:40 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/?p=749</guid>
		<description><![CDATA[RFC 761 section 1.2.2. 2.10. Robustness Principle TCP implementations should follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. RFC 1122 elaborates with section 1.2.2.: 1.2.2 Robustness Principle At every layer of the protocols, there is a general rule whose application can lead to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tools.ietf.org/html/rfc761#section-1.2.2">RFC 761</a> section 1.2.2.</p>
<blockquote><p>
2.10. Robustness Principle</p>
<p>  TCP implementations should follow a general principle of robustness:<br />
  be conservative in what you do, be liberal in what you accept from<br />
  others.
</p></blockquote>
<p><a href="http://tools.ietf.org/html/rfc1122#section-1.2.2">RFC 1122</a> elaborates with section 1.2.2.:</p>
<blockquote><p>
  1.2.2  Robustness Principle</p>
<p>         At every layer of the protocols, there is a general rule whose<br />
         application can lead to enormous benefits in robustness and<br />
         interoperability [IP:1]:</p>
<p>                &#8220;Be liberal in what you accept, and<br />
                 conservative in what you send&#8221;</p>
<p>         Software should be written to deal with every conceivable<br />
         error, no matter how unlikely; sooner or later a packet will<br />
         come in with that particular combination of errors and<br />
         attributes, and unless the software is prepared, chaos can<br />
         ensue.<br />
[...]
</p></blockquote>
<p>For anything expected to inter-operate &#8220;in the wild&#8221; with other implementations of a given standard or API this approach is optimal as both competitive advantage (how successful would a browser that only accepted valid HTML have been in a world with Netscape 1.0?) and user experience (always working as best as possible increases the chance of something working).</p>
<p>However, when an API is internal to a component, department, or a company it might well be better for implementations to <b>reject fast</b> invalid or malformed requests with informative error messages rather than attempting to proceed.  </p>
<p>Within an organization the chances of integration testing catching an error before it affects user experience is much higher and failing immediately helps reduce the chances of future revisions of software needing to be &#8220;bug compatible&#8221; with easily avoided problems.  It&#8217;s not a competitive advantage to try to muddle along with bad input in a world where there are no competitors. The entire system is more robust if each side of every API is careful that they are producing only valid requests and responses.</p>
<p>For example, if a company has standardized on UTF-8 as a wire format for text it is probably best if all new implementations of services validate that their input is correct UTF-8 at every edge and refuse to process anything that is invalid.   Otherwise eventually some system is going to end up having to try and guess the correct encoding in order to proceed and serve valid data that came in an API that didn&#8217;t validate and has to go out an API that must be valid.</p>
<p>This only applies, of course, when both sides of an integration are new enough to be tested together but this applies to a lot of new development within an organization &#8212; a new capability is being added to an entire &#8220;stack&#8221; resulting in API revisions at each layer.</p>
<p>It&#8217;s dramatically easier to catch problems at the first opportunity and requiring the source of the incorrectness to correct it before proceeding than ending up years later with tons of special compatibility hacks where an API is versioned based on the different clients foibles rather than by design.</p>
<p>Internal APIs should be designed to be as easy as possible to use correctly &#8212; but once designed they should <b>only</b> work when used correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2010/01/15/robustness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and libyahoo2, take 2</title>
		<link>http://www.notes.xythian.net/2009/06/01/python-and-libyahoo2-take-2/</link>
		<comments>http://www.notes.xythian.net/2009/06/01/python-and-libyahoo2-take-2/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 04:48:08 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/?p=247</guid>
		<description><![CDATA[Last October I worked on a libyahoo2 binding using Pyrex and got it far enough along to discover the version of libyahoo2 I was using couldn&#8217;t log into YIM. Several Ubuntu updates later I noticed libyahoo2 had been upgraded and, sure enough, this version worked. I updated the Git repository mentioned in that post but [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.notes.xythian.net/2008/10/27/pyrex-and-libyahoo2-or-not/">Last October</a> I worked on a libyahoo2 binding using Pyrex and got it far enough along to discover the version of libyahoo2 I was using couldn&#8217;t log into YIM.</p>
<p>Several Ubuntu updates later I noticed libyahoo2 had been upgraded and, sure enough, this version worked.</p>
<p>I updated the Git repository mentioned in that post but it is likely if I continue to work on it it will go to <a href="http://github.com/xythian/python-yahoo2/tree/master">python-yahoo2 on GitHub</a>.</p>
<p>Pyrex&#8217;s blindness where &#8220;const&#8221; is concerned is pretty annoying.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2009/06/01/python-and-libyahoo2-take-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 and python-virtualenv</title>
		<link>http://www.notes.xythian.net/2009/05/31/ubuntu-904-and-python-virtualenv/</link>
		<comments>http://www.notes.xythian.net/2009/05/31/ubuntu-904-and-python-virtualenv/#comments</comments>
		<pubDate>Sun, 31 May 2009 19:26:17 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/?p=245</guid>
		<description><![CDATA[I recently upgraded a bunch of physical and virtual machines from various Ubuntu v.older version to Ubuntu 9.04. Naturally, this broke my Python development environment since Python was upgraded from 2.5 to 2.6. I had instructed easy_install to put things into /usr/local. The upgrades from Ubuntu v.older to 9.04 went quite smoothly on every machine [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded a bunch of physical and virtual machines from various Ubuntu v.older version to Ubuntu 9.04.   Naturally, this broke my Python development environment since Python was upgraded from 2.5 to 2.6.  I had instructed easy_install to put things into /usr/local.</p>
<p>The upgrades from Ubuntu v.older to 9.04 went quite smoothly on every machine including the ones where I had to do several stepped upgrades since on various machines I skipped one or more upgrades prior to 9.04.</p>
<p>Rather than return to my old ways of just hosing packages (and, worse, &#8220;setup.py develop&#8221; symlinks) into /usr/local I&#8217;ve decided to use python-virtualenv to create some non-root-owned Python environments to work on my various Python-y apps.  The main difference to me is being able to keep things I&#8217;m working on separate from one another.</p>
<p>We&#8217;ll see how it goes.</p>
<p>I&#8217;m afraid all these years of using package-managed software has made me soft &#8212; now a piece of software not having a nice package means I need to think a bit harder about if it&#8217;s worth dealing with the hassle of having that software outside of the package manager.  (That applies to when I&#8217;d like to be using a more recent version of the package, too, though generally on Ubuntu I run into that a lot less frequently than I did on Debian.)   I have mixed feelings about setuptools and easy_install.</p>
<p>I am pleased that now mod_wsgi is in a package so I can switch to that version rather than the one I installed by hand.   mod_wsgi was worth it to install by hand to use until there was a nice package available.  It&#8217;s Just Better than my previous mechanisms for running WSGI apps in, under, or behind Apache.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2009/05/31/ubuntu-904-and-python-virtualenv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Singleshot and Git and first steps</title>
		<link>http://www.notes.xythian.net/2009/03/04/singleshot-and-git-and-first-steps/</link>
		<comments>http://www.notes.xythian.net/2009/03/04/singleshot-and-git-and-first-steps/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 08:12:18 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Singleshot]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/?p=240</guid>
		<description><![CDATA[Singleshot is the photo album software I use to host photos.xythian.com. The last release was .. rather a while ago though I have been making minor enhancements and bug fixes since then for my own use (including flash video support which extracts thumbnails using mplayer and embeds flowplayer to play) though there&#8217;s no video on [...]]]></description>
			<content:encoded><![CDATA[<p>Singleshot is the photo album software I use to host <a href="http://photos.xythian.com/">photos.xythian.com</a>.  The last release was .. rather a while ago though I have been making minor enhancements and bug fixes since then for my own use (including flash video support which extracts thumbnails using mplayer and embeds flowplayer to play) though there&#8217;s no video on my public photo site).</p>
<p>Prior to today every time I took the time to try and update the source tree on Sourceforge I ran into a snag such as &#8220;Sourceforge CVS is unavailable.&#8221;   Months ago, when I tried to migrate from CVS to SVN on Sourceforge I ran into errors.  I didn&#8217;t even try to investigate what went awry as I was low on patience and time.</p>
<p>As a result, my own tree (first in Perforce and now in Subversion) has gotten pretty out of sync from that tree.  I decided to try GitHub and try using Git for something &#8220;real&#8221; &#8212; so I&#8217;m going to move Singleshot&#8217;s source to GitHub and then push all my changes to there.</p>
<p>I followed (mostly) the steps from <a href="http://stackoverflow.com/questions/584522/how-to-export-revision-history-from-mercurial-or-git-to-cvs/584567">How to export revision history from mercurial or git to cvs</a> which describes how to use the git cvsimport command to pull Singleshot&#8217;s revision history from its Sourceforge CVS repository, testing making a tiny change to a README, and pushing that change back to the Sourceforge CVS tree.</p>
<p>(After backing up the source tree on Sourceforge using rsync.)</p>
<pre>
% export CVS_RSH=ssh
% git cvsimport -d :ext:xythian@singleshot.cvs.sourceforge.net:/cvsroot/singleshot -C test1 \
    -r cvs -k -A /home/fox/src/singleshot-import/authors.txt  singleshot
Initialized empty Git repository in /home/fox/src/singleshot-import/test1/.git/
[longish pause]
Counting objects: 561, done.
Compressing objects: 100% (502/502), done.
Writing objects: 100% (561/561), done.
Total 561 (delta 317), reused 0 (delta 0)
</pre>
<p>(Some poking around to see if things look reasonable, making a small change to the README, commiting it first to the git repository and then back to Sourceforge using git cvsexportcommit.)</p>
<p>Then I pushed the whole thing to a GitHub tree:</p>
<p>http://github.com/xythian/singleshot/tree/master</p>
<pre>
% git remote add origin git@github.com:xythian/singleshot.git
% git push origin master
</pre>
<p>That was pretty straightforward and appears to have worked.</p>
<p>My plan is to merge my changes into the out of date tree and then push the new code to GitHub.  If it all works out I&#8217;ll probably indicate that the Sourceforge project is defunct there and host the code on GitHub henceforth. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2009/03/04/singleshot-and-git-and-first-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pyrex and libyahoo2 (or not)</title>
		<link>http://www.notes.xythian.net/2008/10/27/pyrex-and-libyahoo2-or-not/</link>
		<comments>http://www.notes.xythian.net/2008/10/27/pyrex-and-libyahoo2-or-not/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 04:24:58 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2008/10/27/pyrex-and-libyahoo2-or-not/</guid>
		<description><![CDATA[I had something I wanted to try in Python running against Yahoo! Messenger. The obvious choice of library for talking to Yahoo! Messenger was libyahoo2.&#160;&#160; I could not find a Python binding for it, so I started sketching one together with SWIG.&#160; The first step is creating a bunch of empty callbacks. The libyahoo2 in [...]]]></description>
			<content:encoded><![CDATA[<p>I had something I wanted to try in Python running against Yahoo! Messenger.  The obvious choice of library for talking to Yahoo! Messenger was <a href="http://libyahoo2.sourceforge.net/">libyahoo2</a>.&#160;&#160; I could not find a Python binding for it, so I started sketching one together with SWIG.&#160; The first step is creating a bunch of empty callbacks.  The libyahoo2 in Ubuntu&#8217;s package is compiled without USE_CALLBACK_STRUCT, so libyahoo2 expects to find a bunch of extern functions defined to interact with the host.&#160;I made empty callbacks in a C file and started reading more about the API. </p>
<p>It rapidly became clear that I was going to want a layer on top of the library to make interacting with it from Python more palatable.&#160;&#160; I switched to Pyrex, since I wanted to write that wrapper in Python (or something Python-like) rather than building a straight-C wrapper so using SWIG would continue to make sense.&#160;&#160; SWIG&#8217;s big benefit in my mind over Pyrex is easy support for more languages and better tools for defining straight wrappers.&#160; I wasn&#8217;t going to get &quot;free&quot; use in other languages and it wasn&#8217;t going to be a straight wrapper now but rather a module that exposed the functionality of libyahoo2 to Python. </p>
<p> I kept the callbacks.c I had defined but started migrating the definitions to the Pyrex file as I implemented.&#160; This way my library would continue to link without complaint about functions I didn&#8217;t have yet.</p>
<p>Following the usual pattern for Python bindings to libraries that need wrappers to be more Pythonic, I planned to have a &#8216;yahoo2&#8242; module in Python and a &#8216;_yahoo2.so&#8217; extension module.&#160; The _yahoo2 module is written in Pyrex. </p>
<p>libyahoo2 appears not to adhere to the documentation it defines.&#160; It&#8217;ll call ext_yahoo_remove_handler with a tag that was never returned by ext_yahoo_add_handler&#8230; (0).&#160; It looks like an undocumented (that I found) part of the charter of ext_yahoo_add_handler is not to add a given handler more than once. </p>
<p>This also made defining the callbacks the way libyahoo2 expected easier.</p>
<p>D&#8217;oh, I got it far enough along to get this:</p>
<blockquote>
<p>libyahoo2.c:620: debug: Key: 4          Value: Yahoo_Messenger<br />
	    libyahoo2.c:620: debug: Key: 5          Value: hodorbot<br />
	    libyahoo2.c:620: debug: Key: 14         Value: This version of Messenger expired on April 2, 2008. Please upgrade now to the latest supported version: http://messenger.yahoo.com Learn more: http://messenger.yahoo.com/eol<br />
	    libyahoo2.c:620: debug: Key: 15         Value: 1225167367<br />
	    libyahoo2.c:620: debug: Key: 97         Value: 1
      </p>
</blockquote>
<p>I&#8217;ve learned what I wanted to, so instead of seeing if a more recent libyahoo2 than what&#8217;s in Ubuntu works (&gt; 0.7.5+dfsg-3), I&#8217;m just going to call it here.&#160; I&#8217;ll post it in case someone can learn something useful from it.</p>
<p>You can pull a working repository with a command like: </p>
<blockquote>
<p>git clone http://notes.xythian.net/media/2008/10/pythonlibyahoo2.git/ mydirectory </p>
</blockquote>
<p>There&#8217;s three files that do anything: </p>
<ul>
<li>yahoo2.py &#8211; wraps some of the lower level details from the Pyrex layer, including exposing the IO bits as an asyncore dispatcher</li>
<li>_yahoo2.pyx &#8211; is the binding</li>
<li>callbacks.c &#8211; exists to have empty functions defined to satisfy the linker until those have implementations in the Python binding  </li>
</ul>
<p>Not much works, really; there&#8217;s implementations of connect and async_connect, but only async_connect is called by libyahoo2 before it gets far enough along to not log in with the error message above.&#160;There&#8217;s a wrapper for setting the log level (which was key to discovering the above fact&#8230;).</p>
<p>This is a typical definition of one of the library callbacks: </p>
<blockquote class="code"><pre>
cdef public int ext_yahoo_connect_async(int id, char *host, int port, \
  yahoo_connect_callback callback, void *callback_data):
   cdef ConnectionHandle handle
   handle = ConnectionHandle(id, host, port)
   handle.connect_callback = callback
   handle.connect_data = callback_data
   handle.async_connect(callback, callback_data)
   HANDLER_MAP[id].connections.append(handle)
   MANAGER.add(handle)
   return handle.fileno()
</pre>
</blockquote>
<p>ConnectionHandle is an extension class which wraps a Python socket object and can make the callbacks the libyahoo2 IO layer expect.&#160;&#160; MANAGER is the connection manager, which is implemented in the higher level layer (yahoo2.py) so it could be replaced with something that interacted with a GUI event loop. </p>
<p>I&#8217;m probably done with this for the forseeable future and hope publishing it along with a git repoistory may allow someone to build on or learn from what I&#8217;ve done.&#160;&#160; I stumbled upon Cython while working on this, but didn&#8217;t want to derail any progress to something working by playing with it.</p>
<p>So what did I learn?</p>
<ul>
<li>Write toy bots against open protocols with existing libraries in your language of choice, such as XMPP, lest your project get hijacked working on a binding rather than the toy.</li>
<li>Pyrex is pretty nice for building wrappers that have more meat than a typical SWIG binding.</li>
<li>Cython is probably worth checking out.</li>
<li>git is worth playing with more</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2008/10/27/pyrex-and-libyahoo2-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s All Text, Firefox extension</title>
		<link>http://www.notes.xythian.net/2007/12/09/its-all-text-firefox-extension/</link>
		<comments>http://www.notes.xythian.net/2007/12/09/its-all-text-firefox-extension/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 06:18:21 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2007/12/09/its-all-text-firefox-extension/</guid>
		<description><![CDATA[It&#8217;s All Text! is a pretty handy Firefox extension. It lets you set up an external editor and puts a little &#8216;edit&#8217; button in the corner of every textarea that pops open an external editor of your choosing. Then it watches the file the external editor is editing and refreshes the textarea whenever it changes. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://addons.mozilla.org/en-US/firefox/addon/4125">It&#8217;s All Text!</a> is a pretty handy Firefox extension.  It lets you set up an external editor and puts a little &#8216;edit&#8217; button in the corner of every textarea that pops open an external editor of your choosing.  Then it watches the file the external editor is editing and refreshes the textarea whenever it changes.<br />
Particularly handy given all the things nowadays that encourage editing of document-type text in a browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2007/12/09/its-all-text-firefox-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>python-cdb 0.32 (-5.2ubuntu2) with Python 2.5 causes double-free corruption crash on dealloc</title>
		<link>http://www.notes.xythian.net/2007/10/24/python-cdb-032-52ubuntu2-with-python-25-causes-double-free-corruption-crash-on-dealloc/</link>
		<comments>http://www.notes.xythian.net/2007/10/24/python-cdb-032-52ubuntu2-with-python-25-causes-double-free-corruption-crash-on-dealloc/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 01:59:03 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2007/10/24/python-cdb-032-52ubuntu2-with-python-25-causes-double-free-corruption-crash-on-dealloc/</guid>
		<description><![CDATA[I&#8217;ve recently started moving my linux box to a new x86_64 machine running Ubuntu 7.10. I searched for references to this bug but didn&#8217;t find anything with Google or launchpad, so I wanted to make a note of it so future victims can see what is going on and to remind me to report it. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started moving my linux box to a new x86_64 machine running Ubuntu 7.10.   I searched for references to this bug but didn&#8217;t find anything with Google or launchpad, so I wanted to make a note of it so future victims can see what is going on and to remind me to report it.</p>
<p>The symptom is a crash when your cdb object is deallocated usually with a &#8220;double-free&#8221; memory corruption error message.  Assuming a .cdb file named &#8220;foo.cdb&#8221;, the following script will repro the bug:</p>
<blockquote class="code"><p>
#!/usr/bin/python<br />
import cdb<br />
c = cdb.init(&#8216;foo.cdb&#8217;)<br />
del c
</p></blockquote>
<p>with the following message:</p>
<blockquote><p>
fox@hercules:~$ python cdbrepro.py<br />
*** glibc detected *** python: free(): invalid pointer: 0x00002b56c25bd750 ***<br />
======= Backtrace: =========<br />
/lib/libc.so.6[0x2b56c300ab0a]<br />
/lib/libc.so.6(cfree+0x8c)[0x2b56c300e6fc]<br />
python(PyDict_DelItem+0xfa)[0x44370a]<br />
python(PyEval_EvalFrameEx+0x2e40)[0x485140]<br />
python(PyEval_EvalCodeEx+0&#215;830)[0x489d60]<br />
python(PyEval_EvalCode+0&#215;32)[0x489da2]<br />
python(PyRun_FileExFlags+0x10e)[0x4ab4fe]<br />
[...]<br />
Aborted (core dumped)
</p></blockquote>
<p>Some other searching suggests that python-cdb&#8217;s use of PyMem_DEL is no longer recommended.   I haven&#8217;t verified that this doesn&#8217;t cause other problems, but replacing cdbmodule.c&#8217;s use of PyMem_DEL with PyObject_Del (and the PyObject_NEW with _New, to use consistent naming). </p>
<p>As soon as Ubuntu&#8217;s bug tracker (launchpad) works again for me I&#8217;ll report the bug.  Launchpad is timing out with an error message for me now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2007/10/24/python-cdb-032-52ubuntu2-with-python-25-causes-double-free-corruption-crash-on-dealloc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex, [Java&#124;Action]Script</title>
		<link>http://www.notes.xythian.net/2007/09/17/flex-javaactionscript/</link>
		<comments>http://www.notes.xythian.net/2007/09/17/flex-javaactionscript/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 06:57:13 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2007/09/17/flex-javaactionscript/</guid>
		<description><![CDATA[I&#8217;ve been playing with Adobe Flex which I&#8217;ll probably have something to say about soon. Flex uses ActionScript which bears a remarkable similarity to JavaScript. It&#8217;s not quite the same but it&#8217;s close enough that I haven&#8217;t stumbled too badly with it working from JavaScript knowledge.&#160; As with any &#34;new&#34; language the learning curve isn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with Adobe Flex which I&#8217;ll probably have something to say about soon.</p>
<p>Flex uses ActionScript which bears a remarkable similarity to JavaScript. It&#8217;s not quite the same but it&#8217;s close enough that I haven&#8217;t stumbled too badly with it working from JavaScript knowledge.&#160; As with any &quot;new&quot; language the learning curve isn&#8217;t the language but the environment and libraries. </p>
<p>The experience with Flex and also the Greasemonkey hacking I&#8217;ve been doing lately has made me rather fonder of JavaScript than I&#8217;ve been in the past.&#160; JavaScript is particularly nice when used in an environment that is safe from worrying about cross-browser API woes &#8212; such as a Firefox-only Greasemonkey user script or an environment like Flex.&#160;It&#8217;s not ideal but it has a lot of what I like in a language, including garbage collection, closures, reasonable typing and widespread deployment.
	</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2007/09/17/flex-javaactionscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tools and libraries</title>
		<link>http://www.notes.xythian.net/2007/07/13/tools-and-libraries/</link>
		<comments>http://www.notes.xythian.net/2007/07/13/tools-and-libraries/#comments</comments>
		<pubDate>Sat, 14 Jul 2007 04:57:15 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2007/07/13/tools-and-libraries/</guid>
		<description><![CDATA[A tool and a library I&#8217;ve been using or at least trying out: Launchy Free, open-source Windows app that indexes Program Files and any other directories you tell it to. Then alt-space pops up a command line box and it autocompletes as you type. I installed it a while ago and meant to mention it [...]]]></description>
			<content:encoded><![CDATA[<p>A tool and a library I&#8217;ve been using or at least trying out:</p>
<dl>
<dt><a href="http://www.launchy.net/">Launchy</a></dt>
<dd>Free, open-source Windows app that indexes Program Files and any other directories you tell it to.  Then alt-space pops up a command line box and it autocompletes as you type.   I installed it a while ago and meant to mention it but it kind of faded into the background and I don&#8217;t think about using it anymore.   It&#8217;s just there.  No more do I need to concern myself with the program menu&#8217;s lengthy &#8220;organization&#8221; by vendor nor do I keep needing to add paths to my PATH.  I used to do that so I could use Windows-Run to run things rather than rummaging in Program Files but Launchy is a much better solution.  I&#8217;ve read that it resembles Quicksilver for the Mac.</dd>
<dt><a href="http://www.sqlalchemy.org/">SQLAlchemy</a></dt>
<dd>&#8220;SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.&#8221; &#8212; mostly it handles some tedium without getting in the way.   ORMs still make me nervous since they tend to have a lot of &#8220;magic&#8221; in them but SQLAlchemy makes it pretty easy to use the convenient parts and override the &#8220;magic&#8221; if/when it&#8217;s necessary for performance.  Which probably won&#8217;t happen too much but knowing it&#8217;s easy makes it easier to rely on SQLAlchemy in the meantime.   I don&#8217;t know if I&#8217;ll keep using it, because like every other time I use a library like this I find myself spending more time trying to figure out how SQLAlchemy expresses something and I already know how to use SQL.</dd>
<dt>
</dt>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2007/07/13/tools-and-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wx.lib.iewin and NewWindow3</title>
		<link>http://www.notes.xythian.net/2007/03/22/wxlibiewin-and-newwindow3/</link>
		<comments>http://www.notes.xythian.net/2007/03/22/wxlibiewin-and-newwindow3/#comments</comments>
		<pubDate>Fri, 23 Mar 2007 05:29:22 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Readshot]]></category>

		<guid isPermaLink="false">http://www.notes.xythian.net/2007/03/22/wxlibiewin-and-newwindow3/</guid>
		<description><![CDATA[Suppose your wxPython app is is using an embedded Internet Explorer window to display HTML. You want links clicked in that window to open the user&#8217;s default browser rather than following the link within the embedded Internet Explorer. The obvious solution is to hook OnBeforeNavigate2 like so: self.Bind(iewin.EVT_BeforeNavigate2, self.OnBeforeNavigate2, self.ie) ... def OnBeforeNavigate2(self, evt): wx.LaunchDefaultBrowser(evt.URL) [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose your wxPython app is is using an embedded Internet Explorer window to display HTML.  You want links clicked in that window to open the user&#8217;s default browser rather than following the link within the embedded Internet Explorer.</p>
<p>The obvious solution is to hook OnBeforeNavigate2 like so:</p>
<pre class="code python">
        self.Bind(iewin.EVT_BeforeNavigate2, self.OnBeforeNavigate2, self.ie)
...
    def OnBeforeNavigate2(self, evt):
        wx.LaunchDefaultBrowser(evt.URL)
        evt.Cancel = True
</pre>
<p>but if the link the user clicked is set to open a new window, the emebdded IE will just open a new window.   So you hook NewWindow2.  Oops, NewWindow2 doesn&#8217;t tell you what the URL is!</p>
<p>Here&#8217;s what I did, since I don&#8217;t care if my reader works on pre-SP2 Windows XP:</p>
<p>Define an Event to permit me to hook NewWindow3, which is a new event that includes the URL being opened, then hook it appropriately:</p>
<pre class="code python"
wxEVT_NewWindow3 = wx.activex.RegisterActiveXEvent('NewWindow3')
EVT_NewWindow3 = wx.PyEventBinder(wxEVT_NewWindow3, 1)
...
        self.Bind(EVT_NewWindow3, self.OnNewWindow3, self.ie)
...
    def OnNewWindow3(self, evt):
        self.logEvt(evt)
        # Veto the new window.  Cancel is defined as an "out" param
        # for this event.  See iewin.py
        evt.Cancel = True
        wx.LaunchDefaultBrowser(evt.bstrUrl)
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.notes.xythian.net/2007/03/22/wxlibiewin-and-newwindow3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
