Skip to main content

Posts

Showing posts from July, 2011

Several solutions for a few mysql errors

1062 Duplicate entry 'xxxx' for key xxxx. The key is already in current mysql. In mysql slave server, try "STOP SLAVE;SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;START SLAVE;". You may also set slave_skip_errors = 1062 in my.cnf file to ignore all the 1062 errors. 1236  Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' The binlog position in master mysql server is not available. Some problem of master mysql server may cause this issue. You may want change the mysql replication position to next binary log file on the master mysql server(using "change master to ..."). 126 Error 'Incorrect key file for table './db/xxx.MYI'; try to repair it' on query. The error means that index file is crashed, and you may repair it by "repair table xxx". Or you want to change mysql storage to another hard disk since the error my be induced by an disk

One thing about python default parameter list

Python interpreter stores the default parameter list in a dict named func_defaults meeting a "def func(a=0, b=[], c={})" statement. So there is func.func_defaults = [0, [], {}]. When we specify an object in default parameter list of a function, python interpreter will keep its reference in the list. Therefore, an object as a default parameter of a function may change if you change it. For example: def func(a = []):     a.append(0)     print a When call the function in a python IDLE, we may have: >>> func()   [0]   >>> func()   [0, 0]   >>> func()  [0, 0, 0]   >>> func([1])   [1, 0]   >>> func()  [0, 0, 0, 0] You may find some detail example at http://effbot.org/zone/default-values.htm