Making Rails More (Artificially) Intelligent slides & source code

Posted almost 7 years back at Spejman On Rails

I have just posted the session slides and source code of the RailsConf Europe talk Making Rails More (Artificially) Intelligent that Santiago Bel and me did last Tuesday. You can download them all at bee.com.es

We hope you find them useful. Please note that the ones that are at the railsconfeurope.com web are out of date, now I will send the updated slides to o'reilly.

Apple Wireless Keyboard: First impressions

Posted almost 7 years back at poocs.net - Home

Apple announced new keyboards alongside its new iMacs in early August, but the bluetooth variant wasn’t shipping until mid-September. As you can see, mine just shipped (I’ve been using Apple bluetooth keyboards since they first came out).

When you initially open the package, these things really seem tiny. But in the end, they’re exactly the size as the thicker older model minus the numeric keypad and cursor keys moved over.

With regards to the touch feel (and I’m typing this on the keyboard you see above), they feel different but I can type quick and fast easily. The keyboard of my MacBook Pro still feels a little softer and typing on the old whitish Apple keyboards is a different deal altogether. The lowered height of the device is definitely a welcome change.

So far I don’t miss the numeric keypad (and I’m far from being an accountant). The only thing I have to mentally adjust for is the lack of an enter key right next to where I keep the mouse. Due to the smaller size, my mouse currently lives quite a bit to the right and I tended to hit that extra enter key with my right hand occasionally when reaching over from the mouse. This hits solid table ground for the time being. But I’ll live.

Keyboard Update 1.2 popped up when checking with Software Update after pairing the keyboard, installed and rebooted, the new keys for Dashboard and iTunes (play/pause/skip) worked immediately. So no issues to report there.

Update: Here’s a shot of the front edge with a (metric) ruler attached to it, as some commenters indicated interest in it.

script/generate undo

Posted almost 7 years back at Beyond The Type - Home

Here is small idea I’ve had for sometime that I quickly knocked up yesterday.

Generators are great but we have all had those “Oops!” moments where you realised that what you created was not quite what you wanted to do. Enter script/generate undo….

script/generate model WrongName
      exists  app/models/
      exists  test/unit/
      exists  test/fixtures/
      create  app/models/wrong_name.rb
      create  test/unit/wrong_name_test.rb
      create  test/fixtures/wrong_names.yml
      exists  db/migrate
      create  db/migrate/001_create_wrong_names.rb

.. ….

oops.. didn’t want to do that.

script/generate undo
Undo'ing: model WrongName
    notempty  db/migrate
    notempty  db
          rm  db/migrate/001_create_wrong_names.rb
          rm  test/fixtures/wrong_names.yml
          rm  test/unit/wrong_name_test.rb
          rm  app/models/wrong_name.rb
    notempty  test/fixtures
    notempty  test
    notempty  test/unit
    notempty  test
    notempty  app/models
    notempty  app

Under the hood all it is doing is keeping a log of your generator history (see /log/generator.log). When undo is called it looks at the last log entry and passes it onto script/destroy. Pretty simple stuff but it saves you having to remember what it was that you typed previously.

The patch as it stands is pretty rough and ready. I’m posting this here to get some feedback to gauge whether it’s worth pursuing further.

UPDATE Plugin on the way. I’ve created a new project on Rubyforge for any plugins I make - it should be setup soon. (just waiting for approval)

UPDATE 2: Plugin now released. See this post

Graphics, genomics and ruby

Posted almost 7 years back at Saaien Tist


Having known and used the Generic Genome Browser (aka gbrowse, see here) for years now, it occured to me a while ago that it should be o so simple to create the same functionality with a much easier setup if we could use ruby instead of perl.

Gbrowse depends on bioperl's Bio::Graphics module. Although gbrowse has been instrumental for many people's research, it does take a bit of work to get it installed. Apart from bioperl, it depends on Apache for showing the results in a browser. Compare that to any Rails application, where you basically just need ruby and a "gem install rails". I've created rails applications in the past that contain exactly the kind of data that would typically be visualized by something like gbrowse. Takes no time at all to set up and you can even get away by virtually writing no code. And no Apache to be installed, or configuration files that you can't access because you're not root.

