2009年6月17日

Pecl hash インストール

phpize インストール

% yum -y install php-devel

PECL::Package::hashのダウンロード

http://pecl.php.net/package/hash

PECL::Package::hashのインストール

$ tar zxvf hash-1.5.tgz
$ cd hash-1.5
$ phpize
$ ./configure
$ make
# make install

php.ini の設定追加

extension=hash.so

httpd再起動

 

 

2009年6月15日

smarty日本語modifier.truncate.php

modifier.mb_truncate.php をプラグインフォルダに追加

<?php
function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...') {
    if ($length == 0) {return '';}

    if (mb_strlen($string) > $length) {
        return mb_substr($string, 0, $length).$etc;
    } else {
        return $string;
    }
}
?>

 

★文字コード指定

function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...', $encoding = '') {
if ($length == 0) {return '';}

if (mb_strlen($string,$encoding) > $length) {
return mb_substr($string, 0, $length,$encoding).$etc;
} else {
return $string;
}
}

テンプレート側
{$datum.title|mb_truncate:24:'...':'utf8'}

http://c-brains.jp/blog/wsg/07/06/14-160910.php

2009年4月28日

This PHP CGI binary was compiled with force-cgi-redirect enabled

php.ini

cgi.force_redirect = 0 にする

<p>This PHP CGI binary was compiled with force-cgi-redirect enabled.  This
means that a page will only be served up if the REDIRECT_STATUS CGI variable is
set, e.g. via an Apache Action directive.</p>
<p>For more information as to <i>why</i> this behaviour exists, see the <a href="http://php.net/security.cgi-bin">manual page for CGI security</a>.</p>
<p>For more information about changing this behaviour or re-enabling this webserver,
consult the installation file that came with this distribution, or visit
<a href="http://php.net/install.windows">the manual page</a>.</p>

 

 

2009年4月 2日

access フォーム レコード確定

        Me.Repaint
        DoEvents

2009年3月27日

Access VBA URLエンコード

'==================================================
'UrlEncodeUtf8: 文字列をUTF-8でエンコードするFunction
'==================================================
'strSource: 元の文字列
'返り値: エンコードされた文字列
'==================================================
Public Function UrlEncodeUtf8(ByRef strSource As String) As String
Dim objSC As Object
Set objSC = CreateObject("ScriptControl")
objSC.Language = "Jscript"
UrlEncodeUtf8 = objSC.CodeObject.encodeURIComponent(strSource)
Set objSC = Nothing
End Function

'==================================================
'UrlDecodeUtf8: 文字列をUTF-8でデコードするFunction
'==================================================
'strSource: 元の文字列
'返り値: エンコードされた文字列
'==================================================
Public Function URLDecodeUTF8(strSource As String) As String
Dim objSC As Object
Set objSC = CreateObject("ScriptControl")
objSC.Language = "Jscript"
URLDecodeUTF8 = objSC.CodeObject.decodeURIComponent(strSource)
Set objSC = Nothing
End Function

参照元

http://komet163.blog36.fc2.com/blog-entry-18.html

2009年3月12日

CPAN

Perlのモジュールをインストールしよう

http://y-kit.jp/saba/xp/cpan.htm

Readonly

wget ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/perl-Readonly-1.03-6.el5.kb.noarch.rpm

wget ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/perl-Readonly-XS-1.04-7.el5.kb.i386.rpm

 

rpm -Uvh perl-Readonly-XS-1.04-7.el5.kb.i386.rpm perl-Readonly-1.03-6.el5.kb.noarch.rpm

2009年3月11日

Centos5.2 php5.2インストール

古いPHPを削除

# yum list installed | grep php
# yum remove php
# yum remove php-common
# yum remove curl


GPG keyの取得

# rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

取得先を設定

# vi /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

PHPをインストール

# yum -y install php
# yum -y install php-mbstring php-mysql php-mcrypt

リポジトリを無効にする
yum updateでPHP以外のものも取得してしまうため。

# vi /etc/yum.repos.d/utterramblings.repo
enabled=1

enabled=0


 

2009年3月10日

mysql my.cnf utf8

/etc/my.cnf に、

default-character-set=utf8
skip-character-set-client-handshake
を書いておくとutf8を使う限り文字化けは怒らないはず。

default-character-set=utf8
はそのまんまだけれど、
skip-character-set-client-handshake
っていうのは、クライアント側が何でリクエストしてこようが、強制的に、こちらのdefault-character-setになっている文字コードで返すという設定。
/etc/my.cnf に、

default-character-set=utf8
skip-character-set-client-handshake
を書いておくとutf8を使う限り文字化けは怒らないはず。

default-character-set=utf8
はそのまんまだけれど、
skip-character-set-client-handshake
っていうのは、クライアント側が何でリクエストしてこようが、強制的に、こちらのdefault-character-setになっている文字コードで返すという設定。

2009年3月 3日

Hyper Estraierのインストール

Hyper Estraierのインストール

参考サイト

http://www.crimson-snow.net/hmsvr/centos/memo/hyperestraier.html

# mkdir /usr/local/src/hyperestraier <= 作業用ディレクトリの作成
# chmod 777 /usr/local/src/hyperestraier <= 作業用ディレクトリのパーミッション変更
# exit <= 一般ユーザになる
$ cd /usr/local/src/hyperestraier <= 作業用ディレクトリへ移動
[hyperestraier]$ wget http://hyperestraier.sourceforge.net/hyperestraier-1.4.13.tar.gz
 <= 「Hyper Estraier」のソースをダウンロード
[hyperestraier]$ tar xzf hyperestraier-1.4.13.tar.gz <= ダウンロードしたファイルの展開
[hyperestraier]$ cd hyperestraier-1.4.13 <= 展開したディレクトリに移動
[hyperestraier-1.4.13]$ ./configure | tee configure.log 2>&1
[hyperestraier-1.4.13]$ make | tee make.log 2>&1 <= コンパイル
[hyperestraier-1.4.13]$ su <= スーパーユーザになる
Password: <= パスワードの入力
[hyperestraier-1.4.13]# make install | tee make-install.log 2>&1 <= インストール


 

Archives