Entradas no planeta de alcides


  • Alcides Fonseca

    Farewell passenger!

    Por alcides, em 19 Fevereiro 2015 10:07 - Mais entradas deste utilizador

    6 years later and two VPS later, I decided it was time to leave Phusion Passenger.

    I was experience several downtimes due to database (both mariadb and mysql) crashes. It turns out the database could not recover because ruby was occupying the whole memory (512Mb on DigitalOcean). The solution was to shut down apache, then start the database, and finally start apache again. But this would only work for a couple of days.

    I decided to move all my django sites to WSGI (yes, I was deploying django apps using passenger) and ported a sinatra app to django (thanks to legacy database support) just so I could get rid of ruby.

    It all works well now. But in the meanwhile, I went to read Passenger’s source code and I am currently considering forking and removing everything ruby from it. Just an apache2 module that would automatically handle wsgi, avoiding 4 lines of apache config per project. It can be done, I am just not sure it is worth the time. Maybe it would help other people with plain-simple deploying on Apache/NGINX?

  • Alcides Fonseca

    There has some buzz about Reading the source code on the interwebz lately.

    As someone who teaches Computer Science, I find that most students finish their degrees without having read a single line of code that was not written by themselves, group partner or professor. And given the huge amount of good-quality open source code on the internet this is a very disappointed fact.

    In fact, when they find an error on a 3rd party software (being a dependency, middleware or just a library) they simply block and cannot advance. For instance, when debugging a stack-trace in a Java project, once the methods reach out of the scope of their project and belong to something else, they stop debugging and don’t try to understand what is happening underneath.

    And in my experience situations where the answer is not in the documentation, but in the source code, happen at least once a month. In fact, I have up reading the documentation for most libraries in Python or Ruby. I end up just browsing the source to learn how to work with them, it’s must faster for me. Unless they have some really complex algorithm, and then the documentation is a pre-requisite to the source code.

  • Alcides Fonseca

    How to install the R python bindings library RPy2 on Mac OS 10.6 Snow Leopard using Homebrew.

    Install R

    In order to install R in your Mac as a framework, make this change in your homebrew/Library/Formula

    brew install r

    Install RPy2

    wget http://pypi.python.org/packages/source/r/rpy2/rpy2-2.1.4.tar.gz#md5=cf4e0d80ba498a6d76f107531966478d
    tar xfz rpy2-2.1.4.tar.gz
    cd rpy2-2.1.4/
    sudo python setup.py build --r-home /usr/local/Cellar/r/2.11.1/R.framework/Resources/ install
    

    Troubleshooting

    If you are having a problem related to “-framework vecLib” when installing rpy2, insert a new line after #134 of setup.py with the following:

    extra_link_args = extra_link_args[:-1]

    Worked for me.

  • Alcides Fonseca

    Package Install

    Nuno Lourenço created a PIL package for Python 2.6 on OS X.

    Compilation

    How to install PIL (Python Image Library) in Snow Leopard with freetype2 and libjpg support.

    Libjpg

    brew install jpeg Or download source and compile.

    Freetype2

    wget http://mirrors.fe.up.pt/pub/nongnu/freetype/freetype-2.1.10.tar.gz

    tar -zxvf freetype-2.1.10.tar.gz && cd freetype-2.1.10

    ./configure && make && sudo make install

    PIL

    wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz

    tar -zxvf Imaging-1.1.6.tar.gz && cd Imaging-1.1.6/

    Open setup.py and change JPEG_ROOT and FREETYPE_ROOT to:

    FREETYPE_ROOT = libinclude("/usr/local")

    JPEG_ROOT = libinclude("/Users/alcides/Code/Support/homebrew/Cellar/jpeg/7")

    Finally, sudo python setup.py install