用 apache 的 setenv module 在程式中加入判斷 developer 是誰

<VirtualHost 172.30.0.35:80>
        ServerName rimmon.goods.dev.xxx.com.tw
        ServerAdmin [email protected]
        DocumentRoot /home/rimmon/bid/goods/www
        SetEnv DEVELOPER rimmon
        alias /js/ /home/rimmon/bid/www/www/js/
        alias /css/ /home/rimmon/bid/www/www/css/
        <Directory “/home/rimmon/bid/goods/www”>
          Options  FollowSymLinks
          AllowOverride None
          Allow from all
        </Directory>
</VirtualHost>

[sparc] solve gentoo blocking problem

emerge -pv
……
[ebuild     U ] app-shells/bash-3.2_p33 [3.1_p17] USE=”nls -afs -bashlogger
-plugins% -vanilla” 2,564 kB
[blocks B     ] <sys-apps/portage-2.1.4_rc1 (is blocking
app-shells/bash-3.2_p33)
[blocks B     ] sys-apps/mktemp (is blocking sys-apps/coreutils-6.10-r2)
[blocks B     ] >=sys-apps/coreutils-6.10 (is blocking sys-apps/mktemp-1.5)
emerge -1 =bash-3.2_p17*
emerge -1 portage
emerge -1 bash
emerge -C mktemp
emerge -C sys-apps/util-linux
emerge –oneshot coreutils

emerge -1 sys-apps/util-linux

ncurses sample

A Simple scanw example

compile:

gcc sample.c -lncurses

[code language=’c’]
#include /* ncurses.h includes stdio.h */
#include

int main()
{
char mesg[]=”Enter a string: “; /* message to be appeared on the screen */
char str[80];
int row,col; /* to store the number of rows and *
* the number of colums of the screen */
initscr(); /* start the curses mode */
getmaxyx(stdscr,row,col); /* get the number of rows and columns */
mvprintw(row/2,(col-strlen(mesg))/2,”%s”,mesg);
/* print the message at the center of the screen */
getstr(str);
mvprintw(LINES – 2, 0, “You Entered: %s”, str);
getch();
endwin();

return 0;
}
[/code]

改 mysql 欄位寬

 ALTER TABLE `tbl_item` CHANGE `objno` `objno` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 

一次啟動 5 個 memcached 的 shell

[code language=sh]

#!/bin/sh
IP=”192.168.1.254″
MEM=128
CONN=1024
PORTS=”11211 11212 11213 11214 11215″
#
for P in $PORTS; do
  PID=”/tmp/$P.pid”
  echo /usr/bin/memcached -u nobody -p $P -l $IP -d -m $MEM -c $CONN -P $PID
  /usr/bin/memcached -u nobody -p $P -l $IP -d -m $MEM -c $CONN -P $PID
done
#
echo “done!”

[/code]

[php] 讀 CSV 檔

if ( empty($_SERVER["DOCUMENT_ROOT"]) ) $DOC_ROOT="/m1/root";
else $DOC_ROOT=$_SERVER["DOCUMENT_ROOT"];

include $DOC_ROOT."/db.inc.php";

$filename="test_data.dat";
$filename="d_0416.dat";
$max_aline=1000;

if ( !$__db_mysql=@mysql_connect($__config['host'],$__config['user'],$__config['pass'],FALSE, MYSQL_CLIENT_COMPRESS) ) {
  debug_log($process_log,"fail on connect db,0");
  die('fail on connect db,0');
}

mysql_select_db('demo',$__db_mysql);
mysql_query("set names big5", $__db_mysql);

setlocale(LC_ALL,'zh_TW.Big5');
$fp=fopen($filename,"r");

$cnt=0;
while ( $data=fgetcsv($fp,1000) ) {
  if ( count($data)!=48 ) continue;

  unset( $f_name );
  unset( $f_data );
  $f_data[]=0;
  foreach ($data as $k => $v) {
    $f_name[]="f_".$k;
    $f_data[]=sprintf("'%s'",substr($v,0,200));
  }
  $f_data[]=time();

  $sql=sprintf("insert into user2 values (%s)",implode(',',$f_data));
  printf("%d\n",$cnt);
  $result=mysql_query($sql, $__db_mysql);

  $cnt++;
}
fclose($fp);

mysql_close($__db_mysql);

// —–
function xdisp($data) {
  global $fp;
  $data=fgetcsv($fp,1000);
  printf("%d\n",count($data));
  print_r($data);
}