Why we use Rails for Client Projects.

Posted by Floyd Price Tue, 06 Jul 2010 17:44:41 GMT

At least 50% of the time a client will want us to use a specific technology (.NET or Java), this makes perfect sense as a lot of our clients are corperates who have invested a lot of time and money in a particular technology.

The great news for us, and the other 50% of our clients is that we choose to use Ruby On Rails whenever possible. The reasons are many, but a few of the more profound ones are:

Productivity

Thats right, we are about 2 (maybe 3) times more productive with Rails than .NET or Java, now this isn't because we are primarily Rails guys in fact I have spent many more years working with both .NET and Java than I have with Rails, the simple fact is that Rails gives us a head start as we get so much for Free.

This is profound in two ways, firstly and most obviously it costs the client less, and enables us to create better relationships. But this productivity gain also allows us to get functionality in front of the user quicker and as such we can identify requirement changes and fix bugs sooner, meaning we deliver better quality code first time.

Agile

We work in an Agile manor and while we can do this regardless of the technology we use, Rails lends itself to an Agile process perfectly.

Solid Design Patterns

Rails encourages the developer to employ consistant design patterns, the rails guys call this Convention over Configuration which promotes maintainable well tested code.

Separation of Concerns

Rails goes beyond Separation of Concerns by removing Concerns, Object Relational Mappers take out 1000's of lines of code that would take up 50% to 80% of the developers time, simple Routing patterns eliminate tones of boiler plate code.

The baked in support for Model View Controller means makes its easy to keep things in the right place.

Open

Over a 10 year contacting career I hit so many hurdles using web frameworks from commercial vendors, from the ASP.NET framework to JSF I found that whenever I wanted to bend these frameworks, they snapped! And the closed source meant that I was back to the drawing board having to invent an ingenues hack, Rails however is open source and the code (especially the rails 3 code) is well written and easy to extend (partly due to the Ruby language), I can easily bend it in any way I choose.

Database Agnostic

As I mentioned the Object Relation Mapper reduces a tone of code and save you even more time, but the abstraction from the database goes even further than that, A rails application written against MYSQL will work against any Database in production, in fact we have an app that is running on SQL Server for one client and Oracle for another, while we host it for other clients on MYSQL.

 

Just a few reasons why we use Rails, I hope you will too.

 


Converting Flash to HTML5

Posted by Floyd Price Fri, 02 Jul 2010 13:14:00 GMT

OK, The title of this post is a little provocative I admit it, but its a question that is and will be asked more and more as devices without Flash (iPhone, iPad, etc...) become mainstream (although I think that may have already happened).

So the problem is that web designers, especially those working for the Design Firms that serve the major brands out there, have been raising the bar of "Richness" for such a long time that Flash presents the only way to get really rich content that just works in (almost) every browser. And until now this has been just fine and dandy, but as usual Apple have introduced a curve ball that is a real game changer.

iPads, iPhones and other iOS devices will not run flash content (not now, not ever) so many web site owners and in particular many of the Luxury brand site owners are in trouble!

Well the problem of course isn't as bad as it may seem, most sites with this "problem" can be placed in to one of two camps, each with a common solution that will ultimately make for a better web (for everyone).

1. Sites that didn't need Flash in the first place.

What No Flash?

So many sites that are entirely written in flash really don't need to be, I'm talking about many of the Luxury Brands, almost every Game or Movie site.

For example take a look at the Prada.com website (I know your always visiting that site anyway, right?)

It is one great big flash app, no HTML for the unlucky iPad user, but dig a little deeper, the site when running in a browser that does have flash is so simple it could easilly be written using standard web technologies that work on any browser (Never mind HTML5).

The site is basically a navigation element which has rudimentary transitions and a nice full screen background, thats it! Come on guys, why are you using Flash for this? It makes no sense! You are aleanating so many of the people that can afford to buy your products!

I can't believe who many site out there are like this, a small percentage of them are as bad as the Prada.com site a most don't have full screen flash content, but even if you have a small amount of Flash on your site, I suspect you put it there for a reason, and that reason will be lost on so many people these days.

2. Sites that don't need Flash anymore.

OK, times are changing, 12 months ago you needed Flash for the really rich elements of your site (or at least you think you did) but today we have things like HTML5 and CSS3 right? Well no, not really, HTML5 and CSS3 are great (and open) but support, even partial support is only available on the latest and greatest versions of  a handfull of browser and most certainly not on the most popular one Internet Explorer. So Flash is the right choice here then right? Well no, almost always not i'm afraid!

All browsers have the ability to render rich content the problem is, they all have different ways of doing it, Some (like Internet Explorer) have VML support and others like (FireFox) have SVG support, but for the most part they can all render vector graphics, and can all perform acceptable levels of animation and transitions, the problem is the differences in implementation, it makes it almost impossible to be sure that your content will render the same on each browser.

What we need is a common interface that abstracts away all this complexity, and believe it or not, we already have this, several open source projects exist that do exactly that, our favourite is Raphaëljs and without going into all the techy details it allows a designer to create rich vector based content that will work on all major browsers (yep, thats exactly what Flash does) including Safari on the iPad and other iOS devices.

 

OK, so why do i hate flash? Well i don't, I actually love it! Its been an amazing technology that has driven the web forward by an immeasurable distance, but like all great technologies its time for others to stand on its shoulders and take us even further.

I truly believe that adoption of pure HTML5 and CSS3 will be the next frontier of the web, but while we wait for the rest of the world to embrace this we should be moving to more browser friendly technologies that map closer to HTML5 and CSS3.

So, back to the post title, Converting Flash to HTML5!

If you need any flash content Converting to HTML5 please contact us, we have an experienced team of Web Designers and Developers who can generate iPad friendly versions of the most demanding Flash content.

 


