Talks
Lightning Talks
Mike Moore
@blowmage
Chris Shea
1 talk
6 more speakers
See all speakers
Summarized using AI

Lightning Talks

by Mike Moore, Chris Shea, Josh Susser, Jeremy McAnally, Andrew Shafer, David South, Tim Harper, and David Koontz

The video titled "Lightning Talks" from the MountainWest RubyConf 2008 features a series of short presentations by various speakers, discussing Ruby programming and its applications, focusing on innovative tools and methods for improving coding efficiency and project management. Here are the key points discussed in the presentations:

  • Binary Lottery Demonstration: Mike Moore describes a binary lottery application created with Shoes, which visually reveals a random winner by flickering ones and zeros on the screen. He explains how the application utilizes a YAML file for managing participants' data and implements an animation loop to enhance the reveal process.

  • Guess Method Plugin: Moore moves on to discuss a helpful plugin for the IRB console called 'guess method', which utilizes Levenshtein distance to correct typos or misspellings in method calls. It also showcases correct options if multiple close matches exist, aiding in the coding process, particularly during migrations and Rake task management.

  • Active Scaffold Overview: Josh Susser presents 'Active Scaffold', a plugin that builds scaffolding on top of database tables, facilitating CRUD operations in an AJAX setup. He emphasizes the need for community involvement to maintain and revitalize the project as active contributions are crucial for sustaining open-source projects.

  • Migration Concordance Plugin: Susser also introduces a plugin called 'Migration Concordance', which helps teams manage Rails migrations efficiently. It alerts users of any modifications to migrations, ensuring clarity and preventing conflicts during collaboration on development.

  • Puppet Automation Tool: Andrew Shafer discusses Puppet, an open-source tool for automating server management tasks. Shafer outlines how Puppet manages infrastructure configurations declaratively and handles dependencies among different components effectively, highlighting its flexibility and portability.

  • Monkey Bars GUI Library: David South concludes with a demonstration of the Monkey Bars library, which allows the creation of GUI applications using JRuby. South showcases how to generate a new app in just five minutes, emphasizing the ease of creating and compiling applications that can run on any device with Java support.

In conclusion, the speakers covered various tools and methodologies in Ruby programming, focusing on enhancing developer productivity and collaboration through innovative plugins and applications. They encouraged community engagement in projects to maintain growth and progress in open-source ventures.

