Skip to main content

Posts

WKHTML pdf setup in Ubuntu

 wkhtml to pdf install on ubuntu 20.04 sudo apt-get install -y libxrender1 libfontconfig1 libx11-dev libjpeg62 libxtst6 fontconfig xfonts-75dpi xfonts-base libpng12-0 wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb #issue fix for: libpng12-0 sudo add-apt-repository ppa:linuxuprising/libpng12 sudo apt update sudo apt install libpng12-0 #Issue fix for: libssl1.0.0. Edit the source list sudo nano /etc/apt/sources.list to add the following line: deb http://security.ubuntu.com/ubuntu xenial-security main Then sudo apt update and sudo apt install libssl1.0.0. #source link: https://askubuntu.com/questions/1261614/ubuntu-20-04-libssl-so-1-0-0-cannot-open-shared-object-file-no-such-file-or-d sudo dpkg -i wkhtmltox_0.12.5-1.xenial_amd64.deb sudo apt-get -f install

Wordpress Setup using the Xampp.

                       Wordpress Setup using the Xampp.           STEPS: Install the XAMPP server. Link for the reference: https://www.apachefriends.org/download.html After installation, we need to run the Apache and Mysql start. Download the WordPress plugin from the website. Link for reference: https://wordpress.org/download/ We need to put the WordPress folder to xampp -> htdocs  We need to run the URL: http://localhost/wordpress/wp-admin/ We need to set up the WordPress configurations. Database name:  Db name            Username: root            Password:     (Empty)            Host: localhost          Once setup is done we can access the website. Appearance -> Themes...

Heroku Deployment in ROR?

Heroku Deployment in ROR?   git push origin main(branch name) heroku create -> Create the repository in heroku heroku push origin main(branch name) heroku db:migrate heroku logs => Checking the heroku logs heroku open -> Open the URL heroku pg:psql

Ruby on Rails Interview Questions Experienced

ROR Interview Questions Experienced  Difference between the map & each? The map will return the new array with modified values. Each will return the same array with an object. Write the  program to sort the array in ruby without using the sort method? def ary_sort(list, new_array = nil) return new_array if list.size <= 0 if new_array == nil min = list.min new_array = [] end ary_sort(list, new_array) new_array << min list.delete(min) end    ary_sort ([1,6,5,3,8,24,18]) Write the   Program for array pass the arguments?  Input will be a = [2,3,4] ,a.add_no(2)   ====> Output - [4,5,6] Array.class_eval do def add_no(n) self.map{|x| x+ n} end end Difference between the find and find_by in rails? find_by () returns the  nil if the record does not exist in the database find () returns the  ActiveRecord::RecordNotFound exception  f the record does not exist in the database. How do acc...

Error malloc(): memory corruption nginx with passenger?

Error malloc(): memory corruption nginx with passenger Passenger issue resolving steps :  sudo gem uninstall passenger(uninstall all passenger) sudo gem install passenger sudo passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx --extra-configure-flags=none Update nginx config file with new passenger version and restart the nginx

Angular2 Installing main plugins using angular cli steps?

Angular2 Installing main plugins using angular cli steps? 1)npm i -D @angular-devkit/core 2)npm install jquery --save (or) npm install bootstrap@3 jquery --save 3)npm install -D @types/jquery 4)npm install font-awesome --save 5) npm install moment --save 6)npm install --save angular2-daterangepicker (Not there from source download) -> http://www.daterangepicker.com/#config 7)https://www.npmjs.com/package/ng2-highcharts  i)npm install --save highcharts@^4.2.1  ii)npm install @types/highcharts --save  iii)npm install --save ng2-highcharts 8)npm install ngx-pagination --save(https://github.com/michaelbromley/ngx-pagination) 9)npm install -D @types/bootstrap 10)npm install --save @types/daterangepicker

How to deploy angular2 with Apache server ?

How to deploy angular2 with Apache server  and angular cli? ng build --prod It will create dist folder in the application Copy the dist folder all files to /var/www/html/ Create .htaccess file in the path of /var/www/html/ Write this code   in .htaccess file <IfModule mod_rewrite.c>   RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L]  RewriteCond %{REQUEST_FILENAME} !-f   RewriteCond %{REQUEST_FILENAME} !-d   RewriteRule . /index.html [L] </IfModule> sudo service apache2 restart

Ruby on Rails Setup for nginx with Passenger

Ruby on Rails Setup for nginx with Passenger? Ruby Installation Note: Ruby installtion done from source 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 Download ruby which version needed wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz tar -xzvf ruby-2.2.2.tar.gz cd ruby-2.2.2/ ./configure sudo make install ruby -v --> Check the which ruby version installed Rails Installation gem install rails -v 4.2.3 Nginx with Passenger Installation gem install passenger sudo passenger-install-nginx-module sudo service nginx start if error “nginx: unrecognized service” # Download nginx startup script wget -O init-deb.sh https://www.linode.com/docs/assets/660-init-deb.sh sudo mv...

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 http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz #tar -xzvf ruby-2.2.3.tar.gz #cd ruby-2.2.3/ #./configure #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 I...

Sending Mobile SMS in Ruby on Rails using twilio

Sending Mobile SMS in Ruby on Rails using twilio? gem install twilio-ruby In Controller U need to add the  require 'twilio-ruby' @account_sid = 'AC3ddc5567a441ea2fdf0a460452599aa6'  @auth_token = '9aefac893c9c9214770046ecb796d6c8' @client = Twilio::REST::Client.new(@account_sid, @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 number To Number is from whom u need to send the message Use Only Live credentials only @account_sid is twilio account id @auth_token is twilio auth token Before 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 df1|udf2|udf3|udf4|udf5||||||salt) Controller Code Will be def payumoney   @key = "gtKFFx"   @salt =  "eCwWELxi"   val = "#{key|txnid|amount|productinfo|firstname|email|u df1|udf2|udf3|udf4|udf5||||||#{@salt}"  @checksum = Digest::SHA512.hexdigest("#{val}") end <form action="https://test.payu.in/_payment" 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=...

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 df1|udf2|udf3|udf4|udf5||||||salt) Controller Code Will be def payumoney   @key = "gtKFFx"   @salt =  "eCwWELxi"   val = "#{key|txnid|amount|productinfo|firstname|email|u df1|udf2|udf3|udf4|udf5||||||#{@salt}"  @checksum = Digest::SHA512.hexdigest("#{val}") end <form action="https://test.payu.in/_payment" 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=...

Document Preview in Rails?

Document Preview in Rails? Display the doc preview  in iframe? <iframe src='https://docs.google.com/viewer?url=www.google.com/doc/kotesh.docx&embedded=true' frameborder='0'></iframe> Display the doc preview  in new page? <a href= "https://docs.google.com/viewerng/viewer?url=url=www.google.com/doc/kotesh.docx&embedded=true" 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 gem 2)In application folder run the wheneverize. 3)In schedlue.rb file every 3.hours do runner "MyModel.some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end 4)Write the rake task 5)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 = Event.new({         # Code to instantiate an event         })         @event.save       end     end     puts "#{Time.now} - Success!"   end end end 6)whenever --update-crontab