2018/12/22

IntelliJ IDEA產生Interface or Abstract Class需實作的方法

發現IntelliJ不會像Netbeans那樣,當定義類別實作某介面時,不會繼續提示你要實作方法並產生要實作的方法的程式片段,反而要手動產生實作方法的程式。

Mac的話可以按⌃I或⌘N來產生需實作方法的程式碼。

2018/12/21

解決用IntelliJ IDEA啟動Tomcat時,Servlet輸出的Console中文亂碼問題...

參考下圖:
只要在VM options加入加入-Dfile.encoding=UTF-8就不會亂碼了...
改完如下,就沒亂碼了


試過改IntelliJ相關的設定檔都無效,只有這個有效...

2018/8/1

Google Cloud SDK (gcloud) 安裝與需注意的地方

最近在玩Google的Cloud Speech-to-Text API,光要弄個Quickstart就被搞了一陣子

2018/7/30

使用CLI執行JUnit

java -cp .:$JENKINS_HOME/workspace/junit-4.12.jar:$JENKINS_HOME/workspace/hamcrest-core-1.3.jar org.junit.runner.JUnitCore EmployeeTest

2018/7/26

Spring Security的開發

一開始的需求很簡單,就是為Reatful Service弄個Basic access authentication,才發現需要看的文件零零散散的,原本是再找Spring Boot的Security,看一看還是要看到Spring的Security專案。
目前先把重要的文件先寫下來,細節以後有空再寫。

IntelliJ IDEA Mac的快速鍵

格式化程式碼 ⌥⌘L
刪除現在這行⌘delete
自動完成(當提示的下拉選單消失時,想手動叫出)⌃+space
把游標目前所在位置的單字選取起來⌃+g

關閉重複程式碼的波浪底線提示,如下圖:
IntelliJ很像預設會幫你把包括其他程式檔案中有重複的程式碼就會用波浪底線標起來,這樣其實很難看,可參考下圖把它提示關掉:
右邊的Weak Warning換成No highlighting,only fix,這樣波浪底線就會不見了

參考:

2018/7/22

GCP - Google Compute Engine

Google  Compute Engine是GCP提供的雲端服務,可提供使用者創造VM
這裡貼上上次用過的一些圖片

2018/7/14

用Spring Boot使用JPA開發Restful Service

JPA是啥在這目前就不多說明,這篇要寫的是如何用Spring Boot使用JPA開發Restful Service
資料庫用的是MySQL
使用Spring Web MVC框架來開發Restful Service
具體要做的事情是寫一個Restful Service,用JPA對MySQL做資料的存取

用Spring Boot開發的Restful Service範例程式

GET請求:
@RestController
@RequestMapping("/member")
public class WebController {

    @RequestMapping(value = "/firstname/{firstName}", method = {RequestMethod.GET})
    @ResponseBody
    public String queryFirstName(@PathVariable String firstName) {
        return firstName;
    }
}
然後可以用以下的網址來下請求
kiki是這個Web App的Context
使用PathVariable標註就可以取得URL的參數了,之後看要怎麼做後續的處理,這裡將queryFirstName這個method用ResponseBody標注起來,這樣此method回傳的東西就會變成此Service回應的Body,所以此Service就會回應Bloom

2018/7/2

FCF-流程模式與應用劇本的Flow

