> YouTube Gem 0.8.6 Released

Posted about 7 years back at Shane's Brain Extension

This is mainly a bugfix release but also makes it easier to search for videos by category. Searching by category greatly helps in finding videos that are more relevant. You can now do:

videos = videos_by_category_and_tag(YouTube::Category::MUSIC, 'bush')
or if you wanted to:
videos = videos_by_category_and_tag(YouTube::Category::NEWS_POLITICS, 'bush')

For more details check out the CHANGELOG. Thanks to all the contributers, Walter Korman, Lucas Carlson, Rob Tsuk, and Thomas Cox.

Related posts:

> YouTube Gem 0.8.6 Released

Posted about 7 years back at Shane's Brain Extension

This is mainly a bugfix release but also makes it easier to search for videos by category. Searching by category greatly helps in finding videos that are more relevant. You can now do:

videos = videos_by_category_and_tag(YouTube::Category::MUSIC, 'bush')
or if you wanted to:
videos = videos_by_category_and_tag(YouTube::Category::NEWS_POLITICS, 'bush')

For more details check out the CHANGELOG. Thanks to all the contributers, Walter Korman, Lucas Carlson, Rob Tsuk, and Thomas Cox.

Related posts:

Text to speech for Ruby on Rails applications

Posted about 7 years back at Spejman On Rails

I just published the first usable festivaltts4r version, it comes with its plugin for Ruby on Rails, festivalttsOnRails. With this library and this plugin you can make talk your Ruby and your Ruby on Rails applications.

The rails plugin is so easy to use in Ubuntu linux:

  1. Install tts and mp3 generation libraries:

    sudo apt-get install festival lame

  2. Install the festivalttsOnRails plugin for Ruby on Rails:

    script/plugin install \
    svn://rubyforge.org/var/svn/festivaltts4r/plugins/festivaltts_on_rails

  3. Use text_to_flash_player(text) method in your views:

    <%= text_to_flash_player "Talk me!" %>

At the moment the plugin works with a simple english voice but can be very useful as a proof of concept. If people found it interesting it could be improved.

It works so well in Ubuntu Linux, testing in other platforms will be appreciated.

You can also use the festivaltts4r gem in order to make local voice applications with Ruby:
  1. Install tts and mp3 generation libraries:

    sudo apt-get install festival lame

  2. Install festivaltts4r gem:

    sudo gem install festivaltts4r

  3. Include required gems and call to_speech method defined into the String class by festivaltts4r:

    require "rubygems"
    require "festivaltts4r"

    "I'm talking".to_speech

This project has been developed using Festival TTS and lame libraries.

The flash mp3 player used to play the voice has been developed by dew under Creative Commons Attribution-ShareAlike License France license.

More info about festivaltts4r and festivalttsOnRails: festivaltts4r.rubyforge.org

Working AIR / SQLite DataGrid example

Posted about 7 years back at work.rowanhick.com

