2019年7月31日 星期三

centos 7

1. Change ssh Port 22

https://www.opencli.com/linux/centos-7-change-ssh-port-selinux-enable

2019年7月16日 星期二

hyper V

1. NetWork
https://dotblogs.com.tw/acelee/2018/07/18/191122

https://channel9.msdn.com/Series/Windows-Server-2012-Entry-Level/Windows-Server-2012-Entry-Level-5

https://ithelp.ithome.com.tw/articles/10128382

2019年7月15日 星期一

Ruby

0. Ruby install On windows

0-1 下載安裝exe,地址:http://rubyinstaller.org/downloads/
原文網址:https://kknews.cc/tech/pg3lx8.html


下載 DEvKit 表示可擴充的套件



ref:1 2


0-1 RubyGems簡介

RubyGemsRuby的套件管理系統,讓你輕易安裝及管理Ruby函式庫。你可以在RubyGems上找到所有的Ruby開源套件。另外,讀者如果想找RubyRails有哪些好用的套件,也可以瀏覽看看The Ruby Toolbox,這個站依照套件的熱門程度排序,非常方便。

常用指令

gem -v 告訴你 RubyGems 的版本
gem update --system 升級RubyGems的版本
gem install gem_name 安裝某個套件
gem list 列出安裝的套件
gem update gem_name 更新最新版本
gem update 更新所有你安裝的Gems
gem install -v x.x.x gemname 安裝特定版本
gem uninstall gem_name 反安裝

ref 1

0-2 Require Method

https://kaochenlong.com/2016/05/01/require/

Notice
require 'rubygems' will adjust the Ruby loadpath allowing you to successfully require the gems you installed through rubygems, without getting a LoadError: no such file to load -- sinatra.

In Ruby 1.9 'require "rubygems"' happens automatically. In previous Rubies rubygems is not automatically required and you will get the error. Your best bet is to automatically type it in unless you are sure you are running always in 1.9+. 


0-3 Install test
gem install mail
gem install win32-service






1. Ruby  totorail

https://railsbook.tw/chapters/02-environment-setup.html
https://ourcodeworld.com/articles/read/270/how-to-create-an-executable-exe-from-a-ruby-script-in-windows-using-ocra
http://ruby-for-beginners.rubymonstas.org/built_in_classes/symbols.html
https://openhome.cc/Gossip/Ruby/index.html


2. Data structure

Array:
["A string", 1, true, :symbol, 2]

Hash
{ "one" => "eins", "two" => "zwei", "three" => "drei" }


3. Class



4. Block

ref 1

block是用來暫存及傳遞程式碼的地方
它本身不是物件(但有方法可以讓它變物件,最後說明)所以必須掛在別人身上(可能是別的方法、別的物件


@users.each do |u|
...
end




2019年6月26日 星期三

kate progarm practice

1. kate
http://www.shute.kh.edu.tw/~92d314/email/2decision-tree.htm
https://www.slideshare.net/teddysoft/bowling-game-kata-132735820
http://codingdojo.org/kata/


2.  ACM
https://www.cs.ubc.ca/~acm-web/practice/
http://codeforces.com/
https://www.codechef.com/


3. practice
https://codeforces.com/group/L0zlhp0AHw/contest/1155/problem/A


4. reference
https://www.quora.com/How-should-I-practice-for-ACM-ICPC

2019年6月17日 星期一

ES

Reference

ch: 1 2 3

1. DSL

DSL (domain-specific language),領域特定語言指的是專注於某個應用程式領域的計算機語言,

1. Simple  dsl

{
  "query": {
    "match": {
      "status": {
        "query": 200,
        "type": "phrase"
      }
    }
  }
}

2.
{
  "query": {
    "match": {
      "remote_addr": {
        "query": "110.28.1.9",
        "type": "phrase"
      }
    }
  }
}


3.BOOLEAN example ref 1


   
{
   "bool" : {
      "must" :     [],
      "should" :   [],
      "must_not" : [],
   }
}
GET
/my_store/products/_search { "query" : { "filtered" : { "filter" : { "bool" : { "should" : [ { "term" : {"price" : 20}}, { "term" : {"productID" : "XHDK-A-1293-#fJ3"}} ], "must_not" : { "term" : {"price" : 30} } } } } } }



GET _search
{
    "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1560807190000,
              "lte": 1560828790000,
              "format": "epoch_millis"
            }
          }
        },
        {
          "query_string": {
            "query": "*",
            "analyze_wildcard": true
          }
        },
        {
          "match": {
            "upstream_addr": {
              "type": "phrase",
              "query": "202.39.43.17:80"
            }
          }
        }
      ]
    }
  }
}


4. AGGS