Such a rails application makes it possible to browse, edit and delete the data. The problem comes with the visualization bit. There's no bioruby graphics library (yet?) that automatically parses features on a reference and creates a nice picture of where your genes are on that chromosome. Of course, the genes should be clickable so you can link through to NCBI or Ensembl.

I've spend some time in the last year creating such a Bio::Graphics thing for ruby. I wanted it to behave the same as the one from bioperl: there one panel that has one or more tracks, and each track has features on it. Even though it was quite easy to create a proof-of-concept library, the most difficult part was actually finding the right backend.

What should I use to create the pictures themselves? As I'd worked with SVG before, that seemed the right way to go. Downloaded a library from http://raa.ruby-lang.org/project/ruby-svg/ and got a prototype running quite easily. Problem: I needed an SVG viewer or firefox to actually view the picture, and zooming in/out screwed up all text. So after weeks of digging around, I've found rcairo, a ruby-binding to Cairo. Migrating to this backend was easy peasy and the pictures look really nice (see at the top). Unfortunately, it's impossible to create clickable glyphs using Cairo itself, but that can be easily worked around by creating a html file with the map. That's exactly what gbrowse does as well, isn't it?

The picture at the top has been created using the following simple script:


g = BioExt::Graphics::Panel.new(800, 1200, true, 1, 610)

track1 = g.add_track('generic')
track2 = g.add_track('directed',[0,1,0],'directed_generic')
track3 = g.add_track('triangle',[0.5, 0.5, 0.5],'triangle')
track4 = g.add_track('spliced',[1,0,0],'spliced')
track5 = g.add_track('directed_spliced',[1,0,1],'directed_spliced')

track1.add_feature('bla1','250..375', 'http://www.newsforge.com')
track1.add_feature('bla2','54..124', 'http://www.thearkdb.org')
track1.add_feature('bla3','100..449', 'http://www.google.com')

track2.add_feature('bla4','50..60', 'http://www.google.com')
track2.add_feature('bla5','complement(80..120)', 'http://www.sourceforge.net')

track3.add_feature('piep','56')
track3.add_feature('bla','103', 'http://digg.com')

track4.add_feature('gene1','join(34..52,109..183)','http://news.bbc.co.uk')
track4.add_feature('gene2','complement(join(170..231,264..299,350..360,409..445))')
track4.add_feature('gene3','join(134..152,209..283)')

track5.add_feature('gene1','join(34..52,109..183)', 'http://www.vrtnieuws.net')
track5.add_feature('gene2','complement(join(170..231,264..299,350..360,409..445))','http://www.roslin.ac.uk')
track5.add_feature('gene3','join(134..152,209..283)')

g.draw('my_panel.png')



What happens here?
Line 1: Create a new panel for a sequence of 800 bp, with the picture being 1200 points wide. Make all glyphs clickable if a URL is defined (the true), and zoom into the region from 1 to 610 bp.
Lines 3-6: Create different tracks, each with a name, a colour (in RGB at the moment) and a type.
Lines 8-24: Add features to those tracks, each with a name, a locus and an optional URL to link out to external websites. Notice how it handles spliced features and features on the reverse strand?
Line 26: Create the PNG (and in this case: also HTML) file.

Here's a nicer way to produce the same type of output:

#Initialize graphic for a nucleotide sequence of 600 bp
my_panel = BioExt::Graphics::Panel.new(1000, 1200, false, 1, 600)

#Create and configure tracks
track_SNP = my_panel.add_track('SNP')
track_gene = my_panel.add_track('gene')
track_transcript = my_panel.add_track('transcript')

track_SNP.feature_colour = [1,0,0]
track_SNP.feature_glyph = 'triangle'
track_gene.feature_glyph = 'directed_spliced'
track_transcript.feature_glyph = 'spliced'
track_transcript.feature_colour = [0,0.5,0]

# Add data to tracks
DATA.each do |line|
line.chomp!
ref, type, name, location, link = line.split(/\s+/)
if link == ''
link = nil
end
if type == 'SNP'
track_SNP.add_feature(name, location, link)
elsif type == 'gene'
track_gene.add_feature(name, location, link)
elsif type == 'transcript'
track_transcript.add_feature(name, location, link)
end
end

