duangsuse::Echo
723 subscribers
4.28K photos
130 videos
583 files
6.5K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
Forwarded from 羽毛的小白板
正常人的 typing
duangsuse::Echo
现在对示例程序的编写方式已经比较成熟了,都是直接在一个 literate 写一个模块的某层次的基本构件,再在里面写 depend 它们的示例和辅助示例的算法。
在更新自家 Fedora OS installation 的时候顺便说一下。

之前的模型是一个 Literate 对 N 个 language-kotlin 的代码块,然后显示代码的时候拼起来创建 <code> tag 交给 KotlinPlayground 做后续工作。

现在可以一个 Literate 对 N 个靠“可配置”的 Map<LanguageId, [ElementConfig, Consumer<Element>]> 来(之前那个 ElementConfg 是 DOM ElementAttribute Map、Consumer<Element> 是 PlaygroundGlobalId)

所以 show code 时也不能直接拼一起了,不得不把 filterCode 这个工作流程给取消,直接让 enableCodeFilter 程序靠 filterCodeTag 滤出内部 language-* Element 分语言拼合处理,加 button,其实也不太难,要用到我之前定义的 hist(ogram) 直方图来组织按语言的 <code> 创建,然后可以沿用之前的 <code> 创建工作流,这个过程是按 language 分的 for-each,目标是 appendChildElement。

我个人觉得,应该是给每个 literate 选择一个语言,也更加符合现在 LiterateKt 的设计原模型。

type ElementConfig = Consumer<Element> // defined in dom.ts
type Consumer<T> = (T) => any // defined in util.ts
#recommended bpython
bpython version 0.18 on top of Python 2.7.17 /usr/bin/python2


dreampie

