Thursday, November 27, 2014

Nginx 413 Request Entity Too Large

Error:
Nginx 413 Request Entity Too Large

Solution:

You are trying to upload file/video below max range for client request:
For solve this problem increase it in your nginx.conf file.


Nginx conf file will be located at /etc/nginx/nginx.conf. If it does not exist there, it may also be at /usr/local/nginx/conf/nginx.conf or /usr/local/etc/nginx/nginx.conf.


Then open it in your favourite editor and set your required (here i need 20M) value for server or http or location

    # set client body size to 20M #
    client_max_body_size 20M;

  

An error occurred while installing pg (0.17.1)

Error:
 
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/bin/ruby
    --with-pg
    --without-pg
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20141127-24314-61kh42/pg-0.17.1/gems/pg-0.17.1 for inspection.
Results logged to /tmp/bundler20141127-24314-61kh42/pg-0.17.1/extensions/x86_64-linux/2.1.0-static/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.


Solution:

Install this dependency:

        sudo apt-get install libpq-dev


And then do bundle install again. It will work!!

Thursday, November 20, 2014

How to install Python 3.3 in Ubuntu 12.04

Step 1.) Install dependencie:
        sudo apt-get build-dep python3.2
        sudo apt-get install libreadline-dev libncurses5-dev libssl1.0.0 tk8.5-dev zlib1g-dev liblzma-dev
Step 2.) Download Python 3.3.0:
wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz
Step 3.) Extract:
tar xvfz Python-3.3.0.tgz
Step 4.) Configure and Install:

         Python-3.3.0./configure --prefix=/opt/python3.3make
         sudo make install


Create one demo program:

open your favorite text editor and give name with extension .py

write this code in that file. Here I have created test.py

name = raw_input('What is your city name?\n')
print 'Hi, %s.' % name

Run this file like this:

pyhton test.py

Output:

What is your city name? (It will wait for your answer)
Hi, Ahmedabad