# And draw
my_panel.draw('my_panel.png')

__END__
chr1 gene CYP2D6 complement(80..120)
chr1 gene ALDH 100..449
chr1 SNP rs1234 107
chr1 gene bla complement(400..430)
chr1 SNP rs9876 44
chr1 gene some_gene complement(join(170..231,264..299,350..360,409..445))
chr1 transcript transcript1 join(250..300,390..425)
chr1 transcript transcript2 253..330
chr1 transcript transcript3 266..344
chr1 transcript transcript4 complement(join(410..430,239..286,129..151))


If someone would actually be interested in getting the library behind this, just let me know. It should be really easy to incorporate this in a rails application where the data are actually stored in a database.

I wonder what if any role _why's Shoes thing would/could play...

UPDATE: This library has now been improved a bit and is hosted on rubyforge. You can find a tutorial and the whole API documentation at http://bio-graphics.rubyforge.org. You can find instructions on how to install and use it over there.

UPDATE TWO: Forget the previous update. I have moved the bio-graphics code to github. See http://github.com/jandot/bio-graphics. That should make it much easier to fork the code and get more input from other developers.

RailsConf Europe - Wednesday Sessions - 3

Posted almost 7 years back at Liverail - Home

This is my last session of the day as i’ll have to run about by 5 and dive in a taxi to catch my flight.

Extending Rails to Use the Presenter Pattern

The Extending Rails to Use the Presenter Pattern could be re-titled talking Ruby On Rails beyond MVC by Jay Fields of ThoughtWorks.

He lost me quickly in ThoughtWorks-Speak, referencing everything in the ideas of Enterprise patterns. It’s Martin Fowler world. It’s tough to talk to people who may not be fully versed in your lingo and get the subtle references.

I’m gathering some ideas that Presenters are a way to make testing controllers easier and view testing isn’t really worth it (which I’ll agree with).

I’ll suggest checking out “Jay’s blog’:http://blog.jayfields.com/ if you are interested in these things as I didn’t get much out of this at all, Jay doesn’t even like the pattern. It was only about 25 minutes as well…. The person behind me just said “I’m feeling a bit swissed…..” and next to me “Possibly one of the most over-hyped talks here”

RailsConf Europe - Wednesday Sessions - 3

Posted almost 7 years back at Liverail - Home

This is my last session of the day as i’ll have to run about by 5 and dive in a taxi to catch my flight.

Extending Rails to Use the Presenter Pattern

The Extending Rails to Use the Presenter Pattern could be re-titled talking Ruby On Rails beyond MVC by Jay Fields of ThoughtWorks.

He lost me quickly in ThoughtWorks-Speak, referencing everything in the ideas of Enterprise patterns. It’s Martin Fowler world. It’s tough to talk to people who may not be fully versed in your lingo and get the subtle references.

I’m gathering some ideas that Presenters are a way to make testing controllers easier and view testing isn’t really worth it (which I’ll agree with).

I’ll suggest checking out “Jay’s blog’:http://blog.jayfields.com/ if you are interested in these things as I didn’t get much out of this at all, Jay doesn’t even like the pattern. It was only about 25 minutes as well…. The person behind me just said “I’m feeling a bit swissed…..” and next to me “Possibly one of the most over-hyped talks here”

RailsConf Europe - Wednesday Sessions - 2

Posted almost 7 years back at Liverail - Home

First of all, some of the presentation downloads for RailsConf Europe have started appearing on the O’Reilly site here, so please run along and grab them. Nothing to see here.

Well ok, i’ll continue live-blogging from the afternoon sessions but I have a plane to catch soon :-)

Development Case Study: MindMeister

I’ve chosen the lest technical session because sometime the anecdote, the story, is more useful than the code. Development Case Study: MindMeister is the story off the online mind mapping tool “The google docs of mind mapping” apparently.

MindMeister It’s all AJAX (and a lot of it), tough call I think the interface could be way better in Flex and you have offline Mind-mapping possibilities with AIR.

They started with prototyping, then some design concepts , which all looked quite good if you ask me.

