Untitled

May 24

xhprof gui

$ cd /usr/local/src
$ wget http://pecl.php.net/get/xhprof-0.9.2.tgz
$ tar xvzf xhprof-0.9.2.tgz
$ cd xhprof-0.9.2/extension/
$ phpize
$ ./configure
$ make
$ sudo make install
$ vi /etc/php5/apache2/conf.d/xhprof.ini
-----
extension=xhprof.so
-----
$ sudo /etc/init.d/apache2 restart

$ sudo aptitude install graphviz


$ mkdir /var/www/xhgui
$ cd /var/www/xhgui
$ git clone https://github.com/preinheimer/xhprof.git .

$ cp xhprof_lib/config.sample.php xhprof_lib/config.php
-----
// Change these:
$_xhprof['dbhost'] = 'localhost';
$_xhprof['dbuser'] = 'root';
$_xhprof['dbpass'] = 'pass';
$_xhprof['dbname'] = 'xhprof';
$_xhprof['servername'] = 'myserver';
$_xhprof['namespace'] = 'myapp';
$_xhprof['url'] = 'http://172.16.14.134/xhgui'; // プロファイル内容確認画面URL


$_xhprof['dot_binary']  = '/usr/bin/dot';
$_xhprof['dot_tempdir'] = '/tmp';
$_xhprof['dot_errfile'] = '/tmp/xh_dot.err';

$controlIPs[] = "172.16.14.1"; // プロファイル許可IPアドレス
-----

httpd.conf
-----
alias /xhgui /var/www/xhgui/xhprof_html
-----


$ mysql -u root -ppass
mysql> CREATE DATABASE xhprof;

xhprof_lib/utils/xhprof_runs.php
-----
CREATE TABLE `details` (
  `id` char(17) NOT NULL,
  `url` varchar(255) default NULL,
  `c_url` varchar(255) default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `server name` varchar(64) default NULL,
  `perfdata` MEDIUMBLOB,
  `type` tinyint(4) default NULL,
  `cookie` BLOB,
  `post` BLOB,
  `get` BLOB,
  `pmu` int(11) default NULL,
  `wt` int(11) default NULL,
  `cpu` int(11) default NULL,
  `server_id` char(3) NOT NULL default 't11',
  `aggregateCalls_include` varchar(255) DEFAULT NULL,
  PRIMARY KEY  (`id`),
  KEY `url` (`url`),
  KEY `c_url` (`c_url`),
  KEY `cpu` (`cpu`),
  KEY `wt` (`wt`),
  KEY `pmu` (`pmu`),
  KEY `timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-----

※プロファイル開始
http://172.16.14.134/adm/contents/?_profile=1

※プロファイル終了
http://172.16.14.134/adm/contents/?_profile=0

※プロファイル内容確認画面
http://172.16.14.134/xhgui/

Mar 19

doxygen

OUTPUT_LANGUAGE = Japanese
EXTRACT_ALL = YES 
EXTRACT_PRIVATE = YES 
EXTRACT_STATIC = YES 
GENERATE_LATEX = NO
HAVE_DOT = YES 
CALL_GRAPH = YES 
UML_LOOK = YES

Feb 12

oclint-xcode

#!/bin/bash

LANGUAGE=objective-c
ARCH=armv7
#SYSROOT=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
CLANG_INCLUDE=/usr/lib/clang/3.0/include
FRAMEWORKS=''

if [ $# -ne 2 ]; then
  printf "\033[1musage:\033[22m `basename "$0"` /path/to/project MyApp-Prefix.pch \n"
  exit 1
fi

PROJECT_PATH="$1"
PCH_PATH="$2"

INCLUDES=''
for folder in `find "$PROJECT_PATH" -type d`
do
  INCLUDES="$INCLUDES -I $folder"
done

FILES=''
for file in `find "$PROJECT_PATH" -name "*.m"`
do
  FILES="$FILES $file"
done

oclint -x $LANGUAGE -arch $ARCH -isysroot=$SYSROOT -I $CLANG_INCLUDE $INCLUDES -include $PCH_PATH $FILES

Jan 25

xcode のプロジェクト設定で Other Linker Flags を 下記のように書き換えればシミュレータでも正常に動かすことができます。 (実機・シミュレータ確認済み)

修正前: -weak_library /usr/lib/libSystem.B.dylib
修正後: -weak-lSystem /usr/lib/libSystem.B.dylib

Jan 18

UIView debug

- (NSString *)recursiveDescription;
- (NSDictionary *)scriptingInfoWithChildren;
@implementation UIView (Debug)
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    BOOL pointInside = CGRectContainsPoint(self.bounds, point);
    if (pointInside) NSLog(@"%@", self);
    return pointInside;
} 
@end