Author:

Aaron PattersonMy name is Aaron Patterson.

mechanize version 0.7.0 has been released!

Posted by – January 15, 2008

The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends cookies, follows redirects,
can follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have visited as
a history.

Changes:

# Mechanize CHANGELOG

## 0.7.0

* Removed Ruby 1.8.2 support
* Changed parser to lazily parse links
* Lazily parsing document
* Adding verify_callback for SSL requests. Thanks Mike Dalessio!
* Fixed a bug with Accept-Language header. Thanks Bill Siggelkow.

*

Happy New Year! (RKelly Progress report)

Posted by – January 3, 2008

I’ve just started getting the runtime working with RKelly. Its working well enough at this point that I was able to execute my earlier Fibonacci example. I’ve added a method to the runtime that allows you to define ruby functions that may be called from inside javascript. For example, the alert function in the following example is defined in ruby and delegates to puts.

runtime = RKelly::Runtime.new

runtime.define_function(:alert) do |*args|
  puts(*args)
end

runtime.execute(<<END
function f(n) {
  var s = 0;
  if(n == 0) return(s);
  if(n == 1) {
    s += 1;
    return(s);
  } else {
    return(f(n - 1) + f(n - 2));
  }
}
alert(f(20));
END
)

Here is the execution time with ruby 1.8.6 on my machine:

[aaron@mac-mini rkelly]$ time ~/.multiruby/install/1.8.6-p111/bin/ruby -I lib test.rb
6765

real 0m54.332s
user 0m53.913s
sys 0m0.336s
[aaron@mac-mini rkelly]$
[/sourcecode]

Same code, same machine, but with ruby 1.9.0:


[aaron@mac-mini rkelly]$ time ~/.multiruby/install/1.9.0-0/bin/ruby -I lib test.rb
6765

real 0m20.863s
user 0m20.678s
sys 0m0.142s
[aaron@mac-mini rkelly]$
[/sourcecode]

I need to get loops working next!

Parsing Javascript Parser

Posted by – December 24, 2007

I’ve been working hard on RKelly lately. RKelly is a ruby implementation of Kelly. Kelly is a fictional project that I made up so that I could name my project RKelly. Anyway, RKelly is a javascript parser, and will be an interpreter someday. Today I was able to get RKelly to parse and produce a parse tree of prototype.js. I couldn’t get GraphViz to export the file, but you can download the dot file here.

Here is a parse tree of a function that calculates the fibonacci sequence:
fibonacci parse tree

Here is the javascript code:

function f(n) {
  var s = 0;
  if(n == 0) return(s);
  if(n == 1) {
    s += 1;
    return(s);
  } else {
    return(f(n - 1) + f(n - 2));
  }
}

And the ruby code that produced that graph:

require 'rkelly'

parser = RKelly::Parser.new
puts parser.parse(File.read(ARGV[0])).to_dots

I need a new computer….. It took 2 minutes to render the prototype graph! Ugh!

Road to Mechanize 0.7.0

Posted by – December 9, 2007

I’ve been refactoring Mechanize for an 0.7.0 release. Basically I’m trying to clean the code up and there are a few features that I think are unnecessary, but I would like to ask people first.

  1. REXML as a parser.
  2. I want to remove support for REXML. I don’t use it. Hpricot seems to do everything I need.

  3. 1.8.2 thru 1.8.4 support
  4. I’ve got a bunch of monkey patches for 1.8.2 thru 1.8.4. I’d like to remove these because I think most people are on 1.8.5 or up.

  5. WWW::Mechanize::Page#watch_for_set
  6. I am going to remove this method. It made sense when REXML was the main parser, since REXML was so slow. I think that Hpricot is fast enough that this method is not so useful.

I’m going to make 0.7.0 lazily build up form and link objects, which should give everyone a slight speed increase but makes watch_for_set obsolete (sort of).

I’m changing around the class names to be better organized, but they should all have the same methods. Also, if there are any feature requests, let me know!

Birthdays, and Congrats

Posted by – December 7, 2007

I need to post something because it seems like I’m only posting release announcements to my blog……

Today is my sister’s birthday, so I woke her up at 8 this morning to wish her a happy birthday. I wanted to make sure that I was the first person to congratulate her on her special day. Is it OK to say “congratulations” for a birthday? I know Pam doesn’t like to throw around that word without some sort of accomplishment occurring. For example, getting engaged. Should you really congratulate someone on getting engaged since they just made a decision? They didn’t really overcome any obstacles or adversity, they just decided to get married. Anyway, I think that surviving another year is worth congratulating someone.

We will be rollerskating for my birthday, and Pam sent out an evite with this image:

今週日本語のクラスで私とパムさんは「何々つもりだ」と「何々なる」を習いました。私は「パムは茸が好きになる」と言っていました。でも、パムさんは意地悪になりました。Oh well.

csspool version 0.2.4 has been released!

Posted by – December 6, 2007

CSSpool (pronounced “cesspool”) is a validating SAC parser for CSS. The parser
calls methods on a document handler depending on what it has found. CSSPool
currently only supports CSS 2.1. CSSPool will not yield invalid properties or
selectors.

Changes:

## 0.2.4

* Fixed error handling on at rules. Thanks Dan for tests!
* Made specificity an array
* Made StyleSheet::Rule comparable on specificity

*

csspool version 0.2.3 has been released!

Posted by – December 5, 2007

CSSpool (pronounced “cesspool”) is a validating SAC parser for CSS. The parser
calls methods on a document handler depending on what it has found. CSSPool
currently only supports CSS 2.1. CSSPool will not yield invalid properties or
selectors.

Changes:

## 0.2.3

* Fixed a bug where nil selectors on conditional selectors were being visited.

*

csspool version 0.2.2 has been released!

Posted by – December 4, 2007

CSSpool (pronounced “cesspool”) is a validating SAC parser for CSS. The parser
calls methods on a document handler depending on what it has found. CSSPool
currently only supports CSS 2.1. CSSPool will not yield invalid properties or
selectors.

Changes:

## 0.2.2

* I suck.

*

mechanize version 0.6.11 has been released!

Posted by – December 4, 2007

The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends cookies, follows redirects,
can follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have visited as
a history.

Changes:

# Mechanize CHANGELOG

## 0.6.11

* Detecting single quotes in meta redirects.
* Adding pretty inspect for ruby versions > 1.8.4 (Thanks Joel Kociolek)

http://rubyforge.org/tracker/index.php?func=detail&aid=13150&group_id=1453&atid=5709

* Fixed bug with file name in multipart posts

http://rubyforge.org/tracker/?func=detail&aid=15594&group_id=1453&atid=5709

* Posting forms relative to the originating page. Thanks Mortee.
* Added a FAQ

http://rubyforge.org/tracker/?func=detail&aid=15772&group_id=1453&atid=5709

*

Nerd Meeting

Posted by – December 3, 2007

I was put in charge of nerd meeting this week.

So, I made a special terminal theme for this week. You can get it here.