两个都是 Python interpreter 的包装
[DuangSUSE@duangsuse]~% sparkleshare
exception inside UnhandledException handler: The type initializer for 'Sparkles.Logger' threw an exception.

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Sparkles.Logger' threw an exception. ---> System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.
at System.Lazy`1[T].CreateValue () [0x0003a] in <373b6e083d6e45e498c9082a8eebd27f>:0
--- End of inner exception stack trace ---
at SparkleShare.SparkleShare.OnUnhandledException (System.Object sender, System.UnhandledExceptionEventArgs exception_args) [0x0000c] in <330346ba25694cbab2d9ef3ec7a020a1>:0
sudo dnf system-upgrade download --refresh --releasever=31
- package v8-314-3.14.5.10-13.fc29.x86_64 requires libicui18n.so.62()(64bit), but none of the providers can be installed
- package v8-314-3.14.5.10-13.fc29.x86_64 requires libicuuc.so.62()(64bit), but none of the providers can be installed
- libicu-62.2-1.fc29.x86_64 does not belong to a distupgrade repository
- problem with installed package v8-314-3.14.5.10-13.fc29.x86_64

dnf info v8-314

这居然不是 Google V8 JavaScript?是个 3D 库?
duangsuse::Echo
- package v8-314-3.14.5.10-13.fc29.x86_64 requires libicui18n.so.62()(64bit), but none of the providers can be installed - package v8-314-3.14.5.10-13.fc29.x86_64 requires libicuuc.so.62()(64bit), but none of the providers can be installed - libicu-62.2…
Summary      : JavaScript Engine
URL : https://developers.google.com/v8/
协议 : BSD
Description : V8 is Google's open source JavaScript engine. V8 is written in C++ and is used
: in Google Chrome, the open source browser from Google. V8 implements ECMAScript
: as specified in ECMA-262, 3rd edition. This is version 3.14, which is no longer
: maintained by Google, but was adopted by a lot of other software.
不对啊,这么说这只是一个老版本的 v8?我的 node 还能用
duangsuse::Echo
Summary : JavaScript Engine URL : https://developers.google.com/v8/ 协议 : BSD Description : V8 is Google's open source JavaScript engine. V8 is written in C++ and is used : in Google Chrome, the open source browser from Google.…
This is version 3.14, which is no longer maintained by Google, but was adopted by a lot of other software.

$ dnf info v8
Name : v8
时期 : 1
Version : 6.7.17
发布 : 7.fc29

🌚最新版是 6.7
安装 183 软件包
升级 4689 软件包
移除 5 软件包
降级 49 软件包

总下载:6.9 G
DNF 会仅下载软件包、安装 gpg 密钥并检查事务。
duangsuse::Echo
https://github.com/bytemaster/fc_malloc #lowlevel #backend 才想起来 CAS 是 compare-and-swap 非阻塞并行同步 Atomic 操作的意思
The key to developing fast multi-threaded allocators is eliminating lock-contention and false sharing. Even simple atomic operations and spin-locks can destroy the performance of an allocation system. The real challenge is that the heap is a multi-producer, multi-consumer resource where all threads need to read and write the common memory pool.

With fc_malloc I borrowed design principles from the LMAX disruptor and assigned a dedicated thread for moving free blocks from all of the other threads to the shared pool. This makes all threads 'single producers' of free blocks and therefore it is possible to have a lock-free, wait-free per-thread free list. This also makes a single producer of 'free blocks' which means that blocks can be aquired with a single-producer, multiple consumer pattern.

When there is a need for more memory and existing free-lists are not sufficent, each thread maps its own range from the OS in 4 MB chunks. Allocating from this 'cache miss' is not much slower than allocating stack space and requires no contention. Requests for larger than 4MB are allocated direclty from the OS via mmap.
This media is not supported in your browser
VIEW IN TELEGRAM
马上就从 F29 升 F31 了,代码都没写,还有很多东西该学。
https://coolshell.cn/articles/3585.html
SOAP专家: 不知道,使用GET的行为 undefined.

程序员: 哼哼。那么,要是我把我的服务移到别的 endpoint上?我是否可以得到一个301错误?

SOAP专家: 不会的,SOAP不会返回HTTP的错误码。


嗯?HTTP 动词又使用 POST,不是 GET,好像你把信封放那,别人不是有时间了看一下回你,还是立刻就回复一样
就算 GET 有 body 和请求长度上限制算吧,可既然用了 POST,Status Code 不用又是什么意义?
如果只是把 HTTP 当成管道来用,为什么不抽象出一个底层的 SOAP-HTTPTUN 协议?

SOAP专家: RPC!对象序列化!你从哪得到的SOAP就是一堆RPC的这种印象?! SOAP是关于基于文档的消息传递啊,我的朋友。

我的天啊,现在还有人觉得序列化是很重要的东西?难道这不像小白觉得 JavaScript、Lua 和 Ruby 有本质上的区别一样可笑吗?序列化和数据本身无关,和表达格式有关!难道二进制读写器这类东西需要额外再写,不是很差劲的主意吗?

基于文档和 KV 有啥关系和不同???所谓的文档是什么?redis 的 geolocation, sorted set, bitmap, lru 算不算?


SOAP专家: 忘了我所说的吧。现在,让我们谈谈消息传递吧。其消息格式遵守XML Schema,我们把之称为新型的文件格式。

程序员: XML Schema?

SOAP专家: 哦,这是很不错的东西,未来的头等技术,你应该看一下。

程序员: (阅读 Schema 规格说明书). 上帝保佑我们!就算是亚历山大帝也搞不定它啊。

SOAP专家: 不必太担心。会有专门的工作为你来创建XML Schema。真的,这只不过就是工具上的事。


……当一个东西的复杂性需要工具来解决,那些复杂性就本不应该存在。
就像一些人谈编程,他们根本不知道自己写了半天 Java、C,自己写的是什么,更不可能知道 C 的前身是 BCPL、第一个广泛使用的高级语言 Fortran 是 John Backus 于 1957 设计的,更不可能知道自己在用的基础编程方法是『表述式』,结构化编程,是对过程的结构化描述,那时编程是用既有的数据、程序逻辑和语言提供的结构,组织自己的程序,事件、线程、异步,这些通通不特殊。

SOAP专家: 哦,我没有说过吗?WSDL. Web Services Description Language. 它让你指定你的数据类型,参数,操作名,传输绑定,以及endpoint URI,这样,所有的客户程序员就可以访问你的服务了。你应该看看。

其实我设计过一种『WSDL』,它的名字叫 GeekSpec,虽然那时我还很幼稚,我肯定我的设计思想是简单的。
getUserList(name_filter:string) -> array:user = /users
POST@createUser(name:string) = /users

程序员: (阅读WSDL 规格说明书)。我相信那个写下这个文章的人已经被枪杀了。其内部说明都不一致。而且,其用的是HTTP GET绑定,你不是和我说过, GET 是 undefined吗.

SOAP专家: 不必担心那个,没人会用那玩意。


没人会用的设计,会引发非常严重的问题。

总之,工具会帮你生成WSDL,而且在WDSL里会有Schema的。

WSDL 居然是一种『语言』?它是工具生成的?

SOAP专家: 就像是原来那样,只不过,你整个消息被 包装起来成一个元素,其和操作有一样的名字。现在操作名和消息成了一体了。

这就显示出它的不成熟,早产儿。


程序员: 让我总结一下,SOAP的定义是不变的,SOAP可以是任何东西,但就是简单,它不再意味着对象访问,就算是所有的工具都那样做。

SOAP专家: 基本上是对的,但是我们走得比你要远一些。我们不赞成SOAP缩写的含义。

程序员: 真的!那么SOAP是什么的缩写?

SOAP专家: 什么也不是,就是SOAP.
duangsuse::Echo
所以我们在能够区分 case 制造 Element Tree 之前,还需要一个 Map<string, [PlaygroundDefaults, PlaygroundFnGlobalId, PostprocessFn]> 其中 PostProcessFn 可以帮助一些与 #Kotlin Playground 对元素树的结构要求区别很大的 playground 完成兼容,比如修改 hidden text area 的 class 什么的。 #project type PlaygroundDefaults…
什么叫做『设计』呢?举个例子吧。就是上面这种情况,为什么我不用之前想的扩展配置结构:

Map<string, [PlaygroundDefaults, PlaygroundFnGlobalId, PostprocessFn]>

而换用更『不规范』的

Map<string, [ElementConfig, Operation<Element>]> 呢?

我们来看看它们是怎么被使用的,我们有一个钩子函数 function configureLiterateKotlin()。它会在为整个页面添加 show code button 之前对 LiterateKt Script 进行配置。

function configureLiterateKotlin() {

// 『更规范的方法』 [PlaygroundDefaults=Object, PlaygroundGlobalId=String, Postprocess=ElementConfig]

literateKtConfig.language["kotlin"] = [
{/**/},
"KotlinPlayground",
() => {},
];

首先我们就不该写 Postprocess——为什么?难道不应该和前面的 assignDOMAttribute 合并吗?能放在一起的为什么不放一起?能更加可配置的为什么还要用一个全局函数的名字,并且强求那个函数只有一个 (e_code:Element) 参数?
而且我们用了 RequireJS,模块化了 JavaScript 代码,这已经是很『出尘脱俗』的做法了,为什么在这种情况下不允许外部脚本复用 'dom' 这个 JavaScript module?为了兼容老一点的编程风格?

// 正常方法 [ElementConfig, Operation<Element>]

const { withAttribute } = require('dom');
literateKtConfig.language["kotlin"] = [withAttribute({/**/}), e => schedule("KotlinPlayground", e)];

}

type Operation<T> = Consumer<T>
这是我的编程风格,避免任何含糊和“自动类型转换”。
Gradle 实在是太过分了!
Steam 太令人振奋了!