Code Walhalla ... Avatar

Posts tagged sinatra

Sencha App with Salesforce API using a Sinatra Proxy

In my last article, I have presented Sencha Framework and some advantages this product got over other Mobile solutions. Convinced that I had a wonderful tool into my hands I have decided to create a simple app. The aim is to have two tabs. First one with an intro page, second one with a list of Leads retrieved through the Salesforce REST API. The list must be sorted and provide basic interaction by displaying additional details of a selected Lead.

As soon as you start playing with mobile application and a remote API you have to face a common javascript limitation: the Same Origin Policy. I invite you to read the Wikipedia article if you want to know more about that rule. Briefly, "The policy permits scripts running on pages originating from the same site to access each other’s methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites". Said differently, you’re cute javascript mobile application hosted under xyz.com domain _can not_ request any data from salesforce.com domain. Such a shame but so imperative to keep the web safer.

Continue reading…

Sencha Touch, more than a trendy Mobile JS Framework

Few weeks ago, I started to think about my next project, a mobile dashboard app for Salesforce. As I am not an IOS dev but rather a Ruby/Javascript one, I investigated a bit wondering what framework could fit the best my expectations:

  • ability to generate IOS/Android app to remains device agnostic
  • using a language I know and improve my skills rather than diluting them
  • not requiring to install an heavy env cause otherwise it’s never as simple than they pretend
  • well documented to avoid hitting my head against the wall to often looking into a raw source code of thousand of lines
  • promising future cause I don’t like to waste my time learning already obsolete technologies 

Other candidates were RubyMotion, PhoneGap - Cordova, JqueryMobile, Titanium, RhoMobile. My final conclusions are not based on intensive trials but more on web investigations and personal intuitions. Here are the pros and cons of those different solutions.

Continue reading…

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…

Create geek slideshows

I heard one day that consultant finish to see the world into bullet points. Abusing of ppt everyday, their brain slowly mutate and they finish them self to behve as a continuous slideshow of concepts. Funny or scarring. It depends.

However, since 1 or 2 years, we observe people making js presentation, homemade or not. This might be a continuation of Google doc presentation growth or simply a consequence of people getting bored by ppt. To build them, you’ll find on internet libraries like impress.js, deck,js or scrollorama. Some website like prezi.com even offer now a real alternative to ppt based on js. To have an overview of available libraries check favbulous website

However, as this might sound unnecessarily complicated to create a slideshow, share it and publish it using js compared to ppt, I built a small mashup of Sinatra, deck.js and haml hosted on Heroku.

The principle is SIMPLICITY.

Sinatra let me publish and organize my slideshows on Heroku. A new slideshow is just a file with multiple sections. Each section is a slide. As I have extracted all the surrounding css/js call in a layout and added haml syntax, a visually impacting slide might be as simple than:

%section

  %h1 you wont believe it !!!

Neat, isnt it ?

To try the go on Geek slideshow, fork it on Github and start using it.