<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>peabrane - Home</title>
  <id>tag:www.peabrane.com,2007:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://www.peabrane.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.peabrane.com/" rel="alternate" type="text/html"/>
  <updated>2007-11-10T16:56:34Z</updated>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2007-11-10:7</id>
    <published>2007-11-10T16:55:00Z</published>
    <updated>2007-11-10T16:56:34Z</updated>
    <link href="http://www.peabrane.com/2007/11/10/the-fud-surrounding-ecma-4" rel="alternate" type="text/html"/>
    <title>The FUD surrounding ECMA 4</title>
<content type="html">
            &lt;p&gt;&lt;span class=&quot;caps&quot;&gt;UPDATE&lt;/span&gt;:  Dave Thomas, not the Ruby one, has some good criticisms on &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt; in a &lt;a href=&quot;http://www.jot.fm/issues/issue_2007_11/column3/index.html&quot;&gt;blog post&lt;/a&gt;.  Brendan Eich also recently posted some &lt;a href=&quot;http://weblogs.mozillazine.org/roadmap/archives/2007/11/es4_news_and_opinion.html&quot;&gt;news and thoughts&lt;/a&gt; on &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt;.  The &lt;span class=&quot;caps&quot;&gt;ECMA TG1&lt;/span&gt; group has also put out a &lt;a href=&quot;http://www.ecmascript.org/download.php&quot;&gt;reference implementation&lt;/a&gt; of &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;UPDATE2&lt;/span&gt;: On another note,  re-reading this article my tone and tenor towards Microsoft was a little harsh, more rant than anything.  I tend to have a large latent frustration with Microsoft, especially with regards to IE. I guess don&#8217;t blog while pissed off, is probably a good rule to follow.&lt;/p&gt;


	&lt;p&gt;Surprise, Surprise, Microsoft is &lt;a href=&quot;http://blogs.msdn.com/cwilso/archive/2007/10/31/what-i-think-about-es4.aspx&quot;&gt;spreading&lt;/a&gt; &lt;a href=&quot;http://blogs.msdn.com/ie/archive/2007/10/30/ecmascript-3-and-beyond.aspx&quot;&gt;&lt;span class=&quot;caps&quot;&gt;FUD&lt;/span&gt;&lt;/a&gt; about the proposed next version of Javascript, &lt;a href=&quot;http://www.ecmascript.org/es4/spec/overview.pdf&quot;&gt;&lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt;&lt;/a&gt;.  The Microsofties have been purposely vague about there criticisms on &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt;.  As this is a requirement for &lt;span class=&quot;caps&quot;&gt;FUD&lt;/span&gt;, quoting from Wikipedia: “FUD is generally a strategic attempt to influence public perception by disseminating negative (and vague) information.”&lt;/p&gt;


	&lt;p&gt;Brendan Eich, the &lt;span class=&quot;caps&quot;&gt;CTO&lt;/span&gt; of Mozilla, has done a good job of &lt;a href=&quot;http://weblogs.mozillazine.org/roadmap/archives/2007/10/open_letter_to_chris_wilson.html&quot;&gt;rebuffing the falsehoods&lt;/a&gt;, as he calls it.  Brendan specifically targets Chris Wilson a member of the Internet Explorer dev team.  Chris Wilson explained his reluctance on &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt;(ES4) in a blog post: &#8220;as the mashup development pattern would require interoperation of current &lt;span class=&quot;caps&quot;&gt;ES3&lt;/span&gt; scripts as well as supposed new &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; scripts.  With the ScreamingMonkey plan, this clearly won&#8217;t work well &#8211; as they&#8217;ll be run in different runtimes”.  This is a mischaracterization of &lt;a href=&quot;http://wiki.mozilla.org/Tamarin:ScreamingMonkey:Planning_notes&quot;&gt;ScreamingMonkey&lt;/a&gt;, developed by the open source community and Mozilla, it is meant as a backup plan only to bring &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; to IE.  In the potential case Microsoft decides not to support &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; at all.  ScreamingMonkey is a solution not the problem, and it is certainly not an excuse for Microsoft to not implement &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; in the first place.  ScreamingMonkey will only be implemented if the IE team fails to adopt the &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt; standard.  As Brendan Eich has explained: “I&#8217;ll make a promise: if Microsoft truly embraces &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; and ships it in an IE beta, I&#8217;ll put ScreamingMonkey on hiatus”.&lt;/p&gt;


	&lt;p&gt;Chris Wilson goes on to say, “but even without it(ScreamingMonkey) I expressed my skepticism that &lt;span class=&quot;caps&quot;&gt;ES3&lt;/span&gt; scripts won&#8217;t suffer if run through an &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; engine.&#8221;  It seems like Microsoft and the IE team has already made up their mind.  Now &lt;span class=&quot;caps&quot;&gt;ES4&lt;/span&gt; is supposed to be reverse compatible with &lt;span class=&quot;caps&quot;&gt;ES3&lt;/span&gt;.  Maybe Chris Wilson is correct and it will &#8220;suffer&#8221; as he says.  However, he doesn&#8217;t give any details as to why nor has anyone from Microsoft really explained there position in detail.  As the saying goes, it is time to put up or shut up.&lt;/p&gt;


	&lt;p&gt;However, I think this debate is just hiding the real underlying issue.  Microsoft doesn&#8217;t care about the open web.  They know they missed their opportunity with  Web 1.0, and that has brought them Google and company.  I don&#8217;t think they want to make this same mistake again. There is an advantage here for Microsoft.  Holding back &lt;span class=&quot;caps&quot;&gt;ECMA 4&lt;/span&gt; adoption, spreading &lt;span class=&quot;caps&quot;&gt;FUD&lt;/span&gt;, acting like changes will break the web, and in the end making really no changes or advancements to Javascript.  As big changes and advancements would cut into Microsoft&#8217;s plans with &lt;a href=&quot;http://silverlight.net&quot;&gt;Silverlight&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;And look what the last “advancement” Microsoft brought to the open web and what it did for them.  XMLHttpRequest or Ajax, originally developed for &lt;span class=&quot;caps&quot;&gt;IE 5&lt;/span&gt; to enhance Outlook Web Access, was quickly incorporated into Mozilla 1.0 and other competing browsers.  Ajax quickly exploded and has brought Microsoft nothing but grief in a powerful and growing Google platform: Google Maps, GMail, Google Docs; a slew of new competition named Web 2.0; and bunch of other web-based technologies to numerous to name, all which &lt;span class=&quot;caps&quot;&gt;REQUIRE&lt;/span&gt; Ajax.&lt;/p&gt;


	&lt;p&gt;Ajax has seemed to help everyone, but Microsoft and it is easy to see why.  With Ajax, applications which were only viable on the desktop in the past, now become possible on the web.  Ajax has begun to make the web the platform, not the operating system to potential detriment of Microsoft share.&lt;/p&gt;


	&lt;p&gt;Of course, web-based technologies can’t completely compete yet.  Which goes back to my original point, and explains why Microsoft would want to stifle innovation here.  If the movement is towards better, faster web based applications.  Microsoft wants no part, unless your using Silverlight.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2007-10-22:5</id>
    <published>2007-10-22T00:54:00Z</published>
    <updated>2007-10-22T01:32:14Z</updated>
    <link href="http://www.peabrane.com/2007/10/22/netbeans-on-rails" rel="alternate" type="text/html"/>
    <title>Netbeans on Rails</title>
