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.
Wednesday, February 29, 2012
Wednesday, February 15, 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
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.
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.
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 likeCYGWIN=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 towindows/system32
directory. - Run
install.packages('RMySQL',type='source')
and wait while compilation will end.
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;
Subscribe to:
Posts (Atom)