Ticketish

Posted about 7 years back at benmyles.com - Home

It has been a while since I've posted on my personal blog. In fact, I've decided to start fresh. Lately I've been very busy at Integral Impressions working on some great Ruby on Rails projects.

One such project is Ticketish. Just a few days ago we started sending out invitations for a private beta program. Ticketish is a simple issue/bug/ticket management web app, designed to do what it needs to do and then get out of the way.

We built Ticketish for internal use, and have been using it for some months now. We've come to really appreciate it, and decided to add some polish and release it to the world. If you're interested, go sign up for the beta and I'll get an invitation to you within a day or two (probably quicker).

The State (And Future) Of The UJS Plugin

Posted about 7 years back at danwebb.net - Home

Over the past few weeks loads of people have been asking me about what’s going on the UJS plugin. It’s obviously fallen in to disrepair so people, understandably, have been concerned. There has been a reason for this aside from the fact that I am a lazy barsteward (which of course I am, but that’s beside the point). Here is a letter I’ve just written to the UJS mailing list that I’d thought I’d post here to try to get a little more feedback. It’s a little bit long but bear with me…

I’ve been chatting to Luke and users of UJS about what to do with it and still haven’t quiet decided hence the lack of news but below is a rundown of where we are at on the whole thing. However, this is definitely personal opinion and doesn’t necessarily represent Luke’s opinion on the matter.

Essentially, the status is that, of late, I personally have not used UJS at all and have found a much better process by using Low Pro on its own without all the Ruby scaffolding of the UJS plugin. Secondarily, after talking to lots of developers at RailsConf it seems that the UJS plugin has failed to truly achieve it’s main goal which is to get Rails developers to write JavaScript using progressive enhancement. Many people seem to mainly use the plugin to get their JavaScript in to a separate file which is actually not even essential to progressive enhancement and I think this is a failing in the design of UJS itself. To achieve progressive enhancement you really need to think of JavaScript as a separate layer on top of a working HTML application but UJS lets you get away with keeping behavior in your views and hence leads many developers to think in the same way as they did before but think they are unobtrusive because they don’t see any JavaScript in their HTML – which is obviously not what we wanted to achieve. While many people can and do successfully use UJS for progressive enhancement even more seem not to – UJS has not been the ‘angel on your shoulder’ that I originally wanted it to be.

On top of this, the method by which the generated JavaScript is kept in the session has many limitations which myself and Luke have been aware of from the start. It’s not generally a good idea to keep this much information in the session (in fact, normally I never store more than a user ID if I can help it) and while acceptable for light to medium use it does have an upper limit depending on the type of session storage you are using. Rails edge now uses cookies to store session info by default which have a very very low limit which will cripple UJS completely. We have considered other alternatives such as some kind of file based storage but every time it just strikes me as too much scaffolding just to allow developers to put behavior in their view files which, as a said above, I’ve come to believe is a really bad idea anyway.

One of the things that I do personally like and something that has received the most positive feedback are the behavior helpers (the make_*) stuff which essentially encapsulate common tasks with sensible defaults in a very Rails like way. It’s a real time saver and the conventions provided mean that the best path (such as using this.href for the Ajax url) is the easiest. Recently, I’ve come to do this in my own projects via Low Pro and it’s behavior ‘classes’ (although they need a better name!). Now via Low Pro I can write stuff like:

Event.addBehavior({
  '.product a.description' : Remote.Link({ update : 'product_description' }),
  '.product' : Draggable({ revert : true }),
  '#basket' : Droppable
});

I really like this and am slowly building up a library (which you can see if you look at the Low Pro trunk) of common behaviors. There’s a date picker, a drag/drop implementation and the remote stuff I’ve illustrated above. I’m planning on writing autocompleters and in-place editors as behaviors as well. But behaviors have proven really easy to write and I love them as a tool for building site specific components. In fact, as I’ve worked with Low Pro it’s become apparent to me that behaviors are by far the killer feature which is interesting as they were just an experiment I hacked together one day without much thought.

So what to do? Well, there’s two ways to go as far as I can see. The first is to shut down development on UJS completely (or hand it over to another party if anyone is interested) and go on to promote the techniques of implementing progressive enhancement using Low Pro that I’ve found to be so successful recently. This could possibly be via the UJS4Rails site or through my own site – I’m not sure which would be a better platform right now.

