CONTACT:

team@tryolabs.com
(1) 650-319-7251

Python

MySQL vs PostreSQL

Keeping up with our efforts to be an active part of the open source community, we are pleased to announce the public release of our Simple Getty wrapper.

Python Simple Getty is a basic wrapper to the extensive Getty Images Connect API. In its current state it does not fully implement Connect, but it works really well in the most common use case: Search, get details and finally buy a set of images.

You can get the code in our github:

https://github.com/tryolabs/python-simple-getty

We recommend that you read the readme, but once you have the code, finding ...

Read more


libreQDA

A news worthy of The Tryolabs' Herald: 

We have just proudly released to the public LibreQDA, a Qualitative Data Analysis tool that we have developed alongside with the Universitat Autónoma de Barcelona and the Universidad de la República Oriental del Uruguay.

LibreQDA is what is commonly know in the psychology area as Computer Assisted Qualitative Data Analysis Software (CAQDAS). This tool allows the users to log in, import documents from different formats and assign valuable metadata to them. Once documents are opened, the user can select portions of them, tag them and codify them using a hierarchic coding system. Using ...

Read more


So you have made the decision to use timezone-aware dates and now you are building your cool REST API using Tastypie. Of course timezones are important to your application, so you want to expose them when Tastypie exposes dates in the API.

You have a very simple resource that exposes a Django model that has an attribute, for example:

from django.db import models


class Entry(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    # ... more fields
from tastypie.resources import ModelResource
from myapp.models import Entry


class EntryResource(ModelResource):
    class Meta:
        queryset = Entry.objects.all()

Out of the box, you notice ...

Read more


PyCon Uruguay 2012

Last November 10th and 11st we enjoyed the first Python Conference in Uruguay. The event was developed by the Python community in Uruguay as a result of the great success of the PyDay that took place in August 2011.

In the event participated several speakers from Uruguay, Argentina, Brasil and Denmark with talks ranging from Biopython,  Machine Learning to Web applications with Django framework and Tastypie.

raul_garreta
Raul (Tryolabs, Uruguay) speaking about Machine Learning.

erico_andrei
Erico Andrei (Plone Foundation, Brazil) speaking about open source and Python community in Brazil.

andrea_gavana
Andrea Gavana (Maersk Oil, Denmark) speaking about Python applications in the oil industry ...

Read more


Uploading images to our django application can be as easy as adding an ImageField to our model. However, ImageField falls short in one key aspect, thumbnails. Usually when uploading images, we want to create smaller versions for them, for using in for example, galleries or previews. This however, has to be done manually using the appropriate imaging libraries available.

Enter django-thumbnail-works:

The django-thumbnail-works package can solve this for us by providing the EnahncedImageField class. We can easily replace all of the ImageFields in our models with EnhancedImageFields (which actually subclasses Django’s ImageField), and pass the additional arguments that describe ...

Read more


Free tools are great, but the world ain't all sunshine and rainbows. Sometimes, we may need to connect to a Microsoft SQL Server database from one of our Python applications running under Linux. Fortunately, there are ways to achieve this.

I am assuming we got this:

  • • A Microsoft SQL Server installation running under Windows. I tested this using Microsoft SQL Server 2008 R2 Express, but hopefully this will work with other versions as well.
  • Ubuntu Linux. I am using 12.04 LTS.

Without further ado, here are the steps you should follow to get this working.

1. SQL Server ...

Read more


A while back I had a Django application in which I needed registered users able to view, create, update and delete objects in my system. These objects were instances of only a subset of all the Django models.Model subclasses I had defined in the models.py file of my application.

You may find this problem very similar to what the Django Admin site solves for administrators: you register some models that are displayed, and then the admins can create/update/delete the objects in the system as needed. Cool, lets use the Django admin! We should only call admin ...

Read more


Recently we implemented a "Forgot your password?" feature in one of our django sites and wanted to protect the mechanism so our users wouldn't get spammy messages from our servers. As much as we may hate it, forms in our sites usually act as spambots magnets. We need some kind of protection and CAPTCHAs usually do a good job.

There are cool tutorials like this one that can help you integrate django-auth views for password reset in your site. In his post we discuss how to add CAPTCHA protection to this mechanism. Our service of choice is reCAPTCHA because ...

Read more


Recently we had to add support for social networks login to an application we are developing and we chose django-social-auth to work with. It is a well documented and easy to use django application for authentication.

But we wanted to do more than just authenticating the user, we wanted to get extra data like the profile picture, gender, etc. Fortunately django-social-auth has an useful pipeline that you can expand to fulfill this kind of tasks. I will explain briefly how to achieve this. I will assume you already have authentication working which is very well explained in the documentation.

First ...

Read more


Zen Monk

While I was playing today with Django, I've found that the Zen of Django and Python itself lies into its code. Try this at your python console:

>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to ...

Read more