Blog Archives

Doorkeeper (4.2.6) redirect URI does not match

¬†ERROR — omniauth: Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. add callback_url method in your oauth provider

Posted in Uncategorized

Invalid mix of scope block and deprecated finder options on ActiveRecord association

While upgrading from rails to rails 4.2.6 has_many :subitems, through: :child_associations, source: :child, source_type: ‘ContentItem’, conditions: ‘content_items.deleted 1’, order: ‘content_associations.position ASC’ Replaced conditions with proc has_many :subitems, ->{where(‘content_items.deleted 1’)}, through: :child_associations, source: :child, source_type: ‘ContentItem’,¬† order: ‘content_associations.position ASC’ 2.

Posted in Uncategorized, upgrade from rails 3 to 4

start delayed job on reboot [sh script]

Short way: Making script run at boot time at Debian Manual Way: cd /etc/init.d && sudo nano delayed_job_script Paste following code to delayed_job_script: Note: change RAILS_ROOT and ENV variables according to your setup. #!/bin/sh RAILS_ROOT=”/home/deploy/apps/ProjectFolder/current” ENV=”production” case “$1” in start)

Tagged with: , ,
Posted in Ubuntu

Check if same key pressed twice in 1second

var twice = 0; var previous_key=null; $(document).on(‘keyup’, function( e ){ if(twice===1){ if(e.which==previous_key) console.log(previous_key+'(you pressed twice!)’+e.which); else{ console.log(previous_key+’—–‘+e.which); twice = 0; } }else{ previous_key=e.which; } twice = 1; setTimeout(function(){ // …reset to 0 after 1s twice = 0; }, 1000); });

Posted in Javascript

Check and export Java path and version Ubuntu

Check java version: java -version Check path of installed java: readlink -f $(which java Note: remove /bin/java from end of path In ~/.bashrc file add following command at the end: export JAVA_HOME=’/usr/lib/jvm/java-7-openjdk-amd64/jre/’ Now run: source ~/.bashrc

Tagged with:
Posted in java

Elasticsearch service not starting Ubuntu

Cause: While trying to run elasticsearch in background my elasticsearch user and group was recreated and had a new user and group id Solution: sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch/ Now sudo service elasticsearch start sudo service elasticsearch status referenced from

Posted in Elasticsearch

Elasticsearch 1.2.1 ::Transport::Transport::Errors::BadRequest – [400]

This error occurred because index was corrupted or missing Solution either re-index your documents or copy index from your backup. In Ubuntu elastic-search data directory path is mentioned below: /var/lib/elasticsearch/ inside this directory project wise data directories exists. Copy your

Posted in Elasticsearch

Heroku permission denied for database “postgres”

FATAL: permission denied for database “postgres” DETAIL: User does not have CONNECT privilege. Run this command to solve this error: heroku addons | grep POSTGRES

Tagged with: , ,
Posted in Heroku, Uncategorized

LaTeX | error algorithm.sty not found [Ubuntu 14.04]

If you use the algorithm package in your LaTeX document, as mentioned below: \usepackage{algorithm} you might get this error on compiling it LaTeX Error: File `algorithm.sty’ not found. For Ubuntu, this LaTeX package is bundled in the texlive-science package. To

Tagged with: ,
Posted in Latex

Connect with MongoDB on separate EC2 Instance

You need to open mongoDB port to world so that you can listen inbound traffic. To do so: In instance security group -> Inboud Open 27017 port or whatever port on which your mongoDB is currently running. Type Protocol Port

Tagged with: , , ,
Posted in amazon, EC2, mongodb, mongoid