Code Walhalla ... Avatar

Posts tagged rails

Ruby External CRON manager for Salesforce on Heroku

In todays post we’ll have look at task scheduling using Heroku and the famous Resque gem. I have presented it at last London Skillsmatter Salesforce Dev Meetup. Watch the video: Delayed tasks on Salesforce have some well known weaknesses. For example: “Use extreme care if you are planning to schedule a class from a trigger. You must be able to guarantee that the trigger will not add more scheduled classes than the 25 that are allowed”. With the help of Heroku, most of your background tasks might be externalized and delegated to a dedicated app on Heroku. To build that solution we’ll be using 4 different gems. The objective is to create a simple web app that is able to create, handle and monitor tasks build by registered users. To be really functional, that web app should be reachable through an API (coming in a future post).

  1. Sinatra to build a basic web app
  2. Databasedotcom: to get the secure connection to Salesforce API
  3. Omniauth to get the authorization token from your ORG
  4. Resque to handle Job Queues and monitor them

Continue reading…

So you want to play with Ruby?

I heard last week two people complaining about the difficulty to install ruby on a mac and start coding with all our precious gems. They deserve explanations.

Alright let’s have a quick look at that and let’s install our Ruby env with all tools required to code and deploy on heroku.

Being able to compile:

First of all you need GCC aka the compiler. It was previously coming along with XCode but it’s not the case anymore. You can get GCC from github. Download it and just unpack it as usual.

New packaging system:

If you’re bored by macport or if you dont know it already try homebrew. Homebrew is a package installer based on recipes. To install it:

Continue reading…

Monolithic Databases are dead

It’s today a common statement to affirm that hegemony of monolithic relational database system is ending.

ORM, Object Relation Model, were the last trial to perpetuate that pattern born in the 70’s. ORM bring to software development specialist the sweet feeling of directly interacting with objects. In Ruby on Rails world, Active Record was a wonderful implementation imposing its conventional relational approach on all web developer. In “Java world”, Hibernate has still a massive user base but controversy about its performance and ability to handle some complex situation are numerous.

Long story made short, Relational Databases persist data. That’s a fact as for all storage systems but they also structure the way we represent and organize our data model. They oblige us to think them through principles such as cardinality, relation entity, foreign keys and all those typical normalized form concept Entity Relationship Model. Furthermore, well know performance might quickly be an issue when mixing ORM and relational Databases. You want to make a query with 15 joins to display a deeply structured data set with few conditions and limit? You should rethink it.

Continue reading…

_Why Travis?

_Why?

August 19th 2007, _Why the lucky stiff, anonymous author of “Why’s poignant guide to Ruby” book and various OpenSource project such as Camping, Shoes or hpricot disappear from web radar. Since then August 19th is commemorated every year, all over the world and developers offer their strength, knowledge and will to help building Free content and applications.

This year, in France, Jérémy Lecour offered to host a hacking WE in his place, a charming house on Marseilles’s hills. We met there, during 2 days, with Thibault Barrère and Gregory Colpart, well decided to bring also our small contribution to the OpenSource world.

Travis ?

I started to look into Travis project after RuLu 2011 conference. Sven Fuchs and Josh Kalderimis came to present their idea and invite the french community to use, speak, love or hate Travis-CI application.

Continue reading…

When Salesforce meets awesome Ruby gems

There are multiple ways to connect your app to a SalesForce account but this one is pretty elegant and modern as it uses the new Winter ‘11 release with support of OAuth2 authorization standard through Omniauth. This article also describe the built of a REST API using HTTParty awesome gem.

RuLu 2011: “Yes we did it, now it’s your turn !!”

Or “How to organize an international Ruby Conf in 4 months ?”

4 months ago, in february, so impressed by the massive coming success of Euruko Berlin, we decided with few friends of Lyon.rb to organize an other international Ruby event in Lyon. The idea behind was to gather french community on a classic international event in France and prepare the french application for Euruko 2013. Simple.

13 best practices to organize a Ruby Conf:

Here are some lessons I learnt from RuLu 2011 organization that can help you when you’ll plan one:

  • Build a solid team: Your team-mates are usually working during the week and have all a private and selfish life. Planning a Conf is a long road project and it’s sometime a real pain in the ass to stick to a weekly planned meeting. Some people might forget their responsibilities, miss too much meetings or not deliver what they should . You need people you can trust 100%.  

Continue reading…

Why we, Rubyists, care about Salesforce-Heroku?

Everybody might have heard in our Ruby/Rails technosphere that recently, the successful company Salesforce.com, famous for his platform, his growth and his position as the first huge Cloud business oriented app, has bought the tiny and innovative Heroku Platform.

I am not going to give an introduction about what those two key cloud actors do. You have to know that already. I am here to explain why the CRM market leader decided to buy our underground Ruby on-demand hosting platform and why that matter for us. 

Continue reading…

Book: Design Patterns in Ruby

Design Patterns in RUby

Title: “Design Patterns in Ruby”

Author: Russ Olsen

Edition: Addison Wesley

Abstract: Getting better in Ruby using the Gang Of Four holy knowledge. From today I will read a chapter once a while and put my comments here. Reading such traditional sciences is a must-done for any hacker.

Pattern I: Template Pattern

Template Pattern aim to re-organize your code when a part of it only has to be flexible. Templates offer though an Abstract Class a kind of Interface. Using Hooks, available methods are easily over-ridden inside sub-classes. Main and central methods remains in the Abstract base Class and specializations are implemented inside children classes. Nothing complicated here but a pattern that allow us to easily modify of an Object by subclassing it.

Example: Change the behavior of WEBrick by adding a new template.

Pattern II: Strategy Pattern

A modern rule is “you can always delegate more”. Strategy Pattern extract the algorithm out into a separate object. Based on a Strategy all sub-classes (strategies) provide a different approach of the same action. The user, called the context, is implemented in a distinct Class and consequently there is a nice and strong separation between him and strategies.

The most direct connection with Ruby are Procs. A Proc is a chunck of code embeded in an Object. Doesnt that sound like a Strategy?

Example: Rdoc parsers can be extended using a new strategy

Start Up Week End - Lyon 2011

Last week-end after the Lyonrb.fr apéro, we have been 21croissants Ranksa and me to the first Lyon Start Up Week End (SUWE) as partners of the event. Nice place to evangelize and spread Ruby good word.

Continue reading…

Book: Metaprogramming Ruby

Title: “Metaprogramming Ruby”

Author: Paolo Perrotta

Edition: The Pragmatic Programmers

Abstract: Knowing Rails is necessary to understand how modern web frameworks work. But soon, you’ll hear there is something behind and Ruby will be the real big  step for you to be a Rails hacker. Sure, you’ll be amazed by Ruby flexibility. You’ll see objects everywhere and start to know why Rails is so amazing. Then will come real questions. How does ActiveRecord let me see so easily any DB through an object oriented model? Why is it so simple to modify native Rails behaviour and extend Rails library? Since that book, Metaprogramming Ruby, there is for me one answer: MetaProgramming.

Continue reading…