Friday, 05 Feb 2010
Rails 3.0 Beta
David Heinemeier Hansson: You thought we were never going to get to this day, didn’t you? Ye of little faith. Because here is the first real, public release of Rails 3.0 in the form of a beta package that we’ve toiled long and hard over. It’s surely not perfect yet, but we were out of blockers on the list, so here we go. Please give it a run around the block, try to update some old applications, try to start some new ones, and report back all the issues you find.
For those who have purchased (or who have yet to purchase) Agile Web Development with Rails, Edition 3, I’ve begun a page which details the differences that affect what is described in the book.
David Heinemeier Hansson: You thought we were never going to get to this day, didn’t you? Ye of little faith. Because here is the first real, public release of Rails 3.0 in the form of a beta package that we’ve toiled long and hard over. It’s surely not perfect yet, but we were out of blockers on the list, so here we go. Please give it a run around the block, try to update some old applications, try to start some new ones, and report back all the issues you find.
For those who have purchased (or who have yet to purchase) Agile Web Development with Rails, Edition 3, I’ve begun a page which details the differences that affect what is described in the book. Edition 3 was based on Rails 2.2.2, and this page is cumulative. My perception is that the differences that affect applications is way less than the differences between Rails 1 and Rails 2, and frankly not much more than the differences between Rails 2.2 and Rails 2.3.
Work on Edition 4 is well underway, and now that Rails has shipped a beta, I’ll may be able to get a beta of the book out by the end of the month. It will not only be based on Rails 3.0, but will also be focused on current best practices and new APIs.
Things I am tracking at this point: a RubyInstaller for Windows that supports a version of Ruby that Rails can run on, a version of the will_paginate gem that works on Rails 3.0 which was just made available last night and I will be testing with it today, a regression in the (yet to be released) Ruby 1.8.8 that will affect both Builder and Rails, and some inconsistencies in how I18n YAML files are treated with respect to html_safe.
Monday, 01 Feb 2010
Rails 3.0 on Cygwin
Rails 3.0 requires 1.8.7 or later. Both InstantRails and the (current, released) version of RubyInstaller bundle Ruby 1.8.6. The files on the Ruby site seem to be a scavenger hunt. While the next release of RubyInstaller will address this, we can run today with Cygwin.
On the right of the Cygwin page you will find a link to “Install Cygwin now”. The UI for the installation is a little unusual, the basic process is documented here.
When you get to step 15 (yes, step 15), you will want to select the following:
- ruby
- sqlite3
- libsqlite3-devel
- wget
- make
- gcc
- git
- curl
Hint: I find it is easiest to first click on view (top right) to get a alphabetical list of all packages, then use the search box (top left) to filter the list, and then select the individual packages.
Cygwin itself provides a minimal shell window. You can use the Console program to give you a nicer window. This program doesn’t have a proper installer, instead you simply unzip the file you downloaded. In the directory that produced, create a shortcut to the Console executable (right click on Console, select “Create shortcut”) and then drag that shortcut out to some place where you can find it later (e.g., desktop or quick launch toolbar). Launch a Console window using this shortcut to see a Windows command prompt. Select Edit -> Settings, and set the shell to C:\cygwin\bin\bash -l. Select OK, then exit and relaunch the console and you now have a bash prompt.
Notepad++ is a free editor that understands Unix conventions. Select and run the installer from here. Launch Notepad++, and from there navigate to your bash configuration file:
File → Open → Computer → c: → cygwin → home → yourname → .bashrc
Insert the following at the bottom:
alias edit='cygstart "/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe"'
You might need to adjust this path slightly. On Windows XP, for example, I don’t seem to have the “ (x86)” part. Once complete, save the file. Now close any open Console windows and launch a new one. Inside that console, execute the following commands:
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz tar xzf rubygems-1.3.5.tgz cd rubygems-1.3.5 ruby setup cd .. gem install sqlite3-ruby
Now you can install rails normally (gem install rails), or checkout the latest using git. You can now edit files (e.g., config/database.yml) using the alias you set up:
edit config/database.yml
Results following the scenario described in AWDwR3 closely match results on Ubuntu.
Sunday, 31 Jan 2010
FireBug + Ubuntu + AMD64
Tools => AddOns => Extensions => Firebug 1.5.0 => Uninstall => Uninstall => Restart Firefox
sudo apt-get install firebug
Restart Firefox
Fixes bug 449744.
Friday, 29 Jan 2010
Evolution of Tinkering
Jim Stogdill: The automobile went through a similar evolution. From eminently hackable to hood essentially sealed shut. When the automobile was new, you HAD to be a mechanic to own one. Later, being a mechanic gave you the option of tinkering and adapting it to your specific interests. In fact, that’s how most people up until about 1985 learned to be mechanics.
- How many people out here have changed an alternator? (I have, twice) Replaced spark plugs (ditto, several times) or spark plug wires? (once). Not to mention batteries and other parts. As a teenager in the 70’s, this was not unusual. See this picture. Look familiar to anyone?
- My daughter works part time at Best Buy. Some of her co-workers were amazed that I had wiped the virus off of my wife’s computer. They charge big bucks for this service.
- Tinkering skills will always be in demand. I, for one, and pleased to see that hacking skill have progressed from here to here.
Thursday, 28 Jan 2010
Secretary Workflow
The next step of automating the workflow of the Apache Software Foundation secretarial task went operational today. The current flow now looks like this:
- Person prints and signs a document
- Said document is scanned, photographed, faxed, or sent via postal mail to the ASF. In all but the latter case, this results in an email to both myself and to Craig Russell. In the case of postal mail, it eventually arrives at my house, where I simply scan the document, and proceed to Step 5.
- All such email is archived in mbox format on minotaur.apache.org.
- I have a cron job which detaches the documents and stores them in svn for processing. Additionally, the name, email address, message id, and subject are stored in Subversion properties for later use. The act of committing this also causes an email to go out to those at the ASF that watch for such things.
- I have a ruby based CGI application that makes use of frames and even a small amount of AJAX. Within the browser, either Craig or I can select a document that is in the received folder, view it in a second frame, transform it using ImageMagic or pdftk, and file it. The act of committing the document and associated files we use to track the document causes more email messages. Additionally - and this is new as of this week - Mikel Lindsaar’s mail gem is used to send out emails to the person mentioned in the document (copying the original sender, should that person be different).
- A script originally written by me and now maintained by Jim Jagielski, analyzes the files we use to track documents, and publishes a list for all to see.
More details on the mail merge described in step 5. It starts with a configuration file. Here’s mine:
require 'rubygems'
require 'mail'
Mail.defaults do
smtp do
host 'smtp-server.nc.rr.com'
helo 'intertwingly.net'
end
@from = 'Sam Ruby <secretary@apache.org>'
@sig = %{
-- Sam Ruby
Secretary, Apache Software Foundation
}
end
Plus an ERB template file:
to: <%= pubname.inspect %> <<%= email %>> from: <%= from %> cc: secretary@apache.org bcc: <%= bcc %> subject: Your ICLA sent to Apache Secretary Dear <%= pubname %>, This message acknowledges receipt of your ICLA, which has been filed in the Apache Software Foundation records. <%= sig %>
And ultimately, it is processed thus (where vars is an OpenStruct, initially populated with data from HTML forms input and svn properties):
# extract fields from the Mail defaults
Mail.defaults do
vars.sig = instance_eval {@sig.gsub(/^ +/,'').strip}
vars.from = instance_eval {@from}
vars.bcc = instance_eval {@bcc}
end
# expand template
message = ERB.new(open(template).read).result(vars.send(:binding))
headers = message.slice!(/\A(\w+: .*\r?\n)*(\r?\n)*/)
mail = Mail.new do
# apply headers
headers.scan(/(\w+):[ \t]*(.*)/).each do |name, value|
send name, value unless value.empty?
end
body message
# is this a reply?
if vars.email_id
in_reply_to vars.email_id
references vars.email_id
# override subject?
if vars.email_subject and !vars.email_subject.empty?
subject 're: ' + vars.email_subject
end
end
end
# add additional cc if email:addr != email
if vars.email_addr and vars.email_addr != vars.email
if vars.email_name
cc = "#{vars.email_name.inspect} <#{vars.email_addr}>"
else
cc = vars.email_addr
end
mail.cc = (mail.cc + [cc]).join(', ')
end
# ship it!
mail.deliver!
Think Different
Tim Bray For creative people, this device is nothing. Tim also is quite concerned about losing access to emacs.
Imagine a 2.66GHz Intel computer with five USB 2.0 ports, one FireWire 800 port, a mini-DVI port, and a DVD burner. Comes with a wireless keyboard and a 9.7 inch wireless display. The display is fully touch enabled, and can even support a virtual keyboard. Yes, this system runs EMACs. It also can run J2EE, Ruby on Rails, and Django. The display connects to the base station via 802.11, and supports both canvas and AJAX. Comes with OS/X, but you can also install Windows 7 and/or Linux alongside it if that is your preference.
Tim Bray For creative people, this device is nothing. Tim also is quite concerned about losing access to emacs.
In the 70s, text ruled. In the 90s, GUIs and mice ruled. In the 10s, touch.
I can get to the Internet from my server, from my desktop, from my laptop, from my netbook, and from my phone. While my next phone will undoubtedly support touch, my current one does not. None of my other devices do, and frankly, they should not.
Imagine a 2.66GHz Intel computer with five USB 2.0 ports, one FireWire 800 port, a mini-DVI port, and a DVD burner. Comes with a wireless keyboard and a 9.7 inch wireless display. The display is fully touch enabled, and can even support a virtual keyboard. Yes, this system runs EMACs. It also can run J2EE, Ruby on Rails, and Django. The display connects to the base station via 802.11, and supports both canvas and AJAX. Comes with OS/X, but you can also install Windows 7 and/or Linux alongside it if that is your preference.
Would such a system be worth $1,200? If so, you can have it in 60 days: $599 + $499 + $69 + $25 + $5.
Even better, the system is modular. You not only can connect to your base station, but to any node on the network, be it in a humble printer or the glorious cloud. In fact, if you already have one or more of nodes that you are interested in, you can omit the base station and keyboard, and get started for half the price quoted above.
In short, I’m with Yehuda. If you wish to be open, you simply need to be creative. Best of all from my perspective: I’m confident that everything the iPad has to offer, plus video camera, plus VoIP will be available from multiple sources in the $200-$299 price range by late 2012. See also Charles Nutter’s take.
Wednesday, 27 Jan 2010
Retro Virus
Randall Munroe: HAHA, CLEANING VIRUSES? MAN, WHAT A BLAST FROM THE PAST!
How timely. Within the past week, both my sister-in-law and my wife’s netbooks got hit by viruses. I spent yesterday wiping and reinstalling my wife’s machine. While many of the details have changed, the overall process was very familiar.
Randall Munroe: HAHA, CLEANING VIRUSES? MAN, WHAT A BLAST FROM THE PAST!
How timely. Within the past week, both my sister-in-law and my wife’s netbooks got hit by viruses. I spent yesterday wiping and reinstalling my wife’s machine. While many of the details have changed, the overall process was very familiar: install Ubuntu to a USB drive, boot Ubuntu, rsync all of the files off the machine, reset to factory settings, install numerous updates, install a virus scanner, install firefox, thunderbird, pidgin, and printer drivers; copy over profiles and settings, and the data files that were on her Desktop.
Since my sister-in-law is three hours away, and only uses her netbook for the net, she may get upgraded to Ubuntu. Particularly as I don’t know if it is possible to restore the original Windows install on an EEE 900A (mine came win Xandros, long since replaced first by Easy Peasy then by Ubuntu NetBook Remix).
As for my wife: various upgrades may be in her future too.
Thursday, 21 Jan 2010
Content-Disposition
Yesterday, I collaborated with Joshua Peek on improving the parsing of the Content-Disposition header in Rack. Content-Disposition is used on file upload scenarios.
The previous state was that rack used a simplistic regular expression that didn’t match either the RFC or what browsers actually sent. What the new code does is first try to strictly follow RFC 2183. When that fails, it tries to follow what browsers actually do. And in this case, what browsers actually do is slap quotes around the file name, independent of whether the file name contains backslashes or quotes. A notable exception to this is recent versions of Chrome.
Friday, 15 Jan 2010
Peg svn revisions
Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato: You need only append an at sign to the end of the path, such as news@11@
But only for versions of svn >= 1.5. Very annoying. Especially if you have a script that works for everything you throw at it, until it comes across a file with name containing an ‘@’. So you dutifully add the ‘@’ as others have done, find that the code passes all of your tests and then fails on a co-worker’s machine who is running a different version of svn.
Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato: You need only append an at sign to the end of the path, such as news@11@.
But only for versions of svn >= 1.5. Very annoying. Especially if you have a script that works for everything you throw at it, until it comes across a file with name containing an ‘@’. So you dutifully add the ‘@’ as others have done, find that the code passes all of your tests and then fails on a co-worker’s machine who is running a different version of svn.
Code to determine what to append to a given name for use in svn commands (including, BTW, proplist, propget, propset,...):
def svn_at name
if (`svn --version --quiet`.chomp.split('.') <=> %w(1 5)) < 1
''
elsif name.include? '@'
'@'
else
''
end
end
My two cents: information on the basic syntax of working copy (WC) paths as used by the command line should not be buried in a chapter named Advanced Topics in a section entitled Peg and Operative Revisions.
Thursday, 24 Dec 2009
REST in Raleigh
Darrel Miller: Was the idea to call the REST workshop WS-REST designed to be as inflammatory as possible? http://www.ws-rest.org [via Don Box]
Oh, cool, a conference with a topic I’m interested in in my back yard!
It’s a shame it is too late to submit a talk proposal. Guess I’ll get to enjoy it as a civilian.