!!!August 24 - The following code is for example only - DON'T copy and paste... the lovely little syntax highlighter screwed up casing and tag names. Just pay attention to the methods noted above and general structure.. I'll post up the correct files later on Okay so in my excitement to check out AIR/Apollo I tried to get the SQLite connection working. The sample code in the livedocs on one of the initial Flex Builder builds (the online docs have since been corrected), had a few errors in it ... So I reworked an example from start to finish to: 1. Open a connection 2. Create a table 3. Populate the table 4. Fetch from the table 5. Put results into a dataprovider. A couple of errors that will set you wrong in the docs, I've highlighted them below **. (Adobe ... feel free to put this into your examples and tidy it accordingly) 1. The example accesses SQLDBStatement, which doesn't exist - it's called SQLStatement 2. Instead of the method .db on SQLStatement it's .sqlConnection. Which will get you a working connection. Application File - test.mxml Datagrid component - com/rowanh/components/Customers.mxml (note watchout for the cdata tags when you copy and paste... syntax highlighting isn't perfect)

Episode 43: AJAX with RJS

Posted about 7 years back at Railscasts

This episode will walk you through adding AJAX functionality to a form using RJS. See how to easily update multiple elements on a page.

JRuby / Goldspike / Glassfish Deployment Diary

Posted about 7 years back at zerosum dirt(nap) - Home

Robert Dempsey has written a pretty solid little tutorial on deploying your first JRuby on Rails app with Glassfish. It’s powerful stuff. Go read it now, damnit!

The process can still be a bit tricky the first time, especially if you have additional gem dependencies, etc. But once you get it running you’ll be blown away by how simple it is to create a .war and deploy it to any of numerous pre-existing Java application servers (Glassfish).

I had a few issues initially (particularly with openssl support), so I figured I’d document them as an addenum to Robert’s tutorial in case you’re interested. Read on to see my notes…

  • Make sure to set JRUBY_HOME in your environment. It’s used by Goldspike.
  • If both ruby and jruby are in your path, you can specify the ‘version’ of rake to use by doing: jruby -S rake. This will run the specific command in the JRUBY_HOME/bin directory.
  • Edit the goldspike lib/war_config.rb and change the line that reference jruby-complete version 0.99 to read:
add_java_library(maven_library ('org.jruby', 'jruby-complete', '1.0'))
  • This will look for JRuby 1.0 instead of 0.9.9. As of this writing you’ll also have to manually retrieve jruby-complete-1.0.jar as the remote sources don’t seem to have it yet. Put it in JRUBY_HOME/lib.
  • I happen to be using SSL in my app, so I had to gem install it into the JRuby environment using jruby -S gem install jruby-openssl Make sure the gem ends up in your JRUBY_HOME/lib/ruby/gems hierarchy. Tell goldspike it needs to add this gem with the following line: add_gem(‘jruby-openssl’)
  • If you’re doing the jruby-openssl thing you’ll also have to retrieve the latest version of the Bouncy Castle Crypto APIs package for whatever version of Java you’re using (I’m on OS X, Java 1.5). Put this in your JRUBY_HOME/lib directory and then add the library to your war_config.rb file:
add_java_library(maven_library('bouncycastle', 'bcprov-jdk15', '136'))

UPDATES:

  • Make sure to copy jdbc_databases.rake from ActiveRecord-JDBC to your lib/tasks directory (for ActiveRecord-related rake tasks). Thanks to Ola Bini for pointing me in the right direction there.
  • Include the following in environment.rb:
if RUBY_PLATFORM =~ /java/
  require 'rubygems'
  RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end

First hours with Flex 3 / AIR

Posted about 7 years back at work.rowanhick.com

Small step for man, big step for RIA-kind ! I had to stay up past midnight to be one of the questionably committed few to read the words of joy spread by Ted Patrick. Not more than 2 seconds later I download Flex 3 builder. So far I've managed to spend a good solid 3-4 hrs in Builder 3 without any hiccups or crashes. A little gem of a resource, missed out on the various announcements, are the videos on onflex.org. Check out in particular the refactoring one. Looks like some serious goodness to be toyed with there. Something tells me Adobe is on a war path with this one, going for bigtime developer buy in and I'm pretty much sold. Good stuff Adobe! Top marks.

Why SEO is Important

Posted about 7 years back at PJ Hyett

While I was at CNET, traffic was growing steadily on our sites, but we had a rude awakening one particular day.

The “Oh Shit” moment

I remember the morning when my boss said to me:

We’re having a conference call in a few minutes with CNET’s SEO dude, we lost half of our uniques starting last Thursday, why don’t you join in.

The first thing I did is wonder what the hell I did wrong, because in the back of my mind, this problem was inevitably engineering’s fault.

The realization that Google owns you

Chowhound was getting 85% of its traffic from Google. It has around 500k topics, averaging 4.5 posts per topic, each an opportunity to become indexed by Google.

This particular week, Google decided to purge its index of stale data, and in doing so, eliminated the majority of the pages Chowhound had indexed, thus slashing our uniques in half. An interesting side-note was that our pageviews didn’t drop nearly as much, because the core users that were still visiting the site had a much higher pageview per visit ratio than the Google visitors.

What we did wrong

The solution was actually quite simple. On every board, we originally used ‘Next’ and ‘Previous’ links that would paginate you to the corresponding page of topics. Straightforward, but horrible for Google’s bots. They’d click a few of the Next links and say the hell with this and move on.

To give you an idea, the Manhattan board alone has over 800 pages of topics, and when Google is only looking at the first three pages, you have a massive problem.

How we fixed it

Simply put, I wrote the will_paginate plugin. Instead of just having ‘Next’ and ‘Previous’, it also displays a window of page numbers that allows bots the ability to navigate hundreds more pages within one click. Now we’re getting somewhere.

Eureka!

As the traffic began to come back in a serious way, well beyond where it was before the dip, the notion of SEO became quite clear to me. Given a site with tons of great content, instead of building more features, you should be trying to leverage what you already have.

This also makes a lot of sense from a financial standpoint. How long would it take your team to build a new feature for 10k more uniques a day, how long would it take them to add meta tags and a sitemap for 10k more uniques a day. There’s no comparison.

The Checklist

SEO isn’t rocket science (unless you’re trying to push the envelope), you just have to be aware of a few guidelines.

Page-specific
  • Unique title tag
  • Unique meta description (Yahoo is the only one using meta keywords anymore)
  • One h1 tag (the text used in your h2-h4 tags is still very important, though)
Site-wide
  • Allow only quality outbound links (eg. rel="nofollow" on all user-generated links)
  • Block duplicate content from being indexed with robots.txt
  • Structure your CSS so the content can go first
  • Consistent navigation that allows bots to get to any page on your site within 2 or 3 clicks

Piece of cake. This discussion can go far deeper than these points, but if you do the stuff above, you’re 90% of the way there. The last 10% is the most time-consuming, so I leave that to you to decide if it’s worth your time.

I know a lot of people think of SEO as a dirty word, and that it conjures up negatives connotations of link-baiting and spam, but that really couldn’t be further from the truth. I’m just going to start calling it FT…Free Traffic.

Speaking of Which

Err Free does more than just Rails, we’d be happy to apply what we’ve learned about SEO to your site. Who doesn’t love Free Traffic?

Why SEO is Important

Posted about 7 years back at PJ Hyett

While I was at CNET, traffic was growing steadily on our sites, but we had a rude awakening one particular day.

The “Oh Shit” moment

I remember the morning when my boss said to me:

We’re having a conference call in a few minutes with CNET’s SEO dude, we lost half of our uniques starting last Thursday, why don’t you join in.

The first thing I did is wonder what the hell I did wrong, because in the back of my mind, this problem was inevitably engineering’s fault.

The realization that Google owns you

Chowhound was getting 85% of its traffic from Google. It has around 500k topics, averaging 4.5 posts per topic, each an opportunity to become indexed by Google.

This particular week, Google decided to purge its index of stale data, and in doing so, eliminated the majority of the pages Chowhound had indexed, thus slashing our uniques in half. An interesting side-note was that our pageviews didn’t drop nearly as much, because the core users that were still visiting the site had a much higher pageview per visit ratio than the Google visitors.

What we did wrong

The solution was actually quite simple. On every board, we originally used ‘Next’ and ‘Previous’ links that would paginate you to the corresponding page of topics. Straightforward, but horrible for Google’s bots. They’d click a few of the Next links and say the hell with this and move on.

To give you an idea, the Manhattan board alone has over 800 pages of topics, and when Google is only looking at the first three pages, you have a massive problem.

How we fixed it

Simply put, I wrote the will_paginate plugin. Instead of just having ‘Next’ and ‘Previous’, it also displays a window of page numbers that allows bots the ability to navigate hundreds more pages within one click. Now we’re getting somewhere.

Eureka!

As the traffic began to come back in a serious way, well beyond where it was before the dip, the notion of SEO became quite clear to me. Given a site with tons of great content, instead of building more features, you should be trying to leverage what you already have.

This also makes a lot of sense from a financial standpoint. How long would it take your team to build a new feature for 10k more uniques a day, how long would it take them to add meta tags and a sitemap for 10k more uniques a day. There’s no comparison.

The Checklist

SEO isn’t rocket science (unless you’re trying to push the envelope), you just have to be aware of a few guidelines.

Page-specific
  • Unique title tag
  • Unique meta description (Yahoo is the only one using meta keywords anymore)
  • One h1 tag (the text used in your h2-h4 tags is still very important, though)
Site-wide
  • Allow only quality outbound links (eg. rel="nofollow" on all user-generated links)
  • Block duplicate content from being indexed with robots.txt
  • Structure your CSS so the content can go first
  • Consistent navigation that allows bots to get to any page on your site within 2 or 3 clicks

Piece of cake. This discussion can go far deeper than these points, but if you do the stuff above, you’re 90% of the way there. The last 10% is the most time-consuming, so I leave that to you to decide if it’s worth your time.

I know a lot of people think of SEO as a dirty word, and that it conjures up negatives connotations of link-baiting and spam, but that really couldn’t be further from the truth. I’m just going to start calling it FT…Free Traffic.

Speaking of Which

Err Free does more than just Rails, we’d be happy to apply what we’ve learned about SEO to your site. Who doesn’t love Free Traffic?

JRuby Reaches 1.0

Posted about 7 years back at zerosum dirt(nap) - Home

JRuby 1.0 has been officially released. This is huge news. Complete compatibility with Ruby 1.8 is pretty much a done deal. Rails apps run. You can deploy your Rails apps in Glassfish. I mean, how cool is that?

You should check out team member Charles Nutter’s blog for more details. In a nutshell, the future looks like tighter integration with Java as an application platform, and a major focus on optimizing performance. Also a lot of interest in Ruby 1.9/2.0. If you attended Railsconf this year, you most likely got pretty excited about JRuby, and for good reason.

If you’ve never tried it out before, Atlantic Dominion Solutions has put together a great tutorial on getting started with JRuby on OS X. Or, even easier, go get yourself a copy of NetBeans 6.0 M9, which comes bundled with JRuby as the default interpreter for in-IDE development.

Episode 42: with_options

Posted about 7 years back at Railscasts

Several methods in rails take a hash of options as the last argument. If you are passing the same options to several methods, you can remove this duplication by using with_options. Learn all about it in this episode.

Franken-php-rails-apache-stein

Posted about 7 years back at work.rowanhick.com

Every wondered about the possibility of running a rails app, and a php (or anything else for that matter) site together, on one virtual host, on apache. But why? the hordes screamed ... DHH keels over ... the PHP community says ahh just put it in CakePHP... and to you it feels just plain *wrong*. However, there is always that odd need, every now and then, that you have to do it. So here's how. It's really simple, assuming you're using mongrel cluster and setup a balancer in Apache for it, like so in one of the conf files... <Proxy balancer://mybalancer.rowanhick.com> BalancerMember http://localhost:2000 BalancerMember http://localhost:2001 BalancerMember http://localhost:2002 </Proxy> Then on the paths that you want to mash up with your vhost, it's as simple as this... For specific file mapping to an action: ProxyPass /some_path/some_file balancer://mybalancer.rowanhick.com/mycontroller/myaction ProxyPassReverse /some_path/some_file balancer://mybalancer.rowanhick.com/mycontroller/myaction ProxyPreserveHost On For one path mapping to a controller: ProxyPass /some_path/ balancer://mybalancer.rowanhick.com/mycontroller/ ProxyPassReverse /some_path/ balancer://mybalancer.rowanhick.com/mycontroller/ ProxyPreserveHost On Restart and you're away. (even if it feels dirty)

NHRuby Meeting Tuesday 06.12

Posted about 7 years back at zerosum dirt(nap) - Home

Usually the NHRuby meets are scheduled for the third Tuesday of the month, but we had to change it up this time due to some schedule conflicts.

I’ll be speaking about integrating a Flash widget with Rails-based RESTful web services and also giving a brief overview of how to contribute to Rails and other open source projects (I guess you could say Josh Susser’s talk at Railsconf inspired me). Scott will be doing an overview of the tabnav plugin and… something else, too.

More information and directions can be found at the NHRuby Wiki. Also, many thanks to our new host/sponsor for the meetings, RMC Research.

Our Contribution to Advanced Rails Recipes

Posted about 7 years back at Revolution On Rails

We submitted a few recipes, answering the call for sharing what is happing in the rails community, and a half a dozen of them were accepted as entries to the upcoming book. If you enjoyed reading the blog, you would soon have a chance to see some of it on paper.

Our Contribution to Advanced Rails Recipes

Posted about 7 years back at Revolution On Rails

We submitted a few recipes, answering the call for sharing what is happing in the rails community, and a half a dozen of them were accepted as entries to the upcoming book. If you enjoyed reading the blog, you would soon have a chance to see some of it on paper.