We Are Hiring!!!
Hey folks, to keep pace with our fast development, we are looking for a Software Architect Or Technical Manager. His/her objective is to design and ensure the compliance of our developments mainly based on Ruby on Rails technologies.
Above all, our preferred candidate will be flexible and highly motivated to work for a young and innovative startup, in one of the fastest growing industries aka social gaming.
You can download the complete job description here.
See U
Rails 2+: Sanitize SQL string
Indeed it is sometimes useful to sanitize a query to avoid (most of) SQL injections.
Typically, this is the case with your favorite text search field on a website.
Obvisouly, you can’t do better than using the Rails standard way of querying, who automatically applies this mechanism. For instance:
MyModel.find(:all,:conditions => ['name LIKE ?','%'+params[:search]+'%'])
But what if you want to create a fragment of a where clause?
This happens in few cases where you create complex queries in different parts of your code.
Well, if you’re in a ActiveRecord model, you can directly call
sanitize_sql_for_conditions(['name LIKE ?','%'+params[:search]+'%'])
to output a sql sanitized string.
Easy.
But if you’re in a controller or a custom library, you will surely fall on this
NoMethodError: protected method `sanitize_sql_for_conditions' called for ActiveRecord::Base:Class
Arrrgg!
Well, the answer is quite simple though. Just call the method right inside ActiveRecord:
ActiveRecord::Base.send(:sanitize_sql_for_conditions,['name LIKE ?','%'+params[:search]+'%'])
Hope it helps!
“Française des jeux” privatized?
The french ministry of economy thinks again of privatizing “La Française des jeux” (FDJ), according to Liberation.
This is interesting considering that France is currently, under the pressure of EU, opening its gambling market (actually sport betting and poker) over the Internet BUT ensuring the monopolistic position of the existing companies, namely FDJ and PMU.
Indeed, they have already launched their own Internet betting products and they are over-advertising before the market opening… cutting the grass under the feet of their future opponents.
France ensures an exceptional position for the company and sells the goose that lays the golden egg… who will this deal profit to?
FDJ and PMU are big players of the french market with 9.2 billion € and 9.3 billion € gross gaming revenue in 2008; but only 220 M€ (2.3%) and 440 M€ (4.7%) over Internet.
Facebook Connect and Rails: handling logout from Facebook site in Facebooker
Integrating an existing website with Facebook Connect using Facebooker is fairly easy. Several tutorial have been made; the best I found being:
However, there is no description on how to handle a frequent use case where the user has been authentified in your application using Facebook Connect and disconnects in the Facebook website.
In this case, you will surely meet the famous:
Facebooker::Session::SessionExpired (Session key invalid or no longer valid)
One solution to handle this is
rescue_from introduced in Rails 2.0. This is also the method recommended in the
Facebooker documentation.
When the exception occurs, you have to remove the facebook session informations AND facebooker cookies.
Indeed, the set_facebook_session will recreate the facebook_session with these cookies. If you do not remove them, you will loop again and again in your rescue_from handling.
Here is an example of what you can do:
class ApplicationController < ActionController::Base
...
rescue_from Facebooker::Session::SessionExpired do |exception|
clear_facebook_session_information
clear_fb_cookies!
reset_session # i.e. logout the user
flash[:notice] = "You have been disconnected from Facebook."
redirect_to root_url
end
...
end
Dead simple, huh?
Send your bet idea to zukumu13@betcoffee.backpackit.com (put the description in the subject)
We created a page on Backpack to record all crazy ideas of bets… and there are many :)
You can easily add your bet idea by email:
- Put the bet description in the subject of the email.
- Send it to zukumu13@betcoffee.backpackit.com
That’s all!
All people sending bet ideas will be invited to the private BETA, starting fall september (09 of course).
Cleaning in progress
Former office users currently taking their stuff.
We are cleaning:)
After / before… Do you see any différence?
Our first office.
Stuff is not ours… and we’ll have to clean a bit!
First day in own offices, very excited!
Pictures will follow.