<content type="html">
            &lt;p&gt;I&#8217;ve never given Netbeans a look before, as I&#8217;m not a Java programmer.  However recently Netbeans 6, which is
still in beta, has been getting some &lt;a href=&quot;http://www.loudthinking.com/posts/11-sun-surprises-at-railsconf-europe-2007&quot;&gt;good&lt;/a&gt;
&lt;a href=&quot;http://lifeonrails.org/2007/8/30/netbeans-the-best-ruby-on-rails-ide&quot;&gt;press&lt;/a&gt;
for its Ruby on Rails support.  So I thought I&#8217;d give it a run for a couple weeks.&lt;/p&gt;


	&lt;p&gt;I&#8217;ve been using Netbeans for a little over two weeks now.  My verdict: plan and simple Netbeans is kick ass.  I&#8217;m sold.  It may still be a little rough around the edges being a beta
and all.  However even with that said, it beats any other &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; or editor for Ruby on Rails hands down.  Yes in this bloggers opinion(itbo?), this statement includes the beloved Textmate.&lt;/p&gt;


	&lt;h3&gt;I miss my home row.  jVi anyone?&lt;/h3&gt;


	&lt;p&gt;I won&#8217;t list all the great features as I&#8217;d just be repeating what &lt;a href=&quot;http://lifeonrails.org/2007/8/30/netbeans-the-best-ruby-on-rails-ide&quot;&gt;George Cook has already done&lt;/a&gt;.  One thing George Cook didn&#8217;t cover in his article about Netbeans was jVi.  Now as a Vim lover myself, jVi just makes Netbeans that much better.  With jVi and Netbeans together, I feel right at home.&lt;/p&gt;


	&lt;p&gt;Netbeans is an awesome editor by itself.  However in using it, I soon started to miss my Vim home row
