Wednesday, 12 April 2017

Postgres/Django: could not load library postgis-2.1.so

If you are getting error like this after postgresql update:

ERROR:  could not load library "/usr/local/Cellar/postgresql/9.5.6/lib/postgis-2.2.so": dlopen(/usr/local/Cellar/postgresql/9.5.6/lib/postgis-2.2.so, 10): Library not loaded: /usr/local/lib/libCGAL.10.dylib
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Reason: image not found 

or of library libspatialite

Run following command

brew reinstall sfcgal --build-from-source   

brew reinstall libspatialite --build-from-source

I hope it will fix your issue.

Thanks!!!! Enjoy Programming!!! :)

Monday, 3 April 2017

Enable pep8 autoformat in Sublime Text

Steps to install pep8 autoformat package in Sublime Editor

1. Download Mercurial from https://www.mercurial-scm.org/ and install it.

2. Go To Sublime Text -> Preferences -> Browse Packages -> Note down the location.

3. Open terminal and go to Sublime Packages location.

4. Get clone - hg clone https://bitbucket.org/StephaneBunel/pythonpep8autoformat 'Python PEP8 Autoformat'

5. Restart Sublime Text3

6. If pep8 max line length 80 not working - Go To Sublime Text -> Preferences -> Settings -> User - Add rules

"rulers": [80]


Thanks!!!! Enjoy Programming!!! :)

Sunday, 22 January 2017

Odoo: Change currency for Web Shop

If you are facing issue with currency changes for web shop following steps mentioned in post:

http://blog.instant-erp.com/2016/01/odoo-v90-changing-currency-for-e.html

It worked for me. Hopefully will work for you as well.

Thanks!!!! Enjoy Programming :)

Ubuntu: Red warning triangle in top bar

If you are getting Red warning triangle in top bar, run following command:

sudo dpkg --configure -a

and restart your system.

Thanks!!! Enjoy Programming!!! :)

Wednesday, 16 November 2016

Safari SVG Sprite Issue

Few days back, my team faced an issue with svg sprites not working in Safari browser. Tried number of options to make it work but in vain. Finally from some post(don't remember page url) we found this solution and it worked like a charm!! :)


<svg>
    <use xlink:href="/media/icons/sprite.svg#sprite_id"></use>
</svg>

Thanks!!! Enjoy Programming :)

CakePHP: JS and CSS files are not loading

When you will search above topic over internet, lots of answers will pop-up. When I faced the same issue nothing worked, hence just to help someone who is in same shoes writing this post.

If apache is your web server and your cakephp project is in /var/www/html/ folder make sure that AllowOverride All enabled for /var/www/html

To enable AllowOverride All for /var/www/html following is an example for /etc/apache2/sites-available/000-default.conf


<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
        <Directory "/var/www/html">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>


</VirtualHost>


Thanks!!! Enjoy Programming :)

Thursday, 7 April 2016

Django, Eclipse and virtualenv setup

1. Create Virtual Environment

~ pip install virtualenv

~ virtualenv venv

2. Download & install Eclipse

3. Install PyDev

Go to Help -> Eclipse Marketplace -> Search PyDev and install it.




3. Each django virtual environment will be having new workspace and have to use virtual environment interpreter. 

Setup Python interpreter:

Eclipse -> Preferences -> PyDev -> Python Interpreter

Add new interpreter

New -> Set Interpreter Name -> Interpreter Executable(venv/bin/python)

Let's say new interpreter name is: customenv



Note: You can skip this step at this moment and add the interpreter at the time of creating a project.

4.  Create New Project -> PyDev -> PyDev Django Project

If Interpreter is not set till now, please set it now from step 3

Enter Project Name and Select Interpreter(customenv) -> Finish

5. Right Click on 

Project Name-> Properties -> PyDev - Django -> Django settings module (set project settings file e.g <project_name>.settings) -> apply -> Ok




That's it. Please let me know (comments), if you are facing any problem.

Thanks!!!!!!!! Enjoy Programming! :)


Reference Links:

http://linfiniti.com/2011/12/django-development-with-eclipse-and-pydev/

http://www.arruda.blog.br/programacao/review-eclipse-django-virtualenv/

http://lukeplant.me.uk/blog/posts/eclipse-pydev-and-virtualenv/


Postgres/Django: could not load library postgis-2.1.so

If you are getting error like this after postgresql update: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.5.6/lib/...