<?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>java rants &#187; pipes</title>
	<atom:link href="http://www.javarants.com/tag/pipes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javarants.com</link>
	<description>Rants about Java and other internet technologies by Sam Pullara</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:36:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Idiomatic Python?</title>
		<link>http://www.javarants.com/2008/04/23/idiomatic-python/</link>
		<comments>http://www.javarants.com/2008/04/23/idiomatic-python/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 18:19:51 +0000</pubDate>
		<dc:creator>Sam Pullara</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://www.javarants.com/?p=873</guid>
		<description><![CDATA[I&#8217;ve been working my way through compiling Java into Python code but the Python back end of my isn&#8217;t that good (my brain). I would call my stage of Python development the &#8220;magic incantation&#8221; stage. This is the stage where &#8230; <a href="http://www.javarants.com/2008/04/23/idiomatic-python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working my way through compiling Java into Python code but the Python back end of my isn&#8217;t that good (my brain).  I would call my stage of Python development the &#8220;magic incantation&#8221; stage.  This is the stage where you really aren&#8217;t comfortable yet with the way things work in a new language but you can still get things done by miming other developers.  I&#8217;ve also had some help from some friends on <a href="http://twitter.com/spullara">Twitter</a>: @<a href="http://twitter.com/lhl">lhl</a>, @<a href="http://twitter.com/precipice">precipice</a> and @<a href="http://twitter.com/jkwatson">jkwatson</a>.  My distributed information system is now getting some redundancy.  Little did they know that I was doing parallel invocations of identical requests for reliability and incrementally higher performance &#8212; and the results were verified using a quorum of responders.<br />
<span id="more-873"></span><br />
Here is my first service that I am porting.  It takes an RSS feed (in JSON format from Pipes) and combines all the entries from each day into a single entry:</p>
<pre>
import logging
import wsgiref.handlers
from datetime import date
from google.appengine.ext import webapp
from django.utils import simplejson
class DayBinPipesWebService (webapp.RequestHandler):
 def post(self):
 	now = date.today()
 	now = now.strftime("%m/%d/%Y")
 	data = self.request.get("data")
 	items = simplejson.loads(data)["items"]
 	bins = {}
 	for item in items:
 		published = item["y:published"]
 		updateDay = "%(month)02d/%(day)02d/%(year)04d" % published
 		if now != updateDay:
 			bin = bins.get(updateDay, [])
 			bin.append(item)
 			bins[updateDay] = bin
 	entries = []
 	for bin in bins.items():
 		dayDate = bin[0]
 		binEntries = bin[1]
 		first = binEntries[0].copy()
 		first["description"] = ""
 		for e in binEntries:
 			first["description"] += "&lt;p&gt;&lt;a href='%(link)s'&gt;%(title)s&lt;/a&gt;&lt;br&gt;%(description)s&lt;/p&gt;" % e
 		first["title"] = "Items from " + dayDate
 		first["link"] = ""
 		entries.append(first)
 	self.response.content_type = "application/json"
 	simplejson.dump(entries, self.response.out)
</pre>
<p>How would you write this in idiomatic Python as opposed to my rudimentary translation?  Would you change the whole design?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javarants.com/2008/04/23/idiomatic-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Google App Engine to Extend Yahoo! Pipes</title>
		<link>http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/</link>
		<comments>http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 02:59:45 +0000</pubDate>
		<dc:creator>Sam Pullara</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[googleappengine]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[yahoo pipes]]></category>
		<guid isPermaLink="false">http://www.javarants.com/?p=871</guid>
		<description><![CDATA[Update: A commenter pointed out that you can from django.utils import simplejson instead of including it. Makes this even easier. Yahoo! Pipes has always been a great tool for manipulating data but often you have to go to great contortions &#8230; <a href="http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Update: A commenter pointed out that you can
<pre>from django.utils import simplejson</pre>
<p> instead of including it.  Makes this even easier.</p>
<p><a href="http://pipes.yahoo.com">Yahoo! Pipes</a> has always been a great tool for manipulating data but often you have to go to great contortions to get it to do what you want because of its very simple data flow programming model.  <a href="http://appengine.google.com">Google&#8217;s App Engine </a>opens up the possibility of extending Yahoo! Pipes in very interesting ways through Pipes&#8217; Web Service operator.  Currently this operator sees little use as it requires you to be running an external server somewhere on the internet that is always available for the Pipe execution which is quite a high barrier to entry for the typical Pipes developer. Here is what a Pipe that is using web service looks like and our example pipe:</p>
<p><a title="Web Services Example Pipe" href="http://pipes.yahoo.com/spullara/mirror"><img src="http://buildandtest.com/files/pipeusingwebservice.png" alt="Web Service Pipes Example" width="676" height="585" /></a> </p>
<p>With the launch of Google App Engine there is now a very simple way to get code up on the internet quickly in order to include arbitrary processing in the interior of your Pipes.</p>
<p>To demonstrate how this works, let&#8217;s first build a very simple web service that simply mirrors the data that it receives from Pipes.   If you don&#8217;t have a Google App Engine account you can still follow along by download the <a href="http://code.google.com/appengine/">SDK</a> and executing all the stuff locally though it will have to be accessible from the public internet if you want Pipes to send you requests.</p>
<p>First create a new application directory:</p>
<pre>mkdir pipes-mirror
cd pipes-mirror </pre>
<p>Now create an application descriptor called app.yaml:</p>
<pre style="line-height: 100%;font-family:monospace;background-color:#ffffff; border-width:0.01mm; border-color:#000000; border-style:solid; padding:4px;"><span style="background-color:#ffffff;">application: javarants
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
  script: pipes.py</span></pre>
<p>This application descriptor basically tells Google how to deploy your application.  Your application name should match an application name that you create within the GAE administration tool:</p>
<p><img src="http://buildandtest.com/files/applicationname.png" alt="Application Name" width="495" height="161" /></p>
<p>Now we need to process the data coming from pipes.  Pipes is going to pass this web service some data in JSON format and we need to parse it.  GAE doesn&#8217;t include &#8216;<code>simplejson</code>&#8216; in the Python container so you are going to have to include it with your application.  I downloaded <a href="http://pypi.python.org/pypi/simplejson">simplejson-1.8.1</a> and symbolically linked its <code>simplejson</code> directory into my application directory.  When the request comes in the JSON data will be in the &#8216;<code>data</code>&#8216; parameter so we are going to pull it out, parse it, grab the <code>items</code> array and write it back over the wire in pipes.py:</p>
<pre style="line-height: 100%;font-family:monospace;background-color:#ffffff; border-width:0.01mm; border-color:#000000; border-style:solid; padding:4px;"><span style="color:#000080;background-color:#ffffff;font-weight:bold;">import</span><span style="background-color:#ffffff;"> simplejson
</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">import</span><span style="background-color:#ffffff;"> wsgiref.handlers
</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">from</span><span style="background-color:#ffffff;"> google.appengine.ext </span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">import</span><span style="background-color:#ffffff;"> webapp
</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">class</span><span style="background-color:#ffffff;"> MirrorPipesWebService (webapp.RequestHandler):
	</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">def</span><span style="background-color:#ffffff;"> post(self):
		data = self.request.get(</span><span style="color:#008000;background-color:#ffffff;font-weight:bold;">"data"</span><span style="background-color:#ffffff;">)
		obj = simplejson.loads(data)
		obj = obj[</span><span style="color:#008000;background-color:#ffffff;font-weight:bold;">"items"</span><span style="background-color:#ffffff;">]
		self.response.content_type = </span><span style="color:#008000;background-color:#ffffff;font-weight:bold;">"application/json"
</span><span style="background-color:#ffffff;">		simplejson.dump(obj, self.response.out)
</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">def</span><span style="background-color:#ffffff;"> main():
  application = webapp.WSGIApplication([(</span><span style="color:#008000;background-color:#ffffff;font-weight:bold;">'/mirror'</span><span style="background-color:#ffffff;">, MirrorPipesWebService)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)
</span><span style="color:#000080;background-color:#ffffff;font-weight:bold;">if</span><span style="background-color:#ffffff;"> __name__ == </span><span style="color:#008000;background-color:#ffffff;font-weight:bold;">"__main__"</span><span style="background-color:#ffffff;">:
  main()</span></pre>
<p>Now you should have a directory structure that looks a lot like this:</p>
<pre>-rw-r--r--@ 1 sam  sam  106 Apr 13 18:55 app.yaml
-rw-r--r--  1 sam  sam  559 Apr 13 19:28 pipes.py
lrwxr-xr-x  1 sam  sam   47 Apr 13 17:40 simplejson -&gt; /Users/sam/Software/simplejson-1.8.1/simplejson</pre>
<p>Now that we have all the pieces we can deploy the application to GAE with a simple command from the GAE SDK:</p>
<pre>appcfg.py update .</pre>
<p>At this point you should be able to replace my <a href="http://javarants.appspot.com/mirror">web service URL</a> that you find in my example Pipe with your application URL which will be
<pre>http://[application name].appspot.com/mirror</pre>
<p> and get the same results as mine.</p>
<p>What kind of uses can you put this great power?  I currently have a web service that I run that combines RSS entries from the same day into a single entry and have it deployed on my own server.  I will likely port that to GAE as it doesn&#8217;t require a lot of CPU and it is a pain having to administer it.  In fact, most of the functionality that you see in a service like <a href="http://feedburner.com">FeedBurner</a> would be easy to build on top of this framework.  More exotic use cases can be found on Y! Pipes itself where at least one person uses web services to pass in <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=qKDcUk1r3BGBg4HtODY80A">photo URLs and return the coordinates of human faces</a> in the images.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Yahoo! Pipes just launched</title>
		<link>http://www.javarants.com/2007/02/09/yahoo-pipes-just-launched/</link>
		<comments>http://www.javarants.com/2007/02/09/yahoo-pipes-just-launched/#comments</comments>
		<pubDate>Fri, 09 Feb 2007 16:16:11 +0000</pubDate>
		<dc:creator>Sam Pullara</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[yahoo]]></category>
		<guid isPermaLink="false">http://www.javarants.com/?p=971</guid>
		<description><![CDATA[Yahoo! Pipes just launched  <a href="http://www.javarants.com/2007/02/09/yahoo-pipes-just-launched/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div><font face="Helvetica">A really cool application, <a href="http://pipes.yahoo.com">Pipes</a>, from Yahoo! launched the other day and has the potential to really make it easy to mashup web applications and repurpose data.</font></div>
<p>
<div><font face="Helvetica">It is loosely based on the Unix pipes model of using small programs chained together to process data where the output of one program is the input to another program.  With the Pipes application you use RSS (or ATOM) feeds as your source data rather than text files and then use the available transforms and other data source to mashup a new feed that can be displayed using a number of different renderers including a map output.  Here is an example of how you can build a pipe with variables and multiple stages:</font><br /><img src="http://www.javarants.com/C1460871803/E20070209161611/Media/mypipe.png" height="827" width="878" alt="" /></p>
<p><font face="Helvetica">The whole project reminds me a little bit of my <a href="http://www.javarants.com/C1464297901/E870011941/index.html">XQuery</a> project I did so long ago though much better executed and more approachable.  Though as soon as they open up the ability to create more transformation types I will probably drop XQuery in there to do the dirty work.</font></div>
]]></content:encoded>
			<wfw:commentRss>http://www.javarants.com/2007/02/09/yahoo-pipes-just-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ServerSide Symposium</title>
		<link>http://www.javarants.com/2005/03/03/the-serverside-symposium/</link>
		<comments>http://www.javarants.com/2005/03/03/the-serverside-symposium/#comments</comments>
		<pubDate>Thu, 03 Mar 2005 09:42:09 +0000</pubDate>
		<dc:creator>Sam Pullara</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">http://www.javarants.com/?p=1008</guid>
		<description><![CDATA[The ServerSide Symposium  <a href="http://www.javarants.com/2005/03/03/the-serverside-symposium/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div><font face="Helvetica">I arrived in Vegas this morning on the 6:30am flight from San Francisco.  There are very few things that cause me to get up that early.</font></div>
<p> <img src="http://www.javarants.com/C1464297901/E1365294841/Media/floyd.jpg" height="240" width="320" alt="" />
<div>
<p><font face="Helvetica">The day started with Floyd again telling everyone how great they were and how they were really smart and how cool TSSS is.  I really think they should do this with facts rather than statements. The TechTarget people that acquired TSSS have a pretty cool instant polling system that I think would be great to have access to as a speaker.  I hope the speakers knew about it ahead of time and are going to poll their audiences.  Here are the results of the poll:</font></p>
<p><font face="Helvetica">Should java be open sourced:</font><br /><font face="Helvetica">59% yes</font></p>
<p><font face="Helvetica">This is an inexact question because it is not qualified with what form this would take but you can see it is somewhat of a community divider.  Myself, I voted no, mostly because I don&#8217;t think that without further explanation it is a valid question. For instance, lets say it was released with GPL and all Java code that used it needed to be GPL&#8217;d.  I don&#8217;t think you would get a 59% yes response worded that way.  For my needs, Java is sufficiently open sourced.  I can download it and file bugs and patches against the source that they expose.</font></p>
<p><font face="Helvetica">Star Wars versus Star Trek:</font><br /><font face="Helvetica">Star Wars about 65% &#8212; he moved quickly.</font></p>
<p><font face="Helvetica">I believe that you have to compare the best vs the best.  In that regard I compare Empire Strikes Back to Star Trek 2: The Wrath of Khan.  For me, in this case, Star Wars still wins by a nose,</font></p>
<p><font face="Helvetica">What is the most important thing when choosing a web application framework?</font><br /><font face="Helvetica">application maintainability 34%</font><br /><font face="Helvetica">ease of development 27%</font><br /><font face="Helvetica">existing architecture 19%</font><br /><font face="Helvetica">leverage skills 10%</font><br /><font face="Helvetica">code reuse 11%</font></p>
<p><font face="Helvetica">This is clearly the result of asking this question to advanced java developers.  People choose Java because you can go back to code that you or someone else wrote and figure out what it was doing and how to change it.  There are quite a few technologies that this doesn&#8217;t apply to that people are trying to push.. *cough* PHP *cough*.  These weightings generally reflect my biases.</font></p>
<p><font face="Helvetica">What Java IDE do you use?</font><br /><font face="Helvetica">Eclipse 53%</font><br /><font face="Helvetica">Idea 20%</font><br /><font face="Helvetica">jbuilder and wsad 7% each</font></p>
<p><font face="Helvetica">No surprise here except that I think IDEA has gained on Eclipse from this same written poll last year.  Remember that WSAD is also Eclipse which puts it at 60%.  There were a bunch of other ones on the slide but they were all noise.</font></p>
<p><font face="Helvetica">What web framework would you use?</font><br /><font face="Helvetica">struts 47%</font><br /><font face="Helvetica">spring 21%</font><br /><font face="Helvetica">tapestry 8</font><br /><font face="Helvetica">webwork 2</font><br /><font face="Helvetica">other 15</font></p>
<p><font face="Helvetica">I voted other on this one because I really think that JSP 2.0 is going to be sufficient for my needs.  With the new automatic prelude/codas, tag files, and scriptfree pages I can build and extremely clean system without using any of these containers.  I was a bit surprised that JSF wasn&#8217;t listed, however I&#8217;m not going to use it because of its incompatibility with JSP EL, etc.</font></p>
<p><font face="Helvetica">After the introduction to the conference Floyd introduced Mark Hapner, a lifer at the JCP who has had his hands in virtually every interesting (to me) JSR.  His talk was mostly about how the community now owns most of the infrastructure it needs to build services on the internet and that we should never again accept a proprietary wire protocol.  He then drifted into something about mixing SE and EE technologies that didn&#8217;t make much sense.  I&#8217;ve never had any problem mixing things that were designed for SE into WebLogic.  Blah blah blah, collaboration, potential, all kinds of vague innuendo about lightweight containers without talking directly about it.  Somehow he went from this to message and exchange patterns within an application and between them with some hand waving about unix pipe composition.  The only problem is that unix pipes are incredibly ad hoc and have no meta data associated with them while the XML messages that he is talking about compositing are typically in well known self-describing formats.  Perhaps unix processes should be able to output a schema for their output with a command line option so you could grab known fields instead of randomly grepping through stuff like you do today.  I think Microsoft has some sort of shell for .NET that does things like that, though it goes a little too far to the object side.  He also Seems to have a lot of Random Capital letters for Things in his Talk.  Somehow I think that is supposed to elevate them to &#8220;ideas&#8221; but really they are just words and without specifics things like Service Component is not that interesting.</font></p>
<p><font face="Helvetica">Finally he gets to the point, &#8220;here are the specs I&#8217;m working on, use them:&#8221;</font></p>
<p><font face="Helvetica">J2SE as the basis</font><br /><font face="Helvetica">JMX for management</font><br /><font face="Helvetica">JBI for collaboration</font><br /><font face="Helvetica">J2EE for its Service (capitalization his) technologies</font><br /><font face="Helvetica">Build it and other Service technologies will come</font></p>
<p><font face="Helvetica">I&#8217;m not so sure on that last point.  From what I can tell only .NET and Java really have the support for advanced WS-I technologies (this is what he is really talking about I assume).  Not that it is a bad thing, but I don&#8217;t think you are going to see much Ruby, Python, and PHP playing in this service platform or even talking to it without a lot of work.  That is of course unless you are using an implementation that runs on the JVM and just leverage all the Java libraries for dealing with this stuff.</font></p>
<p><font face="Helvetica">Now that he&#8217;s made his point he goes back into vague arguments about making the Java Platform the web build-out technology.  Why he&#8217;s making this argument to a bunch of Java developers who are already using the Java platform to do all this stuff, I&#8217;m not sure.  We all either believe in this vision already or are spies for Microsoft or the collection of duct tape technologies (the Ps).</font></div>
]]></content:encoded>
			<wfw:commentRss>http://www.javarants.com/2005/03/03/the-serverside-symposium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
