Monday, 7 July 2014

Image Processing in rails

 http://railscasts.com/episodes/374-image-manipulation  
 https://www.ruby-toolbox.com/categories/image_processing  
 http://stackoverflow.com/questions/1704670/ruby-rails-image-processing-libraries  
 http://railscasts.com/episodes/374-image-manipulation?view=asciicast  

Rails with javascript/coffeescript/ajax/jquery

 javascript :
 
 http://railsapps.github.io/rails-javascript-include-external.html(theory)  
 http://stackoverflow.com/questions/3437585/best-way-to-add-page-specific-javascript-in-a-rails-3-app  
 http://brandonhilkert.com/blog/page-specific-javascript-in-rails/  
 http://pothibo.com/2013/07/responsive-javascript-in-rails/  
 http://www.sitepoint.com/forums/showthread.php?1040070-Javascript-with-ruby-on-rails  
 http://asciicasts.com/episodes/205-unobtrusive-javascript

 coffeescript :  

 http://www.sitepoint.com/using-coffeescript-in-rails/  
 
 ajax :
  
 http://stjhimy.com/posts/07-creating-a-100-ajax-crud-using-rails-3-and-unobtrusive-javascript  
 http://www.tutorialspoint.com/ruby-on-rails/rails-and-ajax.htm  
 http://richonrails.com/articles/basic-ajax-in-ruby-on-rails  
 http://rails-ajax.x-aeon.com/  
 http://code.tutsplus.com/tutorials/using-unobtrusive-javascript-and-ajax-with-rails-3--net-15243 
 https://github.com/nacengineer/rails-3.1-AJAX-Example
jquery :

 http://joshhuckabee.com/  
 http://railscasts.com/episodes/136-jquery  
 gem "jquery-rails"  
 gem jquery-ujs  
 http://robots.thoughtbot.com/a-tour-of-rails-jquery-ujs  
 http://www.railsdeveloper.net/2010/06/rails-and-jquery-how-to-integrate-jquery-ui-into-your-rails-app/  
 http://stackoverflow.com/questions/13481996/how-can-i-use-jquery-in-rails-3-2-8  

Links for Carrierwave gem in rails

 carrierwave  

 http://carrierwave.rubyforge.org/rdoc/  
 https://coderwall.com/p/lqtsya  
 http://playingwithtux.wordpress.com/2011/07/24/carrierwave-gem-in-rails/  
 https://blog.engineyard.com/2011/a-gentle-introduction-to-carrierwave/  
 http://rebelcolony.com/posts/rails-3-image-uploading-with-carrierwave  
 http://guides.railsgirls.com/thumbnails/  
 http://www.freezzo.com/2010/12/23/create-ffmpeg-processor-for-carrierwave-in-rails-3/  
 http://richonrails.com/articles/allowing-file-uploads-with-carrierwave  
 
Carrierwave for thumbnails  

 http://asciicasts.com/episodes/253-carrierwave-file-uploads  
 http://railscasts.com/episodes/253-carrierwave-file-uploads  
 http://www.sitepoint.com/processing-images-with-carrierwave/  
 http://www.javahabit.com/2012/06/03/saving-files-in-amazon-s3-using-carrierwave-and-fog-gem/  
 http://rubydoc.info/gems/carrierwave/frames  

 Cloudinary and Carrierwave  

 http://www.millwoodonline.co.uk/blog/uploading-many-images-to-cloudinary-with-carrierwave  
 http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary  

 Integrating Zencoder API with Carrierwave in Rails  
 http://waseem-ahmad.com/2013/04/29/integrating-zencoder-api-with-carrierwave-in-rails/ 

 
 http://neovintage.blogspot.in/2010/06/file-uploads-with-rails-3-plupload-and.html  
 http://markcharlesdesign.blogspot.in/2013/12/google-cloud-storage-with.html  
 http://lucapette.com/rails/multiple-files-upload-with-carrierwave-and-nested_form/  

