<commit_before>Title: 期中作業
Date: 2017-04-19 12:00
Category: Course
Tags: teach
Slug: 期中考
Author: 40423213

<iframe src="https://player.vimeo.com/video/213777510" width="640" height="391" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/213777510">2017-04-19_09-35-39</a> from <a href="https://vimeo.com/user61454909">40423213</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
<p><!-- 導入 Brython 標準程式庫 -->
 
<script type="text/javascript" src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython_dist.js">
</script>
 
<!-- 啟動 Brython -->
 
<script>
window.onload=function(){
brython(1);
}
</script>
 
<!-- 以下實際利用  Brython 畫四連桿 trace point 路徑-->
 
<canvas id="fourbar" width="600" height="400"></canvas>
 
<div id="container1"></div>
 
<script type="text/python3">
from browser import document as doc
from browser import html
import math
# 準備繪圖畫布
canvas = doc["fourbar"]
container1 = doc['container1']
ctx = canvas.getContext("2d")
 
fourbar_data = open("./../40423213/40423213.csv").read()
fourbar_list = fourbar_data.splitlines()
#container1 <= fourbar_list[0]
# 以下可以利用 ctx 物件進行畫圖
# 先畫一條直線
ctx.beginPath()
# 設定線的寬度為 1 個單位
ctx.lineWidth = 1
# 利用 transform 將 y 座標反轉, 且 offset canvas.height
# (X scale, X skew, Y skew, Y scale, X offset, Y offset)
# 配合圖形位置進行座標轉換
ctx.transform(1, 0, 0, -1, canvas.width/2+250, canvas.height/2+100)
# 畫出 x 與 y 座標線
# 各座標值放大 8 倍
ratio = 4
ctx.moveTo(0, 0)
ctx.lineTo(-30*ratio, 0)
start_point = fourbar_list[0].split(",")
ctx.moveTo(float(start_point[0])*ratio, float(start_point[1])*ratio)
count = 0
for data in fourbar_list[1:]:
    point = data.split(",")
    #count = count + 1
    #container1 <= str(count) + ":" + point[0] + "," + point[1]
    #container1 <= html.BR()
    ctx.lineTo(float(point[0])*ratio, float(point[1])*ratio)
# 設定顏色為藍色, 也可以使用 "rgb(0, 0, 255)" 字串設定顏色值
ctx.strokeStyle = "blue"
# 實際執行畫線
ctx.stroke()
ctx.closePath()

</script></p>
<iframe src="https://player.vimeo.com/video/215039336" width="640" height="480" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/215039336">40423213-期中作業</a> from <a href="https://vimeo.com/user61454909">40423213</a> on <a href="https://vimeo.com">Vimeo</a>.</p><commit_msg>Mid-term operations<commit_after>Title: 期中作業
Date: 2017-04-19 12:00
Category: Course
Tags: teach
Slug: 期中考
Author: 40423213

<iframe src="https://player.vimeo.com/video/213777510" width="640" height="391" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/213777510">2017-04-19_09-35-39</a> from <a href="https://vimeo.com/user61454909">40423213</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
<!-- PELICAN_END_SUMMARY -->
<p><!-- 導入 Brython 標準程式庫 -->
 
<script type="text/javascript" src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython_dist.js">
</script>
 
<!-- 啟動 Brython -->
 
<script>
window.onload=function(){
brython(1);
}
</script>
 
<!-- 以下實際利用  Brython 畫四連桿 trace point 路徑-->
 
<canvas id="fourbar" width="600" height="400"></canvas>
 
<div id="container1"></div>
 
<script type="text/python3">
from browser import document as doc
from browser import html
import math
# 準備繪圖畫布
canvas = doc["fourbar"]
container1 = doc['container1']
ctx = canvas.getContext("2d")
 
fourbar_data = open("./../40423213/40423213.csv").read()
fourbar_list = fourbar_data.splitlines()
#container1 <= fourbar_list[0]
# 以下可以利用 ctx 物件進行畫圖
# 先畫一條直線
ctx.beginPath()
# 設定線的寬度為 1 個單位
ctx.lineWidth = 1
# 利用 transform 將 y 座標反轉, 且 offset canvas.height
# (X scale, X skew, Y skew, Y scale, X offset, Y offset)
# 配合圖形位置進行座標轉換
ctx.transform(1, 0, 0, -1, canvas.width/2+250, canvas.height/2+100)
# 畫出 x 與 y 座標線
# 各座標值放大 8 倍
ratio = 4
ctx.moveTo(0, 0)
ctx.lineTo(-30*ratio, 0)
start_point = fourbar_list[0].split(",")
ctx.moveTo(float(start_point[0])*ratio, float(start_point[1])*ratio)
count = 0
for data in fourbar_list[1:]:
    point = data.split(",")
    #count = count + 1
    #container1 <= str(count) + ":" + point[0] + "," + point[1]
    #container1 <= html.BR()
    ctx.lineTo(float(point[0])*ratio, float(point[1])*ratio)
# 設定顏色為藍色, 也可以使用 "rgb(0, 0, 255)" 字串設定顏色值
ctx.strokeStyle = "blue"
# 實際執行畫線
ctx.stroke()
ctx.closePath()
</script></p>


<iframe src="https://player.vimeo.com/video/215039336" width="640" height="480" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/215039336">40423213-期中作業</a> from <a href="https://vimeo.com/user61454909">40423213</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
{'fraction_non_alphanumeric': 0.18903754855416488, 'fraction_numerical': 0.08286577470867501, 'mean_word_length': 5.074705111402359, 'pattern_counts': {'":': 2, '<': 80, '<?xml version=': 0, '>': 74, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6468393', 'n_tokens_mistral': 2271, 'n_tokens_neox': 2101, 'n_words': 369}