The name was the hardest thing to fine.

I hear that.. It is very hard to find a name. I agree you shouldn’t be obsessed with finding a free .com domain name, 37signals never did.

Private betas are good, 2 launches making it exclusive with lots of feedback. Starting with just friends but allowing invites to others. No longer than 2 months with an upgrade offer at the end.

They got lots of competitors and clones after launching which I think is a common problem, just make sure you are the brightest and the best. MindMeister have some good user stats, better traffic than their competitors (according to Alexa) but less features than the competitors. Usability is what makes them better. Every euro spent on design is worth it..

Recommendations

  • Get a great designer on board
  • Target non-technical users
  • Watch every Apple demo

Marketing

  • Write to bloggers
  • Post site to app portals
  • Create an API
  • Write regular newsletter & blog posts
  • “Add to del.icio.us / digg” button
  • Spend time (and money) on SEO
  • Be generous with Premium accounts
  • Don’t comment spam
  • Don’t pay for placements and ads
  • Don’t start charging before its really stable
  • Carefully select premium features
  • Think of students et al

Technical Issues

  • Everybody has them
  • It pays to be honest
  • Explain what happened
  • Announce maintenance windows

It seems MindMeister are going offline with Google Gears which is the right move, maybe AJAX was a good choice after all. Use a canvas library which turns to VRML on IE.. And Wirecard

I’ve got to day playing with it now MindMeister is pretty good, its slick works well and I can see how it would be both useful and easy with is important in brainstorming tools. Bravo guys!

Outsourcing to Open Source

Another non-technical session Outsourcing to Open Source from Tobias Luetke at “Shopify’:http://www.shopify.com/. I chose this because i’m a real fan of Shopify, JapedPixel and because it’s more relevant to my business than the others. But I wish I could also have gone to Exploring Very Rapid Web Development Techniques with Hobo by Tom Locke, but those the breaks..

Tobias is talking about Liquid which for those that don’t know is a safe templating method for Rails which you can give to customers to make their own designs/themes without them breaking your app. And he wrote it on the plain to RailsConf 2005!! Not only is it safe but only exposes what you want to expose ie.


class Product << ActiveRecord::Base
liquid_methods :title, :price, :description

If you don’t know about liquid, go look it up. If you ever developing a SaaS with needs safe themes for users, its a great fit. Tobias is also talking about Vision which is a downloadable theme engine which works offline. Using this tool the launched a competition for themes for shopify with an iPod nano, the people who entered then now do full time Shopify themeing and earn more money from it than JadedPixel!!

Vision works by donwloading a Mock version of Shopify with no backend but the objects returned have real like data. Like a massive test case your users can download and theme.

JapedPixel also issued the open source AcitveMerchant as a library for payment processing gateways. It is really useful contribution to Rails. It supports 40+ gateways. Often they are commission by shopify customers who pay a ruby developer to contribute a specific merchant to ActiveMerchant which then automatically appears in Shopify. This is a great example of crowd-sourcing helping the community which then helps your product. It’s like work for free….

Crowdsourcing

Crowdsourcing is a neologism for the act of taking a job traditionally performed by an employee or contractor, and outsourcing it to an undefined, generally large group of people, in the form of an open call. For example, the public may be invited to develop a new technology, carry out a design task, refine an algorithm or help analyze large amounts of data.

Examples of crowdsourcing are threadless.com, freebase, Mechanical Turk, PeertoPatent, OrganizedWisdom. Tobias simple example of CrowdSourcing is giving your users the ability to create a new translation of text in checkout and feed that back to the system. They get credit for the translation and shopify track the progress of translation. This allows them to email authors when they add a new string that needs translation.

A really good talk from Tobias but he could have gone into the theme of crowd-sourcing more than than shopifies use of it, then given the examples. Just a structural thing.

For those interested. Shopify use Solr and love it. From being a public facing Rails application they get some really random requests such as a whole Shakespeare text in a param!. The run 25,000 public facing with different URLs, so they get a lot of web-spiders on the servers. They use memcache generating a unique key for every possible input for a page, check memcache to see if it has a version. If memcache doesn’t have it they gzip it and stick it in memcache. They use version numbers of each object and the version number is part of the key, instead of expiring they just have to lookup a new key and get a cachemiss so generate it. No cache invalidation.

