2019年8月29日 星期四

underscore_js



1.
https://stackoverflow.com/questions/4778881/how-to-use-underscore-js-as-a-template-engine

2.
https://www.sitepoint.com/getting-started-with-underscore-js/

3.
https://playcode.io/

4.
https://wbkuo.pixnet.net/blog/post/207623383-%5Bjavascript%5D-underscore-%E7%9A%84-template-%E5%8A%9F%E8%83%BD%E6%B8%AC%E8%A9%A6

2019年8月27日 星期二

Backbonejs


https://code.tutsplus.com/tutorials/single-page-todo-application-with-backbonejs--cms-21417

https://github.com/tutsplus/single-page-todo-backbone

https://bocoup.com/blog/organizing-your-backbone-js-application-with-modules


https://github.com/mitsuruog/SPA-with-Backbone


https://github.com/mitsuruog/SPA-with-Backbone/tree/phase-1

https://blog.wu-boy.com/2012/04/backbonejs-framework-tutorial-example-1/

https://codertw.com/%E5%89%8D%E7%AB%AF%E9%96%8B%E7%99%BC/277045/

1
http://icodingtw.blogspot.com/2012/04/backbonejs.html

2
http://icodingtw.blogspot.com/2012/04/backbonejs.html

3
http://icodingtw.blogspot.com/2012/05/backbonejs.html

4.
https://rightson.blogspot.com/2012/05/backbonejs.html

5.
http://rightson.blogspot.com/2012/07/backbonejs.html

6.
http://ozzysun.blogspot.com/2012/02/backbonejs-model-04fetch.html

7.
http://jamestw.logdown.com/posts/166159-backbonejs

8.
http://jamestw.logdown.com/posts/166159-backbonejs


9.
https://github.com/jashkenas/backbone/wiki/Tutorials%2C-blog-posts-and-example-sites

2019年8月26日 星期一

Good web design


http://www.eikospartners.com/blog/single-page-applications-a-powerful-design-pattern-for-modern-web-apps

https://medium.com/a-lady-dev/single-page-applications-a-powerful-design-pattern-for-modern-web-apps-ec3590bb7e7a

https://purpleorangepr.com/

https://www.intechnic.com/blog/60-beautiful-examples-of-one-page-website-design-inspirations/


https://www.awwwards.com/practical-uses-of-angularjs-create-a-single-page-application-spa-or-a-website-menu-in-an-instant.html

good
http://www.jollen.org/blog/2014/09/single-page-application.html


https://stackoverflow.com/questions/10040297/how-exactly-can-i-replace-an-iframe-with-a-div-and-javascript


https://codepen.io/ettrics/full/ogRaRv/

https://tympanus.net/Blueprints/MultiLevelMenu/

https://colorlib.com/wp/free-website-menu-templates/

PHP Security



#set up response header
<IfModule mod_headers.c>
Header set X-Frame-Options "SAMEORIGIN"
Header set Content-Security-Policy "default-src 'self'"
</IfModule>


https://adamschen9921.pixnet.net/blog/post/116879044-apache%E7%A7%BB%E9%99%A4%E9%87%8D%E8%A6%81%E8%B3%87%E8%A8%8Aheader

https://gist.github.com/phpdave/24d879514e7411047267

Net craft website

https://toolbar.netcraft.com/site_report?url=tympanus.net%2FBlueprints%2FMultiLevelMenu%2F

https://toolbar.netcraft.com/stats/topsites?c=JP&submit=Refresh

2019年8月22日 星期四

SSH web log tunnel, no need install browser in server

1. SSH
  • ssh -L 8080:remoteMachine.me:80 user@remoteMachine
Local port: 8080
remote port: 80


ref 1 2 3

2019年8月15日 星期四

php centos7 install mysql and pdo

1. install mysql package for php
ref  https://www.opencli.com/php/php-use-mysqlnd-replace-libmysql


libmysql 是 PHP 沿用已久的 MySQL driver, 而在 PHP 5.3 開始, PHP 內建了 PHP 專用連接 MySQL 的 Driver — mysqlnd, 而從 PHP 5.4 之後的版本, mysqlnd 更被 PHP 作為預設安裝選項。
如果在 RHEL / CentOS 下要安裝 mysqlnd, 可以用 yum 指令完成, 但由於 php-mysqlnd (mysqlnd) 與 php-mysql (libmysql) 不能共存, 所以安裝前要先移除 php-mysql.

# yum install php-mysqlnd



2 PHP7 install phpmyadmin


Ref 1









2019年8月14日 星期三