goodness.  &lt;a href=&quot;http://jvi.sourceforge.net/&quot;&gt;jVi&lt;/a&gt; to the rescue, jVi is a
Java port of Vim and it works with Netbeans.  You can use all the Vim commands
while still using all the awesome features of Netbeans: code completion that
really works, incredible &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; integration, debugging, documentation, etc, etc.&lt;/p&gt;


	&lt;h3&gt;Try it out&lt;/h3&gt;


	&lt;p&gt;You can get Netbeans 6.0 Beta 1 from &lt;a href=&quot;http://dlc.sun.com/netbeans/download/6_0/beta1/&quot;&gt;here&lt;/a&gt;.  I&#8217;d however recommend
using one of the &lt;a href=&quot;http://deadlock.netbeans.org/hudson/job/ruby/&quot;&gt;daily builds&lt;/a&gt; available.&lt;/p&gt;


	&lt;p&gt;One thing I should note is, I&#8217;ve noticed a issue when accessing certain features
a blank or empty window will popup.  If you run into this, make sure you are
using the latest &lt;span class=&quot;caps&quot;&gt;JDK&lt;/span&gt;.  As for me it seems like that was the issue, however your mileage may vary.  You can change
the &lt;span class=&quot;caps&quot;&gt;JDK&lt;/span&gt; Netbeans uses by using the &#8216;&#8212;jdkhome&#8217; command line option.&lt;/p&gt;


&lt;pre&gt;$ bin/nbrubyide --jdkhome /usr/lib/jvm/jdk1.6.0_03/&lt;/pre&gt;

	&lt;p&gt;Once you have Netbeans up and running, jVi is really easy to install. Just download  &lt;a href=&quot;https://sourceforge.net/project/showfiles.php?group_id=3653&quot;&gt;jVi for
Netbeans&lt;/a&gt;.  Inside Netbeans goto Tools-&amp;gt;Plugins and then click the Downloaded tab,
click &#8220;Add Plugins..&#8221;, and install.&lt;/p&gt;


	&lt;h3&gt;Documentation and links&lt;/h3&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://blogs.sun.com/tor/&quot;&gt;Tor Norbye&#8217;s blog&lt;/a&gt;, the mastermind behind Ruby and Rails support for Netbeans working at Sun.&lt;/li&gt;
		&lt;li&gt;Netbeans/RubyOnRails &lt;a href=&quot;http://wiki.netbeans.info/wiki/view/RubyOnRails&quot;&gt;Wiki page&lt;/a&gt;.&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2007-08-25:1</id>
    <published>2007-08-25T05:49:00Z</published>
    <updated>2007-10-24T19:47:19Z</updated>
    <link href="http://www.peabrane.com/2007/8/25/trials-and-tribulations-of-class-variables-in-ruby" rel="alternate" type="text/html"/>
    <title>Trials and tribulations of class variables in Ruby.</title>
<content type="html">
            &lt;p&gt;I guess I missed the discussion earlier this year about Ruby and class variables. There were a &lt;a href=&quot;http://blogs.relevancellc.com/2006/11/16/use-class-instance-variables-not-class-variables&quot;&gt;lot&lt;/a&gt; &lt;a href=&quot;http://www.oreillynet.com/ruby/blog/2007/01/nubygems_dont_use_class_variab_1.html&quot;&gt;of&lt;/a&gt; &lt;a href=&quot;http://www.continuousthinking.com/2006/11/17/ruby-class-variable-or-class-instance-variables&quot;&gt;posts&lt;/a&gt; about the problems with using class variables incorrectly, many of which, called for the use of &lt;a href=&quot;http://www.martinfowler.com/bliki/ClassInstanceVariable.html&quot;&gt;class instance variables&lt;/a&gt; instead.&lt;/p&gt;


	&lt;p&gt;I recently fell into this class variable trap described in the posts above. Here is some code simulating my problem.&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
