上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 18 下一页

[Go] panic: assignment to entry in nil map

摘要: 以上错误出现在给 map 变量赋值的时候。 例如: type AbMap map[string]string var abMap AbMap abMap['a'] = 'b' 使用 map 变量需要使用 make 初始化,然后才能赋值。 type AbMap map[string]string ab 阅读全文
posted @ 2020-09-15 22:33 ercom 阅读(1664) 评论(0) 推荐(0)

[FAQ] Cordova 模拟器中不能访问域名, 未联网 ?

摘要: 首先保证电脑已联网,然后打开模拟器的浏览器输入常用网址,看看是否能够联网。 如果访问失败,在本机中在 cmd 中 ping www.baidu.com 获得百度的ip地址,然后在浏览器中输入 https://百度的ip地址 看看是否能够访问。 如果能访问,说明可以联网。域名不能访问,设置 DNS。 阅读全文
posted @ 2020-09-10 22:31 ercom 阅读(341) 评论(0) 推荐(0)

[FAQ] 设置 npm 镜像源

摘要: 查看 npm 源: $ npm config get registry> http://registry.npmjs.org/ 修改 npm 源: $ npm config set registry https://registry.npm.taobao.org Link:https://www.c 阅读全文
posted @ 2020-09-03 00:11 ercom 阅读(222) 评论(0) 推荐(0)

Golang 与 JS 的字符串截取大同小异

摘要: Golang 和 JS 的字符串截取都可以利用索引定位的方式。 Golang: str := "abcdef" sub := str[1: 2] JS: const str = 'abcdef' const sub = str.substring(1, 2) Link:https://www.cnb 阅读全文
posted @ 2020-07-29 22:41 ercom 阅读(276) 评论(0) 推荐(0)

[Py] Python 的 shape、reshape 含义与用法

摘要: shape 方法用于查看数据是几行几列的。 reshape 方法用于不更改数据的情况下,重新把数据进行规划成指定的行数和列数。 .reshape(-1, 1) -1 表示自动,1 表示整理成 1 列数据。 .reshape(2, -1) 整理成 2 行的数据。 .reshape(3, 3) 整理成 阅读全文
posted @ 2020-07-20 16:32 ercom 阅读(1115) 评论(0) 推荐(0)

[Py] Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work

摘要: 当通过常规命令安装 pip install pydot 和 brew install graphviz 之后,在代码中 import pydot 依旧不生效。 比如:在 tensorflow 使用 tf.keras.utils.plot_model 的时候,就会提示 Failed to import 阅读全文
posted @ 2020-07-03 14:34 ercom 阅读(807) 评论(0) 推荐(0)

[ML] Tensorflow2 保存完整模型以及使用 HDF5

摘要: 将模型保存为完整的 HDF5 文件,后面可以直接加载使用: # © cnblogs.com/farwish import tenforflow as tf model = tf.keras.models.xxxxx model.compile(xxx) model.fit(xxx) import t 阅读全文
posted @ 2020-07-03 11:45 ercom 阅读(2061) 评论(0) 推荐(0)

[Py] Python dict 倒序操作

摘要: 倒序操作很简单,使用 reversed( ) 方法,原本是 ['a', 'b', 'c'],倒序后就是 ['c', 'b', 'a'] Ref:在线运行Python代码 Refer:Python dict技巧 Link:https://www.cnblogs.com/farwish/p/132206 阅读全文
posted @ 2020-07-01 18:11 ercom 阅读(1347) 评论(0) 推荐(0)

[Py] Python 接口数据用 pandas 高效写入 csv

摘要: 通过 pandas 把 dict 数据封装,调用接口方法写入 csv 文件。 import pandas as pd data = [{"name": "a"}, {"name": "b"}] pd_data = pd.DataFrame.from_dict(data) pd_data.to_csv 阅读全文
posted @ 2020-07-01 15:45 ercom 阅读(951) 评论(0) 推荐(0)

[Py] Python json str 字符串转为对象 (字典)

摘要: import json json = '{"code": 0}' # Deserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. o 阅读全文
posted @ 2020-07-01 14:36 ercom 阅读(2967) 评论(0) 推荐(0)

[Py] Python 字符串 str 和 字节 bytes 的互转

摘要: 字节转字符串: st = str(data, encoding = "utf8") print(st) print(type(str)) # <class 'str'> 字符串转字节: by = bytes(st, encoding = "utf8") print(by) print(type(by 阅读全文
posted @ 2020-07-01 14:21 ercom 阅读(1196) 评论(0) 推荐(0)