00:00:20.960 Last year, I showed the binary lottery, but I didn't actually demonstrate it running, so those who watched the video didn't know what it does. For the sake of the video, I will run it again. This won't count for anything, so I'll go ahead and kick it off. I wrote it in Shoes this year because I didn't want to create another console application; I actually wanted to do something much fancier. However, I worked on this between 11 PM and 3 AM, so I'm not sure how good it is. As it runs, you will see a bunch of random flickering ones and zeros. With each key I press, we will reveal one more binary position for the number. After all eight bits have been revealed, we'll show who the winning person is. Unfortunately, you won't win anything this time.
00:01:13.360 This is pretty much exactly what we had last year. I've got a YAML file with everyone's name, which we pulled from Activa when you registered. We threw it into a spreadsheet, gave each person a sequential number, and converted that to an eight-digit binary number. I keep that in the YAML file, and then randomly choose one of these entries to be the winner. The app is all about the reveal, so we're not randomly flipping coins like we do with a real binary lottery.
00:01:39.520 This is how the implementation works. Please ignore the irrelevant parts for now. We're using YAML to manage our users, and I start by opening the YAML file. Then, I pick one user at random and ensure that I have a winner. I check that the 'eligible' field for that object is true, and then I start counting. This part is a bit clunky and I apologize for the hackiness, but it’s a Shoes application, and if you’ve ever looked at Shoes, this will feel familiar. On key press, I will just increment the count. Later on, I will animate everything else.
00:02:10.080 I create a stack that displays a paragraph saying, 'At the Mountain Ruby Conference, your winner is...' I struggled with the styling because I was really tired, so I hard-coded it. There’s also an empty paragraph for the winner's name, which is set to be fairly large. Then I have a flow of ones and zeros, which are randomized and displayed prominently. The animation loop runs 60 times a second; I'm updating each digit for my various paragraphs while passing in the current count and the position of the binary number I want to display. When the count reaches or exceeds eight, I replace the empty string in the winner's name paragraph with the winner’s actual name. Additionally, if the count exceeds eight, I change the color of the paragraph to red and mark that winner as ineligible.
00:03:48.160 I’ll save the YAML file, which means that if someone wins once, they cannot win again. In this case, if the winner's name was not marked as red, they did not get saved and they remain eligible to win again.
00:04:21.720 So, that's the binary lottery. Any questions? Great! Now, let me demonstrate a method I wrote for IRB called 'guess method.' It provides tab completion, which can be really useful. However, I don't always use it, as I think I can type faster. If you mistype something with 'guess method,' it will notify you and instead provide the correct object back, even for misspelled constants and methods. It uses the Levenshtein distance to determine if something is close enough; it’s a slightly modified weighting system that works better for typos.
00:05:11.160 If it finds multiple close matches, it will present the possibilities while still raising the name error that would have been raised otherwise. Additionally, if you're outside the threshold, you receive an informative message. I've tested this thoroughly, and it works pretty well! One of the things I commonly mis type is 'exit,' and this method helps fix that. Once I had that working, I often forgot the names of rake tasks or only remembered parts of them. So, I created a command to solve that issue as well.
00:06:00.560 Let me run it for you. This is what happens when I try to run the specs but accidentally misspell it. The output tells me it is invoking something else. Overall, the specs are clear about what it does. However, it's a bit challenging to use with Rails console because you have to ensure that 'guess method' runs after Rails’ method missing and constant missing business.
00:06:44.640 This is because 'guess method' has to catch the name error after Rails executes its method missing function. I've tried including it in Rails, but it's a really bad idea and I certainly don't recommend doing that in a production environment.
00:07:19.160 That’s all I have about that. I was informed that I should ask you if anyone wants to see the active scaffold demo. Where's Tim? There you are. Tim and I are contributors to Active Scaffold but we're no longer part of the core team, and I did think it might make a funny joke, as it still references the 'core team' on our website—something we will change soon.
00:08:11.800 Active Scaffold essentially provides scaffolding on top of database tables. Let me zoom in so you can see it better. I have a customer table that has all the CRUD operations, and it's fully AJAX oriented. It allows sorting and other operations.
00:08:50.240 I've added some extensions to make it more customizable, like the ability to customize the functionality or the user experience. Tim is currently working on a sorting ability that uses AJAX, which is really cool. I don’t have it available for demonstration here, but I also created a PDF plugin to allow printing of the table. The framework supports nesting to handle hierarchical table relations.
00:09:36.320 However, the project has been somewhat stagnant lately. We are pursuing ways to revitalize it, especially to encourage community involvement. As contributors, we are not getting paid to maintain the open-source side of the project. Unless we acquire paid projects, our contributions may remain idle.
00:10:16.200 Are there any questions? Yes, regarding PDF capabilities, that is available through a plugin called RPDF. There are also a couple of other plugins out there that allow exporting, such as Active Scaffold Tools, which offers customization for the lists and export functionality. The localization plugin I maintain is fully UTF-8 compatible.
00:10:30.880 Now, I'm Josh Susser, and I’m going to discuss a plugin I created called Migration Concordance. I’ve recently blogged about it, and if you’re interested, you can find it under my GitHub account. Migrations in Rails are generally great, but they can become a hassle when you work in a team where people modify migrations and you don't notice it.
00:11:05.680 This plugin takes a unique approach to checking migration conditions. Let's say you are working on a team, and someone checks in a migration without you knowing. When you run tests later and everything fails, it can be a real hassle. Rails has a feature that forces you to run migrations if the migration version and the latest migration number differ. This can be cumbersome, so I aimed to provide more clarity.
00:11:59.280 Additionally, sometimes people modify migrations that have been run previously, and checking just the version is inadequate. My plugin helps showcase all migrations by creating a snapshot file that holds a hash of every migration file in your migrations directory.
00:12:37.640 This way, when you run your application or tests, it can easily alert you if anyone modified, deleted, or added a new migration file. You put one line at the end of your environment configuration to call this checking function. Moreover, you need to ignore the snapshot file in version control, as tracking it would undermine the plugin's function.
00:13:03.960 So to demonstrate how it works, let's look at running the environment. You’ll notice an alert indicating that the schema needs to be migrated from an earlier version. Consequently, I can run a rake DB migrate to reset all migrations. When the environment checks for the schema version and finds everything is up to date, it informs me that all is well!
00:13:31.080 In terms of newly generated migrations, they will also be checked. For instance, if I create a new migration, the plugin notifies me that I need to run ' rake DB migrate.' This creates a snapshot that learns about the migration file, so after the migration runs, it will appear in the snapshot and acknowledge everything is good to go.
00:14:22.160 A debate about modifying old migrations exists, and this tool can assist in tracking when and where those alterations occur. It can help ensure that such changes don’t go unnoticed.
00:15:03.320 Next, I want to talk about some framework components I’d like to develop. I've been building domain-specific frameworks that sit on top of Rack for specific client projects, catering for clients who desire web applications yet don’t have the programming expertise to create them from scratch. This concept will be presented in full at Ruby Fringe for those attending.
00:15:45.680 Fundamentally, these frameworks are domain-specific languages (DSLs) aimed at generating web applications. For example, I have a simplified approach to creating them, where a 'page' method includes different methods for populating a page with content.
00:16:37.040 They can generate HTML on the fly or produce a paged PDF document. The goal is to have a reusable component that you can readily customize while reducing the need to reinvent the wheel repeatedly.
00:17:17.920 I envision a shared pool of components we could extract from various frameworks. It would allow collective improvement and contribution, especially useful for newer frameworks like Sinatra.
00:17:47.440 I recently registered a Ruby project called 'framework' just a few hours ago where we can place these reusable components. If anyone is interested, feel free to reach out to me via email or catch me on IRC, as I’ll be around today and tomorrow.
00:18:36.040 Now, I started working for Reductive Labs, engaged full-time on their product, which is an open-source project. That means anyone can explore it, and I think it has some interesting features. Puppet, my focus, allows you to automate various functionalities, so hopefully, by the end of this talk, you’ll understand enough to experiment with it.
00:19:03.840 Puppet is written in Ruby and contains approximately 46,000 lines of Ruby code in the library and about 48,000 lines in the associated test code. It functions to manage nodes in your system across distinct environments.
00:19:33.560 In terms of infrastructure, Puppet establishes declarative centralized configuration across your infrastructure, establishing dependencies and providing a resource abstraction layer, delivering extensible support.
00:20:05.720 As part of the demo, I have a recipe that helps manage a Rails stack, including all necessary web servers and databases. The structure lets you manage dependencies systematically, making the deployment process seamless.
00:20:50.800 If you want this to work correctly, you have to define installation orders for your software. Good operating practices dictate that you cannot just install every package indiscriminately.
00:21:38.440 The way this is structured allows you to explicitly state these dependencies. For instance, many administrators know they need to restart services whenever files change, and Puppet allows you to do this easily.
00:22:12.240 It's important to note that the Puppet code offers portability across different systems, and only requires writing minimal code changes to adapt to various environments.
00:22:30.760 Regarding Puppet's flexibility, the Ruby VM enhances usability and supports easy transition across various environments. Puppet is currently utilized in many production settings. However, if your system demands remain static, Puppet may not be necessary.
00:23:29.440 If maintaining these systems with a manual approach works for you, so be it! But know that your competition might be embracing automated solutions.
00:24:23.680 While discussing Puppet, let’s not skip the importance of defining a usable language for configuration. Puppet addresses this directly, employing its language to maintain a clear understanding of what is expected.
00:25:13.960 We’ve created the internal structure for the Puppet system that allows rapid development and response. It’s an exciting time, and we welcome questions to clarify any part of the discussion!
00:25:47.360 Now, let me introduce David South, who, along with some colleagues, has developed a neat library called Monkey Bars. He will attempt to write a GUI application in five minutes!
00:26:51.760 As many of you know, Monkey Bars is a JRuby library, allowing interaction with Swing without the need for actual Java code. To kick things off, I've used the Monkey Bars command, similar to how you’d setup a Rails application, to generate a new app.
00:27:19.520 Once that’s accomplished, I can create a new Swing form and insert various components. For example, I will place a text label onto the form and name it message. I’ll also create a button that performs specific actions when clicked, and incorporates the back-end functionality.
00:27:59.280 At this juncture, the generated code will be interconnected through the model-view-controller paradigms. Once these elements are defined in the controller, I will focus on the logic of what happens when the button is clicked.
00:28:29.680 Once fully developed, the application will allow interactions similar to traditional GUIs—it will display any messages defined within the model.
00:29:00.160 As we finalize our application, we generate a JAR package, enabling easy access. This allows someone who possesses just the required Java environment to run the application seamlessly.
00:29:43.520 At this point, the process of compiling the application culminates in a runnable JAR file, emphasizing the straightforward workflow established by Monkey Bars.
00:30:09.680 Thank you very much!
Explore all talks recorded at MountainWest RubyConf 2008
+28