Welcome to Fer programes, a blog created with the intention to help us and other programmers in the developing of IT applications. It includes some commands used previously to solve specific problems, links to interesting web pages and general explanations about informatic topics. You are free to collaborate with comments when you consider it is oportune.
Friday, December 23, 2011
Sunday, December 4, 2011
Django - Using the admin date picker in our custom forms
I followed the instructions in this link and it worked perfectly:
http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form
Also this link is useful:
http://stackoverflow.com/questions/660898/django-using-admin-datepicker
http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form
Also this link is useful:
http://stackoverflow.com/questions/660898/django-using-admin-datepicker
Saturday, December 3, 2011
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.
http://eomblog.blogspot.com/2011/11/57-estupendas-chuleta-cheat-sheets.html
The full blog is interesting, so we add the url of it.
http://eomblog.blogspot.com/
Thank you to the author for sharing all this information!
http://eomblog.blogspot.com/2011/11/57-estupendas-chuleta-cheat-sheets.html
The full blog is interesting, so we add the url of it.
http://eomblog.blogspot.com/
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:
return {'additional_values': ['a','b','c']}
...
"path_to_context_processor_function.context_processor_function",)
http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/
https://docs.djangoproject.com/en/1.1/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORS
http://stackoverflow.com/questions/335231/in-django-is-it-possible-to-access-the-current-user-session-from-within-a-custo
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:
return {'additional_values': ['a','b','c']}
- Load the function inside the TEMPLATE_CONTEXT_PROCESSORS variable of the setting.py:
...
"path_to_context_processor_function.context_processor_function",)
- Use the variables inside the templates like any other variables of the dictionary
http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/
https://docs.djangoproject.com/en/1.1/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORS
http://stackoverflow.com/questions/335231/in-django-is-it-possible-to-access-the-current-user-session-from-within-a-custo
Wednesday, November 9, 2011
Terms of use and similar
In this link we can find models of the terms of use, terms of privacy, etc:
http://www.inteco.es/Seguridad/Observatorio/area_juridica_seguridad/Modelos_de_Contratos_Tecnologicos/ctto_politica_privacidad_es
http://www.inteco.es/Seguridad/Observatorio/area_juridica_seguridad/Modelos_de_Contratos_Tecnologicos/ctto_politica_privacidad_es
Monday, October 24, 2011
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
http://stackoverflow.com/questions/417703/python-c-like-stream-input
In this link there are similar ways to do the same with Python
http://stackoverflow.com/questions/417703/python-c-like-stream-input
Wednesday, September 28, 2011
Friday, September 23, 2011
Access array elements in a Django template
http://stackoverflow.com/questions/1700661/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, foo.bar can mean any of:
foo[bar] # dictionary lookup
foo.bar # attribute lookup
foo.bar() # method call
foo[bar] # list-index lookup
Remember that the dot notation in a Django template is used for four different notations in Python. In a template, foo.bar can mean any of:
foo[bar] # dictionary lookup
foo.bar # attribute lookup
foo.bar() # method call
foo[bar] # list-index lookup
Monday, September 12, 2011
Saturday, September 3, 2011
Thursday, July 14, 2011
Tuesday, June 7, 2011
Saturday, June 4, 2011
Latex - How to change text properties of captions
There is related information here:
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Caption_Styles
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Caption_Styles
Monday, April 25, 2011
How to send an email with an attachment with Python
In this page there is a fantastic solution:
http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
Thursday, March 31, 2011
Gnuplot: save plot in jpeg
This are some useful commands:
set terminal jpeg
set output "fig.jpeg"
replot
set terminal x11
set terminal jpeg
set output "fig.jpeg"
replot
set terminal x11
Friday, March 25, 2011
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
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
Subscribe to:
Posts (Atom)