choose your language english spanish

Here it is the new thecodefarm site!

It's a year since we published our "Web under construction" splash. As it is said shoemaker’s son always goes barefoot, that's what has happened to us, it's being a while but it here it is at last!

As you can see, we have integrated the web and the blog in the same site, so now you'll be able to know the latest news on the farm and you know better the team and the services we are working on.

For those who don't know us, thecodefarm is formed by four young entrepeneurs who are passionated by web development and all related staff. Here we leave you a photo so you can recognize us ;)

team

We seized the opportunity to create a blog manager, so we can generate as many blogs as we need for the services we offer by using the same system. We seized the smallest opportunity to learn and improve on what we do. We hope you like it.

This year gonna be a year full of news for thecodefarm, so keep in the loop!

We want to thank you all your interest in our project and the support we have received. Soon you'll discover the new services we have been working on, we hope you're soon enjoying them ;)

We are waiting for you at thecodefarm!

» continue reading

Translating in Django (Internationalization)

In such a a competitive market like the Internet, it's almost essential the fact of offering our products in the user's own language.

Translation process can result extremly boring, but thanks to Django and its support for i18n, this task is much more comfortable.

First of all, we need to install in our system gettext library, needed to compile the files with the translation strings.

We just have to download,

curl -O ftp://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz

Unzip it, and follow the usual steps:

./configure
make
sudo make install

While we are developing our application, we must import gettext (from django own utils).

from django.utils.translation import ugettext as _

We only have to invoke the function (in this case by using _) to tell django we want to translate that text string.

value = _(u'Text for translation')

send_message(user, _('text I want to send'))

If we have to deal with dynamic content, it's much more interesting to use the lazy version of ugettext (ugettext_lazy). That's because the translation is made when the value is accessed with this, instead of translating when the function is called. This will let us, for example, dynamically load translations in a form's ChoiceField

from django.utils.translation import ugettext_lazy as _

If our intention is translating text from the templates, we have to load the translation tags, by including this at the begining of the file:

{% load i18n %}

Hereupon, we only ...

» continue reading

Django Context Processors

Introduction

By using CONTEXT_PROCESSORS everytime we process a view, we'll include by default some specific vars to that template without reapeating it again and again.

By using the default context processors will achieve the following:

  • Avoid feeding on each view the same variables with the same code, getting rid of possible mistakes.
  • Getviews with less responsabilities.
  • DRY(Do not repeat yourself).

How?

We have to create a function called render_response. This function is in charge of doing the dirty work required and gather the context of our project with all the variables we need in each view.

We will create (as an example)util.py fileinto the our project's root. Inside the file we will include the following function:

def render_response (req, * args, ** kwargs):
    kwargs [ 'context_instance'] = RequestContext (req)
    return render_to_response (* args, ** kwargs) n 10;
)

Obviously we need to import:

from django.shortcuts import render_to_response
from django.template import RequestContext

Now we need to create a new function that will include new information to the context, named informacion_utilwill simply include a greeting.

def informacion_util (request):
    return ( "greeting": "Hello from the context!")

The idea is to make this function as complex as we need, this is only an example.

Finally we must add our new function to be executed each time the project's context is required. To do this, in the file settings.pywe need to add a new line.

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.auth"
    "django.core.context_processors.i18n"
    "django.core.context_processors.media"
    "proyecto.util ...

» continue reading

SASS with Compass, a new way to understand CSS

SASS, a new way to work with CSS. To those who are used to program with high level languages it will be closer and more versatile than traditional CSS. Its basic lure resides in its simplicity and the legibility of the code that we create.

Compass is the tool that will give us the way to create our CSS based in the SASS archives we generate in a transparent way.

What is SASS?

SASS is a meta-language that offers us a way to describe our documents' styles clear and structured way. Then this meta-language is interpreted and a valid CSS is created with de values declared in our SASS archives.

First of all, we are going to become familiar with SASS' syntax.

    #container
        width: 1000px
        height: 100%

     #header
        width: 100%
        height: 50px
        color: #171717

As you can see in the previous example, there are not selector's closing characters, there are not sentence's end characters either. This language is based in code tabulation like Python and some other languages. It interprets the sentences' end when a linebreaks is done and the inheritance based in tabulation. The CSS that results from the previous example would be the following one.

    #container { width: 1000px; height: 100%; }

    #container #header { width:100%; height:50px; color:#171717; }

Why use SASS?

There are clearly two reasons why we should start using SASS. On one hand it's the better legibility. Our code will be more legible than CSS documents, inheritance and hierarchy are clear and you ...

» continue reading

48 hour callenge

All thecodefarm staff will spend 48h in order to design, write and promote a web app. Asier, Jorge, Imanol and Nerea, are going to take care about all the details for creating a full functional web application.

For this event we have invited another developer, Jaime, who is member of a new startup based in eLearning.

This challenge will take place from 3rd of April at 17:00 GMT to 5th at the same hour. The web app will be developed using python and the Django framework. Also we have planed to use some external services as twitter or facebook connect.

What is all this about?

What have we done in the 48h challenge?

We’ve been working hard in the following app. Here it’s Going Todo web app DEMO.

It was a great and tiring weekend, two days working hard to make a web app, less than 48h of development invested, a lot of fun! From now on we will work in making new features for this web app in order to launch it as soon as possible.

In the following video you can see us working in Going Todo during the 48h challenge. Thank you all for your interest in our personal challenge! ;)

» continue reading

DkpBoard finally online!

dkpboard

After fixing some technical issues, DkpBoard is now online!

We are still in beta version so if you detect any bug you can contact us (Report Bug link). Please, take a time signing up and start enjoying Dkpboard’s features, including:

  • Guild Raiding Stats
  • Custom Dkp Boards
  • Raider’s custom profile
  • Raids Summary
  • Recruitment System
  • User-friendly Admin Control Panel

And remember, it’s totally free :D

P.S.: For further information about this project, please visit our dkpboard official blog: http://blog.dkpboard.com/

» continue reading