From 657ce7c33e022bf02a5843da88e7a9afffaa0517 Mon Sep 17 00:00:00 2001 From: lmj01 Date: Mon, 29 Apr 2024 11:37:55 +0800 Subject: [PATCH] update --- articles/2024/wechat.md | 8 ++++ cg/opengl.md | 27 +++++++++++ cpl/ECMAScript.md | 100 ++++++++++++++++++++++++++++++++++----- cpl/typescript.md | 62 ------------------------ index/book-info.md | 3 ++ index/computerScience.md | 3 +- web/quickjs.md | 95 ------------------------------------- 7 files changed, 128 insertions(+), 170 deletions(-) create mode 100644 articles/2024/wechat.md delete mode 100644 cpl/typescript.md delete mode 100644 web/quickjs.md diff --git a/articles/2024/wechat.md b/articles/2024/wechat.md new file mode 100644 index 0000000..8121cf9 --- /dev/null +++ b/articles/2024/wechat.md @@ -0,0 +1,8 @@ +# 微信 +> 网页开发中,很多地方会用到微信,记录一下相关过程 + +## 扫码关注 +- 先获取一个tick数据,是str +- 轮询去检查这个str对应的图像被扫码不 + - 扫码,返回openid,属于关注成功 + - 为得到openid,重复轮询check \ No newline at end of file diff --git a/cg/opengl.md b/cg/opengl.md index af75ef8..cd8ab22 100644 --- a/cg/opengl.md +++ b/cg/opengl.md @@ -191,6 +191,33 @@ glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - [OGLplus's Documentation!](https://matus-chochlik.github.io/oglplu2/sphinx/index.html) - [github](https://github.com/matus-chochlik/oglplus) +## tools + +### [glad](https://glad.dav1d.de/) + +- [Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specifications for multiple languages.](https://github.com/Dav1dde/glad) +- [This is a webservice for glad, a multi-language Vulkan/GL/GLES/EGL/GLX/WGL loader-generator based on the official specifications.](https://github.com/Dav1dde/glad-web) + +初始化时,一定注意顺序,特别是封装成框架时,一定要注意这个顺序,否则调用任何gl的函数都会失败 +```js +void initOpenGl() { + // 必须先执行 + glewInit(); + // glad的执行前提窗体的上下文context中,即需要先创建窗体 + this->window = glfwCreateWindow(resolution.width, resolution.height, "OpenGL", NULL, NULL); + if (!this->window) { + glfwTerminate(); + throw std::runtime_error("Failed to create GLFW window!"); + } + glfwMakeContextCurrent(this->window); + // 执行任何gl函数前,需要初始化glad + if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { + std::cout << "Failed to initialize GLAD" << std::endl; + } +} +``` + + ## 参考 - [OpenGL基础,一个韩国人写的基础知识](http://www.songho.ca/opengl/index.html) diff --git a/cpl/ECMAScript.md b/cpl/ECMAScript.md index 56d8e27..9cb3741 100644 --- a/cpl/ECMAScript.md +++ b/cpl/ECMAScript.md @@ -1,4 +1,11 @@ -# JavaScript +# ECMAScript +> + +- [Standard ECMA-262 6th Edition / June 2015 ECMAScript® 2015 Language Specification ](https://262.ecma-international.org/6.0/) +- [RxMarbles](https://rxmarbles.com/) + - [github](https://github.com/staltz/rxmarbles) + +## JavaScript [JavaScripture The bridge between W3C, WHATWG and ECMAScript](https://www.javascripture.com/) @@ -6,9 +13,8 @@ ECMAScript Blob-binary large object -*** -## 不常用特性与新语法 +### 不常用特性与新语法 ### double exclamatioin mark @@ -58,7 +64,7 @@ a == null ? undefined : a(); *** -## 特性 +### 特性 **this** @@ -150,7 +156,7 @@ Drivered.prototype = Object.assign(Object.create(Base.prototype), { ``` -## Event +### Event 浏览器中实现事件循环有两个概念:MacroTask宏任务和MicroTask微任务 macrotasks:setTimeout, setInterval, setImmediate, I/O, UI rendering @@ -170,18 +176,17 @@ JavaScript代码执行顺序:从script开始,全局上下文进入函数调 a interface provides the ability to watch for changes being made to the DOM tree. -## web worker +### web worker HTML5提供了一个javascript多线程解决方案,在之前DOM渲染与JavaScript执行是在同一线程中执行的,现在UI界面与web worker属于不同线程了。 - 通过worker=new Worker(url)加载一个js文件 - 通过postMessage(data)方法来向主线程发送数据 - 绑定worker.onmessage接受worker数据 - 使用worker。terminate()终止一个worker -## typescript -## 工程化 +### 工程化 Fetch API @@ -217,9 +222,80 @@ Error, DOMException try...catch...不能捕获异步操作 +## typescript +> javascript的超集,更加面向对象的编程语言,可以便宜为纯Javascript -## 参考 +### 特性 -- [Standard ECMA-262 6th Edition / June 2015 ECMAScript® 2015 Language Specification ](https://262.ecma-international.org/6.0/) -- [RxMarbles](https://rxmarbles.com/) - - [github](https://github.com/staltz/rxmarbles) \ No newline at end of file +union +```typescript +type1 | type2 | type3 +``` +interface +Typescript的interface比起C#或Java来说时有区别的,Typescript更加广泛, +```typescript +interface SomePoint { + x: number; + y: number; +} +interface SomePoint { + z: number; +} +``` +接口合并后增加了扩展性 + +class + +标准模式 +```typescript +class A { + static st:string; + inst: number; + constructor(m: any){} +} +``` +分解模式 + +```typescript +interface A_Static { + new(m: any): A_Instance; + st: string; +} +interface A_Instance { + inst: number; +} +declare var A: A_Static; +``` +内心时讨厌这种语法的,就是所学其他语言那样,变着花样让我去理解,很容易让人找不到头脑的,但是有时候又特别有用。 + +*** + +### [Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) + +用来定义类型信息及接口规范,当使用扩展的JS库或插件API时,需要使用声明文件来描述库的类型。比如编辑器需要给引用库的提示,就需要类型信息与接口。所以早期的Javascript 库时没有类型定义信息的,需要创建一个对应的d.ts文件,如three-js这样的库。 + +写*.d.ts的流程,尽量从文档入口,不要被细节影像。 + +### 参考 + +- [typescript官网文档](https://www.typescriptlang.org/docs) + +## QuickJS +> 是一个轻量,嵌入式的Javascript引擎 + +### list + +- list.h + +```c +struct list_head { + struct list_head *prev; + struct list_head *next; +}; +``` + +链表头的实现。这样看来不是把数据嵌入到链表中,而是把链表嵌入到其它对象中,来维护这些对象之间的链表关系。 + +### cutils.h/cutils.c + +一些位操作,与内存,字符编码,排序等有关的函数 diff --git a/cpl/typescript.md b/cpl/typescript.md deleted file mode 100644 index 2d599c3..0000000 --- a/cpl/typescript.md +++ /dev/null @@ -1,62 +0,0 @@ - -# typescript -> javascript的超集,更加面向对象的编程语言,可以便宜为纯Javascript - - -## 特性 - -### union -```typescript -type1 | type2 | type3 -``` -### interface -Typescript的interface比起C#或Java来说时有区别的,Typescript更加广泛, -```typescript -interface SomePoint { - x: number; - y: number; -} -interface SomePoint { - z: number; -} -``` -接口合并后增加了扩展性 - -### class - -标准模式 -```typescript -class A { - static st:string; - inst: number; - constructor(m: any){} -} -``` -分解模式 - -```typescript -interface A_Static { - new(m: any): A_Instance; - st: string; -} -interface A_Instance { - inst: number; -} -declare var A: A_Static; -``` -内心时讨厌这种语法的,就是所学其他语言那样,变着花样让我去理解,很容易让人找不到头脑的,但是有时候又特别有用。 - -*** - -## [Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) - -用来定义类型信息及接口规范,当使用扩展的JS库或插件API时,需要使用声明文件来描述库的类型。比如编辑器需要给引用库的提示,就需要类型信息与接口。所以早期的Javascript 库时没有类型定义信息的,需要创建一个对应的d.ts文件,如three-js这样的库。 - -### 流程 - -写*.d.ts的流程,尽量从文档入口,不要被细节影像。 - - -## 参考 - -- [typescript官网文档](https://www.typescriptlang.org/docs) \ No newline at end of file diff --git a/index/book-info.md b/index/book-info.md index 87a0d40..0df0454 100644 --- a/index/book-info.md +++ b/index/book-info.md @@ -30,6 +30,9 @@ ### [Polygon Mesh Processing](https://book.douban.com/subject/5463738/) [官网有资源](http://www.pmp-book.org/) +### [The Software Foundations series is a broad introduction to the mathematical underpinnings of reliable software.](https://softwarefoundations.cis.upenn.edu/) +> 该系列现在有6本了,属于理论比较高深的 + ## readed - 计算机图形图像设计,2016,中国传媒大学出版社,已读 - 囚徒的困境-冯·诺依曼、博弈论和原子弹之谜,已读 diff --git a/index/computerScience.md b/index/computerScience.md index eedc63a..bb778b3 100644 --- a/index/computerScience.md +++ b/index/computerScience.md @@ -102,7 +102,7 @@ - [3D Grafik - WebGL mit three.js](https://xprofan.net/intl/de/php,html,js/3d-grafik-webgl-mit-three-js/) - [use your mouse to control the camera and build an andorid](https://hofk.de/main/threejs/raycaster/raycaster.html) - [webgl examples](https://alteredqualia.com/) -- [](https://github.com/brunosimon/folio-2019) +- [22](https://github.com/brunosimon/folio-2019) ### 动画 @@ -136,6 +136,7 @@ - [协同编辑](../articles/2023/associateEditor.md) - [Building a collaborative text editor in Go协同开发文本编辑器的go实现思考](https://www.aadhav.me/posts/collaborative-editor) +- [CRDT相关的资料集A Conflict-free Replicated Data Type (CRDT) is a data structure that simplifies distributed data storage systems and multi-user applications.](https://crdt.tech/) ## 数值计算 diff --git a/web/quickjs.md b/web/quickjs.md deleted file mode 100644 index 104468b..0000000 --- a/web/quickjs.md +++ /dev/null @@ -1,95 +0,0 @@ -# QuickJS - -> **Atwood's Law**: any application that **can** be written in JavaScript, **will** eventually be written in JavaScript. - -是一个轻量,嵌入式的Javascript引擎,目前(2019.8.9)是bellard的个人项目,可用来学习 - -# source code - -## tool - -### list - -- list.h - -```c -struct list_head { - struct list_head *prev; - struct list_head *next; -}; -``` - -链表头的实现。这样看来不是把数据嵌入到链表中,而是把链表嵌入到其它对象中,来维护这些对象之间的链表关系。 - -### cutils.h/cutils.c - -一些位操作,与内存,字符编码,排序等有关的函数 - -### jscompress.c - -压缩JavaScript代码的小工具 - -```shell -gcc jscompress.c -o jscompress -``` - -### unicode_gen - -- unicode_gen_def.h -- unicode_gen.c - -用来生成unicode的小工具 - -## lib - -### big-float - -- libbf.h -- libbf.c - -big-float大数运算库 - -### unicode - -- libunicode.h -- libunicode.c -- libunicode-table.h - -unicode字符库处理 - -### regexp - -- libunicode.h -- libregexp.h -- libregexp.c - -正则表达式 - -### quick JavaScript libc - -对libc部分函数封装成的基础库 - -## core quick JavaScript - -- quickjs.h -- quickjs.c - -### qjs - -quickjs interpreter - -### qjsc - -quickJS compiler - -## test - -### test262 - -- run-test262.c - - - - - -