Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pj-99 committed Sep 30, 2024
1 parent 161e5f6 commit 05695e8
Show file tree
Hide file tree
Showing 22 changed files with 552 additions and 79 deletions.
48 changes: 38 additions & 10 deletions about/index.html

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions blog/go/go_channels/index.html

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions blog/index.html

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions blog/index.xml

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions categories/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion categories/index.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PJ's Site – Categories</title><link>https://pj-99.github.io/categories/</link><description>Recent content in Categories on PJ's Site</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://pj-99.github.io/categories/index.xml" rel="self" type="application/rss+xml"/></channel></rss>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PJ's Blog – Categories</title><link>https://pj-99.github.io/categories/</link><description>Recent content in Categories on PJ's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://pj-99.github.io/categories/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

Large diffs are not rendered by default.

This file was deleted.

2 changes: 1 addition & 1 deletion en.search-data.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"/about/":{"data":{"":"This is the about page."},"title":"About"},"/posts/":{"data":{"":"隨手紀錄。"},"title":"Posts"}}
{"/about/":{"data":{"":"","#":"About me I like milk tea.\nSome experience developing Android apps and Unity games Currently learning Go Education Master’s in Computer Science, National Chengchi University (2023 - Present)\nMember of NCCU Software Engineering Lab Bachelor’s in Interdisciplinary Program of Technology and Art, National Tsing Hua University (2019 - 2023)\nMember of NTHU Ubicomp Lab Experience Shopback software engineer intern, mobile platform team (2022.6 - 2023.6) Featured Projects 習慣城自然:當代人類行為百科 The Story of a Nostalgic Town - AR App This work presents through an installation, based on a landscape model of a town, accompanied by a dedicated app. Audiences can use augmented reality (AR) to view fragments of stories within the model, piecing together the narratives of the town and the residents.\nAn interactive installation art work with an AR App for the graduation exhibition. Tech stack used: Unity, C#, Vuforia, Figma, Firebase, Raspberry Pi, Python 放視大賞 2023 決選入圍 Watch video✨ Online exhibition TechLifeProbe - Android App A system to probe how data sharing with adolescents’ parents improves their technology abuse through mobile phones\nDeveloped an Android app for human-computer interaction research aimed at improving technology abuse. This research was published in ACM CHI 2022.\nTech stack used: Android, Kotlin, MySQL, PHP, Figma, Python\nRelated publication\nUsing Mobile and Wearable Technologies to Improve Adolescents’ Smartphone Addiction through the Sharing of Personal Data with Parents. Pin-Chieh Chen, Min-Wei Hung, Hsueh-Sung Lu, Chien Wen (Tina) Yuan, Nanyi Bi, Wan-Chen Lee, Ming-Chyi Huang, Chuang-Wen You - ACM CHI, 2022 Project Gallery 習慣城自然:當代人類行為百科 | ARAn interactive installation art work with an AR App for the tech art grduation exhibition. TechLifeProbe Android AppAn Android App for sharing data between tech abuse adolescents and their parents. "},"title":"Hi, I'm PJ."},"/blog/":{"data":{"":"一些筆記📓"},"title":"Blog"},"/blog/go/go_channels/":{"data":{"":"","channel#Channel":"Channel 是個 typed 的管道,go 程式可以透過 channel operator \u003c- 去接受或發送某個值。透過 channel 可以同步不同的 Goroutine。\n箭頭的方向就代表了資料的傳輸方向:\nch := make(chan int) // create a channel for int v := 100 go func() { fmt.Println(\"Sending v to channel\") ch \u003c- v // Send value to the channel }() recv := \u003c- ch // Get value from the channel fmt.Printf(\"recv: %v\", recv) 預設情況下,接受與發送都會 block 住,直到另一端也發送或接受,像是以下的程式會停在 ch \u003c- v,因為程式還在等人發送值到 channel 中,會出現 deadlock 錯誤 fatal error: all goroutines are asleep - deadlock!:\nch := make(chan int) // create a channel for int v := 100 fmt.Println(\"Sending v to channel\") ch \u003c- v // The code will stop here and wait for the value... recv := \u003c- ch fmt.Printf(\"recv: %v\", recv) channel 的 block 行為是可以被控制的,channel 可以宣告成 buffered channel,一個 buffered channel 裡的值可以保存起來,接受端只要拿的到值就可以繼續,發送端只要發送值進去後 channel 沒有超過容量也可以繼續。\nbuffered channel 的容量透過 make() 的第二個參數指定:\nch := make(chan int, 1) 將上面會造成 deadlock 的 channel 改成 buffered channel (size = 1) ,就可以正常執行了:\nch := make(chan int, 1) // create a buffered channel for int v := 100 fmt.Println(\"Sending v to channel\") ch \u003c- v recv := \u003c- ch fmt.Printf(\"recv: %v\", recv) Close the channel Sender 可以透過 close(channel) 通知 receiver 之後不會傳東西到這個 channel 中了。 Receiver 可以透過 v, ok := \u003c- ch 的 ok 是 false 得知 channel 已被關閉,也可以透過 for i := range c 接受值,直到 channel 被關閉。 ","refs#Refs":" A Tour of Go Go 语言 select 的实现原理 | Go 语言设计与实现 (draveness.me) ","select#Select":" select 可以從多個 case 中執行符合的操作。 如果同時有多個條件都符合,隨機選一個。 select (在沒有定義 default 時),會 block 並等待某個 case 並執行對應的操作: select 加上 default 後就不會 block,因為當其他 channel 都還沒好時,會進到 default 中,見官方範例參考: tick := time.Tick(100 * time.Millisecond) boom := time.After(500 * time.Millisecond) for { select { case \u003c-tick: fmt.Println(\"tick.\") case \u003c-boom: fmt.Println(\"BOOM!\") return default: fmt.Println(\" .\") time.Sleep(50 * time.Millisecond) } } "},"title":"Go - Channels"}}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading

0 comments on commit 05695e8

Please sign in to comment.