Component Workshop Releases an Iphone application.

Posted by Floyd Price Tue, 01 Sep 2009 14:18:00 GMT

Component Workshop, 1st September 2009

Component Workshop Iphone App

Today Apple have accepted Component Workshop’s first app in to the iTunes App Store. gPhushed is a small utility that enables users of the popular gMail service to recieve instant notifications when a message has arrived.

Recieving notifications rather than setting your iPhone or iPod touch to automatically check, increases battery life and enables you to keep up to date with your gMail account.

Component Workshop have build a scalable Push Notification layer on top of the Amazon EC2 platform and with this near limitless capacity to scale, we will soon be releasing a series of other Push Service for the iPhone and iPod touch platforms.

For more information about gPhushed, our Notification Platform or our bespoke iPhone development service please Contact Us.

About Component Workshop

Established in 2005, by Floyd Price and Adrian O’Connor, Component Workshop quickly established itself as a leader in the field of Software development with the popular www.CodeSpaces.com development and project management platform.

Component Workshop now operates as a Software Development Shop and as a Software Consultancy, working with leading organisations to provide quality and cost effective solutions to business critical problems.

Our culture is young and enthusiastic, we encourage innovation and Fun at every opportunity. Our passion for technology is shared by all members of staff, and our commitment to our customers is Honesty, Transparency and Value for Money


Debugging your rails controllers with JRuby and Mongrel

Posted by Colin Fri, 24 Jul 2009 07:48:00 GMT

If like me you think that NetBeans is a superb IDE, but quiet often for some unknown reason end up firing up TextMate to fix a bug or add a new feature, only to realise you lose all of the lovely debugging tools that come with the IDE. Well we can take a step in the right direction by allowing you to break out of your controller actions and into a irb console..

First things first we need a java implementation of ruby-debug-base. Fortunately one exits at http://rubyforge.org/frs/?group_id=3085 but it is not installable remotely so download the latest version of this file into a local directory (at time of writing this was ruby-debug-base-0.10.3.1-java.gem)

Fire up terminal and go to the directory that contains the gem file and enter the following

jruby -S gem install ruby-debug-base-0.10.3.1-java.gem
we also need to install the native ruby-debug gem as mongrel requires this to run with the –debugger swtich
ruby -S gem install ruby-debug

O.K with that all installed successfully we can now go ahead and start up our mongrel instance so go to your rails app and issue the following command, to start mongrel

jruby --debug -S script/server --debugger
Now in your controllers, you can create a breakpoint by entering debugger at the point you wish. This will cause the server to break into an irb session. From here you can write any code to inspect your controller you want. Be careful though as you are just issuing ruby commands so Model.destroy_all really will destroy all :)


Using JRuby LDAP to authenticate users with rails

Posted by Colin Tue, 21 Jul 2009 09:20:00 GMT

Many enterprises have an Active Directory infrastructure setup. Wouldn’t it be nice if your jruby app could exploit this already in place infrastructure to authenticate your users. ruby-net-ldap has been around for a while and allows users to do exactly this with MRi ruby and now thanks to Ola bini it is now possible with jruby.

First things first, we need to install the gem,

jruby -S gem install jruby-ldap

once the gem has been installed we can then fire up a console, execute the following command in your rails app directory

jruby -S script/console

once the console is booted enter

   require 'ldap'
   conn = LDAP::Conn.new(host="IP Address of your server", port="LDAP Port, typically 389")

this should then return you a connection object which we can use to now use to bind to the server and form there on search the directory tree. to bind to the server we simply supply some credentials. NB: I had a problem initially as some of the usernames contained periods(.) i.e. foo.bar and this caused a few problems for these accounts, the solution was to fully qualify the name (foo.bar@componentworkshop.com)

  conn.bind("username","password") do |bound_conn|
     conn.search("cn=Users,dc=domain,dc=com", LDAP::LDAP_SCOPE_SUBTREE, "(&(objectclass=person))",["name","mail"]) do |entry|
        puts "#{entry.inspect}"
     end
  end

when ran this code will render each entry that the search has found, firstly it creates a binding which authenticates you on the server. We then pass a block to search the LDAP tree. The search method takes a few parameters, for info about these parameters have a look at Suns documentation

Now we have verified, that everything is setup and working. We can go ahead and use our new found wisdom to authenticate users from our login controller. The following code provides an example on using jruby-ldap to authenticate the users, and then add them to a user model if they do not already exist in the database.

def authenticate
 attrs = ["name","samAccountName", "cn", "mail", "department", "manager"]

     conn = LDAP::Conn.new(host = "127.0.0.1", port = 389)
     conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)   

     domain = "foobar.com"

      conn.simple_bind(login + "@" + domain, password) do |conn| 

        conn.search("cn=Users,dc=componentworkshop,dc=local", LDAP::LDAP_SCOPE_SUBTREE, "(samAccountName=#{login.to_s})", attrs) do |entry|

              user = User.find(:all, :conditions => ["login = ?", login]).first

              if(!user)
                user = User.create!(:name => entry.vals('cn').to_s, :login => entry.vals('samAccountName').to_s, :email => entry.vals('mail').to_s)
              end

              return user;
           else
             return User.find(:all, :conditions => ["login = ?", entry.vals('cn')]).first
           end
        end           
      end
end

About

We are a small British company that produces business-oriented software and solutions. These articles are a product of our daily work - information that we think might be useful to share. We hope you find them useful.

Our Software

These are some of our products. Several are open source, some are web-based and others are proprietary:

Categories

Archives

Syndicate

ml> ._trackPageview(); } catch(err) {} ml> l> pageTracker._trackPageview(); } catch(err) {} ml> ._trackPageview(); } catch(err) {} ml> l>