Nick Sieger: Tag rubyconf2006 tag:blog.nicksieger.com,2005:Typo Typo 2007-08-31T16:25:36+00:00 Nick Sieger urn:uuid:4056b0d7-7b02-4fae-b5b7-536b0cfa5b76 2006-10-21T02:59:38+00:00 2007-08-31T16:25:36+00:00 RubyConf: Matz Roundtable <p><em>An annual tradition at RubyConf is the &#8220;Roundtable&#8221;, where any member of the audience can come up and ask Matz any question. Transcript follows with partial paraphrasing.</em></p> <p><em>Q. Will Ruby ever get the features of <code>evil</code> built in? Will we get <code>become</code>?</em> No.</p> <p><em>Q. If Symbol is a &#8220;frozen&#8221; String, why do we need Symbol?</em> I don&#8217;t have a complete answer to that question &#8211; following tradition.</p> <p><em>Q. What&#8217;s the most unusual architecture Ruby has ever run on?</em> Ruby&#8230;I can&#8217;t think of one&#8230;JRuby? Some guys ran compiled Ruby on the NECS supercomputer. [From the audience] Symbian.</p> <p><em>Q. As Ruby gains acceptance, it becomes more resistance to change. How do you keep agile while gaining momentum?</em> We have forked off 1.8, so if you want stable, use Ruby 1.8 forever.</p> <p><em>Q. The array patch &#8211; is there any chance of a backport for those of us who want 1.8 forever?</em> Could be, but the current patch has a bug in 1.9.</p> <p><em>Q. Why isn&#8217;t YARV the only VM for 1.9? [Comment about register-based VM]</em> I&#8217;m not sure whether stack-based or register-based VMs are better&#8230;[THAT GUY!]&#8230;[Given the hook]</p> <p><em>Q. It seems like momentum is based on strong metaprogramming facilities. With 1.9 there are more user-friendly features. Will code eventually be data, or are we just patching on techniques on a tool that is being used more heavily?</em> An extreme way to do metaprogramming is to use Lisp, but for practicality we have to start somewhere. I&#8217;m not sure that s-expressions are the way to go. We&#8217;re not going to have macros. It will remain similar to what we have in 1.9. <em>The ability to serialize code would be really powerful &#8211; will that happen?</em> Disclosing internal state is tricky because it changes. It could be a platform-specific feature.</p> <p><em>Q. Recently for 1.9, there was a patch for Array and String to be in the object header. Was this profiled? It seems like it would be an incredible performance problem.</em> It was done for slowness of malloc and gc. In some cases it could run slower, but it benchmarked at about 5% faster. It should be tested thoroughly.</p> <p><em>Q. Ruby 2.0 will not have green threads or continuations, correct? Are there specific reasons for that decision?</em> It is difficult to implement green threads in YARV.</p> <p><em>Q. People want to see development move quickly, but may not be able to contribute code. Can you suggest ways for those programmers to contribute?</em> Submit patches to the list. What is the obstacle to joining us? [Question restated] Submit testing, submit documentation. Contribute to RubyCentral? (looks at Chad Fowler)</p> <p><em>Q. The CSV library is useful, but slow. Can we see FasterCSV in stdlib?</em> It&#8217;s ok to replace the csv library with FasterCSV, as long as the compatibility issues are resolved.</p> <p><em>Q. I want to thank you because I love writing in Ruby every day. I tried to write Python first. Recently an unrelated upgrade broke my Python apps. Will we be able to manage multiple versions of Ruby?</em> You&#8217;ll have to have two versions, 1.8, and future ones.</p> <p><em>Q. What would you say is the most important feature of your personality that has given you success?</em> Endurance? <em>Can you elaborate?</em> It&#8217;s easy to design a language, many of them disappear in a year or two. I&#8217;ve been working on Ruby for 13 years.</p> <p><em>Q. I wanted to see in IRB how the class was implemented at runtime. (He means an uneval feature)</em> [Audience member (Eric Hodel?) mentioned ParseTree]</p> <p><em>Q. If there wasn&#8217;t Ruby, what would you be programming in?</em> Some language of my own not named Ruby.</p> <p><em>Q. Do you still look at RCRchive?</em> Yes. I&#8217;ll talk about it in the keynote.</p> <p><em>Q. I would like a feature abstraction that would allow Ruby to fork itself rather than actually forking. Can you see this added to core?</em> We have to define the behavior of that feature. We have to have a good name for the method. Then there will be no problem to add it to core.</p> <p><em>Q. Why do you need to bind methods to an object of the same original module?</em> If you bind a method taken from String class to Array class, it will crash, and we need to prevent it.</p> <p><em>Q. What do you think of Ruby.NET?</em> I&#8217;m pretty open to new implementations. <em>Should there be a standard (language specs) that other projects should follow?</em> <a href="http://headius.blogspot.com">Charles</a> started work for a <a href="http://www.headius.com/rubyspec/">written 1.8 spec</a>, and I&#8217;ll help him with that if I have time.</p> Nick Sieger urn:uuid:0b5efe1d-0753-4dff-8919-0727d6672893 2006-10-24T22:51:55+00:00 2007-08-31T16:33:24+00:00 Rubyconf Wrap-Up <p>Whew! Back home from my first RubyConf, it&#8217;s taken me a couple days to collect some parting thoughts. As you might have noticed, I was <a href="/articles/tag/rubyconf2006">pretty busy last weekend</a>.</p> <p>First of all, what an awesome and welcoming community. It&#8217;s going to sound clich&eacute;, but there are so many intelligent and motivated people walking around that you can&#8217;t help but be inspired to roll up your sleeves and get your hands dirty.</p> <p>There were definitely some high points for me. The beauty and power of the language, even after using it for almost two years, still amazes me. Pretty much every piece of code I saw, whether in a presentation or looking over someone&#8217;s shoulder, had a clear purpose and communicated its intent better than any general-purpose machine language I have seen. The simplicity of Evan&#8217;s new <a href="/articles/2006/10/20/rubyconf-sydney-and-rubinius">Ruby-in-ruby VM</a>, the syntax integration tricks of John&#8217;s <a href="/articles/2006/10/23/rubyconf-your-ruby-in-my-clr">RubyCLR</a> project, the forthcoming <a href="/articles/2006/10/21/rubyconf-mac-os-x-and-ruby">RubyOSA</a> APIs, and Geoffrey&#8217;s <a href="/articles/2006/10/20/rubyconf-graphics-with-ruby">graphics programs</a>, are all great testaments to Ruby&#8217;s power.</p> <p>There was an implementer&#8217;s summit on Friday night, which I attended (see also coverage <a href="http://tbray.org/ongoing/When/200x/2006/10/20/RubyConf">here</a> and <a href="http://on-ruby.blogspot.com/2006/10/rubyconf-2006-implementers-summit.html">here</a>). There are now at least 8 active implementations of Ruby (<a href="http://www.ruby-lang.org/">Ruby</a>, <a href="http://www.atdot.net/yarv/">Yarv</a>, <a href="http://www.jruby.org/">JRuby</a>, <a href="http://on-ruby.blogspot.com/2006/09/ruby-hacker-interview-kevin-tew.html">Cardinal</a>, <a href="http://blog.fallingsnow.net/rubinius/">Rubinius</a>, <a href="http://www.zenspider.com/Languages/Ruby/MetaRuby.html">MetaRuby</a>, <a href="http://plas.fit.qut.edu.au/Ruby.NET/">Ruby.NET</a>, <a href="http://wilcoding.xs4all.nl/wilco/IronRuby.aspx">IronRuby</a>), and two interop bridges (<a href="http://www.rubyclr.com/">RubyCLR</a> and <a href="http://www.rubycocoa.com/">RubyCocoa</a>)! The biggest news was that there are plans to revive the <a href="http://rubyforge.org/projects/rubytests">Ruby testing</a> project (formerly the Rubicon) and share as many tests as possible among the implementations.</p> <p><a href="http://www.forbiddenweb.org/topic/126213/index.html">RejectConf</a> was a huge success, due largely to the indefatigable <a href="http://nubyonrails.com/articles/2006/10/24/adam-keys-ussruby-sketch-from-rubyconf-2006">Adam</a> <a href="http://youtube.com/results?search_query=adamkeys&amp;search=Search">Keys</a>. <a href="http://blog.tewk.com/?p=88">Kevin Tew</a> has a decent wrap-up of the talks that occurred. <a href="http://headius.blogspot.com/">Charlie&#8217;s</a> demo of NetBeans in-place refactoring feature drew a couple oohs and ahs and even one f-bomb. <a href="http://blog.zenspider.com/archives/2006/10/heckle_another_rubyconf_hack.html">Heckle</a>, in time, should be an awesome tool as well. Big thanks to <a href="http://www.zenspider.com/">zenspider</a> for coordinating it. It&#8217;s destined to become an annual tradition. Perhaps the organizers of future RubyConfs could account for it in the budget?</p> <p>On a lighter note, there were quite a few humorous moments that kept popping up. A <a href="http://ni.hili.st/posts/pages/16">summary may read like a list</a> of inside jokes, so here&#8217;s some context. <strong>THAT GUY</strong> is a reference to a disclaimer in <a href="/articles/2006/10/21/rubyconf-zed-shaw-fuzzing">Zed&#8217;s talk</a> about the <a href="http://perl.plover.com/yak/presentation/samples/slide027.html">know-it-all guy who always pipes up during your talk</a> with skepticism. THAT GUY kept getting called out during the rest of the conference. Ani, the developer evangelist from Microsoft was pretty thick-skinned. She was heckled constantly about MS, Vista, and everything else, and still kept a smile on her face. And of course you already watched Adam&#8217;s one-act play, right?</p> <p>My note-taking streak wasn&#8217;t quite perfect; I didn&#8217;t take notes Kevin&#8217;s mkmf talk nor Rich&#8217;s talk about indi, and I slept in and missed Justin&#8217;s Streamlined talk. Also, the beer was flowing for RejectConf, and despite the quality summer of code talks, I was spent. Fortunately, you can fill in the blanks by following along with <a href="http://www.oreillynet.com/ruby/blog/2006/10/blogging_about_rubyconf_2006.html">Curt Hibbs</a> and the <a href="http://technorati.com/tags/rubyconf2006">rest of the blogosphere</a>. Thanks for tuning in, and I hope you got something worthwhile here. See you next year!</p> Nick Sieger urn:uuid:ec8eface-3fb9-477d-8ad8-e91e4c5c9a1d 2006-10-21T19:01:35+00:00 2007-08-31T16:50:36+00:00 RubyConf: Rinda in the Real World <p><em>Speaker: <a href="http://www.vanderburg.org/">Glenn Vanderburg</a></em></p> <p>Rinda is a distributed coordination system, by Masatoshi SEKI, based on work by David Gelernter (called Linda). It&#8217;s similar to JavaSpaces, but more in the Ruby spirit. It uses DRb for communication (also by Seki-san).</p> <p>There are several existing tutorials on Rinda, but none with a broad, real-world applicability. As Glenn started to go deeper with Rinda, flaws began to be exposed.</p> <h2>Rinda Basics</h2> <ul> <li>The <strong>TupleSpace</strong> is in the conceptual middle, as a bag of tuples &#8220;arrays&#8221;. Participants can write tuples into the space, or take them out (usually according to a set of conditions).</li> <li><strong>Tuples</strong> are usually requests to do some work by some unknown requester, or responses to that work.</li> <li>A <strong>RingServer</strong> is a broadcast/multicast lookup service for finding Rinda tuplespaces.</li> <li><strong>Templates</strong> are used to find tuples to take. <code>Template#match</code> requires that the tuples have the same length, and that all the non-nil elements are triple-equal (<code>===</code>).</li> <li>In practice arrays are always used in the <code>#take</code> and <code>#write</code> methods, and they&#8217;re implicitly converted to the appropriate object.</li> </ul> <h2>Protocol design</h2> <p>When you&#8217;re deciding what to store/read in the tuples, you&#8217;re essentially designing a communication protocol. So you need to take the extra precautions required as you would when designing any API or protocol, including documentation, evolution of changes, process workflow, etc.</p> <ul> <li><em>Parts of tuples:</em> command/request, identifiers, and associated parameters/data. Usually templates will match on the command, sometimes on the ID, but never on the data. </li> <li>Strings work well in tuples, because you can use Regexps to select them.</li> <li>Numbers work well, because you can match them with Ranges</li> <li>Symbols don&#8217;t work so well (at least until <a href="http://redhanded.hobix.com/inspect/SymbolIs_aString.html"><code>Symbol &lt; String</code></a>)</li> <li>Communication patterns &#8211; synchronous communication is not a good fit for a Rinda architecture (e.g., a request for status)</li> </ul> <h2>Deployment</h2> <p>DRb does not marshal code/behavior (unlike Java and RMI). This is a limitation that forces you to consider how to use custom objects in the tuples, because the code must be shared (and thus jointly upgraded) across all participants.</p> <p>Multiple processes are probably more reliable for the various components of the architecture (RingServer, TupleSpace, clients) rather than using green threads, although this is just a hypothesis.</p> <p>The TupleSpace is the single point of failure &#8211; if the process with it crashes, when it starts back up, it&#8217;s likely to have a new DRb URL, so it&#8217;s helpful to have a proxy around the tuple space in clients that can rediscover it if it crashes.</p> <p>Be wary of multiple ring servers on the same subnet! Behavior may be unexpected. You may notbe using the tuple space that you wanted, and when the other ring server goes away, so does your tuple space.</p> <p>DRb does not have any security built into it, such as unforgeable object IDs, encrypted transport, authentication, etc. This can be a problem in some situations.</p> <p>There is no persistence by default, so consider adding some for crash resistance, or deal with occasional loss of tuples.</p> <p>There are no transactions, so the requester will never know if it still processing or was lost.</p> <p>As Ruby matures and gains exposure, some libraries that have been good enough for a while may need reconsideration. As a case in point, Rinda and DRb haven&#8217;t been updated since February of 2004.</p> <h2>Q &amp; A</h2> <p><em>Q. Are write/take atomic?</em> Yes, if you timeout, the tuple will still be there. Two workers cannot get the same tuple.</p> <p><em>Q. Where would you use this instead of traditional message queues (reinvent the wheel)?</em> There&#8217;s more flexibility in this architecture. (Justin Gehtland) In this particular case, they have a JMS backend, but the Ruby code could not assume connectivity to that backend.</p> <p><em>Q. Is there a common correlator design pattern?</em> Tie response types to request types to limit the pool of potential matches. In the situation where there is a single requester, it&#8217;s simple to just generate sequential numbers. In a P2P situation, you may need to use a hostname or PID to help distinguish. [Sounds like a GUID/UUID system to me.]</p> <p><em>Q. Have you used expiry dates to grab abandoned tuples?</em> No, sounds like an interesting possibility.</p> Nick Sieger urn:uuid:b565842e-e6dc-4ddf-bc06-69de35a90870 2006-10-23T14:16:00+00:00 2007-08-31T16:50:37+00:00 RubyConf: Your Ruby in My CLR <p><strong>John Lam</strong> wanted to build a photo-flash-card application using Avalon and Indigo and Flickr, but also using Ruby as the implementation language. So along the way he decided to build an interop layer (a bridge) between Ruby and the CLR to do it.</p> <p>Now that John has <a href="http://www.iunknown.com/articles/2006/10/20/dynamic-languages-microsoft-and-me">joined Microsoft</a>, his new mission (bigger picture) is to further dynamic language implementations on the CLR.</p> <h2>Bridging type systems</h2> <ul> <li><p>Dynamic methods in the CLR allow you to do better than simply invoking the reflection API.</p> <pre><code>Ruby | C | CLR ============================================ shadow class | dynamic method | instance </code></pre></li> <li><p>Polymorphic inline caching &#8211; caching method dispatches on different call sites based on the assumption that types don&#8217;t change that often</p></li> <li>Generate shadow classes and method stubs using <code>const_missing</code> and <code>method_missing</code></li> <li>Overload resolution happens in the method shims (a one time cost) to choose, e.g., which constructor to use for <code>System::Collections::ArrayList.new</code></li> <li>Integration is done to make the CLR feel more Rubyish</li> </ul> <h2>Implementation</h2> <ul> <li><p>This changes identity (proxied object):</p> <pre><code>ArrayList.new.as(IEnumerable) </code></pre></li> <li><p>This is less Rubyish, but identity is preserved:</p> <pre><code>IEnumerable.get_enumerator(ArrayList.new) </code></pre></li> </ul> <p>There are trade-offs and warts to a bridge approach to Ruby integration on top of a platform such as the CLR: there is a need to inject artificial type information occasionally to be able to construct CLR objects (e.g., arrays &#8211; <code>Array.of(Int32).new(3)</code>). Generics are evil! Simple stuff doesn&#8217;t seem so bad: <code>List.of(Int32).new</code>, but there&#8217;s more pain to be had (see John for details). John also built a RubyInline-like implementation for the CLR languages too, to allow for getting things done (even if it&#8217;s dirty). Finally, method overloading is a problem, especially when there is no equivalent Ruby type &#8211; this gave way to <code>instance_shim</code> which is a sort of aliasing method that mixes in type metadata for use by the interop layer.</p> <p>On the other hand, there are many places where Ruby (even in bridged mode) can make the experience of developing on the CLR better. Implementing CLR interfaces is a feature that allows Ruby objects to cross to the CLR side, (e.g., adding IEnumerable to Ruby Array). Performance across the CLR boundary (marshalling data) is ~100 times slower than C#, but still fast (3 million calls/second). Huge benefits are gained from using DSLs in Ruby to help with the implementation of the interop layer. Also, RubyCLR allows mixing in methods into CLR types, so we can re-skin APIs that feel clunky in Ruby. This is really leveraging the power of Ruby in the best possible way.</p> <p>My take is that it looks like the RubyCLR project will probably not be seeing much further development, unless John finds a willing maintainer &#8211; but this is speculation, I haven&#8217;t confirmed with John. Yet, the problem of impedance matching between type systems is a recurring theme in the dynamic language arena, and so John&#8217;s work is valuable in helping us to understand this issue.</p> <h2>More Info</h2> <ul> <li><a href="http://www.rubyclr.com/">http://www.rubyclr.com/</a></li> <li><a href="http://www.iunknown.com/">http://www.iunknown.com/</a></li> </ul> Nick Sieger urn:uuid:0de6115d-57e6-482e-9c45-964a94088b5b 2006-10-20T19:04:00+00:00 2007-08-31T16:50:37+00:00 RubyConf 2006 Begins <p>The RubyConf room is filling up this morning. I&#8217;ll be doing my best to live-blog the conference here so stay tuned!</p> <p><a href="http://www.flickr.com/photos/nicksieger/274770531/" title="Photo Sharing"><img src="http://static.flickr.com/110/274770531_01f9ba4a44_m.jpg" width="240" height="160" alt="DSCF4909.JPG" /></a></p> <p><a href="http://www.flickr.com/photos/nicksieger/274770462/" title="Photo Sharing"><img src="http://static.flickr.com/79/274770462_957803fcd8_m.jpg" width="240" height="160" alt="DSCF4908.JPG" /></a></p> Nick Sieger urn:uuid:ef58cdca-f7a4-49f2-b428-968f05a58130 2006-10-20T19:06:00+00:00 2007-08-31T16:50:37+00:00 RubyConf: History of Ruby <p>Takahashi-san is here to present on the history of Ruby, an apparently thankless task, because none of the other original Rubyists are historians. Takahashi is the co-author of two Japanese books on Ruby, <em>Enjoy Ruby</em> and <em>Ruby Recipe Book</em>. He also has the &#8220;Takahashi method&#8221; of presentation named after him. His talk presented an informative timeline of Ruby, the details of which were a bit tricky to capture. If I transcribed anything erroneously, please let me know.</p> <h2>Pre-history age</h2> <ul> <li>Born 24th of February 1993. Without code! </li> <li>Matz and Keiju-san proposed the name first.</li> <li>Thus one of the philosophies of Ruby came to be &#8211; that the name of things matters. Matz: &#8220;I guess Ruby is cool&#8221;. Keiju: &#8220;I also like coral&#8221;. Matz: &#8220;oops&#8221;.</li> </ul> <h2>Ancient age</h2> <ul> <li>Ruby is in public &#8211; release 21 December 1995 &#8211; ruby-0.95.</li> <li>ruby-list ML was launched. First mail: ruby-0.95 test failed. Subsequently 3 versions of Ruby were released in two days.</li> <li>No CVS repository at the time. Anonymous CVS was to come in 1999.</li> <li>25 December 1996 &#8211; Ruby 1.0 released.</li> <li>1 July 1997: Matz announces that Netlab hired him to be a full-time Ruby developer.</li> <li>22 Septempber 1997: an article was published on Ruby &#8211; the first article on the web about Ruby.</li> <li>15 May 1998: RAA launched, maintained manually by Matz.</li> <li>7 December 1998: Ruby home page was in English, but very simple.</li> </ul> <h2>Middle</h2> <ul> <li>Ruby is spreading in Japan during this time. The community is growing around Japanese programming language designers and programmers who do not understand English. Finally they have a tool that they can embrace and establish their own opinions and choices.</li> <li>27 October 1999: Matz and Keiju&#8217;s book is published, the first Ruby book</li> <li>More Ruby books would follow in 2001-2002 (~20 books &#8211; a bubble). But the bubble popped in 2003.</li> <li>4 November 1999: Ruby workshop</li> <li>There were some Perl and Ruby/Perl conferences during this time also.</li> <li>26 May 2001: YARPC &#8211; Yet Another Ruby and Perl Conference</li> <li>9 August 2003: Lightweight language (LL) &#8211; lightweight language workshop (LL Saturday) in 2003. PHP, Perl, Ruby and Python were present. LL Weekend, LL Day and Night, and LL Ring would follow in 2004-2006.</li> <li>LL Ring: 300 attendees talking about LLs in a real boxing ring.</li> </ul> <h2>Modern</h2> <ul> <li>Ruby spreads outside of Japan</li> <li>16 Feb 2002 &#8211; ruby-talk ML surpasses ruby-list ML. </li> <li>ruby-talk was started in December of 1998, but the first posts are almost all Japanese authors writing in English.</li> <li>SunWorld in Februrary 1999 has an article entitled &#8220;New choices for scripting&#8221; including Ruby.</li> <li>February 2000: IBM Developerworks article on the &#8220;latest open source gem from Japan&#8221;.</li> <li>InformIT article by Matz also in 2000.</li> <li>15 December 2001: Programming Ruby by the Pragprogs (1st edition of the Pickaxe).</li> <li>RubyConf.new(2001)</li> <li>Ruby Kaigi &#8211; first Japanese Ruby conference didn&#8217;t happen until 2006, it turns out only because of a dinner of Japanese rubyists at RubyConf 2005 decided that it would be fun.</li> </ul> <h2>Contemporary</h2> <ul> <li>Rails age &#8211; the killer application for Ruby</li> <li>We all know what happened, so we&#8217;ll skip this part.</li> </ul> Nick Sieger urn:uuid:9785ffcc-1680-492c-8b42-6e9111cc85aa 2006-10-20T19:07:00+00:00 2007-08-31T16:50:37+00:00 RubyConf: Sydney and Rubinius <p><em>Update: Evan has posted code and has <a href="http://blog.fallingsnow.net/rubinius/">a page set up for the project</a>.</em> </p> <p>Evan Phoenix (nee Webb), of Seattle.rb, is presenting on Sydney and Rubinius, an experiment in improving the ruby interpreter. Sydney has died, and Rubinius has risen from its ashes, appropriately.</p> <h2>Why</h2> <ul> <li>Why would you write a new Ruby interpreter? It&#8217;s fun, it&#8217;s a good challenge.</li> <li>What&#8217;s wrong with the existing interpreter &#8211; are you hating on Matz? Of course not.</li> </ul> <p>Today&#8217;s Ruby interpreter is like a big dump truck &#8211; sometimes a little slow, but it works for us. YARV is like the red, shiny fire truck. Both big and complex. Rubinius, by comparison, is like a dune buggy. Fast, light, but you&#8217;re going to get sand in your eyes if you drive it a lot.</p> <p>The project, admittedly, is naive.</p> <ul> <li>Simple architecture and implementation.</li> <li>As little background magic as possible</li> <li>No opaque C backend</li> <li>Leverage axiom of simple == powerful</li> <li>Less magic means more introspection <ul> <li>More control for the developer</li> <li>Richer introspection: Backtrace, MethodTable objects</li> </ul></li> </ul> <h2>What was Sydney?</h2> <ul> <li>Giant patch to 1.8.2 that included reentrancy and thread-safety</li> <li>Turned out to be a major PITA</li> <li>CRuby uses a large number of C globals, references to which had to be tracked and fixed</li> </ul> <h2>Transition to Rubinius</h2> <ul> <li>Ruby borrowed a lot from Smalltalk, so why not try an implementation based on the same concepts?</li> <li>Prototype A ported the blue-book implementation to Ruby</li> <li>It worked and validated the basic concept and approach</li> <li>Prototype B took ideas from A but implemented a bytecode interpreter and compiler. Used RubyInline to access raw memory operations.</li> <li>At this time the goal emerged to have a translator which could take a prototype and bootstrap itself into C code.</li> <li>Prototype S was a manual translation of Prototype B into C code to make the implementation quicker.</li> <li>Prototype W was created to translate parts of Prototype B so that there is a maintainable core in Ruby code itself.</li> </ul> <h2>Questions</h2> <p><em>Q. Since you were starting over, could you use a platform-independent library to ease the process, such as APR?</em> Yes &#8211; currently using String and PointerArray from glib.</p> <p><em>Q. How is performance?</em> Too early to tell &#8211; I hope to know by the end of the conference. Prototype S became runnable and usable on the plane here.</p> <p><em>Q. Can you clarify the goal?</em> To create a Ruby interpreter in Ruby that can translate itself out into a C interpreter.</p> <p><em>Q. Have you figured out how to link in external libraries in a platform independent way?</em> No. My hope is that the decision will be made to write a common framework for translating to system calls, e.g., SWT.</p> <p><em>Q. Have you looked at PyPy? (similar project for Python)</em> Yes, and it&#8217;s f-in complicated. It worries me actually.</p> <p><em>Q. Could you have it generate backend code in another language/platform (Java bytecode, CLR)?</em> Yes, I certainly hope so, otherwise I&#8217;m wasting my time.</p> <p><em>Q. How will you add native thread support in a cross-platform way?</em> I hope I won&#8217;t have to, by leveraging external tools.</p> <p><em>Q. If you&#8217;re building a Ruby-to-C translator, why write a Ruby interpreter at all?</em> If I didn&#8217;t, what would I translate? You still need some core engine to translate. <em>Would it be a subset of Ruby?</em> Yes.</p> <p><em>Q. Looks very similar to Squeak, have you looked at Squeak code and talked to Squeak people?</em> Looked at code a lot, I&#8217;ve really stolen all of their ideas. I haven&#8217;t talked to the folks yet because I&#8217;m afraid they might laugh at me.</p> <h2>Resulting Works</h2> <ul> <li>SydneyParser: Used parser from Sydney and stole ParseTree&#8217;s algorithm for generating a sexp that represents the Ruby code.</li> <li>SegfaultProtection: detects a segfault in an extension, saves the Ruby interpreter, and raises a memory fault exception instead.</li> </ul> <h2>The Nitty Gritty (Red Pill)</h2> <ul> <li>All components separated by APIs for swappability</li> <li>Garbage collector: baker two-space copy collector, and a train GC</li> <li>Bytecode interpreter: small set of instructions driven by tests and need, so there are no extraneous operations</li> <li>Compiler: written completely in Ruby, using ParseTree and SexpProcessor. Intended to compile itself to be used as a base compiler for Prototype S.</li> </ul> <h2>Future</h2> <ul> <li>Other backends &#8211; Java, Smalltalk</li> </ul> <h2>More questions</h2> <p><em>Q. Worried about fragmentation?</em> Yes, but I really want to make it as compatible as possible with the current interpreter.</p> <p><em>Q. Rubinius bytecode compatibile with YARV?</em> No, but I hope to be able to write a bridge to YARV in Rubinius.</p> <p><em>Q. Have you looked at Valgrind for the C code?</em> Yes, I have. Good possibility for future direction.</p> <p><em>Q. Can you demo some code?</em> They&#8217;re incredibly boring. &#8220;Look I got a MethodTable object, I asked for one.&#8221;</p> Nick Sieger urn:uuid:c4cb7cde-ff0f-4760-aefe-71d6461b89b3 2006-10-20T20:18:00+00:00 2007-08-31T16:50:37+00:00 RubyConf: Graphics with Ruby <p>Geoff Grosenbach is waxing on pagefuls of numbers condensed into a small, tidy graph that increases the amount of information you can communicate on a page.</p> <p><a href="http://www.flickr.com/photos/nicksieger/279242427/" title="Photo Sharing"><img src="http://static.flickr.com/107/279242427_32770c5081_m.jpg" width="240" height="160" alt="Topfunky fox" /></a><br/> <em>The cartoon fox makes his second appearance of the day in one of Geoff&#8217;s sparklines</em></p> <p>It is in our hands, the hands of the programmer, to show designers what the range of visual representation capabilities are.</p> <h2>Libraries</h2> <ul> <li>Scruffy &#8211; SVG graphs, no dependencies (i.e., RMagick)</li> <li>GNUPlot &#8211; the old standby</li> <li>MRPlot &#8211; scientific plots</li> <li>PNG &#8211; line and font drawing in pure ruby from Seattle.rb</li> <li>Gruff &#8211; depends on RMagick</li> <li>Sparklines &#8211; depends on RMagick</li> <li>[Ploticus and RRD were mentioned during the talk as well]</li> </ul> <h2>Applications</h2> <ul> <li>Automatically generating image mastheads with a font mask, a gradient and a cloud image showing through the mask</li> <li>UrbanDrinks.com &#8211; plotting bars on a timeline showing happy hours in Portland</li> <li>&#8220;Scene graph&#8221; &#8211; rendering multiple layers of images/icons on the filesystem into a composite graphics &#8220;scene&#8221;</li> <li>BillMonk.com &#8211; rendered image with multiple components that allows you to circumvent cross-site or crippled javascript issues</li> <li>In a Rails controller: <ul> <li>Generate and cache (with <code>caches_page</code>) an image with text</li> <li>Register a new mime type and use <code>responds_to {|type| type.jpg { ... } }</code></li> </ul></li> <li>Requisite reference to Edward Tufte</li> </ul> <h2>Techniques</h2> <ul> <li>Comparisons &#8211; show two competing trendlines on a graph</li> <li>Multivariate analysis &#8211; stockhive.com stock chart rendering</li> <li>Content is king &#8211; be judicious</li> </ul> Nick Sieger urn:uuid:14460f4d-1fbb-4a14-b91b-7ed22d4e7973 2006-10-21T02:51:38+00:00 2007-08-31T16:50:38+00:00 RubyConf: Zed Shaw: Fuzzing <h2>What is Fuzzing?</h2> <ul> <li>Throw random stuff at an app until it breaks, with maliciously crafted inputs. It&#8217;s the randomness, stupid.</li> <li>Creating a model for an attack</li> <li>Sampling, survival analysis and mean-time-between-failures (MTBF)</li> </ul> <h2>Limitations</h2> <ul> <li>Shallow &#8211; errors come right away, but then few and far between</li> <li>Not smart</li> <li>Not always needed</li> </ul> <h2>Disadvantages</h2> <ul> <li>Destructive &#8211; don&#8217;t do it against your production system!</li> <li>Potentially expensive</li> </ul> <h2>Advantages</h2> <ul> <li>Fun making developers go insane</li> <li>Finds bugs even in closed source software</li> <li>Easy to do when you have the right tools</li> <li>Excellent for regression/load/DDOS/pen testing</li> <li>Large existing base of tools (links from Zed&#8217;s site)</li> </ul> <h2>Demo/Usage</h2> <ul> <li>Designed to be a simple data container for all the HTTP objects, so you can easily store and replay requests</li> <li>Randomness engine (RC4 cipher) generates random bytes, numbers, chars, base64, etc.</li> <li>Data collection (ten runs of ten samples, spits out .csv files)</li> <li>Session management (dump cookie management)</li> <li>Rails security test (see also <a href="/articles/2006/08/15/security-threat-last-week">my post on this subject</a>)</li> <li>Chunked encoding test</li> <li>Mongrel test suite &#8211; test GET vs. PUT to see if there is any difference in performance between the two methods</li> </ul> <h2>Other Ideas</h2> <ul> <li>Random ruby scripts from a grammar</li> <li>Automatic random AR fixtures</li> <li>Thrash functions for unit tests</li> <li>Random thrashing of other protocols</li> <li>Release RFuzz&#8217;s HTTP client separately as an alternative to <code>net/http</code></li> <li>Hpricot and RWB inclusion</li> <li><a href="http://utu.devjavu.com/">Utu</a> &#8211; HCI research to see if it&#8217;s possible to measure how programmers interact</li> </ul> Nick Sieger urn:uuid:c4baea74-8073-49c0-be1e-97919ce5fb65 2006-10-21T02:54:00+00:00 2007-08-31T16:50:38+00:00 RubyConf: John Long: Radiant CMS <h2>What is Radiant?</h2> <ul> <li>No-fluff, lightweight CMS for small teams</li> <li>Simplicity over features</li> <li>A little more than a blogging engine</li> <li>Made for designers and programmers (techies)</li> <li>Tag-based template language</li> <li>Total control over output</li> <li>Plugin extension mechanism under development</li> <li>Content sites, not portal software</li> </ul> <h2>Getting Started</h2> <ul> <li>Install: <code>gem install radiant</code></li> <li>Generate a new application: <code>mkdir demo &amp;&amp; cd demo &amp;&amp; radiant .</code></li> <li>Configure database: <code>cp config/database.sqlite.yml config/database.yml</code></li> </ul> <h2>Installation types</h2> <ul> <li>Instance mode vs. application mode (whether or not you have Rails source present). Instance mode also makes it possible to clone and share customize Radiant applications.</li> <li>Base application includes an admin interface</li> </ul> <h2>Pages, Snippets and Layouts</h2> <ul> <li>Hierarchical page management</li> <li>Create page in several states (draft, reviewed, published) in Textile or Markdown with slug, breadcrumb, and layout</li> <li>Snippets are small chunks of content that can be shared between pages (to DRY up your content)</li> <li>Layouts that can be broken down into components of the layout (sidebar, etc.)</li> </ul> <h2>Tags</h2> <ul> <li><a href="http://radius.rubyforge.org/">Radius</a></li> <li><code>&lt;r:title/&gt;</code>, <code>&lt;r:content part="sidebar" inherit="true"/&gt;</code>, <code>&lt;r:snippet name="footer"/&gt;</code>, <code>&lt;r:if_content part="extended"&gt;...&lt;/r:if_content&gt;</code>, <code>&lt;r:children:each limit="5" order="desc"&gt;...&lt;/r:children:each&gt;</code></li> <li>Tags can be embedded anywhere, not just in the layout</li> <li>Tags are contextual &#8211; e.g., <code>&lt;r:title/&gt;</code> picks the correct title even if it is embedded within a snippet within multiple pages</li> <li>Custom tags possible with &#8220;behavior&#8221;</li> </ul> <h2>Text Filters</h2> <ul> <li>Textile (RedCloth), Markdown (BlueCloth), SmartyPants</li> <li>Vanilla HTML (no filtering)</li> <li>Custom filters possible. [This is my own example below, not John&#8217;s.] <div class="typocode"><pre><code class="typocode_ruby "> <span class="keyword">class </span><span class="class">MyFilter</span> <span class="punct">&lt;</span> <span class="constant">TextFilter</span><span class="punct">::</span><span class="constant">Base</span> <span class="ident">register</span> <span class="punct">'</span><span class="string">profanity filter</span><span class="punct">'</span> <span class="keyword">def </span><span class="method">filter</span><span class="punct">(</span><span class="ident">txt</span><span class="punct">)</span> <span class="ident">txt</span><span class="punct">.</span><span class="ident">gsub</span><span class="punct">(/</span><span class="regex">(damn|ass|shit)</span><span class="punct">/</span><span class="ident">i</span><span class="punct">,</span> <span class="punct">'</span><span class="string">####</span><span class="punct">')</span> <span class="keyword">end</span> <span class="keyword">end</span> </code></pre></div></li> </ul> <p>Radiant is powering the new <a href="http://www.ruby-lang.org/">ruby-lang.org</a> site. Overall, a slick, well-thought out, polished, extendable CMS done very much in the philosophy of Ruby and Rails. Check it out!</p>