2018年10月31日 星期三

CentOS 7 note

1. no network connection

Find Necessary configuration file in following path
cd /etc/sysconfig/network-scripts/

Name: ifcfg-enp0s3 (maybe.... or other names)

change content:
DNS1=8.8.8.8
DNS2=8.8.4.4
# Note this was set to no
ONBOOT=yes

Then:
service network restart

sudo yum update

sudo yum install net-tools

2. how to use bridge????

2018年4月26日 星期四

Git To GitHub SSH



產生ssh  用來從command line快速登入  github

目的: 本機可以快速登入  github  這樣就不用每次都還要輸入帳密來登入了...


在 Git Bash 或是  Cmder 裡面....
執行  ls -al ~/.ssh


好吧來生成key
執行  ssh-keygen
這樣就會生成key

看key的內容
執行 cat ~/.ssh/id_rsa.pub

準備複製key的內容,貼到 Github...  SSH and GPG keys
登入Github後右上方人頭旁間有倒立三角型,按下後選 Setting
左邊選單SSH and GPG keys 
會看到右邊綠色按鈕,New SSH Key
把   cat ~/.ssh/id_rsa.pub  查到的內容全部貼上

嘗試登入
ssh -T git@github.com
然後輸入一次帳密,就再也不用輸入囉


Reference:

https://git-scm.com/book/zh-tw/v1/%E4%BC%BA%E6%9C%8D%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%96%8B%E9%87%91%E9%91%B0


http://trunk-studio.com/blog/ssh-for-windows/

2018年4月25日 星期三

Sublime Text 3 Syntax HTML Missing


Check:
1. View ===>  Syntax
2. Click on Right-Bottom Text .....will show the syntax you got

If your syntax does not exist.... html in my case

check your package folder if html.sublime-package exist

if not, just copy it from somewhere.

Then you will have it again!!!!


2018年4月24日 星期二

MongoDB fast tutorial for windows



1. Download Mongodb
2. During installation, uncheck : install MongoDB Compass  因為會卡住
3. Set Path eg:  C:\mongodb\bin\    Then you can execute   mongo.exe and mongod.exe
4. Set up a MongoDB data folder.  eg: C:\mongodata\
5. In the cmd, execute: mongod --dbpath C:\mongodata\    啟動mongodb  這樣畫面不關就是啟動
6. New a batch file: execute : mongo 127.0.0.1:27017/admin  用管理員權限登入 mongoDB
7. Execute this batch. you can get in mongodb

可以在batch檔加入:
mongod --dbpath C:\mongodata\      啟動資料庫與指定位置
mongo 127.0.0.1:27017/admin        進入互動介面

2018年3月18日 星期日

Laravel Composer Windows PhpStorm


OS: Win 10
Server: nginx

Php Version: Php 7.2.3

Composer: Laravel Management Program


Composer 安裝套件先安裝


Laravel 安裝與設定方法

建立專案   如果專案名空白就預設laravel  下面專案名是 wow
composer create-project laravel/laravel wow --prefer-dist

下載Xdebug 要對應php的版本
下載
參考說明

在 php.ini 最下面加入以下設定    注意 如果資料夾名稱有 () 將會導致錯誤
=============================
[Xdebug]
zend_extension=C:/code/nginx/php_xdebug-2.6.0-7.2-vc15-nts-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
=============================
在.../Php/中執行  
php -v