Sunday, 6 July 2014

ruby code for lift(elevator)

 class Lift  
  GROUND_FLOOR = 1  
  TOTAL_FLOOR = 10  
  @@previous_floor =0  
  TRAVEL_TIME = 3  
  DO_DC = 10  
  attr_reader :elevator_on_floor  
  attr_accessor :elevator_target_floor, :new_floor  
  def initialize  
    @elevator_target_floor = GROUND_FLOOR  
  end  
  def call_elevator_to_floor( new_floor,entry_count)  
    if new_floor <= TOTAL_FLOOR  
      puts "strated to floor #{new_floor}"  
      time_to_display = ((new_floor-@@previous_floor)*TRAVEL_TIME).abs  
      puts "time left to reach #{time_to_display} seconds"  
      @@previous_floor = new_floor  
      time_passes(new_floor,time_to_display,$entry_count)  
    else  
     puts 'Invalid floor enter between (1 -10)'  
    end  
  end  
  def time_passes(new_floor,time_to_display,entry_count)  
    if @new_floor != @elevator_target_floor  
     sleep time_to_display.abs  
     $entry_count-=1  
     puts "elevator has arrived at #{new_floor}"  
    else  
      puts "elevator has arrived at your floor"  
    end  
  end  
 end  
 lift = Lift.new  
 puts 'Enter the floor number to reach(1-10)'  
 $entry_count =0  
 while line = gets  
  $entry_count+=1  
  line.chomp!  
    if line      
      puts lift.call_elevator_to_floor( line.to_i,$entry_count )   
     end  
 end  

Wednesday, 2 July 2014

Useful Discussions on Ruby on Rails

 source linkedin (2nd July 2014)  
 Is Ruby On Rails ready for any Enterprise?  
 http://www.linkedin.com/groups/Is-Ruby-On-Rails-ready-120725.S.5888238688403480580?type=member&fromEmail=fromEmail&trk=eml-b2_anet_digest-group_discussions-2-grouppost-disc-0&ut=3T5H8htQzB8mk1&item=5888238688403480580&gid=120725&view2n= 
 

Why You Should Never Charge Hourly

http://freelancefolder.com/why-you-should-never-charge-hourly/?utm_content=buffer98769&utm_medium=social&utm_source=linkedin.com&utm_campaign=buffer 
 
 

Collaborative code editor

http://blog.hashdog.com/rails/scrapfy-chrome-extension/ 
 

No more support for 1.8.7 and 1.9.2 ruby

 
https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/?utm_source=rubyweekly&utm_medium=email 

Sunday, 29 June 2014