RailsConf Europe - Wednesday Sessions - 2

Posted almost 7 years back at Liverail - Home

First of all, some of the presentation downloads for RailsConf Europe have started appearing on the O’Reilly site here, so please run along and grab them. Nothing to see here.

Well ok, i’ll continue live-blogging from the afternoon sessions but I have a plane to catch soon :-)

Development Case Study: MindMeister

I’ve chosen the lest technical session because sometime the anecdote, the story, is more useful than the code. Development Case Study: MindMeister is the story off the online mind mapping tool “The google docs of mind mapping” apparently.

MindMeister It’s all AJAX (and a lot of it), tough call I think the interface could be way better in Flex and you have offline Mind-mapping possibilities with AIR.

They started with prototyping, then some design concepts , which all looked quite good if you ask me.

The name was the hardest thing to fine.

I hear that.. It is very hard to find a name. I agree you shouldn’t be obsessed with finding a free .com domain name, 37signals never did.

Private betas are good, 2 launches making it exclusive with lots of feedback. Starting with just friends but allowing invites to others. No longer than 2 months with an upgrade offer at the end.

They got lots of competitors and clones after launching which I think is a common problem, just make sure you are the brightest and the best. MindMeister have some good user stats, better traffic than their competitors (according to Alexa) but less features than the competitors. Usability is what makes them better. Every euro spent on design is worth it..

Recommendations

  • Get a great designer on board
  • Target non-technical users
  • Watch every Apple demo

Marketing

  • Write to bloggers
  • Post site to app portals
  • Create an API
  • Write regular newsletter & blog posts
  • “Add to del.icio.us / digg” button
  • Spend time (and money) on SEO
  • Be generous with Premium accounts
  • Don’t comment spam
  • Don’t pay for placements and ads
  • Don’t start charging before its really stable
  • Carefully select premium features
  • Think of students et al

Technical Issues

  • Everybody has them
  • It pays to be honest
  • Explain what happened
  • Announce maintenance windows

It seems MindMeister are going offline with Google Gears which is the right move, maybe AJAX was a good choice after all. Use a canvas library which turns to VRML on IE.. And Wirecard

I’ve got to day playing with it now MindMeister is pretty good, its slick works well and I can see how it would be both useful and easy with is important in brainstorming tools. Bravo guys!

Outsourcing to Open Source

Another non-technical session Outsourcing to Open Source from Tobias Luetke at “Shopify’:http://www.shopify.com/. I chose this because i’m a real fan of Shopify, JapedPixel and because it’s more relevant to my business than the others. But I wish I could also have gone to Exploring Very Rapid Web Development Techniques with Hobo by Tom Locke, but those the breaks..

Tobias is talking about Liquid which for those that don’t know is a safe templating method for Rails which you can give to customers to make their own designs/themes without them breaking your app. And he wrote it on the plain to RailsConf 2005!! Not only is it safe but only exposes what you want to expose ie.


class Product << ActiveRecord::Base
liquid_methods :title, :price, :description

If you don’t know about liquid, go look it up. If you ever developing a SaaS with needs safe themes for users, its a great fit. Tobias is also talking about Vision which is a downloadable theme engine which works offline. Using this tool the launched a competition for themes for shopify with an iPod nano, the people who entered then now do full time Shopify themeing and earn more money from it than JadedPixel!!

Vision works by donwloading a Mock version of Shopify with no backend but the objects returned have real like data. Like a massive test case your users can download and theme.

JapedPixel also issued the open source AcitveMerchant as a library for payment processing gateways. It is really useful contribution to Rails. It supports 40+ gateways. Often they are commission by shopify customers who pay a ruby developer to contribute a specific merchant to ActiveMerchant which then automatically appears in Shopify. This is a great example of crowd-sourcing helping the community which then helps your product. It’s like work for free….

Crowdsourcing

Crowdsourcing is a neologism for the act of taking a job traditionally performed by an employee or contractor, and outsourcing it to an undefined, generally large group of people, in the form of an open call. For example, the public may be invited to develop a new technology, carry out a design task, refine an algorithm or help analyze large amounts of data.

