- 博客(14)
- 问答 (1)
- 收藏
- 关注

原创 GS1(Globe standard 1) 码的解析
package drugcodeimport ( "github.com/pkg/errors" "math" "regexp" "strconv" "strings")const minLen = 7const Gs1TagStr = "%1D"const Gs1Tag = "\u001D"//BadDrugCode 不合法的drug_codevar BadDrugCode = errors.New("不合法的drug_code")func GetDrugCode.
2021-05-25 00:28:42
4457

原创 netty简单实现文件上传接收 (OSS对象仓库) 基于Http 协议.
1.gradle配置(mvn童鞋自行分解)让其支持json : compile group: 'io.netty', name: 'netty-all', version: '4.1.9.Final' compile 'com.google.code.gson:gson:2.8.2'2.2.构建netty文件服务主类Server:import io.netty.bootstrap.ServerB...
2018-05-16 00:39:40
1949

原创 Retrofit 实现单文件上传 包括进度回调, 得到文件md5, 和获取文件MimeType.
1.gradle配置 Retrofit 很多时候时候让 Retrofit 支持 Json :implementation 'com.squareup.retrofit2:retrofit:2.1.0'implementation 'com.squareup.retrofit2:converter-gson:2.1.0'2.构建NetWork来获取Retrofit 实例(单实例模式):impor...
2018-05-16 00:11:56
564
原创 golang 顺序执行协程的n种方式之sync.Mutex
package mainimport ( "log" "math/rand" "sync" "time")func main() { var cc = make([]*sync.Mutex, 1001) for i := 0; i < len(cc); i++ { m := &sync.Mutex{} m.Lock() cc[i] = m } for i := 1000; i > 0; i-- { go gog(i, cc) } cc[0].
2022-01-06 23:21:28
388
原创 Golang 顺序执行协程任务的n种方法之sync.Cond
package mainimport ( "log" "math/rand" "sync" "time")type A struct { C *sync.Cond I int}func main() { c := &A{ C: sync.NewCond(&sync.Mutex{}), I: 1, } for i := 1000; i > 0; i-- { go gog(i, c) } c.C.L.Lock() for c.I !...
2022-01-06 22:34:01
661
原创 rust leetcode 111 二叉树最小深度
pub fn min_depth(root: Option<Rc<RefCell<TreeNode>>>) -> i32 { fn m_depth(root: &Option<Rc<RefCell<TreeNode>>>) -> i32 { if let Some(node) = root { let r1 = m_depth(&...
2022-01-03 09:51:01
326
原创 RUST 实现优先队列 Heap
pub trait Heap<T> { fn heap_len(&self) -> usize; fn heap_less(&self, i: usize, j: usize) -> bool; fn heap_swap(&mut self, i: usize, j: usize); fn heap_push(&mut self, v: T); fn heap_pop(&mut self) -> .
2021-12-22 00:32:43
453
原创 JavaScript实现复制文本到剪贴板
function copyText(text) { let textarea = document.createElement("textarea"); let currentFocus = document.activeElement; document.body.appendChild(textarea); textarea.value = text; ...
2019-10-21 18:28:49
213
原创 JavaScript jQuery 实现banner(轮播图) 一
效果图:菜单menu.json[ { "item": "手机、配件", "sub": [ { "name": "手机通讯:", "content": [ "手机", "手机商城", "以旧换新&quo
2019-03-07 21:38:25
929
原创 JavaScript jQuery 实现banner(轮播图)
效果:JSON数据:[ { "url": "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1133216305,48749125&fm=26&gp=0.jpg", "link": "https://www.jd.com", "title": "京东&qu
2019-03-07 21:04:20
1381
空空如也
JavaScript如何深度克隆函数对象!
2017-05-05
TA创建的收藏夹 TA关注的收藏夹
TA关注的人