[Py] Jupyter 写入和执行 python 文件

摘要: 以 %%writefile request.py 开头。 下面写 python 代码,然后 shift + enter 键,可以把 python 代码写入开头指定的文件中,没有则自动创建。 以 %run request.py 的形式运行当前目录下的 python 文件。 也可以指定绝对路径。 To: 阅读全文
posted @ 2020-07-01 13:51 ercom 阅读(1566) 评论(0) 推荐(0)

[ST] 音悦Tai 凉了,一段印记成为过去时

摘要: 互联网上依旧流传着音悦台的传说,过去十年间,你我也许都曾是音悦台的用户。 很多MV的右上角依然是 YinYueTai 的 Logo,比如 Siren-宣美,算是一个时代的印记吧。 互联网企业,即便是真的做到独角兽级别,面对时间的考验也无法逃避。 这个时代是风云变幻的,且看且珍惜。 Ref:心情音乐播 阅读全文
posted @ 2020-06-30 20:51 ercom 阅读(315) 评论(0) 推荐(0)

[FAQ] wechaty 与 wechaty-puppet-padplus 生态安全吗

摘要: 答案是肯定有风险。 非技术角度讲,使用这种方式登录微信存在被微信官方风控的可能性,需要特别注意。 另外,以下是 wechaty 项目说明文件中截取的内容: 我们可以看到,除了微信官方方面的风险,我们的数据会经过第三方服务机构,而且并未承诺绝不访问用户数据。 而是说保持最大程度的自律,自律这种说法我不 阅读全文
posted @ 2020-06-30 15:41 ercom 阅读(1768) 评论(3) 推荐(0)

[FAQ] Vue iframe 的 src 是链接地址却加载了相对路径 ?

摘要: iframe 的 src 是链接, 但是加载的实际链接是相对路径,只有一种可能:链接地址不正确。 检查链接有没有少符号,常见错误:http//,http:/ Refer:Vue的iframe错误 Link:https://www.cnblogs.com/farwish/p/13205777.html 阅读全文
posted @ 2020-06-29 00:13 ercom 阅读(1411) 评论(0) 推荐(0)

[Go] Colly 使用 POST 提交 application/x-www-form-urlencoded 示范

摘要: Colly 提供了 Post 和 PostRaw 方法,它们的参数类型不一样,需要注意。 目标地址接受指定的 Content-Type,可以通过设置 request Header。 局部代码: // @author <cnblogs.com/farwish> c := colly.NewCollec 阅读全文
posted @ 2020-06-28 15:47 ercom 阅读(1752) 评论(0) 推荐(0)

[FAQ] dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

摘要: 通过 ls -al /usr/local/opt 可以看到 icu4c 链接的不是 libicui18n.64.dylib。 一般是 node 版本问题会出现该提示,通过观察版本大小,决定是升级还是使用旧版的库。 比如 Mac 升级 node 使用:brew upgrade node Refer:什 阅读全文
posted @ 2020-06-28 13:17 ercom 阅读(1219) 评论(0) 推荐(0)

[ML] 可视化编写运行 Python 脚本的工具 Jupyter

摘要: Jupyter 提供了可视化的编写和运行 python 程序的 Web 界面。 https://jupyter.org/install 使用只需要两步: $ pip install jupyterlab$ jupyter lab 之后你就可以在 .ipynb 的文件中编写脚本了。 To: 在线运行环 阅读全文
posted @ 2020-06-27 17:52 ercom 阅读(530) 评论(0) 推荐(0)

[ML] 科学编程语言 Octave 简单操作

摘要: octave 是和 matlab 类似的软件,可以方便的进行矩阵计算、图形绘图。 matlab 收费,octave 是 gnu 开源软件。 Mac 安装: $ brew install octave 进入命令行: $ actave 不带分号将输出结果,带分号则不输出结果: 输入一列矩阵的两种方式: 阅读全文
posted @ 2020-06-26 17:28 ercom 阅读(421) 评论(0) 推荐(0)

[ML] 机器学习简介