C:\Program Files (x86)\PHP
$ php -v
PHP 7.2.3 (cli) (built: Feb 28 2018 05:48:02) ( NTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
   with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans


另外一種建立專案方法:
使用PhpStorm

1. 先確定 PhpStorm的設定
Files ==>  Settings ==>  Languages & Frameworks ==> PHP
確定CLI interpreter 設定
可點進去確認
裡面也可以設定xdebug






2. 新增專案
File ==> New Project ==> Composer Project  ==> Filter package 找到 laravel/laravel
然後改 Location的名稱後,就可以按下create了




之後可以加入 GIT



啟動Server 方式

直接點選 index.php 滑鼠右鍵,Run index.php

或是在nginx 上面啟動
依照正常的nginx啟動 php方式啟動,但是記得要在設定檔修改路徑成為你要啟動的 Laravel 的public 資料夾 (預設的 index.php)
例如:
root C:\Users\XXXXXX\PhpstormProjects\Laravel01\public;

然後就可以正常啟動囉.......




2018年3月17日 星期六

Nginx + PHP + Windows


=======================
PHP5

OS: Windows 10 Home

download  nginx (windows)
https://nginx.org/en/download.html

download php5  (stable)
https://windows.php.net/download#php-5.6

Key: 如何連結 nginx 與 php5 ?

Php5 :  利用 php-cgi.exe 執行以下命令
php-cgi -b 9000

nginx: 設定檔修改   /conf/nginx.conf

1. 將以下的code 前面的 #  移除,使他們不再是註解
2. 修改  fastcgi_param 參數中的  /scripts   改為 $document_root


location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


在nginx.exe 目錄下執行以下命令  例如C:\code\nginx\nginx-1.12.2
start nginx

如果要重讀取設定檔
nginx -s reload

如果要停止server     
nginx -s stop


參考
http://nginx.org/en/docs/windows.html



=======================
PHP7

download php7  (stable)
https://windows.php.net/download#php-7.2

如上

=======================

可能問題
nginx 可能多重啟動,所以不能確定是跑那一個!?




砍光,重啟才能確定。


2018年2月23日 星期五

CentOS Linux HOW to install sublime 3 如何安裝

Time: 2018/2/24

===================================
進入Downloads目錄,準備下載

$ cd ~/Downloads

===================================
下載檔案

## On 32bit
$ wget https://download.sublimetext.com/sublime_text_3_build_3143_x32.tar.bz2

## On 64bit
$ wget https://download.sublimetext.com/sublime_text_3_build_3143_x64.tar.bz2

===================================
解壓縮到指定目錄

## On 32bit
$ sudo tar -vxjf sublime_text_3_build_3143_x32.tar.bz2 -C /opt
## On 64bit
$ sudo tar -vxjf sublime_text_3_build_3143_x64.tar.bz2 -C /opt

===================================
設定指令(sublime3)與檔案的連結( /usr/bin/sublime3 前面有空格)

# sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime3

===================================
可以執行了....
$ sublime3

===================================

設為桌面?
$ sudo sublime3 /usr/share/applications/sublime3.desktop

===================================
以下內容放入剛剛開啟的檔案

[Desktop Entry]
Name=Sublime3
Exec=sublime3
Terminal=false
Icon=/opt/sublime_text_3/Icon/48x48/sublime-text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

===================================
安裝套件
https://packagecontrol.io/installation



將以下內容執行後,就可以開始安裝套件
-------------------------------------------------------------------
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
-------------------------------------------------------------------

完成安裝後, Ctrl + Shift + P    然後輸入 install 選擇 Package Control: Install Package 後
就可以開始安裝套件



===================================
推薦套件

git
emmet
Alignment
GitGutter
ColorPicker
SublimeLinter



===================================

參考:



2017年7月8日 星期六

Windows 7 + Ubuntu 雙硬碟系統 出現 error: unknown filesystem. grub rescue>

Windows 7 + Ubuntu 雙硬碟系統  出現

error: unknown filesystem.
grub rescue>

裝備:  硬碟一  Win 7   硬碟二   Ubuntu 14
目的:  要拆除硬碟二,然後使硬碟一可以正常開機,不會出現 grub rescue>
處理:

使用隨機版的Win 7 修復光碟(可以開機,只有一片)

進入後想辦法進去  console命令提示字元
執行以下兩命令
bootrec /fixmbr
bootrec /fixboot

重新開機後就會刪除原本的grub menu選單,這樣就不會出現找不到ubuntu硬碟區域的錯誤。

但是也無法使用ubuntu開機了  = =!

參考
http://www.ha97.com/3960.html

2017年6月13日 星期二

jQuery datepicker change position 改變位置


原本是自動調整上下,
改成只顯示在下面:

https://stackoverflow.com/questions/3474018/how-to-set-the-show-position-of-datepicker


在ready裡面新增 beforeShow方法

 $('.datetime').datepicker({
     dateFormat: 'm/d/yy',
     beforeShow: function (input, inst) {
         var offset = $(input).offset();
         var height = $(input).height();
         window.setTimeout(function () {
             inst.dpDiv.css({ top: (offset.top + height + 4) + 'px', left: offset.left + 'px' })
         }, 1);
     }

 });

改變位置範例

http://2008.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerPosition.html

2017年6月7日 星期三

JavaScript and jQuery Get Radio Value 如何取值

JavaScript Get Radio Value 如何取值?

另外加上JQuery的取法~

Html:

<input type="radio" name = myRadio value="Get One">
<input type="radio" name = myRadio value="Get TWO">


Javascript:
         var wow= document.getElementsByName("myRadio ");
         for(var i = 0;i<wow.length;i++) {
            if(wow[i].checked) {
            alert(wow[i].value);
            }
         }
       }

