-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.xml
437 lines (208 loc) · 85.2 KB
/
search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>the-horse-and-his-boy</title>
<link href="/the-horse-and-his-boy/"/>
<url>/the-horse-and-his-boy/</url>
<content type="html"><![CDATA[<p>Author: C.S.LEWIS<br>a series of the chronicles of Narnia.<br>BOok 3</p><p>在一故事的一开始,是一个偏僻小地方,那里有一个渔民和他收养的小孩子。一天不同寻常的事情发生了,一个来自大都市Tarkaan 的一个骑马的人来到了渔民的家里,渔民拿出了好吃好喝的出来招待,后面他们背着渔民收养的小伙子Shasta 进行着秘密的谈话。<br>他们的密谋是渔民要把小伙子Shasta 卖给来的客人,因为客人出的价钱不在渔民的预期之内,也就是价钱太低了,于是就进行了一番讨价还价。不巧地是,他们的谈话被我们的小伙子Shasta窃听了。<br>听到了谈话的Shasta到了马厩,自言自语地对着那个陌生人带来的马说话,冷不防地马开始说话了,这让Shasta 大吃一惊,经过一番对话,他们两人同意一起逃走。从谈话中Shasta 了解到了会说话的马来自于narnia,它是被拐卖的,也了解了它的过往经历。<br>在跑路的过程中,他们定下的目标就是到北方也就是narnia 的地盘。Bree这是Shasta 给会说话的马起的名字,说有一个马术精湛的人在不远处跟踪他们,在狮子的威胁下,这两波人被迫聚集在了一起。这下子,跟踪Shasta 的人的身份也就随着谈话揭晓了,原来这竟然是一个逃婚的领主的女儿,有趣的是,这个Aravis也骑着会说话的马,Hwin,接下来就是Aravis逃婚和遇到Hwin 的具体过程。<br>接下来就是Aravis 和Hwin 一人一马加入了他们。经过一番商讨,他们乔装打扮进入了Tashbaan,他们约定在一个地方汇合那个地方叫做the tombs of the ancient ,以他们会走散的前提下。正当他们以为能够轻松穿过城市时候,变故发生了,Shasta 被捉住了,似乎是和narnia 来的王子Corin 长得像,被误以为是他。<br>为什么narnia 的王子会来到tisroc 这个国家呢?王子自然是由国王和女王们带来的。为什么会有几个国王和女王呢?这是发生在故事第二部《the lion,the witch,the wardrobe》里面。还有随同来的亚人(半人半羊)?他们遇到了什么危机呢?原来女王Susan 被Tisroc这个国家的王子看上了,要求她嫁给王子。narnia的这些国王和也意识到了危机的临近,他们也在考虑思考出路和解决的办法?<br>Shasta 在这里住的非常安适,乐不思蜀,某一天失踪的Corin 王子从窗外回来了。Shasta 和Corin 王子发生了一段对话,然后Shasta 根据Corin 的指示爬出了窗外,到了屋顶之上。 几乎相当于飞檐走壁似的穿过了城区。到了城外他们约定好的地点古君王的陵墓。<br>只有Shasta 到了,不见其他人和马。一个人在墓地一遇到风吹草动就会神经质地以为有非自然生物。在期间,他遇到了一只猫,那个猫给人的感觉非同寻常。过了几天吧,他看到一个马夫带领着两匹马,而这两匹马正是Bree 和Hwin 。他不敢过去,怕是一个诱拐他的阴谋。</p><p>那么他的伙伴Aravis 为什么没有来呢?事情要回到Shasta 被narnia 的人捉去的时候,Aravis 的闺蜜一眼就在人群中发现了她,这个闺蜜是个有话就说的天真人,非常的单纯不会思考过多的隐情,认出来自然要大声叫出名字,随后就是久别重逢的再续闺中 情。马儿们自然也跟着,她们两个合计想出了一个方法使得Aravis 穿过Tashbaan,让马夫先带着两匹马到君王墓等候,她随后就到。这两个闺蜜到王都宴会偶然在一处密室碰到了tisroc 的王子和国王大臣密谋侵吞archenland再然后就是narnia 。<br>等到Aravis和Shasta 汇合,她把她听到的阴谋对大伙说了,大家都同意赶在王子之前给narnia 的通风报信。他们一路上风餐露宿,长途跋涉,终于到了Archenland,这里山清水秀,景色宜人也宜马。在他们快要松懈下来的时候,前面来了一只狮子,他们只有玩命地跑,在后面的Aravis 收到狮子的攻击的时候,Shasta 勇敢地站出来喝退了狮子,在后面众人对Shasta 的印象发生了改观。他们到了一处隐士的屋子,隐士告诉Shasta 他应该立刻马不停蹄地到king lune 的驻地传达tisroc的王子带领军队要来袭击Archenland 的消息,而在另一边隐士的家里,隐士为Aravis 治疗了伤势,用美味的水草犒劳了两匹马,而我们的马儿Bree 还在因为面临狮子的危机时刻一心只想逃而没有顾及到队友的自私感到无地自容在耍脾气,一匹马独自在那生自己的闷气,特别是在模范英雄Shasta 的英勇身姿的映衬之下。幸好有队友和饮食的开导。<br>话分两头,我们的勇士Shasta 一路快跑在一处林地遇到了anvard 的王Luue,并把袭击的消息告诉了王,王Lune 自然开始了行动,比如说赶快回城关城门。<br>我们的信使因为脚下的马儿不配合而落后于大部队,后面甚至只剩下他们一人一马了,随着异象出现了narnia 的神的化身狮子,经过一开始的恐惧,Shasta 对狮子大吐心中的不快,讲述了出生以来遭遇到的厄运和近些天进行的冒险。而狮子也向Shasta说了一些关于Shasta 的隐情和身世和他们一路来的偶遇都是它促成的。<br>等到他醒过来时候已经到了narnia。在这里他遇到了当地的居民也就是会说话的野兽,他给它们说了袭击的事情,它们就把消息传递出去了。然后居民略尽地主之谊,dwarf 给他做了一顿大餐,他也吃的心满意足,吃饱喝足后到外面看美景去了,Shasta 一会就沉沉睡去了。</p><p>等到消息传到了narnia 的王都 caral paravel,军队集结。在隐士的屋子里面湖泊里面正有着正发生在战场的影像,只有画面没有声音。narnia 和tisroc 的军队两军会面于一处地方,narnia 一方有哪些阵容?有国王和女王列阵于军队前面,我们的王子Corin和Shasta 见了面隐藏在了军队中,军队中有各种会说话的野兽,比如说马,centaur s,dwarf 等等.战局的最后自然是narnia 的一方取得了胜利,tisroc的王子rabadash 被俘虏。到这里,隐士的镜像就结束了,因为接下来主要是谈话,没有什么好看的。<br>而正发生在现场的大型认亲场面,则是和Shasta 和Corin 相关,原来他们竟然是双胞胎。<br>事情的前因后果,等到我们的Cor王子到了隐士的家里来了,想要接纳Aravis。然后Cor 也就是Shasta说了Lune 王告诉他的关于他的身世。在Cor 和Corin 出生后,他们被 带到了先知centaur 的家里,先知一看到Cor就说他能拯救Archenland大陆于危难之中。而Lune 的大臣显然不满意这个预言,而且因为大臣是一个叛国贼,偷偷滴把Archenland 的消息传出去。大臣就把Cor 拐骗出国家,等到Lune 发现的时候,派出大船前去追击,据说发生了海战。最后大臣战败,只是因为大臣知道自己的败局已定,Cor 王子早已经被转移了。在大海孤独流浪的Cor 和一位没有姓名的骑士,动了恻隐之心的骑士选择牺牲自己的生命也就是饿死自己给予了孩子以新生,并且在狮子的暗中帮助下到了河岸被一个渔民收养了。<br>讲完了他的身世,Cor把Aravis 接到了他父亲的宫殿。然后两匹马也得到了适宜的安排。他们到了Lune 的宫殿,在那里narnia的国王和王后都在那,因为刚刚打完仗,商量rabadash的处置。这群善良的王决定从轻发落,只是要附加一些条件,而rabadash 根本就不想听,在那不停咒骂。<br>过了一会儿,narnia 的神的化身狮子无声无息地出现在了大厅里面,狮子见rabadash 油盐不进,一会儿功夫在众人的见证下rabadash 变成了一只驴子。<br>变成了驴子的rabadash 被送回了tisroc,根据狮子的预言,在Tisroc的神庙里面并且在民众的见证下又变回了人的身体。但是他自此之后不能够离开神庙的区域,否则会变成驴子而且不能变回来。自此对于周边的国家来说是件好事,因为等到rabadash 继承王位时,他一生都没有对外发动过战争,人们称他为和平缔造者,而在rabadash 死后,他成了人们的笑话。<br>之后narnia 的人们举行了盛大的宴会。</p>]]></content>
<tags>
<tag> digest </tag>
</tags>
</entry>
<entry>
<title>the-magician's-nephew</title>
<link href="/the-magician's-nephew/"/>
<url>/the-magician's-nephew/</url>
<content type="html"><![CDATA[<p>Author: C.S.LEWIS<br>a series of the chronicles of Narnia.<br>Book 1</p><p>故事梗概: 一个男孩和女孩因为男孩的叔叔的缘故先后来到了来到了一个正在走向死亡的世界,意外地唤醒了邪恶的女王和他们一起来到了现实世界并在这引发了骚动。男孩和女孩合作把女王带离了这个世界,去到了一个正在经历创世的世界,他们在那看到了震撼人心的创世奇景,女王因为畏惧创世神力逃离众人,这给新生的世界带来了危机。为了补救,男孩和女孩根据创世神的指示到遥远的西方取得正确的苹果,在那里男孩经历了女王的诱惑但最后抵挡住了,成功滴把苹果带回。回来后,苹果被种在地下,大陆完成了第一次王与女王的加冕仪式,苹果树悄无声息地成长孕育出了果实,男孩被允许摘下一枚果子,随后3个人回到了本来的世界,果子被男孩母亲吃下,果核被种在院子,长成了大树,后面被做成了衣橱,成为新故事的起点。</p><p>此地有一排房子,两处人家比邻而居。一天,一个叫做Digory的男孩探出墙壁遇见了邻居家的小女孩Polly,他们交谈了起来,男孩在向女孩抱怨他的家里有个叫做Andrew的叔叔,有些癔症。他们经常一起玩,Polly给他展示了穿梭房屋的密道,他们开始了探索,结果他们阴差阳错地来到了Digory的叔叔的书房。Digory的叔叔也在里面,他的叔叔诱惑Polly,让她拿起戒指,而我们的女主角Polly痴迷于戒指的美观,就接触了戒指,刚一接触她就消失了。</p><p>实际上,我们的魔法师Andrew对戒指有着粗浅的认知,但是他因为胆小不敢去尝试。结果就丧心病狂地对我们的小女孩伸出了魔爪,现在还要以朋友的名义来道德绑架我们可爱的Digory 。尽管叔叔非常可恶,但事关未来老婆的生死怎能袖手旁观呢?他义愤填膺,只能忍辱负重地请教叔叔关于戒指的使用方法。他叔叔见奸计得逞,给他说了戒指如何使用。这里有两种戒指,戴上黄色戒指可以使人离开这个世界,就像Polly一样;绿色的戒指可以让人回到本来的世界。</p><p>等到Digory离开了本来的世界,他出现在一片茂密的森林里,他从池塘出来,并且发现此地有很多个池塘。不远处他发现了先走的Polly,他们两人都有些懵逼,经过一番回忆,他们记起来了事情的来龙去脉和目的。</p><p>事多的Digory提出要到其它池塘看看,然后他们选了一个池塘进入其中,他们来到了一个几乎将近终点的世界。那边的太阳更大颜色更红,感觉太阳要快走到终点。他们来到了一片宫殿废墟,四周有高大的城墙和穹顶门户。经过一番运动,他们来到了一间屋子,屋子里面陈列着人形石蜡雕像,排列在两旁,在最上面有一个女性,两人看过了石碑上面的记载的内容,手贱的Digory打破了诅咒,包括用小锤敲响了铃铛,魔法被解除,宫殿开始倒塌。</p><p>根据女王Jadis的自白,在战争里,被她的sister 逼到了绝路,她就给世界施加了一个叫做deplorable word 的咒语。咒语的影响是除了施术者陷入沉睡以外,其他一切生物都死去。</p><p>在无意中Digory 提到了他们生活的世界。因为Jadis的世界已经接近死亡了,引发了她的觊觎。谈话中Polly言语上对Jadis不敬,Jadis愤怒地抓住了Polly的头发,就这样三人被一起传送到了本来的世界。</p><p>到了Digory 的家后,他的叔叔就被征用了,而两个小孩被忽视了,他的叔叔神态活像一只狗为女王Jadis 鞍前马后。Jadis催促uncle Andrew给她找一个符合她身份的坐骑。后来jadis跟着Andrew一起出去了,等到Jadis 回来时候发生了骚动。因为抢东西不负帐,警察商人和马夫Cabby在后面追她 ,在争斗的过程中,Polly 和Digory 互相合作,成功地把Jadis 带离了原来的世界。只是这次多了几个人,有叔叔Andrew 和马夫Cabby和一匹马 。</p><p>他们一行人来到了一片新大陆,随着一阵阵的狮子的吟唱歌声,这个世界从一片荒芜到充满着充满生机的树木,各种野兽诞生,而且其中的一些野兽甚至成为了能够说话的野兽,而且和Digory一行人一起来的那匹马也变成了会说话的野兽,他们能够思考。<br>在大陆改造的过程中,反派Jadis 趁着狮子不得空的时机逃掉了。在改造完成后,造世主狮子Aslan和会说话的野兽交流了感情,然后说明了纳尼亚大陆会面临的危机。而且这个危机就是亚当夏娃的后代也就是Digory 一行人带来的,女王Jadis。接着就是国王和王妃的加冠仪式,国王就是Cabby王妃就是他在原来世界的妻子,他的妻子被狮子隔空转移过来了。</p><p>关于拯救大陆的办法,狮子也讲了。具体就是在纳尼亚大陆中心种一棵树,使得女王jadis不敢靠近树的附近。在那里找到树的种子呢 ?地点就在纳尼亚大陆之外的西边,跨越高山和悬崖,有一个蓝色湖泊绿色的山谷,而果树就在前面的山丘。骑上会飞的马出发了。在旅途中更是发生了神奇的景象,就是吃过的toffee,第二天就长出来满是toffee的树。</p><p>到了地方后,他们看到了一处果园,树叶有多种颜色,只有Digory 一个人进了果园,他采摘了果园中心银色的果实。因为Jadis跟踪窃听了他们的谈话知道了他们的目的,Jadis和他们在果园相遇。jadis不断滴诱惑Digory 私自吃下摘的果实,Digory 的内心相当的挣扎,因为jadis 给他说明了果实和他妈妈的病情之间的关系。最终,Digory 还是压制住了心中的这份躁动,控制了内心的私欲。</p><p>一行人回到了纳尼亚大陆,回到了Aslan的身边。自然得到了它的一顿夸奖。然后让Digory 亲自种下了果实。种下了果实之后就是Aslan给国王和王后的加冕仪式。</p><p>而我们的uncle Andrew 早已经被各种会说就对的野兽们玩坏了,aslan临行前给两个孩子一个命令和警告。接着他们就回到了伦敦,根据aslan的嘱托,他们把戒指埋在地下,Digory 把果实给了他的妈妈,她吃了不久后痊愈了,<br>吃剩下的果实种子被种在这边的世界,之后Digory 砍下了树木做了一个衣橱柜,这就是后面的故事的开端。</p>]]></content>
<tags>
<tag> digest </tag>
</tags>
</entry>
<entry>
<title>在rust程序中调用c函数</title>
<link href="/call-c-from-rust/"/>
<url>/call-c-from-rust/</url>
<content type="html"><![CDATA[<h2 id="需求"><a href="#需求" class="headerlink" title="需求"></a>需求</h2><p>我想写一段rust程序,它能够接收到用户键盘输入就会立刻退出,即按任意键退出,但是不用用户敲击<code>enter</code>键。纯用rust写似乎不好实现,而利用现成的c语言却能很好地解决问题。</p><p>我们用c语言实现上面的功能,并在rust程序中调用c函数,我们把c静态编译成静态库,静态链接。</p><h2 id="代码实现细节"><a href="#代码实现细节" class="headerlink" title="代码实现细节"></a>代码实现细节</h2><p>我们使用构建库<code>cc</code>来编译c程序为静态库,利用rust构建脚本来搜索查找静态库。我们在main模块里面引入c库函数。</p><p>新建一个项目 <code>cargo new callc</code>.下面是各个文件的内容构成。</p><blockquote><p>src/press.c</p></blockquote><p>c代码解释:<code>getch</code>函数从标准输入流读取一个字符,而不需要用户输入enter键,因为直接从键盘Buffer里面读取。一旦字符被读取,程序会退出。<br>注意<code>conio.h</code> 可能不是标准库函数,在除Windows以外的操作系统中可能会出现失败的情形。</p><pre class="language-none"><code class="language-none">#include <stdio.h>#include <conio.h>int press() { printf("Press any key to exit...\n"); getch(); return 0;}</code></pre><blockquote><p>Cargo.toml</p></blockquote><pre class="language-none"><code class="language-none">build="build.rs"[build-dependencies]cc = "1.0.78"</code></pre><blockquote><p>src/main.rs</p></blockquote><p>声明我们要使用函数<code>press</code></p><pre class="language-none"><code class="language-none">// Note the lack of the `#[link]` attribute. We’re delegating the responsibility// of selecting what to link over to the build script rather than hard-coding// it in the source file.extern { fn press(); }fn main() { unsafe { press(); }}</code></pre><blockquote><p>build.rs</p></blockquote><p>编译<code>press.c</code>为静态库,紧接着在位置<code>OUT_DIR</code>环境变量所指示的目录下面找到静态库便于后面的链接。</p><pre class="language-none"><code class="language-none">use std::env;fn main() { // out dir is in target/release/build let out_dir = env::var("OUT_DIR").unwrap(); // Tell Cargo that if the given file changes, to rerun this build script. println!("cargo:rerun-if-changed=src/press.c"); // Use the `cc` crate to build a C file and statically link it. cc::Build::new() .file("src/press.c") .compile("press"); println!("cargo:rustc-link-search=native={}", out_dir); println!("cargo:rustc-link-lib=static=press");}</code></pre><h2 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h2><p>[1] <a class="link" href="https://doc.rust-lang.org/cargo/reference/build-script-examples.html" >https://doc.rust-lang.org/cargo/reference/build-script-examples.html<i class="fas fa-external-link-alt"></i></a></p>]]></content>
<tags>
<tag> rust </tag>
</tags>
</entry>
<entry>
<title>set_up_anki_custom_server_new</title>
<link href="/set-up-anki-custom-server-new/"/>
<url>/set-up-anki-custom-server-new/</url>
<content type="html"><![CDATA[<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>在文章<a href="https://dobefore.github.io/set_up_anki_custom_server_on_https_protocol/">set_up_anki_custom_server_on_https_protocol</a>里面提供了Ankidroid几乎全版本(>2.8)的支持,但是由于部署软件兼容性并不能正常滴在所有Windows机型上运行。所以这篇文章介绍更广兼容性的方法,需要安装我们文件夹中提供的Ankidroid版本(当然也可以等待2.16正式版的发布),关于为什么会有版本要求看这里<a href="#ankidroid%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82%E5%8E%9F%E5%9B%A0%E4%B8%8E%E7%89%88%E6%9C%AC%E9%80%89%E6%8B%A9">ankidroid版本要求原因与版本选择</a>。</p><p>接下来是一份相当简单的引导教程,可以找个合适的位置存放下载好的文件夹用来<strong>存放同步数据</strong>。</p><h2 id="第一步-打开配置文件ankisyncd-toml,设置你的同步账号和密码"><a href="#第一步-打开配置文件ankisyncd-toml,设置你的同步账号和密码" class="headerlink" title="第一步 打开配置文件ankisyncd.toml,设置你的同步账号和密码"></a>第一步 打开配置文件ankisyncd.toml,设置你的同步账号和密码</h2><p>如果跳过这一步的话,会得到账号username:<code>test</code>,password:<code>123456</code>。如下图,账号可以随意填写,输入后记得保存。<br><a href="https://imgse.com/i/v4GRLq"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/08/31/v4GRLq.png" alt="v4GRLq.png" ></a></p><h2 id="第二步-双击启动ankiserver,查看同步地址(用于Ankidroid的配置)"><a href="#第二步-双击启动ankiserver,查看同步地址(用于Ankidroid的配置)" class="headerlink" title="第二步 双击启动ankiserver,查看同步地址(用于Ankidroid的配置)"></a>第二步 双击启动ankiserver,查看同步地址(用于Ankidroid的配置)</h2><p>如果您的Anki版本为2.1.57或者以后版本(>=2.1.57),需要进行下面两个小步骤。</p><ol><li>在黑色窗口找到并复制红色方框内容,鼠标左键按下不放,拖动直到覆盖整个内容,松开鼠标,单机右键复制。</li></ol><p><img lazyload alt="image" data-src="https://cdn.staticaly.com/gh/dobefore/blogpics@main/Snipaste_2023-02-09_09-20-00.118paadfycfk.webp" alt="Snipaste_2023-02-09_09-20-00" ></p><p>,2. 并打开Anki,进入<code>工具-->设置-->网络</code>,找到下方的<code>self-hosted-sync server(自建同步服务器)</code>.,将我们复制的地址粘贴到这里,如图所示。重启Anki</p><p><img lazyload alt="image" data-src="https://cdn.staticaly.com/gh/dobefore/blogpics@main/Snipaste_2023-02-09_09-20-39.lak466bjkxs.webp" alt="Snipaste_2023-02-09_09-20-39" ></p><p>下面这张图片是第四步要用到的,留意,</p><p><a href="https://imgse.com/i/xvcWQO"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/11/07/xvcWQO.png" alt="xvcWQO.png" ></a></p><h2 id="第三步-打开Anki,输入账号-来自第一步-,点击同步"><a href="#第三步-打开Anki,输入账号-来自第一步-,点击同步" class="headerlink" title="第三步 打开Anki,输入账号(来自第一步),点击同步"></a>第三步 打开Anki,输入账号(来自第一步),点击同步</h2><p>保持第二步服务端处于开启状态(黑屏打开状态),到<strong>工具(tools)–>首选项(preferences)–>网络(network)–>退出账号(logout)</strong>,然后退出Anki再打开,输入第一步的账号。<br><a href="https://imgse.com/i/v4gcLV"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/08/31/v4gcLV.png" alt="v4gcLV.png" ></a></p><h2 id="第四步-安卓手机,连接到电脑相同的局域网"><a href="#第四步-安卓手机,连接到电脑相同的局域网" class="headerlink" title="第四步 安卓手机,连接到电脑相同的局域网"></a>第四步 安卓手机,连接到电脑相同的局域网</h2><p><del>设置 -> 高级设置 -> 自定义同步服务器</del>(此为老版配置地址,请使用文件夹内的安装包或者等待正式版<code>2.16</code>的发布,以此进入<strong>设置–>同步–>自定义同步服务器</strong>,设置同步地址和媒体文件同步地址。<br><a href="https://imgse.com/i/xvy5cD"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/11/07/xvy5cD.jpg" alt="xvy5cD.jpg" ></a></p><h2 id="一些额外话"><a href="#一些额外话" class="headerlink" title="一些额外话"></a>一些额外话</h2><p>为便于后续服务器软件打开,你可以将软件发送到开始菜单和桌面,这样你将能够通过开始菜单搜索找到我们的应用,<br>操作方法也很简单,在我们文件夹找到<code>send.exe</code>,双击它,允许管理员运行。<br><a href="https://imgse.com/i/v4GqyR"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/08/31/v4GqyR.png" alt="v4GqyR.png" ></a></p><p><a href="https://imgse.com/i/v4Gbl9"><img lazyload alt="image" data-src="https://s1.ax1x.com/2022/08/31/v4Gbl9.png" alt="v4Gbl9.png" ></a></p><h3 id="Ankidroid版本要求原因与版本选择"><a href="#Ankidroid版本要求原因与版本选择" class="headerlink" title="Ankidroid版本要求原因与版本选择"></a>Ankidroid版本要求原因与版本选择</h3><p>因为安卓安全性相关策略,较新的安卓系统会要求APP HTTPS连接,AnkiDroid 2.10-2.15.6都是基于这样设计的,在新版本2.16(目前为测试版)允许HTTP不安全连接,同样也降低了我们部署的难度和繁琐程度。</p><p>工具源来自 <a class="link" href="https://github.com/ankicommunity/anki-sync-server-rs" >anki-sync-server-rs<i class="fas fa-external-link-alt"></i></a>以及<a class="link" href="https://github.com/dobefore/anki-server-deploy" >anki-server-deploy<i class="fas fa-external-link-alt"></i></a></p>]]></content>
<tags>
<tag> Anki </tag>
<tag> 搭建Anki服务器 </tag>
<tag> windows </tag>
</tags>
</entry>
<entry>
<title>island_economy</title>
<link href="/island-economy/"/>
<url>/island-economy/</url>
<content type="html"><![CDATA[<p>from : How an Economy Grows and Why It Crashes<<小岛经济学>>,Peter D. Schiff Andrew J. Schiff<br>前提:islander will eat 1 fish per day .</p><h2 id="About-employee-and-employer"><a href="#About-employee-and-employer" class="headerlink" title="About employee and employer"></a>About employee and employer</h2><p>A worker is free to : </p><ol><li>underconsume to build a net(capital ).</li><li>take out a business loan to nuy a net.</li><li>work for someone who already has a net.</li></ol><p><strong>fish transport</strong>:Finnigan,a strong man,can deliver 100 fish per day,at a 2% freight fee,he earned 2 fish per day. Murray,having taken out a business loan to build a fish cart,he can deliver 300 fish per day,at a 1% rate,he earned 3 fish per day. assuming Finnigan can deliver 400 fish with a cart,as Finnigan can generate 4 fish in income at a 1% rate,Murray offer him 3 fish as employee.</p><p><strong>about paper money</strong>: people love getting stuff for free ,they hate paying taxes .if he could find a way to make it look like he was giving something to the islanders for free ,How could they give away more than they took ?<br>After storm destroy,many of our citizens are hutless and fishless,politician say ‘I will institute a government reconstruction program for our neediest citizens to repair the damage.’</p><p>But, there were not enough fish reserves to finance the spending plans.The government would issue paper money called Fish Reserve Notes,fish:note 1:1.To get support ,government hand out notes to fund .<br>Soon,more notes than the government ‘s account in bank had fish to redeem(兑换?), use official fish (generate new fish from discarded fish parts) to pay back depositors.fish:note 9:10 (10 official fish from 9 genuine fish)</p><p>government establish a fishing department.To guarantee people ,create a new agency insurance corporation with Senate behind their deposits.</p><p>then official fish:real fish -> 5:4 -> 3:2 -> 2:1 .now most ate 2 per day ,at minimum .prices for every thing had to go up to keep pace with the diminished nutritional value of fish. ‘fishflatten’ was born and discoraged savings , unemployment high.There is no fish in the bank.</p><p>One island,Sinopia,catch fish by hand,no savings,bank,credit,business,offered to exchange fish for fish reserve notes.The transactions were a huge boom to Usonia,ie boost local economy ,deposits of fish swell .fishflation disappear .</p><p>Sinopia can build factory ,sold these goods to Usonians for fish reserve notes.</p><p>Reality check:Many of these dollars held by foreigners are typically deposited in American banks, where they can be borrowed by Americans. That way we can spend even if we don’t save.<br>Usonia work transfer to “service sector” and less capital intense ,e.g. chefs,story teller .</p><h2 id="About-export"><a href="#About-export" class="headerlink" title="About export"></a>About export</h2><p><strong>trade surplus</strong> :the country exported much more than it import(sells more aboard than it ).trade deficit is the reverse . A country with trade surplus will create a international demand for its currency .Strong trading positions tend to strengthen a country ‘s currency .BUt when a country ‘s currency rises,its products become more expensive . “a global currency war “–depress currency . In addition,a cheap currency simultaneousLy makes imports morexpensive.</p><p>One island leader withdraw much more fish from bank , causing Usonia fishflation.Usonia leaders close the bank ‘s fish window to foreign deposits. This causes value of Notes to drop,but it finally stablize.Although the gap between Senate spending and what it raised in taxes widens,<br>the notes that are used to pay for fresh fish from foreign sources are exported and never are redeemed for fish .</p><h2 id="about-hut-loan-market"><a href="#about-hut-loan-market" class="headerlink" title="about hut loan market"></a>about hut loan market</h2>]]></content>
<tags>
<tag> economy </tag>
</tags>
</entry>
<entry>
<title>raspberry pico观察日记</title>
<link href="/rpi-pico-diary/"/>
<url>/rpi-pico-diary/</url>
<content type="html"><![CDATA[<p>每次按住<code>bootsel</code>接入pc usb时,会擦除pico原来的程序(.uf2);下载firmware到pico,第二次只是插入usb供电,不会擦除程序。</p><p>requirements (Installation of development dependencies):</p><ul><li>Toolchain support for the cortex-m0+ processors in the rp2040 (<code>thumbv6m-none-eabi</code>)<pre class="language-none"><code class="language-none">rustup target install thumbv6m-none-eabicargo install flip-link# This is our suggested default 'runner'cargo install probe-run# If you want to use elf2uf2-rs instead of probe-run, instead do...cargo install elf2uf2-rs --locked</code></pre></li></ul><p>run with <code>elf2uf2</code> (Loading a UF2 over USB)<br>Make sure your .cargo/config contains the following</p><pre class="language-toml" data-language="toml"><code class="language-toml"><span class="token punctuation">[</span><span class="token table class-name">target.thumbv6m-none-eabi</span><span class="token punctuation">]</span><span class="token key property">runner</span> <span class="token punctuation">=</span> <span class="token string">"elf2uf2-rs -d"</span></code></pre><p>connect pico to pc by pushing <code>bootsel</code> ,and then run <code>cargo run</code></p>]]></content>
<tags>
<tag> raspberry-pico </tag>
<tag> embeded </tag>
</tags>
</entry>
<entry>
<title>common-vim-commands</title>
<link href="/common-vim-commands/"/>
<url>/common-vim-commands/</url>
<content type="html"><![CDATA[<pre class="language-none"><code class="language-none">行移动:$: 将光标移动到当前行的行尾0: 将光标移动到当前行的行首在屏幕中移动:gg: 移动到文件开头M: 移动到屏幕中间L: 移动到一屏末尾字符删除:x: 删除当前光标所在处的字符X: 删除当前光标左边的字符行删除:dd: 删除当前光标处的一整行=D文本复制、剪切与粘贴:y: 复制,p:粘贴yy: 复制一整行撤销修改、重做与保存:u: 撤销上一步的操作。文本的查找与替换:/string 正向查找?string 反向查找设置高亮显示 :set hls *按键将当前光标处的单词高亮显示,使用n浏览下一个查找高亮的结果:wq save and exit</code></pre>]]></content>
<tags>
<tag> vim </tag>
</tags>
</entry>
<entry>
<title>termux-settings</title>
<link href="/termux-settings/"/>
<url>/termux-settings/</url>
<content type="html"><![CDATA[<h2 id="获取手机存储访问权限"><a href="#获取手机存储访问权限" class="headerlink" title="获取手机存储访问权限"></a>获取手机存储访问权限</h2><pre class="language-none"><code class="language-none">termux-setup-storage</code></pre><h2 id="set-user-account-for-termux"><a href="#set-user-account-for-termux" class="headerlink" title="set user account for termux"></a>set user account for termux</h2><pre class="language-none"><code class="language-none">whoami#set new passpasswd</code></pre><h2 id="install-and-set-ssh"><a href="#install-and-set-ssh" class="headerlink" title="install and set ssh"></a>install and set ssh</h2><p>start sshd</p><pre class="language-none"><code class="language-none">apt install opensshsshd -p8022</code></pre><p>delete old host key in file <code>known_hosts</code> from client<br>e.g. <code>C:\Users\Admin\.ssh\known_hosts</code></p><h2 id="set-on-my-zsh"><a href="#set-on-my-zsh" class="headerlink" title="set on-my-zsh"></a>set on-my-zsh</h2><pre class="language-none"><code class="language-none">apt install curl zsh gitsh -c "$(curl -fsSL https://gitee.com/sherkeyxd/termux-ohmyzsh/raw/master/install.sh)"</code></pre><p>add plugin <code>autosuggestions</code></p><pre class="language-none"><code class="language-none"># 拷贝到 plugins 目录下(or use alternative repo from gitee)git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions</code></pre><p>在 ~/.zshrc 中配置:</p><pre class="language-none"><code class="language-none">plugins=(其他的插件 zsh-autosuggestions)</code></pre><h2 id="install-linux-distribution"><a href="#install-linux-distribution" class="headerlink" title="install linux distribution"></a>install linux distribution</h2><pre class="language-none"><code class="language-none">pkg install proot-distroproot-distro listproot-distro install ubuntu# or save command to a scriptproot-distro login ubuntu</code></pre><h2 id="settings-in-linux-distribution"><a href="#settings-in-linux-distribution" class="headerlink" title="settings in linux distribution"></a>settings in linux distribution</h2><h3 id="install-ssh"><a href="#install-ssh" class="headerlink" title="install ssh"></a>install ssh</h3><pre class="language-none"><code class="language-none">apt updateapt install openssh-server</code></pre><p>modify sshd_config</p><pre class="language-none"><code class="language-none">vim /etc/ssh/sshd_config</code></pre><p>把Port 22改为 9022,注意不能是22,也不能是8022<br>把PermitRootLogin那一行,注释去掉,改为PermiRootLogin yes</p><p>start sshd</p><pre class="language-none"><code class="language-none">/etc/init.d/ssh stop/etc/init.d/ssh start</code></pre><p>check status of sshd</p><pre class="language-none"><code class="language-none">/etc/init.d/ssh status</code></pre><p>get username <code>whoami</code><br>最终还是失败不是ssh的问题</p>]]></content>
<tags>
<tag> termux </tag>
</tags>
</entry>
<entry>
<title>hexo-blog-config</title>
<link href="/hexo-blog-config/"/>
<url>/hexo-blog-config/</url>
<content type="html"><![CDATA[<p>After clone blog source code into local,these steps should be done.</p><h2 id="install-nodejs-and-npm"><a href="#install-nodejs-and-npm" class="headerlink" title="install nodejs and npm"></a>install nodejs and npm</h2><p>install archive file,unpack it.</p><pre class="language-none"><code class="language-none">https://nodejs.org/en/download/</code></pre><p>add bin path to .bashrc</p><pre class="language-none"><code class="language-none">export PATH="$HOME/node-v16.14.2-linux-arm64/bin:$PATH"</code></pre><h2 id="install-theme-yun"><a href="#install-theme-yun" class="headerlink" title="install theme -yun"></a>install theme -yun</h2><p>if not,will cause</p><pre class="language-none"><code class="language-none">WARN No layout: about/index.htmlWARN No layout: tags/index.htmlWARN No layout: categories/index.html</code></pre><p><a class="link" href="https://hexo-theme-yun.vercel.app/guide/#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B" >https://hexo-theme-yun.vercel.app/guide/#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B<i class="fas fa-external-link-alt"></i></a></p><h2 id="generate-and-deploy"><a href="#generate-and-deploy" class="headerlink" title="generate and deploy"></a>generate and deploy</h2><pre class="language-none"><code class="language-none">hexo ghexo d</code></pre>]]></content>
<tags>
<tag> hexo </tag>
<tag> blog </tag>
</tags>
</entry>
<entry>
<title>linux-commands</title>
<link href="/linux-commands/"/>
<url>/linux-commands/</url>
<content type="html"><![CDATA[<h1 id="scp-transfer-files-between-local-and-remote"><a href="#scp-transfer-files-between-local-and-remote" class="headerlink" title="scp transfer files between local and remote"></a>scp transfer files between local and remote</h1><h2 id="copy-file-from-local-to-a-remote"><a href="#copy-file-from-local-to-a-remote" class="headerlink" title="copy file from local to a remote"></a>copy file from local to a remote</h2><pre class="language-none"><code class="language-none">scp test.txt [[email protected]](mailto:[email protected]):/home/ubuntu</code></pre><h2 id="receive-download-files-from-remote"><a href="#receive-download-files-from-remote" class="headerlink" title="receive/download files from remote"></a>receive/download files from remote</h2><p>for example receive an executable task from remote to local dir .</p><pre class="language-none"><code class="language-none">scp [email protected]:/home/ubuntu/task [email protected]'s password:task 100% 3325KB 531.1KB/s 00:06</code></pre><h1 id="decompress"><a href="#decompress" class="headerlink" title="decompress"></a>decompress</h1><h2 id="unzip"><a href="#unzip" class="headerlink" title="unzip"></a>unzip</h2><p>download via curl and unzip </p><pre class="language-none"><code class="language-none">curl -o everytask.zip http://192.168.31.244:8000/everytask.zipmkdir everytaskcp everytask.zip everytaskcd everytaskunzip everytask.zip</code></pre>]]></content>
<tags>
<tag> linux </tag>
</tags>
</entry>
<entry>
<title>raspberry-pi-wifi-error</title>
<link href="/raspberry-pi-wifi-error/"/>
<url>/raspberry-pi-wifi-error/</url>
<content type="html"><![CDATA[<p>On raspberry pi 4b,two reasons cause wifi error.</p><h2 id="usb-3-0-interfere-with-wifi"><a href="#usb-3-0-interfere-with-wifi" class="headerlink" title="usb 3.0 interfere with wifi"></a>usb 3.0 interfere with wifi</h2><p>reproduce:</p><pre class="language-none"><code class="language-none">sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.confpplicant.conf Successfully initialized wpa_supplicantwlan0: Trying to associate with SSID 'SZMIFI'wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16wlan0: Trying to associate with SSID 'SZMIFI'wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16wlan0: Trying to associate with SSID 'SZMIFI'wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16wlan0: Trying to associate with SSID 'SZMIFI'wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="SZMIFI" auth_failures=1 duration=10 reason=CONN_FAILEDwlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="SZMIFI"wlan0: Trying to associate with SSID 'SZMIFI'wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="SZMIFI" auth_failures=2 duration=20 reason=CONN_FAILED^Cnl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0p2p-dev-wlan0: CTRL-EVENT-TERMINATING nl80211: deinit ifname=wlan0 disabled_11b_rates=0</code></pre><p>fix: switch to usb 2.0</p><h2 id="HDMI-is-jamming-its-own-wifi"><a href="#HDMI-is-jamming-its-own-wifi" class="headerlink" title="HDMI is jamming its own wifi"></a>HDMI is jamming its own wifi</h2><p>screen definition higher than 1920*1080 will cause wifi stop working.</p><p>fix:keep screen definition to 1920*1080 and apply,in the Preference->Screen Configuration</p><h2 id="keyboard-and-mouce-sometimes-dont-respond"><a href="#keyboard-and-mouce-sometimes-dont-respond" class="headerlink" title="keyboard and mouce sometimes dont respond."></a>keyboard and mouce sometimes dont respond.</h2><p>fix: disable hdmi until raspberry pi boot with keyboard and mouce</p><h2 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h2><ul><li><a class="link" href="https://hackaday.com/2019/11/28/raspberry-pi-4-hdmi-is-jamming-its-own-wifi/" >https://hackaday.com/2019/11/28/raspberry-pi-4-hdmi-is-jamming-its-own-wifi/<i class="fas fa-external-link-alt"></i></a></li></ul>]]></content>
<tags>
<tag> raspberry-pi </tag>
<tag> wifi </tag>
</tags>
</entry>
<entry>
<title>docker-command</title>
<link href="/docker-command/"/>
<url>/docker-command/</url>
<content type="html"><![CDATA[<p>difference between image and container<br>We can build or image on local or from docker hub.Then We run container from image,you can run multi-containers from a image with <code>--name=appname</code>.</p><h2 id="install-docker"><a href="#install-docker" class="headerlink" title="install docker"></a>install docker</h2><pre class="language-none"><code class="language-none">curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh</code></pre><h2 id="Add-a-Non-Root-User-to-the-Docker-Group"><a href="#Add-a-Non-Root-User-to-the-Docker-Group" class="headerlink" title="Add a Non-Root User to the Docker Group"></a>Add a Non-Root User to the Docker Group</h2><p>this require you are login to non-root user on OS</p><pre class="language-none"><code class="language-none">sudo usermod -aG docker Pi</code></pre><h2 id="remove-docker"><a href="#remove-docker" class="headerlink" title="remove docker"></a>remove docker</h2><pre class="language-none"><code class="language-none">sudo apt-get purge docker-cesudo rm -rf /var/lib/docker</code></pre><h2 id="build-docker-image"><a href="#build-docker-image" class="headerlink" title="build docker image"></a>build docker image</h2><p>image_name:tag</p><pre class="language-none"><code class="language-none">sudo docker build -t ankisyncd:latest .</code></pre><h2 id="container-run-start-stop-remove"><a href="#container-run-start-stop-remove" class="headerlink" title="container run,start,stop,remove"></a>container run,start,stop,remove</h2><h3 id="run-container-in-foreground-add-d-to-run-in-background"><a href="#run-container-in-foreground-add-d-to-run-in-background" class="headerlink" title="run container in foreground (add -d to run in background)"></a>run container in foreground (add -d to run in background)</h3><pre class="language-none"><code class="language-none">sudo docker run -it ankisyncd:latest</code></pre><h3 id="start-and-stop-container"><a href="#start-and-stop-container" class="headerlink" title="start and stop container"></a>start and stop container</h3><pre class="language-none"><code class="language-none">docker container stop container_namedocker container start container_name</code></pre><h3 id="look-up-IP-address-in-a-container"><a href="#look-up-IP-address-in-a-container" class="headerlink" title="look up IP address in a container"></a>look up IP address in a container</h3><p><code>docker ps -a</code> to get container_name</p><pre class="language-none"><code class="language-none">docker inspect container_name | grep Address</code></pre><h3 id="remove-image-and-container"><a href="#remove-image-and-container" class="headerlink" title="remove image and container"></a>remove image and container</h3><p>remove image</p><p>run <code>docker images</code> to get <code>IMAGE ID</code>,<br>then run <code>sudo docker rmi 8458e1ca9dca</code></p><p>remove container</p><p>run <code>docker ps -a</code> to get <code>CONTAINER ID</code>,<br>then run <code>sudo docker rm 97590f6d5deb</code></p><h2 id="Volume-for-persist-data"><a href="#Volume-for-persist-data" class="headerlink" title="Volume for persist data"></a>Volume for persist data</h2><p>add <code>VOLUME /app</code> in Dockerfile</p><p>show Volume</p><pre class="language-none"><code class="language-none">docker volume list</code></pre><p>remove the volume by <code>volume name</code></p><pre class="language-none"><code class="language-none">docker volume rm 962b2d970bcd96de860b348130a84aa86c0aaa55378b3dce35225659679ff808</code></pre><h2 id="reference"><a href="#reference" class="headerlink" title="reference"></a>reference</h2><p><a class="link" href="https://phoenixnap.com/kb/docker-on-raspberry-pi" >https://phoenixnap.com/kb/docker-on-raspberry-pi<i class="fas fa-external-link-alt"></i></a></p>]]></content>
<tags>
<tag> docker </tag>
</tags>
</entry>
<entry>
<title>git常用命令</title>
<link href="/git-commonly-used-command/"/>
<url>/git-commonly-used-command/</url>
<content type="html"><![CDATA[<h3 id="config-user"><a href="#config-user" class="headerlink" title="config user"></a>config user</h3><pre class="language-none"><code class="language-none">git config --global user.name "dobefore"git config --global user.email [email protected]</code></pre><h3 id="Tag"><a href="#Tag" class="headerlink" title="Tag"></a>Tag</h3><p>create local tag<br><code>git tag 0.1.2</code><br>push tag to remote<br><code>git push origin 0.1.2</code></p><h3 id="fetch-and-checkout-to-other-people’s-pull-request"><a href="#fetch-and-checkout-to-other-people’s-pull-request" class="headerlink" title="fetch and checkout to other people’s pull request"></a>fetch and checkout to other people’s pull request</h3><pre class="language-none"><code class="language-none">#To fetch a remote PR into your local repo,git fetch origin pull/PRID/head:BRANCHNAMEgit checkout BRANCHNAME</code></pre>]]></content>
<tags>
<tag> git </tag>
</tags>
</entry>
<entry>
<title>gen-c-dynamical-library-using-rust-and-call</title>
<link href="/gen-c-dynamical-library-using-rust/"/>
<url>/gen-c-dynamical-library-using-rust/</url>
<content type="html"><![CDATA[<h3 id="使用rust生成动态库cdylib"><a href="#使用rust生成动态库cdylib" class="headerlink" title="使用rust生成动态库cdylib"></a>使用rust生成动态库cdylib</h3><h4 id="layout"><a href="#layout" class="headerlink" title="layout"></a>layout</h4><pre class="language-none"><code class="language-none">├── Cargo.lock├── Cargo.toml└── src └── lib.rs</code></pre><h4 id="Cargo-toml"><a href="#Cargo-toml" class="headerlink" title="Cargo.toml"></a>Cargo.toml</h4><pre class="language-toml" data-language="toml"><code class="language-toml"><span class="token punctuation">[</span><span class="token table class-name">lib</span><span class="token punctuation">]</span><span class="token key property">name</span> <span class="token punctuation">=</span> <span class="token string">"rustdll"</span> <span class="token comment">#生成dll的文件名</span><span class="token key property">crate-type</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span><span class="token string">"cdylib"</span><span class="token punctuation">]</span></code></pre><h4 id="lib-rs"><a href="#lib-rs" class="headerlink" title="lib.rs"></a>lib.rs</h4><pre class="language-rust" data-language="rust"><code class="language-rust"><span class="token attribute attr-name">#[no_mangle]</span><span class="token keyword">pub</span> <span class="token keyword">extern</span> <span class="token keyword">fn</span> <span class="token function-definition function">gettime</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">let</span> input <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span> <span class="token macro property">println!</span><span class="token punctuation">(</span><span class="token string">"from rust dll {}"</span><span class="token punctuation">,</span>input<span class="token punctuation">)</span></code></pre><p>build之后,在Windows平台会生成两个文件 <code>rustdll.dll</code>可导入路``rustdll.dll.lib<code> ;而在Linux平台生成文件</code>librustdll.so`</p><h3 id="调用由rust生成的动态库里的函数"><a href="#调用由rust生成的动态库里的函数" class="headerlink" title="调用由rust生成的动态库里的函数"></a>调用由rust生成的动态库里的函数</h3><h4 id="layout-1"><a href="#layout-1" class="headerlink" title="layout"></a>layout</h4><pre class="language-none"><code class="language-none">aa/├── Cargo.lock├── Cargo.toml├── build.rs├── lib│ └── librustdll.so└── src └── main.rs</code></pre><h4 id="LInux"><a href="#LInux" class="headerlink" title="LInux"></a>LInux</h4><p>build.rs</p><pre class="language-rust" data-language="rust"><code class="language-rust"><span class="token keyword">fn</span> <span class="token function-definition function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// indicate dynamical library</span> <span class="token macro property">println!</span><span class="token punctuation">(</span><span class="token string">"cargo:rustc-link-lib=dylib=rustdll"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// search lib directory,relative path is also ok</span> <span class="token macro property">println!</span><span class="token punctuation">(</span><span class="token string">"cargo:rustc-link-search=native=/home/ubuntu/aa/lib"</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span></code></pre><p>src/main.rs</p><pre class="language-rust" data-language="rust"><code class="language-rust">和 build<span class="token punctuation">.</span>rs 中的cargo<span class="token punctuation">:</span>rustc<span class="token operator">-</span>link<span class="token operator">-</span>lib 二选一<span class="token comment">//#[link(name = "rustdll")]</span><span class="token keyword">extern</span> <span class="token punctuation">{</span> <span class="token keyword">fn</span> <span class="token function-definition function">gettime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span><span class="token keyword">fn</span> <span class="token function-definition function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">unsafe</span> <span class="token punctuation">{</span> <span class="token function">gettime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></code></pre><p>build command</p><p>if <code>cargo build</code>,可以编译但link error</p><pre class="language-none"><code class="language-none">ldd target/debug/aa linux-vdso.so.1 (0x00007ffd5b12d000) librustdll.so => not found</code></pre><p>add new flags</p><pre class="language-none"><code class="language-none">cargo rustc -- -C link-args="-Wl,-rpath,/home/ubuntu/aa/lib/"</code></pre><h4 id="Windows"><a href="#Windows" class="headerlink" title="Windows"></a>Windows</h4><p>src/main.rs</p><pre class="language-rust" data-language="rust"><code class="language-rust">和 build<span class="token punctuation">.</span>rs 中的cargo<span class="token punctuation">:</span>rustc<span class="token operator">-</span>link<span class="token operator">-</span>lib 二选一<span class="token comment">//#[link(name = "rustdll.dll")]</span><span class="token keyword">extern</span> <span class="token punctuation">{</span> <span class="token keyword">fn</span> <span class="token function-definition function">gettime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span><span class="token keyword">fn</span> <span class="token function-definition function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">unsafe</span> <span class="token punctuation">{</span> <span class="token function">gettime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></code></pre><p>build.rs</p><pre class="language-rust" data-language="rust"><code class="language-rust"><span class="token keyword">fn</span> <span class="token function-definition function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// search import library .lib</span> <span class="token comment">// indicate dynamical library</span> <span class="token macro property">println!</span><span class="token punctuation">(</span><span class="token string">"cargo:rustc-link-lib=dylib=rustdll.dll"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// search lib directory,relative path is also ok</span> <span class="token macro property">println!</span><span class="token punctuation">(</span><span class="token string">"cargo:rustc-link-search=native=.."</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span></code></pre><p>将<code>rustdll.dll</code>和<code>rustdll.dll.lib</code>放在和aa同目录下,执行<code>cargo build</code></p><p>完成后,将可执行文件和动态库文件放在同一文件夹下即可</p><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><p><a class="link" href="http://ostack.cn/?qa=621344/" >Linking Rust application with a dynamic library not in the runtime linker search path<i class="fas fa-external-link-alt"></i></a></p>]]></content>
<tags>
<tag> rust </tag>
<tag> cdylib </tag>
</tags>
</entry>
<entry>
<title>build_ankisyncd</title>
<link href="/build-ankisyncd/"/>
<url>/build-ankisyncd/</url>
<content type="html"><![CDATA[<p>disable git verify ssl</p><pre class="language-none"><code class="language-none">export GIT_SSL_NO_VERIFY=true</code></pre><h3 id="Configure-gcc"><a href="#Configure-gcc" class="headerlink" title="Configure gcc"></a>Configure gcc</h3><h4 id="Install-the-C-cross-toolchain-only-for-armv7"><a href="#Install-the-C-cross-toolchain-only-for-armv7" class="headerlink" title="Install the C cross toolchain(only for armv7)"></a>Install the C cross toolchain(only for armv7)</h4><pre class="language-none"><code class="language-none"># Step 1: Install the C cross toolchain$ sudo apt-get install -qq gcc-arm-linux-gnueabihf</code></pre><h4 id="add-cargo-compiled-standard-crates"><a href="#add-cargo-compiled-standard-crates" class="headerlink" title="add cargo compiled standard crates"></a>add cargo compiled standard crates</h4><pre class="language-none"><code class="language-none">#for aarch54rustup target add aarch64-unknown-linux-musl# for aarch32/armv7rustup target add armv7-unknown-linux-musleabihf#for darwin macosrustup target add x86_64-apple-darwin</code></pre><h4 id="download-cross-compile-toolchains-and-set-ENV-var"><a href="#download-cross-compile-toolchains-and-set-ENV-var" class="headerlink" title="download cross-compile toolchains and set ENV var"></a>download cross-compile toolchains and set ENV var</h4><ol><li>aarch64/x86_64</li></ol><p>enter site <a class="link" href="https://link.zhihu.com/?target=https://musl.cc/" >https://musl.cc/<i class="fas fa-external-link-alt"></i></a> to get musl-gcc and decompression</p><p>export bin (x86_64-linux-musl-native seems not able to build ,so use cross version)</p><pre class="language-none"><code class="language-none">export PATH="$HOME/aarch64-linux-musl-cross/bin:$PATH"export PATH="$HOME/x86_64-linux-musl-cross/bin:$PATH"source ~/.profile</code></pre><ol start="2"><li><p>armv7</p><pre class="language-none"><code class="language-none">git clone --depth 1 https://github.com/raspberrypi/tools.git rpitools</code></pre><p>export bin</p><pre class="language-none"><code class="language-none">export PATH="$HOME/rpitools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin:$PATH"</code></pre></li><li><p>macos</p><pre class="language-none"><code class="language-none"># Install build dependenciessudo apt install \ clang \ gcc \ g++ \ zlib1g-dev \ libmpc-dev \ libmpfr-dev \ libgmp-dev \ libxml2-dev</code></pre></li></ol><p>Add the following to a script called osxcross_setup.sh and make it executable.</p><pre class="language-none"><code class="language-none">git clone https://github.com/tpoechtrager/osxcrosscd osxcrosswget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xzmv MacOSX10.10.sdk.tar.xz tarballs/UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh</code></pre><p>run sh</p><pre class="language-none"><code class="language-none">./osxcross_setup.sh</code></pre><p>Add to PATH ENV</p><pre class="language-none"><code class="language-none">export PATH="/home/ubuntu/osxcross/target/bin:$PATH"</code></pre><h4 id="Configure-Cargo"><a href="#Configure-Cargo" class="headerlink" title="Configure Cargo"></a>Configure Cargo</h4><p> cat ~/.cargo/config</p> <pre class="language-none"><code class="language-none"> [target.x86_64-apple-darwin]linker = "x86_64-apple-darwin14-clang"ar = "x86_64-apple-darwin14-ar" [target.aarch64-unknown-linux-musl] linker = "aarch64-linux-musl-gcc" rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"] [target.armv7-unknown-linux-musleabihf] linker = "arm-linux-musleabihf-gcc" rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-args=-static", ] [target.x86_64-unknown-linux-musl] linker = "x86_64-linux-musl-gcc" rustflags = ["-C", "target-feature=+crt-static", "-C", "link-args=-static",] [net] retry = 2 # 失败 自动重试 次数 git-fetch-with-cli = true</code></pre><h3 id="Cross-compile-openssl"><a href="#Cross-compile-openssl" class="headerlink" title="Cross-compile openssl"></a>Cross-compile openssl</h3><h4 id="cross-compile"><a href="#cross-compile" class="headerlink" title="cross-compile"></a>cross-compile</h4><pre class="language-none"><code class="language-none">wget https://www.openssl.org/source/openssl-1.0.1t.tar.gztar -zxvf openssl-OpenSSL_1_1_1fcd ..# for aarch64export MACHINE=aarch64export ARCH=armexport CC=aarch64-linux-musl-gcc# for x86_64export MACHINE=x86_64export ARCH=x86_64export CC=x86_64-linux-musl-gcc#aarch32/armv7export MACHINE=armv7export ARCH=arm# in rpitoolsexport CC=arm-linux-gnueabihf-gcccd openssl-OpenSSL_1_1_1f# add --prefix=dir to apoint dir will be make install./config shared && makecd ..# dont know if its true.fisrt time will build failed.change add OPENSSL_LIB_DIR # with lib,then build,this will fail and last change back and build export OPENSSL_LIB_DIR=/home/ubuntu/openssl-1.0.1t/export OPENSSL_INCLUDE_DIR=/home/ubuntu/openssl-1.0.1t/includeexport OPENSSL_STATIC=true</code></pre><h4 id="cross-compile-libsqlite3"><a href="#cross-compile-libsqlite3" class="headerlink" title="cross compile libsqlite3"></a>cross compile libsqlite3</h4><p>this step isnt necessary during build ankisyncd,do in build<br>everydaytask.</p><pre class="language-none"><code class="language-none">export CC=aarch64-linux-musl-gcc ./configure --host=aarch64 --prefix=/home/ubuntu/sqlmake & make installexport SQLITE3_LIB_DIR=$HOME/sql/lib export SQLITE3_INCLUDE_DIR=$HOME/sql/include export SQLITE3_STATIC=1 </code></pre><h3 id="build-ankisyncd"><a href="#build-ankisyncd" class="headerlink" title="build ankisyncd"></a>build ankisyncd</h3><p>at last ,build</p><pre class="language-none"><code class="language-none"># aarch64cargo build --target=aarch64-unknown-linux-musl --release#aarch32/armv7 cargo build --target armv7-unknown-linux-musleabihf --release#linux x86_64cargo build --release --target=x86_64-unknown-linux-musl# MacOS x86_64CC=o64-clang \CXX=o64-clang++ \SQLITE3_SYS_STATIC=1 \OPENSSL_SYS_STATIC=1 \cargo build --target x86_64-apple-darwin</code></pre><p>package and compression</p><pre class="language-none"><code class="language-none">tar -czvf ankisyncd_linux_armv7.tar.gz ankisyncd ankisyncctl</code></pre><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul><li><a class="link" href="https://jiapeng.me/helium-gateway-rs-compile/" >cross compile for armv7<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://github.com/japaric/rust-cross" >rust cross github<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://www.cnblogs.com/sevenyuan/p/13663372.html" >交叉编译rust-openssl crate for armv7<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://qiita.com/liubin/items/6c94f0b61f746c08b74c" >How to build openssl-sys crate for musl in Rust<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://www.jianshu.com/p/7d599bdf370a" >git错误error: server certificate verification failed. CAfile:<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://rustwiki.org/zh-CN/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html" >MUSL 支持完全静态二进制文件<i class="fas fa-external-link-alt"></i></a></li><li><a class="link" href="https://doc.rust-lang.org/cargo/reference/config.html" >git-fetch-with-cli<i class="fas fa-external-link-alt"></i></a></li></ul>]]></content>
<tags>
<tag> rust </tag>
<tag> cross-compile </tag>
</tags>
</entry>
<entry>
<title>rust-fatal-error-link1201</title>
<link href="/rust-fatal-error-link1201/"/>
<url>/rust-fatal-error-link1201/</url>
<content type="html"><![CDATA[<p>on occationally,当我run <code>cargo build</code> using building tool msvc,error appears as follows:</p><pre class="language-none"><code class="language-none">note: LINK : fatal error LNK1201: error writing to program database'D:\software\vscode_project\anki_sync\anki-sync-server-rs\target\debug\build\futures-channel-29fccd2a64763c5c\build_script_build-29fccd2a64763c5c.pdb'; check for insufficient diskspace, invalid path, or insufficient privilege</code></pre><p>after search the Internet,I find the solution. You can delete the file error info refers to,that is,in this situation,<code>D:\software\vscode_project\anki_sync\anki-sync-server-rs\target\debug\build\futures-channel-29fccd2a64763c5c\build_script_build-29fccd2a64763c5c.pdb</code>. Or you just can delete folder /target ,problems solved.</p><h3 id="reference"><a href="#reference" class="headerlink" title="reference"></a>reference</h3><ul><li><a class="link" href="https://stackoverflow.com/questions/35662865/fatal-error-lnk1201-error-writing-to-program-database-visual-studio-2003" >fatal error LNK1201: error writing to program database - Visual Studio 2003<i class="fas fa-external-link-alt"></i></a></li></ul>]]></content>
<categories>
<category> program language </category>
</categories>
<tags>
<tag> rust </tag>
</tags>
</entry>
<entry>
<title>sciter-rs控件中文显示乱码</title>
<link href="/rust-sciter-utf8-support/"/>
<url>/rust-sciter-utf8-support/</url>
<content type="html"><![CDATA[<h1 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h1><p>在用Rust运行sciter app 时,控件文字包含中文会出现乱码的问题。</p><h1 id="How-to-Fix"><a href="#How-to-Fix" class="headerlink" title="How to Fix"></a>How to Fix</h1><ol><li>如果在html页面里面,在 <code><head></code>标签里加上<code>meta</code> 标签注明字符集<code>utf-8</code>。</li></ol><pre class="language-html" data-language="html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>head</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>meta</span> <span class="token attr-name">http-equiv</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Content-Type<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>text/html; charset=utf-8<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>head</span><span class="token punctuation">></span></span></code></pre><ol start="2"><li><p>如果是以BOM开始的utf8资源.</p><pre class="language-none"><code class="language-none">first three bytes: EF BB BF). #不是太明白</code></pre><h1 id="reference"><a href="#reference" class="headerlink" title="reference"></a>reference</h1></li></ol><ul><li><a class="link" href="https://sciter.com/forums/topic/sciterloadhtml-and-utf-8/" >sciterloadhtml-and-utf-8<i class="fas fa-external-link-alt"></i></a></li></ul>]]></content>
<categories>
<category> program language </category>
</categories>
<tags>
<tag> rust </tag>
<tag> gui </tag>
<tag> sciter </tag>
</tags>
</entry>
<entry>
<title>rust中的文本断行(newline)</title>
<link href="/newline-differ-in-Windows-and-Linux/"/>
<url>/newline-differ-in-Windows-and-Linux/</url>
<content type="html"><</p><p>结果看出是Unix风格的newline “”\n”,再看下Rust writeln!的文档说明:</p><blockquote><p>On all platforms, the newline is the LINE FEED character (<code>\n</code>/<code>U+000A</code>) alone (no additional CARRIAGE RETURN (<code>\r</code>/<code>U+000D</code>).</p></blockquote><h2 id="解决方式"><a href="#解决方式" class="headerlink" title="解决方式"></a>解决方式</h2><p>Rust中为我们提供了macro write!(),并没有newline。我们自己提供newline风格CRLE(\r\n)。</p><pre class="language-none"><code class="language-none">write!(file, "{}\r\n","c").unwrap();</code></pre>]]></content>
<categories>
<category> program language </category>
</categories>
<tags>
<tag> rust </tag>
</tags>
</entry>
<entry>
<title>无职转生~在异世界认真地活下去小说下载</title>
<link href="/wzzs/"/>
<url>/wzzs/</url>
<content type="html"><![CDATA[<p>从qianbixiaoshuo上获取的<strong>无职转生~在异世界认真地活下去</strong>小说1-24卷提供百度网盘下载,txt和mobi(无目录) </p><span id="more"></span><p>网盘链接:<a class="link" href="https://pan.baidu.com/s/1fC61scDXaAXayJko60uj3Q" >点此跳转网盘<i class="fas fa-external-link-alt"></i></a></p><p>提取码:2020</p>]]></content>
<categories>
<category> book </category>
</categories>
<tags>
<tag> resource </tag>
</tags>
</entry>
<entry>
<title>Windows搭建基于https协议的Anki局域网同步服务器</title>
<link href="/set_up_anki_custom_server_on_https_protocol/"/>
<url>/set_up_anki_custom_server_on_https_protocol/</url>
<content type="html"><![CDATA[<hr><p><strong>配置满足的条件</strong>有:</p><ul><li>Windows Anki版本2.1(版本:帮助–>关于)</li><li>安卓平台 Ankidroid 版本 >=2.8</li><li>同步时局域网(手机热点,WIFI)内和在电脑旁</li><li>IOS anki (ipad,iphone等)不能同步。</li></ul><p><strong>首先运行</strong>引导配置程序,请双击<strong>deployer.exe。</strong></p><h2 id="一、检查Anki版本"><a href="#一、检查Anki版本" class="headerlink" title="一、检查Anki版本"></a>一、检查Anki版本</h2><p>安装上面所说的版本。</p><p>点击下一步。。。</p><p><a href="https://imgtu.com/i/bTGMlD"><img src="https://s1.ax1x.com/2022/03/12/bTGMlD.png" alt="bTGMlD.png"></a></p><h2 id="二、设置Anki同步地址"><a href="#二、设置Anki同步地址" class="headerlink" title="二、设置Anki同步地址"></a>二、设置Anki同步地址</h2><h4 id="(1)添加根证书到受信任的系统证书区"><a href="#(1)添加根证书到受信任的系统证书区" class="headerlink" title="(1)添加根证书到受信任的系统证书区"></a>(1)添加根证书到受信任的系统证书区</h4><p>有如下弹窗请点击是。</p><p><a href="https://imgtu.com/i/bT8bQg"><img src="https://s1.ax1x.com/2022/03/12/bT8bQg.png" alt="bT8bQg.png"></a></p><h4 id="(2)设置手机Anki同步地址"><a href="#(2)设置手机Anki同步地址" class="headerlink" title="(2)设置手机Anki同步地址"></a>(2)设置手机Anki同步地址</h4><p>1.在桌面找到<code>rootCA.crt</code> ,用QQ、USB、微信等发送文件到手机,并在手机中找到它,触摸弹出证书安装界面。仅安装一次,后续部署过程中无需此操作。</p><p><a href="https://imgtu.com/i/bTGKSO"><img src="https://s1.ax1x.com/2022/03/12/bTGKSO.png" alt="bTGKSO.png"></a></p><p>2.手机开启在定义同步服务器,进入 设置->高级设置->自定义同步服务器(点击后勾选)</p><p>3.填写引导程序界面的同步地址和媒体文件同步地址,点击开关进入下一步。。。</p><p><a href="https://imgtu.com/i/jC122d"><img src="https://s1.ax1x.com/2022/06/23/jC122d.png" alt="jC122d.png"></a></p><h2 id="三、将服务器端启动程序发送到桌面快捷方式,并添加到开始菜单"><a href="#三、将服务器端启动程序发送到桌面快捷方式,并添加到开始菜单" class="headerlink" title="三、将服务器端启动程序发送到桌面快捷方式,并添加到开始菜单"></a>三、将服务器端启动程序发送到桌面快捷方式,并添加到开始菜单</h2><p><a href="https://imgtu.com/i/bTGeFx"><img src="https://s1.ax1x.com/2022/03/12/bTGeFx.png" alt="bTGeFx.png"></a></p><p>添加到开始菜单意味着可以通过开始搜索框快捷启动软件</p><p>然后就在桌面看到了上面的图标,点击下一步。。。</p><h2 id="四、新建账号-账号管理"><a href="#四、新建账号-账号管理" class="headerlink" title="四、新建账号/账号管理"></a>四、新建账号/账号管理</h2><p>选择 添加账号 ,再点击 提交选择,会出现输入框,输入简单的用户名和密码 ,点击 提交,即添加成功,点击下一步。。。</p><p><a href="https://imgtu.com/i/bT8jwn"><img src="https://s1.ax1x.com/2022/03/12/bT8jwn.png" alt="bT8jwn.png"></a></p><h2 id="五、打开同步服务、Anki切换配置方案-填写账号"><a href="#五、打开同步服务、Anki切换配置方案-填写账号" class="headerlink" title="五、打开同步服务、Anki切换配置方案,填写账号"></a>五、打开同步服务、Anki切换配置方案,填写账号</h2><p>1.在桌面找到第五步发送的快捷方式Anki_server,双击后会出现黑色窗口(同步过程中保持运行),可最小化运行。如果采用DHCP动态分配IP的设备(比如校园网),请下翻至问答区Q2.</p><p><a href="https://imgtu.com/i/bTGmY6"><img src="https://s1.ax1x.com/2022/03/12/bTGmY6.png" alt="bTGmY6.png"></a></p><p>2.打开电脑 Anki,建议 到<strong>文件–>切换配置方案–>添加</strong>新的配置方案并进入(如果有牌组,先导出),点击同步,输入刚刚创建的账号密码,成功后再导入牌组。</p><p><strong>百度网盘链接:</strong></p><p>**Windows Anki **,<a class="link" href="https://apps.ankiweb.net/" >Anki官网下载<i class="fas fa-external-link-alt"></i></a>,<a class="link" href="https://github.com/ankitects/anki/releases" >PC 历史版本<i class="fas fa-external-link-alt"></i></a></p><p><strong>Ankidroid</strong>:<a class="link" href="https://pan.baidu.com/s/1_sEx8PXrraQuXlsfx_Y3EA" >百度网盘链接(提取码:2020)<i class="fas fa-external-link-alt"></i></a>,<a class="link" href="https://f-droid.org/packages/com.ichi2.anki/" >F-droid市场下载<i class="fas fa-external-link-alt"></i></a>,<a class="link" href="https://github.com/ankidroid/Anki-Android/releases" >gtihub下载<i class="fas fa-external-link-alt"></i></a></p><p><strong>服务器端软件</strong>(提取码:2021):<a class="link" href="https://pan.baidu.com/s/1NMGVGzJ2nm6wmWSZDNn5iQ" >点这里<i class="fas fa-external-link-alt"></i></a></p><p><strong>阿里云盘链接:</strong></p><p><strong>服务器端软件</strong><a class="link" href="https://www.aliyundrive.com/s/inbib8Fkx21" >点这里<i class="fas fa-external-link-alt"></i></a></p><p><strong>问答区:</strong></p><p><strong>Q1:配置并打开服务器后,电脑端anki能够同步,手机端却不行?</strong></p><p>A:1.手机端anki IP是否配置正确,比如https去掉s 2.手机和电脑是否在同一局域网下 3.电脑开启了防火墙,把防火墙关掉。</p><p><strong>Q2:某天打开服务端软件开始同步,发现突然出现错误,明明账号和密码都对,以前都可以同步?</strong></p><p>可能设备采用DHCP动态分配IP,说明服务端所在的电脑被分配的IP已经发生变动;每次服务端软件anki_server(ankisyncd)启动会检测本机ip是否发生变化,如果发生变动,会自动修改电脑Anki的IP,并将详细的新地址打印到服务端黑色窗口,需要你手动填写到安卓Ankidroid的相应界面。<br><a href="https://imgtu.com/i/bTGnfK"><img src="https://s1.ax1x.com/2022/03/12/bTGnfK.png" alt="bTGnfK.png"></a></p><p><strong>参考文章:</strong></p><p><a class="link" href="https://blog.dteam.top/posts/2019-04/%E6%9C%AC%E5%9C%B0https%E5%BF%AB%E9%80%9F%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88mkcert.html" >本地https快速解决方案——mkcert<i class="fas fa-external-link-alt"></i></a></p><p><a class="link" href="https://github.com/ankicommunity/anki-sync-server-rs" >ankicommunity/anki-sync-server-rs<i class="fas fa-external-link-alt"></i></a></p>]]></content>
<categories>
<category> tools </category>
</categories>
<tags>
<tag> Anki </tag>
<tag> 搭建Anki服务器 </tag>
</tags>
</entry>
</search>