10 little known ways to find a ruby on rails team for your next project
Everytime we talk to our clients, we find that they are not aware of lot of options through which they can find a good rails developer. Usually clients go to odesk and other freelance websites to find rails developers. Following are 10 more ways to find rails company/developer for your next dream project :
- Post your requirements on twitter with hashtag #ruby #ror #rails
- Go to Railsdevelopment.com - its a directory of rails companies. You can search for specific services with your budget ranges.
- Working with Rails – Again a directory of rails developers and companies. You can browse through specific industry categories.
- Local Ruby Meetups – The most passionate guys are always there in local meetups. For eg: we have delhi ruby meetups and you can find all local meetups in australia here
- RubyJobs – Post a job on rubyjobs or rubyinside job board. There are some country specific ruby job boards.
- RubyonRails wiki – There is a wiki of ruby on rails companies.
- Open Source Contributions – Sites like http://agilewebdevelopment.com/ gives you a directory of rails plugins. Open Source contributions such as releasing a Rails plugin, or fixing bugs on projects , or Rails itself, demonstrates exposure to other Rails code bases and quality of a developer. Search for developer name in github.
- Conferences – Conferences are good way to find quality rails developer or team.
- Facebook – Few people post jobs on facebook.
Few tips :
- Don’t hire someone that doesn’t know Rails at all. Yes, we have seen some people doing it.
- Ask for references of previous clients if possible in your country.
- Look for someone who values the money you are paying them and will make your investment in them provide a valuable return.
- A personal Rails blog is a good indicator of developer’s interests , experience and resume.
Integrating Yahoo! BOSS with your ruby on rails application
What is Yahoo! BOSS? Yahoo developer website cites it as:
“Yahoo! Search BOSS (Build your Own Search Service) is an initiative in Yahoo! Search to open up Yahoo!’s search infrastructure and enable third parties to build revolutionary search products leveraging their own data, content, technology, social graph, or other assets. This release includes Web, News, and Image Search as well as Spelling Suggestions.”
Some of the possible implementation of Yahoo! Boss may be finding related posts for your article, suggested tag/category for an article/query, correcting misspelled words by providing suggestions, fetching latest news on a topic dynamically, search over delicious tags, customized language search. Some of these have been tried and successfully implemented. An example is the TechCrunch’s Search Engine.
Here is a concise guide on how to use this new service in your next rails application.
Obtain API key
Get an application key from http://developer.yahoo.com/search/boss/.
Install BOSSMan Gem
BOSSMan is a gem for interaction with the Yahoo BOSS web service written by John Pignata. Install it using the following commands:
gem install gemcutter gem tumble gem install bossman
Usage
Put this in your environment.rb
require 'bossman' include BOSSMan BOSSMan.application_id = <Your Application ID>
Web Search
Use the following code to execute search over the web:
boss = Search.web("Apple Pie", { :count => 2, :filter => "-hate" })
puts "Number of results: #{boss.totalhits}"
boss.results.each do |result|
puts "#{result.title}"
puts "#{result.dispurl}"
puts "#{result.abstract}"
end
# => Number of results: 2618888
# => <b>Apple</b> <b>pie</b> - Wikipedia, the free encyclopedia
# => <b>en.wikipedia.org</b>/wiki/<wbr><b>Apple</b>_<b>pie</b>
# => English <b>apple</b> <b>pie</b> recipes go back to the time of Chaucer. <b>...</b> The basis of Dutch <b>apple</b> <b>pie</b> is a crust on the bottom and around the edges. <b>...</b>
boss = Search.web("Moon", { :count => 10, :type => "nonhtml,-pdf" })
boss.results.each do |result|
puts "#{result.title}"
puts "#{result.dispurl}"
puts "#{result.abstract}"
end
# => BACKGROUND:
# => www.<b>radford.edu</b>/~rusmart/<wbr><b>moon</b>.doc
# => We noticed was that one of the scan lines took longer to scan the <b>moon</b> then any other. This occurred toward the middle of the <b>moon</b>. <b>...</b>
boss = Search.web("Star", { :sites => "wwe.com", :style=>'raw' })
boss.results.each do |result|
puts "#{result.title}"
puts "#{result.dispurl}"
puts "#{result.abstract}"
end
# => John Cena - WWE: Raw
# => www.<b>wwe.com</b>/super<b>star</b>s/raw/<wbr>johncena
# => Official profile from WWE for the professional wrestler John Cena, who has been training since he was 15. Features lots of photos and video clips, including John ...
Apart from universal arguments mentioned at the end of this document, the following arguments can also be used:
| Parameters | Values/Description |
|---|---|
:filter |
Filter out adult or hate content Syntax: :filter => "-hate, -porn"
|
:type |
Specifies document formats (pdf, msoffice,etc) |
| :view | Syntax: :view => "view1,view2", etc
|
| :abstract | :abstract => "long" will retrieve and display an abstract of a web document up to 300 characters. This expanded abstract provides the requestor with a larger piece of information to work from in a web search query. The default for abstract is an abbreviated description. |
Click here to view list of response fields returned by web search.
Images Search
For searching images on web, use the following code:
boss = Search.images("snow hills", { :dimensions => "large" })
boss.results.each do |result|
puts "#{result.url}: #{result.abstract}"
end
# => http://www.amanita-photolibrary.co.uk/photo_library/BI_habitats/gb96_chiltern_hills_from_ivinghoe_snow_std.jpg: Copyright © 2004 Chiltern hills east from near Ivinghoe snow habitats landscapes British Isles
Click here for list of additional arguments that can be provided with image search.
Click here to view list of response fields returned by image search.
News Search
Yahoo! BOSS also provides news search capabilties.
boss = BOSSMan::Search.news("free shipping", { :age => "1d-2w", :orderby => "date", :count => 1})
boss.results.each do |result|
puts "#{result.title} [from #{result.source}]"
puts "#{result.abstract}"
end
# => Wal-Mart announces weekly price cuts for holidays [from USA Today]
# => Wal-Mart said it will cut prices this holiday season for a week at a time on thousands of items, from bananas to board games. The first group of cuts hit Wednesday.
Click here for list of additional arguments that can be provided with news search.
Click here to view list of response fields returned by news search.
Spelling Search
Correct your misspelled words using its spelling suggestion feature:
boss = BOSSMan::Search.spelling("acknowlegment")
puts boss.suggestion # => acknowledgment
Site Explorer
You can also search for the pages from other sites linking into your site pages.
links = Search.se_inlink("http://mail.yahoo.com", :count => 2)
links.results.map { |result| p result.url }
# => http://www.aol.com/
# => http://groups.yahoo.com/
For displays a list of all pages belonging to a domain in the Yahoo! index, use se_pagedata method provided.
links = Search.se_pagedata("twitter.com", :count => 1)
links.results.map { |result| p "#{result.url} - #{result.abstract}" }
# => http://twitter.com/ - Use Twitter to send status updates (tweets) through your cell phone, instant messenger, or via the Web, and notify friends and followers of the little things <b>...</b>
Universal Arguments for Web, Images and News
Following is the list of most commonly used arguments with web, image and news search. For more comprehensive list click here
| Argument | Options/Details |
|---|---|
:start |
Ordinal position of first result. First position is 0. Default sets start to 0. |
:count |
Total number of results to return. Maximum value is 50. Default sets count to 10. |
:format |
The data format of the response. Value can be set to either "xml" or "json". Default sets format to "json". |
:callback |
The name of the callback function to wrap the result. Parameter is valid only if format is set to "json". No default value exists. |
:sites |
Restrict BOSS search results to a set of pre-defined sites. Multiple sites must be comma separated. Example: (:sites => "abc.com,cnn.com"). The Images service does not yet support multiple sites. |
:view |
Retrieve additional search data provided by the respective BOSS service. Please see individual chapters to see what view options are available. |
:style |
By default for web search result titles and abstracts contain bold HTML tags around the search term. Use :style => "raw" to remove the bold tags around the search terms in titles and abstracts. |
Ruby on Rails Caching And JavaScript Techniques
Cross posted from darthsid
While implementing caching in a recent rails project I came across some typical caching issues. In a lot of pages the content is same for all users but certain components in them have user specific actions. As an example, I have a page listing all public messages that users have posted(similar to the public timeline in twitter) but actions on those messages are user specific(eg: only owner or admin can delete a message). Also, most of these actions use ajax and the rails authenticity token in them also gets cached resulting in subsequent failures if the session changes. Another issue was that the timestamps in most pages is fuzzy and they become irrelevant if a page gets cached for too long. I could have created separate caches for each user but if the user base really grows managing the caches would become a nightmare and that would still not solve the authenticity token and the timestamp problem. The simplest solution was to use JavaScript, more specifically jQuery.
Read more
How to Integrate TinyMce with Redbox in 5 steps ?
TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.
Redbox is a library that pops a modal box over a web page, using CSS and javascript, so that you can ask the user a question, or show them something important. The box can be loaded from content already on the page (but hidden), or it can be loaded via AJAX. The contents of the box can be replaced using AJAX, for multi-page forms, and it can be closed easily using a javascript link.
Here is the process for integrating Redbox and tinymce.
Step I:
Install required plugins:
- TinyMce(http://github.com/kete/tiny_mce/tree/master)
- RedBox(http://www.craigambrose.com/projects/redbox)
Step II:
Include javascript files to layout:
<%= include_tiny_mce_js %> <%= javascript_tag "initialize_editor();" %>
Now, add this javascript method which initilizes the text editor. You can specify the options you want for your text editor here.
Javascript:
function initialize_editor(){
tinyMCE.init({
theme:"advanced",
//mode:"textareas", // this is commented because we do not want to apply the editor to all the text area
instances. Instead, we will use the class "mceEditor" to specify on which element we want to add the editor.
theme_advanced_toolbar_location:"top",
theme_advanced_toolbar_align:"left",
theme_advanced_resizing:true,
theme_advanced_resize_horizontal:false,
paste_auto_cleanup_on_paste:true,
theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",
theme_advanced_buttons1:"bold, italic, underline, strikethrough, | , undo, redo, link, unlink, image, | , bullist, numlist",
theme_advanced_buttons2:"",
theme_advanced_buttons3:"",
dialog_type:"modal"
});
}
Step III:
Add editor class “mceEditor” to the text area where you want the editor to be added.
<%= f.text_area :details, :id => 'ta_id', :class => 'mceEditor' %>
Now, we need to create a tinymce editor control for the text area(‘ta_id’) on loading the popup so add this “execCommand” loads the tinyMCE in the textarea.
<script type="text\javascript">
tinyMCE.execCommand('mceAddControl', true, "ta_id");
</script>
Step IV:
When we submit our form and copy over the editor content to the text box it references. Tinymce provides a method ‘triggerSave’ that moves the contents from the editor to the form field. This method is automatically called by tinyMCE by adding a trigger on the forms submit method.
Save the content:
<%= f.submit 'Save', :class => 'primaryAction', :onclick => "tinyMCE.triggerSave(true,true);" %>
Step V:
Whenever we close our popup redbox we need to remove the tinymce editor control that we had added. Remove control on closing the redbox:
<%= link_to_close_redbox 'Close', {:onclick => "tinyMCE.execCommand('mceRemoveControl', true, 'ta_id'});"} %>
Works on: Firefox(1.5+), Safari and IE(7+)
For Internet Explorer we need to initialize the editor on loading the pop-up but for firefox we need to initalize editor on loading the main page. So we need modify our javascript
<script type="text\javascript">
if(navigator.appName=="Microsoft Internet Explorer")
initialize_editor();
tinyMCE.execCommand('mceAddControl', true, "ta_id");
</script>
And so here we are ready to go in just five simple steps.
Refer here for more details.
Now You Can Have Better Youtube Integration with Ruby on Rails
I recently wanted to upload, edit, update and delete a video directly on youtube from my rails application. This can be achieved by YouTube Data API that allows application to perform functions normally executed on youtube.
Step 1 : Demystifying Authentication with Google AuthSub
Google provides an authentication service to those web applications that need to access services protected by a user’s Google account. I chose Google’s ‘AuthSub’ scheme for this. This also provides a high level of security to web application.
The AuthSub interface provides several methods for acquiring and managing authorization tokens. Once a web application has received a token, it can request access to a Google service.
To obtain an authentication token, submit an HTTP POST request to the following URL:
https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.example.com%2Fupload.html&scope=http%3A%2F%2Fgdata.youtube.com&session=0&secure=0
Setting session parameter to 1 indicates that the single-use token can be exchanged for a session token.
AuthSubSessionToken is a method that allows the web application to exchange a single-use token for a session token. I used a gem ‘gdata’ to convert the token into a session token.
client = GData::Client::DocList.new client.authsub_token = params[:token] session[:token] = client.auth_handler.upgrade()
Session token allows the application to make unlimited calls to the Google service. When using session tokens, your application should store the session token for each user rather than requesting a new one each time it needs to access a Google service. For other token management options, see Working With AuthSub.
Step 2 : Getting the Youtube Developer Key
A developer key is required that identifies the YouTube developer that is submitting an API request. A client ID identifies your application for logging and debugging purposes. Please visit here to obtain a developer key and client ID.
Step 3 : Improving the Youtube Model Plugin
“youtube-model” is a plugin that provides youtube video uploading functionality. That was a good start.
I forked the plugin and updated it with few methods to get the rest of the functionality done. Each method is explained here.
1. uploaded_by_user
A method uploaded_by was provided in the plugin to retrieve all the videos of the user but it receives username as a parameter. So I added a method uploaded_by_user that receives the session token and solves our purpose.
YouTube.uploaded_by_user(session[:token])
2. update_video
The video can be updated by using this method passing video id, session token and params hash as parameters.
YouTube.update_video(params[:id], session[:token], params[:you_tube_entry])
3. delete_video
The video can also be deleted if uploaded at the user’s youtube account by passing video id and token as a parameter.
YouTube.delete_video(params[:id], session[:token])
4. video_status
This method helps finding out the status of uploaded video.
s = YouTube.video_status(session[:token], params[:id]) @status = s.control.state.name
The changes to the plugin have been merged in the master and you can download everything here. I will really appreciate your feedback and suggestions to make this plugin better.
Vibha Chadha is working with Vinsol as a rails developer. When she is not writing code, she likes to read “geek” books and listen to some “good” music.