class Person
  @@count = 0
  def initialize(name)
    @name = name
    @@count += 1
  end
end

class Customer &amp;lt; Person
  @@count = 0
  def self.count
    puts @@count
  end
end

a = Person.new(&quot;Jim Bob&quot;)
b = Person.new(&quot;Jason Yates&quot;)
c = Customer.new(&quot;Albert Einstein&quot;)

puts  &quot;Output: Customer.count&quot;&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;Output: 3&lt;/pre&gt;

	&lt;p&gt;You would expect to get ‘1′ back from the ‘Customer.count’ method. It is the more obvious behavior or the one with the least surprise. The issue is, as you may have already noticed, class variables are shared with its subclasses. This behavior, speaking from personal experience here,  can lead to very confusing and hard to diagnose bugs.&lt;/p&gt;


	&lt;p&gt;The problem above is easily solved by the use of class instance variables.&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
class Person
  class &amp;lt;&amp;lt; self; attr_accessor :count; end
  def initialize(name)
    @name = name
    self.class.count ||= 0
    self.class.count += 1
  end
end

class Customer &amp;lt; Person
end

a = Person.new(&quot;Jim Bob&quot;)

b = Person.new(&quot;Jason Yates&quot;)
c = Customer.new(&quot;Albert Einstein&quot;)

puts  &quot;Output: Customer.count&quot;&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;Output: 1&lt;/pre&gt;

	&lt;p&gt;As you can see this simulates the expected behavior.&lt;/p&gt;


	&lt;p&gt;This will all become mute fairly soon anyways. In Ruby 1.9, class variables are now read-only by its subclasses. With this even the first example should work correctly.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2007-07-31:4</id>
    <published>2007-07-31T23:12:00Z</published>
    <updated>2007-10-24T19:47:31Z</updated>
    <link href="http://www.peabrane.com/2007/7/31/pimp-my-gnome-terminal" rel="alternate" type="text/html"/>
    <title>Pimp my gnome-terminal</title>
<content type="html">
            &lt;p&gt;I saw Rob Orsini &lt;a href=&quot;http://blog.tupleshop.com/2007/7/22/pimp-my-iterm&quot;&gt;pimped his iTerm&lt;/a&gt;.  I admit, I got a little jealous. What about gnome-terminal?  You may ask, do people actually program Rails on Linux and use Gnome at that?  Well I atleast know of &lt;a href=&quot;http://jaywhy.wordpress.com&quot;&gt;one guy&lt;/a&gt; who does.&lt;/p&gt;


I was tired of manually opening Vim, starting the Rails server, tailing the development log, and opening the Rails console every time I opened a project. So I pimped my gnome-terminal.
&lt;pre&gt;#!/bin/bash

