2021年国庆
七十二年又华诞,
甲子地支各一轮。
茹苦含辛终渐老,
忠孝未尽愧吾心。
碌碌人生是所愿,
空空苟活非所殷。
平平淡淡侬常在,
来年新月复照人。
Golden hour黄金一小时
The Golden Hour – When Sunlight Turns Magical
黄金一小时是摄影的概念,指的太阳与地平线呈6度以内的角度时, 光色为金色.
Electron Preload.js和renderer.js上下文隔离问题
eletron 12版本以后默认开启了上下文隔离
webPreferences: {
contextIsolation: true,
}
上下文隔离后, 内存变成了不一样的区域, 通过桥接函数contextBridge.exposeInMainWorld
从preload转移过去的都是复制的内容, 桥接过去的obj也是复制的, 在render中修改并不会影响preload. 甚至ipcRender也不能直接桥接过去, .on
会丢失.
可是renderer中最重要的就是ipc消息交互了. ipcRenderer.on用不了要如何监听ipcMain发过来的消息?
Eletron官方文档中居然都没有写如何桥接.on
,只写了.send
和.invoke
参考这个回答吧: https://stackoverflow.com/questions/59993468/electron-contextbridge
两个人给出了两种方式:都是preload.js
第一种:
const {
contextBridge,
ipcRenderer
} = require("electron");
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld(
"api", {
send: (channel, data) => {
// whitelist channels
let validChannels = ["toMain"];
if (validChannels.includes(channel)) {
ipcRenderer.send(channel, data);
}
},
receive: (channel, func) => {
let validChannels = ["fromMain"];
if (validChannels.includes(channel)) {
// Deliberately strip event as it includes `sender`
ipcRenderer.on(channel, (event, ...args) => func(...args));
}
}
}
);
第二种:
const { ipcRenderer, contextBridge } = require('electron')
const validChannels = ["toMain", "myRenderChannel"];
contextBridge.exposeInMainWorld(
"api", {
send: (channel, data) => {
if (validChannels.includes(channel)) {
ipcRenderer.send(channel, data);
}
},
on: (channel, callback) => {
if (validChannels.includes(channel)) {
// Filtering the event param from ipcRenderer
const newCallback = (_, data) => callback(data);
ipcRenderer.on(channel, newCallback);
}
},
once: (channel, callback) => {
if (validChannels.includes(channel)) {
const newCallback = (_, data) => callback(data);
ipcRenderer.once(channel, newCallback);
}
},
removeListener: (channel, callback) => {
if (validChannels.includes(channel)) {
ipcRenderer.removeListener(channel, callback);
}
},
removeAllListeners: (channel) => {
if (validChannels.includes(channel)) {
ipcRenderer.removeAllListeners(channel)
}
},
}
);
Vue3入门
选择global版本
<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.0-beta.7/vue.global.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.0-beta.7/vue.global.min.js"></script>
文档准备好后再运行脚本
var ready = function ( fn ) {
// Sanity check
if ( typeof fn !== 'function' ) return;
// If document is already loaded, run method
if ( document.readyState === 'complete' ) {
return fn();
}
// Otherwise, wait until document is loaded
document.addEventListener( 'DOMContentLoaded', fn, false );
};
防止看到花括号
<div id="app" class="app" v-cloak>{{counter}}</div>
[v-cloak]{
display: none!important;
}
xml与js object(json)互转
node上还是使用xmlbuilder2, 支持两者的互转.
rhino做剖面图的方法
https://www.bilibili.com/read/cv7568289/
1. Section 命令
输入section
命令, 选择要剖的物体, 再画一条剖线, 就会生成2D曲线, 不要乱点击, 直接将2D曲线移动出来即可.
2. 用截平面视图
将视图调整为截平面
, 画一个截平面, 然后就能直接看到剖面.
freecad插入工程2d视图
https://www.bilibili.com/read/cv6183523/
做法:
- 切换到
TechDraw
工具组 - 点击最左边的
插入默认页
, 会插入一个新的2D绘图页. 并且视图Tab页和组合浏览器->模型
中会增加一个Page
- 点击回3D视图页面, 选择要插入2D图纸的零部件,并且将视图角度旋转到需要表现的角度;
- 点击
插入视图
,将插入2D视图到2D图纸. - 刚插入的可能很丑.点击选中插入的视图, 修改左侧
组合浏览器
中的数据
属性, 将Coarse View
设置为True, 选择Rotation
旋转调整角度, 选择数据
属性, 将Line Width
设置为0.1mm
. - 在2D视图上点击右键选择导出为SVG, 保存即可.
Windows tortoiseGit会因文件名大小写改变而无法正确识别文件状态
Windows上安装TortoiseGit后,已经commit的文件会打√
, 未加入版本管理的文件会打?
, 有修改的文件或者文件夹会打!
, 刚刚加入文件管理,但还没有commit的会打+
.
如果对项目进行commit时, tortoiseGit发现不了任何的新的修改,然而项目目录上就是有个!
, 跟着!
一路进入会找到若干个文件上打着?
,但这些文件明明已经commit并且也没有任何修改,这时候一般是这几个文件的文件名大小写改变导致的.
登录git的WEB服务器端查看这几个文件名与本地的异同, 将本地文件名大小写改为与服务器一致就可以解决,文件将恢复√
状态.
jekyll根据Url的Get参数动态变更内容
jekyll本身是预处理成静态页面,所以是不支持的。如果还是只用静态页面服务器的话,要支持只能从js上想办法。
JS获得GET参数
location.search
可以获取get参数, 如?b=qq&c=dd
,然后将其转化为json对象,我用的是字符串替换+JSON.parse
let urlParams = JSON.parse('{"'+location.search.substring(1).replace(/=/g,'":"').replace(/&/g,'","')+'"}')
对单个DOM元素在JS中修改
给DOM元素加id
,再通过js修改即可。
document.getElementById('name').innerText = someNewName
按GET参数不同显示不同的post
可以先在css中设置class,属性是display:none
将元素隐藏,然后将所有的post按打上不同的class标记,再在js中遍历post的元素,将需要显示的class标记删除。
css:
.qq,.tr{
display:none;
}
预处理前的liquid代码
<li class="{{post.b}}"> ....</li>
js代码
var all = document.getElementsByClassName(urlParams.b);
console.log(all.length)
//这儿删除了 i++, 因为 每次使用classList.remove, 都会让当前的all[i]从all的数组中删除, 数组会不断变短直至为0
for (var i = 0; i < all.length;) {
all[i].classList.remove(urlParams.b)
}
批量修改class颜色
可以通过css变量
参考:https://stackoverflow.com/questions/9436123/javascript-changing-a-class-style/65471649
:root {
--some-color: red;
}
.someClass {
color: var(--some-color);
}
Then you can change the variable's value in Javascript with
document.documentElement.style.setProperty('--some-color', '(random color)');
矿机改做AI训练?
2018年的文章: 【年薪千万超级矿工】共享矿机训练神经网络,收益是挖矿4倍
Magic Eye
ESP8266腾讯Qcloud AT命令集
中国纹饰及其含义
其他参考文献
传统窗格图案几何纹饰及其艺术特征
V1分布图
根据企查查2021-8-18
Floor | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 总计 | 计数 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4-7 | 1 | 1 | 1 | |||||||||||||||
8 | 1 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 10 | 8 | ||||||||
10 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 7 | 2 | 20 | 11 | |||||
12 | 1 | 1 | 1 | 1 | 1 | 1 | 4 | 2 | 12 | 8 | ||||||||
14 | 2 | 1 | 2 | 1 | 1 | 7 | 5 | |||||||||||
16 | 2 | 1 | 1 | 2 | 2 | 1 | 1 | 10 | 7 | |||||||||
18 | 1 | 2 | 2 | 7 | 1 | 1 | 1 | 15 | 7 | |||||||||
20 | 1 | 2 | 2 | 5 | 3 | |||||||||||||
22 | 2 | 2 | 1 | 1 | 2 | 3 | 11 | 6 | ||||||||||
26 | 2 | 1 | 3 | 1 | 1 | 8 | 5 | |||||||||||
28 | 1 | 8 | 1 | 3 | 3 | 1 | 1 | 18 | 7 | |||||||||
30 | 1 | 2 | 3 | 2 | ||||||||||||||
总计 | 3 | 5 | 16 | 1 | 3 | 2 | 1 | 3 | 4 | 12 | 14 | 12 | 6 | 10 | 17 | 11 | 120 | |
计数 | 3 | 4 | 6 | 1 | 2 | 2 | 1 | 2 | 2 | 8 | 7 | 7 | 5 | 6 | 7 | 7 |