Archive for September, 2008
TCL Substring, How do you do it?
At first I was a bit confused on how to achieve a substring in TCL. Its not very clear and its not well documented, but in the end I found it.
Here is it:
set string "This is an example string"
putserv "PRIVMSG #channel :Example: [string range $string 0 4]"
# This would message #channel with "Example: This"
# Remember: [...]
Connecting to MySQL using TCL
So, lately i’ve been playing around with tcl again, and trying to make it work alongside MySQL to store information such as Q auth’s and various other information on users. Its working quite well.
We connect to MySQL through TCL using a package called mysqltcl.
Here is how I connect:
# First we require the mysqltcl package. You [...]
Convert time (hr:min:secs) into seconds
I wrote this snippet to convert ffmpeg’s information output time into seconds, i can then determine the 25, 50 and 75 percentages to create 3 different thumbnails of a movie (using ffmpeg also).
Heres the snippet:
function time2seconds($time=’00:00:00′){
list($hr,$m,$s) = explode(’:', $time);
return ( (int)$hr*3600 ) + ( (int)$m*60 ) + (int)$s;
}
Hope you find this [...]
