Created
October 29, 2012 20:00
-
-
Save alakra/3976164 to your computer and use it in GitHub Desktop.
RubyConf Schedule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Schedule | |
** Day 1 | |
*** Keynote - Matz | |
Matz says to be happy | |
Write your own languages | |
Keep a look out for Ruby 2.0 RC1 | |
He works @ NaCl | |
Use progress bar on bottom of slides to show progression of talk (maybe use a Nyan Cat) | |
*** Abstracting Features Into Custom Reverse Proxies :track2: | |
by Nick Muerdter (at NREL) - http://developer.nrel.gov/ | |
Put email and twitter on header of slides | |
**** Why and How to use reverse proxies? | |
***** Benefits | |
1 entry point to all API / 1 user account to access API | |
API key access to all APIs | |
Rate limiting for all APIs | |
Analytics to all APIs | |
Standardized a single API | |
Scales well (reverse proxy to other reverse proxies) | |
***** Costs | |
Didn't want changes to each API | |
***** Implementation | |
Use the reverse proxy to interpret single API call to backend APIs | |
Put all benefits into reverse proxy app to sit between client and backend apis | |
***** Tooling | |
em-proxy - eventmachine | |
rack-reverse proxy is a little slower | |
***** Applications | |
Error handling? (interception) | |
Web page manipulation | |
Insert standard analytics javascript snippet | |
Add headers/footers? | |
Populate ads to keep them separate from your system | |
Add JSONP callbacks for all JSON APIs | |
Security checks | |
More than HTTP... | |
Implement your own buffering systems | |
Intercept and manipulate email | |
Intercept database calls | |
Anything via TCP/IP | |
***** Gotchas | |
Content-Length (if you change content, make sure this is correct) | |
GZip responses (need to do a bit of buffering) | |
Need buffering when dealing with response if doing parsing (need something aware of HTTP response structure) | |
Testing can be a challenge with evented things | |
***** Objectives | |
Make web services | |
More Gov't data coming our way through this | |
Make it easier for user to find and consume APIs | |
Federal push to develop and deploy APIs | |
***** Open Source | |
API Umbrella - https://github.com/NREL/api-umbrella | |
Goliath - uses em-synchrony (uses fibers) - https://github.com/postrank-labs/goliath | |
HAProxy | |
Varnish Cache | |
Supervisor - monitoring proxy | |
*** Service Oriented Architecture at Square :track2: | |
by Chris Hunt | |
Use JSON to communicate between web services | |
**** Languages | |
JRuby and Java | |
**** Deployment | |
Using Java - allows them to run any language on the JVM | |
**** Boilerplate things | |
***** Documentation | |
Must use fdoc to describe API or cannot deploy - https://github.com/square/fdoc | |
The builds will fail | |
***** Testing | |
Reccommendation: Growing object-oriented software guided by tests | |
Using foreman to boot up test env to develop Sinatra based API apps against | |
***** Code Quality | |
Using cane to enforce consistency on code quality - https://github.com/square/cane | |
***** Deployment | |
Jetty provisions the host | |
JetPack does this for you - https://github.com/square/jetpack | |
***** Monitoring | |
Airbreak with Hoptoad - https://airbrake.io/pages/home | |
Cubism.js - https://github.com/square/cubism | |
Splunk | |
***** Security | |
Using SSL Certs with mutual authentication | |
Because they are building web services they can verify the private keys of other services | |
**** NEED SLIDES FOR THIS PROCESS**** | |
*** Ruby 2.0 on Rails :track1: | |
by Akira Matsuda | |
100% compatible -- no idea | |
http://www.ruby.or.jp/en/ | |
**** Background | |
Monkey patching affects all instances when you override a class | |
**** New Features | |
***** Refinements | |
Uses to new methods Module#refine and Kernel#using | |
module Bar | |
refine String do | |
def say; puts "blah"; end | |
end | |
end | |
class Foo | |
using Bar | |
def hello | |
'ello'.say | |
end | |
end | |
Foo#hello only uses that refinement instead of a global monkey patch | |
Works only with Classes and Modules (not lambda/procs) | |
If you have to, you can do it this way: | |
Module.new { using Bar }.module_eval { ... } | |
https://github.com/amatsuda/rspec-refinements | |
E.g. In Ruby2.0, "#should" is a core method now, so we use refinements | |
to ensure that Rspec doesn't pollute the global namespace | |
possible ActiveRecord enhancements: | |
User.where ('age >= ?', 18) | |
to | |
User.where({ :age >= 18 }) | |
https://github.com/amatsuda/activerecord-refinements (not official, but useful) | |
^^^^^ Look at lib/active_record/refinements.rb | |
ActiveSupport | |
It monkey patches and cannot be unloaded from the global namespace without restarting process | |
https://github.com/amatsuda/activesupport-refinements | |
LOL. This is experimental and may be removed. | |
Also, ambiguity with alias_method_chain | |
***** Module#prepend | |
Like include, but the order of method invocation is reversed when calling super iteratively | |
***** Enumerable#lazy | |
for lazy evaluation | |
(1..Float::INFINITY).lazy | |
.select(&:even?) | |
.take(20) | |
.force | |
#=> [2,4,6,8...40] | |
***** Keyword arguments | |
No more work arounds | |
*** Your app is not a black box (Travis CI) :track2: | |
It's about how good you want your app to be | |
Using AS Notifications => metricks => librato metricks reporter | |
Using librato to display data | |
Tasseo - use a fork to make it work with librato | |
*** Building modular, scalable web apps? Of CORS! :track2: | |
** Day 2 | |
*** Jim Weirich - Y-Combinator | |
Using Emacs to run ruby - http://stackoverflow.com/questions/5742237/run-ruby-from-emacs-buffer | |
Alan Turing - The turing machine overview | |
Alonzo Church - Lambda calculus | |
**** Influcences today: | |
LIsp | |
Clojure | |
Ruby | |
Coffeescript | |
Javascript | |
**** Fixpoints | |
Any value that when given to that function it will return that same value | |
e.g. 0 = sin(0) | |
e.g. 1 = sqrt(1) | |
e.g. 0 = sqrt(0) | |
**** Higher order functions | |
make_addr = ->(x) { | |
->(v) { | |
->(n) { n + x }.(v) | |
} | |
} | |
# function that returns a function | |
compose = ->(f,g) { | |
->(n) { f.(g.(n)) } | |
} | |
**** Functional Refactorings | |
***** Tennet Correspondence Principle | |
add1 = make_addr.(1) | |
mul3 = ->(n) { ->(z) { n * 3 }.(12345) } | |
mul3add1 = compose.(mul3, add1) | |
mul3add1.(10) | |
***** Introduce Binding | |
***** Wrap Function | |
***** Inline definition | |
**** Recursion | |
**** Y Combinator - Applicative Order Y Combinator - Z-combinator - Fixpoint Combinator | |
y = ->(f) { | |
->(x) { x.(x) }.( | |
->(x) { f.(->(v) { x.(x).(v) }) } | |
) | |
} | |
**** Applications | |
Don't really need this because we have named functions, if you | |
wanted to make everything anonymous, you could use the Y | |
Combinator, but I wouldn't reccomend that | |
**** Conclusion | |
If you like this: | |
http://experthuman.com/programming-with-nothing | |
*** Grow Your Unix Beard Using Ruby :track2: | |
JRuby and Ruby on Windows do not support forking | |
**** Process forking | |
#fork seems to be the only method that returns twice | |
but it's not really returning twice, just returning once per process | |
When you fork, it copies the whole current Ruby VM at that point in time | |
into the new process | |
$hits = Array(1..5)g | |
pid = Process.fork do | |
$hits.delete_at(1) | |
puts "Child hits: #{hits}" | |
end | |
**** Preforking | |
**** Fork And Exec | |
Core to all processes in unix | |
**** Dennis & Ken - the original unix beards | |
*** Real Time Salami :track1: | |
**** Streaming | |
Clients are blocked while rails works | |
Why buffer? | |
ActionController::Live Module - get an IO object on response | |
response.stream to act like an IO object | |
Want to do this to stream ERB | |
**** Applications | |
Infinite Streams | |
More interesting ... SSE (Server Side Event) | |
FS Events to Puma to Browser | |
DB Events - Console to DRB socket to Puma to Browser | |
**** Hacking | |
Ghostscript REPL | |
Using RubyVM in 1.9.3+ to understand bytecode in Ruby | |
The goal is to create printable ruby ... what? | |
Quicknote: ActiveRecord::Relation != Arel | |
interpolating strings with #{} still creates string objects that are thrown away | |
but the final allocation is only one string | |
Process -> Make code readable -> Measure -> Then Optimize | |
***** Dtrace - Using it to inspect Rails boot time | |
disabling trace (not any faster) | |
Where are we spending the most time in the RubyVM? | |
What is being called the most | |
GC Time | |
Compile Time | |
Searching | |
bug #7158 - require is too slow - https://bugs.ruby-lang.org/issues/7158 | |
*** What we can learn from dRuby's metaprogramming magic :track3: | |
What is dRuby? (dRB) | |
Distributed Object System | |
Can invoke methods in different processes | |
Can send objects between processes | |
Pure Ruby | |
In ruby standard library | |
Using recorded videos to display irb coding | |
**** Usage | |
distributed RSpec | |
**** Design Style | |
unix | |
ipc - interprocess comm | |
fork/pipe, systemV IPC | |
**** DRB story and methodology | |
embedded web servers into small apps | |
was doing everyting with CGI (not cool anymore) | |
http restricts how to exchange objects | |
server - client relationship | |
function api (rpc) | |
Didn't want to convert Ruby world to Web world | |
Wanted Ruby to talk to Ruby. | |
RPC -> RMI | |
Extending Ruby's method invocation to socket programming | |
ObjectSpace._id2ref & send | |
Using Marshalling to save and resurrect objects | |
Ruby socket programming paterns from shttpserv | |
DRB doesn't translate procs remotely, it will proxy back to the client | |
http://segment7.net/projects/ruby/drb/DRbSSL/ | |
Also interesting: http://rdoc.info/stdlib/rinda/frames | |
*** How I Set out to Benchmark an Algorithm and Ended Up Fixing Ruby :track3: | |
**** 4 Rs of bug reporting | |
***** Reproduce | |
Make the bug occur everytime (or at least more than once) | |
Ruby can be influenced by various .*rc files (.irbrc, .gemrc) | |
Environmental variables | |
rvm and rbenv | |
ask a friend to run the code on their codebase | |
***** Report | |
Ruby Bug Tracker - http://bugs.ruby-lang.org | |
All steps to reproduce, bonus points for attachments (script that shows the bug in action) | |
Ruby Version | |
Crash log (look in Console.app in OS X, find the equivalent for your system, maybe syslog for other unix distros) | |
***** Reduce | |
Reduce the environment dependencies to narrow the scope of where the bug is | |
Eliminate libraries | |
Simple scripts are the best | |
Shrink code (5 or fewer lines is ideal) | |
***** Regress | |
Try different versions | |
Better: try different ruby releases | |
Best: git bisect (ZOMG!) | |
Bonus: try different build settings | |
***** Repair | |
Try and fix it | |
Pack your Bags | |
Get the source code | |
Build it | |
****** Study the map | |
include/ruby/ruby.h | |
ID => symbols | |
VALUE => everything else | |
rb_id2name => dump symbols in GDB | |
rb_string_value_cstr => #to_s for GDB | |
vm_call_method | |
****** Bring your gardener | |
miniruby | |
like ruby, only smaller | |
lexer, parser, interpreter, VM/runtime | |
core library classesx | |
make miniruby to build | |
****** Weapon of choice | |
GDB | |
gdb ./miniruby | |
set pre-run breakpoints | |
pass arguments to miniruby with "run" | |
watch it crash | |
****** Advanced Weaponry | |
MallocStackLoggingNoCompact | |
man malloc | |
Set env variables to log the stack during allocations | |
Run in GDB, use malloc_history to view stacks | |
CFLAGS-"-O0 -g" ./configure | |
malloc vs gmalloc (gmalloc is more aggressive, stresses the system because it locks a page after an allocated page and uses memory up quickly) | |
*** The Celluloid Ecosystem :track1: | |
Why use threads? Because of multicore systems | |
Cores are growing and threads are getting cheaper | |
Processes waste RAM | |
Serialization penalty | |
Used circles to do UML object messaging diagrams | |
**** Applications | |
Sidekiq and Ahearsion | |
**** OOP Tools and Concurrency Tools need to be combined | |
Active Objects (Based on Actor Model) | |
"Cells" name of abstraction | |
Can call methods asynchronously | |
Can do "futures" also (much like ordering food at a restaurant | |
before getting to the restaurant) | |
** Day 3 | |
*** The Insufficiency of Good Design | |
by Sarah Mei | |
OOP Design | |
Good communication is important | |
*** mruby meets iOS and RTOS! :track3: | |
*** Machine Write Tests For Our Code? New Verification Techniques :track2: | |
*** How we try to answer The Great Energy Questions with Ruby :track2: | |
*** Rapid Programming Language Prototypes with Ruby & Racc :track3: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment