RailsConf 2007 - Day 2 1
Note: Check out the RailsConf Wiki and the presentation page
Chad Fowler is starting the keynote introduction. 1600 developers are at the keynote. He makes a passionate speech about how Rails is changing how we think about software and how Rails impacted the industry. An now Rich Kilmer introduces the person that introduced him to Textmate: DHH.
A peek at Rails 2.0
Celebrating what we have
- > 1 million downloads
- Hundreds of plugins
- ~10k people on rubyonrails-talk
- He asks who is getting paid in one form or another using Rails and a large part the participants raise their hands. ( Books: many Rails books in many languages. Surpassed PHP, Perl and Python (source O’Reilly Radar).
- http://workingwithrails.com/ indicates over 100 countries where people do Rails.
- IDE: CodeGear, Textmate, NetBeans, JetBrains, Aptana
Rails 2.0
- It’s not gonna change everything you know, it’s gonna be humble.
- No new ‘great’ idea.
- The experiment worked! (RESTFul resource)
- The world of resources is a better, greener place.
- Rails 2.0 will focus more on the REST convention
- Routes
map.namespace(:admin) do |admin
admin.resources :products,
:collection => {:inventory => :get},
:member => {:duplicte => :post},
:has_many => [:tags, :images, :variants],
:has_one => :seller
end- David now demos the new scaffolding that use the resource approach of working with things.
./script/generate scaffold persone name:string create_at:time
* He adds new format format.csv to support exporting as comma separated text. You can easily connect to this services:require 'active_resource'
class Person < ActiveResource::Base
self.site = "http://localhost:3000"
end
p = Person.find 1- Beyond CRUD you can custom methods, Person.find :all, :params => {:name => ‘d’}
- This all works today.
- Action Web Service is no longer service with Rails 2.0. ActiveResource is.
- Friends and allies: Ajax, REST, Atom, OpenID
9 other things I like about rails 2:
1) Breakpoints are back (ruby_debug)
2) HTTP Performance
<!-- :cache => true
gzips all javascript and stylesheet in one file
i.e. prototype, css get zipped down to 35K from 200k
-->
<%= javascript_include_tag :all, :cache => true %>
<%= stylesheet_link_tag :all, :cache => true %> 3) Query cache. DHH loves free performance
4) action.mime_type.rendererpeople/index.html.erb
people/index.xml.builder
people/index.rss.erb
people/index.atom.builder
def index
respond_to do |format|
format.html
format.xml
format.rss
format.atom
end
end5) config/initializers. One file per configuration in initializers folder
6) Sexy migrations (just nicer)create_table :people do |t|
t.integer :account_id
t.string :first_name, :last_name
end8) The MIT assumption. ./script/generate plugin now generates a default MIT license file.
9) Spring cleaning. Deprecated features of 1.2 will be removed. In-place editor will be moved to plugins.
That’s pretty much it. Thank you.
Building Community Focused Apps with Rails by Dan Benjamin
Rails is the ideal platform for Web 2.0. Fast prototyping and proof of concept. Prototype becomes the product. Conducive to collaboration with developers and designers. Dan is going to talk about Cork’d. Currently 20000 users.
Make a Plan.
- Treat your application like a product and your idea like a business. Just because it’s a good idea doesn’t mean it’s gonna be automatically successful.
- Stay Agile. Resist big infrastructure.
- Build the Right Team. Keep it light.
- Determine Ownership.
- Have a Revenue Stream (ads don’t count)
- Focus on Simplicity. Don’t build features just because you think they are cool.
- Don’t Release a Public Beta. They had two private betas. They learned from a handful set of people rather than from a large group.
- Know Your Audience. Be your Audience
Build the App.
- Think Like a Designer.
- Consider the Fold.
- Avoid Big Migrations. User entered data can be challenging.
- Collaborate.
- The Rails Layouts Makes Designers Happy.
- Common Rails Collaboration Tools. Subversion, Capistrano, Campfire, Basecamp, Lighthouse.
- Don’t Repeat Yourself: Use Plugins. acts_as_authenticated, attachment_fu, acts_as_taggable, exception_notification, open_id_authentication, ymlr4r geocode
- Take “Code Vacations”
Get Noticed
- “It’s Google’s World, We Just Live in It.”
- Use Smart URLs. /wine/view/5748, /authors/danbenjamn
- Leverage Markup. Google reads metatags.
Recruit Members
- Make It Obvious and Easy to Signup
- Ask Only for What’s Truly Necessary
- Ask for Everything but Require (Almost) Nothing
- Limit Non-Members
Keep Them Coming Back for More
- Make Frequent Improvements
- Respond Positively to Your Members
- Create A Developer Network
- Share Your API
- Find Good Partners
- “If You Do Things Right, People Won’t Know You’ve Done Anything At All.”
- Just Ship It
How We Used Apollo and Rails to (start to) Build an Agile Project Management App by Christopher Haupt and Chris Balley
They are part of Adobe’s Consumer Hosted Applications and Online Services group. They use whatever technology is right for the job, Flex, Rails and dozens of other technologies. They use Scrum and are geographically dispersed teams, in Germany, India, US.
Why Did We Choose Apollo and Rails?
- Learning Exercise
- Offline Support
- Maturing Tools
- Leverage our Rails Experience
- Cross Platform
- Installers
Why not AJAX?
- Offline and Partially Connected
- File System Access
- Drag and Drop with Native OS
Now they are demoing Maptacular, an Apollo applications.
Combining Apollo and Rails: Communication
- Flash Side
- AMF
- SOAP
- REST <== they used that
- HTML Side
- AJAX techniques
- Hybrid
- Ue DOM bridge to use the one you are comfortable with.
Combining Apollo and Rails: Quirks
- Flex’isms
- RESET can be a pain
- Use _method hacks for PUT, DELETE, HEAD
- Pass a body on everything other than GET
- Some HTTP headers can’t be used, or problematic on a GET
- HTTP Status codes not accessible
- Use URLoader to get HTTP Status Codes
- dasherize-is-unhealthy-to-your-actionscript-code
- Migrating to newer Apollo Builds
- ApolloApplication .vs. Application (for transparency)
Now they move on to Code Snippets. The sample code can be found on the Apollo Labs.
- Online/Offline (Event.NETWORK_CHANGE). Notifies if network change but doesn’t tell if network is up or not. Solution: use URLoader to ping the network (they ping google.com)
- Video Capture, File IO, Doing your own Chrome
Chris now demonstrate some community create applications.
RailsConf 2007 - Day 1 3
Here we go, RailsConf 2007, has started. It’s bigger than ever, more tracks, more sessions. This is the first day where they provide full or half-day tutorials sessions. I will try to cover the different sessions I will attend so stay tuned.
Today I will attend: “Scaling a Rails Application from the Bottom Up.” and “Harnessing Capistrano.”
Scaling a Rails Application from the Bottom Up. by Jason Hoffman
Jason Hoffman, CTO of Joyent. Did also form Textdrive.
Six part presentation:
I. Introduction and foundation II. Where do I put stuff III. What stuff? IV. What do I run on this tuf? V. What are the patterns of deployment? VI. Lessons learned
His presentation will answer the following questions:
- What is a “scalalble” application?
- What are some hardware layout?
- Where do you get the hardware?
- How do you pay for it?
- Where do you put?
- Who runs it?
- How do you watch it?
- What do you need relative to an application?
- What are the commonalities of scalable web architectures?
- What are the unique bottlenecks for Ruby on Rails applications?
- What’s the best way to start so you make sure everything scales?
- what are to common mistakes?
Maybe it’s a little early, or I am not awake, but the talk seems a little slow. But Jason seems to do a good job at describing how the different people (developer, sysadmin, ...) see scalability.
Ease of management is on log scale. It’s not just a Rails issue. A $5000 Dell 1850 costs $1850 to power over 3 year.
This is a really good presentation from a point of view of what is involved to build data center. I should have read better the description of the presentation.
So I am going to move over to Thomas Fuchs presentation:
Is JavaScript Overrated? Or: How I Stopped Worrying and Put Prototype and script.aculo.us to Full Use by Thomas Fuchs
I am just tuning in to his presentation and he is showing of how to use selectors with Prototype.
DOM traversal:$('blech').previous('ul').down('.somesuch',2)
$('homo-sapiens').descendantOf('australopothecus')$('a_div').update('blah').show().setStyle({opacity:0.5});
$('myform').focusFirstElement();
$('person-example').serialize();
Element.addMethods('form') {
valid: function(element) {
// code to valid form
}
}- speedier $$
- CSS 3 Selectors
- $(‘form’).request()
- String .includes .times .toPaddedString(8,2)
- JSON support i.e. new Date().toJSON();
- $(‘blah’).firstDescendent()
- throw $continue deprecated use “return” instead
- Safari issues fixed
- YAML compatible
DOM, Events, Forms, Position:
- new Element(tagName, attributes);
- $(‘blech’).insert(html|object, position)
- $(‘blech’).wrap(‘span’);
- $(‘country’).setValue(‘AT’);
Function.prototype: curry(), wrap(), defer(), delay() Q: When is the next release of Prototype? A: When it’s ready.
A 10 minute break now, the Thomas is going to present Scriptaculous Effects.
script.aculo.us adds advanced User Interface interaction to the DOM. Extracted from Real-World applications. Started with Fluxiom. The two main parts are Visual effects and Drag&Drop. Today we will only look at the Visual Effects. They are other parts such as Autocompleter, In-Place Editor, Slider control, DOM Builder, and Unit testing. They won’t be more advanced components.
Effects engine: the ideas behind the engine is timeline based animations.
Core Effects:- Effect.Move
- Effect.Opacity
- Effect.Highlight
- Effect.ScrollTo
- Effect.Morph // 1.7+
- Effect.Parallel
Based on the Effect.Base.prototype class. Effect life cycle: intialize(), setup(), update(), finish(). Each frame calls update().
Effect.DefaultOptions = {
transition: Effect.Transitions.sinoidal,
duration: 1.0,
fps: 100,
sync: false,
from: 0.0,
to: 1.0,
delay: 0.0,
queue: 'parallel'
}Morphing: came out with Scriptaculous 1.7.
$('mydiv').morph('font-size:20px; color:"#abcdef");
$('mydiv').morph('warning'); //limited to top level classnamenew Effect.Blah('element_2')
new Effect.Blah('element_2', {duration:0.6, delay:0.3});new Effect.Blah('element_1', {queue:'end'});
new Effect.Blah('element_2', {queue:'front'});new Effect.Blah('element_1', {queue:{scope:'blech'}});
new Effect.Blah('element_2', {queue:{scope:'blech', position:'end'}});
new Effect.Blah('element_3', {queue:'front'});Element.toggle('element', 'blind');
Element.tagifyText(element);
Element.multiple('element', Effect.Fade, {speed:0.05});Do it yourself: Thomas now shows how to create an Effect programatically.
Future features:- Sound without Flash (it’s already in the beta release). Sound.paly(‘sword.mp3’). It uses native sound implementation with Quicktime as fallback.
- Adjust to new Prototype features. $(‘blech’).fade(); $(‘blech’).slowlyReveal();
Part IV: Testing
Thomas is flying through testing…- assert(true)
- assertEqual(expected, actual)
- assertEnumEqual(expected, actual)
- assertNotEqual(expected, actual)
- assertMatch
- assertIdentical
- assertNotIdentical
- assertType
- assertRaise
- assertRespondTo
- assertVisible(element)
- assertNotVisible(element)
- info(message)
Mostly unit testing, but some functional testing is available. Most assert take a message. I.e. assertXYZ(params, message)
- wait(milliseconds, method) // should be last statement in test, but can be nested.
- rake test:javascripts (browser will popup). Done with the javascript_test plugin. Launches the web server (WEBrick), then controls the browsers (Safari, Firefox, IE), the browser then calls the web server, and list the results (SUCCESS, FAILURE, and ERROR)
- www.prototypejs.org
- wiki.script.aculo.us/scriptaculous/
- Book: Prototype and script.aculo.us by Pragmatic Programmer
- Book: Prototype and Scriptaculous in Action by Manning
- Book: Ajax on Rails by O’Reilly
JRuby talk by Charles Nutter and Thomas Enebo
(note taken by Robert Hall, thanks man!)
- 1.8ish—based on Ruby 1.8.5
- Gems 0.9.1 is pre-installed
- Partially compiled—about 80% of Ruby code compiles…rest is run in JIT mode
- Ruby 1.8 strings supported. Works with ActiveSupport::MultiByte
- Ruby 2.0 String support coming
- Most Ruby apps should work on JRuby —most gems just work —Red Cloth, Blue Cloth —Hpricot
- Typical Rails commands just work
- ports: Mongrel ported, Hpricot ported, RMajick in progress
- Ruby thread API supported —native-threaded 1 JRuby thread=1 system thread —supports thread pooling
- performance comparable to C Ruby impl —Rdoc has issues —CLI performance slow
- JDBC support strong —mySQL support strong —some postgres issues —some Oracle users —many others
- ActiveRecord JDBC
- No native extension support
- Goldspike—JRuby deployment tool —Rails plugin for building WAR files —app server agnostic —Can be deployed to Java app server as WAR file
- Deployment—MOngrel supported..some issues (forking, process management doesn’t work)
- Access to Java EE features (JMS, JPA, JTA)
- Java libraries can be wrapped
- Coming soon —A Grizzly/GlassFish V3 option —Lightweight, gem-installable like Mongrel —Concurrency, pooling mulit-app like WAR
- Mephisto demo
- Main idea—- Ruby as the programming language, Java for the platform and libraries
- Best of all worlds
—Ruby or Rails as the appl layer
—Java libraries alone or as ported/wrapped gems
-Java based services-legacy app integration —The JVM - Acceptable to today’s enterprise —Java to ‘them’, Ruby to you
- Calling Java from Rails demo —RSS reader demo..calling Java library from Rails code
- Tools— Textmate, Emacs, Vi(m), notepad —missing some features —code competion? —jump to declaration? —rename variables? —popup Rdoc?
- Presenters claim Best Ruby IDE Available is NetBeans (milestone 9) —code completion —smart syntax highlightings (for Ruby code, RHTML files, etc) —Rdoc support
- Demoed a cool Ruby shell like IRB implemented in Swing..built into NetBeans
- Jruby 1.0 almost ready
LUNCH: will be back at 1:30pm
Harnessing Capistrano by Jamis Buck
Jamis will focus Capistrano 2.0 today. Some things will not be backward compatible with Capistrano 1.0.
His slides are online at http://presentations.jamisbuck.org/railsconf2007/.
Sol's RailsConf 2007 picks
are here. See you in Portland.
Lee's RailsConfPlan at MyConfPlan
Following Daniel’s lead, here are the talks that I’m thinking of attending. So far I only looked at the titles of the talks, I’m sure I’ll do some switching once I look at them more in depth. Anyway, if you decide to look Daniel up while you’re there, you might want to look me up too, so I can translate his Swiss accent for you.
Chris, Sol and Nick... tag… your turn.
RailsConf 2007 - Here we come!
I just completed a first pass at setting my schedule for RailsConf. Check it out at MyConfPlan. In any case go check out MyConfPlan which is a pretty cool Rails application. As usual I am looking forward meeting many of the people I have met last year. Also if you are from Switzerland and doing Rails work, try to hunt me down, I would love to talk to you. It’s also fun that we are going to meet Kirk again, and “old” mate from Denver that is now leaving in Portland.