jQuery empty(),remove() and Thickbox

I am a great fan of thickbox and I have used it for a long time. Recently I came across a situation where trying to close a modal that had a table with around 7000 rows (each 8 columns) crashed the tab in Chrome and took a very long time in Firefox.

I went through the thickbox forum and discovered that other people have had similar issues and they were related to the tb_remove() function. I did my own profiling and came to the same conclusion.Of particular interest was this statement:


I looked at the documentation and then read through the comments where someone mentioned that remove() can be quite expensive due to stuff that it does and he suggested to use empty() before remove(). Voila, it worked! So for anyone else facing the same issue with thickbox, change the statement above to:


and see if that works for you.

Unix find, xargs and basename.

Xargs is great. If you want to know why use xargs over exec, have a read of this: xargs versus exec.

But, there is one problem. If the command that you are trying to execute on the results from find cannot take more than one file as param (basename for e.g, can take only one file), then use the -n 1 param with xargs (to process one file at a time) . In that case, xargs is probably going to be as quick as using exec.

find . -name "*.rar" | xargs -n 1 unrar e
find . -name "*.rar" | xargs -n 1 basename

And this will get the basename without using the basename function (I go it from this page).

find . -name "*.rar" -printf "%fn"

Munin: Could not open required defaults file: /root/.my.cnf

For some reason I kept getting this error (even when the file was readable by all) in one of the munin (mysql slave) plugins that I had written.

So this was the solution that worked for me;

under the [mysql*] section in /etc/munin/plugin-conf.d/munin-node 
I added this: 
env.mysqlopts -u{user} -p{password}

and in my plugin

I did something like this:

mysql ${mysqlopts} -e'show slave status G'

and that seemed to have picked up the user and password from env.mysqlopts and the plugin started working (ofcourse after I restarted munin).