#Kotlin #lib #recommended #functional 小值/验证 IO 库
https://github.com/fork-handles/forkhandles/tree/trunk/values4k#show
这个作者感觉可以,尤其是他也很重视程序的一致性(对称性)
In order to maintain symmetry (and to ensure that we can support inline classes), this method is present on the
Little strange but actually consistent because the display and parse logic should NOT be part of the Value itself, but be separated logically.
像
可以手工验证但这不好看,根本解决方法是定义并引用新类型
原来 Factory 在 Kotlin 的标准是
https://github.com/fork-handles/forkhandles/tree/trunk/values4k#show
这个作者感觉可以,尤其是他也很重视程序的一致性(对称性)
In order to maintain symmetry (and to ensure that we can support inline classes), this method is present on the
ValueFactory
instance.Little strange but actually consistent because the display and parse logic should NOT be part of the Value itself, but be separated logically.
像
fun transferMoneyTo(amount: Int, sortCode: String, accountNumber: String)
是不安全的,因为它有 Int,String 值但值无格式(如非负数什么的)可以手工验证但这不好看,根本解决方法是定义并引用新类型
inline class SortCode(override val value: String): Value<String>尤其是可以 inline (新 Kotlin 限定),然后这种方法强化的类型(格式)安全还可以保证
toString()
时把密码码掉什么的(取原值就用 SortCode.show(c)
了)。class Money private constructor(value: Int) : AbstractValue<Int>(value) {然后就可以
companion object : ValueFactory<Money, Int>(::Money, 1.minValue)
}
class AccountNumber private constructor(value: String) : StringValue(value) {
companion object : StringValueFactory<AccountNumber>(::AccountNumber, "\\d{8}".regex)
}
Money.parse("123"), Money.of(123), Money.of(0)/*throw IAE*/, ofOrNull, ofResult4k/*库自定Result<T>类型*/
这样原来 Factory 在 Kotlin 的标准是
ofXXX(_)
😋 很好看GitHub
fork-handles/forkhandles
Foundational libraries for Kotlin. Contribute to fork-handles/forkhandles development by creating an account on GitHub.
#lib #doc #js ACE code editor
https://ace.c9.io/index.html#nav=howto
https://mivik.gitee.io/compress
https://file.xecades.xyz/Linux/GetKeyDown.html
https://stackoverflow.com/questions/8832320/how-can-i-highlight-code-with-ace-editor
https://medium.com/@jackub/writing-custom-ace-editor-mode-5a7aa83dbe50
https://github.com/ajaxorg/ace#features
https://stackoverflow.com/questions/18614169/set-value-for-ace-editor-without-selecting-the-whole-editor '
啊... 感觉 ACE 真的好草啊
设计上大概就是 replace, getValue 这些常用"UI"功能放 root object
replace(range,text), setValue 放 .session
getSelectedText(), insert(s) 放 .selection
但是它的 cursor 真的好难弄啊,为什么是 {line, column} 的形式呢(Range 也是这种,四元形式...),而且都只有 cursor/selection Left/Right/Up/Down 的无参函数,估计只是给 UI 绑定的
那你定义个鸡毛啊! 就这?! 要知道不管什么文本存储后端, LRUD 四向的代码几乎都差不多,你暴露接口,而且不支持 length 只能为 1? 也没有元编程便利性 API 辅助?
而且
无了无了
https://stackoverflow.com/questions/23278238/ace-code-editor-set-language-dynamically
https://stackoverflow.com/questions/20869962/what-are-the-requirements-for-mode-html-in-ace-editor
https://www.xspdf.com/resolution/54957281.html
https://ace.c9.io/index.html#nav=howto
https://mivik.gitee.io/compress
https://file.xecades.xyz/Linux/GetKeyDown.html
https://stackoverflow.com/questions/8832320/how-can-i-highlight-code-with-ace-editor
https://medium.com/@jackub/writing-custom-ace-editor-mode-5a7aa83dbe50
https://github.com/ajaxorg/ace#features
https://stackoverflow.com/questions/18614169/set-value-for-ace-editor-without-selecting-the-whole-editor '
editor.setValue() does selectAll, forgot to unselect it
'啊... 感觉 ACE 真的好草啊
设计上大概就是 replace, getValue 这些常用"UI"功能放 root object
replace(range,text), setValue 放 .session
getSelectedText(), insert(s) 放 .selection
但是它的 cursor 真的好难弄啊,为什么是 {line, column} 的形式呢(Range 也是这种,四元形式...),而且都只有 cursor/selection Left/Right/Up/Down 的无参函数,估计只是给 UI 绑定的
那你定义个鸡毛啊! 就这?! 要知道不管什么文本存储后端, LRUD 四向的代码几乎都差不多,你暴露接口,而且不支持 length 只能为 1? 也没有元编程便利性 API 辅助?
而且
ace.edit(selector, options)
居然没有用,非得 editor.setOptions
才行无了无了
https://stackoverflow.com/questions/23278238/ace-code-editor-set-language-dynamically
https://stackoverflow.com/questions/20869962/what-are-the-requirements-for-mode-html-in-ace-editor
https://www.xspdf.com/resolution/54957281.html
session()
也挺有意思的,但凡桌面应用都要有撤销重做的能力,这个是 .setMode("ace/mode/sql")
都能重做一样Stack Overflow
How can I highlight code with ACE editor?
I'd like to syntax highlight more than a dozen small snippets of code and then make them editable with ACE Editor by clicking on them, since I think it would be much faster than setting up the full
#js #lib #performance #gui https://editor.datatables.net/generator/
🤔 想起了 #Qt Model/View 的 delegate 和 createEditor 什么的... 但其实从 row 建立可搜索、可排序、可编辑的 table 并不需要那么多名词吧
https://github.com/fiduswriter/Simple-DataTables
嘛,虽说是 lightweight ,其实连 Date format 都支持...
http://fooplugins.github.io/FooTable/ 感觉还是这个最好看
https://github.com/frappe/datatable 这个也支持 inline editing
https://github.com/future-architect/cheetah-grid 有创意,内带比率可视化支持
https://github.com/mleibman/SlickGrid/wiki/Examples 感觉最糟糕的一个
https://github.com/bvaughn/react-virtualized 第二糟糕的
https://github.com/ratiw/vue-table 最像 Qt 的一个... 不对,这不像 Qt
https://github.com/jiren/StreamTable.js 支持 #stream 但只能用 templating 的一个
http://swimlane.github.io/ngx-datatable/#filter Angluar 的一个
https://github.com/daniel-nagy/md-data-table#demo Material #Design 的一个,作者眼力是不是不好... README.md 那么多示例 table 放着呢
https://clusterize.js.org/ #performance #web 🤔给 <tr> 甚至 <il> <div> tag 做 chunking 的简易 js 优化
🤔 想起了 #Qt Model/View 的 delegate 和 createEditor 什么的... 但其实从 row 建立可搜索、可排序、可编辑的 table 并不需要那么多名词吧
https://github.com/fiduswriter/Simple-DataTables
嘛,虽说是 lightweight ,其实连 Date format 都支持...
http://fooplugins.github.io/FooTable/ 感觉还是这个最好看
https://github.com/frappe/datatable 这个也支持 inline editing
https://github.com/future-architect/cheetah-grid 有创意,内带比率可视化支持
https://github.com/mleibman/SlickGrid/wiki/Examples 感觉最糟糕的一个
https://github.com/bvaughn/react-virtualized 第二糟糕的
https://github.com/ratiw/vue-table 最像 Qt 的一个... 不对,这不像 Qt
https://github.com/jiren/StreamTable.js 支持 #stream 但只能用 templating 的一个
http://swimlane.github.io/ngx-datatable/#filter Angluar 的一个
https://github.com/daniel-nagy/md-data-table#demo Material #Design 的一个,作者眼力是不是不好... README.md 那么多示例 table 放着呢
https://clusterize.js.org/ #performance #web 🤔给 <tr> 甚至 <il> <div> tag 做 chunking 的简易 js 优化
GitHub
GitHub - fiduswriter/simple-datatables: DataTables but in TypeScript transpiled to Vanilla JS
DataTables but in TypeScript transpiled to Vanilla JS - fiduswriter/simple-datatables
dnaugsuz
你们真没有做过绘制的人嘛 噢对,这里是 Python 群…… 基本都是后端或者框架使用者 能不能问一下绘制算法是 ys.forEach((y,x) => g.lineTo(x, h-h* y/yBounds )) 的情况下 x 轴(y=0) 的绘制点 y 如何定义 y 轴的又如何定义…… 就连化 x 轴(y=y_func(vy+yzero) 其中 vy是y offset yzero 是y=0时z ,的方法都是我试出来的 而且中途还修了一个低级数据语义bug 哭死了
(其实是我根本没想好
就增加一个「相对x轴」功能,默认关闭
嗯……刚才想了几个特性
首先是 Desmos 的跟踪函数曲线,这个比较简单, click 的时候 mouse 若有
目前函数列表是没做的情况,做了估计要支持 enabled, color, expr 的编辑(是)
然后是缩放动画(补间函数可参考这个) 以及手动缩放钮,应该安排下, touchscreen 的 press 也没 handle
整个 navi panel 也不能最小化看整体图像,得做一下
Nivalis 的 variable slider 是很棒的设计, 有必要加一个
另外
隐式绘图 (画圆什么的) 可能优化的情况比较多,我也不了解代数符号系统那边什么情况,和 yuuta 一样,暂时只支持 x 变量
只能说 #math #cplusplus #js #web #tools 大佬 始终是大佬 ,而且 JVM 端大佬也不少
#Linux 系也有 KDE 的 KAlgebra 和普通工程计算器 KCalc
https://c3d.libretexts.org/CalcPlot3D/index.html 这还有个 3D 的
https://wiki.archlinux.org/index.php/List_of_applications/Science#Computer_algebra_system #listing
KDE 还指什么 Kernel Dense Estim. 的图 #lib #Python https://seaborn.pydata.org/index.html
草
with(window) { width, height }
和 x,y 的对应关系(就增加一个「相对x轴」功能,默认关闭
嗯……刚才想了几个特性
首先是 Desmos 的跟踪函数曲线,这个比较简单, click 的时候 mouse 若有
y_func(x)==y
,把它高亮下,直到 mouseup 时显示 y_func(x) 就可以了目前函数列表是没做的情况,做了估计要支持 enabled, color, expr 的编辑(是)
然后是缩放动画(补间函数可参考这个) 以及手动缩放钮,应该安排下, touchscreen 的 press 也没 handle
整个 navi panel 也不能最小化看整体图像,得做一下
Nivalis 的 variable slider 是很棒的设计, 有必要加一个
另外
dim2Cfg
这个配置对象,也应该给做个 modal dialog 的配置编辑器隐式绘图 (画圆什么的) 可能优化的情况比较多,我也不了解代数符号系统那边什么情况,和 yuuta 一样,暂时只支持 x 变量
只能说 #math #cplusplus #js #web #tools 大佬 始终是大佬 ,而且 JVM 端大佬也不少
#Linux 系也有 KDE 的 KAlgebra 和普通工程计算器 KCalc
https://c3d.libretexts.org/CalcPlot3D/index.html 这还有个 3D 的
https://wiki.archlinux.org/index.php/List_of_applications/Science#Computer_algebra_system #listing
KDE 还指什么 Kernel Dense Estim. 的图 #lib #Python https://seaborn.pydata.org/index.html
草
KDE.org
KAlgebra Mobile
Graph Calculator
列一些有趣的社区项目 #math #listing #Java
https://www.desmos.com/calculator/i6fijibmbz
#GUI 系列:
https://github.com/darsam44/Mini-desmos (吐嘈: 真的不迷你)
https://github.com/DanielZhangD/Javmos
https://github.com/LitterallyTheCoolestGuy69/Desmos-But-Scuffed
#Python 转换/等式代码生成脚本系列:
https://github.com/MrNewdary/svg2desmos/blob/main/svg2desmos.py
https://github.com/anematode/parametrizer/blob/master/undeletable.py
https://github.com/allesspassig/despy/blob/master/despy.py
https://github.com/emily-yu/image-to-desmos OpenCV #cv
#music https://github.com/AlexApps99/MIDI2Desmos 听 MIDI 函数图系列...
多项式课系列:
https://github.com/galbar07/Desmos
https://github.com/yonatan555/Desmos-Polynom
https://github.com/JiangTianXiang/Grade-12-Calculus-Graphing-Calculator
https://github.com/WhoIsKatie/Javmos
https://github.com/TimChoy/javmos
https://github.com/DvirTomer/Desmos-Polynom
乱入:
https://github.com/andrewpareles/Calculator/blob/master/main.ml
https://github.com/Tuttivers/ExponentialSeekbar-sample/blob/master/NearMeSeekBar.kt#L75 #Kotlin #Android
https://mukunthag.github.io/SHM/ 振荡器什么的...
https://github.com/Rob--/root-approximations/blob/master/evaluatex.js#L190 #JavaScript #lib #parsing 几百行的符号代数系统...
可移植性/项目管理极差的 GUI:
https://github.com/Pi-Man/Graphing-Calculator/tree/master/Graphing-Calculator
https://github.com/RohanK22/cppmathtool
http://well-made-territory.surge.sh/Desmos.html
https://github.com/softchickenidiot/3D-Grapher/tree/master/3D Grapher
https://www.desmos.com/calculator/i6fijibmbz
#GUI 系列:
https://github.com/darsam44/Mini-desmos (吐嘈: 真的不迷你)
https://github.com/DanielZhangD/Javmos
https://github.com/LitterallyTheCoolestGuy69/Desmos-But-Scuffed
#Python 转换/等式代码生成脚本系列:
https://github.com/MrNewdary/svg2desmos/blob/main/svg2desmos.py
https://github.com/anematode/parametrizer/blob/master/undeletable.py
https://github.com/allesspassig/despy/blob/master/despy.py
https://github.com/emily-yu/image-to-desmos OpenCV #cv
#music https://github.com/AlexApps99/MIDI2Desmos 听 MIDI 函数图系列...
多项式课系列:
https://github.com/galbar07/Desmos
https://github.com/yonatan555/Desmos-Polynom
https://github.com/JiangTianXiang/Grade-12-Calculus-Graphing-Calculator
https://github.com/WhoIsKatie/Javmos
https://github.com/TimChoy/javmos
https://github.com/DvirTomer/Desmos-Polynom
乱入:
https://github.com/andrewpareles/Calculator/blob/master/main.ml
https://github.com/Tuttivers/ExponentialSeekbar-sample/blob/master/NearMeSeekBar.kt#L75 #Kotlin #Android
https://mukunthag.github.io/SHM/ 振荡器什么的...
https://github.com/Rob--/root-approximations/blob/master/evaluatex.js#L190 #JavaScript #lib #parsing 几百行的符号代数系统...
可移植性/项目管理极差的 GUI:
https://github.com/Pi-Man/Graphing-Calculator/tree/master/Graphing-Calculator
https://github.com/RohanK22/cppmathtool
http://well-made-territory.surge.sh/Desmos.html
https://github.com/softchickenidiot/3D-Grapher/tree/master/3D Grapher
Desmos
Final Project
#web #js #ux #doc PointerEvent
https://www.davrous.com/2015/08/10/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy/
#lib https://github.com/jquery/PEP
#doc https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Using_Touch_Events
https://rbyers.github.io/paint.html
http://hammerjs.github.io/getting-started/ Pinch (touch scale)
https://www.davrous.com/2015/08/10/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy/
#lib https://github.com/jquery/PEP
#doc https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Using_Touch_Events
https://rbyers.github.io/paint.html
http://hammerjs.github.io/getting-started/ Pinch (touch scale)
David Rousset
Unifying touch and mouse: how Pointer Events will make cross-browsers touch support easy
I often get questions from developers like, “with so many touch-enabled devices on phones and tablets, where do I start?” and “what is the easiest way to build for touch-input?” Short answer: “It’s complex.” Surely there’s a more unified way to handle multi…
#TypeScript #lib #doc https://util.liuli.moe/@liuli-util/async/ 有一大堆
https://util.liuli.moe/@liuli-util/array/ 包含 swap, groupBy, segment(即 chunked), diffBy, uniqueBy 等处理函数 ,还有 arrayToMap(即 associate)
https://util.liuli.moe/@liuli-util/string/#StringValidator.isEmail 非常实际的一个值验证
https://util.liuli.moe/@liuli-util/dom/ 包含一些下载 ArrayBuffer 之类的处理,不过没有复制到剪贴板的
https://util.liuli.moe/@liuli-util/other/#EventEmitter EventTarget 一类对象实现
https://util.liuli.moe/@liuli-util/test/#countTime 这个就是
此外还有 tree 库,支持 treeEach 后序遍历树结构,treeToList (即 flatten , 还有 treeFilter 的变体)
concatMap
, debounce
, wait
等操作的 async 组合库https://util.liuli.moe/@liuli-util/array/ 包含 swap, groupBy, segment(即 chunked), diffBy, uniqueBy 等处理函数 ,还有 arrayToMap(即 associate)
https://util.liuli.moe/@liuli-util/string/#StringValidator.isEmail 非常实际的一个值验证
https://util.liuli.moe/@liuli-util/dom/ 包含一些下载 ArrayBuffer 之类的处理,不过没有复制到剪贴板的
https://util.liuli.moe/@liuli-util/other/#EventEmitter EventTarget 一类对象实现
https://util.liuli.moe/@liuli-util/test/#countTime 这个就是
measureTime { }
,要是能写成 Python timeit 的形式就好了此外还有 tree 库,支持 treeEach 后序遍历树结构,treeToList (即 flatten , 还有 treeFilter 的变体)
#info #design #web #lib #ali #security 据悉今天阿里 Antd #GitHub 账号被盗
https://tttttt.me/im_RORIRI/870
上频道言,相关事件:
https://github.com/alibaba/nacos/issues/4593
https://tttttt.me/im_RORIRI/870
上频道言,相关事件:
https://github.com/alibaba/nacos/issues/4593
Telegram
螺莉莉的黑板报
【本报讯】阿里员工因未开 2FA 造成账号失窃,仓库 ownership 被转移,Ant Design 仓库失联一上午。
我再强调一遍,综合 HoHoHo 事件,Antd 是一个完全不可信任的 UI 库,无论是工程质量还是开发人员的基本素质都达不到一般开源产品的水平,我们不推荐您在自己的项目中使用任何阿里开源产品。
我再强调一遍,综合 HoHoHo 事件,Antd 是一个完全不可信任的 UI 库,无论是工程质量还是开发人员的基本素质都达不到一般开源产品的水平,我们不推荐您在自己的项目中使用任何阿里开源产品。
#java #lib 解析xml有什么简单点的办法?
DOM/SAX/XMLPull 手动转型
SimpleXML/JAXB 注解
🌚
SXML 支持注解 databind
我看最简单的方法是用 ruby 或 js (
Erbzur:
手动解析(pull)不是很难复用吗?偏偏xml一堆自定义tag
duangsuse:
JAXB-databind
果然还是注解自动构造的好用
手动解析也可以复用的,但是 pull 的话就会麻烦很多
<users>
<user id=wtf><friends>name
这样的要变成 List<User> 其实不需要几行代码,只是在定义 schema 的同时就能 bind 过去了这样。
啊…… 看来对于强类型语言的 Java 不用 annotation+reflect 想组织 data class 还是不行呢。
调用构造器的话就必须是用反射,否则…… 函数式组合子那一套不起效了,除非用 NamedTuple
DOM/SAX/XMLPull 手动转型
SimpleXML/JAXB 注解
🌚
SXML 支持注解 databind
我看最简单的方法是用 ruby 或 js (
Erbzur:
手动解析(pull)不是很难复用吗?偏偏xml一堆自定义tag
duangsuse:
JAXB-databind
果然还是注解自动构造的好用
手动解析也可以复用的,但是 pull 的话就会麻烦很多
<users>
<user id=wtf><friends>name
这样的要变成 List<User> 其实不需要几行代码,只是在定义 schema 的同时就能 bind 过去了这样。
啊…… 看来对于强类型语言的 Java 不用 annotation+reflect 想组织 data class 还是不行呢。
调用构造器的话就必须是用反射,否则…… 函数式组合子那一套不起效了,除非用 NamedTuple
#Java #lib 话说 jmod 的变动也挺有意思的,原来 jar 只能放 .class 和 resources ,现在 jmods 能放 lib/ bin/ conf/ legal/ 等一大堆东西了,据说还能热更新。
不过
还有 Apache 的 xalan XSLT compiler 和 xerces, jaxp 啥玩意
不得不说把 Java 和 C++ 一比,我还是觉得 C++ 的“设计模式”有范一些,至少不会制造麻烦。 🌚
一般都是用
或
7z x /usr/lib/jvm/default/jmods/java.xml.jmod classes/javax/xml/catalog/CatalogMessages_zh_CN.properties感觉J2EE实现真是很神奇,不仅有 Apache 的 BECL 与 Objectweb ASM ,还有 Java_cup 生成的解析器…… 真是太逗了
cat `find classes -name CatalogMessages_zh_CN.properties` |python -c 'import sys,re; print("".join(eval(f"\"{s}\"") for s in re.findall(": (.*)\\n", sys.stdin.read()) if "\"" not in s))'
不过
javax.xml
包也封了最关键的 stream (start-end element 的 pull 事件), xpath 甚至 namespace.QName
当然还有 datatype 和 catalog, validation, transform (我觉得最草的两个)还有 Apache 的 xalan XSLT compiler 和 xerces, jaxp 啥玩意
不得不说把 Java 和 C++ 一比,我还是觉得 C++ 的“设计模式”有范一些,至少不会制造麻烦。 🌚
一般都是用
org.xml.sax.Parser
或 org.w3c.dom.Document
或
javax.xml.parsers.SAXParser
和 DocumentBuilder
w3c 的 DOM 抽象弄得挺全的啊,除了 Node/Element/Attr/Text , MouseEvent 和 MutationEvent 都有…… (text)Range 和 NameList, Comment, traversal.TreeWalker ...噢, Reactive 就是 c=a+b 自动更新 c 呀,我之前想了几次呢。 一般不用 onresize 之类的事件很麻烦呢 #Web #DontKnow #JS #lib
而且还能做到数据变动视图自动更新,耳不仅是单向的视图更改数据,有点意思。 #functional #ce
然后对于控件的 computed() 用了特殊语法 $: a+b (label statement) 表示,应该说也是很实践性
“ 在「古典」React 里,你不得不写 shouldComponentUpdate, 在现代 React, 你同样需要引入 useCallback 和 useMemo,手动地缓存函数,来避免性能问题。
同样是使用 Virtual DOM 的 Vue 却没有这个问题,因为 Vue 的机制(依赖收集)决定了它不必重新执行整个 UI 函数来换取新的 Virutal DOM 树,当某个状态更新的时候,它明确地知道应该 diff 哪些节点。
这么看 React 真是傻逼,不过是提供了无作用域的 state ,竟然要重渲染整体 UI?难道不能收集出有哪些变量节点用了被更新变量么,这不是基础操作?
而且还能做到数据变动视图自动更新,耳不仅是单向的视图更改数据,有点意思。 #functional #ce
然后对于控件的 computed() 用了特殊语法 $: a+b (label statement) 表示,应该说也是很实践性
“ 在「古典」React 里,你不得不写 shouldComponentUpdate, 在现代 React, 你同样需要引入 useCallback 和 useMemo,手动地缓存函数,来避免性能问题。
同样是使用 Virtual DOM 的 Vue 却没有这个问题,因为 Vue 的机制(依赖收集)决定了它不必重新执行整个 UI 函数来换取新的 Virutal DOM 树,当某个状态更新的时候,它明确地知道应该 diff 哪些节点。
这么看 React 真是傻逼,不过是提供了无作用域的 state ,竟然要重渲染整体 UI?难道不能收集出有哪些变量节点用了被更新变量么,这不是基础操作?