發表文章

目前顯示的是 6月, 2017的文章

Markdown

[MySQL] 交易特性

http://xyz.cinc.biz/2013/05/mysql-transaction.html

[JavaScript] typeof !== “undefined” vs. != null

https://stackoverflow.com/questions/2703102/typeof-undefined-vs-null up vote 535 down vote accepted typeof  allows the identifier to never have been declared before. So it's safer in that regard: if ( typeof neverDeclared == "undefined" ) //no errors if ( neverDeclared == null ) //throws ReferenceError: neverDeclared is not defined

[PHP] Check is Number

檢查金額是否為數字 https://stackoverflow.com/questions/8307104/is-numeric-vs-is-float-vs-is-int if is_numeric($input) === true then either is_float($input) === true OR is_int($input) === true OR 分別需要注意 第一種 0x36這種也過 第二種 整數或小數點 第三種 整數 [eric_tu@localhost ~]$ php -a Interactive shell php > echo intval(23); 23 php > echo intval(231asad); PHP Parse error: syntax error, unexpected 'asad' (T_STRING) in php shell code on line 1 php > echo intval('231asad'); 231 php > echo is_int('23'); php > echo intval(0x3123); 12579 php > echo intval('.x2130'); 0 php > is_numeric('123ads') php > echo is_numeric('123ads'); PHP Parse error: syntax error, unexpected echo (T_ECHO) in php shell code on line 2 php > echo preg_match('/^[0-9]*$/', '21313','asd21') php > echo preg_match('/^[0-9]*$/', '21313','asd21'); PHP Fatal error: Only variables can be passed by reference in php ...

[MySQL] 語法查詢

http://www.1keydata.com/tw/sql/sqlselect.html http://note.drx.tw/2012/12/mysql-syntax.html

[MySQL] ERROR Can't connect to local MySQL server through socket

[eric_tu@localhost ~]$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) [eric_tu@localhost ~]$ mysql -u eric_tu -h 127.0.0.1 -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.18 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> mysql> show databases; mysql> use Msgboard;

[XShell] Xshell connect fail

Xshell connect fail 解決方法: 查看shh 狀態 重啟看看 還是不行 查IP 發現IP換了 所以去xshell session重新設定。(今天網路掛了,重開之後區網IP有更動) [eric_tu@localhost eric_tu]$ sudo service sshd status sudo: /var/db/sudo/eric_tu writable by non-owner (040770), should be mode 0700 We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for eric_tu: Redirecting to /bin/systemctl status sshd.service ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: active (running) since 一 2017-06-19 15:03:20 CST; 4min 30s ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 2245 (sshd) CGroup: /system.slice/sshd.service └─2245 /usr/sbin/sshd -D 6月 19 15:03:20 localhost.localdomain systemd[1]: Starting OpenSSH server da...

[Linux] NTP

set date 如何校時 sudo yum install ntp Dependencies Resolved ============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================================================== Installing: ntp x86_64 ...

[PHPUnit] Remaining deprecation notices (9)

PHPunit Warning  Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0: [eric_tu@localhost eric_tu]$ vendor/bin/phpunit --coverage-html web/reports/ PHPUnit 5.7.20 by Sebastian Bergmann and contributors. ................... 19 / 19 (100%) Time: 9.87 seconds, Memory: 36.50MB OK (19 tests, 39 assertions) Generating code coverage report in HTML format ... done Remaining deprecation notices (9) Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0: 9x 9x in BankControllerTest::testRegisterAction from AppBundle\Entity [eric_tu@localhost eric_tu]$ vendor/bin/phpunit --coverage-html web/...

[Symfony] crawler get request parameter setting

https://github.com/FriendsOfPHP/Goutte/issues/113 Having been bit a couple times with the way Guzzle client aggregates parameters, although I like the spirit of this request I think introducing it into Goutte’s foundation is likely to cause more problems/confusions than it solves. For example, if you had: $params = array( ‘a’ => ‘a’, ‘b’ => ‘b’, ); $crawler = $client->request(‘GET’, ‘ http://www.example.com/?c=c ’, $params); Would you expect  http://www.example.com/?c=c&a=a&b=b  to be loaded, or  http://www.example.com/?a=a&b=b  ? Furthermore things become really hairy when you start trying to plan for query array values. Although it restrains the functionality of Goutte/BrowserKit/Guzzle, wouldn’t this be best since you’d have complete control and understanding of what you are about to access: $params = array( ‘a’ => ‘a’, ‘b’ => ‘b’, ); $crawler =  c l i e n t − > r e q u e s t ( ′ G E T ′ , ′ h t t p : / / w w w . e x a...