Wednesday, October 14, 2015

Thursday, September 10, 2015

Great JS frameworks infographic

Here is a great infographic that is very useful when choosing an adequate JS framework for your projects: http://www.webdesigndegreecenter.org/choosing-javascript-framework/

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 installing gnureadline

I was getting the following error gen trying to install gnureadline via pip:

collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/gnureadline/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1_fHxP-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/gnureadline
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/pip/__main__.py", line 5, in <module>
    exit = run()
  File "/usr/lib/python2.7/dist-packages/pip/runner.py", line 12, in run
    return pip.main()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 66: ordinal not in range(128)

Turns out that is an issue generated by the use of older versions of pip: https://github.com/pypa/pip/issues/2667

The the version of pip in my server was 1.5.4 so I updated it:

sudo python -m pip install --upgrade pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d
  Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed pip
Cleaning up...

Mine was a new server so I installed some needed common libs: http://stackoverflow.com/questions/31508762/exception-using-pip-install

sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev libncurses5-dev

Then I tried to install gnureadline again and everything worked fine :)

Monday, July 13, 2015

Error installing MySQL-python on OSX

Tring to install mysql-python:

sudo python -m pip install MySQL-python



I was getting the error:

    sh: mysql_config: command not found

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Applications/XAMPP/xamppfiles/htdocs/associate-fork-jhon-venv/build/MySQL-python/setup.py", line 17, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found



I solved the issue running:

brew install mysql


Reference:

Thursday, January 29, 2015

Monday, January 26, 2015

Heroku: enable gzip compression

Add to your .htaccess file:

##################### GZIP COMPRESSION #####################

SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-phpBrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Header append Vary User-Agent env=!dont-vary

Reference:
http://stackoverflow.com/questions/12367858/how-can-i-get-apache-gzip-compression-to-work

Wednesday, January 21, 2015

Monday, January 19, 2015

Python: ImportError: No module named mandrill

I installed mandrill using pip:

    (venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ pip install mandrill

I got this result:

    Downloading/unpacking mandrill
    Downloading mandrill-1.0.57.tar.gz
    Running setup.py (path:/private/var/folders/x3/st96cn215h915kqwlcrmtspw0000gn/T/pip_build_jhonjairoroa87/mandrill/setup.py) egg_info for package mandrill
    Requirement already satisfied (use --upgrade to upgrade): requests>=0.13.2 in /usr/local/lib/python2.7/site-packages (from mandrill)
    Requirement already satisfied (use --upgrade to upgrade): docopt==0.4.0 in /usr/local/lib/python2.7/site-packages (from mandrill)
    Installing collected packages: mandrill
    Running setup.py install for mandrill
    changing mode of build/scripts-2.7/mandrill from 644 to 755
    changing mode of build/scripts-2.7/sendmail.mandrill from 644 to 755
    changing mode of /usr/local/bin/mandrill to 755
    changing mode of /usr/local/bin/sendmail.mandrill to 755
    Successfully installed mandrill
    Cleaning up...


But when I try to use it, fails:

    (venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ python
    Python 2.7.6 (default, Sep  9 2014, 15:04:36)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mandrill
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named mandrill
    >>>
    >>> import sendmail.mandrill
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named sendmail.mandrill


I solved it by uninstalling it

     pip uninstall mandrill

and reinstalling it using the python -m option:

    sudo python -m pip install mandrill

Now it works perfectly.

    (venv)Jhons-MacBook-Pro:python_mandrill jhonjairoroa87$ python
    Python 2.7.6 (default, Sep  9 2014, 15:04:36)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mandrill
    >>>


Reference:
http://stackoverflow.com/questions/28032356/importerror-no-module-named-mandrill/28032480

Thursday, January 15, 2015

Codeship - heroku continous deployment: Push failed: could not store slug!

Trying to deploy automatically form codeship to heroku I was getting the error:

-----> Compressing... done, 72.0MB
-----> Launching...!     
Push failed: could not store slug!     
If the problem persists, see http://help.heroku.com and provide Request ID 

I solved the issue by adding the heroku url project and enable the "force push" flag in the option: Project settings > Deployment > Heroku Deployment > more options.

Reference:
http://stackoverflow.com/questions/9794413/failed-to-push-some-refs-to-githeroku-com

Wednesday, January 14, 2015

Python: "command python setup.py egg_info failed with error code 1" while trying to install psycopg2

Using MacOSX I was trying to install psycopg2 by using the command,

sudo pip install psycopg2

And I was getting this error:

command python setup.py egg_info failed with error code 1

I solved the issue by installing http://brew.sh/ and running following commands:

brew install python
brew install postgres

References:
http://stackoverflow.com/questions/5420789/how-to-install-psycopg2-with-pip-on-python