Rails useful resources

  Rails: Things you must know about TDD and BDD    
  http://blog.andolasoft.com/2014/06/rails-things-you-must-know-about-tdd-and-bdd.html   
  
  ROR development-resources :    
  http://www.developerslane.com/14-top-ruby-on-rails-development-resources/#prettyPhoto   
  
  Useful blog for Rails developer:   
  http://blog.hashdog.com/articles/  
  http://robots.thoughtbot.com/  
  
  Steps to add ‘Elasticsearch’ to Rails App :   
  http://blog.andolasoft.com/2014/05/steps-to-add-elasticsearch-to-rails-app.html   
  
  Top 5 Tools for Project Management:   
  http://www.sitepoint.com/top-5-tools-for-project-management/    
  
  Sidekiq gem  
  http://sumanranjanpanda.wordpress.com/2013/09/24/steps-to-implement-sidekiq-with-rails-3-x/  
  http://tsamni.com/post/84515089035/sidekiq-performing-background-or-delayed-jobs-with  
  
  git rollback after git push  
  http://stackoverflow.com/questions/1270514/undoing-a-git-push  
  
  git structure  
  http://stackoverflow.com/questions/3666953/showing-git-branch-structure  
  
  Installing xapian-full 1.2.3 on UBUNTU  
  sudo apt-get update  
  sudo apt-get install build-essential zlib1g-dev uuid-dev  
  gem fetch xapian-full  
  gem unpack xapian-full-1.2.3.gem  
  sudo apt-get install curl  
  cd xapian-full-1.2.3  
  curl -O https://github.com/rlane/xapian-full/pull/4.patch  
  patch < 4.patch  
  gem build xapian-full.gemspec  
  gem install ./xapian-full-1.2.3.gem  
  sudo gem install xapian-full  
  cd ..  
  rm -rf xapian-full-1.2.3  
  rm xapian-full-1.2.3.gem  
  http://www.xpertpcnet.com/wordpress/2013/04/26/installing-xapian-full-1-2-3-on-ubuntu/  
 
 
  kill rails server:   
  netstat -plntu | grep 3000  
  tcp    000.0.0.0:30000.0.0.0:*        LISTEN   7656/ruby  
  The last column shows the PID and the process name, then you only need to do:  
  kill -9  7656  
  and rails s to get it working again...  
  
  or  
  Remove that file: C:/Rails/tmp/pids/server.pid  
  
  or  
    start the server on different port  
  C:\Rails>rails s -p 3001  
 
  Basic rails console commands:  
 >> User.new # Creates a new user object  
 >>  
  user = User.new(:name => “Michael Hartl”, :email =>   
 “mhartl@example.com”) => # >> user.save # Save the object   
 specified  
 >> user.name # access a specific property of the object  
 >> User.create(:name => “A Nother”, :email => “another@example.org”) # same as a user.New and a user.save  
 >> foo.destroy # destroy a created object, but the created object will still in memory (see below)  
 >> foo => # #Still gave you something even after destroy  
 >> User.find(1) # Find user with id 1  
 >> User.find_by_email(“mhartl@example.com”) # Find user by email (or any other specific attributes)  
 >> User.first # Find the first user in DB  
 >> User.all # Returns all usrs  
 >> user.email = “mhartl@example.net” #Updating a user’s property, and then do user.save  
 >>  
  user.update_attributes(:name => “The Dude”, :email =>   
 “dude@abides.org”) #Update several attr at once, and also performs a   
 user.save at the end, only attributes indicated on the object as   
 attr_accessible can be updated this way  
 >> user.errors.full_messages # If there were errors when saving the data, they will be contained here  
 If you want to access some of your helper methods while in the console:  
 >include ActionView::Helpers::TextHelper // Now you can use them  
 User.find_by_login("praaveenranganathan@gmail.com").user_company_info  
 SELECT * FROM `user_company_infos` WHERE (`user_company_infos`.`user_id` = '38f35826-2050-11e3-a135-0015e9bbd3cc') LIMIT 1;  
 http://pragtob.github.io/rails-beginner-cheatsheet/#rails-commands  
 rvm installation not working:  
  if u get RVM is not a function error
 You need to run the follow  
 source ~/.rvm/scripts/rvm  
 then run this  
 type rvm | head -n 1  
 and if you get  
 rvm is a function  
 the problem is solved.  
 You also need to run user$ rvm requirements to see dependency requirements for your operating system  
 Source: https://rvm.io/rvm/install/  
 I forget mention that you need to put this code into you ~/.bashrc or ~/.zshrc file and you will not need to write this code again.  

Monday, 5 May 2014

Adding the Disqus comment system to a Rails 3 application

 step 1  
 gem install disqus  
 step2  
 add in application.rb(user should registered to consume service)  
 config.after_initialize do  
   Disqus::defaults[:account] = "youraccountname"  
   Disqus::defaults[:developer] = true  
   Disqus::defaults[:container_id] = "disqus_thread"  
   Disqus::defaults[:show_powered_by] = false  
   end  
  step3  
  add this to view file(example: show.html.erb)  
 <div id ="disqus_thread">  
 <% = raw disqus_thread %>  
 </div>  
 start the server and check.....