Many online resources are available for MyGeneration, including articles, templates, and even video tutorials that can give you more information. Because MyGeneration is a freeware tool written by a couple of guys with full-time jobs and families, it’s a little rough around the edges. The documentation is not at a level of quality that most commercial products must meet. However, because of the large community of users, there are many existing templates for people to learn from and active online forums for quick support.
MyGeneration can save you hours of repetitious coding, and it can improve the quality of your code by cutting down on the number of bugs injected via copy-and-paste actions.
—Justin Greenwood, cocreator of MyGeneration
Generating Your Data-Access Layer with Codus
Data-access layers are responsible for the mundane task of retrieving data from and saving data to databases. Any complicated business rules are restricted to the business layer, and the UI logic is all in the presentation layer. This makes data-accesslayer code repetitive, predictable, and often painful to write—and a prime candidate for code generation.
The book assumes that users have installed Facter and Puppet from source in their ~/src directory.
This section walks through the process of installing the following:
In general, Linux distributions provide Ruby 1.8.7, which can be installed as a system package. Earlier versions of Ruby 1.8 should be avoided due to performance issues and known bugs. Puppet 3.0 officially supports Ruby 1.9.x serieshowever, it is only available on the latest distributions.
As of the publication date of this book, using Puppet 3.0 with Ruby 1.9.3 contains enough known issues that it should be avoided. This is likely to be fixed in the near future.
The following commands are sufficient for installing ruby and rubygems on Redhat- and Debian-based systems:
Installing Ruby from a package is sufficient if you only need to support a single Ruby environment. RVM is recommended for more complicated setups and in general for development with Ruby. It allows multiple versions of Ruby to be installed on the same system, and provides the ability to isolate specific sets of gems to different environments using gemsets. More information on RVM can be found here.
In Chapter13, you learned how clients can invoke HTTP requests in the background. You also learned how the server side can detach response processing from the original calling thread with an AsyncResponse. In this chapter, well use both of these features to implement a customer chat service.
Before we dive into code, let me explain the REST interface for our chat service. The service will share a URL to both send and receive chat messages. The service will work much like Twitter in that if one user posts a chat, anybody listening for chats will see it. Posting a chat is a simple HTTP POST request. Heres an example request:
As you can see, all the user has to do is post a simple text message to the /chat URL and messages will be sent to all listeners.
To receive chat messages, clients will make a blocking GET request to the chat server:
When a chat becomes available, this GET request returns with the next chat message. Additionally, a nextLink header is sent back with the HTTP response:
If I were teaching you how to cook, I'd start by making sure you knew the basic techniques
you'd be repeating many times: how to julienne vegetables, deglaze a pan, cream butter, roast
poultry, and so on. That way, when we got to specific recipes later, I could simply say,
"sweat the aromatics in butter and puree the tomatoes" without having to explain the meanings
of words like "sweat," "aromatics," and "puree."
I want to do the same thing in this section: make sure you have a grasp of all the
procedures that come up in many different Mac troubleshooting tasks. Then, when I describe the
specific steps you'll follow to solve various problems, I can say, "start up in Safe Mode"
without having to spell out that process every time. And of course, you can always follow
links back here if you need a reminder of what I'm talking about.
If you've been using Macs for any length of time, you may raise your eyebrows at some of
the procedures just ahead. "Restart Your Mac? Is he kidding? Who doesn't know how to restart a
Mac?" But please read through those sections anyway, because they include details that may not
be obvious (such as what to do if the usual means of restarting doesn't work).