The other would be to re-think the UJS plugin totally and go for some kind of 2.0 release that would take a completely different tack. However, all of the ideas for this I’ve thought of or heard so far don’t really compel me to write them. I think to work on this myself I’d need to be sure that I’d want to use it and so far this is not the case but any ideas and feedback are very welcome so please do drop me a mail or feedback on this list.

Either way, we need to make fixes to the current plugin to make it work with Rails 1.2.3 which I’ve been working on recently but I’d love patches if you’ve already solved these issues yourself (which it appears many of you have).

So yes, that’s it. Let me know what you think, I’d appreciate any feedback you have.

Large Mephisto Deployment

Posted about 7 years back at Mephisto - Home

I’m not sure how many other large sites use Mephisto, but I managed to deploy it to the-leaky-cauldron.org the other day (after lots of heavy modding to get things like polls and article ratings working). Leaky gets about 3 million unique visitors a month – and with 9,000 articles and over 300,000 comments (not all of which have converted yet) I thought I’d let you know. —Mephisto group message by Nick Poulden.

I’m not sure, but I think that’s one of the largest Mephisto installations around. Great job, Nick Poulden!

New DRYML getting closer

Posted about 7 years back at The Hobo Blog

If you’re wondering why things have been a bit quiet around here of late, it’s because we’ve been taking a pretty hard look at where we’ve got so far with DRYML, and figuring out where exactly we want to be.

We really wanted to raise our game and make DRYML even simpler and more elegant than it is already. The good news is, things are starting to come into focus.

During this process we’ve considered a lot of out-there ideas, and have even considered a complete re-write with an entirely new approach. Fortunately, and as so often seems to be the case, the journey has taken us full circle, and we’ve ended up pretty close to where DRYML is right now. It’s just we now have a much better understanding of why it works so well :-). All we really need is a bit of polish here and there and a couple of tweaks.

Just today James and I have had a great day nailing all this down, and it looks like we’re ready to start implementing the new features. We’re really excited about this new stuff and are really looking forward to getting it ready for you all to start hacking with.

I’m afraid your existing DRYML pages won’t work with the new syntax, but the overall semantics is hardly changed so it should be a no-brainer to port everything over. It will be well worth it!

New DRYML getting closer

Posted about 7 years back at The Hobo Blog

If you’re wondering why things have been a bit quiet around here of late, it’s because we’ve been taking a pretty hard look at where we’ve got so far with DRYML, and figuring out where exactly we want to be.

We really wanted to raise our game and make DRYML even simpler and more elegant than it is already. The good news is, things are starting to come into focus.

During this process we’ve considered a lot of out-there ideas, and have even considered a complete re-write with an entirely new approach. Fortunately, and as so often seems to be the case, the journey has taken us full circle, and we’ve ended up pretty close to where DRYML is right now. It’s just we now have a much better understanding of why it works so well :-). All we really need is a bit of polish here and there and a couple of tweaks.

Just today James and I have had a great day nailing all this down, and it looks like we’re ready to start implementing the new features. We’re really excited about this new stuff and are really looking forward to getting it ready for you all to start hacking with.

I’m afraid your existing DRYML pages won’t work with the new syntax, but the overall semantics is hardly changed so it should be a no-brainer to port everything over. It will be well worth it!

Episode 45: RJS Tips

Posted about 7 years back at Railscasts

This episode is packed with little RJS goodies. Learn the different ways to access an element, how to add "if" conditions and how to apply an effect to multiple elements.

Testing Helpers in Rails

Posted about 7 years back at

It can be useful at times to unit test helpers to make sure they generate correct html. It is not obvious how to do this at first. So far I have been testing my helper by defining a class “MyClass” at the top of my unit test and including all the appropriate modules. I also need to define a url_for method if I ever want to test helpers that generate links.

The code follows (Replace MyHelper with your appropriate helper class);

class MyClass
  include ERB::Util
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::UrlHelper
  include MyHelper

  def url_for(options)
    ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
    generated_path, extra_keys = ActionController::Routing::Routes.generate_extras(options, {})
    generated_path
  end
end

Then in my tests I do something like;

def test_revision_link
  assert_equal(
    "<a href=\"http://svn.sourceforge.net/viewvc/jikesrvm?view=rev&amp;revision=22\">22</a>", 
    MyClass.new.revision_link(22))
end

Seems easy enough to do in retrospect but things usually do.

Episode 44: Debugging RJS

Posted about 7 years back at Railscasts

RJS and AJAX can be difficult to debug. Many times you don't get any error message in the browser. Learn different techniques for solving these tricky problems in this episode.

> 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.