<?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>Peter Krantz &#187; Ruby</title>
	<atom:link href="http://www.peterkrantz.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterkrantz.com</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 09:57:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rails vs Grails vs Django models</title>
		<link>http://www.peterkrantz.com/2009/rails-grails-django-models/</link>
		<comments>http://www.peterkrantz.com/2009/rails-grails-django-models/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 16:58:47 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[domain modeling]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=281</guid>
		<description><![CDATA[Coming back to Rails after being away from some time in Django land I discovered a huge difference in how Rails and Django treats your models...]]></description>
			<content:encoded><![CDATA[<p>Coming back to Rails after being away from some time in Django land I discovered a huge difference in how Rails, Grails and Django treats your models. <span id="more-281"></span>In Django and Grails you can look at a model class and see all the properties it has:</p>
<pre class="brush: python; title: ; notranslate">
class Organization(models.Model):
    name = models.CharField(max_length=255)
    url = models.URLField(verify_exists=False)
    orgtype = models.ForeignKey(OrgType)
</pre>
<p>The same model class in Rails typically looks like this:</p>
<pre class="brush: ruby; title: ; notranslate">
class Organization &lt; ActiveRecord::Base
    belongs_to :OrgType
end
</pre>
<p>&#8230;and in Grails it is more specific like Django:</p>
<pre class="brush: groovy; title: ; notranslate">
class Organization {
  String name
  String url
  static belongsTo = OrgType
  OrgType orgtype
}
</pre>
<p>It took me a while to remember that in Rails, parts of the model design is actually stored in the database schema instead of in the Ruby code. Peculiar don&#8217;t you think, given that everything else in a Rails app is nicely declared in Ruby code? There are of course benefits to both approaches, but I have started adding comments in the Rails model classes to be able to remember what properties they have without peeking in the Db. Typically I have a number of half-baked projects on my laptop and from time to time I forget what they do and these comments help me remember.</p>
<p>Check out more examples here:</p>
<ul>
<li><a href="http://docs.djangoproject.com/en/dev/topics/db/models/#topics-db-models">Django models</a></li>
<li><a href="http://www.tutorialspoint.com/ruby-on-rails/rails-models.htm">Rails models</a></li>
<li><a href="https://www.ibm.com/developerworks/java/library/j-grails02128/">Grails models</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2009/rails-grails-django-models/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Intricacies of PHP compared to Ruby</title>
		<link>http://www.peterkrantz.com/2008/php-for-beginners/</link>
		<comments>http://www.peterkrantz.com/2008/php-for-beginners/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 09:25:19 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2008/php-for-beginners/</guid>
		<description><![CDATA[Via Tim Bray&#8217;s blog I found zestyping&#8217;s &#8220;Why PHP should never be taught&#8221;. In it he provides ...]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://www.tbray.org/ongoing/When/200x/2007/12/31/Year-Sweep-Tech">Tim Bray&#8217;s blog</a> I found <a href="http://zestyping.livejournal.com/124503.html?thread=690519">zestyping&#8217;s &#8220;Why PHP should never be taught&#8221;</a>. In it he provides some interesting PHP code that will be difficult for beginners to understand.<span id="more-127"></span></p>
<pre class="brush: php; title: ; notranslate">$a = 0;
$b = &quot;eggs&quot;;
$c = &quot;spam&quot;;</pre>
<p>yields:</p>
<pre class="brush: ruby; title: ; notranslate">
a == b
b != c
a == c
a == d
b != d
c != d
</pre>
<p>(Please note that d hasn&#8217;t been defined). In the comments, people freak out and tell him that this behaviour is defined in the documentation. I guess that makes it even worse.</p>
<p>Trying the same thing in Ruby:</p>
<pre class="brush: ruby; title: ; notranslate">
a = 0
b = &quot;eggs&quot;
c = &quot;spam&quot;

a == b
=&gt; false

b == c
=&gt; false

a == c
=&gt; false

a == d
NameError: undefined local variable or method 'd' for main:Object from (irb):7
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/php-for-beginners/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SimpleCrawler for your everyday web crawling needs</title>
		<link>http://www.peterkrantz.com/2007/ruby-web-crawler/</link>
		<comments>http://www.peterkrantz.com/2007/ruby-web-crawler/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 19:22:43 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/ruby-web-crawler/</guid>
		<description><![CDATA[Over at the standards-schmandards blog I often test websites to gather statistics on specific HTML use, accessibility ...]]></description>
			<content:encoded><![CDATA[<p><img class="illustration alignleft" src="http://www.peterkrantz.com/wp-content/uploads/2007/08/simplecrawler.gif" alt="" width="162" height="125" />Over at the <a href="http://www.standards-schmandards.com/">standards-schmandards blog</a> I often test websites to gather statistics on specific HTML use, accessibility and other things. Each time I have written a web crawler to collect the data. In Python and Ruby this is a simple task but last time it was like a déjà vu and I decided to create a Ruby library that I could use in the future.<span id="more-103"></span></p>
<p><a href="http://www.peterkrantz.com/simplecrawler/wiki/">SimpleCrawler</a> is a Ruby gem that covers basic web crawling needs. Coupled with Raakt and Ruport it can be used to create a <a href="http://www.peterkrantz.com/simplecrawler/wiki/examples/accessibility-report">basic accessibility report</a> for a website.</p>
<p>A minimal example:</p>
<pre class="brush: ruby; title: ; notranslate">
require 'simplecrawler'

# Set up a new crawler
sc = SimpleCrawler::Crawler.new(&quot;http://www.peterkrantz.com/&quot;)

sc.crawl { |document|
   # output the crawled uri
   puts document.uri
}
</pre>
<p>For more details and examples see the <a href="http://www.peterkrantz.com/simplecrawler/wiki/">SimpleCrawler wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/ruby-web-crawler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hackety Hack &#8211; The Foundation for a Revolution</title>
		<link>http://www.peterkrantz.com/2007/hackety-hack-revolution/</link>
		<comments>http://www.peterkrantz.com/2007/hackety-hack-revolution/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 11:11:26 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Trends]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/hackety-hack-revolution/</guid>
		<description><![CDATA[Why the lucky stiff is a well known name among most Ruby developers. Many have read his ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://whytheluckystiff.net/">Why the lucky stiff</a> is a well known name among most Ruby developers. Many have read his Ruby programming tutorials and seen his spectacular performances (or whatever they are) at RailsConf and elsewhere. Personally, I owe him a lot for Hpricot, the liberal HTML parser (at <a href="http://www.verva.se/web/t/Page____492.aspx">my government agency</a> we use it to run the <a href="http://www.verva.se/web/t/Page____2135.aspx">quarterly test of all public websites in Sweden</a>). Hpricot is also the default parser for the <a href="http://www.peterkrantz.com/raakt/wiki/">Ruby Accessibility Analysis Kit</a>.<span id="more-96"></span></p>
<h2>The Hackety Hack</h2>
<p><img class="alignleft" src="http://www.peterkrantz.com/wp-content/uploads/2007/07/hackety-hack.jpg" alt="Hackety Hack t-shirt" width="300" height="217" />His latest endeavour seemed uninteresting at first. Hackety Hack, a toolbox to <a href="http://hacketyhack.net/">teach programming to kids</a>. But after a while it dawned on me. If Ruby on Rails is beginning to make inroads into the Enterprise by challenging web development paradigms, Hackety Hack will in time question many of the programming paradigms taught at universities today.</p>
<p>My first programming class at university was in <a href="http://en.wikipedia.org/wiki/ML_programming_language">ML, a functional programming language</a>. I remember that we played with lists a lot. And recursion. Then we made a parser for our own symbolic programming language. I guess that pretty much killed my entrepreneurial spirit for a couple of years.</p>
<p>Kids who learn how to set up a blog in five lines of code, send messages over the internet and play with mp3 files will not accept that. The first kids out of Hackety Hack camp will soon be arriving at universities all over the place. And they will question the curly braces, the semicolons and <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Arcane ways to make Old programming languages Pleasant</a>.</p>
<p>If I was a university professor I would make sure to have a look at some other programming languages apart from Java and C# (do they teach C# at universities?) before these kids come and ruin my programming classes.</p>
<p>I predict that Sweden will be the last bastion of uninterested software developers. To make some sort of vague statement I have made a Hackety Hack t-shirt for my 2 year old son. I hope he will be at the front lines of the Hackety Hack revolution.</p>
<p><strong>Update:</strong> A bunch of people asked me where the highres print came from. The <a href="http://hacketyhack.net/art/">original logo is of course from Why the lucky stiff</a>. Here is the <a href="http://www.peterkrantz.com/wp-content/uploads/2007/07/hackety-hack-print.pdf">Hackety Hack logo PDF</a> that I created in Inkscape.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/hackety-hack-revolution/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Checking for Model Classes Before Using Them in Rails Migrations</title>
		<link>http://www.peterkrantz.com/2007/models-in-migrations-tip/</link>
		<comments>http://www.peterkrantz.com/2007/models-in-migrations-tip/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 11:39:27 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/models-in-migrations-tip/</guid>
		<description><![CDATA[If you are using model objects in migrations (e.g. for inserting data) you should make sure that ...]]></description>
			<content:encoded><![CDATA[<p>If you are using model objects in migrations (e.g. for inserting data) you should make sure that the migration works even if that model class is removed. I discovered this when setting up a new development environment and running all migrations in an empty database.</p>
<p>Let&#8217;s say you have the following migration code:</p>
<p>class InsertCounties < ActiveRecord::Migration<br />
  def self.up<br />
    County.create :code => &#8217;10&#8242;, :name => &#8216;Blekinge&#8217;<br />
    County.create :code => &#8217;20&#8242;, :name => &#8216;Dalarna&#8217;<br />
  end<br />
end</p>
<p>This assumes that the County model is available when the migration is run. If you checked out the most recent version of your code from svn it is possible that it doesn&#8217;t contain the County model and the migration will fail. To check if County is available before trying to use it <a href="http://redhanded.hobix.com/inspect/methodCheckDefined.html">we can use Ruby&#8217;s defined?</a> like this:</p>
<p><strong>Update:</strong> No we can&#8217;t. defined? always returns false inside an ActiveRecord migration for some reason (maybe the class isn&#8217;t loaded before the actual call?). We have to use a begin&#8230;rescue&#8230;end block instead:</p>
<p>class InsertCounties < ActiveRecord::Migration<br />
  def self.up<br />
    begin<br />
      County.create :code => &#8217;10&#8242;, :name => &#8216;Blekinge&#8217;<br />
      County.create :code => &#8217;20&#8242;, :name => &#8216;Dalarna&#8217;<br />
    rescue<br />
      puts &#8220;Could not add data&#8230;&#8221;<br />
    end<br />
  end<br />
end</p>
<p>This way the rest of the migrations will run.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/models-in-migrations-tip/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bringing Ruby to the .NET environment</title>
		<link>http://www.peterkrantz.com/2007/bringing-ruby-to-the-net-environment/</link>
		<comments>http://www.peterkrantz.com/2007/bringing-ruby-to-the-net-environment/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 09:04:15 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Trends]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/bringing-ruby-to-the-net-environment/</guid>
		<description><![CDATA[Things are heating up in the Ruby-as-a-dotnet-language area. Martin Fowler voiced his concerns on Microsoft not being ...]]></description>
			<content:encoded><![CDATA[<p>Things are heating up in the Ruby-as-a-dotnet-language area. <a href="http://martinfowler.com/bliki/RubyMicrosoft.html">Martin Fowler voiced his concerns</a> on Microsoft not being able to look at source code and therefore having trouble implementing Ruby properly. Microsoft, with <a href="http://www.iunknown.com/">John Lam</a> in the cockpit, is implementting Ruby for the .net platform (if you have been reading my previous blog posts I predicted way <a href="http://www.peterkrantz.com/2006/using-ruby-as-a-net-language/">back in february 2006</a> that John Lam would get scooped up my Microsoft:-).</p>
<p><a href="http://ola-bini.blogspot.com/2007/06/there-can-be-only-one-tale-about-ruby.html">Ola Bini is also concerned</a> about Microsoft not letting ther developers look at the Ruby implementation. If you remember the whole SCO debacle I guess it isn&#8217;t that strange. Microsoft is in the position where software they develop potentially may end up in millions of computers. Apparently the US legal system awards damages in proportion to this. Thus, any issues with a Ruby implementation on .net can quickly become costly.</p>
<p>It is all quite bizarre. Does this mean that the Microsoft version of the Ruby language is different from the &#8220;original&#8221; Ruby? I guess we will never know. Developers will probably write a lot of Ruby code that runs happily on the CLR. Rails applications will be deployed. But I am sure that there will be &#8220;special cases&#8221; where IronRuby will differ from &#8220;original&#8221; Ruby.</p>
<p>Therefore is was refreshing to see that Queensland University of Technology are progressing steadily with <a href="http://plas2003.fit.qut.edu.au/Ruby.NET/">their Ruby.NET implementation</a>. Currently you can actually compile a Ruby script into a .NET 2.0 assembly that other CLR languages can talk to. This may be the spearhead into the <a href="http://www.peterkrantz.com/2007/enterprise-rails-deployment/">other half of enterprise deployment options</a>.</p>
<p>All in all the future of software development looks bright. Will developers that invested a lot of time in Java or C# switch? Or will they move on to maintaining applications?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/bringing-ruby-to-the-net-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with UTF-8 in PDF::Writer and Ruby on Rails</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/</link>
		<comments>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comments</comments>
		<pubDate>Thu, 31 May 2007 14:26:00 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/</guid>
		<description><![CDATA[Googling for information on how to use PDF::Writer shows that there are many european developers frustrated with ...]]></description>
			<content:encoded><![CDATA[<p>Googling for information on how to use <a href="http://ruby-pdf.rubyforge.org/pdf-writer/index.html">PDF::Writer</a> shows that there are many european developers frustrated with the lack of UTF-8 support in PDF::Writer. As Ruby on Rails works great with UTF-8 these days this can be a bit of an issue. </p>
<p>Part of the problem lies in the fact that the PDF specification (at least up to 1.6) does not support UTF-8 (you can use UTF-16 if you like). I had the misfortune of plowing thorugh it a couple of years ago when developing a PDF form filler library for a customer (don&#8217;t ask).</p>
<p>In Ruby on Rails, this is easy to solve as long as you only use Latin characters with diacritics. The solution is to switch encoding back to <a href="http://en.wikipedia.org/wiki/ISO_8859-15">ISO-8859-15</a> for text strings you feed to PDF::Writer. </p>
<p>A simple extension to the String class will do the trick:</p>
<pre class="brush: ruby; title: ; notranslate">
class String
  require 'iconv'
  def to_iso
    c = Iconv.new('ISO-8859-15','UTF-8')
    c.iconv(self)
  end
end
</pre>
<p>If you are working in Rails you can put this code in the lib folder (I usually call the file string_extensions.rb). </p>
<p>Then, when you call the text method on your PDF::Writer intance you can easily pass a correctly encoded string.</p>
<h2>Overriding PDF::Writer text method</h2>
<p>A much cleaner approach, as Aníbal describes in the comment below, is to override PDF::Writer&#8217;s text method.</p>
<p>Put the following code in a file called pdfwriter_extensions.rb (or whatever you choose to call it) in your lib directory:</p>
<pre class="brush: ruby; title: ; notranslate">
CONVERTER = Iconv.new( 'ISO-8859-15//IGNORE//TRANSLIT', 'utf-8')

module PDF
	class Writer
		alias_method :old_text, :text

		def text(textto, options = {})
			old_text(CONVERTER.iconv(textto), options)
		end

	end
end
</pre>
<p>In your controller that handles the PDF output you add:</p>
<pre class="brush: ruby; title: ; notranslate">
  require 'pdf/writer'
  require 'pdfwriter_extensions'
</pre>
<p>&#8230;after which you can use PDF::Writer like in the tutorial:</p>
<pre class="brush: ruby; title: ; notranslate">
    pdf = PDF::Writer.new
    pdf.select_font &quot;Helvetica&quot;, :encoding =&gt; nil
    pdf.text &quot;User name: &lt;b&gt;#{@user.name}&lt;/b&gt;&quot;, :font_size =&gt; 16, :justification =&gt; :left
    send_data pdf.render, :disposition =&gt; 'inline', :filename =&gt; &quot;user_details.pdf&quot;, :type =&gt; &quot;application/pdf&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>New release of the Ruby Accessibility Analysis Kit and online interface</title>
		<link>http://www.peterkrantz.com/2007/raakt-052/</link>
		<comments>http://www.peterkrantz.com/2007/raakt-052/#comments</comments>
		<pubDate>Sun, 01 Apr 2007 20:37:43 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/raakt-052/</guid>
		<description><![CDATA[The current version has some minor bug fixes that will speed up testing. The online test interface ...]]></description>
			<content:encoded><![CDATA[<p>The current version has some minor bug fixes that will speed up testing. The <a href="http://www.peterkrantz.com/bacc/">online test interface</a> has been updated to support direct input of markup. This is for those of you unable to install Raakt locally.</p>
<p>This means that there is no reason to skip basic accessibility testing of whatever you are developing! To find out more on how you can integrate Raakt in your testing framework check out the <a href="http://www.peterkrantz.com/raakt/wiki/">Raakt wiki</a> which now has a lot more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/raakt-052/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Putting Camping in the Camping logo</title>
		<link>http://www.peterkrantz.com/2007/camping-steganography/</link>
		<comments>http://www.peterkrantz.com/2007/camping-steganography/#comments</comments>
		<pubDate>Sun, 11 Mar 2007 13:53:48 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/camping-steganography/</guid>
		<description><![CDATA[<img src='http://www.peterkrantz.com/wp-content/uploads/2007/03/camping-in-camping.png' alt='The camping framework embedded in the campin logo' class="illustration"/>Having played with the <a href="http://diit.sourceforge.net/">Digital Invisible Ink Toolkit (DIIT)</a> lately it was interesting to see how big the logo file for the <a href="https://code.whytheluckystiff.net/camping">camping framework</a> would become if the camping framework itself was embedded in it...]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.peterkrantz.com/wp-content/uploads/2007/03/camping-in-camping.png' alt='The camping framework embedded in the campin logo' class="illustration"/>Having played with the <a href="http://diit.sourceforge.net/">Digital Invisible Ink Toolkit (DIIT)</a> lately it was interesting to see how big the logo file for the <a href="https://code.whytheluckystiff.net/camping">camping framework</a> would become if the camping framework itself was embedded in it. The original logo file (stolen from Why&#8217;s site) is a 73 Kb PNG file. Embedding <a href="https://code.whytheluckystiff.net/camping/browser/trunk/lib/camping.rb">camping.rb</a> in it creates a 101 Kb file visible to the right.<br />
<span id="more-72"></span><br />
Maybe this is the future of software distribution? Programmers and photographers can work together to distribute software and pretty pics? Is the porn industry in on this? What type of image would it take to distribute Oracle 9? Remember where you heard it first&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/camping-steganography/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A new version of the Ruby Accessibility Analysis Kit</title>
		<link>http://www.peterkrantz.com/2007/raakt-in-watir/</link>
		<comments>http://www.peterkrantz.com/2007/raakt-in-watir/#comments</comments>
		<pubDate>Sat, 03 Mar 2007 16:58:22 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/raakt-in-watir/</guid>
		<description><![CDATA[This is to announce that RAAKT (The Ruby Accessibility Analysis Kit) has been updated. This release includes ...]]></description>
			<content:encoded><![CDATA[<p>This is to announce that <a href="http://rubyforge.org/projects/raakt">RAAKT (The Ruby Accessibility Analysis Kit)</a> has been updated. This release includes more accessibility tests and an initial mapping of tests to the <a href="http://www.wabcluster.org/uwem/tests/">Unified Web Evaluation Methodology</a> (UWEM). Also, thanks to Derek Perrault RAAKT now uses <a href="http://code.whytheluckystiff.net/hpricot/">Hpricot</a> to parse the HTML document. This solves the problem where the previous parser (RubyfulSoup) declared a class &#8220;Tag&#8221; that was likely to clash with your local classes in Rails.</p>
<p>To install the new version simply type <kbd>gem update raakt</kbd> or <kbd>gem install raakt</kbd> if you have a previous version installed.</p>
<h2>Changelog</h2>
<p>Summary of changes from version 0.4 to version 0.5.1.</p>
<ul>
<li>Example of how to use RAAKT in <a href="http://wtr.rubyforge.org/">Watir unit tests</a>.</li>
<li>Tests for area element alt attribute.</li>
<li><a href="http://www.wabcluster.org/uwem/tests/">UWEM</a> mapped in comments for relevant test methods.</li>
<li>Test to check that input fields of type image have an alt attribute with text.</li>
<li>Refactoring of some methods for more compact syntax. Patch by Derek Perrault.</li>
<li>Added test to verify that fieldsets have legends.</li>
<li>Fixed alt_to_text that needed to check element type before attempting to read attribute value.</li>
<li>Fixed language attribute check (downcased value). Added iso language code list.</li>
<li>Applied patch from Derek Perrault (better use of Hpricot features).</li>
<li>Fixed check for lang attribute (now requires a value as well). </li>
<li>Test for charset mismatch in http headers and document meta element.</li>
<li>Switch to Hpricot. Patch by Derek Perrault.</li>
</ul>
<p>An article on the value of, and how to integrate basic accessibility tests in your development process is in the works for <a href="http://www.standards-schmandards.com/">standards-schmandards.com</a>. In the meantime check out the <a href="http://www.peterkrantz.com/raakt/wiki/">Raakt wiki</a>.</p>
<p>If you are using Watir it is very simple:</p>
<p>require &#8216;watir&#8217;<br />
require &#8216;raakt&#8217;<br />
require &#8216;test/unit&#8217;</p>
<p>class TC_myTest < Test::Unit::TestCase<br />
	attr_accessor :ie</p>
<p>	def setup<br />
		@ie = Watir::IE.start(&#8220;http://www.peterkrantz.com&#8221;)<br />
	end</p>
<p>	def test_startPagePassesBasicAccessibilityCheck<br />
		#set up the accessibility test and pass html to raakt<br />
		raakttest = Raakt::Test.new(@ie.document.body.parentelement.outerhtml)</p>
<p>		#run all tests on the current page<br />
		result = raakttest.all</p>
<p>		#make sure raakt didn&#8217;t return any error messages<br />
		assert(result.length == 0, result)<br />
	end<br />
end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/raakt-in-watir/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Parsing ASP.NET sites with WWW::Mechanize and Hpricot</title>
		<link>http://www.peterkrantz.com/2007/mechanize-on-aspnet/</link>
		<comments>http://www.peterkrantz.com/2007/mechanize-on-aspnet/#comments</comments>
		<pubDate>Sun, 18 Feb 2007 20:16:07 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/mechanize-on-aspnet/</guid>
		<description><![CDATA[Users of Hpricot (which WWW::Mechanize is using as the default html parser) may have discovered that the ...]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.peterkrantz.com/wp-content/uploads/2007/02/mechanize-hpricot-trsp.gif' alt='' class='right'/>Users of <a href="http://code.whytheluckystiff.net/hpricot/">Hpricot</a> (which <a href="http://mechanize.rubyforge.org/">WWW::Mechanize</a> is using as the default html parser) may have discovered that the buffer size for attribute values is set to 16384 bytes default. Typically this isn&#8217;t a problem, I mean who would put 16Kb of data into an HTML attribute? Well, ASP.NET uses a hidden input field to store view state in order to save a few clock cycles on the server side (and spare developers the hazzle of coding view state). </p>
<p>Typically, developers tend to forget to turn off view state resulting in a lot of data that never is used. The guy who made the decision to have this default view state behaviour has probably caused a lot of unnecessary bytes clogging your internet connection (as it typically is included in each request).</p>
<p>If you are using mechanize and/or Hpricot to parse such a site you may have come across this error:</p>
<p><samp>ran out of buffer space on element &lt;input&gt;, starting on line 38. (Hpricot::ParseError)</samp></p>
<p>If you want to try it out, load <a href='http://www.peterkrantz.com/wp-content/uploads/2007/02/viewstatesample.htm'>this sample viewstate file</a> into Hpricot. The <a href='http://code.whytheluckystiff.net/hpricot/ticket/13'>buffer space error</a> has been reported in the Hpricot issue tracker.</p>
<p>Fortunately, from version 0.5 of Hpricot it is easy to increase the buffer size before loading data. This is done by setting the buffer_size attribute to a sufficiently large number:</p>
<p>require &#8216;hpricot&#8217;<br />
Hpricot.buffer_size = 262144</p>
<h2>Fixing Mechanize</h2>
<p>As mechanize uses Hpricot as the default parser this error will happen when loading many ASP.NET pages. Fortunately, mechanize allows the user to specify a custom parser class through the <a href='http://mechanize.rubyforge.org/classes/WWW/Mechanize/PluggableParser.html'>pluggable_parser </a> attribute. To make mechanize use Hpricot with a larger buffer size:</p>
<p>require &#8216;hpricot&#8217;<br />
require &#8216;mechanize&#8217;</p>
<p>Hpricot.buffer_size = 262144<br />
agent = WWW::Mechanize.new<br />
agent.pluggable_parser.default = Hpricot<br />
agent.get(&#8216;http://www.peterkrantz.com/wp-content/uploads/2007/02/viewstatesample.htm&#8217;)</p>
<p>&#8230;and we&#8217;re back on track mechanizing the world again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/mechanize-on-aspnet/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Hpricot &#8211; My New Favourite Ruby XML Parser</title>
		<link>http://www.peterkrantz.com/2007/ruby-xml-parsing/</link>
		<comments>http://www.peterkrantz.com/2007/ruby-xml-parsing/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 11:38:30 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/ruby-xml-parsing/</guid>
		<description><![CDATA[<img src='http://www.peterkrantz.com/wp-content/uploads/2007/02/hpricot.gif' alt=''  class="right"/>Maybe I am the last person to discover this, but Hpricot is great for parsing XML documents on multiple platforms. It isn't a real XML parser, but it is great for quick extraction of data from XML files.]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.peterkrantz.com/wp-content/uploads/2007/02/hpricot-giraffe.jpg' alt=''  class="right"/>One of the missing features in the default Ruby distribution is the lack of a good XML parser. The included REXML is only sufficient for the most basic scenarios as performance degrades quickly with XML size. </p>
<p>Recently I had a situation where I needed to parse a 700 Kb XML file and extract some values with XPath queries. Doing this in REXML proved to be too slow (around 30 seconds). Since I was on OS X it was a small task to get the <a href="http://libxml.rubyforge.org/">Ruby libxml bindings</a>. The speed increase was immense and everything worked smoothly.</p>
<p>As usual, requirements change and the application needed to be able to run on Windows and OS X. Unfortunately the Ruby libxml api does not work in Windows. Looking around, I couldn&#8217;t find a decent XML parser for Ruby that worked on both platforms and I didn&#8217;t want to code for both REXML and libxml.</p>
<p>Enter <a href="http://code.whytheluckystiff.net/hpricot/">Hpricot</a>. Originally written to do HTML scraping it is actually very capable of working with XML too. And it has binaries for Windows, Linux and OS X.</p>
<p>A quick example shows how easy it is to load and get data from an XML file:</p>
<p>require &#8216;hpricot&#8217;<br />
doc = Hpricot(open(&#8220;lazaridis_msgs.xml&#8221;))</p>
<p>doc.search(&#8220;//message&#8221;).each do |message|<br />
	e_number = message.attributes["subject"][16..17]<br />
	puts &#8220;Evaluation identifier is #{e_number}&#8221;<br />
end</p>
<p>Technically, Hpricot isn&#8217;t an XML-parser. It doesn&#8217;t validate the document which means that malformed XML can slip through. You will have to be careful if your application relies on wellformedness of the XML data.</p>
<p>I will be switching the <a href="http://www.standards-schmandards.com/projects/raakt/">Ruby Accessibility Analysis Kit</a> over to Hpricot soon. It will be a nice speed increase for your Rails unit tests using RAAKT. This will also solve the problem in RubyfulSoup where the author <a href="http://www.martinicity.net/articles/2006/07/25/the-ruby-accessibility-analysis-kit">declared a &#8220;Tag&#8221; class with a bad scope</a>.</p>
<p>So, maybe I am the last person on earth to discover this, but if you need a great library for XML parsing on multiple platforms, check out <a href="http://code.whytheluckystiff.net/hpricot/">Hpricot</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/ruby-xml-parsing/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using the Apple remote in Ruby</title>
		<link>http://www.peterkrantz.com/2007/apple-remote-in-ruby/</link>
		<comments>http://www.peterkrantz.com/2007/apple-remote-in-ruby/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 14:06:34 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/apple-remote-in-ruby/</guid>
		<description><![CDATA[<img id="image53" src="http://www.peterkrantz.com/wp-content/uploads/2007/02/apple-remote1.gif" alt="Apple infrared remote control" class="right"/>After playing with iremoted (an infrared remote daemon for OS X) and Ruby's IO.popen I guess I am convinced that Ruby really works as a glue on many levels. Here is a minimal dungeon game which you control with the apple remote. If you ever manage to find your way out I would be surprised…]]></description>
			<content:encoded><![CDATA[<p><img id="image53" src="http://www.peterkrantz.com/wp-content/uploads/2007/02/apple-remote1.gif" alt="Apple infrared remote control" class="right"/>After playing with <a href="http://www.osxbook.com/software/iremoted/">iremoted</a> and <a href="http://www.rubycentral.com/book/ref_c_io.html#IO.popen">Ruby&#8217;s IO.popen</a> I guess I am convinced that Ruby really <a href="http://www.linuxjournal.com/article/8969">works as a glue</a> on many levels. </p>
<p>So, using iremoted and capture Apple remote commands in the terminal it is trivial to use the remote to control a Ruby application. Of course, calling OS commands isn&#8217;t limited to Ruby.</p>
<p>Here is a minimal dungeon game which you control with the apple remote. If you ever manage to find your way out I would be surprised&#8230;</p>
<p>IO.popen (&#8220;/Applications/iremoted&#8221;) { |f|</p>
<p>   x = y = 0</p>
<p>   puts &#8220;You are standing in an open field west of a white house, with a boarded front door&#8230;&#8221;</p>
<p>   while (line = f.gets.chomp)<br />
      if line == &#8220;Plus released&#8221;<br />
         y += 1<br />
      end</p>
<p>      if line == &#8220;Minus released&#8221;<br />
         y -= 1<br />
      end</p>
<p>      if line == &#8220;Previous released&#8221;<br />
         x -= 1<br />
      end</p>
<p>      if line == &#8220;Next released&#8221;<br />
         x += 1<br />
      end</p>
<p>      puts &#8220;You are at coordinate #{x}, #{y}.&#8221;<br />
   end<br />
}</p>
<p>Who will be first to create a terminal based media center application using Ruby? With some more glue from <a href="http://rubyosa.rubyforge.org/">RubyOSA (the Ruby/AppleEvent Bridge)</a> it should&#8217;t be that hard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/apple-remote-in-ruby/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Making open-uri play nice with HTTPS and expired certificates</title>
		<link>http://www.peterkrantz.com/2007/open-uri-cert-verification/</link>
		<comments>http://www.peterkrantz.com/2007/open-uri-cert-verification/#comments</comments>
		<pubDate>Sat, 27 Jan 2007 21:21:27 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/open-uri-cert-verification/</guid>
		<description><![CDATA[I was using the open-uri library to download HTML in an accessibility test when I found that ...]]></description>
			<content:encoded><![CDATA[<p>I was using the open-uri library to download HTML in an accessibility test when I found that it does not work well when the remote site has an expired certificate. In this case open-uri will  throw a &#8220;certificate expired&#8221; exception. This may be ok as a default behaviour, but there is no option to override the check.</p>
<p>Fortunately you can easily change the behaviour by editing the open-uri source. If you are on Windows  it is available in C:\ruby\lib\ruby\1.8\open-uri.rb depending on your installation directory of course.</p>
<p>Somewhere around line 232 (in the version distributed in Ruby 1.8.5) you can see the certificate verification mode used:</p>
<p>http.verify_mode = OpenSSL::SSL::VERIFY_PEER</p>
<p>To skip certificate verification you can change VERIFY_PEER to VERIFY_NONE. The complete section should read:</p>
<p>if target.class == URI::HTTPS<br />
   require &#8216;net/https&#8217;<br />
   http.use_ssl = true<br />
   http.verify_mode = OpenSSL::SSL::VERIFY_NONE<br />
   store = OpenSSL::X509::Store.new<br />
   store.set_default_paths<br />
   http.cert_store = store<br />
end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/open-uri-cert-verification/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Code Search Reveals Anger, Frustration and Hate</title>
		<link>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/</link>
		<comments>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/#comments</comments>
		<pubDate>Wed, 11 Oct 2006 08:09:30 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/</guid>
		<description><![CDATA[Google&#8217;s Code search is a great way to spend an evening. Indexing a hefty amount of source ...]]></description>
			<content:encoded><![CDATA[<p>Google&#8217;s Code search is a great way to spend an evening. Indexing a hefty amount of source code reveals anger, frustration and hate. Some favourites:</p>
<ul>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+java">I hate Java</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22Java+sucks">Java sucks</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22python+sucks%22&#038;btnG=Search">Python sucks</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+microsoft">I hate Microsoft<br />
</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+DTD">I hate DTDs</a> (that is REXML by the way&#8230;)</li>
</ul>
<p>Interestingly, searching for &#8220;<a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22ruby+sucks%22&#038;btnG=Search">Ruby sucks</a>&#8221; does not return any matching documents&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing Google&#8217;s Accessible Search with the Ruby Accessibility Analysis Kit</title>
		<link>http://www.peterkrantz.com/2006/google-accessible-search/</link>
		<comments>http://www.peterkrantz.com/2006/google-accessible-search/#comments</comments>
		<pubDate>Fri, 21 Jul 2006 16:37:35 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/google-accessible-search/</guid>
		<description><![CDATA[Recently Google Labs released Google Accessible Search &#8211; Accessible Web Search for the Visually Challenged. Running the ...]]></description>
			<content:encoded><![CDATA[<p>Recently Google Labs released <a href="http://labs.google.com/accessible/">Google Accessible Search &#8211; Accessible Web Search for the Visually Challenged</a>. Running the search page (http://labs.google.com/accessible/) through <a href="http://peterkrantz.com/bacc/">RAAKT (using the online version)</a> yields three errors and the search result page is using tables for layout.  Maybe I am missing something here, but how hard can it be for Google to make sure their search page is using best practices and avoid basic accessibility pitfalls?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/google-accessible-search/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Languages Influence Your Thought Process</title>
		<link>http://www.peterkrantz.com/2006/language-thought-influence/</link>
		<comments>http://www.peterkrantz.com/2006/language-thought-influence/#comments</comments>
		<pubDate>Thu, 20 Jul 2006 10:15:55 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/language-thought-influence/</guid>
		<description><![CDATA[When I studied social antropology a couple of years ago I never thought that it would influence ...]]></description>
			<content:encoded><![CDATA[<p>When I studied social antropology a couple of years ago I never thought that it would influence my future programming endeavours. At that time we looked at theories on how things in our surroundings influence thought processes. One theory is called the <a href="http://en.wikipedia.org/wiki/Sapir-Whorf_hypothesis">Sapir-Whorf hypothesis</a>. It states:</p>
<blockquote><p>&#8220;&#8230;there is a systematic relationship between the grammatical categories of the language a person speaks and how that person both understands the world and behaves in it.&#8221;</p></blockquote>
<p>Recently I have found more information on how other people feel programming languages influence how they think (e.g. <a href="http://www.paulgraham.com/">Paul Graham</a>, <a href="http://cfis.savagexi.com/articles/2006/07/20/languages-that-get-out-of-your-way">Charlie Savage</a>). Maybe this can put an end to the Ruby vs Python debate? Some people will feel that Ruby relates more to their thought process than Python does. And some will feel that Python is superior.</p>
<p>If you like me believe that programming languages influence your thought process the advice in <a href="http://www.pragmaticprogrammer.com/loty/">The Pragmatic Programmer: From Journeyman to Master</a> is very relevant:</p>
<blockquote><p>&#8220;Learn at least one new [programming] language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut.&#8221;</p></blockquote>
<p><a href="http://www.infoq.com/news/2008/05/should-you-learn-languages">Others may disagree</a>.</p>
<p>So, what is your next language?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/language-thought-influence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated accessibility tests in Ruby on Rails</title>
		<link>http://www.peterkrantz.com/2006/accessibility-in-rails-with-raakt/</link>
		<comments>http://www.peterkrantz.com/2006/accessibility-in-rails-with-raakt/#comments</comments>
		<pubDate>Fri, 14 Jul 2006 09:42:47 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/accessibility-in-rails-with-raakt/</guid>
		<description><![CDATA[A couple of days ago I released RAAKT &#8211; The Ruby Accessibility Analysis Kit gem (I know, ...]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I released <a href="http://rubyforge.org/projects/raakt">RAAKT &#8211; The Ruby Accessibility Analysis Kit gem</a> (I know, it really needs a better name). RAAKT is a gem that can be used independently of Rails and my plan was to make a Rails plugin that would add a custom assert method that did the check. It turns out that it only takes five lines of code so there is no need for a plugin. So let&#8217;s see how you can integrate accessibility checks into your current Rails application.</p>
<h2>Install the RAAKT gem</h2>
<p>This is a simple step. If you have installed rubygems all you need to do is <kbd>gem install raakt</kbd>. This will install the latest version of RAAKT (currently 0.3).</p>
<h2>Add the custom assertion</h2>
<p>Open the file test_helper.rb in the test folder in your Rails application. Add the following method to the class Test::Unit::TestCase:</p>
<p>def assert_basic_accessibility<br />
  rt = Raakt::Test.new(@response.body)<br />
  result = rt.all<br />
  assert result.length == 0, result.collect { |msg| &#8220;n&#8221; + msg.text + &#8220;n&#8221; }<br />
end</p>
<p>Make sure the raakt module is required by adding &#8220;require &#8216;raakt&#8217;&#8221; in the top of the file. No we can use assert_basic_accessibility in our functional tests (where view output is available).</p>
<h2>Test your views</h2>
<p>By adding assert_basic_accessibility to all functional tests that render a complete HTML document you can make sure you don&#8217;t create any of the fundamental accessibility errors that plague many applications.</p>
<p>Currently the RAAKT module will do the following tests on your markup:</p>
<ol>
<li><strong>check_document_structure</strong>: Verify that headings are correctly structured (h1 -> h2 etc)</li>
<li><strong>check_tables</strong>: Verify that all tables have headers (th elements).</li>
<li><strong>check_for_formatting_elements</strong>: Make sure no font, b, i, blink or marquee elements have been used.</li>
<li><strong>check_has_heading</strong>: Verify that the document has at least one h1 heading.</li>
<li><strong>check_form</strong>: Verifies that all form input fields (except hidden fields) have a corresponding label element.</li>
<li><strong>check_link_text</strong>: Verifies that all link elements are unambiguous (two links with different targets should not have the same link text. Yes, that means all your &#8220;Edit&#8221; links). Use the title attribute to separate links.</li>
<li><strong>check_title</strong>: Verify that a non-empty title element is available.</li>
<li><strong>check_frames</strong>: If frames are used, verify that each frame has a descriptive title attribute.</li>
<li><strong>check_images</strong>: Verify that all images have an alt attribute.</li>
<li><strong>check_refresh</strong>: Make sure that no client-side meta refresh is present.</li>
<li><strong>check_for_nested_tables</strong>: Verify that no nested tables are present.</li>
<li><strong>check_for_language_info</strong>: Make sure the html element has a lang attribute indicating what language your document is in.</li>
</ol>
<p>Sometime soon I will create documentation on each of the errors that you may recieve and what you can do to correct them. Suggestions and feedback are always welcome on the <a href="http://rubyforge.org/tracker/?group_id=1861">RAAKT project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/accessibility-in-rails-with-raakt/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Porting the Python Accessibility Analysis Kit to Ruby</title>
		<link>http://www.peterkrantz.com/2006/ruby-accessibility-analysis-kit/</link>
		<comments>http://www.peterkrantz.com/2006/ruby-accessibility-analysis-kit/#comments</comments>
		<pubDate>Thu, 29 Jun 2006 13:53:46 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/ruby-accessibility-analysis-kit/</guid>
		<description><![CDATA[At RailsConf in Chicago I realized that it would be a good idea to port PAAKT to ...]]></description>
			<content:encoded><![CDATA[<p>At RailsConf in Chicago I realized that it would be a good idea to port <a title="Python Accessibility Analysis Kit" href="/projects/paakt">PAAKT</a> to Ruby and make sure it can be used for automatic accessibility tests in the Rails testing framework. Work has begun and I hope to release it at the end of this summer if all goes well. The project is registered at Rubyforge. Now, all I need is a good name. Maybe RAAKT? Suggestions are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/ruby-accessibility-analysis-kit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Exporting Exchange calendars to Apple iCal over HTTP and WebDAV</title>
		<link>http://www.peterkrantz.com/2006/exchange-to-ical-http/</link>
		<comments>http://www.peterkrantz.com/2006/exchange-to-ical-http/#comments</comments>
		<pubDate>Sat, 29 Apr 2006 08:26:00 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/exchange-to-ical-http/</guid>
		<description><![CDATA[Having recently recieved a brand new MacBook Pro from my employer I needed to get basic things such as mail and calendaring working. We use Microsoft Exchange 2003 which is great if everyone is using Outlook. Since I work with various clients I am subjected to their respective firewall policy which typically only allows HTTP(S) traffic. This leaves us with Outlook Web Access (dumbed down interface for everyting but IE). We need a module to read Exchange and export appointments to iCal...]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> This code has been integrated and greatly enhanced in the <a href="http://rubyforge.org/projects/rexchange/">rexchange project</a> by Sam Smoot. <strong>Update 2</strong>: iCal in Lion supports Exchange and none of this should be required anymore.</p>
<p>Having recently recieved a brand new MacBook Pro from my employer I needed to get basic things such as mail and calendaring working. We use Microsoft Exchange 2003 which is great if everyone is using Outlook. Since I work with various clients I am subjected to their respective firewall policy which typically only allows HTTP(S) traffic. This leaves us with Outlook Web Access (dumbed down interface for everyting but IE). Reading e-mail works fine in OWA. However, the calendar becomes useless as reminders won&#8217;t appear.</p>
<p>Unfortunately, Apple&#8217;s iCal doesn&#8217;t work with Exchange. iCal does, however, store data in the <a href="http://www.ietf.org/rfc/rfc2445.txt">standard icalendar format</a>. Having som experience working with WebDAV access to Exchange (which is available if you can reach OWA) I decided to write an Exchange API in Ruby to read calendar items and convert these to the icalendar format. So, I was about half-way through when I discovered that <a href="http://rubyforge.org/projects/rexchange/">Sam Smoot had created RExchange</a>. That gave me most of the API:s required for connecting to Exchange.</p>
<p>RExchange did not contain a class for working with appointments (only mail and contacts), so I had to add that. Also, RExchange uses the Time::parse method to convert strings to time representation which doesn&#8217;t work for dates after 2037.</p>
<p>Anyway, to export your Exchange calendar to iCal through WebDAV, <a href="/rexc/rexc.zip">download the rexport script</a>, unpack the files and modify the rexchange.rb file with your login credentials and OWA URL. Execute rexchange.rb from the terminal. It will create an iCal storage file corestorage.ics in the same directory. This can be opened directly in iCal.</p>
<p>Future options may include a synchronization mode. Suggestions and patches are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/exchange-to-ical-http/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.peterkrantz.com @ 2012-02-04 11:14:50 -->