Examples of crowdsourcing are threadless.com, freebase, Mechanical Turk, PeertoPatent, OrganizedWisdom. Tobias simple example of CrowdSourcing is giving your users the ability to create a new translation of text in checkout and feed that back to the system. They get credit for the translation and shopify track the progress of translation. This allows them to email authors when they add a new string that needs translation.

A really good talk from Tobias but he could have gone into the theme of crowd-sourcing more than than shopifies use of it, then given the examples. Just a structural thing.

For those interested. Shopify use Solr and love it. From being a public facing Rails application they get some really random requests such as a whole Shakespeare text in a param!. The run 25,000 public facing with different URLs, so they get a lot of web-spiders on the servers. They use memcache generating a unique key for every possible input for a page, check memcache to see if it has a version. If memcache doesn’t have it they gzip it and stick it in memcache. They use version numbers of each object and the version number is part of the key, instead of expiring they just have to lookup a new key and get a cachemiss so generate it. No cache invalidation.

RailsConf Europe - Wednesday Sessions - 1

Posted almost 7 years back at Liverail - Home

Trying to make better choices today which shouldn’t be too hard. So I decided on following up my Flex on Rails background (which I havn’t be exploring recently), but since I was the first tutorial on integrating Flex and Rails, I thought i’d check on it’s progress.

Building Rich Internet Applications with Flex and Ruby on Rails

This session was given by Simeon Bateman, who although not Adobe is certainly a Flex expert and has real world in-anger experience of Flex and Rails.

Unfortunately Simeon spent far too much time on Flash background and had some problems with the Internet before getting to the good stuff. But did manage to quick demonstrations of

  • HTTPService using XML REST responses from Rails
  • AMF using WebORB
  • AMF using RubyAMF

To his credit the last 15 mins was some of the best and explained the advantages of AMF over HTTPService with great examples. Simeon reckons that RubyAMF is the way to go in the future as WebORB has not been updated in a year, other people I know concur with that.

The other question for people interested in Flash/Flex is:

What is Thermo?

Creating Hybrid Web and Desktop Applications with Rails and Slingshot

A session by Joyent on Slingshot. This is something i’ve had an interest in for a while, in the realms of the online/offline applications. In theory Slingshot offers downloadable Rails applications that run on the desktop but syncs with an online web-application.

It will do syncronisations, and you can extend the sync-hooks and will need to implement aggregate_data for your models to get the sync works. But it won’t do conflict resolutions, but it does handle auto-increment ids and foreign-key problems on the syncronisation side which is a pretty tough problem. It can also sync files as well as data between online and offline. You must have timestamps on your model to sync models which make sense.

I will do some drag and drop stuff but only on Mac OS X. This is a real problem, and certainly AIR could overtake easily in this area. I would like to see how I could get RailsDAV working with Slingshot on this.

Your code will be visible in the download, it is after all Ruby. So it better be open-source application on a behind firewall deployment. I don’t think this is this biggest problem as people won’t be able to copy it without the web-application component.

They downloads can be big. 20MB is the initial hit and applications can be as big as 100MB.

Overall it seems better on Mac OSX than Windows. It has DMG packaging, XCode customisation and changing Info.plist while the Windows deployment looks a lot harder.

In practice, its not complete. Here is a list of things it won’t do (Yet)

  • sync conflict resolution
  • encrypt your code
  • domain specific online/offline issues
  • package you application automatically
  • update itself + your Rails app code
  • native menus

But this is still one of the most interesting and innovative things being talked about at RailsConf Europe so was certainly worth intending. The presentation was well done and paced well, including presentation then questions then demo which is a lot to fill 45 minutes. Showing you don’t have to aim your presentation at the lowest common demoninator.

I’m wondering if you could just use the sync_controller parts of slingshot and write an AIR end…. Evil but useful.

Great demo..

RailsConf Europe - Wednesday Sessions - 1

Posted almost 7 years back at Liverail - Home

Trying to make better choices today which shouldn’t be too hard. So I decided on following up my Flex on Rails background (which I havn’t be exploring recently), but since I was the first tutorial on integrating Flex and Rails, I thought i’d check on it’s progress.

