Archive | 2011

NH Ruby September 2011: Backbone.js Jason Morrison

Twelve folks attended the September meeting of the New Hampshire Ruby Rails Group. Due to some logistical issues, we moved the meeting from NH-ICC to AlphaLoft, thanks to AlphaLoft member Nick Plante. Jason Morrison of thoughtbot was the featured speaker, talking about backbone.js.

Organizer Brian Turnbull got the meeting started with brief introductions.

Clients want the improved client-side experience of rich-client apps within the browser.

But which framework? Different patterns: MVC2 is what we’re used to seeing in Ruby/Rails. MVC and MVVM (Model-View-View-Model or Presenter).

Choice fatigue (http://www.nytimes.com/2011/08/21/magazine/do-you-suffer-from-decision-fatigue.html) : there seem to be more JavaScript frameworks than JS developers.

  • Capuccino – PowerPoint in the browsers, 270North
  • SproutCore (1,x,m 2.z) ricu Ui widget framework,.0 from the ground up rewrite, less widgets
  • Knockout.js: useds the HTML5 Data- elements
  • Batman.js – from Shopify, ActiveMerchant, using Node.js server-side component
  • JavaScriptMVC – mature, uses jQuery, filterable grids, lots of power
  • Spine.js – CoffeeScript, asynchronous front end, does full validation on client-side
  • Backbone.js – tonight’s featured framework, well-documented (in Doc-O)
  • Angular, Coherent, PureMVC-js, AFrameJS, TrimPath Junction,

Moving parts:

  • History
  • Router
  • View
  • Model
  • Collection
  • Sync
  • Underscore
  • $

Jason wowed the crowd with an excellent demo of an app under development and spoke eloquently of the power, and the dangers, of deploying MVC (or MV-something-else) into the client. His slides contained a great many good references. My laptop gave out at this point, so I didn’t take additional notes, but you can find his slides at http://jayunit.net/backbone-js-on-rails-talk and source for the slides at https://github.com/jasonm/backbone-js-on-rails-talk/blob/gh-pages/slides/index.md

One of the little things that got the crowd all excited was the line numbering on Jason’s Vim session: the current line was numbered 0, and line numbers incremented both up and down the screen. “Oh, that” Jason said. ‘set rnu’ is the command (see :help rnu within vim for details.)

Michael Tomer talked a little bit about his project, rocket.io, which is an interesting project trying to solve similar problems: “real-time” (no http lag) page updating, background sync between client and remote server. You can find his work at [updated link] https://github.com/actsasbuffoon/rocket-io

Thanks to Jason for an awesome presentation, to Nick Plante for hosting us at AlphaLoft, to Brian Turnbull for organizing the meeting, announcements and logistics, and to all the attendees for their participation.

NH Ruby meeting, 15 August 2011: Brian Turnbull, Rails 3

Brian Turnbull ran and presented to the August meeting of the New Hampshire Ruby Users Group meeting, held at the New Hampshire Innovation Commercialization Center. Over a dozen attendees turned out for the meeting, despite the inclement weather.

Brian presented an introduction to Rails 3 using a small application he had built for  work. He gave us an overview of the problem to be solved, skipping the irrelevant details, and explained how that fit into basic MVC concepts. We touched on the idea of design patterns. We examined or discussed many facets of Rails development, including rake tasks, migrations, fat models – thin controllers, using HAML for view templating, creating your own custom validators, deployment using Capistrano and more.

Brian mentioned several useful resources, such as Google, the Rails Guides, the API reference,  and more. He mentioned that he’d read Metaprogramming Ruby [Updated link] and thought that it changed his perspective on using Ruby.

As always, there was time for folks to get their questions answered. There were questions on stack dumps in rake, unobtrusive JavaScript, new features of Rails 3, Capistrano deploys to non-git-clients, and more.

Thanks to Brian for a information-packed presentation, and to all for attending and participating. Brian is always looking for ideas for future meetings and volunteer help in organizing.

 

Local paper goes Web – Why?

What my local newspaper can provide online: Not much.

I subscribe to the local paper, in paper format, supporting a local industry of loggers, paper mills, ink manufacturers, advertisers, newspaper staff, delivery people, gas stations and coffee shops. Now the local paper wants me to pay extra for the privilege of reading their web site and I am honestly hard pressed to figure out why I would want to do that. I’m already spending several hundred dollars a year for the paper and its delivery. In half- and full-page ads in the paper, the paper suggests I will gain access to:

  • breaking news: I have the computer and radio on all day (I’m also a supporting member of my local NPR station). I see the headlines and follow important stories when they occur, from the primary sources.
  • Sports: sorry, don’t care.
  • Local news: the value of my local paper is local journalism on local issues. I want and pay for the efforts of my local ink-stained wretches who personally interview the local people making news, take photos and write editorials from the local point of view.
  • Weather: just re-feeding the nationally-supplied weather forecasts.
  • TV listings: already available online in many formats, and on the cable if I cared to look.

What I pay for my local paper is the first draft of history. Local news, the facts, names, dates, places and time. Most importantly: why? I pay for a journalist to analyze all these factoids, easily found for free on the internet, and tell me why. Why did it happen? Why should I care? What is the significance of this in the big scheme of things? Is the local protest against a new public works project a NIMBY or a valid concern? Is the latest councilman gaffe an oopsie or a major ethical lapse? This is what I pay for: a professional journalist to think, weigh the issues, and present an unbiased analysis of the issues. The rest is just filler.

Seacoast WordPress Developers Group, April Notes

On April 6th, the Seacoast WordPress Developer’s Group met at the New Hampshire Innovation Commercialization Center to talk WordPress. Networking and casual conversation started around 6:30, with the meeting formally starting at 7 PM with a round of introductions:

Dave – former Cold Fusion, ETL, new to WordPress,
Carl Eric Johnson – web developer, WordPress instructor and eveloper, fan of Thesis framework.
Amanda – BIL doing Joomla, Drupal, and WordPress
Sharon, Rye Public Library, Technology Coordinator, just launched a freshened site on April 1st using WordPress and Atahualpa theme/framework.
Will, a graphic designer in a print shop who’d been encouraged to learn web design and now WordPress.

Book recommendations:
Amanda praised the Wrox Professional WordPress book.
Carl Eric has enjoyed WordPress: Visual QuickStart Guide [Updated link — ed.] to get up and running, and WordPress Bible(Aaron Barzell) from Wiley as a reference.

Main Presentation: Carl Eric Johnson: talk about themes and frameworks
Sitepoint.com Wicked WordPress Themes book has free sample download chapter. Table of contents points out the choices of custom themes, child themes, building a framework.
Child themes: load with parent’s theme files, in your child file, you import the parent, then override what’s different.
In WordPress 3.0, theme TwentyTen has a lot of options built in. Thesis and Atahualpa have a number of pages of options: sizing, features, colors, styles, etc.

Amanda talked about file structures and “the loop” – directories of wp-admin and wp-install are pretty much off-limits, containing the installed WordPress files and overwritten up updates; wp-content contains most everything else, including the stuff you customize. Add your own functions.php and copy the functions you want to override. A theme consists of index.php and style.css as a minimum; you can add as much as you want from there. See the Codex for the hierarchy of theme files WordPress looks for in order to render your content. Consider starting with a “blank” theme if you’re building your own, such as Starkers or Boilerplate themes – essentially stripped-down skeletal themes with all of the style removed.

See http://codex.wordpress.org/Template_Hierarchy for a description of how WordPress selects the correct template(s).

See http://codex.wordpress.org/The_Loop_in_Action for an overview of the loop.

Header-Rotator

A few late night tweaks to the header image logic: I’ve created as simple a plugin as possible that lets me have three of my own images randomly appear in the heading. Based on the TwentyTen Header Rotator plugin, I ripped out all the code other than the logic to hook into the WordPress framework and the last line to pick an image at random. For my first pass, I hard-coded threefour images (a full moon on a snowy evening, a frosty window and a full batch of cherries, all taken at home) to load up the array. Got it working. That’s the first sanity check. It will be followed with admin pages, setting pages, the ability to upload and resize your own images, etc.

I tried to keep it as close to “the simplest thing that would work” for a first pass, but I left a little complexity in there: the list of images is an array of one-element arrays because the main theme uses something similar where you can store more information about each image, such as a thumbnail location. I figured I’d eventually need to add that back in there, so I left the structure in place. Here’s the core code that gets it to work:


if(!is_admin()) add_filter('theme_mod_header_image','trhr_rotate');
 
function trhr_rotate(){
$imagelist = array(
0 => array('url' => home_url('/wp-content/uploads/2011/03/cropped-DSCN1285.jpg')),
1 => array('url' => home_url('/wp-content/uploads/2011/03/cropped-DSCN1288.jpg')),
2 => array('url' => home_url('/wp-content/uploads/2011/02/cropped-SnowMoon.jpg')),
3 => array('url' => home_url('/wp-content/uploads/2010/07/cherries.jpg')),
);
return $imagelist[rand(0,count($imagelist)-1)]['url'];
}

Thanks to the Seacoast WordPress Developers group for the inspiration, and also some cool ideas from Smashing Magazine’s “Ten Things Every WordPress Plugin Developer Should Know

TwentyTenFive theme

Readers shouldn’t notice too much of a change as I switched from the TwentyTen default theme for WordPress 3.x to the TwentyTenFive theme by Richard Shepard. It was originally developed as this article for Smashing Magazine, and then took on a life of its own. The theme is available for download and modification from GitHub.com. I was pleased to be able to contribute a minor fix (a really tiny fix, consisting of two dots and a slash, but in the right place). Hope to contribute more as I learn more about WordPress internals.

TwentyTen Header Rotator Follow-up

Ah, the power of the web. I posted the problem I was having both here and on the WordPress.org web site, and within a week, another developer pointed out the simple one word addition to the plugin code to make it work in WordPress 3.1. Problem solved!

Now that I’ve spent some time poking at the code, and inspired by the “How to Build a Plugin” presentation at last Seacoast WordPress Developer’s meeting, I’m thinking of a fancier plugin that will let you load up as many images as you want and shuffle them. Inspiration is one thing, perspiration is another; I’ve got enough on my plate right now that this is a pretty low-priority issue. And there’s the challenge of feature creep: it would be nice if I could link each header to page that described the significance of the picture, had its licenses, etc. And that you could load up multiple pictures and enable/disable them individually for seasonal themes or special events. And… oh, dear.

Seacoast WordPress Developers meeting, 2-March-2011

Five people attended the March meeting of the Seacoast WordPress Developer‘s meetup, held at the New Hampshire innovation Commercialization Center near Pease in Portsmouth. We did a round of introductions and welcomed two new members and discussed what the group could focus on. We discussed the boundaries of CMS and Blogging and Wikis and how they overlap (A professional in education provided us with some great insights on how we think about some of these items), the challenge in finding consultants and clients, and how we can build up a network. We talked about potential agenda items: what should we schedule, what should we have in free-form.
I think an FAQ we ought to be prepared to answer is “What is it that WordPress is?” It’s less than obvious. “A blog” is the wrong answer, as that is a form of document, and not an application. “A CMS” is such a vaguely defined answer that it’s not much more useful than “an application.”

Other questions we started to explore, and possible future topics:

  • What is it that others are looking for on the web?
  • Good resources for learning WordPress: Codex, FAQ, books, etc.
  • WordPress SEO
  • WordPress Security
  • Loop/structure of databases tables, templates
  • Popular plugins
  • WordPress Backup tips: data and files
  • WordPress Community

Finally, Amanda presented her talk on building a plugin. She’d done some excellent research and used clear examples and explained them well. Here are the notes and slides posted to the new Seacoast WordPress Developer’s website, running WordPress, of course, and BuddyPress.

So, it was a great second meeting of the Seacoast WordPress Developer’s group. Stay tuned for more news. Thanks to Amanda for organizing the event, and to the New Hampshire Innovation Commercialization Center for providing the great facilities!

Color vim on CygWin

I’ve had to do some admin work on a Windows 2008 R2 server and found it handy to have a POSIX environment installed on Windows so I have ssh, grep, rsync, git, bash, vim and other functionality available all working within the same shell.

While vim was functional, the terminal was one that vim didn’t recognize as color, and hence the editor was only black and white and a few shades of gray. A little Googling returned this page: http://infrablue.tripod.com/cygwin.html with instructions on using rxvt as the terminal and configuring bash to run within it. A few tweaks, and I’m running vim and editing in color!

[UPDATE] @mintty_cygwin on twitter was kind enough to point out that rxvt development is pretty much stopped, but that the project http://code.google.com/p/mintty/ offered yet another TTY to run on Windows. This one has some pretty cool options, and is easy to install. I’m up and running with it now!

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.