[
    {
        "id": "323ee37d.6efdfc",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 220,
        "wires": [
            [
                "51b76bf5.8eb624"
            ]
        ]
    },
    {
        "id": "1c4ca252.ccb9ae",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 660,
        "y": 220,
        "wires": []
    },
    {
        "id": "4f119c6d.ef24b4",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 260,
        "wires": [
            [
                "1c4ca252.ccb9ae"
            ]
        ]
    },
    {
        "id": "a3adcc67.610ab",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 180,
        "wires": [
            [
                "1c4ca252.ccb9ae"
            ]
        ]
    },
    {
        "id": "51b76bf5.8eb624",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            }
        ],
        "outputs": 2,
        "x": 330,
        "y": 220,
        "wires": [
            [
                "a3adcc67.610ab"
            ],
            [
                "4f119c6d.ef24b4"
            ]
        ]
    },
    {
        "id": "5f898829.198678",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 400,
        "wires": [
            [
                "bf264e22.fcbda"
            ]
        ]
    },
    {
        "id": "bf264e22.fcbda",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 360,
        "y": 420,
        "wires": [
            [
                "a5221b3.c77bce8"
            ],
            [
                "db8eb49f.47fbc8"
            ]
        ]
    },
    {
        "id": "a5221b3.c77bce8",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 540,
        "y": 380,
        "wires": [
            [
                "94a4d4c5.4cb968"
            ]
        ]
    },
    {
        "id": "db8eb49f.47fbc8",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 530,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "94a4d4c5.4cb968",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 700,
        "y": 380,
        "wires": [
            [
                "2d2adb84.8afa54"
            ]
        ]
    },
    {
        "id": "7f1b1e2d.afb1f",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 235,
        "y": 440,
        "wires": [
            [
                "bf264e22.fcbda"
            ]
        ]
    },
    {
        "id": "2d2adb84.8afa54",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 815,
        "y": 420,
        "wires": []
    },
    {
        "id": "e6ac8553.b72108",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 560,
        "wires": [
            [
                "f9321e63.486ff"
            ]
        ]
    },
    {
        "id": "f9321e63.486ff",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 350,
        "y": 560,
        "wires": [
            [
                "2d50afb9.35264"
            ]
        ]
    },
    {
        "id": "2d50afb9.35264",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 510,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "9f7571fa.a4cb7",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 680,
        "wires": [
            [
                "f1aae794.c7d3d8"
            ]
        ]
    },
    {
        "id": "f1aae794.c7d3d8",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 350,
        "y": 720,
        "wires": [
            [
                "67f97e49.aea55"
            ]
        ]
    },
    {
        "id": "67f97e49.aea55",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 470,
        "y": 780,
        "wires": [
            [
                "82ede6fe.6b7e88"
            ]
        ]
    },
    {
        "id": "dd20d2ac.d81a",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 710,
        "y": 780,
        "wires": [
            [
                "e9976f71.071f7"
            ]
        ]
    },
    {
        "id": "82ede6fe.6b7e88",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 720,
        "wires": [
            [
                "dd20d2ac.d81a"
            ]
        ]
    },
    {
        "id": "e9976f71.071f7",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 800,
        "y": 720,
        "wires": [
            [
                "69be43fd.b2aa9c"
            ]
        ]
    },
    {
        "id": "69be43fd.b2aa9c",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 960,
        "y": 680,
        "wires": []
    },
    {
        "id": "f57f4766.7b55f8",
        "type": "FCF-PushService",
        "z": "7225b89d.d54578",
        "url": "",
        "outputs": 1,
        "x": 260,
        "y": 960,
        "wires": [
            [
                "e8b5486a.36b398"
            ]
        ]
    },
    {
        "id": "e8b5486a.36b398",
        "type": "FCF-FacebookNotification",
        "z": "7225b89d.d54578",
        "outputs": 0,
        "x": 480,
        "y": 960,
        "wires": []
    },
    {
        "id": "167babdc.d9d9e4",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 150,
        "y": 1140,
        "wires": [
            [
                "ed6c88fd.a94938"
            ]
        ]
    },
    {
        "id": "c47078e0.004cf8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 660,
        "y": 1140,
        "wires": []
    },
    {
        "id": "604ab498.ce1e1c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1140,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "c56eae30.bd8e8",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1100,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "ed6c88fd.a94938",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 310,
        "y": 1140,
        "wires": [
            [
                "c56eae30.bd8e8"
            ],
            [
                "604ab498.ce1e1c"
            ],
            [
                "aad1b308.ba045"
            ]
        ]
    },
    {
        "id": "aad1b308.ba045",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1180,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "a32945ea.46d568",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 110,
        "y": 1320,
        "wires": [
            [
                "1bf9c33c.44097d"
            ]
        ]
    },
    {
        "id": "1bf9c33c.44097d",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 300,
        "y": 1320,
        "wires": [
            [
                "8a82ce0.362663"
            ],
            [
                "6e965d22.745e24"
            ]
        ]
    },
    {
        "id": "8a82ce0.362663",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 460,
        "y": 1280,
        "wires": [
            [
                "94b356c9.59d7a8"
            ]
        ]
    },
    {
        "id": "94b356c9.59d7a8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 620,
        "y": 1280,
        "wires": [
            [
                "9080ee19.6ba83"
            ]
        ]
    },
    {
        "id": "cadf217c.f77d8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 1020,
        "y": 1360,
        "wires": [
            [
                "7dcc91eb.ae87"
            ]
        ]
    },
    {
        "id": "6e965d22.745e24",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 450,
        "y": 1360,
        "wires": [
            [
                "e3a2384c.2743c8"
            ]
        ]
    },
    {
        "id": "e3a2384c.2743c8",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 1360,
        "wires": [
            [
                "63ce94e.f45f86c"
            ]
        ]
    },
    {
        "id": "63ce94e.f45f86c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 740,
        "y": 1360,
        "wires": [
            [
                "6efbea33.442e24"
            ]
        ]
    },
    {
        "id": "ba204130.7fcfd",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 175,
        "y": 1280,
        "wires": [
            [
                "1bf9c33c.44097d"
            ]
        ]
    },
    {
        "id": "9080ee19.6ba83",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 735,
        "y": 1280,
        "wires": []
    },
    {
        "id": "6efbea33.442e24",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 870,
        "y": 1360,
        "wires": [
            [
                "cadf217c.f77d8"
            ]
        ]
    },
    {
        "id": "7dcc91eb.ae87",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 1190,
        "y": 1360,
        "wires": [
            [
                "ddd81121.4ab91"
            ],
            [
                "96fa6890.2b3448"
            ],
            [
                "ec067ee.6f27e8"
            ]
        ]
    },
    {
        "id": "ddd81121.4ab91",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1320,
        "wires": []
    },
    {
        "id": "96fa6890.2b3448",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1360,
        "wires": []
    },
    {
        "id": "ec067ee.6f27e8",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1400,
        "wires": []
    },
    {
        "id": "e09bc8da.162608",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 700,
        "y": 1480,
        "wires": [
            [
                "707a5063.bc556"
            ]
        ]
    },
    {
        "id": "75fae486.edaf6c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1480,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "46f59e9b.47c33",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1440,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "11451281.6f087d",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 350,
        "y": 1480,
        "wires": [
            [
                "46f59e9b.47c33"
            ],
            [
                "75fae486.edaf6c"
            ],
            [
                "c72b8a00.f2c228"
            ]
        ]
    },
    {
        "id": "c72b8a00.f2c228",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1520,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "e25201da.27ef5",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 235,
        "y": 1480,
        "wires": [
            [
                "11451281.6f087d"
            ]
        ]
    },
    {
        "id": "707a5063.bc556",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 815,
        "y": 1480,
        "wires": []
    },
    {
        "id": "2487dbad.576004",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 175,
        "y": 1620,
        "wires": [
            [
                "cf18aefc.51bc2"
            ]
        ]
    },
    {
        "id": "cf18aefc.51bc2",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 300,
        "y": 1620,
        "wires": [
            [
                "7c46d3c4.c860ec"
            ],
            [
                "7e6d6425.8e04ac"
            ]
        ]
    },
    {
        "id": "7c46d3c4.c860ec",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 460,
        "y": 1580,
        "wires": [
            [
                "fe25289.77ed6d8"
            ]
        ]
    },
    {
        "id": "fe25289.77ed6d8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 620,
        "y": 1580,
        "wires": [
            [
                "2900348e.dea8cc"
            ]
        ]
    },
    {
        "id": "2900348e.dea8cc",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 735,
        "y": 1580,
        "wires": []
    },
    {
        "id": "7e6d6425.8e04ac",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 450,
        "y": 1640,
        "wires": [
            [
                "439da3bc.95e1dc"
            ]
        ]
    },
    {
        "id": "439da3bc.95e1dc",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 1640,
        "wires": [
            [
                "40b75a0f.d7adb4"
            ]
        ]
    },
    {
        "id": "40b75a0f.d7adb4",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 740,
        "y": 1640,
        "wires": [
            [
                "f3bffd26.80274"
            ]
        ]
    },
    {
        "id": "f3bffd26.80274",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 900,
        "y": 1640,
        "wires": []
    },
    {
        "id": "22711368.c2bf3c",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1075,
        "y": 1300,
        "wires": [
            [
                "7dcc91eb.ae87"
            ]
        ]
    },
    {
        "id": "4b092aa9.3f6174",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 290,
        "y": 1400,
        "wires": [
            [
                "6e965d22.745e24"
            ]
        ]
    },
    {
        "id": "1b9e5c8f.2b5153",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 155,
        "y": 1400,
        "wires": [
            [
                "4b092aa9.3f6174"
            ]
        ]
    },
    {
        "id": "98bd3fe8.c4eb5",
        "type": "FCF-facebook-node",
        "z": "",
        "botname": "PhoneBot"
    },
    {
        "id": "98d94233.f1991",
        "type": "FCF-DialogflowConfig",
        "z": "",
        "agentName": "AirConditioningBot"
    },
    {
        "id": "8bfe4fb9.6e799",
        "type": "FCF-DialogflowConfig",
        "z": "",
        "agentName": "ParkingBot"
    }
]

