Saturday, December 3, 2011

Front end automation + tricks + tools in Django

Very interesting presentation:

More than 50 cheat sheets for web projects and other programming languages

In this page we can find a fantastic recopilation of cheat sheets for distinct programming languages and web specifications.

The full blog is interesting, so we add the url of it.

Thank you to the author for sharing all this information!

Friday, November 11, 2011

Django - Context Processors

In some occasions we may need information available to each template, like the user properties, the session settings, or an special variable.

What we could do is to add all this information to the response dictionary. However, it would contradict the DRY principle of Django.

A good approach is to use a customized Context Processor, which will add to the dictionary the returned variables of the function.

Specifically, the modifications we must do can be the following:

  • Define the Context Processor function, like for example:
def context_processor_function(request):
return {'additional_values': ['a','b','c']}

  • Load the function inside the TEMPLATE_CONTEXT_PROCESSORS variable of the
TEMPLATE_CONTEXT_PROCESSORS = ("django.core.context_processors.auth",
  • Use the variables inside the templates like any other variables of the dictionary
For more complete information, this links are useful:

Saturday, October 1, 2011

Python - C++ like stream input

One of the things in which C++ is better than Python is in the stream input, using the fantastic cin option.

In this link there are similar ways to do the same with Python

Friday, September 23, 2011

Iterating through two lists in a Django template

Access array elements in a Django template

Remember that the dot notation in a Django template is used for four different notations in Python. In a template, can mean any of:

foo[bar] # dictionary lookup # attribute lookup # method call
foo[bar] # list-index lookup

Thursday, July 14, 2011

How to execute Python scripts from the console

>>> execfile("")

Saturday, June 4, 2011

Latex - How to change text properties of captions

There is related information here:,_Figures_and_Captions#Caption_Styles

Thursday, March 31, 2011

Gnuplot: save plot in jpeg

This are some useful commands:

set terminal jpeg

set output "fig.jpeg"


set terminal x11

Friday, March 25, 2011

Log scale in gnuplot plots

The corresponding command is:

set log xy

Monday, January 17, 2011

Very important commands in Gnuplot

Plot two or more plots in the same window:

set multiplot

Plots with lines:

plot "file.dat" w l

Plot with yerrorbars. The third column of the input data is the lenght of the errorbar:

plot "file.dat" with errorbars

Hide the legend:

unset key