Color Syntax copying for TextMate

Just in time for preparing our RailsConf talk I found out how to copy text with color syntax from TextMate. Simply Ctrl+Alt+Cmd+R in TextMate and paste in Keynote. Of course you need the copy-as-rtf-tmbundle from Max Muermann. I was using XCode for that before, but the keyword detection was different that Textmate’s which I prefer.

To install:

cd ~/Library/Application Support/TextMate/Bundles
git clone git://github.com/drnic/copy-as-rtf-tmbundle.git “Copy as RTF.tmbundle”

DrNic put the bundle on github.

#103 Site Wide Announcements

Sometimes you need to display an administrative announcement to every page on the site and give the users the ability to hide the announcement. See how in this episode.

#103 Site Wide Announcements

Sometimes you need to display an administrative announcement to every page on the site and give the users the ability to hide the announcement. See how in this episode.

Flash Media Server(s) in Ruby?

While preparing an application to be presented during our talk for RailsConf I was looking for a “Flash Media Server” written in Ruby that could record video form a Flash Player. I found rubyizumi but it doesn’t support recording (to my understanding). In Javaland they are a couple, red5 and demou, but they are too convoluted for just a demo. Red5 allows Ruby scripting which is pretty cool. I found one which I really like and will certainly use which is named haxe Video which is written in haXe and is very succinct and works. It’s open source and can be found on googlecode. Of course there is Adobe’s Flash Media Server but I would prefer finding a Ruby specific solution. Do you know any Flash Media Server written in Ruby? Drop me a line or a comment.

Don’t use networksolutions.com for you domain name searches…

I frequently get “great” ideas and reserve some domain names. Call me silly, but this makes the ideas more tangible even if I never work on them. I book my domain names through 1and1.com, for about $7 a year, but I do usually the search on netsol.com . So I searched for some names this morning, then decided to abandon, my idea didn’t need a separate domain for now, and to my surprise I got the following dialog when leaving the site:

20080424_netsol.jpg

So what does that mean? Well, it seems if I click OK they will hide the names I searched for from others users who are doing searches for 4 days. So my recommendation: don’t use networksolutions.com for your search.

Nathan Sobo – Ruby on Rails Podcast

Nathan Sobo of Pivotal Labs talks about Treetop, a cutting-edge parser written in Ruby.

Sponsor

Nathan Sobo – Ruby on Rails Podcast

Nathan Sobo of Pivotal Labs talks about Treetop, a cutting-edge parser written in Ruby.

Sponsor

WebSnapshot Updated.

websnapshot_1.jpg

The guys running the Adobe AIR Marketplace contacted me a couple of weeks ago to publish Websnapshot on the market place. Then they kindly gave me a free Thawte code signing certificate. So I republished the app and changed the skin, I used the Darkroom theme found on scalenine.com. Thawte didn’t make it easy on me to get the certificate. The main issue was that I didn’t have a phone number associated with my company name, therefore Thawte wanted me to send a phone bill with my company name (thug!) or a notarized letter. I had to resend three times the letter as first they couldn’t read it, then it didn’t show some required date…Well, finally I got the certificate and could sign the application. I don’t believe it will make a difference to many users as most people currently install non-signed apps anyhow. Now that certificate was changed from the initial I used to sign the application it will however require that you uninstall first the application if it was already installed.

You can now find the application on the Marketplace or here.

It’s basically the same version than before with just a minor scaling issue fixed. What I need to add next is auto update, custom filenames, saving to s3 and Flickr.

Enjoy!
Daniel.

#102 Auto-Complete Association

Usually a select menu is used for setting a belongs_to association, but in this episode I will show you how to use a text field with auto completion.

#102 Auto-Complete Association

Usually a select menu is used for setting a belongs_to association, but in this episode I will show you how to use a text field with auto completion.

A Note About Git Commit Messages

I want to take a moment to elaborate on what makes a well formed commit message. I think the best practices for commit message formatting is one of the little details that makes Git great. Understandably, some of the first commits to rails.git have messages of the really-long-line variety, and I want to expand on why this is a poor practice.