2018/6/18

Java讀檔、寫檔

最少行數的寫檔:
private static void writeUsingFiles(String data) {
        try {
            Files.write(Paths.get("/Users/pankaj/files.txt"), data.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
}

最少行數的讀檔:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

    public static void main(String[] args) throws IOException {
        String content = new String(Files.readAllBytes(Paths.get("duke.java")));
    }

參考:
讀檔:
http://www.adam-bien.com/roller/abien/entry/java_8_reading_a_file
寫檔:
https://www.journaldev.com/878/java-write-to-file

2018/6/17

於Netbeans的Spring Boot重新載入程式

之前用Servlet開發,只要有改程式它就會重新載入,就不用重新部署重新啟動
現在換到Spring Boot發現竟然不會自動重載程式,每次一改程式就要整個重新啟動
於是找到了以下的連結,教你怎麼讓他自動重載程式:
http://sanprojects.eu/blog/spring-boot-hotswapping-with-netbeans

2018/6/10

FCF-手機選購案例的Flow

[
    {
        "id":"5496536b.ed791c",
        "type":"FCF-facebook-receive",
        "z":"9fdb8a20.7c04d8",
        "bot":"d43caf60.461aa",
        "x":90,
        "y":160,
        "wires":[
            [
                "15cd9267.0a04de"
            ]
        ]
    },
    {
        "id":"15cd9267.0a04de",
        "type":"FCF-DataCollection",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":"請問你要什麼品牌",
                "topic2":"brand"
            },
            {
                "topic":"請問你預算多少",
                "topic2":"price"
            }
        ],
        "collect":"query",
        "x":280,
        "y":160,
        "wires":[
            [
                "d636c838.51bf18"
            ],
            [
                "e62c9a56.7fd688"
            ]
        ]
    },
    {
        "id":"d636c838.51bf18",
        "type":"FCF-Message",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "message":[

        ],
        "answer":false,
        "track":false,
        "parse_mode":"",
        "x":460,
        "y":120,
        "wires":[
            [
                "a49695f.5ecca68"
            ]
        ]
    },
    {
        "id":"a49695f.5ecca68",
        "type":"FCF-facebook-send",
        "z":"9fdb8a20.7c04d8",
        "bot":"d43caf60.461aa",
        "track":true,
        "outputs":1,
        "x":620,
        "y":120,
        "wires":[
            [
                "5307cb55.73b9d4"
            ]
        ]
    },
    {
        "id":"e62c9a56.7fd688",
        "type":"FCF-Frame",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":""
            }
        ],
        "name":"1",
        "token":"",
        "outputs":1,
        "x":460,
        "y":200,
        "wires":[
            [
                "6ba01cd8.7e8a64"
            ]
        ]
    },
    {
        "id":"6ba01cd8.7e8a64",
        "type":"FCF-PullService",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":""
            }
        ],
        "URL":"https://script.google.com/macros/s/AKfycbwLxGc9PIFVK79F4dYbnt0zOBkesEvzPn8VvSt6CxtU0RQu2g/exec",
        "outputs":1,
        "x":610,
        "y":200,
        "wires":[
            [
                "515cb02.2a24b5"
            ]
        ]
    },
    {
        "id":"515cb02.2a24b5",
        "type":"FCF-Frame",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":""
            }
        ],
        "name":"1",
        "token":"",
        "outputs":1,
        "x":760,
        "y":200,
        "wires":[
            [
                "b3f912b.d4275f"
            ]
        ]
    },
    {
        "id":"b3f912b.d4275f",
        "type":"FCF-Message",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "message":[
            ""
        ],
        "answer":false,
        "track":false,
        "parse_mode":"",
        "x":900,
        "y":200,
        "wires":[
            [
                "767684e9.91a16c"
            ]
        ]
    },
    {
        "id":"767684e9.91a16c",
        "type":"FCF-facebook-send",
        "z":"9fdb8a20.7c04d8",
        "bot":"d43caf60.461aa",
        "track":true,
        "outputs":1,
        "x":1060,
        "y":200,
        "wires":[
            [
                "2ff8e685.c26d3a"
            ]
        ]
    },
    {
        "id":"f13f1278.b11e4",
        "type":"FCF-KeywordExtraction",
        "z":"9fdb8a20.7c04d8",
        "agentCredentials":"15994b6e.a30be5",
        "outputs":1,
        "x":270,
        "y":240,
        "wires":[
            [
                "e62c9a56.7fd688"
            ]
        ]
    },
    {
        "id":"8f304000.4203f",
        "type":"FCF-DataCollection",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":"請問您的姓名是?",
                "topic2":"name"
            },
            {
                "topic":"請問您的電話是?",
                "topic2":"phone"
            }
        ],
        "collect":"userData",
        "x":260,
        "y":340,
        "wires":[
            [
                "afab121e.cd96b"
            ],
            [
                "5af7e5f6.9ae44c"
            ]
        ]
    },
    {
        "id":"afab121e.cd96b",
        "type":"FCF-Message",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "message":[
            ""
        ],
        "answer":false,
        "track":false,
        "parse_mode":"",
        "x":440,
        "y":300,
        "wires":[
            [
                "fe813dc.0132fc"
            ]
        ]
    },
    {
        "id":"fe813dc.0132fc",
        "type":"FCF-facebook-send",
        "z":"9fdb8a20.7c04d8",
        "bot":"d43caf60.461aa",
        "track":true,
        "outputs":1,
        "x":620,
        "y":300,
        "wires":[
            [
                "698d1187.bd9b3"
            ]
        ]
    },
    {
        "id":"5af7e5f6.9ae44c",
        "type":"FCF-Frame",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":""
            }
        ],
        "name":"",
        "token":"",
        "outputs":1,
        "x":430,
        "y":380,
        "wires":[
            [
                "71c4de3e.63505"
            ]
        ]
    },
    {
        "id":"71c4de3e.63505",
        "type":"FCF-PullService",
        "z":"9fdb8a20.7c04d8",
        "rules":[
            {
                "topic":""
            }
        ],
        "URL":"https://script.google.com/macros/s/AKfycbw9QggKKq1JWmztN77EetPqo2w_aJBQER7Db13D4oBtdDaym2w/exec",
        "outputs":1,
        "x":610,
        "y":380,
        "wires":[
            [
                "806472e2.41f9"
            ]
        ]
    },
    {
        "id":"806472e2.41f9",
        "type":"FCF-Message",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "message":[
            ""
        ],
        "answer":false,
        "track":false,
        "parse_mode":"",
        "x":780,
        "y":380,
        "wires":[
            [
                "c8fadff.3ea792"
            ]
        ]
    },
    {
        "id":"c8fadff.3ea792",
        "type":"FCF-facebook-send",
        "z":"9fdb8a20.7c04d8",
        "bot":"d43caf60.461aa",
        "track":false,
        "outputs":0,
        "x":940,
        "y":380,
        "wires":[

        ]
    },
    {
        "id":"f7a039cb.dffd28",
        "type":"link in",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "5307cb55.73b9d4"
        ],
        "x":135,
        "y":100,
        "wires":[
            [
                "15cd9267.0a04de"
            ]
        ]
    },
    {
        "id":"5307cb55.73b9d4",
        "type":"link out",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "f7a039cb.dffd28"
        ],
        "x":735,
        "y":120,
        "wires":[

        ]
    },
    {
        "id":"1f54dcb8.8e7603",
        "type":"link in",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "c2790c.9a1a06f8"
        ],
        "x":135,
        "y":280,
        "wires":[
            [
                "f13f1278.b11e4"
            ]
        ]
    },
    {
        "id":"c2790c.9a1a06f8",
        "type":"link out",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "1f54dcb8.8e7603"
        ],
        "x":1355,
        "y":160,
        "wires":[

        ]
    },
    {
        "id":"d5a46457.00c978",
        "type":"link in",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "698d1187.bd9b3",
            "127d20a0.79f2df"
        ],
        "x":135,
        "y":340,
        "wires":[
            [
                "8f304000.4203f"
            ]
        ]
    },
    {
        "id":"127d20a0.79f2df",
        "type":"link out",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "d5a46457.00c978"
        ],
        "x":1355,
        "y":240,
        "wires":[

        ]
    },
    {
        "id":"2ff8e685.c26d3a",
        "type":"FCF-Dispatcher",
        "z":"9fdb8a20.7c04d8",
        "agentCredentials":"15994b6e.a30be5",
        "rules":[
            {
                "topic":"returnPhoneBrand"
            },
            {
                "topic":"returnthePhoneItsGood"
            }
        ],
        "outputs":2,
        "x":1230,
        "y":200,
        "wires":[
            [
                "c2790c.9a1a06f8"
            ],
            [
                "127d20a0.79f2df"
            ]
        ],
        "outputLabels":[
            "2",
            ""
        ]
    },
    {
        "id":"698d1187.bd9b3",
        "type":"link out",
        "z":"9fdb8a20.7c04d8",
        "name":"",
        "links":[
            "d5a46457.00c978"
        ],
        "x":735,
        "y":300,
        "wires":[

        ]
    },
    {
        "id":"d43caf60.461aa",
        "type":"FCF-facebook-node",
        "z":"",
        "botname":"PhoneBot"
    },
    {
        "id":"15994b6e.a30be5",
        "type":"FCF-DialogflowConfig",
        "z":"",
        "agentName":"\bSmartphoneBuyBot"
    }
]