摘要: 监督学习(Supervised Learning) 添加标签,手把手训练。 比如线性回归算法。 半监督学习(Semi-supervised Learning) 非监督学习(Unsupervised Learning) 通过有标签或没标签的数据集,让机器自己去找出规律。比如分类算法。 结构化学习(St 阅读全文
posted @ 2020-06-26 17:18 ercom 阅读(220) 评论(0) 推荐(0)

[FAQ] Large files detected. You may want to try Git Large File Storage

摘要: Git 提交文件大于 100M 时提示需要使用 Git LFS。 Ubuntu 安装示例: $ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash $ sudo a 阅读全文
posted @ 2020-06-18 14:53 ercom 阅读(715) 评论(0) 推荐(0)

[Go] go-nsq 使用指南

摘要: 首先你需要有一个 nsq 的服务端,nsq 由三部分构成:nsqd、nsqlookupd、nsqadmin。 快速启动 nsq 一个节点看这里:https://github.com/farwish/nsq-launcher go-nsq 是众多客户端中的一个,使用 golang 编写,我们在逻辑代码 阅读全文
posted @ 2020-06-17 23:57 ercom 阅读(535) 评论(0) 推荐(0)

[FE] ServerSideRender 加上 PWA 特性的一种处理方式

摘要: SSR 和 PWA 这两块分开讲,需要做不少的处理,现在我们有了一种简便的方式来处理它,就是使用 Quasar 框架。 Quasar 支持了 SPA、SSR、PWA、Mobile APP、Electron APP、Browser Extension 这些类型应用的开发,相当强大。 在 Quasar 阅读全文
posted @ 2020-06-16 15:15 ercom 阅读(42) 评论(0) 推荐(0)

[FAQ] Error 1142: INDEX command denied to user

摘要: MySQL 用户没有某个命令权限时提示的错误、具体这里提示的是没有 index 命令权限。 把某库的所有表的 index 命令授权给用户即可: grant index on xxdb.* to 'xx-user'@'%'; Refer:MySQL权限错误 Link:https://www.cnblo 阅读全文
posted @ 2020-06-16 13:39 ercom 阅读(4754) 评论(0) 推荐(0)

[Caddy2] 无法访问 Lets Encrypt OCSP 的解决方法

摘要: 更换国内 DNS 为国外 DNS。 Caddy 使用对应 DNS 的 provider。 重新运行即可获取到证书,Certificate obtained successfully。 其它参考: [Caddy2] Caddyfile 使用其它 DNS provider [Caddy2] cloudf 阅读全文
posted @ 2020-06-13 00:47 ercom 阅读(770) 评论(0) 推荐(0)

[Caddy2] cloudflare, acme: cleaning up failed: no memory of presenting a DNS record

摘要: 使用 cloudflare 做为 DNS 之后,使用 Caddy 申请 Lets Encrypt 证书。 有时在日志里会发现一系列的提示信息: acme: use dns-01 solver acme: cleaning up failed: no memory of presenting a DN 阅读全文
posted @ 2020-06-13 00:20 ercom 阅读(1296) 评论(0) 推荐(0)

[Caddy2] Caddyfile 使用其它 DNS provider

摘要: 安装 caddy 的 dns provider 模块。 https://github.com/caddy-dns/cloudflare 如果是在 Docker 中 build 模块按文档进行,通过 caddy:2.0.0-builder 安装需要的模块, 然后 COPY --from=builder 阅读全文
posted @ 2020-06-12 21:19 ercom 阅读(2389) 评论(0) 推荐(0)

[Caddy2] Caddyfile 指令

摘要: 以下是 Caddyfile 的标准指令。 acme_server An embedded ACME server basicauth Enforces HTTP Basic Authentication bind Customize the server's socket address encod 阅读全文
posted @ 2020-06-12 16:28 ercom 阅读(2436) 评论(0) 推荐(0)

[Caddy2] Caddyfile 概念预览

摘要: 结构 块: 所有的指令必须在 { } 块中,如果只有一个站点,则块标记可以省略。 全局的配置块可以放在最上方,其次是站点的配置块。 指令: 指令是服务于站点配置的关键词。 关键词和引号: 空格在 Caddyfile 指令中很重要,如果希望带空格的字符为一个值,需要给它们加上引号。 directive 阅读全文
posted @ 2020-06-12 16:15 ercom 阅读(1313) 评论(0) 推荐(0)

[Caddy2] The Caddy Web Server 常见 Caddyfile 模式

摘要: Caddyfile 是 JSON 配置的易用写法,支持通常用的功能,完整功能还是需要 JSON 配置的。 以下适用于 Caddy2 版本的配置。 静态文件服务器 example.com root * /var/www file_server 通常第一行是站点地址,root 代表站点根路径,* 代表访 阅读全文
posted @ 2020-06-12 13:39 ercom 阅读(5728) 评论(0) 推荐(0)

[FE] WebStorm, ESLint: Trailing spaces not allowed

摘要: 在 WebStorm 中搜索文件 .eslintrc.js 在里面的 rules 项中追加规则: 'no-trailing-spaces' : ['off', { 'skipBlankLines': true, 'ignoreComments': true, } ], http://eslint.o 阅读全文
posted @ 2020-06-11 07:25 ercom 阅读(631) 评论(0) 推荐(0)

[FE] JS 判断当前是否在微信浏览器中的最新代码

摘要: 注意以下使用了 const 定义未改变的变量,没有使用 var。 function isWeChatBrowser () { const ua = window.navigator.userAgent.toLowerCase() const matchArr = ua.match(/MicroMes 阅读全文
posted @ 2020-06-10 10:45 ercom 阅读(300) 评论(0) 推荐(0)

[FE] Quasar 变通 loading 单纯使用遮罩效果的方法

摘要: Quasar 的 loading 组件是提供加载中的遮罩效果的。 如果你不想要 loading 的效果,只想保留遮罩效果,那么你可以通过 show() 方法的参数进行调整。 把 spinnerSize 设为 0 即可做到,如果想把提示信息设为图片样式,可通过 message 设置 html 标签。 阅读全文
posted @ 2020-06-10 10:39 ercom 阅读(503) 评论(0) 推荐(0)

[Go] 有了 cast 组件, golang 类型转换从此不再困扰

摘要: 在 golang 中,参数和返回值之间往往涉及 int、string、[]、map 等之间的转换。 如果是手动去处理,一容易出错,二不能兼容多数类型,比较麻烦。 使用 cast,能够让代码更健壮、可维护性也更高。 Refer: Golang的类型转换 Refer:https://github.com 阅读全文
posted @ 2020-06-08 07:28 ercom 阅读(1070) 评论(0) 推荐(0)

[Go] golang 两个数组 list 的合并方式

摘要: s := append([]int{1, 2}, []int{3, 4}...) Tool:在线Golang代码运行 Cool:在线 AI 编程助手 https://stackoverflow.com/questions/16248241/concatenate-two-slices-in-go L 阅读全文
posted @ 2020-06-06 17:38 ercom 阅读(9751) 评论(0) 推荐(0)

[Go] assignment count mismatch 1 = 2

摘要: Golang 中这个错误的的意思是赋值变量的数目不匹配。 举例: result := json.Marshal(List) 由于没有给返回值中的 error 正确赋值,就会报 assignment count mismatch 1 = 2 正确写法: result, _ := json.Marsha 阅读全文
posted @ 2020-06-04 21:22 ercom 阅读(3481) 评论(0) 推荐(0)

[Go] golang 时间格式化 12小时制 与 24小时制

摘要: timestamp := int64(1591271169) # 12小时制 time.Unix(timestamp, 0).Format("2006-01-02 03:04:05") # 24小时制 time.Unix(timestamp, 0).Format("2006-01-02 15:04: 阅读全文
posted @ 2020-06-04 19:56 ercom 阅读(2039) 评论(0) 推荐(0)

[Go] freecache 设置 SetGCPercent 的作用

摘要: 你需要对 freecache 有一个大致了解,freecache 的内存空间是预分配的。 假设你的程序占用了 50M 内存,那么开启 freecache 预分配 200M 空间,总共下来就是 250M 空间被占用。 SetGCPercent 的作用是设置垃圾回收比例,简单来说,新插入数据比例占旧数据 阅读全文
posted @ 2020-06-03 20:44 ercom 阅读(2109) 评论(0) 推荐(0)

[FAQ] Vue 如何控制标签元素的某个属性的显示 ?

摘要: 这需要借助 v-model 的用法,动态决定元素的展示。 <q-btn :disable="2 > 1">按钮</q-btn> 展示结果是:<q-btn disable>按钮</q-btn> <q-btn :disable="2 < 1">按钮</q-btn> 展示结果是:<q-btn>按钮</q- 阅读全文
posted @ 2020-06-03 09:17 ercom 阅读(1704) 评论(0) 推荐(0)

[FE] 实时视频流库 hls.js 重载切换资源的方式

摘要: hls 播放需要先 attachMedia,然后 loadSource。 如果切换 resource,需要先执行 hls.destroy(),否则会出现混乱。 destroy 之后再依次进行 hls 实例化、attach、load 操作。 Refer:hls的使用方式 https://github. 阅读全文
posted @ 2020-06-03 09:08 ercom 阅读(2440) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 18 下一页