Here’s a model Git commit message:

Short (50 chars or less) summary of changes

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.  In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body.  The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.

Write your commit message in the present tense: "Fix bug" and not "Fixed
bug."  This convention matches up with commit messages generated by
commands like git merge and git revert.

Further paragraphs come after blank lines.

- Bullet points are okay, too

- Typically a hyphen or asterisk is used for the bullet, preceded by a
single space, with blank lines in between, but conventions vary here

- Use a hanging indent

Let’s start with a few of the reasons why wrapping your commit messages to 72 columns is a good thing.

  • git log doesn’t do any special special wrapping of the commit messages. With the default pager of less -S, this means your paragraphs flow far off the edge of the screen, making them difficult to read. On an 80 column terminal, if we subtract 4 columns for the indent on the left and 4 more for symmetry on the right, we’re left with 72 columns.
  • git format-patch --stdout converts a series of commits to a series of emails, using the messages for the message body. Good email netiquette dictates we wrap our plain text emails such that there’s room for a few levels of nested reply indicators without overflow in an 80 column terminal. (The current rails.git workflow doesn’t include email, but who knows what the future will bring.)

Vim users can meet this requirement by installing my vim-git runtime files, or by simply setting the following option in your git commit message file:

:set textwidth=72

For Textmate, you can adjust the “Wrap Column” option under the view menu, then use ^Q to rewrap paragraphs (be sure there’s a blank line afterwards to avoid mixing in the comments). Here’s a shell command to add 72 to the menu so you don’t have to drag to select each time:

$ defaults write com.macromates.textmate OakWrapColumns '( 40, 72, 78 )'

More important than the mechanics of formatting the body is the practice of having a subject line. As the example indicates, you should shoot for about 50 characters (though this isn’t a hard maximum) and always, always follow it with a blank line. This first line should be a concise summary of the changes introduced by the commit; if there are any technical details that cannot be expressed in these strict size constraints, put them in the body instead. The subject line is used all over Git, oftentimes in truncated form if too long of a message was used. The following are just a handful of examples of where it ends up:

  • git log --pretty=oneline shows a terse history mapping containing the commit id and the summary
  • git rebase --interactive provides the summary for each commit in the editor it invokes
  • if the config option merge.summary is set, the summaries from all merged commits will make their way into the merge commit message
  • git shortlog uses summary lines in the changelog-like output it produces
  • git format-patch, git send-email, and related tools use it as the subject for emails
  • reflogs, a local history accessible with git reflog intended to help you recover from stupid mistakes, get a copy of the summary
  • gitk has a column for the summary
  • GitHub uses the summary in various places in their user interface

The subject/body distinction may seem unimportant but it’s one of many subtle factors that makes Git history so much more pleasant to work with than Subversion.

#101 Refactoring Out Helper Object

If you have complex view logic, this can easily lead to helper methods which call each other. See how to refactor this out into another object in this episode. This is also known as the presenter pattern.

#101 Refactoring Out Helper Object

If you have complex view logic, this can easily lead to helper methods which call each other. See how to refactor this out into another object in this episode. This is also known as the presenter pattern.

Google’s appengine is up and running.

Appengine is Google’s answer to Amazon’s web services (ec2, s3, …). I just signed up and got the following message: “Thanks for checking in! When space in the Google App Engine preview release becomes available, we’ll notify you by emailing…”

While waiting you can read there doc or download the SDK.

They have some demo apps. Also, the runtime or development language of choice seems to be Python…hopefully Ruby is next on the line.

Update: 11:14pm Got an Invitation to try Google App Engine saying my account has been activated. The account allows me to create 3 applications.

#100 5 View Tips

Here’s five quick tips to use in views. Be sure to catch the end of the episode where I reveal an exciting contest!

#100 5 View Tips

Here’s five quick tips to use in views. Be sure to catch the end of the episode where I reveal an exciting contest!