Monday, December 24, 2012

Install and configure Trac in alwaysdata.com web site

I followed this steps to install Trac in the alwaysdata.com web site:

The main manual is from this page:

http://forum.alwaysdata.com/viewtopic.php?pid=3218#p3218

PYTHONPATH=~/modules easy_install-2.5 --install-dir ~/modules Genshi==0.6
PYTHONPATH=~/modules easy_install-2.5 --install-dir ~/modules Trac==1.0
./trac-admin /home//www/trac/myproject initenv
./trac-admin /home//www/trac/myproject deploy /tmp/deploy 
mv /tmp/deploy/* /home//www/trac
 
Section 5: Small modification
#!/usr/bin/eval PYTHONPATH=/home//modules TRAC_ENV=/home//www/trac/myproject python

Section 6: Small modification
AddHandler fcgid-script .fcgi

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/trac.fcgi/$1 [QSA,L] 

I also had to solve some issues reported here:
http://forum.alwaysdata.com/viewtopic.php?id=1601

To configure Trac authentication (Trac works with apache authentication) I followed:
http://trac.edgewall.org/wiki/TracModWSGI#ConfiguringAuthentication

$ htpasswd -c /somewhere/trac.htpasswd admin
New password: 
Re-type new password: 
Adding password for user admin


$ htpasswd /somewhere/trac.htpasswd john
New password: 
Re-type new password: 
Adding password for user john

The final .htaccess file is the following:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/trac.fcgi/$1 [QSA,L]

    AuthType Basic
    AuthName "trac"
    AuthUserFile /home//www/trac/trac.htpasswd
    Require valid-user

Sunday, November 25, 2012

Accents in javascripts

In the following link, we can see the codes we have to use to put accents and special characters in javascripts:

http://www.pjb.com.au/comp/diacritics.html

It is extremely easy and useful.

Friday, October 12, 2012

Map-Reduce implementation in Python

Recently I discovered a Python implementation of the Map-Reduce framework.
It is mincemeat.py, and can be found here: https://github.com/michaelfairley/mincemeatpy
The advantage is that it is an only-file implementation and it is quite efficient.
There is an example attached with the downloaded file.
To run it, you need just to execute example.py, which will perform the server tasks.
For each client, just run mincemeat.py specifying the server port (127.0.0.1 by default).

Other implementations of the Map-Reduce pattern in python are:

octopy
hadoopy
dino
mrjob

Sunday, September 30, 2012

Django - User authentication with django-registration

http://stackoverflow.com/questions/6127264/newbie-django-error-templatedoesnotexist-at-accounts-login

https://bitbucket.org/devdoodles/registration_templates/src

Friday, September 28, 2012

NoSQL and MapReduce

NoSQL is a wide variety of database systems that differ of the classical RDBMS based on SQL.

MapReduce is a framework that provides high performance in solving problems in a parallel way of computers, servers, clusters...

Here there is an interesting presentation about NoSQL and MapReduce: http://www.slideshare.net/j_singh/nosql-and-mapreduce

And here a popular NoSQL Databases web page: http://nosql-database.org/

The CAP theorem says that, for a distributed system, it is impossible to simultaneously provide the following guarantees:
  • Consistency
  • Availability
  • Partition tolerance

Sunday, August 5, 2012

Agile methodologies and Rails

I have found a very interesting online course called Software as a Service in which you are introduced to agile methodologies and Rails programming.

It can be followed here: https://www.coursera.org/courses

Here there is information about the course book and other important information (the assignments are thought to be done working in a virtual machine, which is available there also): http://beta.saasbook.info/bookware-vm-instructions

Thursday, June 14, 2012

What is big data?

The best definition I've found in the net:

Big Data is a term used to describe large collections of data (also known as datasets) that may be unstructured, and grow so large and quickly that it is difficult to manage with regular database or statistics tools.

Tuesday, June 5, 2012

Saturday, February 11, 2012

How to redirect output to screen and a file

With the command tee (in Linux) or the command wtee (in Windows)

Example (in Linux)

ls | tee output.txt

Example (in Windows)

dir | wtee > output.txt

Wednesday, February 8, 2012

RMySQL - How to connect R with MySQL in Windows

Following the instructions of http://stackoverflow.com/questions/4785933/adding-rmysql-package-to-r-fails

Important note 1: The installation works when using MySQL for 32bit computers and R for 32bit computers. I have tried to install it to the 64bit version of R but I did not succeed.
  • Install RTools
  • Install MySQL or header and library files of mysql
  • Create or edit file C:\Program Files\R\R-2.12.1\etc\Renviron.site and add two lines like CYGWIN=nodosfilewarning
    MYSQL_HOME=C:/ARCHIV~1/MYSQL/MYSQLS~1.5
  • Copy libmysql.lib from mysql/lib to mysql/lib/opt to meet dependencies.
  • Copy libmysql.dll to C:\Program Files\R\R-2.12.1\bin or to windows/system32 directory.
  • Run install.packages('RMySQL',type='source') and wait while compilation will end.
Important note 2: My computer contains Spanish language Windows, and I had several problems with the accent in the folder named "Configuración local", where the downloaded packages are stored and compiled.
I solved the problem in the following way. I changed the environment variable TMP to another local folder without containing any accent.
After the installation I rolled back the change in the environment variable.

Sunday, February 5, 2012

MySQL - Get row number on select

http://stackoverflow.com/questions/2520357/mysql-get-row-number-on-select

SET @rank=0;
SELECT @rank:=@rank+1 AS rank, itemID, COUNT(*) as ordercount
FROM orders
GROUP BY itemID
ORDER BY ordercount DESC;

Monday, January 2, 2012

Python - How can I iterate through two lines?

You want the zip function.

a = [1,2,3]
b = ['a','b','c']
for
(n,l) in zip(a, b):
print "num: ", n ,"; let: ", l



num: 1 ; let: a
num: 2 ; let: b
num: 3 ; let: c