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

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
Forwarded from dnaugsuz
这么说 bounds = 0..0 的情况其实我的程序不是最佳实践!没有利用循环操作的兼容性…… 也没有 require 过 param
#Firefoxabout:config 设置 browser.urlbar.decodeURLsOnCopy 为true 可以复制 UTF-8 解码的 URL
Forwarded from 记挂
这个有没有影响
Forwarded from dnaugsuz
你说是 (html!!) 还是 body?.string() ?
🤔我觉得没影响,你要拿 String 那你就拿 String。
Forwarded from dnaugsuz
如果你要做,还有更好的方法吗……
要这么写就别担心太多

为什么 html 是 var 啊…… 你应该写
val html: String = client.get(LOGIN_API).body?.string() ?: throw Errors.NetError() 不是么…

为什么你要写 html!! 啊,而且如果你只 parse(resp.string()) 的话调用 string() 也没问题啊
Forwarded from 记挂
Forwarded from 记挂
下面要用到。。懒得新建变量了。。
Forwarded from dnaugsuz
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from dnaugsuz
草生,你这么编程的话…… 在一段子程序里,是一类东西都可以叫一个名字了

用户的 1:1 宠物叫 val pat,用户 1:N 的寄养宠物也叫 for (pat in pats) ,然后你就可以把 patpat 变成一个 var 来“复用”废“好大脑力”编造的名字了,真棒……

如非必要,请别写 var …… 你要明白有些 val 都是可以 inline 进引用处的,只不过为了简化代码提升可读性才拆开成不可变具名量,你用 var 语义就全毁了。

真正用 var 的情况往往是 for while 里循环更新变量,你这种完全可以内联的……
Forwarded from Hinnka Zhou
@ask2332 这是你想要的效果吗?
Forwarded from dnaugsuz
#OCR #Java #code
float scale = 246f / 255;
Paint paint = new Paint() ;
ColorMatrix matrix = new ColorMatrix();
matrix.set(new float[] {
scale, 0, 0, 0, 0,
0, scale, 0, 0, 0,
0, 0, scale, 0, 0,
0, 0, 0, 1, 0,
});
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
paint.setColorFilter(filter);
getWindow().getDecorView().setLayerType(View.LAYER_TYPE_HARDWARE, paint);
Forwarded from Hinnka Zhou
matrix.setScale(scale, scale, scale, 1);就可以
Forwarded from dnaugsuz
ColorMatrix.set(float[]) 是有一定 (float[]) 长度要求的吗 🤔
scale 后面跟着4个0 是什么意思
最后一个 1,0 是什么意思
Forwarded from Hinnka Zhou
4x5
Forwarded from Hinnka Zhou
Forwarded from dnaugsuz
哇,一个色彩通道对应 5 个浮点值
Forwarded from dnaugsuz
fun setupColorFilter(scale: Float = 246.0 / 0xFF) {
val matrix = floatArrayOf(
scale, 0,0,0,0,
0, scale, 0,0,0,
0,0, scale, 0,0,
0,0,0,1,0
)
val rgbaMatrix = ColorMatrix().apply { set(matrix) }
val filter = ColorMatrixFilter(rgbaMatrix)
val paint = Paint().apply { colorFilter = filter }
window.decorView.setLayerType(View.LAYER_TYPE_HARDWARE, paint)
}
说实话,看到 #Ruby 关系式求解器 里作者实现了个 Iterable.interleave_with 我觉得挺奇怪的,真的是要 interleave? 总觉得可以 zipWith 什么的,但作者的水平又不可能不知道 zipWith
作者的实现方式也很奇怪, interleaveWith 就是 (xs=[a, b], ys=[c, d]) res=[a, c, b, d] 而已,但他用的方式是一个 Array 不断 push pop 这么 cycle 下去的