2018/6/4

Javascript的物件

覺得這篇寫得蠻好的
https://developer.mozilla.org/zh-TW/docs/Learn/JavaScript/Objects/Basics
常常對js物件中的dot notation與bracket notation感到陌生、不解

2018/6/2

於Ubuntu 18.04安裝nginx與php-fpm與phpmyadmin

安裝的nginx為1.14.0版
安裝的phpmyadmin為4.8.1版
安裝的php-fpm為7.2版

2018/5/31

灌ubuntu時的server name、user name、your name

每次灌ubuntu時都不知道這幾個的差別,但其實很好分,只是有時候還是會忘記

2018/5/22

取得DialogFlow v2 REST API的Authorization Token

自API.AI被Google買走變成DialogFlow後,有些API的資料格式變了,那這裡要寫的就是如何取得v2 REST API的Authorization Token

2018/5/5

Raspberry Pi 3 B+ Wifi設定

最近自己買了一塊最新的Raspberry Pi 3 model B+
那這裡來寫一下和分享一下我的wifi的設定和過程

2018/5/2

Javascript的var let const

未使用關鍵字宣告變數:全域變數,任何地方都存取得到
var:重新宣告會覆蓋前面的值,function與if作用域又不同
let:區域變數,作用範圍比var還小,不能在同個scope使用let關鍵字再次宣告同名稱的變數,否則會報錯,但var可以
const:用來定義常數,只能在定義時設定初值,之後就不能改變,但可以在定義時計算初值。如果把一個物件宣告成const,但此物件的屬性還是可以更改,因為物件只是參考