jQuery:

$('input[name=myRadio]').val()

範例:
https://api.jquery.com/checked-selector/

2017年6月5日 星期一

Machine Learning Resource 機器學習人工智慧人工智能 資源




NTUEE ML 2016
https://www.youtube.com/playlist?list=PLJV_el3uVTsPy9oCRY30oBPNLCo89yu49
李宏毅28 videos53,870 viewsLast updated on Mar 25, 2017
課程網頁: http://speech.ee.ntu.edu.tw/~tlkagk/courses_ML16.html


NTUEE MLDS 2017
https://www.youtube.com/playlist?list=PLJV_el3uVTsPMxPbjeX7PicgWbY7F8wW9
李宏毅12 videos10,313 viewsUpdated yesterday
這門課的全名是 Machine Learning and having it Deep and Structured ,銜接 Machine Learning (https://www.youtube.com/watch?v=fegAeph9UaA&list=PLJV...) 這門課,目標是要深度學習深度學習 課程網頁: http://speech.ee.ntu.edu.tw/~tlkagk/courses_MLDS17.html



Dr. Fei Fei Li of Stanford's Artificial Intelligence Lab
Innovate and Celebrate 2016
https://www.youtube.com/watch?v=IXxh5C9iKFE



《硅谷财经圈》科技钱缘:人工智能和深度学习 By DingDingTV
https://www.youtube.com/watch?v=xaq7CVlHTwU



基礎
線性代數    電機系 蘇柏青
http://ocw.aca.ntu.edu.tw/ntu-ocw/index.php/ocw/cou/102S207

線性代數    趙啟超
http://ocw.nthu.edu.tw/ocw/index.php?page=course&cid=89

線性代數   應用數學系 莊重老師
http://ocw.nctu.edu.tw/course_detail_3.php?bgid=1&gid=1&nid=271#.WTVY8mh95EZ

2017年5月12日 星期五

Macbook air terminal sublime set shortcut

在蘋果電腦上面自己設定sublime的終端畫面terminal捷徑 shortcut

Using Linux command:  ln

ln  {parameter} {Original Path} {Destination Path}

ln -s "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl


Note: 

1. You can have your own preference. 

For example: subl3 or subccc.... etc. 名稱可以任意決定

 2. Be careful the app name. Sometimes is not Sublime Text.app.

2017年4月7日 星期五

Git note



1. Install git

2. git config

3. git status

add new folder and file

git status

git add .  (add all files and folders in the folder into index.)     (將新檔案加入索引index)

git commit -m "message"   (將新增的索引,儲存到數據庫 repo)




git log
commit b32578e2b93c6b1f17502363e00cbe22a74e30ba
Author: spyspy <spyhopping101@gmail.com>
Date:   Sat Apr 8 06:07:39 2017 +0800

    wow













2017年2月16日 星期四

Hot Key Shortcut Encyclopedia快捷鍵大全 Sublime Notepad ++ Eclipse Visual Studio Code Atom

Hot Key Shortcut Encyclopedia快捷鍵大全

關鍵字

Multi-cursor and selection

Sublime 快捷鍵 Hot Key Shortcut
Ctrl + G    go to a line  跳到某一行(輸入行數)
Ctrl + P    search for file name 搜尋檔案名稱
Ctrl + SHIFT + F   全檔案檢索
Ctrl + SHIFT + P    Package Control  安裝插件要用的
Ctrl + X   Cut line
Ctrl + ↩   Insert line after   在下一行插入一行
Ctrl + ⇧ + ↩    Insert line before   在上一行插入一行

Official Doc 官方文件
http://docs.sublimetext.info/en/latest/reference/keyboard_shortcuts_win.html

Column Selection:
Windows
Right Mouse Button + Shift  OR: Middle Mouse Button
直線部分選取


Add to selection: 滑鼠左鍵(可以滑動選取) + Ctrl   多重選取    




Subtract from selection: Alt
沒有實驗出來

https://www.sublimetext.com/docs/2/column_selection.html

Notepad ++

Multiple Selection:
Alt + Mouse dragging or
Alt + Shift + Arrow keys

Official Doc 官方文件
https://notepad-plus-plus.org/features/column-mode-editing.html



Visual Studio Code
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

局部方塊選取  
1. shift + alt + mouse right  
2. ctrl +  shift + alt + the arrow keys.
Selecting Columns in VS Code
http://superuser.com/questions/1052795/selecting-columns-in-vs-code

vscode 插件推荐 - 献给所有前端工程师(更新与2017.3.6)
https://segmentfault.com/a/1190000006697219

vscode editors
https://code.visualstudio.com/docs/editor/codebasics

General
Ctrl+Shift+P, F1 Show Command Palette
Ctrl+P Quick Open
Ctrl+Shift+N New window/instance
Ctrl+Shift+W Close window/instance

Basic editing
Ctrl+X Cut line (empty selection)
Ctrl+C Copy line (empty selection)
Alt+ ↑ / ↓ Move line up/down
Shift+Alt + ↓ / ↑ Copy line up/down
Ctrl+Shift+K Delete line
Ctrl+Enter Insert line below
Ctrl+Shift+Enter Insert line above
Ctrl+Shift+\ Jump to matching bracket
Ctrl+] / [ Indent/outdent line Home Go to beginning of line End Go to end of line
Ctrl+Home Go to beginning of file
Ctrl+End Go to end of file
Ctrl+↑ / ↓ Scroll line up/down
Alt+PgUp / PgDown Scroll page up/down
Ctrl+Shift+[ Fold (collapse) region
Ctrl+Shift+] Unfold (uncollapse) region
Ctrl+K Ctrl+[ Fold (collapse) all subregions
Ctrl+K Ctrl+] Unfold (uncollapse) all subregions
Ctrl+K Ctrl+0 Fold (collapse) all regions
Ctrl+K Ctrl+J Unfold (uncollapse) all regions
Ctrl+K Ctrl+C Add line comment
Ctrl+K Ctrl+U Remove line comment
Ctrl+/ Toggle line comment
Shift+Alt+A Toggle block comment
Alt+Z Toggle word wrap

Navigation
Ctrl+T Show all Symbols
Ctrl+G Go to Line... Ctrl+P Go to File...
Ctrl+Shift+O Go to Symbol...
Ctrl+Shift+M Show Problems panel F8 Go to next error or warning
Shift+F8 Go to previous error or warning
Ctrl+Shift+Tab Navigate editor group history
Alt+ ← / → Go back / forward
Ctrl+M Toggle Tab moves focus

Search and replace
Ctrl+F Find
Ctrl+H Replace
F3 / Shift+F3 Find next/previous
Alt+Enter Select all occurences of Find match
Ctrl+D Add selection to next Find match
Ctrl+K Ctrl+D Move last selection to next Find match
Alt+C / R / W Toggle case-sensitive / regex / whole word

Multi-cursor and selection 
Alt+Click Insert cursor
Ctrl+Alt+ ↑ / ↓ Insert cursor above / below
Ctrl+U Undo last cursor operation
Shift+Alt+I Insert cursor at end of each line selected
Ctrl+I Select current line
Ctrl+Shift+L Select all occurrences of current selection
Ctrl+F2 Select all occurrences of current word
Shift+Alt+→ Expand selection
Shift+Alt+← Shrink selection
Shift+Alt + (drag mouse) Column (box) selection
Ctrl+Shift+Alt + (arrow key) Column (box) selection
Ctrl+Shift+Alt +PgUp/PgDown Column (box) selection page up/down

Rich languages editing
Ctrl+Space Trigger suggestion
Ctrl+Shift+Space Trigger parameter hints Tab Emmet expand abbreviation
Shift+Alt+F Format document
Ctrl+K Ctrl+F Format selection F12 Go to Definition
Alt+F12 Peek Definition
Ctrl+K F12 Open Definition to the side
Ctrl+. Quick Fix Shift+F12 Show References F2 Rename Symbol
Ctrl+Shift+ . / , Replace with next/previous value
Ctrl+K Ctrl+X Trim trailing whitespace
Ctrl+K M Change file language

Editor management
Ctrl+F4, Ctrl+W Close editor
Ctrl+K F Close folder
Ctrl+\ Split editor
Ctrl+ 1 / 2 / 3 Focus into 1 st, 2nd or 3rd editor group
Ctrl+K Ctrl+ ←/→ Focus into previous/next editor group
Ctrl+Shift+PgUp / PgDown Move editor left/right
Ctrl+K ← / → Move active editor group

File management 
Ctrl+N New File Ctrl+O Open File...
Ctrl+S Save
Ctrl+Shift+S Save As...
Ctrl+K S Save All
Ctrl+F4 Close
Ctrl+K Ctrl+W Close All
Ctrl+Shift+T Reopen closed editor
Ctrl+K Enter Keep Open Ctrl+Tab Open next Ctrl+Shift+Tab Open previous
Ctrl+K P Copy path of active file
Ctrl+K R Reveal active file in Explorer
Ctrl+K O Show active file in new window/instance

Display 
F11 Toggle full screen
Shift+Alt+1 Toggle editor layout
Ctrl+ = / - Zoom in/out
Ctrl+B Toggle Sidebar visibility
Ctrl+Shift+E Show Explorer / Toggle focus
Ctrl+Shift+F Show Search
Ctrl+Shift+G Show Git
Ctrl+Shift+D Show Debug
Ctrl+Shift+X Show Extensions
Ctrl+Shift+H Replace in files
Ctrl+Shift+J Toggle Search details
Ctrl+Shift+C Open new command prompt/terminal
Ctrl+Shift+U Show Output panel
Ctrl+Shift+V Toggle Markdown preview
Ctrl+K V Open Markdown preview to the side Debug
F9 Toggle breakpoint
F5 Start/Continue
Shift+F5 Stop
F11 / Shift+F11 Step into/out F10 Step over
Ctrl+K Ctrl+I Show hover

Integrated terminal
Ctrl+` Show integrated terminal
Ctrl+Shift+` Create new terminal
Ctrl+Shift+C Copy selection
Ctrl+Shift+V Paste into active terminal
Ctrl+↑ / ↓ Scroll up/down
Shift+PgUp / PgDown Scroll page up/down
Ctrl+Home / End Scroll to top/bottom Keyboard shortcuts for Windows Other operating systems’ keyboard shortcuts and additional unassigned shortcuts available at aka.ms/vscodekeybindings



Eclipse 



Atom