GET /cars/transactions/_search
{
    "size" : 0,
    "aggs" : { 
        "popular_colors" : { 
            "terms" : { 
              "field" : "color"
            }
        }
    }
}
能会注意到我们将 size 设置成 0 。我们并不关心搜索结果的具体内容,所以将返回记录数设置为 0 来提高查询速度。 设置 size: 0 与 Elasticsearch 1.x 中使用 count 搜索类型等价。


2. VIsualize

https://www.elastic.co/guide/cn/kibana/current/tutorial-visualizing.html

2019年5月23日 星期四

HTML and CSS



1. @important
風格表有三種來源:作者定義的,用戶指定的,與展現程式的預設值。預設的串聯規則是:作者定義的風格表會取代用戶定義的風格表,而展現程式的預設值位階最低。可以在作者的風格表與用戶的風格表中使用 !important,改變預設的串聯規則。依據 CSS2 標準,如果用戶的風格表中,有使用 !important 的規則,則其優先權會高過作者的風格表,即便作者的風格表中有加上 !important。其語法是:

ref: 1 2


2.  @media ref 1
@media 是 CSS 擴充元件的寫法之一,我們可以把它當成是 CSS 的類別

Query 顧名思義就是「查詢」的意思,我們如果要非常熟練的運用 media,各種條件跟條件之間的查詢是不可或缺的。像是前面範例運用的(min-width: 400px) and (max-width: 700px),那個「and」就是 Query 的一種。

Query 的語法只有三大項:not, and, only。我們最常用的是「and」


Media Feature
width | min-width | max-width
(寬度 | 最小寬度 | 最大寬度)
height | min-height | max-height
(高度 | 最小高度 | 最大高度)
device-width | min-device-width | max-device-width
(裝置寬度 | 裝置最小寬度 | 裝置最大寬度)



3. jquery
: time line  1 2



4. CSS add start
https://stackoverflow.com/questions/23141854/adding-asterisk-to-required-fields-in-bootstrap-3






2019年4月11日 星期四

Bootstrap

bootstrap Office document 1

CH1 Installall Bootstrap


Bootstrap Office :
https://getbootstrap.com/docs/4.0/getting-started/download/


解壓縮後有 CS 及 JS 資料夾
此外還需下載 jquery https://jquery.com/download/

# hello_world.html
<!DOCTYPE html>
<html>
<head>
<title>Good</title>
<link rel="stylesheet" href="css/bootstrap.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>

<body>
<div class="jumbotron">
 <h1>  Hello word </h1>
 <a class="btn btn-primary btn-lg" href="E" role="button">
  從開始第一章
 </a>
</div>

<script src="js/jquery.js">
<script src="js/bootstrap.js">
</body>
</html>



CH2  table

https://mdbootstrap.com/docs/jquery/tables/sort/
https://v4-alpha.getbootstrap.com/content/tables/

Table width:
https://mdbootstrap.com/docs/jquery/tables/responsive/


bootstrap example:
https://github.com/wenzhixin/bootstrap-table-examples/blob/master/jsfiddle_examples.md

bootstrap sourcecode:
https://github.com/wenzhixin/bootstrap-table-examples
https://github.com/wenzhixin/bootstrap-table/blob/develop/src/bootstrap-table.js



Table getall data :

$('#target').bootstrapTable('getData');   ref 1 2



CH3 bootstrap table for toolbar


--------------------------------------------
office

toolbar



  • Attribute: data-toolbar
  • Type: String/Node
  • Detail:
    A jQuery selector that indicates the toolbar, for example: #toolbar.toolbar, or a DOM node.
  • Default: undefined
  • Example: Custom Toolbar

--------------------------------------
example code

<div id="toolbar">
  <select class="form-control">
    <option value="">Export Basic</option>
    <option value="all">Export All</option>
    <option value="selected">Export Selected</option>
  </select>
</div>
<table id="table"
       data-toggle="table"
       data-toolbar="#toolbar"
       data-show-export="true"
       data-pagination="true"
       data-maintain-selected="true"
       data-page-size="5"
       data-page-list="[5, 25, 50, 100, ALL]"
       data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data2/"
       data-export-options='{
         "fileName": "test",
         "ignoreColumn": ["state"]
       }'
       >
    <thead>
    <tr>
        <th data-field="state" data-checkbox="true"></th>
        <th data-field="id">ID</th>
        <th data-field="name">Name</th>
        <th data-field="price">Price</th>
    </tr>
    </thead>
</table>
----------------------------------------
reference
1 2 3 4 5 mutlipe icon



CH4  Good bootstrap design

https://bootsnipp.com

CH5 GOOD API
https://dotblogs.com.tw/shihgogo/2017/05/31/085635