Skip to main content


Showing posts from 2016

Ruby On Rails with Nginx With Passenger Deployment?

Ruby On Rails  with Nginx With Passenger Deployment?

Ruby Installation #sudo apt-get update #sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev #wget
#tar -xzvf ruby-2.2.3.tar.gz
#cd ruby-2.2.3/
#make #sudo make install #ruby -v Rails Installation Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment. To install NodeJS, we're going to add it using a PPA repository: sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs gem install rails -v 4.2.4 MongoDB Installation sudo apt-key adv --keyserver --recv …

Sending Mobile SMS in Ruby on Rails using twilio

Sending Mobile SMS in Ruby on Rails using twilio?gem install twilio-rubyIn ControllerU need to add the  require 'twilio-ruby'@account_sid = 'AC3ddc5567a441ea2fdf0a460452599aa6' @auth_token = '9aefac893c9c9214770046ecb796d6c8'@client =, @auth_token)p @client.account@client.account.messages.create(from: '+12019044303', to: '+919538947694',body: 'Hello koteshwarrao welcome to my blog') Notes: From number is nothing but twillo numberTo Number is from whom u need to send the messageUse Only Live credentials only@account_sid is twilio account id@auth_token is twilio auth tokenBefore Sending any message to mobile the mobile number need to be verified to twilio account.

PayUMoney Integration in Ruby on Rails

PayUMoney Integration in Ruby on Rails

Generating Cheksum in Payu
   Hash or Checksum
= sha512(key|txnid|amount|productinfo|firstname|email|u

Controller Code Will be
def payumoney
  @key = "gtKFFx"
  @salt =  "eCwWELxi"
  val = "#{key|txnid|amount|productinfo|firstname|email|u
 @checksum = Digest::SHA512.hexdigest("#{val}")

<form action="" method='post' id='sub'  >
    <input type="hidden" name="key" value="<%=@key%>">
    <input type="hidden" name="hash" value="<%=@checksum%>">
    <input type="hidden" name="txnid" value="TXN1234">
    <input type="hidden" name="amount" value="200">
    <input type="hidden" name="firstname" value=&quo…

Document Preview in Rails?

Document Preview in Rails?
Display the doc preview  in iframe?
<iframe src='' frameborder='0'></iframe>
Display the doc preview  in new page?
<a href= "" target= "_blank">Doc PreView</a>

Production deployment steps in rails?

Production deployment steps in rails? List of steps for Production deployment 1)In app folder -> git pull origin master 2)bundle install --path vendor/bundle 3)rake assets:precompile RAILS_ENV=production 4)touch tmp/restart.txt 5)If u want to restat server level command is  sudo service nginx restart 6)Stop the nginx server command is sudo service nginx stop 7)Starting the nginx server command is sudo service nginx start

Cronjob in ruby on rails

1)Install whenever gem2)In application folder run the wheneverize.3)In schedlue.rb fileevery 3.hours dorunner "MyModel.some_process"rake "my:rake:task"command "/usr/bin/my_great_command"end4)Write the rake task5)namespace :events do  desc "Rake task to get events data"  task :fetch => :environment do    events = Event.nba_search    events.each do |item|      item.each do |hash|        @event ={        # Code to instantiate an event        })      end    end    puts "#{} - Success!"  endendend6)whenever --update-crontab

Ruby Encoder Steps

List Of steps for RubyEncoder

1)Downlolad the -> Or else we can download in this link also
2)Copy above file in this directory -> /usr/local/bin  (RubyEncoder-2.2-Evaluation-Linux-x86_64-Install)
3)Give the permissions chmod 755 RubyEncoder-2.2-Evaluation-Linux-x86_64-Install
4)Run the RubyEncoder-2.2-Evaluation-Linux-x86_64-Install command
5)Open Existing Project
  i)Add button click
  ii)Choose for destination
  iii)Click on encode button
  iv)select the platform which one we want to encode
    4)Macos x
 6)Set the destination folder.
 7)Click on install button.

Iquanti Apptitude Test for ror

Iquanti Apptitude Test for ror ?

Max. Marks 100
Given two strings A and B, check if they are anagrams.

Two strings are said to be anagrams, if one string can be obtained by rearranging the letters of another.

Examples of anagrams are dog, god; abac, baac; 123, 312

abab, aaba; dab, baad are not anagrams.


First line of the input is the number of test cases T.
It is followed by T lines, each line has two space separated strings A and B;

OUTPUT For each test case, print "YES" if they are anagrams, otherwise print "NO". (without quotes)

1 <= T <= 10
A and B both contain only lower case latin letters 'a' to 'z' and digits 0 to 9.
Length of each string A and B does not exceed 5*10^5 (500000),

Sample Input(Plaintext Link)
abcd bcda
bad daa
a1b2c3 abc123
Sample Output(Plaintext Link)

Prime or Not
Max. Marks 100
Given the number N check whether it is prime number or not.

Input co…

Basic Ruby Programs for Interview?

Basic Ruby Programs for Interview?

# require 'prime'
# # p Prime.first(10)
# Prime.each(100) do |prime|
#   p prime  #=> 2, 3, 5, 7, 11, ...., 97
# end

#Prime number programe
 def prime_numbers max
for i in (2..10) do
    for j in (2..i) do
        break if i%j == 0
    p "#{i} is a prime number." if i == j

#Factorial Programe
n = gets
n = n.to_i
def fact(n)
  if n == 0
    n * fact(n-1)
p fact(n)

#Reverse Number Programe
x = 12345
y = 0
while x > 0 do
    y = y*10
    y = y + (x%10)
    x = x/10

  puts y    

puts "What character do you want to make the pyramid out of?"
character = gets.chomp

puts "How many rows of #{character}'s do you want?"
row_count = gets.chomp.to_i

character_count = 1
width = 100

row_count.times do
puts (character * character_count).center(width)
character_count += 2

star_string = "*"
10.times do
    puts star_string
    star_string = star_string + "*&qu…