php install oracle connect

1.  Oracle Instant Client

Oracle Instant Client enables applications to connect to a local or remote Oracle Database for development and production deployment. The Instant Client libraries provide the necessary network connectivity, as well as basic and high end data features, to make full use of Oracle Database. It underlies the Oracle APIs of popular languages and environments including Node.js, Python and PHP, as well as providing access for OCI, OCCI, JDBC, ODBC and Pro*C applications. Tools included in Instant Client, such as SQL*Plus and Oracle Data Pump, provide quick and convenient data access.




2.  install




3 Step:
package: oci8-2.2.0
package: oracle-instantclient19.3-basic-19.3.0.0.0.0-1,
oracle-instantclient19.3-devel-19.3.0.0.0.1.x86_64.rpm,
oracle-instantclient19.3-sqlplus-193.30.0.01.x84_64.rpm


1. install rpm  for basic and develop, 
2. install oci8, 透過OCI8連到Oracle之範例說明
3. install php.d for oci8.ini
4. resta server

4. Good reference
linux centos centos7 安装oci8
CentOS下,裝Oci8
Oci_connect function is undefined in CentOS with Oracle


5. explain PHP INI
php ini chinese




2019年8月13日 星期二

Linux bash loop Problem

1. Problem:
This will cause the fork bomb if you in bashrc write
scl enable XXX

bash fork retry: no child processes

2. solution Logout
killall -KILL -u user1

Install apache and php

1. 安裝 1

Simple install 1
https://dywang.csie.cyut.edu.tw/dywang/rhce7/node71.html



2. Bird and detail content Install 2

http://linux.vbird.org/linux_server/0360apache.php#www_basic_basic



3. Quick install 

https://www.opencli.com/linux/redhat-centos-7-setup-apache-mariadb-php

php 7

1. reference

https://tecadmin.net/nstall-php7-on-centos6/
https://www.tecmint.com/install-php-7-in-centos-6/
https://tecadmin.net/nstall-php7-on-centos6/