if [[ $# == 0 ]]; then
  PROJECT_DIR=$PWD
elif [[ $# == 1 &amp;amp;amp;&amp;amp;amp; -d &quot;$1&quot; ]]; then
  PROJECT_DIR=&quot;$@&quot; 
else
  print &quot;usage: pimp-term.sh [rails project directory]&quot; 
  return 1
fi

cd $PROJECT_DIR

gvim 

gnome-terminal \
  --tab -t &quot;app&quot; \
  --tab -t &quot;server&quot; -e &quot;sh -x -c './script/server'&quot; \
  --tab -t &quot;console&quot; -e &quot;sh -x -c './script/console'&quot; \
  --tab -t &quot;log&quot; -e &quot;sh -x -c 'tail -f log/development.log'&quot;&lt;/pre&gt;

&lt;pre&gt;
$ pimp-term.sh project/myblog&lt;/pre&gt;

	&lt;p&gt;You&#8217;ve officially been pimped.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2007-03-05:3</id>
    <published>2007-03-05T06:14:00Z</published>
    <updated>2007-10-24T19:47:44Z</updated>
    <link href="http://www.peabrane.com/2007/3/5/pdf-templates-via-rails" rel="alternate" type="text/html"/>
    <title>PDF Templates via Rails</title>
<content type="html">
            &lt;p&gt;Recently, for a project, I needed a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; generator which took existing &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; as templates and filled in data.  My simple requirement was &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; look and feel wouldn&#8217;t require any coding.  How hard could that be?  Famous last words.&lt;/p&gt;


&lt;h3&gt;The Problem&lt;/h3&gt;

	&lt;p&gt;The majority of &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; generators out there are exactly that generators. They simply create new &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;&#8217;s based on programming code. They don&#8217;t edit existing &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; files, let alone have the ability to fill in data.  So I looked into a couple other solutions.  First I checked out image based solutions like using ImageMagick.  I could of course edit existing image files and add data.  But, the problem is the added image data would have to be positioned.  If the template image changed, so would my positions in code.  So that was out.&lt;/p&gt;


	&lt;p&gt;I tried using PostScript files saved from Adobe Illustrator.   I created a template and placed text like &amp;lt;% replace_me &lt;span&gt;&amp;gt;.  That should work right?  Wrong.  For whatever reason Adobe Illustrator likes to create &lt;span class=&quot;caps&quot;&gt;HUGE&lt;/span&gt; files.  Yes 100,000 lines long in some cases. It also splits up text arbitrarily.  So &#8221;&amp;lt;&lt;/span&gt; replace_me &lt;span&gt;&amp;gt;&#8221; became &#8221;&amp;lt;&lt;/span&gt; r&#8221; 20 lines of positioning and font information, &#8220;eplac&#8221; 20 lines of positioning and font information, etc.  Making a search and replace impossible.&lt;/p&gt;


&lt;h3&gt;iText to the Rescue&lt;/h3&gt;

	&lt;p&gt;&lt;a href=&quot;http://www.lowagie.com/iText/&quot;&gt;iText&lt;/a&gt; is an excellent Java &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; library.  In fact, I believe other then it&#8217;s C# counterpart.  Is the only &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; library which could do what I wanted.  iText can take existing &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;&#8217;s and manipulate them.  It also can take blank &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; forms and fill out the data, similar to taking &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; form and setting each form field tags value attribute.  This is exactly what I wanted.  Although it is an ad-hoc round about solution it does work.&lt;/p&gt;


	&lt;p&gt;Creating &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; forms is pretty easy also. Downside is only one product can create them Adobe LiveCycle Designer, which comes with Adobe Acrobat Professional.&lt;/p&gt;


&lt;h3&gt;Solution&lt;/h3&gt;

So first I needed to create a wrapper around iText using the excellent &lt;a href=&quot;http://rjb.rubyforge.org/&quot;&gt;Ruby Java Bridge&lt;/a&gt;(Rjb).
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
require 'rjb'
Rjb::load('lib/itext-1.4.8.jar')

class PDFStamper
  attr_accessor :writer

  def initialize( template = &quot;proposal_template.pdf&quot; )
    filestream   = Rjb::import('java.io.FileOutputStream')
    acrofields   = Rjb::import('com.lowagie.text.pdf.AcroFields')
    pdfreader    = Rjb::import('com.lowagie.text.pdf.PdfReader')
    pdfstamper   = Rjb::import('com.lowagie.text.pdf.PdfStamper')

    reader = pdfreader.new( template )
    @stamp = pdfstamper.new( reader, filestream.new( tmpfile() ) )
    @form = @stamp.getAcroFields()
  end

  def set( key, value )
    @form.setField( key, value.to_s )
  end

  def fill
    @stamp.setFormFlattening(true)
    @stamp.close
  end

  def tmpfile
    return @tmpfile unless @tmpfile.nil?
    @tmpfile = File.join( Dir::tmpdir, make_tmpname )
  end

  private

  def make_tmpname
    return 'proposal-' + rand(10000).to_s + '.pdf'
  end
end&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then using Adobe LiveCycle Designer, I simply created a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; form and added textfield&#8217;s which would be filled out by iText.  The textfield&#8217;s can be styled, so don&#8217;t think you have to keep that normal &#8220;textfield&#8221; look. Make sure you give each textfield a name that you will use &#8220;set( textfield_name, value)&#8221; to set the value .  In my &lt;span class=&quot;caps&quot;&gt;PDF I&lt;/span&gt; 
simply named each textfield after the database fields.  Then in my controller code, I had the following.&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;def output
  order = Order.find(params[:id])
  pdf = PDFStamper.new

  for column in Order.content_columns
    pdf.set( column.name, order.send(column.name) )
  end

  pdf.fill

  send_data( File.open( pdf.tmpfile ).read,
    :filename =&amp;amp;gt; &quot;order.pdf&quot;,
    :type =&amp;amp;gt; &quot;application/pdf&quot;,
    :disposition =&amp;amp;gt; &quot;inline&quot; 
  )
end&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Caveats&lt;/h3&gt;

	&lt;p&gt;First of, you need Java environment variables set correctly before this will work.&lt;/p&gt;


&lt;pre&gt;export LD_LIBRARY_PATH=/usr/java/jdk1.6.0/jre/lib/i386/:/usr/java/jdk1.6.0/jre/lib/i386/client/:./
export JAVA_HOME=/usr/java/jdk1.6.0/&lt;/pre&gt;

	&lt;p&gt;You can set these variables in the command line and start mongrel manually &#8220;mongrel_rails start&#8221;.  Which will work fine.  Except in production this isn&#8217;t really a good solution.&lt;/p&gt;


	&lt;p&gt;I ended up using the mongrel_cluster init.d script that comes with mongrel.  Documentation is available &lt;a href=&quot;http://mongrel.rubyforge.org/docs/mongrel_cluster.html&quot;&gt;here&lt;/a&gt;. I simply placed the export commands on the top of the script.&lt;/p&gt;


	&lt;p&gt;Another issue I hit was when Java starts.  Java will check for total available system memory and then precedes to steal a good portion of it.  Now this isn&#8217;t a problem with a dedicated server. A virtual server, on the other hand, is allocated a portion of the available system memory.  So if the server you are on has 4gbs of memory.  Java thinks it has 4gbs to play with, not the 256mb allocated to your virtual server.&lt;/p&gt;


	&lt;p&gt;This caused this weird issue where one mongrel process in my cluster would work and one wouldn&#8217;t.  Because each mongrel instance starts its own Java process.  The first one would steal all the available memory.  Then the second couldn&#8217;t even start because no memory was available.&lt;/p&gt;


	&lt;p&gt;Making matters worse Rails or Mongrel, not sure which, would hide this memory error.  I didn&#8217;t figure it out until I created a test script that forked, each fork loading the iText jar.  The test showed the error coming from Java.&lt;/p&gt;


	&lt;p&gt;To fix this, I set the _JAVA_OPTIONS environment variable.  The options get sent to Java as it loads, it limits the amount of ram each Java instance can eat up. Just place this next to your other Java environment variables inside your init.d mongrel script.&lt;/p&gt;


&lt;pre&gt;export _JAVA_OPTIONS='-Xms16m -Xmx32m'&lt;/pre&gt;

	&lt;p&gt;You may have to fudge these numbers a little for your particular environment.  Or, if you are using a dedicated server don&#8217;t worry about it.&lt;/p&gt;


&lt;h3&gt;Limitations&lt;/h3&gt;

	&lt;p&gt;Now for my particular needs, I only needed text placeholders for the template.  However, I believe using LiveCycle designer you can place image placeholders and table based data.  Then use iText to fill them in. Don&#8217;t take my word for it though.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.peabrane.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.peabrane.com,2006-08-17:2</id>
    <published>2006-08-17T06:13:00Z</published>
    <updated>2007-10-24T19:48:00Z</updated>
    <link href="http://www.peabrane.com/2006/8/17/who-needs-compliance-we-have-improvements" rel="alternate" type="text/html"/>
    <title>Who needs compliance, we have "improvements"?</title>
<content type="html">
            &lt;p&gt;Microsoft&#8217;s Chris Wilson, the Group Program Manager for IE, was &lt;a href=&quot;http://blogs.zdnet.com/web2explorer/?p=260&quot;&gt;interviewed&lt;/a&gt; by ZDNet today and with great marketing finesse managed to completely dodge the whole standards compliance issue.  Instead Chris talks about “standard improvements” or “improvements in our standards support in &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;”.  I applaud the IE team here for the &lt;span class=&quot;caps&quot;&gt;IE6&lt;/span&gt; bug improvements found in &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;. However, what about actual standards compliance? According to the &lt;a href=&quot;http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx&quot;&gt;IEBlog&lt;/a&gt;, the &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; team has added support for.&lt;/p&gt;


&lt;ul&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;HTML 4&lt;/span&gt;.01 &lt;span class=&quot;caps&quot;&gt;ABBR&lt;/span&gt; tag&lt;/li&gt;
    &lt;li&gt;Improved (though not yet perfect) &amp;lt;object&amp;gt; fallback&lt;/li&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;CSS 2&lt;/span&gt;.1 Selector support (child, adjacent, attribute, first-child etc.)&lt;/li&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;CSS 2&lt;/span&gt;.1 Fixed positioning&lt;/li&gt;
    &lt;li&gt;Alpha channel in &lt;span class=&quot;caps&quot;&gt;PNG&lt;/span&gt; images&lt;/li&gt;
    &lt;li&gt;Fix :hover on all elements&lt;/li&gt;
    &lt;li&gt;Background-attachment: fixed on all elements not just body&lt;/li&gt;
&lt;/ul&gt;

	&lt;p&gt;Most of these added features still have issues, or caveats related to them.  Slack, of course, should be given with &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; still being in beta. Overall though even with these additions, standards compliance hasn&#8217;t changed much in &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;.  &lt;a href=&quot;http://www.webdevout.net/browser-support&quot;&gt;Web Devout analysis&lt;/a&gt; of both &lt;span class=&quot;caps&quot;&gt;IE6&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; confirms this.  First let me say a semi-legitimate argument could be made saying Web Devout&#8217;s numbers are biased towards IE.  However I still think is fairly effective especially when comparing IE with itself.&lt;/p&gt;


&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;IE 6&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;IE 7&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;Firefox 1.5&lt;/td&gt;
&lt;td&gt;Opera 8.5&lt;/td&gt;
&lt;td&gt;Opera 9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; / &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;73%&lt;/td&gt;
&lt;td&gt;73%&lt;/td&gt;
&lt;td&gt;90%&lt;/td&gt;
&lt;td&gt;85%&lt;/td&gt;
&lt;td&gt;85%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;CSS 2&lt;/span&gt;.1&lt;/td&gt;
&lt;td&gt;51%&lt;/td&gt;
&lt;td&gt;55%&lt;/td&gt;
&lt;td&gt;93%&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;td&gt;95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;CSS 3&lt;/span&gt; changes&lt;/td&gt;
&lt;td&gt;10%&lt;/td&gt;
&lt;td&gt;13%&lt;/td&gt;
&lt;td&gt;27%&lt;/td&gt;
&lt;td&gt;8%&lt;/td&gt;
&lt;td&gt;22%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;51%&lt;/td&gt;
&lt;td&gt;79%&lt;/td&gt;
&lt;td&gt;78%&lt;/td&gt;
&lt;td&gt;84%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ECMAScript&lt;/td&gt;
&lt;td&gt;99%&lt;/td&gt;
&lt;td&gt;99%&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

	&lt;p&gt;As you can see, there really isn&#8217;t much difference between &lt;span class=&quot;caps&quot;&gt;IE6&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; with regards to standards compliance.  Most importantly, in my opinion, &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; is still lacking:&lt;/p&gt;


&lt;ul&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Level 2 Events(Netscape Communicator had this in 2000!)&lt;/li&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; attributes are still broken&lt;/li&gt;
    &lt;li&gt;No Javascript 1.6 support&lt;/li&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; :focus&lt;/li&gt;
    &lt;li&gt;&lt;span class=&quot;caps&quot;&gt;SVG&lt;/span&gt; support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However my list is quite short. There are &lt;a href=&quot;https://jaywhy.wordpress.com/wp-admin/%E2%80%9Dhttp://www.quirksmode.org/blog/archives/2006/04/ie_7_and_javasc.html%E2%80%9D&quot;&gt;many&lt;/a&gt; &lt;a href=&quot;https://jaywhy.wordpress.com/wp-admin/%E2%80%9Dhttp://erik.eae.net/archives/2006/02/01/12.10.34/%E2%80%9D&quot;&gt;more&lt;/a&gt; &lt;a href=&quot;https://jaywhy.wordpress.com/wp-admin/%E2%80%9Dhttp://alex.dojotoolkit.org/?p=536%E2%80%9D&quot;&gt;lists&lt;/a&gt; out better than mine.&lt;/p&gt;
I wouldn&#8217;t go so far to say as &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; is “just a bug release”.  It is fairly close however.  &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; is still years behind most modern web browsers, and it hasn&#8217;t even been released.
          </content>  </entry>
</feed>
