- 下載MSYS2:
https://www.msys2.org/ - 安裝
- 程式開始執行後輸入:
pacman -Syu y y - 在安裝目錄底下找到msys2.exe,雙擊執行
- 輸入指令:
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
y - 加入環境變數:
C:\msys64\mingw64\bin - 打開cmd,輸入以下指令,測試是否安裝成功:
g++ --version
gdb --version
2021年7月23日 星期五
Go(Golang)程式語言 設定GCC
2020年8月26日 星期三
Go(Golang)程式語言語快速筆記
1. String字串(Str)
1.1. 字串String To 時間Time
str2Time, _ := time.Parse("2006-01-02 15:04:05.00000", "2020-08-26 08:00:00.00000")轉換結果, 錯誤訊息 := time.Parse("2006-01-02 15:04:05.00000", 目標字串)
1.2. 字串String To 整數Int
import ("strconv")str2Int, _ := strconv.Atoi(tgtInt)轉換結果, 錯誤訊息 := strconv.Atoi(目標字串)
1.3. 字串String To 32位元浮點數Float32
import ("strconv")str2Float32, _ := strconv.FormatFloat("1.23456", 'f', 2, 32)
轉換結果, 錯誤訊息 := strconv.FormatFloat(目標字串, 格式, 小數點後第幾位, 位元)
1.4. 字串String To 64位元浮點數Float64
import ("strconv")str2Float64, _ := strconv.FormatFloat("1.23456", 'f', 2, 64)
轉換結果, 錯誤訊息 := strconv.FormatFloat(目標字串, 格式, 小數點後第幾位, 位元)
2020年7月16日 星期四
Go(Golang)程式語言性能測試工具---pprof 1.安裝與設定篇(Graphviz)
安裝Graphviz
Graphviz官方網站:https://graphviz.org/
Step1. 連線至官網(https://graphviz.org/),點選下載(Download)。
|
|
|
Step2. 來到下載頁面,捲動滾輪往下來到Windows,選擇穩定版本(Stable Windows install packages)下載。
Step3.
接著你會來到一個階層目錄網頁,依照你的電腦作業系統版本下載對應的檔案。以我的電腦為例,作業系統是win10
64位原版本,因此我所選擇的目錄順序就會為Index of /Packages/stable/windows/
==> 10 ==> cmake ==> Release ==> x64 ==>
graphviz-install-2.44.1-win64.exe。
*note:這邊補充說明,一開始我下載的是2.44版本,不知道為什麼一直裝不起來,最後成功運行的版本是2.38,官網似乎已經將2.38的64位元版本移除。2.38版本檔案的備用連結
Step4. 雙擊安裝程式(graphviz-2.38.msi),開始安裝,點擊下一步(Next)。
Step5. 使用程式的預設即可,要記得你的安裝位置(C:\Program Files (x86)\Graphviz2.38\),等等新增環境變數會需要使用到。沒有問題後就點擊下一步(Next)。
Step6. 開始安裝前的最後確認,但是好像也沒有什麼資訊需要double
check,所以就直接點擊下一步(Next)。
Step7.
接下來程式就會自己開始安裝,安裝速度很快,過程少於一分鐘就完成了。
Step8.
看到這個畫面代表程式已經成功安裝完成,點選關閉(Close)。接著我們就需要替Graphviz設定環境變數。
Graphviz環境變數設定
Step1. 開啟檔案總管,對著本機按右鍵,然後點選內容,開啟系統控制台。
Step2. 點選進階系統設定。
Step3. 點選環境變數。
Step4. 從系統變數(下面那欄)中找到Path,點一下,然後點選編輯。
Step5. 點選新增,接著輸入Graphviz的安裝位置,安裝位置為『"Graphviz安裝位置"\bin』。因為我們是使用系統預設的安裝路徑,因此這裡填入C:\Program Files (x86)\Graphviz2.38\bin。接著點選確定。這樣就完成了Graphviz的環境變數設定了!
運行pprof測試工具(以CPU執行時間測試為例)
Step1. 開啟VSCode編譯器,並在終端機輸入以下指令,然後按下Enter,就會開始運行程式並記錄CPU執行每段程式的耗費時間。
go test -bench=. -benchtime=3s -cpuprofile=cpu"."out ./
Step2.
等到程式執行完成後,會顯示此次測試共耗費了224.626秒。接著在終端機輸入以下指令並按下Enter,就會以視覺化的方式,呈現每段代碼CPU所執行的耗費時間。
go tool pprof -http=:8080 cpu.out
結論
這篇文章中,我們介紹了pprof的安裝(Graphviz)與設定,並且以CPU為例,簡單展示使用的結果。因此可以總結為下列幾個重點。
1.下載並安裝Graphviz(https://graphviz.org/)
2.設定Graphviz環境變數(C:\Program Files (x86)\Graphviz2.38\bin)
3.測試並查看結果
//測試 go test -bench=. -benchtime=3s -cpuprofile=cpu"."out ./ //查看結果 go tool pprof -http=:8080 cpu.out
2019年1月31日 星期四
Go(Golang)程式語言的介紹與安裝(Window作業系統)與環境設定
Go語言簡介
維基百科上對於Go語言的描述如下(https://zh.wikipedia.org/wiki/Go):
Go(又稱Golang)是Google開發的一種靜態強型別、編譯型、並發型,並具有垃圾回收功能的程式語言。
羅伯特·格瑞史莫,羅勃·派克(Rob Pike)及肯·湯普遜於2007年9月開始設計Go,稍後Ian Lance Taylor、Russ Cox加入專案。Go是基於Inferno作業系統所開發的。Go於2009年11月正式宣布推出,成為開放原始碼專案,並在Linux及Mac OS X平台上進行了實現,後來追加了Windows系統下的實現。在2016年,Go被軟體評價公司TIOBE 選為「TIOBE 2016 年最佳語言」。目前,Go每半年發布一個二級版本(即從a.x更新到a.y)。
大神們的廬山真面目:
![]() |
| 羅伯特·格瑞史莫 |
![]() |
| 羅勃·派克 |
![]() |
| 肯·湯普遜 |
2018年9月24日 星期一
如何更改Visual Studio Code(VSCode) 介面語言
顯示語言
在一班情況下,Vsiual Studio Code(VSCode) 安裝完成後為英語版本,當然它也附有其他九種語言,分別是:英文(美國)、簡體中文、繁體中文、法文、德文、義大利文、日文、韓文、俄文、西班牙文。各個語言與其代碼對照如下表:
| Display Language | Locale |
|---|---|
| English (US) | en |
| Simplified Chinese | zh-CN |
| Traditional Chinese | zh-TW |
| French | fr |
| German | de |
| Italian | it |
| Spanish | es |
| Japanese | ja |
| Korean | ko |
| Russian | ru |
| Bulgarian | bg |
| Hungarian | hu |
| Portuguese (Brazil) | pt-br |
| Turkish | tr |
2018年3月20日 星期二
Golang問題集---在mac環境下使SQLite時編譯器報錯(Xcode/iOS license)
Golang問題---在mac環境下使用SQLite時編譯器報錯
錯誤訊息:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.2018年3月9日 星期五
Keras:MNIST手寫數字辨識資料集介紹
MNIST手寫數字辨識資料集
MNIST手寫數字辨識資料集,是由Yann LeCun(揚·勒丘恩)大神所蒐集,這位大神同時也是Convulution Nueral Networks(卷積神經網絡)的創始人,因此享有"卷積網絡之父"的美譽。關於這位大神的事蹟在維基百科上有詳細的介紹,再者裡就不在多做闡述。由於MNIST的資料大小適中,而且皆為單色影像(黑字白底),十分適合做為初學者第一個建立模型、訓練、與預測的資料集。
2017年5月9日 星期二
老地方牛肉麵(忠孝東路三段)
今天是系上去資策會數位教育研究所的參訪,參訪結束的時間剛好是中餐,因此前一天就在家裡事前先尋找那附近有什麼美食。找著找著就看到了google map上評分4.1的老地方牛肉麵,剛好離參訪地點也不是太遠(走路約6分鐘),因此就決定在今天去光顧了~~~
具體的位置如下圖:
2015年1月29日 星期四
java程式設計題目---字母處理【大寫轉小寫小寫轉大寫】
Write the following method that returns a new string in which the uppercase are changed to lowercace and lowercace to uppercase.
EX: enter: aBcD ,output: AbCd。
EX: enter: aBcD ,output: AbCd。
2015年1月19日 星期一
java程式設計題目---數字處理【座標最短距離與座標】
設計一程式,提示使用者輸入座標點數,再依序輸入所有點的二為座標(x,y)。
(a)找出點之間的最短座標。
(b)找出是那些點之間的最短距離。
例如:
輸入: 輸出:
輸入座標點數:3 最短距離:2.00
依序輸入3個座標x、y: 那些點之間距離最短:
0 3 (1,0);(3,0)
1 0
3 0
(a)找出點之間的最短座標。
(b)找出是那些點之間的最短距離。
例如:
輸入: 輸出:
輸入座標點數:3 最短距離:2.00
依序輸入3個座標x、y: 那些點之間距離最短:
0 3 (1,0);(3,0)
1 0
3 0
java程式設計題目---數字處理【十六進位轉二進位】
設計一程式,提示使用者輸入一16進位數字,將該16進位數字轉為對應的2進位數字。使用字元"1"或"0"每四個空一格的方式從螢幕輸出。
例如:輸入123F5,輸出:0001 0011 1111 0101。
例如:輸入123F5,輸出:0001 0011 1111 0101。
2014年12月27日 星期六
java程式設計題目---數字處理【雙生質數(使用method)】
Twin primes(雙生質數) are a pair of prime numbers that differ by 2. For example, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 are twin primes. Write a program to find all twin primes less than 1,000. Display the output as follows:
(3,5)
(5,7)
...
(3,5)
(5,7)
...
java程式設計題目---公式計算【梅森質數(使用method)】
A prime number is called a Mersenne prime(梅森質數) if it can be written in the form 2^p-1 for some positive integer p.
Write a program that finds all Mersenne prime with p<=31 and displays the output as follows:
p 2^p-1
2 3
3 7
5 31
...
Write a program that finds all Mersenne prime with p<=31 and displays the output as follows:
p 2^p-1
2 3
3 7
5 31
...
2014年12月26日 星期五
java程式設計題目---數字處理【迴文質數判斷(使用method)】
A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Display 10 numbers line, separated by exactly one space, as follows:
2 3 5 7 11 101 131 151 181 191
313 353 373 383 727 757 787 797 919 929
2 3 5 7 11 101 131 151 181 191
313 353 373 383 727 757 787 797 919 929
java程式設計題目---數字處理【迴文判斷(使用method)】
Write the methods with the following headers:
public static int reverse(int number)
public static Boolean isPalindrome(int number)
Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.
public static int reverse(int number)
public static Boolean isPalindrome(int number)
Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.
java程式設計題目---數字處理【數值反轉(使用method)】
Write a method with the following header to display an interger in reverse order:
public static int reverse(int number)
For example, reverse(3456) displays 6543. Write a test program that promotes the user to enter an integer and displays its reversal.
public static int reverse(int number)
For example, reverse(3456) displays 6543. Write a test program that promotes the user to enter an integer and displays its reversal.
java程式設計題目---字母處理【輸出字母、換行(使用method)】
Write a method that prints characters using the following header:
public static void printChars(char ch1, char ch2, int numberPerLine)
This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program the prints ten characters per line from 1 to Z. Character are separated by exactly one space.
public static void printChars(char ch1, char ch2, int numberPerLine)
This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program the prints ten characters per line from 1 to Z. Character are separated by exactly one space.
java程式設計題目---圖形繪製【使用2的n次方印三角形(使用method)】
Write a method to display a pattern as follows:
1
1 2
1 2 4
1 2 4 8
...
1 2 4 8 ....
The method header is
public static void displayPattern(int n)
1
1 2
1 2 4
1 2 4 8
...
1 2 4 8 ....
The method header is
public static void displayPattern(int n)
java程式設計題目---數字處理【由大到小排序(使用method)】
Write a method with the following header to display three numbers in decreasing order:
public static void displaySortedNumbers(double num1, double num2, double num 3)
Write a test program that prompts the user to enter three numbers and invokes the method to display them in decreasing order.
public static void displaySortedNumbers(double num1, double num2, double num 3)
Write a test program that prompts the user to enter three numbers and invokes the method to display them in decreasing order.
java程式設計題目---公式計算【判斷一年有幾天(使用method)】
Write a method that returns the number of days in a year using the following header:
public static int numberOfDaysInAYear(int year)
Write a test program that displays the number of days in year from 2000 to 2020.
public static int numberOfDaysInAYear(int year)
Write a test program that displays the number of days in year from 2000 to 2020.
訂閱:
文章 (Atom)
Go(Golang)程式語言 設定GCC
下載MSYS2: https://www.msys2.org/ 安裝 程式開始執行後輸入: pacman -Syu y y 在安裝目錄底下找到msys2.exe,雙擊執行 輸入指令: pacman -Su pacman -S --needed base-devel mingw-...
-
MNIST手寫數字辨識資料集 MNIST手寫數字辨識資料集 ,是由 Yann LeCun(揚·勒丘恩) 大神所蒐集,這位大神同時也是Convulution Nueral Networks(卷積神經網絡)的創始人,因此享有"卷積網絡之父"的美譽。關於這位大...
-
顯示語言 在一班情況下, Vsiual Studio Code (VSCode) 安裝完成後為英語版本,當然它也附有其他九種語言,分別是:英文(美國)、簡體中文、繁體中文、法文、德文、義大利文、日文、韓文、俄文、西班牙文。各個語言與其代碼對照如下表: Display ...
-
第一章 二、效能與效率有何區別 ? 效能 : 作對的事情 效率 : 把事情做對 五、管理程序包括哪四項管理職能 ? 規劃、組織、領導、控制 六、管理者所扮演的色有哪些 ? 人際角色 : 頭臉人物、領導者、聯絡人 資訊角色 : 監控者、傳播者、發言人...

