Building Rich Internet Applications with Flex and Ruby on Rails

This session was given by Simeon Bateman, who although not Adobe is certainly a Flex expert and has real world in-anger experience of Flex and Rails.

Unfortunately Simeon spent far too much time on Flash background and had some problems with the Internet before getting to the good stuff. But did manage to quick demonstrations of

  • HTTPService using XML REST responses from Rails
  • AMF using WebORB
  • AMF using RubyAMF

To his credit the last 15 mins was some of the best and explained the advantages of AMF over HTTPService with great examples. Simeon reckons that RubyAMF is the way to go in the future as WebORB has not been updated in a year, other people I know concur with that.

The other question for people interested in Flash/Flex is:

What is Thermo?

Creating Hybrid Web and Desktop Applications with Rails and Slingshot

A session by Joyent on Slingshot. This is something i’ve had an interest in for a while, in the realms of the online/offline applications. In theory Slingshot offers downloadable Rails applications that run on the desktop but syncs with an online web-application.

It will do syncronisations, and you can extend the sync-hooks and will need to implement aggregate_data for your models to get the sync works. But it won’t do conflict resolutions, but it does handle auto-increment ids and foreign-key problems on the syncronisation side which is a pretty tough problem. It can also sync files as well as data between online and offline. You must have timestamps on your model to sync models which make sense.

I will do some drag and drop stuff but only on Mac OS X. This is a real problem, and certainly AIR could overtake easily in this area. I would like to see how I could get RailsDAV working with Slingshot on this.

Your code will be visible in the download, it is after all Ruby. So it better be open-source application on a behind firewall deployment. I don’t think this is this biggest problem as people won’t be able to copy it without the web-application component.

They downloads can be big. 20MB is the initial hit and applications can be as big as 100MB.

Overall it seems better on Mac OSX than Windows. It has DMG packaging, XCode customisation and changing Info.plist while the Windows deployment looks a lot harder.

In practice, its not complete. Here is a list of things it won’t do (Yet)

  • sync conflict resolution
  • encrypt your code
  • domain specific online/offline issues
  • package you application automatically
  • update itself + your Rails app code
  • native menus

But this is still one of the most interesting and innovative things being talked about at RailsConf Europe so was certainly worth intending. The presentation was well done and paced well, including presentation then questions then demo which is a lot to fill 45 minutes. Showing you don’t have to aim your presentation at the lowest common demoninator.

I’m wondering if you could just use the sync_controller parts of slingshot and write an AIR end…. Evil but useful.

Great demo..

RailsConf Europe - Wednesday Keynotes

Posted almost 7 years back at Liverail - Home

Partly due to having to check out my hotel, partly due to my hangover and partly due to not being bothered I missed today’s pre-roller advert by ThoughtWorks to today’s keynotes.

But i’m here now for the session on Best Practices. A bit late. Siting at the back nursing my headache.

The Best Practices session is very codey but still entertaining so far covering test-first, associations, method naming and chaining. Expressive Interfaces they call them, readability and undestanding. Now moving on to with_scope and the dangers of using a before_filter with a scoped command, hence reducing all queries to a limited scope. For instance only finding posts for the current user. Instead use associations:


current_user.posts.find(params[id])

But it has uses. You can use method_messaging with a with_scope and create a dynamic has_many association through a proxy. Similarly very cool but I can see that being mis-used also. I think using method_missing should be a last resort, documented heavily and only used if it significantly improves readability or time. Not really as a best practice.

The use of conditions and commands in Ruby can be confusing as there is many ways of doing it. The question, which can be understood quickest?


command if conditional?
....
if conditional?
  command
end
...
conditional? and command
...
conditional? && command
...

All of the above do the same. For me number 2 is clearest but involves more typing, but I hate mixing up commands with conditionals in an expression, and the speakers agree.

RailsConf Europe - Wednesday Keynotes

Posted almost 7 years back at Liverail - Home

Partly due to having to check out my hotel, partly due to my hangover and partly due to not being bothered I missed today’s pre-roller advert by ThoughtWorks to today’s keynotes.

