var call_user_func = function(obj, method) { return eval(’obj.’ + method).apply(obj, Array.prototype.slice.call(arguments, 2)); } var test1 = { method1: function(arg1, arg2, arg3) { return alert(arg1 + arg2 + arg3); } } call_user_func(test1, ‘method1′, 1, 2, 3); It works on Firefox3, Safari4, IE6.
Category Archives: Tweak
tpcc-mysql rough benchmark for Amazon RDS
I tried to do tpcc-mysql benchmark for Amazon RDS. Before do that, did the same test for EC2 small instance. From EC2 small instance to small. Fedora8 and MySQL 5.0.45. Default configuration. (no change for a my.cnf; innodb_buffer_pool_size = 8388608) # mysql -h domU-12-31-39-06-7C-86.compute-1.internal -u mymasteruser -p mysql> grant all privileges on tpcc.* to tpcc@’%’ [...]
Amazon RDS quick start
I’ve tried to use Amazon Relational Database Service. Easy to scale-up appeals to me. Official Getting Started Guide is very good. I almost followed this document. Works on Mac OSX 10.5.8. % rds-create-db-instance –db-instance-identifier myinstance –allocated-storage 5 –db-instance-class db.m1.small –engine MySQL5.1 –master-username mymasteruser –master-user-password **** –db-name MyDatabase –headers It takes several minutes. % rds-describe-db-instances –headers [...]
rackspacecloud.com’s Cloud Files network benchmark
I got a rough benchmark. Main purpose is to know how Cloud Files(rackspacecloud.com) is fast from Tokyo, Japan. Also I compared the speed with Amazon EC2/CloudFront and Sakura Internet 7,800yen dedicated hosting service. % ab -n 50 -c 5 http://server/image-file(jpg/png/gif) Transfer rate (Kbytes/sec): 1527 (www.google.com) 1245 (s3.amazonaws.com) 3796 (cloudfront.net) 45 (sakura internet 7800yen server) 2135 [...]
Using MAMP is better than source compile PHP on Mac OS 10.5.8
PHP5.2.10 couldn’t be compiled on Mac OS 10.5.8. % ./configure –with-readline –with-mysql –with-pdo-mysql –enable-mbstring –with-openssl –with-curl –with-apxs2=/usr/local/apache2/bin/apxs % make Undefined symbols: “_EVP_CIPHER_CTX_block_size”, referenced from: _zif_openssl_seal in openssl.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [libs/libphp5.bundle] Error 1 I tried to compile openssl0.9.8j, then set –with-openssl=/usr/local/ssl, but the same error occurred. [...]
screencapture doesn’t work on GNU screen
While using screen screencapture command doesn’t work well. It creates only a black image file. % screen % screencapture ~/Desktop/desktop.png // it doesn’t work % exit % screencapture ~/Desktop/desktop.png // it works! Mac OS 10.5.7
SweetCatcher (old name: Skype4Sweet) First Release
Oops, I needed to change the name: SweetCatcher According to Skype API Terms of Use (http://www.skype.com/legal/terms/api/) ยง 4.1 using the word “Skype” in product’s name is not allowed. The following names would be OK: “works with Skype” “uses Skype Software” or “uses Skype” “for Skype Software” or “for Skype”
Back up Gmail Starred with fetchmail and procmail
% fetchmail –all –proto IMAP –port 993 –user *your gmail account name* –ssl –folder ‘[Gmail]/Starred’ –mda “/usr/bin/procmail -d %T” –keep imap.gmail.com You can get mails at /var/mail/*your mac account name*. On Mac OSX 10.5.5.
Additional information: How to build a Firefox extension
Mozilla pins (wallpaper) on Flickr – Photo Sharing! This entry inspired me. How to build a Firefox extension (lifehacker.com) I use Mac OSX 10.5 and Firefox 3.0.5. Set up your development environment ref: https://developer.mozilla.org/en/Setting_up_extension_development_environment Small script for starting firefox. % cat ~/bin/firefox-debug.sh #!/bin/sh /Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev I created a new profile “dev” for development. [...]