Tuesday, March 22, 2011

Mysql tips

Reference: http://souptonuts.sourceforge.net/readme_mysql.htm

  Clean up binary log files.  For a default install they may be in

/usr/local/var/
or
/var/lib/mysql/

with names ending in -bin.000001,-bin.000002,.. The following
command may help find out where the logs are located.

mysql> show variables like '%home%';
+---------------------------+-----------------+
| Variable_name | Value |
+---------------------------+-----------------+
| bdb_home | /var/lib/mysql/ |
| innodb_data_home_dir | |
| innodb_log_group_home_dir | ./ |
+---------------------------+-----------------+


mysql> reset master;
reset master;
Query OK, 0 rows affected (0.02 sec)

See (Tip 24:) details working with binary log files and (Tip 25:) explains
how to setup logging. (Tip 37:) shows have to setup MASTER and SLAVE
replication.

Why not SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2 ?

If you decide that you can skip the next statement from the master, issue the following statements: 
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = n; 
mysql> START SLAVE;
The value of n should be 1 if the next statement from the master does not use AUTO_INCREMENT or LAST_INSERT_ID(). Otherwise, the value should be 2. The reason for using a value of 2 for statements that use AUTO_INCREMENT or LAST_INSERT_ID() is that they take two events in the binary log of the master.
Reference: http://lists.mysql.com/mysql/204875

Wednesday, March 2, 2011

Subshell vs Command Block

First, code inside a nested subshell obeys the above rules of subshell inheritance, except that it knows about variables defined in the surrounding shell; in contrast, think of blocks as code units that inherit everything from the outer shell. Second, variables and traps defined inside a command block are known to the shell code after the block, whereas those defined in a subshell are not.
1. Subshell

If you run this code, you will see the message $hatter  is mad every 60 seconds, and if you hit CTRL-C, you will see the message,  You hit CTRL-C!. You will need to hit CTRL-Z to  stop it (don't forget to kill it with kill %+).
2.  Command Block


If you run this, you will see the message $hatter is; the outer shell doesn't know about the subshell's definition of hatter and therefore thinks it's null. Furthermore, the outer shell doesn't know about the subshell's trap of the INT signal, so if you hit CTRL-C, the script will terminate.




Tuesday, March 1, 2011

Grails + IntelliJ

- 'grails integrate-with --intellij' creates IDEA 8.x project files
- IDEA 9 and 10 will present you with a dialog to upgrade the project files
- Ultimate Edition of IDEA 9 and 10 has built in Grails support. Project files is created by 'File --> New Project... --> Import Grails application from existing sources'. This is what the documentation should recommend IMO, rather than 'grails integrate-with --intellij'.

Saturday, February 19, 2011

System CMOS checksum bad

I got this error message every time I try to boot up my Thinkpad T43, I guess I need a new backup battery for my aged laptop and the links below provides a very clear instructions for me to follow.

http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-52603
http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-52604

This is where I can buy the backup battery from:
http://www.machinaelectronics.com/store/buypart/IBM_Thinkpad_T43/02K6541

Friday, February 18, 2011

How to setup GitHub on Ubuntu 10.10 ?



The following keygen step is very important but not mentioned in the GitHub web sites ...

7. Generating SSH keys(Github needs it):
In the terminal type
>ssh-keygen -t rsa -C "xxxx@yzmail.com"
and just press enter for the next 3 statements.
Now execute the following commands :
ravi@Hackintosh:~$ cd .ssh
ravi@Hackintosh:~/.ssh$ gedit id_rsa.pub
The file will be opened in gedit just COPY all the contents and close it and paste the contents in temporary document for later use.( For more info :http://help.github.com/linux-key-setup/)