But i’m here now for the session on Best Practices. A bit late. Siting at the back nursing my headache.

The Best Practices session is very codey but still entertaining so far covering test-first, associations, method naming and chaining. Expressive Interfaces they call them, readability and undestanding. Now moving on to with_scope and the dangers of using a before_filter with a scoped command, hence reducing all queries to a limited scope. For instance only finding posts for the current user. Instead use associations:


current_user.posts.find(params[id])

But it has uses. You can use method_messaging with a with_scope and create a dynamic has_many association through a proxy. Similarly very cool but I can see that being mis-used also. I think using method_missing should be a last resort, documented heavily and only used if it significantly improves readability or time. Not really as a best practice.

The use of conditions and commands in Ruby can be confusing as there is many ways of doing it. The question, which can be understood quickest?


command if conditional?
....
if conditional?
  command
end
...
conditional? and command
...
conditional? && command
...

All of the above do the same. For me number 2 is clearest but involves more typing, but I hate mixing up commands with conditionals in an expression, and the speakers agree.

Insomnia: The Good, the Bad, and the Ugly

Posted almost 7 years back at Sporkmonger

  • The Good: Plenty of time to hatch brilliant ideas.
  • The Bad: Brilliant ideas do not help you fall asleep.
  • The Ugly: In the morning, you’re too tired to implement anything.

NetBeans 6.0 Beta 1 Available

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

NetBeans 6.0 Beta 1 is out and ready for download, including a slimmed-down Ruby-only version for those of you who don’t want all the extras. Personally I like having one IDE for both Java and Ruby but hey, I’m special. As I’ve written about before, I’m quite smitten with NetBeans and this latest release is the best yet. If you’re curious about why I’m gushing over it, read here, here, and here.

So yeah, it’s nice. Go download 6.0 Beta 1 and give it a try. It’s packaged with JRuby 1.0.1 and Glassfish v2, which is starting to look more and more attractive as a serious deployment option for Rails.

PS: those of you who are frustrated with Goldspike may want to take a look at Nick Sieger’s Warbler, an alternative for packaging up your WAR files.

PPS: you don’t have to use JRuby as your interpreter of course. Just go to preferences → Ruby and point it at MRI (/usr/bin/ruby or whatever) if you don’t want / need / like JRuby. And then you can use the fast debugger too. Inline Ruby debugging rocks.

RailsConf Europe - Tuesday Keynotes

Posted almost 7 years back at Liverail - Home

Tuesday is ending now with some final keynotes

Basically sandwiching in Roy Fielding, a uber-guru of the web between some Diamond sponsors seems like a commercialization thing. A theme of the conference maybe.

Beyond Startups: Rails Demand in the Global 2000

Thanks to Jonathan Siegel we heard the obvious, that yes some Global 2000 companies are starting to use Rails. Big shock. Shame the man can’t present at all. Little note, if your sponsorship money buys you a presentation, learn how to present an engaging talk.

The Rest of REST

An intellectual and precise talk by Roy Fielding, was interesting and historically educating but academic for most people there. Still I find the elements of architectural style and forming lasting styles of architecture is really interesting from a consulting point of view. The architectural style a way of deducing principles of technology removed from any of the problems of actual languages and products.

Rails and the Next Generation Web

Craig McClanahan is a great speaker and someone we are interested to hear from. This should be the principle of buying your speaking slot, put up something interesting with an interesting topic, not just a marketing speech.

Craig talks about his love of Ruby and Rails even after being a Java-guy for so many years. A shift for Sun? Rich Internet Applications and Horizontal scaling, gone is Moore’s Law. Well Craig says that Java web frameworks pace of innovation is slowing, and the Java community know they need to look to the future. Could the Rails community go snow-blind also? Forget to look to the future..

Mentions three plugins. act_as_cached, act_as_state_machine, will_paginate… get it wrong as they only extend ActiveRecord. While acts_as_autenticator, paginator gets it right as they don’t care about the implementation.

make_resourceful plugin is a good example of separating API from implementation where you could plugin ActiveResource or ActiveRecord.

Unfortunately Craig only has 50 minutes which is no time at all. I would love to hear a proper 2 hr talk from him as it seems he has some great stuff to say.