This blog is my memo for collecting IT stuffs. And some my free softwares.Please use facebook to leave comments.
Get the position of object that you want to move to using offset().top, and change scrollTop of body using animate() function.
var divOffset = $('#hogeContainer').offset().top; $('body').animate({scrollTop: divOffset + 'px'}, 1000);
In order to run Wordpress on my low spec VPS, I needed to find out a way to run it without MySQL so I try to install PDO plug in to Wordpress.
It is very easy step to set up since there is a plug in to make it come true. Personally it is not nice to have MySQL daemon running for just Blog used for personal web page or even corporate site. Besides SQLite is faster.
I personally love Safari in browsers out there. I just wonder what browser people think is the best. Here is the quick research I made using search engines which some may find interesting. The summary of search results by words "browser *** sucks" on both bing and google:
bing browser Chrome sucks 1,130,000 browser IE sucks 10,700,000 browser Firefox sucks 7,140,000 browser Safari sucks 913,000
google browser Chrome sucks 76,500 browser IE sucks 3,410,000 browser Firefox sucks 922,000 browser Safari sucks 973,000
Interesting things is that you can see who lies and tricks in its search engine. I love bing :)
I got DVD with data we shot the other day. This is a memo of how to rip DVD and retrieve data out of computer.
I could not find reasonable free software that I can use easily so I just counted on mplayer as I used to do in Linux.
First, install mplayer by darwin port
$ sudo port install mplayer
Then mencoder. The command:
$ mencoder dvd://1 \ -ss 00:00:03 -endpos 00:00:48 \ -aspect 4:3 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=9800 \ -vf crop=640:480:0:0 -oac mp3lame -lameopts abr:br=96:vol=9 -o mazatlan05-visit.avi;
dvd:// to specify device ID
-ss is to specify starting position for trimming
-endpos to specify ending position. but this really means the position from starting position. so the command means that will trim movie for 48 secs from 00:00:03.
-aspect to specify aspect ratio
lavc is to specify encoding type. adjust your vbitrate considering of file size output
-vf to specify cropping settings if needed. w:h:x:y or something ... probably
mp3lame to specify audio settings. br for bitrate, vol is for volume
-o is to specify output file name
The purpose for using those 2 syntacs is the same, "update a record if the record exist, otherwise insert a record."
But they work slightly in different way.
REPLACE INTO will replace record as it reads. When the PK is used to search record, the record will be simple updated.
But if other unique keys than PK is used, the record will be deleted and insert a new record. It means it will generate new auto number if the key is set to auto_increment.
On the other hand, INSERT ON DUPLICATE KEY UPDATE will simply update all the time.
Both are very useful unless you use them in wrong way.
Javascript doesn't have trim function. but you can use replace() function instead in a way something like this.
target = target.replace(/(^\s+)|(\s+$)/g, "");