2018/3/20

Ubuntu Desktop RDP遠端桌面設置

這篇真的可以動
http://c-nergy.be/blog/?p=8952

如何改XRDP Port
https://askubuntu.com/questions/133343/how-do-i-set-up-xrdp-session-that-reuses-an-existing-session

如果用RDP遠端連進Ubuntu,發現Mate Terminal沒有ifconfig,下面這篇可以解決:
https://askubuntu.com/questions/433092/the-command-could-not-be-located-because-sbin-is-not-included-in-the-path-env

其他參考文章:
https://bit.ly/2zD0HYR
(此篇是真的讓遠端桌面可以成功連線) https://bit.ly/2AKl99L

2018-9-19更新:
因為Ubuntu 18.04出了,變成之前的很像都不一定可以用,因此這裡做個更新。
經過我實驗後,下面連結的教學文章是可以動的,只是還缺一個步驟
https://bit.ly/2NXC01x
就是連是連得進去,但會閃退!請在家目錄底下創造一個叫.xsession的檔案。
而因我在上面那篇教學文章中xfce4,所以.xsession檔案內容要寫xfce4-session,參考下圖:
然後再下這個指令:sudo chown username:username .xsession
那我使用者名稱是lab401,所以我就填sudo chown lab401:lab401 .xsession
這個步驟是參考這個網址:https://blog.csdn.net/u014447845/article/details/80291678

然後請重新開機
之後你就可以走你的3389port連進去了!
RDP預設就是3389也不用改,但連進去的時候還是要加port號:
因為我是裝在VM裡面,所以在Virual Box有轉port,所以才是4001,他內部還是走3389。

2018/3/17

Gitlab備份紀錄

最近把gitlab移植到新的Server花了蠻多時間,發現其實沒那麼容易,有一些眉眉角角的點在此紀錄一下。