2.  說明

 PHP 是 Apache 當中的一個模組,那在談了 Apache 的 httpd.conf 之後,『我們怎麼沒有講到 PHP 這個模組的設定啊?』不是不講啦!而是因為目前 Apache 很聰明的將一些重要模組給他拆出來放置到 /etc/httpd/conf.d/*.conf 檔案中了,所以我們必須要到該目錄下才能瞭解到某些模組是否有被加入啊!底下先來瞧瞧吧!

https://stackoverflow.com/questions/2772400/how-does-php-interface-with-apache


3. 設定檔案



4  php array are call by value
https://stackoverflow.com/questions/879/are-php-variables-passed-by-value-or-by-reference


5. PHP PDO
https://www.slideshare.net/ryerryer/phpdb-72324578


6. php 7 news
https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.unicode-codepoint-escape-syntax







Apache 2.4

1. Setting File 

Position: conf/httpd.conf 


2. Seting Example 

2-1 

----------------------------- https://www.itread01.com/content/1546777631.html

Apache2.2升級到Apache2.4後httpd.conf的配置差別總結。


1、Listen設定的差別
設定監聽埠需指定IP
如Listen 88
需要改成
Listen 192.168.0.1:88


2、日誌紀錄設定的差別


RewriteLogLevel 改為 logLevel


LOGLEVEL設定第一個值是針對整個Apache的預設等級,後面對指定的模組修改此模組的日誌記錄等級


3、需載入更多的模組
開啟Gzip在apache2.4中需額外載入mod_filter
開啟SSL在apache2.4中需額外載入mod_socache_shmcb


4、許可權設定的差別


Apache2.2用Order Deny / Allow的方式,2.4用Require


apache2.2:
Order deny,allow
Deny from all


apache2.4:
Require local


此處比較常用的有如下幾種:
Require all denied
Require all granted
Require host domain
Require ip 192.168.1.1
Require local


要注意的是:如果在htaccess檔案中有設定的也要相應修改


5、Namevirtualhost 2.4中已經被刪除



2-2 Example

在 AWS EC2 裝好基本的 LAMP 環境之後,想設一下 Apache Virtual Host 設定
結果居然無法運作,查了一下才發現在 Apache 2.4.6 (或更之前) 有對這部份的設定做了一些調整
以下是簡易的筆記

1. NameVirtualHost*:80 這行已經廢除,不用再寫了
2. 原本的 http.conf 已經預設加上 IncludeOptional conf.d/*.conf
    所以可以把 Virtual Host 的設定獨立成另一隻檔案,我習慣命名為 vhosts.conf,放在 /etc/httpd/conf.d/vhosts.conf
3. <VirtualHost> 的調整
由原本的
<VirtualHost sample.com>
        DocumentRoot  /var/www/www_sample
        ServerName sample.com
        CustomLog logs/access_log combined
        DirectoryIndex  index.php index.html index.htm index.shtml
        <Directory "/var/www/www_sample">
            Options FollowSymLinks
            AllowOverride All
        </Directory>
</VirtualHost>

改為 
<VirtualHost *:80>
        DocumentRoot  /var/www/www_sample
        ServerName sample.com
        CustomLog logs/access_log combined
        DirectoryIndex  index.php index.html index.htm index.shtml
        <Directory "/var/www/www_sample">
            Options FollowSymLinks
            AllowOverride All
        </Directory>
</VirtualHost>



2-3  Remove  welcome page

https://linuxconfig.org/how-to-disable-default-apache-welcome-page-on-redhat-linux




2-4 Default Parameters  Ref https://kknews.cc/zh-tw/other/qorvg6b.html

配置文件位於:
[root@www ~]# vim /usr/local/http-2.4.23/conf/extra/httpd-default.conf

Timeout 5
推薦5 這個是 apache接受請求或者發出相應的時間超過這個時間斷開
KeepAlive On/Off KeepAlive
指的是保持連接活躍,換一句話說,如果將KeepAlive設置為On,那麼來自同一客戶端的請求就不 需要再一次連接,避免每次請求都要新建一個連接而加重伺服器的負擔。一般情況下,圖片較多的網站應該把 KeepAlive設為On。


原文網址:https://kknews.cc/other/qorvg6b.html







2-5 Virtual host ref ref

在 Apache 上設定 VirtualHost 是牙齒掉下來然後又腐化掉的問題,但這問題又久久才會處理一次,剛不小心出了一點小問題,於是稍微記錄一下提醒自己。
設定 VirtualHost 目的是使用同一個伺服器架設多個網站,當使用者以不同網域名稱連到該主機時, web server 會依據不同的目的網頁需求,回應不同的網頁內容



2-6 https://httpd.apache.org/docs/2.4/mod/core.html#directory
Office Document


2-7 2.4 New document

Core Enhancements

Run-time Loadable MPMs
Multiple MPMs can now be built as loadable modules at compile time. The MPM of choice can be configured at run time via LoadModule directive.
Event MPM
The Event MPM is no longer experimental but is now fully supported.
Asynchronous support
Better support for asynchronous read/write for supporting MPMs and platforms.
Per-module and per-directory LogLevel configuration
The LogLevel can now be configured per module and per directory. New levels trace1 to trace8 have been added above the debuglog level.
Per-request configuration sections
<If><ElseIf>, and <Else> sections can be used to set the configuration based on per-request criteria.
General-purpose expression parser
A new expression parser allows to specify complex conditions using a common syntax in directives like SetEnvIfExprRewriteCond,Header<If>, and others.
KeepAliveTimeout in milliseconds
It is now possible to specify KeepAliveTimeout in milliseconds.
NameVirtualHost directive
No longer needed and is now deprecated.
Override Configuration
The new AllowOverrideList directive allows more fine grained control which directives are allowed in .htaccess files.
Config file variables
It is now possible to Define variables in the configuration, allowing a clearer representation if the same value is used at many places in the configuration.
Reduced memory usage
Despite many new features, 2.4.x tends to use less memory than 2.2.x


2-8  Remove Index browser index 
https://www.itread01.com/content/1549475658.html
more clarn
https://www.tekfansworld.com/how-to-disable-apache-2-4-directory-browsing-on-ubuntu-16-04.html


2-9 Simple apach4 manipuate
http://igt.com.tw/5/linset/www1.htm


2-10 Scl apache 4
http://igofun.net/wordpress/2017/12/28/%E3%80%90centos-6%E3%80%91%E9%80%8F%E9%81%8E-scl-%E5%B0%87-apachehttpd-%E5%8D%87%E7%B4%9A%E5%88%B0-2-4-%E7%89%88/


2-11 Vshot 2

https://dywang.csie.cyut.edu.tw/dywang/rhce7/node78.html


2-12 apache management

https://blog.xuite.net/towns/hc/80213406-Apache%E5%AE%89%E8%A3%9D%E3%80%81%E8%A8%AD%E5%AE%9A%E8%88%87%E7%AE%A1%E7%90%86


2-13

https://dotblogs.com.tw/maplenote/2012/07/20/apache24_httpd_conf