Skip to content

Commit 877bee9

Browse files
committed
重装git
0 parents  commit 877bee9

File tree

119 files changed

+56305
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+56305
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
## 页面配置
6+
7+
* 视频页&首页视频
8+
9+
```/static/video_config.json```
10+
* 首页三张图片
11+
12+
```/src/pages/index.js:L11 features```
13+
14+
### Installation
15+
16+
```
17+
$ yarn
18+
```
19+
20+
### Local Development
21+
22+
```
23+
$ yarn start
24+
```
25+
26+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
27+
28+
### Build
29+
30+
```
31+
$ yarn build
32+
```
33+
34+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
35+
36+
### Deployment
37+
38+
```
39+
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
40+
```
41+
42+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

blog/2019-05-28-hola.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: hola
3+
title: Hola
4+
author: Gao Wei
5+
author_title: Docusaurus Core Team
6+
author_url: https://github.com/wgao19
7+
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
8+
tags: [hola, docusaurus]
9+
---
10+
11+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

blog/2019-05-29-hello-world.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
id: hello-world
3+
title: Hello
4+
author: Endilie Yacop Sucipto
5+
author_title: Maintainer of Docusaurus
6+
author_url: https://github.com/endiliey
7+
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
8+
tags: [hello, docusaurus]
9+
---
10+
11+
Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).
12+
13+
<!--truncate-->
14+
15+
This is a test post.
16+
17+
A whole bunch of other information.

blog/2019-05-30-welcome.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: welcome
3+
title: Welcome
4+
author: Yangshun Tay
5+
author_title: Front End Engineer @ Facebook
6+
author_url: https://github.com/yangshun
7+
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
8+
tags: [facebook, hello, docusaurus]
9+
---
10+
11+
Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!
12+
13+
Delete the whole directory if you don't want the blog features. As simple as that!

