Created Friday, March 26, 2010 by Ryan Stenhouse
SRC is over for the day. Lightning talks later. Time to write mine!
Question: SO, have you got anything that will deal with not total failure, but partial failure like timeouts and such? Yes – absolutely. In this instance, with nginx if you proxy through a location, you can put a timeout on it to miliseonds.
Talk open to Questions now.
SSI vs. ESI – ESI is SSI with a difference syntax. It’s an XML DSL which supports instance graceful fallback. Nginx processes the SSI, and pulls the content straight from the nodes.
Using Server Side Includes – a blast form the past!
His example proves that if you’re distributing things properly and gracefully falling back when there are no nodes.
And the Demo is back! Every block of content is coming from another machine in the audience. There are 15 connections.
Ok, audience participation dead because of the bad WiFi. On with the talk!
Audience participation, I’m ‘old_content’.
It was backed up by some good numbers. And now, how to do it with a live demo. Brave man!
Harvest vs Yield: Yield is Overall Availability. Harvest measures the completeness of the response. By allowing graceful Harvest degradation, you can increase your overall availability.
Identify the parts of your system each segment rely on.
Diagrab, being explained quicker than I can type it up. Talking about dependancies now too. Most systems depend on other systems – databases, memcached, payment processor. More than just your code!
Less Breakage: Because it increases availability of the whole. Systems will always break; but how does your system react when a fault occurs?
Easier to separate development work, and also simplifies deployment. More user-friendly failures – only one part of the page fails.
Reduces the complexity of the code by breaking down the monolithic parts into smaller chunks.
Each segment of content is easily parallelisable, with each segment potentially being generated by a separate rack app.
How to make it faster? Better templating? Caching? None are good options, so the work is distributed.
Advantages of distribution: Is faster because of paralyzation and reduces complexity because you’re breaking things down into smaller chunks.
The problem is that the page takes too long to generate and the view code is very complicated. Partials within partials. Any bug in it will break the most important part of Scribd.
The other segments are less required and are happily isolated for this example.
The Problem: The read page on Scribd. (Lets you read documents online if you don’t know). The document viewer is the only ‘important’ part.
Works for Scribs, who deal with work at massive scale. Always looking for new staff – send in your CVs. Audience participation. Eek.
Talk starting. Tyler McMullen from SF, talking about distributed systems with Rack -but there’s little-to-no Rack in his talk, it’s more Framework Agnostic.
There’s a PA system here. Every-so-often the disembodied voice of either Alan or Paul is suddenly everywhere. It’s as cool as it is scary. I will pay money-cash if one comes out with ‘I AM THE GREAT AND POWERFULL OZ’
Managed to get plugged back in! In the final scheduled talk of the day, which for me is Distributed Architectures with Rack. Dur to start in the next five minutes.
Battery gone, that’s all for now folks. Be back around 1930 for the lightning talks.
Code will be on GitHub later, and I’ll include it in my final writeup.
Showing how obstacle and navigation works with the IR sensor. Quite cleber with not all that much code. But yes – very C-like for Ruby nut still nicer than C.
Showing some code of how the Flying Robot worked. And showing now a Sharp GP2D12 IR Sensor with a 30cm range.
Shoes doesn’t like Snow Leopard.
Flying Robot by Damen and Ron Evans. It;s a blimp flying in a 2008 Ruby conference. Flying to Ride of the Valkyries. Brilliant.
Barsiono by Matthew Williams.
It’s a Ruby DSL to mix drinks. Video: Drives pumps to mix drinks. It’s bloody brilliant.Noisy, but awesome.
It’s a video showing a board playing music on glasses filled with various amounts of water. It’s very very cool.
Ruby on Bells example, by JD Barnhart.
Some example code for moving a Servo through 180 degrees.
Tonnes of plugins and libraries are available for RAD as well, most of them are wrappers to C libraries.
Question: It’s not very idomatic Ruby, is this because it’s being compiled to C? Yes, that’s why. It’s not good, but better than writing the C.
35 minutes of battery left, realistically 20 minutes. Just enough to cover Martain’s brilliant talk.
Reading from a serial device is also very very easy. (For reading from Sensors).
Nifty video on the slide. Keynote has improved presentations everywhere no end.
Likewise for fading an LED in and out over a period of time, and again it is much more succinct in Ruby than in Processing / C.
Compared the Ruby version to the C for blinking LEDs, much more succinct in Ruby – looked very interesting.
Unfamiliar with the platform, should buy Getting Started with Arduino by Massimo Banzi, who is one of the people behind Arduino.
Configurable with very straight forwad YAML files, which have good internal documentation and then use the rake tasks to build and upload to your device in one easy step.
Oh no – Battery in the Red.
RAD – Ruby Arduino Development, released in Jly 2007. Ruby wrapper that works with the Arduino. Available as a gem and is on GitHub http://github.com/madrona/rad Compatible with Version 15 of the software, but some Forks work with other versions. Uses Ruby2C
Need to take care with downloading Drivers, especially if you’re on a Mac.
Software behind it is based on Processing, and provides a basic Cross-Platform IDE. Latest version is 18.
Shields are add-on boards which are chain-able and add ethernet, wifi, motor, sd cards, and various other functions to the arduino. But you need to keep track of your pins!
Latest one has 128 kb of ram, 54 pins, 16 analogue pins, Shield compatible.
Basic form, 6 analogue pins out of the 15 in total. Clock runs at 16 MHz. AUtomatic external voltage, between 6 and 20.
Duemilanove is the current one, ATMega processor. 60,000 sold in 2009. Only from the Italian manufacturer.
http://arduino.cc – Community site with examples, tutorials and downloads and a very active forum.
Arduino and Ruby with a little bit of Shoes!
Taking the next step in Web Development with Document Databases Alexander Lang
@langalex
culerity, couch_potato gems made by this guy.
Interesting presentation style, but 10 minutes of preamble so far – get on with it!
Topics: Performance, cluster, dynamo, scalability, cloud, sharding. Really talk about how to design a domain model with documents. Covering couchDB and his own Couch Potato Gem.
Differences: DocDBs have one namespace, no schemas and documents an be complicated using JSON. Real DBs have flat tables with fixed schema.
Accessed throuh SQL in RealDBs, in DocDbs, you can just use a key and a URI to get the resource back. ALso map and reduce.
He;s not too good at explaining his topic. Flashy presentation software though. SVG based.
All the document DB examples are showing are JSON, but unfortunately, there’s no explanation.
One nifty thing though, you can model compositions in a Document Database (Which appears to me to only be because you’re using JSON objects…)
Composition works better with OO languages and are not possible to model with SQL [citation needed].
SQL: restricted to lists of the same time, and associations are only the relationship you can create. Document Database can be mixed and matched at will.
Polymorphic Associations: Pretty cool way to aggregate content for a specific user. The only useful use case presented so far -probably why Twitter are switching.
Reporting example now – Getting the number of words in an e-mail. No direct way to do it in SQL – obviously you can do it all in Ruby rather than the DB. In Couch, it’s much much better. Pretty cool, give it a regexp then count the resulting array (will costly in performance though!).
Apparently no costly in performance because couch compiles things and only runs your code once.
Nested forms are easy to do. And now onto Duck Typing.
Sorry, The internet failed. Next post will be all my notes for the Crouch Talk
Lunchtime!
Question: How does this fit in with Seeqel and DataMapper? These others have a lot of advantages over ActiveRecord. Arel and Seeqel have asimilar API but implemented differently, Arel may be better. DataMapper and AR3 it comes back to the syntax you like, both are probably equal. Are you doing anything about the n+1 problem or Itendity Mapping? No IM, it doesn’t work well in every case, 10% of the time if falls on its face. Fails at complicated associations and fills up memory. If this can be fixed then it might make it in, but it’s not high on the list. N+ bug will interfere with the Identity Map and they’ll hurt eachother.
Question: Given how great lazy loading is, why is it that .all solidifies the collecting? Because behaving otherwise would probably break a lot of apps. Old behaviour remains the same for now, but is deprecated and will be gone to a plugin by Rails 3.2.
Question: How does the lazy loading trigger to run the query; and how to trigger it manually? Will be a .to_a method which runs the whole query as expected.
Question: Will it make unit tests more brittle? Short answer is probably not, since it may end up that you’re trying to test the framework.
He’s @carllerche on Twitter. I didn’t do too good a job updating this liveblog on his talk – was too interesting to split my attention effectively. The Arel stuff lives on GitHub
Arel can also work quite well entirely in memory.
Implemented a nifty interface to EC2 in just Arel. Including the engine within his interface that know specifically how to speak to EC2.
The Engine responds to CRUD.
How Arel is architected, two parts. Algebra part for modelling relation, and the engine which physically does things. Separates representing data concepts from the underling how it’s going to work.
.and and .or are defined on Arel objects to make it possible to chain things. Pretty nifty.
Operators, eq, not, lt, lteq, gt, gteq, matches and in are available to use on Arel objects for the predicates to pull out data from the table.
Stuff he;s about to show may be in Rails 3.1. Arel is built into rails, so it is able to talk to directly. Model.arel_table gets an Arel object.
Scope uses the same API since everything is driven from those relations now.
Still works like a model, so the relation object still works mostly like the model you’re expecting.
Querys are only run when you try to iterate through the relation that the query is executed. New finder methods, where, having, select, group, rder, limit, offset, joins, includes, lock, readonly, form.
NOow AR has a new API- Product.where(:name => ‘ipad’). Doesn’t give back an array, gives back another relations o you chan chain stuff, and store them. They;re re-usable and further chain able too. Very clever! They’re also lazy, yay!.
Has primitive operations, Restriction: like WHERE in SQL, Projections: Like SELECT, Joins: As you think. Intersection Union and Difference too, skipped through. Operations can be combined together and returns a different relation, so it’s a closure.
Relatons are an unordered header with types and an unordered set of tuples.
Arel is OO Relational Algebra implementation. Comparing it to SQL, not quite the same but close enough for comparison. Was proposed by E F Codd, became how all RDMS work.
Arel comes from GSOC, Engine Yard and Ruby Central are starting a Ruby Summer of Code thing.
Going over how the finders used tow ork in AR, going through the pitfalls of using the hash to do things. Then goes on to named scope and how that improved the querying.
Carl form Engine Yard is giving the talk. Giving the blurb about EY.
Next talk: Getting the most out of a Active Record 3 with Arel. Back in the massive lecture hall, can see this one being pretty popular. Arel is seriously clever stuff.
On GitHub: http://biy.ly/rubyjoy , Can follow @jasoncale on Twitter.
Back to presentation. From the London to Edinburgh trip, every ten seconds output to video form the train. The effect is quite pretty.
Fith Example: Nothing for now; but it now responds to the sounds coming form his phone to draw frames from the webcam.
Fourth example: Hooks into twitter and looks for the #scotruby tag, overlays them onto the video. Very very clever, and quite cool to look at. The video is actually being drawn by the tweets.
Third example takes this a step further and generates the ellipse size based on the brightness and contrast of the cells.
Second example captures every 10 pixels and draws an ellipse. It’s also remarkably little code. And now the images looks like it’s made up with a bunch of pixels in a bit of a mosaic effect.
In total, it’s less than 20 lines of real code to capture video from the webcam. That’s pretty cool.
He’s got a webcam hooked up to his Mac and he’s going to use processing to capture images from it. Requires the ‘video’ library which comes with ruby-processing.
Live demo now
ruby-processing does its best to map the Java stuff to more ruby-like methods.
processing.org/reference gives you the full API, and they are all mapped 1:1 to ruby-processing.
Look into the main Ruby bits on ruby-processing. Defines a ‘sketch’ as a ‘class’.
Showing how to pull out the examples coming with Ruby Processing so you can play with them.
On to an example… Another Screencast.
Processing also has a good GUI library too, and can also talk to the rest of Java. Even Swing – should you be so perverse.
Commands app and applet lets you share what you’ve done. Bundles your processing into a cross-platform Java application or into a Java Applet.
Includes ‘live’, which is an interactive ruby-processing shell.
gem install ruby-processing gives you the rp5 command which is the heart of Processing.
Oh dear – ‘organic beauty’. Ruby Processing is a ruby interface to Processing that lets you not write Java. Works with JRuby to talk to the Java stuff. It’s on GitHub.
Processing application, form processing.org. Nice looking applicatin, quite clean and open feeling.
Screencast!
On OS X – Processing.app. It’s a derivative of Java. No non-mac option yet – I’ll source one for my final writeup.
Meant to let non-technical people program : ‘fun dudes’
Processing is – Open source programming language and environment that allows people to program images animation and interactions.
Talking about Processing in Ruby. Jason Cale, from London, writes Ruby.
Big yellow backdrop on screen – ‘Alrite Mate’. Quite a full room!
StoneWall in a nutshell from me – an ACL with states.
Off to the next talk! Joy of Painting with Ruby.
How tightly does it tie into ActiveRecord, or can it be used ORM Agnostic? Wants it to be ORM Agnostic for Rails 3, but needs AR to do the ‘Guarding’ functionality for now.
Talk is over, QA now. Why don’t you use ‘StateMachine’ over ‘AASM’? StonePath doesn’t overly depend on it and he wants StonePath to work with both.
I’m sure StonePath is brilliant, but in my opinion this talk isn’t communicating how it works as well as it could. 30 minutes of a walkthrough of a webapp looking at AR models isn’t explaining a Stateful Workflow.
Talking about REST now.
It took him 8 hours to write this contrived example.
Assigning takss to people as part of the workflow. This example is up on his GitHub – I’ll link it later. It’s deliberately contrived, but I guess it does explain how StonePath works.
Showing the actions for each user now and how each state can be changed depending on the workflow.
Discussing the ste machine aspects just now an how states work and flicking through his views.
StonePath sits on top of AR and uses AASM to do some of it’s magic. It’s essentially a DSL and some customised associations between models.
There are far too many diagrams in this talk, so I can’t really type much – sorry people.
The Work ItemsL The ‘thing’ people are collaborating over. your Boss’s Boss. Has state and has an owner.
As an aside, the Library in the Royal College of Physicians is beautiful.
State-Based Workflow. Idea –> Bill –> Law or Idea –> Bill –> Dead.
StonePath’s reference implementation is a gem for Rails.
Workflow is a structured collaboration. Several people workong towards a common goal.
Workflow is a long lived process, possibly with more than one software agents, with audi. It is not page flow , step-by-step wizards and so on.
Workflows / Sate Machines. State based and Processed based. Only talking about the State based ones
Next talk! StonePath: an Introduction. State / Task Workflow for Rails.
Google Group: wizardbookstudy
Resources: the computing book is online for free.
In summary – Look for non-traditional solutions. Share them and show it around. Find good abstractions which describe the detail which do the job you need. Embrace duality, don’t worry about objects or functions, they’re kinda the same thing.
Think laterally, hone your tools and learn more. Grow as a programmer.
Objects and Closures have duality and can be defined in terms of eachother.
Same implementation as Lambdas was very nifty. Now talking about the various ways to implement it, OO verses Functionally.
Using a data structure – could this just be done with functions? Yes.
Now can do LISP list stuff in Ruby.
Chapter Two; Cons Cell. List, the ability of using pairs to create powerful data structures. Cons, Car, Cdr.
So far been a very brilliant talk on how to do Functional programming in Ruby 1.9, – Lateral Thinking for OO people
Key is working out the ‘good_enough’ and ‘improve_guess’ for the problem.
How would you refactor it? Swapping the algorithmic parts for individual methods. Created a ‘generic algorithm’
Cool stuff from Chapter 1: Square Root function. Calculates the root of any number. Starts by guessing and loops til it roughly has it right.
From 9 – 1 to producing a Sceme Interpreter – in an Introductory book.
Structure and IMplementation of Computer Programs – The Wizard Book. Introductory text at MIT. How could that be of use?
The Rule of 3: If I hear something mentioned 3 times in close proximity; it’s something I might want to look into more closely.
Summary: Lateral Thinking, Dualities and Abstractions. And on to Software. Physics done.
Tied into Abstractions now from teh three models of atoms – abstractions are very powerful things because they help us make sense of things and good assumptions.
On to the wave / particle duality now; electrons and photons diffract too.
Explaining interference between waves now. Double Slit Diffraction.
An example of Lateral Thinking
Light emission grom Carbon. Bhor trying to find patterns. Onto Hydrogen now.
Recapping his last keynote – about Bhor & Einstien ; structure of matter.
Jim is up now; Picture of Niels Bohr on screen.
Paul is welcoming us now, “More Ruby than Rails”. Kevin Rutherford is running the BoF Sessions in Rooms 5 and 6. Seminar room for charging and hacking.
Darth Vader has appeared on the big screen, looks like we’ll be getting started once these last few stragglers get in and get seated
Quick survey of the crowd shows iPhones and Macs are predominant gadgets on people’s laps and in their hands.
The lecture theatre here is huge, roughly 12 tiers of seats arranged in a massive semicircle pointing down at the podium.
“Shuffling in a general theatre direction” now!
There is still plenty of people arriving, looks like a full house!
Arrived and registered for this year’s Scottish Ruby Conference. The turnout is pretty damn impressive. Registration was painless and efficient and the coffe is brilliant. Keynote from Jim starts in about 10 minutes.