> For the complete documentation index, see [llms.txt](https://zhang699-2.gitbook.io/note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zhang699-2.gitbook.io/note/shang-wei-zheng-li.md).

# 尚未整理

## Google Stack Driver logging

在未使用Docker 與 GCP 的時候，裸上nodejs 可以使用到GCP 的 log console

{% embed url="<https://cloud.google.com/logging/docs/setup/nodejs?hl=zh-tw>" %}

## Docker

Different with VM

* <https://docs.docker.com/get-started/#a-brief-explanation-of-containers>

MAC

* <https://store.docker.com/editions/community/docker-ce-desktop-mac>

Ubuntu

* <https://philipzheng.gitbooks.io/docker_practice/content/install/ubuntu.html>

## HTML Canvas

* BeginPath to refresh previous moveTo
* FillStyle to setup color
* stroke to draw the line
* draw circle in canvas by using arc(x, y, radius, startAngle, endAngle)
  * <https://www.w3schools.com/tags/canvas_arc.asp>
* use Time variable to make animation in canvas
* Draw a circle by connecting each two points as a line
* References
  * <https://www.youtube.com/watch?v=fVAE28YTCMs>

## Swagger

swagger-node, create template project of node

swagger-ui

swagger-mock

describe response's property as null result to avoid **Fail to schema validation problem**

![](https://1017997441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfNCl-wVfadiT_RYx9b%2F-LfNCnod-7k9QKNb1EC-%2F-LfNCpHO9ccv3M7LJFg8%2F%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-06-21%20%E4%B8%8B%E5%8D%888.37.18.png?generation=1558405666877492\&alt=media)

Add Authorize in Swagger API

1. Write Swagger Spec as following:![](https://1017997441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfNCl-wVfadiT_RYx9b%2F-LfNCnod-7k9QKNb1EC-%2F-LfNCpHQY0fhHepd2FKv%2F%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-06-26%20%E4%B8%8B%E5%8D%8810.26.03.png?generation=1558405666836133\&alt=media)
2. Declare security need inside API's schema

   ![](https://1017997441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfNCl-wVfadiT_RYx9b%2F-LfNCnod-7k9QKNb1EC-%2F-LfNCpHShsOkJ08E8Zuv%2F%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-06-26%20%E4%B8%8B%E5%8D%8810.26.16.png?generation=1558405666830150\&alt=media)
3. Prepare swaggerSecurityHeandlers and verified API there
4. ```
   var config = {
     appRoot: __dirname, // required config
     swaggerSecurityHandlers: {
       Bearer: function (req, authOrSecDef, scopesOrApiKey, callback) {
         console.warn('apiKey', scopesOrApiKey);
         if (scopesOrApiKey === TOKEN) {
           callback();
         } else {
           callback(new Error('API Key not matched'))
         }
       },
     },
   };
   ```

## Ideas

MapFriends

* 以看到事件距離自己目前地點的距離收費，e.g. 1km 的半徑免費 以上收費
* 要以聲音進行溝通，無文字
* 可以上傳大頭貼與FB/Google 登入 或匿名
* 匿名如何建立事件？ 必須留email ?
* Disable file cache.

`/etc/nginx/nginx.conf`

`sendfile off`

### Stored Bitbucket password not updated

`remote: Too many invalid password attempts. Try logging in through the website with your password.`

`fatal: unable to access 'https://zhang699@bitbucket.org/zhang699/rotan.git/': The requested URL returned error: 403`

Solution: Update MAC's KeyChain

![](https://1017997441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfNCl-wVfadiT_RYx9b%2F-LfNCnod-7k9QKNb1EC-%2F-LfNCpHUha7jVhoiNKRw%2F%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-04-01%20%E4%B8%8A%E5%8D%881.24.26.png?generation=1558405666919448\&alt=media)