blog/2020-07-08-3_2-release.md

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
---
2+
title: 发布 CodeLab Adapter 3.2
3+
author: CodeLab
4+
date: 2020-05-10
5+
tags: ["codelab"]
6+
image: https://adapter.codelab.club/img/42b96f90be7f9884c9702fc5cd5279fb.png
7+
---
8+
9+
<!--<img class="img-responsive" src="https://adapter.codelab.club/img/42b96f90be7f9884c9702fc5cd5279fb.png" />-->
10+
11+
12+
> Playful Programming Centre
13+
14+
# 前言
15+
16+
距离 [CodeLab Adapter 3.0 发布](https://www.codelab.club/blog/3-release/)过去了 3 周有余,期间收到许多用户的邮件反馈,大家热心给出了改进建议和 bug 报告。
17+
18+
这段期间,根据大家的反馈迭代了若干个小版本,也为一些用户单独构建了一些版本,以服务于他们独特的用途。
19+
20+
3.2 是一个大版本,汇集了我们这段时间来的所有改进。
21+
22+
<!--truncate-->
23+
24+
今后,每当发布大版本,我们会在博客里发一篇文章说明重大变更。(沿袭 [Open edX](https://open.edx.org/) 社区类似的做法。)
25+
26+
至于常规版本的迭代日志,可参考[changelog](https://adapter.codelab.club/changelog/)
27+
28+
# 先睹为快
29+
30+
CodeLab Adapter 3.2 的改进,主要围绕以下方面:
31+
32+
- **新增扩展**
33+
- **让连接无处不在**
34+
- **提升 Windows 平台的使用体验**
35+
- **增强自省能力**
36+
- **完善插件体系**
37+
38+
39+
以下逐条陈述。
40+
41+
## 新增扩展
42+
43+
CodeLab Adapter v3 是一个高度可扩展的开放系统。将一个新的体系接入 CodeLab Adapter, 有时只需几分钟时间!
44+
45+
在 3.2 中,新增了以下扩展:
46+
47+
- [Stage](https://adapter.codelab.club/extension_guide/stage/)
48+
- [RaspberryPi GPIO](https://adapter.codelab.club/extension_guide/rpi_gpio/)
49+
- [Minecraft](https://adapter.codelab.club/extension_guide/minecraft/)
50+
- [Sonic Pi](https://adapter.codelab.club/extension_guide/sonicPi/)
51+
- [MQTT Broker](https://adapter.codelab.club/extension_guide/MQTT_Broker/)
52+
- [MQTT Adapter](https://adapter.codelab.club/extension_guide/MQTT_adapter/)
53+
- [Calypso](https://adapter.codelab.club/extension_guide/Calypso/)
54+
55+
其中 RaspberryPi,Minecraft,Sonic Pi 拥有巨大生态,用户社区从千万到百万级别不等。
56+
57+
### [Stage](https://adapter.codelab.club/extension_guide/stage/)
58+
59+
Stage 指 Scratch 的舞台区。
60+
61+
![](https://adapter.codelab.club/img/307a089f4fc36348702fe4d98958ce30.png)
62+
63+
Adapter/Scratch Stage 插件允许将 Scratch 舞台区的图像(舞台或者摄像头图像)以 base64 的格式发往 Adapter。如此一来,你就可以构建 Adapter node/extension ,用作自定义图像处理程序!可以使用 神经网络 / OpenCV ... 来处理舞台区的内容,一切都由你决定,识别的结果将返回给 Scratch。
64+
65+
其他的用例,包括构建一个自动保存舞台状态的插件;或者构建自拍/美颜插件:)
66+
67+
需要配合 Scratch `图像识别` 插件中的积木一起使用。
68+
69+
![](https://adapter.codelab.club/img/999e46633d51f05d58c863c698fcb109.png)
70+
71+
### [RaspberryPi GPIO](https://adapter.codelab.club/extension_guide/rpi_gpio/)
72+
73+
![](https://adapter.codelab.club/img/cb459aec0fc8b001c8f1f9e32b10d8f2.png)
74+
75+
树莓派是全球最流行的开源硬件之一,在疫情期间,更是被广泛使用,哥伦比亚将其用于制作呼吸机,有些硬件黑客则使用树莓派 DIY 口罩制作机,将自动生产的口罩赠送给附近医院。
76+
77+
树莓派通过 GPIO 引脚驱动物理/电器设备,所以 DIY 经常会用到 GPIO 。操作树莓派 GPIO 的工具里,[gpiozero](https://gpiozero.readthedocs.io/en/stable/index.html)尤为出色,因其具有很好的可理解性(图形化未必意味着更好的可理解性),Python 之父也是 gpiozero 的粉丝。
78+
79+
为了充分利用 gpiozero,我们只对它做一层薄薄的包装(REPL), 使其在 Scratch 中可用,更多的自由度则留给了你。
80+
81+
树莓派高度灵活,难以积木化它的所有特性,那样并不会提高可理解性。 我们希望用户灵活使用 Python 去增强 Scratch ,更好的扩展模式可以参考[Python eval kernel](https://adapter.codelab.club/extension_guide/extension_python_kernel/)
82+
83+
当然, 一些功能是可以积木化的,期待你来提交 PR。
84+
85+
### [Minecraft](https://adapter.codelab.club/extension_guide/minecraft/)
86+
87+
![](https://adapter.codelab.club/img/WechatIMG1431.jpeg)
88+
89+
Minecraft(我的世界)是一款开放世界沙盒游戏,拥有惊人的自由度,它是有史以来最畅销的电子游戏,在儿童中尤其流行。
90+
91+
由于 COVID-19,提前结束这个学期后,MIT 学生在 Minecraft 上重建了 MIT 整个校园。校方还[报道了这事](http://news.mit.edu/2020/building-and-reconnecting-mit-minecraft-0407)
92+
93+
![](https://adapter.codelab.club/img/ba660a0566b0e83a643e88da376f3140.png).
94+
95+
Minecraft 插件将 Minecraft 接入 Adapter ,使游戏中的世界可以与现实世界随意互动! 可以将 Scratch、乐高、 AI、 实物,以及任何你喜欢的东西都接入到游戏中,与游戏角色互动。
96+
97+
我们制作了一个入门 Demo:[Scratch-mcTurtle](https://scratch3v3.codelab.club?sb3url=https://adapter.codelab.club/sb3/Scratch-mcTurtle.sb3), 你可以从这里起步。它是一个运行在 Minecraft 世界里的 Turtle,将出现在主角周围, 推荐你飞到空中(空格)去看它的运行轨迹。
98+
99+
<video src="https://adapter.codelab.club/video/1588665494072465.mp4" controls="controls"></video>
100+
101+
如果你想做更多有趣的事,建议阅读[minecraft](stuffaboutcode.com/p/minecraft.html), 我们鼓励你去修改[插件源码](https://github.com/CodeLabClub/codelab_adapter_extensions/blob/master/nodes_v3/node_minecraft.py),去支持更多的对象。欢迎把你的修改结果提交到 CodeLab 源码仓库,分享给社区里的其他人用。
102+
103+
### [MQTT Broker](https://adapter.codelab.club/extension_guide/MQTT_Broker/)
104+
105+
@云天 在 国内最大的 maker 社区 -- dfrobot 社区里分享了十来篇采用 CodeLab Adapter 构建项目的案例, 一些有趣的案例如:
106+
107+
<video src="https://adapter.codelab.club/video/1589111397669473.mp4" controls="controls"></video>
108+
109+
将 OpenCV 接入 CodeLab Adapter,与家居互动,挥手时显示运动区域的光晕,颇有钢铁侠的味道。
110+
111+
<video src="https://adapter.codelab.club/video/1589111360787294.mp4" controls="controls"></video>
112+
113+
使用 CodeLab Adapter 连接 Google Teachable Machine 和 Microbit,训练了一个口哨汤勺开关
114+
115+
他在 懒人系列之视控灯 项目里写道:
116+
117+
> CodeLab Scratch3+CodeLab Adapter+Python 完美搭配。以前我要实现类似功能,要通过一个中间者 MQTT,比如本地的像 Siot。
118+
119+
CodeLab Adapter 的典型用途之一确实是 构建复杂连接的项目时,部分替代 MQTT。
120+
121+
但 MQTT 有其独特的价值,所以在 Adapter 3.2 中,有两个插件围绕 MQTT 。
122+
123+
MQTT Broker 插件允许你在本地轻松启动一个轻量级 MQTT Broker,这是一颗强劲的心脏。 轻量级,却高性能,采用 Adapter 内置的 [hbmqtt](https://hbmqtt.readthedocs.io/en/latest/index.html), 基于协程的并发能力,足以让你在树莓派上支撑起整个学校的物联网。
124+
125+
一个典型的使用场景是将各类支持 mqtt client 的硬件,接入 Adapter(你需要写一个 extension, 不过我们已经构建了一个:[MQTT_adapter](https://adapter.codelab.club/extension_guide/MQTT_adapter/) ),方便你将 esp32、esp8266、掌控板等设备接入 Adapter 。
126+
127+
### [MQTT Adapter](https://adapter.codelab.club/extension_guide/MQTT_adapter/)
128+
129+
MQTT Adapter 插件负责桥接 mqtt 与 Scratch/Adapter, 它展示我们在易用性上所做的努力。
130+
131+
原理很简单,它将来自 mqtt 的消息(mqtt topic:`to_scratch`),转发到 eim 中,将 eim 中的消息转发到 mqtt(mqtt topic:`from_scratch`)。
132+
133+
### [Calypso](https://adapter.codelab.club/extension_guide/Calypso/)
134+
135+
![](https://adapter.codelab.club/img/5e2d27904616c6f685c439d933fa2ced.png)
136+
137+
[Calypso](https://calypso.software/) 是 CMU 大学七年来对儿童如何学习基于规则的机器人编程的研究成果。由[David S. Touretzky](https://en.wikipedia.org/wiki/David_S._Touretzky)博士构建,他是 CMU 计算机科学和神经认知基础中心的研究教授。此外,Touretzky 一直活跃在互联网,主张言论自由。
138+
139+
[Calypso](https://calypso.software/)目前用于为 Cozmo 编程。被广泛用于 AI 教育项目.
140+
141+
<video src="https://adapter.codelab.club/video/1589111342575217.mp4" controls="controls"></video>
142+
143+
当 Cozmo 看到我表情悲伤时,将帮我升起窗帘: "Give you some sunshine"。
144+
145+
Cozmo 说 oh you are sad ,give you some sunshine。《Give Me Some Sunshine》是《三傻大闹宝莱坞》里的插曲。
146+
147+
这个例子很好展示了 设备与环境的互动。这种与环境的连接能力,允许大量有想象力且有温度的事情发生。更多理念,参考[CodeLab 可编程空间 背后的理念与设计原则](https://www.codelab.club/blog/design-principles-behind-neverland/)
148+
149+
## 让连接无处不在
150+
151+
Adapter 3.0 拥有强大的连接能力。
152+
153+
v3.2 在连接方面的主要工作是使其高度易用。
154+
155+
[Adapter Node](https://adapter.codelab.club/dev_guide/Adapter-Node/) 虽然能够将整个 Python 生态 接入到 Adapter 中, 但对于许多入门者,却可能缺乏 Python 相关的技能。
156+
157+
v3.2 使连接开箱可用,对于入门者,Ta 可以快速将自己感兴趣的系统,接入 Adapter 中;对于高阶用户,推荐使用[Adapter Node](https://adapter.codelab.club/dev_guide/Adapter-Node/),几乎拥有无限的自由。
158+
159+
> 让简单的事情保持简单,让困难的事情变得可能 -- Alan Kay
160+
161+
v3.2 中 Adapter 默认接收 EIM 消息请求,请求地址为:
162+
163+
`https://codelab-adapter.codelab.club:12358/api/message/eim?message=hi`
164+
165+
它只是简单 HTTP 请求,可以从任何地方发起!拥有和 web 生态一样的简单性。这个简单的接口带来了类似 IFTTT 的简单和灵活。你可以将任何 event 通知给 Adapter。
166+
167+
前边有两个案例,是基于这个接口做的:
168+
169+
[Calypso](https://adapter.codelab.club/extension_guide/Calypso/) 以及 Kano 魔杖。以下是 Kano 魔杖的案例:
170+
171+
<video src="https://adapter.codelab.club/video/1576905337206766.mp4" controls="controls"></video>
172+
173+
更有想象力的事情是,使用 Ngrok 之类的工具,将该接口暴露到公共互联网,如此一来,我们甚至可以在教学直播中,让远方的学生与演播厅的整个可编程空间互动,可以是多人!
174+
175+
前边的场景不过也是一种**连接**罢了,虽然可能跨越半个地球。
176+
177+
Adapter 专注在连接,并使其简易。
178+
179+
尤其值得一提的是,我们充分考虑了安全性,即便暴露到公共网络,它也是安全的!
180+
181+
## 提升 Windows 平台的使用体验
182+
183+
由于许多用户在使用 Windows 平台,而我自己则主要在用 MacOS 和 Linux,之前忽视了 Windows 平台下的使用体验。
184+
185+
@Hanson 同学在使用 CodeLab Adapter 过程中,不只在班级博客中写了推荐文章:[使用 Codelab-Adapter 扩展 Scratch](https://rcfclass7.wordpress.com/2020/04/24/%e4%bd%bf%e7%94%a8codelab-adapter%e6%89%a9%e5%b1%95scratch/)(文章中对 Adapter 架构的理解非常精确),还给出了许多反馈和建议, 这些改进建议,多数在 3.2 中付诸实施。
186+
187+
其中最大的一项改进是:
188+
189+
> HCI 运行时启动的 python 命令行程序可以改为.pyw 的隐藏程序
190+
191+
将 Node 作为隐藏程序,不只是 @Hanson 同学提出,其他用户也多次提出,在 3.2 中,这项工作已完成。
192+
193+
容我吐槽下 Windows,忍无可忍,在源码注释中竖了中指 🖕️,不准备删除:) Windows 拙劣得惊人。 在其中编程,仿若在泥塘与巨兽搏斗。推荐大家使用 Ubuntu系统,Ubuntu 是免费的,不需要重新购买计算机,直接安装 Ubuntu 即可使用。
194+
195+
## 增加自省能力
196+
197+
我们在[发布 CodeLab Adapter 3.0](https://www.codelab.club/blog/3-release/) 讨论**自省**时说到
198+
199+
> 自省的意思是说事物理解它自身的状态,当我们说一个事物 智能 的时候,很多时候和它的自省能力有关。
200+
201+
3.2 进一步增强 Adapter 的自省能力,于是我们可以做到一些智能的行为,诸如在程序启动时,自动更新最新的 Adapter Client,这样使用 Adapter Node 时,无需再操心环境依赖问题。
202+
203+
这也是 3.2 对易用性的最大改进之一。
204+
205+
导致这项改进的背景是,Cozmo 社区的许多用户,是没有技术背景的奶爸,他们使用 CodeLab Adapter 来驱动孩子们喜欢的 Cozmo,让他们在 Scratch 里同时驱动 Cozmo 和 Vector:
206+
207+
<video src="https://adapter.codelab.club/video/where-did-the-human-go.mp4" controls="controls"></video>
208+
209+
但他们经常会对文档中一些我们(工程师们)认为非常基础的概念产生疑惑,诸如 pip 是什么,命令行怎么打开,他们给我发邮件,他们感到困惑的地方,让我有点惊讶。
210+
211+
但我们要承认,对创造感兴趣的并非都是工程师,如何让非技术背景的用户更加易于使用,是我们不断增强 Adapter 自省能力的原因。通过增加自省能力,来自动化完成一些需要手动操作的技术活。
212+
213+
## 完善插件体系
214+
215+
3.2 中,对插件体系有 2 大改进:
216+
217+
### 插件市场
218+
219+
![](https://adapter.codelab.club/img/57c8980da375649292ff3fc158e71bae.png)
220+
221+
插件市场现在同时支持 Node 和 Extension,用户可以将自己创建的插件,分享给社区用户。而且我们允许 Node 托管在互联网的任何区域!
222+
223+
### 可扩展的插件 Meta 信息
224+
225+
3.2 中,我们使用静态分析(ast) 从 Node/Extension 中动态提取 meta 信息。这些信息用于为插件排序,以及为 UI 提供插件附属信息。其中关于添加图标和描述信息的想法,来自Longan团队的产品经理@yuchen,目前3.2中已经实现。
226+
227+
![](https://adapter.codelab.club/img/a884c24a566089e8d87ce339fab0efdd.png)
228+
229+
此外, 第三方公司在构建自己的扩展时,可以随意自定义信息给自定义的前端 UI 使用,这样一来具有极高的灵活度。
230+
231+
这是我第一次写静态分析相关的代码。把代码当数据来操控的想法实在太有意思了!它给人一种无所不能的快乐。
232+
233+
把代码当数据来操控的想法在 LISP 社区很盛行,但在学习 LISP 的时候(《SICP》和《The Little Schemer》)围绕这个话题读了不少资料,却总有一种隔阂感,后来 Seymour 和蒙台梭利关于“实践”的论点打动我,便习惯了 learning by doing。由于近期希望在代码运行之前提取 Meta 信息,如此一来对代码的静态分析,就成为眼前事,那些能够方便解析和操控静态代码的工具和语言(hylang),像 ast,之前觉得复杂而冗长,这两天却呈现出前所未有的趣味。
234+
235+
ast 模块的 api 惊人地优美。这些 api 在我之前看来,是一堆与我无关的结构,只能凭借记忆和无聊的练习去反复适应它。当我最近试着手动处理代码结构,处处碰壁,再次看到 ast,惊为天人。这时,理解只是轻松的副产物。或许可以作为 seymour 关于“建构主义”所做讨论的案例注脚。
236+
237+
238+
# 其他改进
239+
其他的改进,如:
240+
241+
- 日志滚动存放 30 天,逾期清除,避免占用太多计算机存储空间
242+
- Adapter退出时,UI 弹出(alert)提醒,而不是显示断开加载中(之前有几位用户对此感到困惑)
243+
- 软件启动时,使用线程自动检查环境信息,并提取到全局
244+
- 将一些辅助函数移往 adapter client,使得构建 Node 更为容易。
245+
- ...
246+
247+
不在此一一列出,我们近期将一起更新到changelog里。

docs/Aboutus.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# About us

docs/adapter/doc0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
id: doc0
3+
title: 从这里开始
4+
---
5+
从这里开始

0 commit comments

Comments
 (0)