<?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>Jython Journeys</title>
	<atom:link href="http://jython.xhaus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jython.xhaus.com</link>
	<description>Notes about my work with jython and python</description>
	<lastBuildDate>Tue, 08 May 2012 21:27:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Google Technologogy User Group Panel Session On Web Development Technologies</title>
		<link>http://jython.xhaus.com/google-technologogy-user-group-panel-session-on-web-development-technologies/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-technologogy-user-group-panel-session-on-web-development-technologies</link>
		<comments>http://jython.xhaus.com/google-technologogy-user-group-panel-session-on-web-development-technologies/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 19:48:26 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[jython]]></category>
		<category><![CDATA[Python Ireland]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[GTUG]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=231</guid>
		<description><![CDATA[On the 29th of November 2011, I represented the python perspective at the Google Technology User Group debate, the Battle of the Backends, which pitted Python against Ruby-on-Rails and Node.js for web development. The debate was held at Google&#8217;s European HQ at Barrow St, Dublin. Here are my slides from the python vs. ruby v. [...]]]></description>
			<content:encoded><![CDATA[<p>On the 29th of November 2011, I represented the python perspective at the <a href="http://dublingtug.wordpress.com/">Google Technology User Group</a> debate, the <a href="http://dublingtug.wordpress.com/2011/12/01/november-2011-gtug-meet/">Battle of the Backends</a>, which pitted <a href="http://www.python.org">Python</a> against <a href="http://rubyonrails.org/">Ruby-on-Rails</a> and <a href="http://nodejs.org/">Node.js</a> for web development.</p>
<p>The debate was held at <a href="http://www.google.com/about/company/address.html">Google&#8217;s European HQ at Barrow St, Dublin</a>.</p>
<p>Here are <a href="http://www.xhaus.com/presentations/gtug20111129/">my slides from the python vs. ruby v. node.js debate</a>. </p>
<p>The video from the debate is available on <a href="http://www.youtube.com/watch?v=HouuqQYINIM">GTUGs youtube channel</a>: the python segment begins after 20 minutes.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/google-technologogy-user-group-panel-session-on-web-development-technologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jython and Internationalized Domain Names.</title>
		<link>http://jython.xhaus.com/jython-and-internationalized-domain-names/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jython-and-internationalized-domain-names</link>
		<comments>http://jython.xhaus.com/jython-and-internationalized-domain-names/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 22:59:57 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=208</guid>
		<description><![CDATA[I&#8217;m happy to announce that jython finally supports Internationalized Domain Names. In May 2010, the Internet Committee for Assigned Names and Numbers (ICANN) permitted the first non-ASCII Internationalized Top-Level Domains to be made available. An Internationalized Domain Name (IDN) is a domain name that includes characters from outside the ASCII character set. IDNs are specified [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce that jython finally supports Internationalized Domain Names.</p>
<p><span id="more-208"></span></p>
<p>In May 2010, the <a href="http://www.icann.org/">Internet Committee for Assigned Names and Numbers</a> (ICANN) permitted the <a href="http://blog.icann.org/2010/05/idn-cctlds/">first non-ASCII Internationalized Top-Level Domains to be made available</a>.</p>
<p>An <a href="http://en.wikipedia.org/wiki/Internationalized_domain_name">Internationalized Domain Name</a> (IDN) is a domain name that includes characters from outside the <a href="http://en.wikipedia.org/wiki/ASCII">ASCII character set</a>. IDNs are specified in <a href="http://www.apps.ietf.org/rfc/rfc3490.html">RFC 3490</a>, and may contain any character from the <a href="http://en.wikipedia.org/wiki/Unicode">Unicode</a> character repertoire, meaning that domain names may now contain any writing symbol in use by human-beings anywhere on the planet.</p>
<p><b>Potential Issues</b></p>
<p>There are lots of interesting things and potential issues to note about IDNs.</p>
<p>They open up a whole new frontiers for cybersquatters and phishers, by opening up the possibility of <a href="http://en.wikipedia.org/wiki/IDN_homograph_attack">Homograph Attacks</a>, where the user is intentionally misguided by the visual similarity of character glyphs from different character sets. For example, is this character <b>&#946;</b> a greek lower case beta or a german eszett?</p>
<p>Will companies like <b>Société Générale</b> find themselves held hostage by cybersquatters who have registered the accented version of their brand name before they even realise that it was possible to register it? In the case of the SocGen, the answer is <a href="http://www.xn--socitgnrale-ebbbbb.com">no</a>.</p>
<p><b>Solutions</b></p>
<p>Doubtless, various solutions will be adopted to solve these problems, as national registrars from around the world deal with how these problems relate specifically to the characters in use in their country. For example, the Russian national registrar <a href="http://xn--j1ay.xn--p1ai/">Coordination Centre for RU TLD</a> only permits Cyrillic characters to be used in the new <a href="http://en.wikipedia.org/wiki/.%D1%80%D1%84">.&#1088;&#1092;</a> top-level domain.</p>
<p><b>Jython support</b></p>
<p>Unfortunately, <a href="http://bugs.jython.org/issue1153">jython idna encoding is currently broken</a>, due to shortcomings in the unicodedata module and lack of stringprep support.</p>
<p>But IDNs are now supported when you run jython on a Java 6 JVM, since that version of the JVM has built-in IDN support: I checked in the changes at <a href="https://fisheye3.atlassian.com/changelog/jython/?cs=7198">revision 7198</a>.</p>
<p>There is also a workaround for java 5, where you can use GNU LibIDN to convert domain and host names to punycode before passing them to domain names that expect to receive ASCII parameters. This workaround is documented on the <a href="http://wiki.python.org/jython/NewSocketModule#InternationalizedDomainNamesupport">jython socket wiki</a>.</p>
<p>If you&#8217;re interested in playing with IDNs, you can obviously <a href="http://www.jython.org/download.html">download the latest jython</a>. And there are plenty of <a href="http://www.google.com/#q=idn+converter">Online IDN converters</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/jython-and-internationalized-domain-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jython supports IPV6.</title>
		<link>http://jython.xhaus.com/jython-supports-ipv6/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jython-supports-ipv6</link>
		<comments>http://jython.xhaus.com/jython-supports-ipv6/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 14:33:49 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=199</guid>
		<description><![CDATA[I am delighted to announce that jython is IPV6 ready: the future of internet addressing is fully supported. IPV4 exhaustion As you are no doubt aware by now (since it&#8217;s been covered in all mainstream media), the reign of Internet Protocol Version 4 (IPV4) is coming to an end: the IPV4 address space will run [...]]]></description>
			<content:encoded><![CDATA[<p>I am delighted to announce that jython is IPV6 ready: the future of internet addressing is fully supported.</p>
<p><span id="more-199"></span></p>
<p><b>IPV4 exhaustion</b></p>
<p>As you are no doubt aware by now (since it&#8217;s been covered in all mainstream media), the reign of <a href="http://en.wikipedia.org/wiki/IPv4">Internet Protocol Version 4 (IPV4)</a> is coming to an end: the <a href="http://en.wikipedia.org/wiki/IPv4_address_exhaustion">IPV4 address space will run out before the end of 2011</a>. </p>
<p>The problem is a simple one: IPV4 addresses are made up of only 32 bits, meaning that they can only represent a maximum of 2<sup><small>32</small></sup> different addresses (nearly 4.3 billion). But the internet is so successful and growing so fast that this address space is now too small: there are over 6 billion people on this planet, over 4 billion mobile phones, and over 1 billion PCs. Multi-device ownership is commonplace and growing in the rich world, and networking device ownership in the developing world is growing rapidly.</p>
<p>The decision to use 32-bit addresses was the right decision to make back in the 1960s. At the birth of the Internet, there were only several dozen machines connected to it. Rather than go into this subject in detail, I recommend reading this article: <a href="http://dltj.org/article/vint-cerf-ip-addressing/">Vint Cerf on the Origins of 32-bit IP Addressing</a>.</p>
<p>But as the Internet expanded and more and more machines connected to it, it became clear in the 1990s that IPV4 addresses would eventually run out, and that something would be needed to replace it: <a href="http://en.wikipedia.org/wiki/IPv6">Internet Protocol Version 6 (IPV6)</a> was born.</p>
<p><b>IPV6</b></p>
<p>IPV6 solves the address space problem permanently, by introducing a mind-bogglingly large address space: 128 bits, or 2<sup><small>128</small></sup> possible addresses. That&#8217;s 340,282,366,920,938,463,463,374,607,431,768,211,456 possible addresses! (Although see below for some caveats).</p>
<p>My favourite way to describe the size of this address space is as follows. If we were to divide the theoretical IPV6 address space between every star in the known universe (estimated to be 10<sup><small>22</small></sup>, or 10,000,000,000,000,000,000,000 stars), every star would have nearly 2<sup><small>55</small></sup> addresses to itself, i.e. an address space that is 8.4 million (2<sup><small>23</small></sup>) times bigger than our existing IPV4 planetary internet (since 2<sup><small>23</small></sup> * 2<sup><small>32</small></sup> == 2<sup><small>55</small></sup>).</p>
<p>That&#8217;s a lot of addresses, and once IPV6 is fully in service across the internet, we won&#8217;t be running out of addresses for a very long time.</p>
<p>(Actually, the number of addresses available under IPV6 will be less than the theoretical maximum, because <a href="http://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xml">various sub-sets of the IPV6 address space have been reserved for special purposes</a>. But the set of addresses available will remain practically unlimited for the foreseeable future).</p>
<p><b>Java vs. python</b></p>
<p>As readers of this blog will be aware, <a href="http://www.jython.org/">jython</a> is an implementation of the <a href="http://www.python.org/">python language</a> that runs on the <a href="http://www.java.com/">java platform</a>.</p>
<p>Both python and java have been moving towards IPV6 for a number of years. Both are <a href="http://en.wikipedia.org/wiki/Cross-platform">multi-platform languages</a>, and attempt to provide APIs that work seamlessly across all operating systems. </p>
<p><a href="http://www.python.org/">Cpython</a>, the most well known version of the python language, that is written in <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29">C</a>, <a href="http://docs.python.org/dev/whatsnew/2.2.html">first provided IPV6 facilities back in version 2.2</a>, released in December 2001. This support, although complete in design, did not initially work on all platforms on which cpython is used, because underlying operating system support was variable and patchy.</p>
<p>Simiarly, <a href="http://download.oracle.com/javase/1.4.2/docs/guide/net/ipv6_guide/">java introduced IPV6 support in version 1.4</a>, released in February 2002. But this support suffered the same problems as with cpython: underlying operating system support was variable, particularly on older OSes such as Windows 2000, XP and 2003.</p>
<p>Fortunately, most operating systems have caught up with the present, and provide excellent IPV6 support, including most open-source operating systems, MacOS and <a href="http://research.microsoft.com/en-us/projects/msripv6/">Windows since Windows Vista</a>.</p>
<p><b>Jython and IPV6</b></p>
<p>As is always true when using jython, there are two different approaches one can take to using IPV6 on jython: 1. Use the Java socket API or 2. Use the python socket API.</p>
<p><b>The java socket API</b></p>
<p>Users of jython have always had access to IPV6 though the java socket API, because of the <a href="http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html">seamless integration between java and jython</a>. However, jython users often avoid using java APIs, particularly the more over-complex ones. And the java socket API is probably one of the worst examples of over-complexity, since it comprises two entirely different APIs, with different designs, to provide the full range of socket functionality: the <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html">java.net</a> APIs and the <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/nio/package-summary.html">java.nio</a> APIs.</p>
<p><b>The python socket API</b></p>
<p>Long term users of jython networking libraries, which rely on the socket module, will be aware that the jython socket module has a particularly difficult task implementing the python socket API, since it must implement the cpython API, which has a C language philosophy, on top of the java API facilities, which have a different, more object-oriented philosophy. And as described above, the java socket API is really two completely different APIs, both of which must be used if you want the full range of functionality, e.g. <a href="http://www.nightmare.com/medusa/async_sockets.html">asynchronous networking</a>.</p>
<p>Implementing IPV6 has been problematic, for several reasons, including that operating system support has been patchy, thus making it difficult to reliably test on a cross-platform basis. Also, the <a href="http://mail.python.org/pipermail/python-3000/2007-March/006522.html">cpython socket API is not without problems when it comes to IPV6</a>.</p>
<p>Still, it has always been my stated intent that any python code written which uses the socket module should behave identically on jython and cpython, wherever possible. And now that intent extends to IPV6, final support for which I checked in recently (revisions <a href="https://fisheye3.atlassian.com/changelog/jython/?cs=7191">7191</a> and <a href="https://fisheye3.atlassian.com/changelog/jython/?cs=7193">7193</a>), and which should be included in the next release of jython, due any day now.</p>
<p>I am particularly satisfied with this step forward, since I believe that IPV6 opens up a whole new world of networking possibilities.</p>
<p><b>Reliability</b></p>
<p>I won&#8217;t yet make the claim that the new IPV6 support is 100% defect free, since there are so many different java-version and operating-system combinations on which jython is used. There will always be some combination of operations on some JVM on some operating systems where it just won&#8217;t work, for example <a href="http://bugs.sun.com/view_bug.do?bug_id=6230761">this java IPV6 defect on Windows</a>. But the jython socket module has a <a href="https://fisheye3.atlassian.com/browse/jython/trunk/jython/Lib/test/test_socket.py?hb=true">very large set of unit-tests</a>, currently 133 separate tests, and growing. As and when bugs are uncovered, I will <a href="http://wiki.python.org/jython/NewSocketModule">document them</a>, <a href="http://wiki.python.org/jython/NewSocketModule#IPV6addresssupport">provide work-arounds</a>, and unit-tests for the work-arounds.</p>
<p>Happy IPV6 networking!</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/jython-supports-ipv6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyCon Ireland 2010: A great success!</title>
		<link>http://jython.xhaus.com/pycon-ireland-2010-a-great-success/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pycon-ireland-2010-a-great-success</link>
		<comments>http://jython.xhaus.com/pycon-ireland-2010-a-great-success/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 19:34:03 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[jython]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Python Ireland]]></category>
		<category><![CDATA[Conferences]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=191</guid>
		<description><![CDATA[I&#8217;m delighted to report that PyCon Ireland 2010, the first ever python language conference in Ireland, was a great success! Over 100 people came, attended two dozen talks and tutorials in three tracks, and participated in sprints and open-spaces. Our conference venue, the Dublin School of English in Temple Bar, was a great success. Their [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m delighted to report that PyCon Ireland 2010, the first ever python language conference in Ireland, was a great success! Over 100 people came, attended two dozen talks and tutorials in three tracks, and participated in sprints and open-spaces.</p>
<p><span id="more-191"></span></p>
<p>Our conference venue, the <a href="http://www.dse.ie/">Dublin School of English</a> in Temple Bar, was a great success. Their classroom layouts proved ideal for talks and tutorials. The rooms for our three tracks were all accessed from a large foyer, where our sponsors set up their tables (and beanbags!). Open spaces rooms were also close, so the amount of traffic through the foyer gave a sociable and affable atmosphere.</p>
<p>Local restaurateurs <a href="http://www.botticelli.ie/">Botticelli&#8217;s</a> did a great job on the daytime catering, supplying tasty food and drink, and excellent coffee: we had a dedicated coffee machine and barista all day!</p>
<p>Just as I&#8217;ve experienced with other python conferences, there was a significant presence from the third-level education, both researchers and students. There were computer scientists interested in python as a language for teaching (the original purpose for which python was designed). There were research groups who were either already using or learning python in order to apply it to their programming needs, for analysing and visualising data, controlling equipment, etc. Work areas of third-level conference participants included genetics, electronics, and space hardware.</p>
<p>The venue for Saturday evening was the very modern <a href="http://www.radissonblu.ie/royalhotel-dublin">Radisson Blu hotel</a> on Golden Lane. The hotel staff were very professional and helpful: they made our entire experience there seamless and relaxed. What better way to end the evening than to retire to the bar for informal chats, the odd beer and the fine artistry of 3 piece blues band, <a href="http://www.myspace.com/leftrightcentrebluesband">Left, Right and Centre</a>.</p>
<p>For the sprints on Sunday, the most remarkable project was certainly the <a href="http://groups.google.com/group/pythonireland/browse_thread/thread/e2b47ac8d5d13f04?hl=en">project</a> to code a <a href="http://en.wikipedia.org/wiki/Bedlam_cube">solution finder for the fiendish Bedlam cube puzzles</a> that sponsors Google had brought along. The effort even continued after the sprint was over, with the crew retiring to the <a href="http://www.tog.ie/">TOG Hackerspace</a> to work further on it.</p>
<p>One very successful outcome from the conference was that there is now a <a href="http://groups.google.com/group/pythonireland/browse_thread/thread/4a1b112d803a021?hl=en">Python Ireland meetup in Cork city</a>, which will be meeting on the first Thursday of each month. With the Galway Python meetups happening on the first Wednesday of the month, and the Dublin meetups on the second Wednesday, it is clear that Python Ireland is an active and growing community. Watch this space!</p>
<p>Many of the presentations given and media recorded at the conference are now available: See the following links</p>
<ul>
<li><a href="http://groups.google.com/group/pyconireland/web/pycon-ireland-2010---links-to-slides-videos-source-code-and-more">Talks, slides, sourece code, etc</a></li>
<li><a href="http://vimeo.com/groups/pyconireland">Videos of talks</a></li>
<li><a href="http://www.python.ie/pyconireland">General conference information</a></li>
</ul>
<p>An enormous amount of organisation goes into making an event like a python conference work, and all of the committee are delighted that their work has all been worthwhile. One person deserves very special mention, Python Ireland&#8217;s Chairman, Vicky Lee, who was dedicated, untiring and endlessly patient through the whole process and put in more work than the rest of us put together: Massive kudos to <a href="http://twitter.com/whykay">Vicky</a>!</p>
<p>Looking forward to PyCon Ireland 2011!</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/pycon-ireland-2010-a-great-success/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Transforming with XSLT on Google AppEngine and jython.</title>
		<link>http://jython.xhaus.com/transforming-with-xslt-on-google-appengine-and-jython/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=transforming-with-xslt-on-google-appengine-and-jython</link>
		<comments>http://jython.xhaus.com/transforming-with-xslt-on-google-appengine-and-jython/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 18:42:26 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[google appengine]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[java scripting]]></category>
		<category><![CDATA[web technology]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=171</guid>
		<description><![CDATA[I&#8217;m writing this post in response to a challenge. I wrote a post entitled Jython on Google AppEngine: Why bother?, which was a reply to a statement made by a Google engineer about not seeing the point of running jython on AppEngine. And a similar statement was repeated in a comment on that blog post [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing this post in response to a challenge. I wrote a post entitled <a href="http://jython.xhaus.com/jython-on-google-appengine-why-bother/">Jython on Google AppEngine: Why bother?</a>, which was a reply to a statement made by a Google engineer about not seeing the point of running jython on AppEngine. And a similar statement was repeated in a <a href="http://jython.xhaus.com/jython-on-google-appengine-why-bother/#comments">comment on that blog post</a> (i.e. &#8220;<i>the gist of what I intended to say was that while it was possible to run Jython on App Engine, I couldn’t think why you’d want to</i>.&#8221;)</p>
<p>So rather than get into a back-and-forth of yes-it-is-no-it-isnt-yes-it-is, I thought I&#8217;d reply with some simple code that demonstrates <b>something that cannot (currently) be done in cpython on AppEngine</b>, but is <b>easy with jython on AppEngine</b>: XSLT transforms. </p>
<p><span id="more-171"></span></p>
<p>So, without further ado, here is the jython source code for running an XSLT transform on Google AppEngine. It is implemented as a jython WSGI application, using xhaus.com&#8217;s <a href="http://modjy.xhaus.com">modjy WSGI gateway for java servlets</a> that was <a href="http://jython.xhaus.com/modjy-now-fully-integrated-into-jython/">contributed to the jython project a few months back</a>.</p>
<p>In order to get this code running, I suggest you download the <a href="http://downloads.xhaus.com/modjy_webapp_google_appengine/">modjy on google appengine demo</a> from our <a href="http://downloads.xhaus.com">downloads site</a>. In that download, there is a jython file called &#8220;demo_app.py&#8221;. Simply replace the entire contents of that file with the code below, and you&#8217;re good to go. If you need help with getting the modjy demo application working on Google AppEngine, see the documentation on the modjy wiki: <a href="http://opensource.xhaus.com/projects/modjy/wiki/ModjyGoogleAppEngine">Running jython WSGI applications on Google AppEngine, with modjy</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">__doc__ = <span style="color: #483d8b;">&quot;&quot;&quot;
A demonstration of how to run XSLT transforms on Google AppEngine with jython (not cpython).
Please feel free to use this code in whatever way you wish.
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> java.<span style="color: black;">io</span> <span style="color: #ff7700;font-weight:bold;">import</span> StringReader, StringWriter
<span style="color: #ff7700;font-weight:bold;">from</span> javax.<span style="color: #dc143c;">xml</span>.<span style="color: black;">transform</span> <span style="color: #ff7700;font-weight:bold;">import</span> Transformer, TransformerFactory
<span style="color: #ff7700;font-weight:bold;">from</span> javax.<span style="color: #dc143c;">xml</span>.<span style="color: black;">transform</span>.<span style="color: black;">stream</span> <span style="color: #ff7700;font-weight:bold;">import</span> StreamResult, StreamSource
&nbsp;
xml_data = <span style="color: #483d8b;">&quot;&quot;&quot;
&lt;books&gt;
  &lt;book&gt;
    &lt;title&gt;2001 - A Space Odyssey&lt;/title&gt;
    &lt;author&gt;Arthur C Clarke&lt;/author&gt;
  &lt;/book&gt;
  &lt;book&gt;
    &lt;title&gt;I, Robot&lt;/title&gt;
    &lt;author&gt;Isaac Asimov&lt;/author&gt;
  &lt;/book&gt;
  &lt;book&gt;
    &lt;title&gt;Kil'n people&lt;/title&gt;
    &lt;author&gt;David Brin&lt;/author&gt;
  &lt;/book&gt;
&lt;/books&gt;
&quot;&quot;&quot;</span>
&nbsp;
xslt_source = <span style="color: #483d8b;">&quot;&quot;&quot;
&lt;xsl:stylesheet
  xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
&gt;
&nbsp;
&lt;xsl:template match=&quot;books&quot;&gt;
&lt;html&gt;
  &lt;head&gt;&lt;title&gt;A list of books, transformed into html from xml using xslt and jython.&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;table border=&quot;1&quot; width=&quot;50%&quot; align=&quot;center&quot;&gt;
      &lt;caption&gt;A list of books, transformed into html from xml using xslt and jython.&lt;/caption&gt;
      &lt;tr&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Author&lt;/th&gt;&lt;/tr&gt;
    &lt;xsl:for-each select=&quot;book&quot;&gt;
      &lt;tr&gt;&lt;td&gt;&lt;xsl:value-of select=&quot;title/text()&quot;/&gt;&lt;/td&gt;&lt;td&gt;&lt;xsl:value-of select=&quot;author/text()&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/xsl:for-each&gt;
    &lt;/table&gt;
  &lt;/body&gt;
&lt;/html&gt;
&lt;/xsl:template&gt;
&nbsp;
&lt;/xsl:stylesheet&gt;
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> generate_html<span style="color: black;">&#40;</span>xml_data, xslt_source<span style="color: black;">&#41;</span>:
  transformer = TransformerFactory.<span style="color: black;">newInstance</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">newTransformer</span><span style="color: black;">&#40;</span>StreamSource<span style="color: black;">&#40;</span>StringReader<span style="color: black;">&#40;</span>xslt_source<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  output_buffer = StringWriter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  transformer.<span style="color: black;">transform</span><span style="color: black;">&#40;</span>StreamSource<span style="color: black;">&#40;</span>StringReader<span style="color: black;">&#40;</span>xml_data<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, StreamResult<span style="color: black;">&#40;</span>output_buffer<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">return</span> output_buffer.<span style="color: black;">buffer</span>.<span style="color: black;">toString</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> handler<span style="color: black;">&#40;</span>environ, start_response<span style="color: black;">&#41;</span>:
  result = generate_html<span style="color: black;">&#40;</span>xml_data, xslt_source<span style="color: black;">&#41;</span>
  start_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;200 Hoopy&quot;</span>, <span style="color: black;">&#91;</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'content-type'</span>, <span style="color: #483d8b;">'text/html'</span><span style="color: black;">&#41;</span> <span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#91;</span>result<span style="color: black;">&#93;</span></pre></div></div>

<p>Happy Transforming!</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/transforming-with-xslt-on-google-appengine-and-jython/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Jython on Google AppEngine: Why bother?</title>
		<link>http://jython.xhaus.com/jython-on-google-appengine-why-bother/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jython-on-google-appengine-why-bother</link>
		<comments>http://jython.xhaus.com/jython-on-google-appengine-why-bother/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 14:40:09 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[google appengine]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[java scripting]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=160</guid>
		<description><![CDATA[Why on earth would you want to run jython applications on Google Appengine? First off, I must apologise for the flippant nature of the attention grabbing title. I&#8217;m a jython committer, and a jython user, so I believe that there are very good reasons for running jython on Google AppEngine. (You can read how to [...]]]></description>
			<content:encoded><![CDATA[<p>Why on earth would you want to run <a href="http://www.jython.org">jython</a> applications on <a href="http://appengine.google.com">Google Appengine</a>?</p>
<p><span id="more-160"></span></p>
<p>First off, I must apologise for the flippant nature of the attention grabbing title. I&#8217;m a jython committer, and a jython user, so I believe that there are very good reasons for running jython on Google AppEngine. (You can read how to do so on the modjy wiki: <a href="http://opensource.xhaus.com/projects/modjy/wiki/ModjyGoogleAppEngine">how to run jython applications on Google AppEngine</a>).</p>
<p>The title is essentially a paraphrase of a statement made by a Google AppEngine Evangelist, at a talk about AppEngine that I attended here in Dublin. The speaker was of the opinion that there was no valid reason for running jython on AppEngine, a statement which I couldn&#8217;t let pass.</p>
<p>I think that the core of his reasoning for making that statement was a simple misunderstanding, but a misunderstanding that is common among users who are familiar with python, or users of cpython, but who are not familiar with jython&#8217;s use as a <a href="http://www.javaworld.com/javaworld/jw-11-2007/jw-11-jsr223.html">JVM scripting language</a>. The misunderstanding is that the only reason for running jython is so that one can run python applications on the JVM, using python&#8217;s wealth of &quot;batteries included&quot; APIs. If that is the case, then why bother running jython, when one can simply use the <a href="http://code.google.com/appengine/docs/python/gettingstarted/">cpython support on AppEngine</a> directly?</p>
<p>To explain, when writing a cpython application that processes email, for example, one can make use of the python&#8217;s <a href="http://docs.python.org/library/email.html">email module</a>, which provides a wealth of features for dealing with the many complexities of parsing, processing and generating email messages, MIME, etc. Users of jython can also use the python email modules, since those modules are written in pure python. But since jython runs on the Java Virtual Machine(JVM) and permits seamless integration of java and python code, jython users writing email processing also have the option of using the excellent <a href="http://java.sun.com/products/javamail/">JavaMail APIs</a>, which are just as robust as the pure python modules, and arguably more efficient. So jython users have the best of both worlds: they can use either python APIs or java APIs, with equal ease.</p>
<p>Processing email is perhaps too straightforward an example, in that both python and java have excellent email processing support. But due to the more widespread use of java in the development community in general, java generally has far more support for any given technology need, since there are often multiple options available. A good example of this is cryptography: there is a wealth of <a href="http://www.homeport.org/~adam/crypto/">java cryptography libraries</a> available, including the excellent <a href="bouncycastle.org">Bouncy Castle</a>, <a href="http://www.cryptix.org/">Cryptix</a>, <a href="http://www.flexiprovider.de/">Flexiprovider</a>, etc. The choice of crypto libraries in python is generally narrower, supports less functionality, and is sometimes abandon-ware.</p>
<p>So if one&#8217;s understanding of jython is simply that it is a way to run pure python modules on the JVM, then the above mentioned mis-understanding is forgivable. But it is simply not the case that the primary usage of jython is to run pure python modules: Jython excels as a dynamic/scripting language for the JVM, and permits the use of java APIs, without having to write java code.</p>
<p>In discussion with the Google engineer after the talk, he conceded that there was one possible use case for running jython on AppEngine, namely that of prototyping java applications. In this scenario, applications would</p>
<ol>
<li>Be developed in jython, taking advantage of the enormous productivity increases gained by developing in python</li>
<li>Be translated to java once the functionality of the application is complete</li>
</ol>
<p>My reply to this is: <b>&#8220;Why bother with step 2&#8243;</b>?</p>
<p>If you&#8217;ve got a running application that is fully functional and written in jython, then you don&#8217;t need to translate it to java. You should only consider translating it, or parts of it, into java <b>if you really have to</b>. For example, after profiling your jython application, you may find one or two core pieces that are performance bottlenecks: these are prime candidates for translation to java, to improve performance. But there&#8217;s no reason to translate the rest of the application: maintainability and productivity is best served by simply leaving the jython code exactly as is.</p>
<p>I suppose a part of the reason why this mis-perception of jython has come about is because python is such an excellent language that it is in the unique position of having two completely independent implementations of the language that run on Google AppEngine. But just because both cpython and jython run on AppEngine doesn&#8217;t mean that their usages should be identical. Jython&#8217;s place in the AppEngine ecosystem is primarily as a JVM dynamic language.</p>
<p>So, in summary, jython is more than just a mechanism for running pure python code on the JVM: it is an excellent JVM development platform in it&#8217;s own right.</p>
<p>I hope I&#8217;ve given you some good reasons to consider developing your next Google AppEngine project on jython.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/jython-on-google-appengine-why-bother/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A list of open source HTTP proxies written in Java.</title>
		<link>http://jython.xhaus.com/a-list-of-open-source-http-proxies-written-in-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-list-of-open-source-http-proxies-written-in-java</link>
		<comments>http://jython.xhaus.com/a-list-of-open-source-http-proxies-written-in-java/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 15:48:51 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=153</guid>
		<description><![CDATA[A few years ago, as an aide to python web programers, I compiled a database of open source HTTP proxies written in python, which became surprisingly popular. So I&#8217;ve decided to expand the database to encompass the other language that I regularly use, java, and publish a database of open source HTTP proxies written in [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago, as an aide to python web programers, I compiled a <a href="http://proxies.xhaus.com/python/">database of open source HTTP proxies written in python</a>, which became surprisingly popular.</p>
<p>So I&#8217;ve decided to expand the database to encompass the other language that I regularly use, java, and publish a <a href="http://proxies.xhaus.com/java/">database of open source HTTP proxies written in java</a>.</p>
<p><span id="more-153"></span></p>
<p>While carrying out a web development project a few years ago, I needed a HTTP proxy to help with development and debugging. Rather than write my own, I decided to research what open source options were already available.</p>
<p>However, Python is such an easy language to write web servers and proxies in that a lot people had written and puiblished HTTP proxies, so making the decision wasn&#8217;t easy. It required a lot of research, which basically meant a code and architectural review of all of the open source python proxies available.</p>
<p>Since most web programmers use a HTTP proxy at some stage, I thought it would be a useful exercise to compile a complete list of the available options, with a comparison table to enable a feature by feature comparison.</p>
<p>The result of that was this <a href="http://proxies.xhaus.com/python/">comparison table of open source HTTP proxies written in python</a>, which became quite popular, because it saved python programmers going through the same complex comparison and review process I had undertaken.</p>
<p>Since I&#8217;m currently working on another proxy-related project, I needed to review available open source HTTP proxies written in java. And I thought I&#8217;d save someone some research time by publishing a similar <a href="http://proxies.xhaus.com/java/">comparison table of open source HTTP proxies in java</a>.</p>
<p>I hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/a-list-of-open-source-http-proxies-written-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jython 2.5; it&#8217;s a beautiful day!</title>
		<link>http://jython.xhaus.com/jython-25-its-a-beautiful-day/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jython-25-its-a-beautiful-day</link>
		<comments>http://jython.xhaus.com/jython-25-its-a-beautiful-day/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 18:39:23 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[jython]]></category>
		<category><![CDATA[java scripting]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=3</guid>
		<description><![CDATA[A fantastic thing happened today: Jython 2.5 was released! I&#8217;ve anticipated this day a long time, as have many others; it&#8217;s great that it&#8217;s finally happened. I&#8217;ve been using jython since 1999, when it was known as jpython. That was back in the Finn Bock Errata days; Finn had been kind of maintaining jpython after [...]]]></description>
			<content:encoded><![CDATA[<p>A fantastic thing happened today: Jython 2.5 was released! I&#8217;ve anticipated this day a long time, as have many others; it&#8217;s great that it&#8217;s finally happened.</p>
<p><span id="more-3"></span><br />
I&#8217;ve been using jython since 1999, when it was known as jpython. That was back in the Finn Bock Errata days; Finn had been kind of maintaining jpython after Jim Hugunin left CNRI, and produced a series of upgrade patches and fixes he called Errata. For legal reasons relating to CNRI&#8217;s IP, the project name had to be changed to jython; after that Finn, Samuele Pedroni and Barry Warsaw powered forward, bringing jython through cpython 2.0 and 2.1 compatibility. The result was a fantastically robust product, which had completely seamless Java integration, and which went on to become the JVM scripting language for a wide range of applications.</p>
<p>However, after 2.1 had settled down, Finn moved on. Cpython moved onto version 2.2, which brought big changes to the language: metaclasses, descriptors, properties, iterators, generators and nested scopes, to mention a few. All of the new features required large changes in the sometimes complex interactions between cpython and java class designs.</p>
<p>Samuele continued as jython&#8217;s maintainer, and a jython 2.2 alpha was produced that provided many of the required new features, and much of which still remains in jython 2.5. But Samuele moved on to the greener pastures of the amazing PyPy project, which is developing a self-hosting python-in-python interpreter. Although that is where his main energies lie, Samuele continues to be a jython contributor and provide valued guidance to the other developers.</p>
<p>The project languished for a couple of years, and the version number did not advance; 2.2 alpha was the state of jython for a long time, principally because of the enormous work involved in implementing a full 2.2 version. Brian Zimmer was project lead for a while, but much of the time there was no clear leadership. Jython 2.1 continued and continues to be used in a lot of places; it&#8217;s stability was and is fantastic, and it always did the job. But there was some angst about it&#8217;s future, especially with the advance of other JVM scripting languages such as JRuby, and with changes in Java itself, such as Annotations, Generics, etc.</p>
<p>Then the project sprang back to life, with a complete 2.2 being published; Charlie Groves was the key person in that achievement. Charlie did, and still does, an <a href="http://fisheye3.atlassian.com/browse/~author=cgroves/jython">enormous amount of work on jython</a>, and I believe that his dedication to releasing a complete and robust 2.2 version was key to revitalising jython, both the language and the community.</p>
<p>And then came Frank Wierzbicki, the current BDFL, and the person who has done most to bring jython to the modern state it exists in today.</p>
<p>Initially, there was hesitation about which version of the python language to target; cpython had reached version 2.5, and ironpython was at version 2.4. Upgrading jython to 2.3, then 2.4 and then 2.5 seemed like an awful lot of work. Frank adopted a bold strategy: aim to get jython as up-to-date as possible,  and bring jython directly to 2.5. And today we&#8217;ve seen that that strategy worked!</p>
<p>Congratulations Frank! Superb job!</p>
<p>And well done to a great group of people who&#8217;ve contributed fantastic work; Jim Baker, Charlie Groves, Otmar Humbel, Tobias Ivarsson, Philip Jenvey, Nicholas Riley, Leo Soto, among <a href="https://www.ohloh.net/p/jython/contributors/">others</a>.</p>
<p>Well done to all the jython development team; ye&#8217;ve achieved something wonderful!</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/jython-25-its-a-beautiful-day/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to run jython WSGI applications on Google AppEngine with modjy.</title>
		<link>http://jython.xhaus.com/how-to-run-jython-wsgi-applications-on-google-appengine-with-modjy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-run-jython-wsgi-applications-on-google-appengine-with-modjy</link>
		<comments>http://jython.xhaus.com/how-to-run-jython-wsgi-applications-on-google-appengine-with-modjy/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 21:36:01 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[google appengine]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=97</guid>
		<description><![CDATA[As you can see from our last blog post, we were delighted to get jython WSGI applications running on Google AppEngine for java using modjy. We promised in that we&#8217;d write a tutorial on how to do do that. Well we&#8217;ve done that: you can read the results on the modjy wiki: How to run [...]]]></description>
			<content:encoded><![CDATA[<p>As you can see from our last blog post, we were delighted to get jython WSGI applications running on Google AppEngine for java using modjy. We promised in that we&#8217;d write a tutorial on how to do do that.</p>
<p><span id="more-97"></span></p>
<p>Well we&#8217;ve done that: you can read the results on the modjy wiki: <a href="http://opensource.xhaus.com/projects/modjy/wiki/ModjyGoogleAppEngine">How to run jython WSGI applications on Google AppEngine with modjy</a>.</p>
<p>If you successfully upload the mody demo application, you should see results like this: <a href="http://jywsgi.appspot.com">modjy demo application running on AppEngine</a></p>
<p>We&#8217;d be happy to know of any successful reports of jython WSGI applications running on AppEngine: please feel free to leave a comment about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/how-to-run-jython-wsgi-applications-on-google-appengine-with-modjy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modjy running on Google AppEngine.</title>
		<link>http://jython.xhaus.com/modjy-running-on-google-appengine/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=modjy-running-on-google-appengine</link>
		<comments>http://jython.xhaus.com/modjy-running-on-google-appengine/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 08:25:26 +0000</pubDate>
		<dc:creator>alan.kennedy</dc:creator>
				<category><![CDATA[google appengine]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[web technology]]></category>

		<guid isPermaLink="false">http://jython.xhaus.com/?p=92</guid>
		<description><![CDATA[So, after the announcement by Google that their AppEngine could run other JVM languages, including jython, I had to have a go at getting modjy, our jython WSGI to java servlet bridge, running on it. It wasn&#8217;t a complex job, but did require a number of tweaks to the standard jython deployment. I will write [...]]]></description>
			<content:encoded><![CDATA[<p>So, after <a href="http://googleappengine.blogspot.com/2009/04/seriously-this-time-new-language-on-app.html">the announcement by Google that their AppEngine could run other JVM languages</a>, including <a href="http://www.jython.org">jython</a>, I had to have a go at getting <a href="http://jython.xhaus.com/?p=41">modjy</a>, our jython WSGI to java servlet bridge, running on it.</p>
<p><span id="more-92"></span></p>
<p>It wasn&#8217;t a complex job, but did require a number of tweaks to the standard jython deployment. I will write up these instructions and make them available very soon.</p>
<p>You can see the results here: <a href="http://jywsgi.appspot.com">modjy demo application running on Google AppEngine</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jython.xhaus.com/modjy-running-on-google-appengine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

