» 2016 » May の記事

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.  

[master]
nano my.cnf
binlog_format = mixed
/etc/init.d/mysql restart

[slave]
nano my.cnf
binlog_format = mixed
/etc/init.d/mysql restart

show variables like "binlog_format";

 

~ PDO @ php ~

connie 2016.05.19 | php | | No Comments

get assoc array from db ONLY

$rtn= $query->fetchAll(PDO::FETCH_ASSOC);
Array
(
    [hmvID] => 1
    [insertDate] => 2016-03-16 15:18:53
    [requestType] => EAN
    [requestData] => 4547557009859
    [requestDate] => 2016-03-16 17:45:38
    [status] => 1
    [type] => CD
    [title] => ジレンマ(期間生産限定盤)(アニメ盤)
    [artist] => ecosystem
    [ReleaseDate] => 2011-11-30
    [sPhoto] => http://ecx.images-amazon.com/images/I/512THFU3PrL._SL75_.jpg
    [XLPhoto] => http://ecx.images-amazon.com/images/I/512THFU3PrL.jpg
    [ListPrice] => ¥ 1,337
    [LowestNewPrice] => ¥ 570
    [ASIN] => B005OCSU7Y
    [EAN] => 4547557009859
    [SeikodoProductCode] => 
    [DetailPageURL] => http://www.amazon.co.jp/%E3%82%B8%E3%83%AC%E3%83%B3%E3%83%9E-%E6%9C%9F%E9%96%93%E7%94%9F%E7%94%A3%E9%99%90%E5%AE%9A%E7%9B%A4-%E3%82%A2%E3%83%8B%E3%83%A1%E7%9B%A4-ecosystem/dp/B005OCSU7Y%3FSubscriptionId%3DAKIAIMFGLRVRLCPPHX7A%26tag%3Dpuiconnie-22%26linkCo
    [currentStorage] => 房間貓柱CD櫃
    [tag] => 銀魂
)

get assoc and int array from db

$rtn= $query->fetchAll();
Array
(
    [hmvID] => 1
    [0] => 1
    [insertDate] => 2016-03-16 15:18:53
    [1] => 2016-03-16 15:18:53
    [requestType] => EAN
    [2] => EAN
    [requestData] => 4547557009859
    [3] => 4547557009859
    [requestDate] => 2016-03-16 17:45:38
    [4] => 2016-03-16 17:45:38
    [status] => 1
    [5] => 1
    [type] => CD
    [6] => CD
    [title] => ジレンマ(期間生産限定盤)(アニメ盤)
    [7] => ジレンマ(期間生産限定盤)(アニメ盤)
    [artist] => ecosystem
    [8] => ecosystem
    [ReleaseDate] => 2011-11-30
    [9] => 2011-11-30
    [sPhoto] => http://ecx.images-amazon.com/images/I/512THFU3PrL._SL75_.jpg
    [10] => http://ecx.images-amazon.com/images/I/512THFU3PrL._SL75_.jpg
    [XLPhoto] => http://ecx.images-amazon.com/images/I/512THFU3PrL.jpg
    [11] => http://ecx.images-amazon.com/images/I/512THFU3PrL.jpg
    [ListPrice] => ¥ 1,337
    [12] => ¥ 1,337
    [LowestNewPrice] => ¥ 570
    [13] => ¥ 570
    [ASIN] => B005OCSU7Y
    [14] => B005OCSU7Y
    [EAN] => 4547557009859
    [15] => 4547557009859
    [SeikodoProductCode] => 
    [16] => 
    [DetailPageURL] => http://www.amazon.co.jp/%E3%82%B8%E3%83%AC%E3%83%B3%E3%83%9E-%E6%9C%9F%E9%96%93%E7%94%9F%E7%94%A3%E9%99%90%E5%AE%9A%E7%9B%A4-%E3%82%A2%E3%83%8B%E3%83%A1%E7%9B%A4-ecosystem/dp/B005OCSU7Y%3FSubscriptionId%3DAKIAIMFGLRVRLCPPHX7A%26tag%3Dpuiconnie-22%26linkCo
    [17] => http://www.amazon.co.jp/%E3%82%B8%E3%83%AC%E3%83%B3%E3%83%9E-%E6%9C%9F%E9%96%93%E7%94%9F%E7%94%A3%E9%99%90%E5%AE%9A%E7%9B%A4-%E3%82%A2%E3%83%8B%E3%83%A1%E7%9B%A4-ecosystem/dp/B005OCSU7Y%3FSubscriptionId%3DAKIAIMFGLRVRLCPPHX7A%26tag%3Dpuiconnie-22%26linkCo
    [currentStorage] => 房間貓柱CD櫃
    [18] => 房間貓柱CD櫃
    [tag] => 銀魂
    [19] => 銀魂
)

 

mysqladmin -u root -p var | grep -E 'character|collation' | tr -s ' '
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
nano  /etc/my.cnf
[mysqld]
...
...
character-set-server=utf8
systemctl stop mariadb
systemctl start mariadb
mysqladmin -u root -p var | grep -E 'character|collation' | tr -s ' '
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |

 

~ centos setting GEOIP ~

connie 2016.05.06 | centos, php | | No Comments
yum install GeoIP-devel
yum install php-pear
yum install php-pecl-geoip

cd /usr/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
mv GeoLiteCity.dat GeoIPCity.dat

sudo systemctl restart php-fpm
sudo systemctl restart nginx

TEST PHP CODE

$record = geoip_record_by_name($_SERVER["REMOTE_ADDR"]);
    if ($record) {
        print_r($record);
    }

 

~ nas synology install and setup nano ~

connie 2016.05.04 | Uncategorized | | No Comments

Install Nano

ipkg update
ipkg install nano

nano /opt/etc/nanorc
uncomment the include line

Setup nano Fix bad regex error message

nano fix_bad_regex.sh

#!/bin/bash
NEW="\\\b"
DPATH="/opt/share/nano/*.nanorc"
BPATH="/opt/share/nano/"
[ ! -d $BPATH ] && mkdir -p $BPATH || :
for f in $DPATH
do
  if [ -f $f -a -r $f ]; then
    /bin/cp $f "$f.bak"
    sed -i "s/\\\</$NEW/g" "$f"
    sed -i "s/\\\>/$NEW/g" "$f"
   else
    echo "Error: Cannot read $f"
  fi
done

sh fix_bad_regex.sh

 

~ nas synology ipkg install ~

connie 2016.05.04 | Uncategorized | | No Comments
cd /volume1/public

wget http://ipkg.nslu2-linux.org/feeds/optware/syno-e500/cross/unstable/syno-e500-bootstrap_1.2-7_powerpc.xsh

sh syno-e500-bootstrap_1.2-7_powerpc.xsh

ipkg update

 

| HOME |

Smiley face

May 2016
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031