Scott Garman posts a reminder message that tonight’s Ruby/Rails SIG meeting will be a special meeting: three presenters on three topics, and some awesome door prizes: Brian Turnbull on HTTP, Scott Garman on VPS, and Nick Plante on git. There will also be discounts for Linode, a raffle for free admission to the Voices that Matter Ruby 2008 conference in Boston, and perhaps Nick will even bring copies of his new book (with David Berube), Practical Rails Plugins. A meeting not to be missed!
Tag Archives | Ruby
Notes from MonadLUG: David Berube, Ruby on Rails
Eleven members attended the August 14th meeting of the MonadLUG, Monadnock Linux User Group, held as usual on the second Thursday of the month at the SAU1 offices in Peterborough. David Berube was the main presenter.
We had the usual announcements (check upcoming events at http://www.gnhlug.org) and also some time for Q&A while waiting for the main speaker and had the ceremonial struggling with the laptop and the projector. One fellow was looking for help understanding how to install drivers for a scanner not supported by SANE, another had questions on what the keyring was and how he could get it to stop demanding a password from him.
David’s been a fixture in the groups for some years. He served as Fearless Leader of GNHLUG for several years, and took a stint as coordinator of the CentraLUG group. He has written a number of magazine articles and authored or co-authored several books, the most recent, Practical Ruby Plugins, due out later this month.
David gave us a brief history of web development, focusing on the incremental improvements made from scripts to cgi-bin to modules to long-running processes in terms of responsiveness, latency and the ability to scale to larger and quicker demands. He briefly compared Ruby with Perl, Python and Lisp, and then dove into the demo.
David had an Ubuntu laptop that he hadn’t previously done Ruby on Rails development on before, so he showed us the basics of installing Ruby, using Ubuntu’s package manager, and cautioned us against using the OS package manager to install gems: The gem system is a package manager in its own right, and it does things in a somewhat different way than most of the OS package manager tools. Instead, he recommended using ruby to install gems. As is often the case, there were some glitches, so we had a small distraction while we worked through creating the /usr/bin links for rake and rails that somehow hadn’t been created automatically.
David then created a new project, and walked us through the directory structure and the significance of files in each folder. He created a model that defined the wiki example we were creating, a controller to answer requests from the web server, and a view that would render the response from our application. He used the built-in rails and rake scripts to create the example database (SQLite3 is built in and used by default if nothing is specified, new in RoR 2.1), showed how the rails console could be used interactively to create model objects (implicitly saving them to disk) and that the console could be used to add, edit, query and delete objects. He then ran the application, after explaining the logic of URLs constructed in a “RESTful” fashion as http://yourwebserver/controller/action/parameter addresses. David started the built-in Webrick webserver and navigated his browser to http://localhost:3000/page/show/bob to show us Bob’s wiki page entry. Whew!
There was some good Q&A during and following the presentation.
I asked some questions on how a team of developers could insure that they were maintaining the same versions of gems when developing, as the gems are usually installed globally and are not in the main application source code tree. David suggested either creating a local team gem repository, or hardcoding the exact versions you want to freeze the target application at, directly within the code.
Charlie had some questions on how to keep up. While he’d read through the “PickAx” book and the “Skateboard” book, those are already a version out of date. David booted up Pidgin and we chatted with a couple of his fellow authors on what they recommended. Here’s a few links I noted from the meeting:
- PickAx: http://www.pragprog.com/titles/ruby3/programming-ruby-3
- SkateBoard (aka AWDWR):http://www.pragprog.com/titles/rails2/agile-web-development-with-rails
- Beginning Ruby by Peter Cooper (full disclosure: a fellow author and mentor of David’s from Apress): http://www.apress.com/9781430223634 [edit: updated URL]
- Installable versions of Ruby (to get the latest): http://www.ruby-lang.org/en/
- David’s recent Ruby books: http://apress.com/book/search?searchterm=berube&act=search&submit.x=0&submit.y=0
- http://rubyonrails.org has some good screencasts and documents
David also mentioned he was running Gnome-Do, a QuickSilver-clone that lets you launch applications or perform functions with a keyboard shortcut and your keywords. And David also showed off the Vimperator, a Vim-like interface for the FireFox browser. David noted you might find some troubles with Javascript-intensive pages:
Thanks to Charlie Farinella for organizing and running the meeting, to Ken and the SAU for providing the fine facilities, to David for an informative presentation and to all for attending and participating!
Notes from NH Ruby/Rails Group, 20-May-2008
Five members attended the May meeting of the New Hampshire Ruby / Rails group, held as usual at the offices of RMC Research in Portsmouth.
Nick Plante entertained and educated the group on Rack, a foundation layer that interfaces between the web application handler (like Mongrel or FastCGI) and the actual web application framework adaptor (like Merb or Camping or Halcyon or Sinatra) in a manner similar to the Python WSGI layer. It allows for the creation of custom web frameworks while removing a lot of the grunt work. Nick had a sample application whipped up where a few lines of code could define the routing of various requests and cleverly answered “Hello, World” to the correct RESTful query.
For those for whom Rails isn’t the complete answer or those who want to build their own web functions with components other than those used by the Rails framework, Rack is a foundation on which you should be plugging together your building blocks.
Brian Turnbull volunteered to fill in for Scott Garman, who had to cancel at the last minute. Brian had been using NetBeans only a brief while, but had a great story to tell on using the built-in debugger to trace out a problem with Rails-generated CSS meta tags always getting a cache-breaking URL. While a feature in development, when the CSS was being served from a caching store like Amazon’s S3, the ever-changing URL defeated the point of caching. Brian showed how breakpoints could be applied to the code and step-by-step tracing (why is it that all debuggers have Step-In, Step-Once, Step-Over, Step-Out icons that all look the same and can’t be told apart?) and walked from his code into the Rails framework down to the mis-behaving component.
Having identified the problem, our discussion took a tangent into a discussion about monkey-patching, and how this ‘feature’ was a bug deserving of an optional switch to disable, and ought to be submitted upstream to the Rails maintainers. To confirm, we went through the steps to grab the latest version of rails as a plug-in (gem? I’m not sure.) so that we were working with the latest ‘edge’ code to confirm the problem hadn’t already been fixed. By installing this way, we were overriding the Rails framework only for this application, and could easily revert to the stable version, without disturbing the main shared code on the machine. We talked about how this was a Best Practice when bringing an app under development up to production, so it was isolated from changes outside of the app’s control.
Plenty of time was available for discussion, and we talked with Tim a bit about configuring a new machine with all the tools he’d need to develop a Rails app with NetBeans: Ruby, Rails, a couple good gems, the Java runtime. Nick and Brian noted that the default Rails environment within NetBeans is JRuby not MRI (Matz’ Ruby Interpreter) and how you might want to reconfigure NetBeans to use MRI instead if you weren’t planning on deploying to a JRuby environment.
Thanks to Nick and Brian for their presentations, to Scott for arranging the meeting, to Tim and RMC for providing the great facilities and to all for attending the meetings! Discussion is ongoing now on the topics for the June meeting; join the mailing lists at http://mail.nhruby.org/mailman/listinfo/ and keep an eye on the new meeting plans at http://wiki.nhruby.org/index.php/Upcoming_meetings.
Developers, developers, developers song gets covered again
We all know the answer is “Developers, developers, developers, developers,” but who’s asking the question these days? It seems like Sun has taken up the song, according to Timothy M. O’Brien’s posting over at O’Reilly, “Surprising Contender: NetBeans as a Ruby+MySQL IDE.” Great news for all of us looking for new tools; NetBeans is shaping up to be a pretty sharp IDE.
I saw a blog post recently and neglected to bookmark it that posited the thesis that rich IDEs were bad when learning a language. A simple text editor and console can be all the interface you might need when when starting off and as your skills increased, the need for code completion, cross-referencing, inline debugging, source code control, refactoring and macros all became more valuable. Witness the training videos on http://www.rubyonrails.org where developers use a browser, a console window and the Textmate editor to build sample applications. The simplicity is appealing.
Notes from NH Ruby group, 15-April-2008
Eight people attended the April meeting of the Ruby Special Interest Group, http://www.nhruby.org, held as usual on the second Tuesday of the month in the meeting room at RMC Research.
We lead the night off with a brief video on Passenger from Phusion.nl, a new Apache module that host rails, like a mod_rails (not _ruby) module. Nick reported he’s been running it on one of his sites for a while and is pleased with the performance and the marked decrease in load. Having a mod_rails option available is likely to get hosting companies offering fractional horsepower shared virtual machines to be able to host Rails apps, bringing Rails onto the $7-a-month commodity hosting sites. Cool!
I asked for recommendations on the right way of parsing incoming XML and SOAP packets and was referred to Hpricot and soap4r. Another attendee asked for recommendations on Content Management Systems. Nick mentioned Radiant (which we got to see later in the presentation). comatose and railfrog. We got into a couple discussions during the evening on the stability and applicability of Ruby and Rails for many situations, citing high traffic web sites and the several runtime engines/VMs like JRuby in which Ruby code can run.
Finally, we arrived a the Live Hacking session where we got to watch Scott and then Nick show how to add new functionality to an existing app. Actually getting to see another craftsman at work brings out all sorts of good questions. Scott added chronic to his To-Do application. Chronic is a “natural language datetime parser,” according to the web site, and Scott showed how it could easily be integrated into an existing app, and accept values like “Next Tuesday” or “Thursday last week” and return sane datetime values. We also looked at what would be involved and set up a unit test to check our changes.
Nick showed us a little more of the Radiant application, and his work on making the Radiant CMS support multiple sites. The source he’s working on is stored at github.com, and the networking graph is a thing to behold. Nick spent a little time getting us familiar with the different philosophy of git (branching is inexpensive, merging is very smart, branches can interact in many ways including pushing to and pulling from each other) and then grabbed the most recent code and hopped right into to refactor a code snippet that was an inelegant hack using a deprecated technique into one that was more proper, running our unit tests before and after to confirm the refactoring didn’t break anything.
An excellent evening as usual! Thanks to all for their attendance and participation, to Scott and Nick for organizing, announcing and presenting, and to RMC Research for providing the nice facilities.
State of the Computer Book Market, Part 4 – The Languages – OReilly Radar
Over at O’Reilly, Mike Hendrickson posts State of the Computer Book Market, Part 4 – The Languages – OReilly Radar. Bear in mind in the world of lies, damned lies and statistics, these are statistics. Like measurements of job posting vs. languages, or web pages vs. languages, these aren’t an indication of what languages are in use out there, or what languages are suitable for use. This is just a measurement of what book titles sold the most, grouped roughly by language. If the best book on your favorite language is years old, it’s probably shown as small here. If a bunch of crappy books got published on the language-of-the-week, and the authors and publishers did a good job of getting a buzz going, it’s probably scoring high. Don’t use this to decide whether to use vi or emacs, tabs or spaces.
But it’s interesting data.
PySIG notes, 25-Oct-2007, Kent Johnson and Beautiful Soup sprint
Thirteen people elected to skip watching the second game of the World Series (Go Sox!) to attend the October meeting of the Python Special Interest Group (PySIG), held as usual at the Amoskeag Business Incubator in Manchester, New Hampshire, on the fourth Thursday of the month, 7 PM until… well, 10 PM last night!
The usual slew of announcements was made: the PySIG won’t meet on the usual night due to the Thanksgiving holiday. A meeting might happen the week after, since there are five Thursdays. Stay tuned for the official announcement. Other affiliated GNHLUG meetings are posted to http://www.gnhlug.org and all are welcome.
I had proposed a programming challenge to PySIG: following recent discussions on the GNHLUG mailing lists about attendance at meetings, Jim Kuzdrall had suggested we more closely analyze the attendance data that’s been posted to the GNHLUG wiki [1] for the past two years or so. The data is accessible from there, but the HTML format is not too easy to manipulate into an analyze-able format.
Enter BeautifulSoup. BS is a utility written in Python that parses HTML, with a lot of toleration for somewhat malformed HTML, and produces a parsed tree that can be traversed or queried or parsed into its various elements. Kent S Johnson continued his great Kent’s Korner series with a presentation on the basics of using BeautifulSoup. Kent noted that the documentation on BS is remarkably good, with illustrative examples and exhaustive discussions. BS is in its third major version and continues to be supported by its original author.
After Kent’s Korner, Bill Sconce took the driver’s seat, set up BS on his machine and we began with the kernel of source Kent had supplied to parse the source. The group participated, suggested, yelled at typos, experimented, threw out code, started over, changed the angle of attack, and successfully produced code that not only parsed the existing page, but generated a comma-separated-value file with proper escaping, thanks to the csv module. Along the way, we discussed issued of character conversion (since BS uses the aptly-named UnicodeDammit module and csv wants ASCII), escaping issues, coding styles, and more.
At the end of the presentation, Kent got the projector again to show a somewhat different tack he had used to parse the HTML, with an emphasis on writing small functions to clean each column of the idiosyncracies found in the data (a “Saturday” in the date field, a date field a two-day event, approximated attendance ~24 and so forth) and generate some results: which groups had the highest attendance for the year? No one was surprised that Nashua/MerriLUG was #1, but who knew that PySIG was #2? Woo-hoo! We noted that RubySIG was last, but there’s a good sampling problem: they had just started up early in the year, and a couple attendance figures were missing.
To follow up from the meeting, we intended to merge Kent’s improvements into the group’s code and generate some CSV files that we can make available for download from the GNHLUG wiki for all to analyze, graph, visualize and study.
Thanks to Kent for preparing his Beautiful Soup presentation, to Bill Sconce and Alex Hewitt for arranging the meeting, to Bill again for having the patience to type while twelve people tsk’d at him, to the Amoskeag Business Incubator for providing the fine facilities, and to all for attending and vigorously participating in the meeting!
[1] which actually breaks down to:
http://wiki.gnhlug.org/twiki2/bin/view/Www/PastEvents2007,
http://wiki.gnhlug.org/twiki2/bin/view/Www/PastEvents2006, and
http://wiki.gnhlug.org/twiki2/bin/view/Www/PastEvents2005
Adding a “skin=print.pattern” eliminates some of the “chrome”
surrounding the content.
New Hampshire Ruby, 16-Oct-2007: Rails Deployment
Organizer Scott Garman posts:
This month’s NHRuby.org meeting topic will be on deploying Ruby on Rails applications. While back in May our meeting focus was on using Capistrano as our primary deployment tool, this month Scott Garman will be demonstrating a simpler application to manage Rails deployments, called “Vlad the Deployer”
Vlad the Deployer “targets the 80% use case” of deployments and boasts an engine written in less than 500 lines of code. Is simpler always better? Drop by our meeting and find out!
Scott will also be discussing various Rails-related tidbits he’s been working with recently.
Anyone who attends the meeting will be offered special coupon codes from Linode if they’re interested. The coupons give you two months of free service after purchasing one month of their Virtual Private Server (VPS) hosting. Linode sponsored the recent Rails Rumble and Nick Plante
had many good things to say about them.WHEN: Tuesday, October 16, 2007. 7-9 PM.
WHERE: RMC Research Offices, 1000 Market Street, Portsmouth, NH.For a map and driving directions, see our wiki site
Notes from the NH Ruby/Rails Group, 25-Sept-2007: Scott Garman and Nick Plante
Five attendees made it to the September meeting of the NH Ruby/Rails User Group, held as usual at the well-appointed RMC Research offices, though not on the usual third Tuesday. A round of introductions lead to some vigorous discussions, including how to broadcast and record meetings (perhaps a future meeting will be available via WebEx?), other computing organizations and conferences in the Granite State (GNHLUG, SwANH, the infoeXchange conference, NH High-Tech Council, etc.).
Nick Plante had some great stories about the Ruby Rampage, a 48-hour online programming contest he help run. A large number of teams competed and a fair number actually delivered working applications, some of them looking quite polished. There’s open voting on the most popular applications, and winners will walk away with a number of desirable prizes. Nick’s also been tapped to do the closing presentation at Ruby East, where he will demonstrate some of the more popular applications. There are some great apps there, and some will be providing their source code, though not all. Check them out!
On to the main presentation: Scott and Nick had started a simple Ruby app for NHRuby members to be able to suggest future meeting topics and vote on them, giving the organizers some ideas on what to present next. Tonight, Scott presented the unit, functional and integration test frameworks built into Rails and/or available as add-ons. Nick showed the UI for the voting interface and dove deep into how the form functioned. There was a lot of discussion, with debates on where the boundaries are in unit vs. functional vs. integration, and how Javascript (via the Prototype libraries) can be integrated into the interface and how Rails allows graceful degradation on platforms with Javascript unavailable or disabled. Comparisons were made between the internal, programmer-centric tests provided by Rails and external tests a QA person might run with a tool like Selenium. Lots and lots of great ideas. In a future meeting, Scott and Nick will discuss the next step, deploying the application, perhaps using Vlad the Deployer (ow) and/or the new Capistrano 2.
Thanks to Scott for organizing the meeting, Tim of RMC for providing the meeting space, Scott and Nick for the presentation, Brian for mentioning Selenium and all for their attendance and participation!
New Hampshire Ruby/Rails Group, 25-Sept-2007: Live Coding
Organizer Scott Garmin posts:
“Tomorrow’s NH Ruby/Rails User Group meeting will include a continuation of the live coding project Nick Plante and Scott Garman started during the July meeting. This project was to develop a web application where group members could submit proposed topics for future meetings, and vote on their favorites… This month, Nick Plante will demonstrate how to add the voting system to the application. Nick will use an AJAX-based 5-star voting system that you may have seen on many product review sites… Scott Garman will give an introduction to the Rails testing framework, demonstrating how unit, functional, and integration tests are written. Scott will also demo some useful third-party tools that make testing easier and faster, and how they integrate with the NetBeans IDE.”
WHEN: Tuesday, September 25, 2007. 7-9 PM.
WHERE: RMC Research Offices, 1000 Market Street, Portsmouth, NH.
For a map and driving directions, see our wiki site.