Monday, December 30, 2013

Thursday, December 26, 2013

How to install subversion(rabbitcsv) control

RabbitVCS is a set of graphical tools written to provide simple and straightforward access to the version control systems you use. Currently, it is integrated into the Nautilus and Thunar file managers, the Gedit text editor, and supports Subversion and Git, with a goal to incorporate other version control systems as well as other file managers.

Steps:
sudo add-apt-repository ppa:rabbitvcs/ppa  
sudo apt-get update 
sudo apt-get install rabbitvcs-core rabbitvcs-nautilus3 rabbitvcs-cli
nautilus -q 
sudo apt-get install rabbitvcs-gedit

Monday, December 09, 2013

Skipping index creation, cannot connect to ElasticSearch

Error:

Skipping index creation, cannot connect to ElasticSearch
(The original exception was: #<Errno::ECONNREFUSED: Connection refused - connect(2)>)

Solution:
sudo apt-get update
Before install elastic search you need to install java first.
so install java from here.

If you want to use latest version of ElasticSerach then change below link:
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.deb
sudo dpkg -i elasticsearch-0.90.7.deb
For start elasticsearch do this:
sudo service elasticsearch start

Saturday, December 07, 2013

An error occurred while installing mongrel (1.1.5), and Bundler cannot continue.

Installing mongrel (1.1.5) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/sachin/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb 
checking for main() in -lc... yes
creating Makefile

make
compiling http11_parser.c
compiling http11.c
http11.c: In function ‘http_field’:
http11.c:70:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c:71:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c:77:22: error: ‘struct RString’ has no member named ‘ptr’
http11.c:77:50: error: ‘struct RString’ has no member named ‘len’
http11.c: In function ‘request_uri’:
http11.c:102:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c: In function ‘fragment’:
http11.c:113:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c: In function ‘request_path’:
http11.c:124:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c: In function ‘query_string’:
http11.c:135:3: warning: format not a string literal and no format arguments [-Wformat-security]
http11.c: In function ‘header_done’:
http11.c:172:33: error: ‘struct RString’ has no member named ‘ptr’
http11.c:174:89: error: ‘struct RString’ has no member named ‘ptr’
http11.c:176:52: error: ‘struct RString’ has no member named ‘ptr’
http11.c:177:26: error: ‘struct RString’ has no member named ‘len’
http11.c: In function ‘HttpParser_execute’:
http11.c:298:23: error: ‘struct RString’ has no member named ‘ptr’
http11.c:299:23: error: ‘struct RString’ has no member named ‘len’
http11.c:307:5: warning: format not a string literal and no format arguments [-Wformat-security]
make: *** [http11.o] Error 1


Gem files will remain installed in /home/sachin/.rvm/gems/ruby-1.9.3-p286@prjct/gems/mongrel-1.1.5 for inspection.
Results logged to /home/sachin/.rvm/gems/ruby-1.9.3-p286@prjct/gems/mongrel-1.1.5/ext/http11/gem_make.out
An error occurred while installing mongrel (1.1.5), and Bundler cannot continue.
Make sure that `gem install mongrel -v '1.1.5'` succeeds before bundling.

Solution:
change in Gemfile

gem "mongrel", ">= 1.2.0.pre2"

Friday, December 06, 2013

Can't verify CSRF token authenticity using rails for link and json requests

I think we are trying to do a POST request from a link. By default links aren't do POST requests, only GET requests can do it. So when we try to make the connection to our server, then Rails warns us about this CSRF.

One way is that, we can comment the protect_from_forgery line from application_controller, So Rails doesn't do this kind of verification, but this is extremely not recommended because it it will affect your another def. of controller then you need do like this way.
protect_from_forgery with: :exception, :except => [<def_name>]
I have another way to avoid this kind of behavior is that we need to use a form instead of link. So we can do proper POST requests to the server.

If you are using JSON requests then you can add this :
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }

Tuesday, December 03, 2013