• Playing with Processing, Making Snow

    by Dan

    What is Processing?

    "Processing is an open source programming language and environment for people who want to program images, animation, and interactions."
    -Processing.org

    I wanted to play around with doing some visual programming and had played with Processing in the past. I recently had been reading about Ruby-Processing and wanted to give it a shot. First, I went to look for some Ruby-Processing tutorials, and I had recently heard about the presentation by Jeff Casimir about the 'Art of Code' (slides and code), using Ruby-Processing. I went through those examples and decided I wanted to modify it to display snowflakes in the spirit of winter. After a bit of searching I found a project that generated a Penrose snow flake using Ruby-Processing. I figured I could modify the programs to get a nice snow flake screen saver type app. The result is my app Processing-Snow, and is shown in the screen shot below.

    Processing-Snow

    Processing-Snow

    Playing around with Ruby-Processing is a lot of fun, I highly recommend spending a couple hours to make a tiny app. I built my Snow app in about an hour and a half. Then I spent a bit of time using Caliper to improve the metrics. For such a small project there wasn't a lot to improve, but it still helped me to do some refactoring. To get an idea of the code you can view Processing-Snow's Metrics.

    Feel free to fork Processing-Snow on GitHub and read about how to run it with in the projectss README.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on December 23rd, 2009 by Dan in Hacking, Misc, Ruby.

  • Announcing Caliper Community Statistics

    by Ben

    For the past few months, we've been building Caliper to help you easily generate code metrics for your Ruby projects. We've recently added another dimension of metrics information: community statistics for all the Ruby projects that are currently in Caliper.

    The idea of community statistics is two-fold. From a practical perspective, you can now compare your project's metrics to the community. For example, Flog measures the complexity of methods. Many people wonder exactly defines a good Flog score for an individual method. In Jake Scruggs' opinion, a score of 0-10 is "Awesome", while a score of 11-20 is "Good enough". That sounds correct, but with Caliper's community metrics, we can also compare the average Flog scores for entire projects to see what defines a good average score.

    To do so, we calculate the average Flog method score for each project and plot those averages on a histogram, like so:

    flog_average_method_histogram

    Looking at the data, we see that a lot of projects have an average Flog score between 6 and 12 (the mean is 10.3 and the max is is 21.3).

    If your project's average Flog score is 9, does that mean it has only "Awesome" methods, Flog-wise? Well, remember that we're looking at the average score for each project. I suspect that in most projects, lots of tiny methods are pulling down the average, but there are still plenty of big, nasty methods. It would be interesting to look at the community statistics for maximum Flog score per project or see a histogram of the Flog scores for all methods across all projects (watch this space!).

    Since several of the metrics (like Reek, which detects code smells) have scores that grow in proportion to the number of lines of code, we divide the raw score by each project's lines of code. As a result, we can sensibly compare your project to other projects, no matter what the difference in size.

    The second reason we're calculating community statistics is so we can discover trends across the Ruby community. For example, we can compare the ratio of lines of application code to test code. It's interesting to note that a significant portion of projects in Caliper have no tests, but that, for the projects that do have tests, most of them have a code:test ratio in the neighborhood of 2:1.

    code_to_test_ratio_histogram

    Other interesting observations from our initial analysis:
    * A lot of projects (mostly small ones) have no Flay duplications.
    * Many smaller projects have no Reek smells, but the average project has about 1 smell per 9 lines of code.

    Want to do your own analysis? We've built a scatter plotter so you can see if any two metrics have any correlation. For instance, note the correlation between code complexity and code smells.

    Here's a scatter plot of that data (zoomed in):

    scatter_plot

    Over the coming weeks, we'll improve the graphs we have and add new graphs that expose interesting trends. But we need your help! Please let us know if you spot problems, have ideas for new graphs, or have any questions. Additionally, please add your project to Caliper so it can be included in our community statistics. Finally, feel free to grab the raw stats from our alpha API* and play around yourself!

    * Quick summary: curl http://api.devver.net/metrics for JSON, curl -H 'Accept:text/x-yaml' http://api.devver.net/metrics for YAML. More details. API is under development, so please send us feedback!

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on November 19th, 2009 by Ben in Development, Ruby, Tools and tagged , .

  • Improving Code using Metric_fu

    by Dan

    Often, when people see code metrics they think, "that is interesting, I don't know what to do with it." I think metrics are great, but when you can really use them to improve your project's code, that makes them even more valuable. metric_fu provides a bunch of great metric information, which can be very useful. But if you don't know what parts of it are actionable it's merely interesting instead of useful.

    One thing when looking at code metrics to keep in mind is that a single metric may not be as interesting. If you look at a metric trends over time it might help give you more meaningful information. Showing this trending information is one of our goals with Caliper. Metrics can be your friend watching over the project and like having a second set of eyes on how the code is progressing, alerting you to problem areas before they get out of control. Working with code over time, it can be hard to keep everything in your head (I know I can't). As the size of the code base increases it can be difficult to keep track of all the places where duplication or complexity is building up in the code. Addressing the problem areas as they are revealed by code metrics can keep them from getting out of hand, making future additions to the code easier.

    I want to show how metrics can drive changes and improve the code base by working on a real project. I figured there was no better place to look than pointing metric_fu at our own devver.net website source and fixing up some of the most notable problem areas. We have had our backend code under metric_fu for awhile, but hadn't been following the metrics on our Merb code. This, along with some spiked features that ended up turning into Caliper, led to some areas getting a little out of control.

    Flay Score before cleanup

    When going through metric_fu the first thing I wanted to start to work on was making the code a bit more DRY. The team and I were starting to notice a bit more duplication in the code than we liked. I brought up the Flay results for code duplication and found that four databases models shared some of the same methods.

    Flay highlighted the duplication. Since we are planning on making some changes to how we handle timestamps soon, it seemed like a good place to start cleaning up. Below are the methods that existed in all four models. A third method 'update_time' existed in two of the four models.

     def self.pad_num(number, max_digits = 15)
        "%%0%di" % max_digits % number.to_i
      end
    
      def get_time
          Time.at(self.time.to_i)
      end
    

    Nearly all of our DB tables store time in a way that can be sorted with SimpleDB queries. We wanted to change our time to be stored as UTC in the ISO 8601 format. Before changing to the ISO format, it was easy to pull these methods into a helper module and include it in all the database models.

    module TimeHelper
    
      module ClassMethods
        def pad_num(number, max_digits = 15)
          "%%0%di" % max_digits % number.to_i
        end
      end
    
      def get_time
          Time.at(self.time.to_i)
      end
    
      def update_time
        self.time = self.class.pad_num(Time.now.to_i)
      end
    
    end
    

    Besides reducing the duplication across the DB models, it also made it much easier to include another time method update_time, which was in two of the DB models. This consolidated all the DB time logic into one file, so changing the time format to UTC ISO 8601 will be a snap. While this is a trivial example of a obvious refactoring it is easy to see how helper methods can often end up duplicated across classes. Flay can come in really handy at pointing out duplication that over time that can occur.

    Flog gives a score showing how complex the measured code is. The higher the score the greater the complexity. The more complex code is the harder it is to read and it likely contains higher defect density. After removing some duplication from the DB models I found our worst database model based on Flog scores was our MetricsData model. It included an incredibly bad high flog score of 149 for a single method.

    File Total score Methods Average score Highest score
    /lib/sdb/metrics_data.rb 327 12 27 149

    The method in question was extract_data_from_yaml, and after a little refactoring it was easy to make extract_data_from_yaml drop from a score of 149 to a series of smaller methods with the largest score being extract_flog_data! (33.6). The method was doing too much work and was frequently being changed. The method was extracting the data from 6 different metric tools and creating summary of the data.

    The method went from a sprawling 42 lines of code to a cleaner and smaller method of 10 lines and a collection of helper methods that look something like the below code:

      def self.extract_data_from_yaml(yml_metrics_data)
        metrics_data = Hash.new {|hash, key| hash[key] = {}}
        extract_flog_data!(metrics_data, yml_metrics_data)
        extract_flay_data!(metrics_data, yml_metrics_data)
        extract_reek_data!(metrics_data, yml_metrics_data)
        extract_roodi_data!(metrics_data, yml_metrics_data)
        extract_saikuro_data!(metrics_data, yml_metrics_data)
        extract_churn_data!(metrics_data, yml_metrics_data)
        metrics_data
      end
    
      def self.extract_flog_data!(metrics_data, yml_metrics_data)
        metrics_data[:flog][:description] = 'measures code complexity'
        metrics_data[:flog]["average method score"] = Devver::Maybe(yml_metrics_data)[:flog][:average].value(N_A)
        metrics_data[:flog]["total score"]   = Devver::Maybe(yml_metrics_data)[:flog][:total].value(N_A)
        metrics_data[:flog]["worst file"] = Devver::Maybe(yml_metrics_data)[:flog][:pages].first[:path].fmap {|x| Pathname.new(x)}.value(N_A)
      end
    

    Churn gives you an idea of files that might be in need of a refactoring. Often if a file is changing a lot it means that the code is doing too much, and would be more stable and reliable if broken up into smaller components. Looking through our churn results, it looks like we might need another layout to accommodate some of the different styles on the site. Another thing that jumps out is that both the TestStats and Caliper controller have fairly high churn. The Caliper controller has been growing fairly large as it has been doing double duty for user facing features and admin features, which should be split up. TestStats is admin controller code that also has been growing in size and should be split up into more isolated cases.

    churn results

    Churn gave me an idea of where might be worth focusing my effort. Diving in to the other metrics made it clear that the Caliper controller needed some attention.

    The Flog, Reek, and Roodi Scores for Caliper Controller:

    File Total score Methods Average score Highest score
    /app/controllers/caliper.rb 214 14 15 42

    reek before cleanup

    Roodi Report
    app/controllers/caliper.rb:34 - Method name "index" has a cyclomatic complexity is 14.  It should be 8 or less.
    app/controllers/caliper.rb:38 - Rescue block should not be empty.
    app/controllers/caliper.rb:51 - Rescue block should not be empty.
    app/controllers/caliper.rb:77 - Rescue block should not be empty.
    app/controllers/caliper.rb:113 - Rescue block should not be empty.
    app/controllers/caliper.rb:149 - Rescue block should not be empty.
    app/controllers/caliper.rb:34 - Method name "index" has 36 lines.  It should have 20 or less.
    
    Found 7 errors.
    

    Roodi and Reek both tell you about design and readability problems in your code. The screenshot of our Reek 'code smells' in the Caliper controller should show how it had gotten out of hand. The code smells filled an entire browser page! Roodi similarly had many complaints about the Caliper controller. Flog was also showing the file was getting a bit more complex than it should be. After picking off some of the worst Roodi and Reek complaints and splitting up methods with high Flog scores, the code had become easily readable and understandable at a glance. In fact I nearly cut the Reek complaints in half for the controller.

    Reek after cleanup

    Refactoring one controller, which had been quickly hacked together and growing out of control, brought it from a dizzying 203 LOC to 138 LOC. The metrics drove me to refactor long methods (52 LOC => 3 methods the largest being 23 LOC), rename unclear variable names (s => stat, p => project), move some helpers methods out of the controller into the helper class where they belong. Yes, all these refactorings and good code designs can be done without metrics, but it can be easy to overlook bad code smells when they start small, metrics can give you an early warning that a section of code is becoming unmanageable and likely prone to higher defect rates. The smaller file was a huge improvement in terms of cyclomatic complexity, LOC, code duplication, and more importantly, readability.

    Obviously I think code metrics are cool, and that your projects can be improved by paying attention to them as part of the development lifecycle. I wrote about metric_fu so that anyone can try these metrics out on their projects. I think metric_fu is awesome, and my interest in Ruby tools is part of what drove us to build Caliper, which is really the easiest way try out metrics for your project. Currently, you can think of it as hosted metric_fu, but we are hoping to go even further and make the metrics clearly actionable to users.

    In the end, yep, this is a bit of a plug for a product I helped build, but it is really because I think code metrics can be a great tool to help anyone with their development. So submit your repo in and give Caliper hosted Ruby metrics a shot. We are trying to make metrics more actionable and useful for all Ruby developers out, so we would love to here from you with any ideas about how to improve Caliper, please contact us.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on October 27th, 2009 by Dan in Development, Devver, Hacking, Misc, Ruby, Testing, Tools and tagged , , , , , .

  • A Dozen (or so) Ways to Start Subprocesses in Ruby: Part 3

    by Avdi

    In part 1 and part 2 of this series, we took a look at some of Ruby's built-in ways to start subprocesses. In this article we'll branch out a bit, and examine some of the tools available to us in Ruby's Standard Library. In the process, we'll demonstrate some lesser-known libraries.

    Helpers

    First, though, let's recap some of our boilerplate code. Here's the preamble code which is common to all of the demonstrations in this article:

    require 'rbconfig'
    
    $stdout.sync = true
    
    def hello(source, expect_input)
      puts "[child] Hello from #{source}"
      if expect_input
        puts "[child] Standard input contains: \"#{$stdin.readline.chomp}\""
      else
        puts "[child] No stdin, or stdin is same as parent's"
      end
      $stderr.puts "[child] Hello, standard error"
      puts "[child] DONE"
    end
    
    THIS_FILE = File.expand_path(__FILE__)
    
    RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
    

    #hello is the method which we will be calling in a Ruby subprocess. It reads some text from STDIN and writes to both STDOUT and STDERR.

    THIS_FILE and RUBY contain full paths for the demo source file and the the Ruby interpreter, respectively.

    Method #6: Open3

    The Open3 library defines a single method, Open3#popen3(). #popen3() behaves similarly to the Kernel#popen() method we encountered in part 2. If you remember from that article, one drawback to the #popen() method was that it did not give us a way to capture the child process' STDERR stream. Open3#popen3() addresses this deficiency.

    Open3#popen3() is used very similarly to Kernel#popen() (or Kernel#open() with a '|' argument). The difference is that in addition to STDIN and STDOUT handles, popen3() yields a STDERR handle as well.

    puts "6. Open3"
    require 'open3'
    include Open3
    popen3(RUBY, '-r', THIS_FILE, '-e', 'hello("Open3", true)') do
      |stdin, stdout, stderr|
      stdin.write("hello from parent")
      stdin.close_write
      stdout.read.split("\n").each do |line|
        puts "[parent] stdout: #{line}"
      end
      stderr.read.split("\n").each do |line|
        puts "[parent] stderr: #{line}"
      end
    end
    puts "---"
    

    When we execute this code, the result shows that we have captured the subprocess' STDERR output:

    6. Open3
    [parent] stdout: [child] Hello from Open3
    [parent] stdout: [child] Standard input contains: "hello from parent"
    [parent] stdout: [child] DONE
    [parent] stderr: [child] Hello, standard error
    ---
    

    Method #7: PTY

    All of the methods we have considered up to this point have shared a common limitation: they are not very well-suited to interfacing with highly interactive subprocesses. They work well for "filter"-style commands, which read some input, produce some output, and then exit. But when used with interactive subprocesses which wait for input, produce some output, and then wait for more input (etc.), their use can result in deadlocks. In a typical deadlock scenario, the expected output is never produced because input is still stuck in the input buffer, and the program hangs forever as a result. This is why, in previous examples, we have been careful to call #close_write on subprocess input handles before reading any output.

    Ruby ships with a little-known and poorly-documented standard library called "pty". The pty library is an interface to BSD pty devices. What is a pty device? In BSD-influenced UNIXen, such as Linux or OS X, a pty is a "pseudoterminal". In other words, it's a terminal device that isn't attached to a physical terminal. If you've used a terminal program in Linux or OS X, you've probably used a pty without realizing it. GUI Terminal emulators, such as xterm, GNOME Terminal, and Terminal.app often use a pty device behind the scenes to communicate with the OS.

    What does this mean for us? It means if we're running Ruby on UNIX, we have the ability to start our subprocesses inside a virtual terminal. We can then read from and write to that terminal as if our program were a user sitting in front of a terminal, typing in commands and reading responses.

    Here's how it's used:

    puts "7. PTY"
    require 'pty'
    PTY.spawn(RUBY, '-r', THIS_FILE, '-e', 'hello("PTY", true)') do
      |output, input, pid|
      input.write("hello from parent\n")
      buffer = ""
      output.readpartial(1024, buffer) until buffer =~ /DONE/
      buffer.split("\n").each do |line|
        puts "[parent] output: #{line}"
      end
    end
    puts "---"
    

    And here is the output:

    7. PTY
    [parent] output: [child] Hello from PTY
    [parent] output: hello from parent
    [parent] output: [child] Standard input contains: "hello from parent"
    [parent] output: [child] Hello, standard error
    [parent] output: [child] DONE
    ---
    

    There are a few of points to note about this code. First, we don't need to call #close_write or #flush on the process input handle. However, the newline at the end of "Hello from parent" is essential. By default, UNIX terminal devices buffer input until they see a newline. If we left off the newline, the subprocess would never finish waiting for input.

    Second, because the subprocess is running asynchronously and independently from the parent process, we have no way of knowing exactly when it has finished reading input and producing output of its own. We deal with this by buffering output until we see a marker ("DONE").

    Third, you may notice that "hello from parent" appears twice in the output - once as part of the parent process output, and once as part of the child output. That's because another default behaviour for UNIX terminals is to echo any input they receive back to the user. This is what enables you to see what you've just typed when working at the command line.

    You can alter these default terminal device behaviours using the Ruby "termios" gem.

    Note that both STDOUT and STDERR were captured in the subprocess output. From the perspective of the pty user, standard output and standard error streams are indistinguishable - it's all just output. That means using pty is probably the only way to run a subprocess and capture standard error and standard output interleaved in the same way we would see if we ran the process manually from a terminal window. Depending on the application, this may be a feature or a drawback.

    You can execute PTY.spawn() without a block, in which case it returns an array of output, input, and PID. If you choose to experiment with this style of calling PTY.spawn(), be aware that you may need to rescue the PTY::ChildExited exception, which is thrown whenever the child process finally exits.

    If you're interested in reading more code which uses the pty library, the Standard Library also includes a library called "expect.rb". expect.rb is a basic Ruby reimplementation of the classic "expect" utility written using pty.

    Method #8: Shell

    More obscure even than the pty library is Ruby's Shell library. Shell is, to my knowledge, totally undocumented and rarely used. Which is a shame, because it implements some interesting ideas.

    Shell is an attempt to emulate a basic UNIX-style shell environment as an internal DSL within Ruby. Shell commands become Ruby methods, command-line flags become method parameters, and IO redirection is accomplished via Ruby operators.

    Here's an invocation of our standard example subprocess using Shell:

    puts "8. Shell"
    require 'shell'
    Shell.def_system_command :ruby, RUBY
    shell = Shell.new
    input  = 'Hello from parent'
    process = shell.transact do
      echo(input) | ruby('-r', THIS_FILE, '-e', 'hello("shell.rb", true)')
    end
    output = process.to_s
    output.split("\n").each do |line|
      puts "[parent] output: #{line}"
    end
    puts "---"
    

    And here is the output:

    8. Shell
    [child] Hello, standard error
    [parent] output: [child] Hello from shell.rb
    [parent] output: [child] Standard input contains: "Hello from parent"
    [parent] output: [child] DONE
    ---
    

    We start by defining the Ruby executable as a shell command by calling Shell.def_system_command. Then we instantiate a new Shell object. We construct the subprocess within a Shell#transact block. To have the process read a string from the parent process, we set up a pipeline from the echo built-in command to the Ruby invocation. Finally, we ensure the process is finished and collect its output by calling #to_s on the transaction.

    Note that the child process' STDERR stream is shared with the parent, not captured as part of the process output.

    There is a lot going on here, and it's only a very basic example of Shell's capabilities. The Shell library contains many Ruby-friendly reimplementations of common UNIX userspace commands, and a lot of machinery for coordinating pipelines of concurrent processes. If your interest is piqued I recommend reading over the Shell source code and experimenting within IRB. A word of caution, however: the Shell library isn't maintained as far as I know, and I ran into a couple of outright bugs in the process of constructing the above example. It may not be suitable for use in production code.

    Conclusion

    In this article we've looked at three Ruby standard libraries for executing subprocesses. In the next and final article we'll examine some publicly available Rubygems that provide even more powerful tools for starting, stopping, and interacting with subprocesses within Ruby.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on October 12th, 2009 by Avdi in Development, Ruby and tagged , , , , , .

  • Lone Star Ruby Conf 2009 Wrapup Review

    by Dan

    I recently went to the Lone Star Ruby Conference (LSRC), in Austin TX. It was great to be able to put faces to many people I had interacted with in the Ruby community via blogs and twitter. I also got to meet Matz and briefly talk with him, which was cool. Meeting someone who created a language which is such a large part of your day to day life is just an interesting experience. I enjoyed LSRC, and just wanted to give a quick summary of some of the talks that I saw and enjoyed. This is by no means full coverage of the event, but hopefully sharing my experience with others is worth something. If you are interested in seeing any of the talks keep an eye out for Confreaks, they taped the event and many of the talks should be coming online soon.

    Dave Thomas
    Dave was the first speaker for LSRC, and it was a great way to kick off the event. Dave gave a talk about Ruby not being perfect and that is why he likes it. I have heard Dave speak before, and I always enjoy his talks. It isn't like you learn anything specific about Ruby development, but you learn about the Ruby community. Actually, Dave would say we are a collection of Ruby communities, and that having a collection of communities is a good thing. It was also interesting to hear Dave speak about the entire Zed, "Rails is a Ghetto" incident. Sometimes when you are angrily ranting around online, it is easy to forget that there are real people attached to things. Feelings can get hurt, and while Dave agrees there is some valid points in the post, I think it shows that it probably isn't a good way to go about fixing them. Dave really loves Ruby and the weird things you can do with the language and it shows.

    Glenn Vanderburg, Programming Intuition
    Glenn talked about phyical emotions tied to code, such as a sense of touch or smell. The talk generally just evoked memories of Paul Graham's "Hackers and Painters" in my head, in fact Glenn talked about PG during his talk. The best programmers talk about code as if they can see it. The talk explored ways to feel the code and react to it. It tried to promote the idea that it is OK to just have a gut reaction that some code is a bad way to do things, because we should sense the code. Glenn also played a video showing Bobby McFerrin teaching the audience the Pentatonic scale, which I really enjoyed.

    James Edward Gray II, Module Magic
    James visited Japan recently and went to a Ruby conference, and he really enjoyed it. About half his talk was why Japan is awesome... He then found little ways to tie this back into his talk about Ruby and Modules. It covered some interesting topics like load order that many people just don't know enough about, but use every day. Examples of the differences between include and extend. Modules are terrific at limiting scope, limit the scope of scary magic and keep it hidden away. I enjoyed talking with James a good amount through out the conference. I had never met him before LSRC, but I used to practice Ruby working on Ruby Quiz which he ran for a long time.

    James has his slides are up, Module Magic

    Fernand Galiana, R-House
    Fernand gave a really cool and demo heavy talk about home automation. He has a web front end that lets him interact with all his technology. His house tweets most of the events that it runs. The web interface has a iPhone front in, so he can, on the go, change the temperature or turn off lights. I have always been a real home automation geek. When I was growing up, my dad loved playing with an X-10 system that we had in the house. I am really interested in playing with some of this stuff when I have my own place, mostly looking at ways I could use it to cut waste on my energy usage.

    Mike Subelsky, Ruby for Startups: Battle Scars and Lessons Learned
    * You Ain't Gonna Need It (YAGNI), don't worry about being super scaling at the beginning...
    * Early days focus on learning more data about what your building and what your customers want concentrate on the first 80% solution.
    * Don't over build, over design, or over engineer.
    * Eventually plan to move everything out of your web request, build it so that it will be easy to do in the future, but it isn't worth doing at first. (delayed job, EM, etc)
    * Make careful use of concurrency, prefer processes communicating via messages (SQS etc...) If you are doing threading in your software EM is your friend.
    * Avoid touching your RDBMS when you are storing not critical data:
    - Storing large text blogs in S3, message across SQS, tons of logging SDB
    * Don't test all the time at the beginning, it gets in the way of exploration... Things that is mission critical maybe should be BDD as it will be the most stable and least likely to change part of your code

    Mike posted his slides on his blog, Ruby for Startups.

    Jeremy Hinegardner, Playing nice with others. -- Tools for mixed language environments

    Jeremy wanted to show how easy it is to use some code to make it easy to work with a system that uses multiple languages. He brought up that most projects in the room utilize more than one language. That it will be more common as systems grow in complexity. He looked at a lot of queues, key value stores, and cache-like layers that can be talked to by a variety of language. He then showed some code that would quickly demonstrate how easy it was to work with some of these tools. Extra points because he talked about Beanstalkd, which I personally think is really cool. I think nearly everyone is starting to look at work queues, messaging systems, and non standard databases for their project and this was a good overview of options that are out there.

    Yukihiro Matsumoto (Matz), Keynote and Q&A
    Matz gave a talk about why we, as a community, love Ruby. In this talk there weren't really any takeaways that were specifically about Ruby code but more about the community and why Ruby is fun. He spent a good amount of time talking about Quality Without A Name, QWAN. More interesting than the talk was the Q&A session. I thought the most interesting question was why Ruby isn't on Git yet. He said the teams doesn't have time to convert all the tools they use from SVN to git. He also mentioned that the git project tracking SVN is very close to the SVN master and is a good way to work on the Ruby code.

    Evan Light, TDD: More than just "testing"
    Evan first covered that the tools we as a community keep getting excited about aren't really what matters. What matters is TDD technique. After discussing why tools aren't as important for awhile, Evan began live coding with the audience. Something I thought was pretty impressive as it would be difficult to do. It made for a weird pair programming exercise with the entire audience trying to drive. Which sometimes worked well and sometimes lead to conflicting ideas / discussion (which made for interesting debate). It was over all a really interesting session, but it is hard to pull out specific tidbits of wisdom from the talk.

    Jake Scruggs, What's the Right Level of Testing?
    I have known of Jake for awhile from his work on the excellent Metric Fu gem. Jake explored what the right level of testing for a project is, from his experience on his last nine projects over the years. He explored what worked, what didn't and what sometimes works but only depending on the people and the project. I think it comes to this conclusion: what works for one project won't work for all projects. Having some testing and getting the team on a similar testing goal will make things much better. He also stressed the importance of metrics along with testing (really? From the metric-fu guy? Haha). If testing is old and broken, causing team backlash, low morale, and gridlock, it might be better to lessen the testing burden or throw away difficult to maintain tests. Getting rid of them and getting them out of the way, might be worth more than the value the tests were providing. In general he isn't big into view testing, he likes to avoid slow testing. He likes to have a small 'smoke screen' of integration tests, to help verify the system is all working together. In the end, what is the right level of testing for a project? The answer: what level of assurance does the given project really need? In a start-up you probably don't need a huge level of assurance, speed matters and market feedback matter more. If your building parts for a rocket or medical devices it is entirely different.

    I enjoyed this talk quite a bit, and it inspired me to fix our broken metric_fu setup and start tracking on projects metrics again. Jake also wrote a good roundup of LSRC

    Corey Donohoe @atmos, think simple
    Corey gave interesting quick little thoughts and ideas about how to stay productive, happy, learn more, do more, fail less, and keep things simple and interesting... Honestly with something like 120+ slides, I can't even begin to summarize this talk. I checked around and couldn't find his slides online, but they couldn't really do the talk justice anyways. Keep your eyes peeled for the video as it was a fun talk, which I enjoyed. Until then here is a post he made about heading to LSRC.

    Joseph Wilk, Outside-in development with Cucumber
    Cucumber is something I keep hearing and reading about, but haven't really gotten a chance to play with it myself. Joseph's talk was a good split between a quick intro to Cucumber, and diving in deeper to actually show testing examples and how it worked. From the talk it sounded to me like Cucumber was mostly a DSL to talk between the customer and the developer/tester. I don't know if that is how others would describe it. I thought Cucumber was an odd mix of English and and Ruby, but it helps effectively tell a story. Since returning form LSRC, I have started working on my first Cucumber test.

    Yehuda Katz, Bundler
    This was just a lightening talk about Bundler, which I had read about briefly online. Seeing the work that was done for this blew me away. I can honestly say I hope this takes over the Ruby world. We have been dealing with so many problems related to gems at Devver, and if Bundler becomes a standard, it would make the Ruby community a better place. I am really excited about this so go check out the Bundler project now.

    Rich Kilmer, Encoding Domains
    The final keynote of the event was about encoding domains. I didn't really know what to expect going into this talk, but I was happily surprised. Rich talked about really encapsulating a domain in Ruby and then being able to make the entire programming logic much simpler. He gave compelling examples of working with knowledge workers in the field and just writing code with them to express their domain of knowledge in Ruby code. Live coding with the domain with experts he jokingly called "syntax driven development" - you write code with them until it doesn't raise syntax errors. Rich spoke energetically and keep a tiring audience paying attention to his stories about projects he has worked on through out the years. Just hearing about people who have created successful projects who have been working with Ruby in the industry this long is interesting. I thought it had great little pieces of knowledge that were shared during the talk, but again this was a talk where it was to hard to pull out tiny bits of information, so I recommend looking for the video when it is released.

    Final Thoughts
    LSRC was a good time besides hearing all the speakers. In fact like most conferences some of the best knowledge sharing happened during breaks, at dinner, and in the evenings. It also gave me a chance to get to know some of the community better than just faceless Twitter avatars. It was fun to talk with Ruby people about things that had nothing to do with Ruby. I also am interested in possibly living in Austin at some point in my life so it was great to check it out a bit. Friday night after the conference I went out with a large group of Rubyists to Ruby's BBQ, which was delicious. We ate outside with good food, good conversation, and live music playing next door. As we were leaving someone pointed out that the guitarist playing next door was Jimmy Vaughn, brother of the even more famous Stevie Ray Vaughan. We went over to listen to the show and have a beer, which quickly changed into political speeches and cheers. Suddenly I realized we were at a libertarian political rally. I never expected to end up at a Texan political rally with a bunch of Rubyists, but I had a good time.

    Hopefully the next Ruby conference I attend with be as enjoyable as LSRC was, congrats to everyone who helped put the conference together and all those that attended the event and made it worth while.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on September 3rd, 2009 by Dan in Hacking, Misc, Ruby, Tips & Tricks.

  • Using Devver on OS X 10.6 “Snow Leopard”

    by Ben

    If you're trying to use Devver and you see this error:

    /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:302:in `start_tls': undefined method `set_tls_parms' for EventMachine:Module (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/lib/client/mod_client.rb:32:in `post_init'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:43:in `new'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:36:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:36:in `new'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:716:in `bind_connect'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:723:in `connect'
    from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/lib/client/client.rb:125:in `push_tests'
    from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/bin/devver:145
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in `call'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in `event_callback'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in `run_timers'
    from (eval):44:in `each'
    from (eval):44:in `each'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in `run_timers'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in `run'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in `loop'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in `run'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in `run_machine'
    from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run'
    from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/bin/devver:144
    from /usr/bin/devver:19:in `load'
    from /usr/bin/devver:19
    

    ... it's because EventMachine (and other compiled gems) may act a little funky after installing Apple's latest OS.

    In this post, I'll go through some steps that should help you resolve this error (... assuming you use MacPorts. If you don't, please tailor these directions accordingly). But first:

    • Warning: The directions below may leave your system in an unknown state. Please, please, please backup everything before going further. Time Machine is your friend!
    • Disclaimer: These steps worked for me, but I can't guarantee they'll work for you. If you have any problems, please let me know in the comments or email support@devver.net.
    • Note: If you already installed Devver before upgrading to Snow Leopard, things will likely continue to work fine for you for now - but these directions may be helpful when you upgrade Devver clients.

    OK, now that we've got that out of the way ...

    1. Upgrade MacPorts

    Try running something like port list installed. If you get an error like this:

    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found.  Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)
    

    You need to install the latest version of MacPorts. Go here and download the 'Snow Leopard' dmg and install.

    2. Reinstall openssl and ruby

    Now that MacPorts is installed, do this:

    sudo port sync
    sudo port upgrade openssl
    sudo port upgrade ruby
    

    You could also try sudo port upgrade ruby186 if you want Ruby 1.8.6, but I haven't tried this myself.

    3. Reinstall EventMachine

    sudo gem uninstall eventmachine
    sudo gem install eventmachine
    

    And you're done!

    Now you should be able to run Devver normally. If that didn't work, please let me know!

    Bonus: Reinstall other gems

    Matt Aimonetti has written a handy script (Update: here is my fork, with a new gem path an an important bug fix on line eight) that will find the gems you should reinstall once you've done the above steps. The only change you'll need to make is to replace the gem path:

    #Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
    Dir.glob('/opt/local/lib/ruby/gems/**/*.bundle').map do |path|
    

    For more info, you can find a great guide on resolving Ruby-related problems when upgrading to Snow Leopard at rubyonrails.org

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on September 3rd, 2009 by Ben in Ruby.

  • Announcing Devver as a Lone Star Ruby Conference Sponsor

    by Dan

    We are very happy to be a sponsor of LSRC. I am especially excited because that means I get to attend the event. I am looking forward to getting a chance to meet another Ruby community as I have never been to Austin Texas, and it seems like there are a lot of exciting things going on with the Ruby community. Find me and come by to talk about Ruby, testing, or Devver. Devver is also currently hiring, so if you are attending the conference and interested in highly distributed Ruby systems, definitely come talk to us. It is great to get to participate in events like these and spend time with the amazing Ruby community which is so supportive of new ideas, good code and testing, and startups.

    Check out some of the great things that will be going on at Lone Star Ruby Conf this year.

    I am particularly excited about:

    • Mike Subelsky: Ruby for Startups: Battle Scars and Lessons Learned
    • Larry Diehl: Dataflow: Declarative concurrency in Ruby
    • Ian Warshak: Rails in the Cloud
    • Jeremy Hinegardner: Playing nice with others. -- Tools for mixed language environments.
    • Evan Light: TDD: More than just "testing"
    • Jake Scruggs: What's the Right Level of Testing?
    • Corey Donohoe, atmos: think simple
    • Pradeep Elankumaran: Fast and Scalable Front/Back-end Services using Ruby and XMPP
    • Danny Blitz: Herding Tigers - Software and the Art of War
    • Looking forward to meeting everyone in Austin, shoot me an email at dan@devver.net or message me on twitter @danmayer so we can meet up at the conference in person.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on July 20th, 2009 by Dan in Devver, Ruby and tagged .

  • A command-line prompt with timeout and countdown

    by Avdi

    Have you ever started a long operation and walked away from the computer, and come back half an hour later only to find that the process is hung up waiting for some user input? It's a sub-optimal user experience, and in many cases it can be avoided by having the program choose a default if the user doesn't respond within a certain amount of time. One example of this UI technique in the wild is powering off your computer - most modern operating systems will pop up a dialogue to confirm or cancel the shutdown, with a countdown until the shutdown proceeds automatically.

    This article is about how to achieve the same effect in command-line programs using Ruby.

    Let's start with the end result. We want to be able to call our method like this:

    puts ask_with_countdown_to_default("Do you like pie?", 30.0, false)
    

    We pass in a question, a (possibly fractional) number of seconds to wait, and a default value. The method should prompt the user with the given question and a visual countdown. If the user types 'y' or 'n', it should immediately return true or false, respectively. Otherwise when the countdown expires it should return the default value.

    Here's a high-level implementation:

    def ask_with_countdown_to_default(question, seconds, default)
      with_unbuffered_input($stdin) do
        countdown_from(seconds) do |seconds_left|
          write_then_erase_prompt(question, seconds_left) do
            wait_for_input($stdin, seconds_left % 1) do
              case char = $stdin.getc
              when ?y, ?Y then return true
              when ?n, ?N then return false
              else                  # NOOP
              end
            end
          end
        end
      end
      return default
    ensure
      $stdout.puts
    end                             # ask_with_countdown_to_default
    

    Let's take it step-by-step.

    By default, *NIX terminals operate in "canonical mode", where they buffer a line of input internally and don't send it until the user hits RETURN. This is so that the user can do simple edits like backspacing and retyping a typo. This behavior is undesirable for our purposes, however, since we want the prompt to respond as soon as the user types a key. So we need to temporarily alter the terminal configuration.

      with_unbuffered_input($stdin) do
    

    We use the POSIX Termios library, via the ruby-termios gem, to accomplish this feat.

    def with_unbuffered_input(input = $stdin)
      old_attributes = Termios.tcgetattr(input)
      new_attributes = old_attributes.dup
      new_attributes.lflag &= ~Termios::ECHO
      new_attributes.lflag &= ~Termios::ICANON
      Termios::tcsetattr(input, Termios::TCSANOW, new_attributes)
    
      yield
    ensure
      Termios::tcsetattr(input, Termios::TCSANOW, old_attributes)
    end                             # with_unbuffered_input
    

    POSIX Termios defines a set of library calls for interacting with terminals. In our case, we want to disable some of the terminal's "local" features - functionality the terminal handles internally before sending input on to the controlling program.

    We start by getting a snapshot of the terminal's current configuration. Then we make a copy for our new configuration. We are interested in two flags: "ECHO" and "ICANON". The first, ECHO, controls whether the terminal displays characters that the user has types. The second controls canonical mode, which we explained above. After turning both flags off, we set the new configuration and yield. After the block is finished, or if an exception is raised, we ensure that the original terminal configuration is reinstated.

    Now we need to arrange for a countdown timer.

        countdown_from(seconds) do |seconds_left|
    

    Here's the implementation:

    def countdown_from(seconds_left)
      start_time   = Time.now
      end_time     = start_time + seconds_left
      begin
        yield(seconds_left)
        seconds_left = end_time - Time.now
      end while seconds_left > 0.0
    end                             # countdown_from
    

    First we calculate the wallclock time at which we should stop waiting. Then we begin looping, yielding the number of seconds left, and then when the block returns recalculating the number. We keep this up until the time has expired.

    Next up is writing, and re-writing, the prompt.

          write_then_erase_prompt(question, seconds_left) do
    

    This method is implemented as follows:

    def write_then_erase_prompt(question, seconds_left)
      prompt_format = "#{question} (y/n) (%2d)"
      prompt = prompt_format % seconds_left.to_i
      prompt_length = prompt.length
      $stdout.write(prompt)
      $stdout.flush
    
      yield
    
      $stdout.write("\b" * prompt_length)
      $stdout.flush
    end                             # write_then_erase_prompt
    

    We format and print a prompt, flushing the output to insure that it is displayed immediately. The prompt includes a count of the number of seconds remaining until the query times out. In order to make it a nice visually consistent length, we use a fixed-width field for the countdown ("%2d"). Note that we don't use puts to print the prompt - we don't want it to advance to the next line, because we want to be able to dynamically rewrite the prompt as the countdown proceeds.

    After we are done yielding to the block, we erase the prompt in preparation for the next cycle. In order to erase it we create and output string of backspaces ("\b") the same length as the prompt.

    Now we need a way to wait until the user types something, while still periodically updating the prompt.

            wait_for_input($stdin, seconds_left % 1) do
    

    We pass wait_for_input an input stream and a (potentially fractional) number of seconds to wait. In this case we only want to wait until the next second-long "tick" so that we can update the countdown. So we pass in the remainder of dividing seconds_left by 1. E.g. if seconds_left was 5.3, we would set a timeout of 0.3 seconds. After 3/10 of a second of waiting for input, the wait would time out, the prompt would be erased and rewritten to show 4 seconds remaining, and then we'd start waiting for input again.

    Here's the implementation of wait_for_input:

    def wait_for_input(input, timeout)
      # Wait until input is available
      if select([input], [], [], timeout)
        yield
      end
    end                             # wait_for_input
    

    We're using Kernel#select to do the waiting. The parameters to #select are a set of arrays - one each for input, output, and errors. We only care about input, so we pass the input stream in the first array and leave the others blank. We also pass how long to wait until timing out.

    If new input is detected, select returns an array of arrays, corresponding to the three arrays we passed in. If it times out while waiting, it returns nil. We use the return value to determine whether to execute the given block or note. If there is input waiting we yield to the block; otherwise we just return.

    While it takes some getting used to, handling IO timeouts with select is safer and more reliable than using the Timeout module. And it's less messy than rescuing Timeout::Error every time a read times out.

    Finally, we need to read and interpret the character the user types, if any.

              case char = $stdin.getc
              when ?y, ?Y then return true
              when ?n, ?N then return false
              else                  # NOOP
              end
    

    If the user types 'y' or 'n' (or uppercase versions of the same), we return true or false, respectively. Otherwise, we simply ignore any characters the user types. Typing characters other than 'y' or 'n' will cause the loop to be restarted.

    Note the use of character literals like ?y to compare against the integer character code returned by IO#getc. We could alternately use Integer#chr to convert the character codes into single-character strings, if we wanted.

    Wrapping up, we make sure to return the default value should the timeout expire without any user input; and we output a newline to move the cursor past our prompt.

      return default
    

    And there you have it; a yes/no prompt with a timeout and a visual countdown. Static text doesn't really capture the effect, so rather than include sample output I'll just suggest that you try the code out for yourself (sorry, Windows users, it's *NIX-only).

    Full source for this article at: http://gist.github.com/148765

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on July 16th, 2009 by Avdi in Ruby, Tips & Tricks and tagged , , , , .

  • A dozen (or so) ways to start sub-processes in Ruby: Part 2

    by Avdi

    In the previous article we looked at some basic methods for starting subprocesses in Ruby. One thing all those methods had in common was that they didn't permit a lot of communication between parent process and child. In this article we'll examine a few built-in Ruby methods which give us the ability to have a two-way conversation with our subprocesses.

    The complete source code for this article can be found at http://gist.github.com/146199.

    Method #4: Opening a pipe

    As you know, the Kernel#open method allows you to open files for reading and writing (and, with addition of the open-uri library, HTTP sockets as well). What you may not know is that Kernel.open can also open processes as if they were files.

      puts "4a. Kernel#open with |"
      cmd = %Q<|#{RUBY} -r#{THIS_FILE} -e 'hello("open(|)", true)'>
      open(cmd, 'w+') do |subprocess|
        subprocess.write("hello from parent")
        subprocess.close_write
        subprocess.read.split("\n").each do |l|
          puts "[parent] output: #{l}"
        end
        puts
      end
      puts "---"
    

    By passing a pipe ("|") as the first character in the command, we signal to open that we want to start a process, not open a file. For a command, we're starting another Ruby process and calling our trusty hello method (see the first article or the source code for this article for the definition of the hello method RUBY and THIS_FILE constants).

    open yields an IO object which enables us to communicate with the subprocess. Anything written to the object is piped to the process' STDIN, and the anything the process writes to its STDOUT can be read back as if reading from a file. In the example above we write a line to the child, read some text back from the child, and then end the block.

    Note the call to close_write on line 5. This call is important. Because the OS buffers input and output, it is possible to write to a subprocess, attempt to read back, and wait forever because the data is still sitting in the buffer. In addition, filter-style programs typically wait until they see an EOF on their STDIN to exit. By calling close_write, we cause the buffer to be flushed and an EOF to be sent. Once the subprocess exits, its output buffer wil be flushed and any read calls on the parent side will return.

    Also note that we pass "w+" as the file open mode. Just as with files, by default the IO object will be opened in read-only mode. If we want to both write to and read from it, we need to specify an appropriate mode.

    Here's the output of the above code:

    4a. Kernel#open with |
    [child] Hello, standard error
    [parent] output: [child] Hello from open(|)
    [parent] output: [child] Standard input contains: "hello from parent"
    
    ---
    

    Another way to open a command as an IO object is to call IO.popen:

      puts "4b. IO.popen"
      cmd = %Q<#{RUBY} -r#{THIS_FILE} -e 'hello("popen", true)'>
      IO.popen(cmd, 'w+') do |subprocess|
        subprocess.write("hello from parent")
        subprocess.close_write
        subprocess.read.split("\n").each do |l|
          puts "[parent] output: #{l}"
        end
        puts
      end
      puts "---"
    

    This behaves exactly the same as the Kernel#open version. Which way you choose to use is a matter of preference. The IO.popen version arguably makes it a little more obvious what is going on.

    Method #5: Forking to a pipe

    This is a variation on the previous technique. If Kernel#open is passed a pipe followed by a dash ("|-") as its first argument, it starts a forked subprocess. This is like the previous example except that instead of executing a command, it forks the running Ruby process into two processes.

      puts "5a. Kernel#open with |-"
      open("|-", "w+") do |subprocess|
        if subprocess.nil?             # child
          hello("open(|-)", true)
          exit
        else                        # parent
          subprocess.write("hello from parent")
          subprocess.close_write
          subprocess.read.split("\n").each do |l|
            puts "[parent] output: #{l}"
          end
          puts
        end
      end
      puts "---"
    

    Both processes then execute the given block. In the child process, the argument yielded to the block will be nil. In the parent, the block argument will be an IO object. As before, the IO object is tied to the forked process' standard input and standard output streams.

    Here's the output:

    5a. Kernel#open with |-
    [child] Hello, standard error
    [parent] output: [child] Hello from open(|-)
    [parent] output: [child] Standard input contains: "hello from parent"
    
    ---
    

    Once again, there is an IO.popen version which does the same thing:

      puts "5b. IO.popen with -"
      IO.popen("-", "w+") do |subprocess|
        if subprocess.nil?             # child
          hello("popen(-)", true)
          exit
        else                        # parent
          subprocess.write("hello from parent")
          subprocess.close_write
          subprocess.read.split("\n").each do |l|
            puts "[parent] output: #{l}"
          end
          puts
        end
      end
      puts "---"
    

    Applications and Caveats

    The techniques we've looked at in this article are best suited for "filter" style subprocesses, where we want to feed some input to a process and then use the output it produces. Because of the potential for deadlocks mentioned earlier, they are less suitable for running highly interactive subprocesses which require multiple reads and responses.

    open/popen also do not give us access to the subprocess' standard error (STDERR) stream. Any output error generated by the subprocesses will print the same place that the parent process' STDERR does.

    In the upcoming parts of the series we'll look at some libraries which overcome both of these limitations.

    Conclusion

    In this article we've explored two (or four, depending on how you count it) built-in ways of starting a subprocess and communicating with it as if it were a file. In part 3 we'll move away from built-ins and on to the facilities provided in Ruby's Standard Library for starting and controlling subprocesses.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on July 13th, 2009 by Avdi in Ruby, Tips & Tricks and tagged , .

  • Devver adds Postgres and SQLite database support

    by Dan

    We are working hard to quickly expand our compatibility on Ruby projects. With that goal driving us, we are happy to announce support for Postgres and SQLite databases. With the addition of these database options, along with our existing support for MySQL, Devver now supports all of the most popular databases commonly used with Ruby. These three databases are the default databases tested against ActiveRecord and we expect will cover the majority of the Ruby community.

    To begin working with Postgres or SQLite on Devver all you need to do is have a database.yml with the test environment set to the adapter of your choice. If we don't support your favorite database, you can still request a beta invite and let us know which database you want us to support. If we just added support for your database, perhaps we can speed up your project on Devver, so request a beta invite.

    Devver Caliper: Hosted metric_fu for your Ruby project.
    Get set up in under a minute

    Posted on July 6th, 2009 by Dan in Development, Devver, Ruby, Testing and tagged , , .