1 de octubre de 2012

Working on django-notification (django 1.4 support, internationalization, etc.).

What's this all about?

Working on a Django project, I happened to come across with the need of a notifications app for Django. The first one to take a look at and perhaps the most popular the last years is django-notification. So, let's take a look at it, my friend.

What was the problem?

Well, to begin with, it does not work with Django  1.4 or above. That's the starting point for me to branch out from the original repo of the project. I tuned it up to work with Django 1.4.

Later down the road, we decided to use internationalized dates. And then again, django-notification did not handle them properly (does not suppor internationalization at all). And therefore a zillion of our tests started to throw warning.

Once again, I had some time to spare, and got myself hands on that.


Which changes did I make to django-notification? Let's take a look:

  • Made it work with django 1.4
  • [this is a big one] Made django-notification timezone aware and compliant.
  • Made every single file PEP8 compliant
  • Fixed a bunch of issues I found while going through the codebase (like missing imports)
  • Quite a few code improvements (like the usage of "zip" or "file" as variable names)

Where's this code? How I install it for my project?

The code is available here, at my github account: https://github.com/matiasherranz/django-notification

You can install it with pip this way:

pip install  -e git+https://github.com/matiasherranz/django-notification.git#egg=django-notification

I'm open to suggestions, comments or pull requests to improve the app.

Hope it helps!

15 de septiembre de 2012

Material de mi charla sobre Django en el PyDay Córdoba 2012

Acá dejo el contenido de mi charla de Django del PyDay 2012:

Filminas y la aplicación que mostré, creada paso a paso:

Muchas gracias a todos/as los/as que vinieron!

Cualquier consulta, no duden en mandarme un email.


21 de mayo de 2012

Find what you are looking for with grep + find + xargs

Sometimes (very often) you are looking for this particular word of string that you think is in one file of a given project... but you don't know which file, and the project has a zillion files. And you feel like crying.

Well, don't, that's what this post is for :)

Let's go for the command:

$ find -iname | xargs grep -in

[1] a folder name: for instance, to look from the current folder, use ".".
[2] for instance, for files ending in .py, use this: "*.py"
[3] a string to look for. Case insensitively.

Example: Let's look for the string "hello", case insensitively, between the files of the current folder and its subfolders, inside files with filename ending in .py:

$ find . -iname '*.py' | xargs grep -in 'hello'

The output will say the file(s) and line numbers in those files where 'hello' was found.

17 de mayo de 2012

VOX USB-MIDI Driver for Mac OS X

After digging around the web for a while, searching for the VOX USB-MIDI Driver for Mac OS X for the VOX ToneLab EX, I found it on the VOX Japanese site.

Here's the link: http://voxamps.jp/support/download/usb-midi/mac.html

Direct download link: link.

11 de mayo de 2012

Logo UNC vectorizado

Escribiendo nuestro trabajo final de la Licenciatura en Ciencias de la Computación de FaMAF con Joaco (http://focojoaco.blogspot.com.ar/) nos dimos con que necesitábamos un logo de la UNC para la carátula de la tesis.

Fue bastante complicado encontrarlo, así que lo comparto: link.


23 de febrero de 2012

Keyboard shortcut to unhide or unminimize a window in Mac OS X Lion

  • press Command-Tab to show your running apps
  • press tab until you've selected the minimized app
  • here's the magic trick => then press the option key, and let go of the command key (you must depress the command key after pressing the option key!)
Source: Link.

7 de febrero de 2012

Repairing PostgreSQL after upgrading to Mac OSX Lion

I upgraded to Mac OSX to 10.7.3 (Lion) yesterday and had some issues with PostgreSQL.

For instance, when I tried to run the South migrations for the Django project I'm working at, I got this:

psycopg2.OperationalError: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
How I fixed this?

  1.  Edit PostgreSQL's config to define the unix_socket_directory setting:

    $ sudo nano /Library/PostgreSQL/9.0/data/postgresql.conf

    In my case I changed the setting to unix_socket_directory = '/var/pgsql_socket/'.
  2. Exceute the following commands:

    $ sudo dscl . append /Groups/_postgres GroupMembership postgres
    $ sudo chmod g+w,o+rx /var/pgsql_socket/

  3.  Restart the server:

    $ sudo -u postgres /Library/PostgreSQL/9.0/bin/pg_ctl -D /Library/PostgreSQL/9.0/data/ restart
Note: You may want to add an alias for this command in your ~/.profile file. If so, it is just a matter of adding a line like this:

alias restart_postgres='sudo -u postgres /Library/PostgreSQL/9.0/bin/pg_ctl -D /Library/PostgreSQL/9.0/data/ restart'