chasecs / chasecs.github.io Goto Github PK
View Code? Open in Web Editor NEWblog
Home Page: https://chasecs.github.io/
blog
Home Page: https://chasecs.github.io/
https://chasecs.github.io/posts/redis-usage-and-its-datatype/
redis 的使用场景总结有以下几种:
缓存/数据存储。涉及大部分 redis 的数据类型, string,Hash ,Zset ,set 等
队列。利用 list 类型的 push pop 操作。
事件通知。利用 publish/subscribe 消息系统
Promise 是异步编程的一种解决方案,让 javascript 可以从杂乱回调函数中解脱出来。后来 ES6 标准把 Promise 纳入其中,原生提供了 Promise 对象。Promise 也成为 ES6 最主要的特性之一。网上介绍 promise 使用方法的文章很多,解释其原理却很少。这篇文章循序渐进地实现了一遍 promise,分析透彻,对了解 promise 的工作原理很有帮助。为了
https://chasecs.github.io/posts/golang-network-programming-implementation/
提要:
TCP 服务端、客户端示例
Network system calls
TCP 编程是如何实现的
Go 网络编程主要通过 net 包(package)实现,它支持 TCP/IP, UDP, domain name resolution, Unix domain sockets 等连接,此外,还通过 net/http ,net/rpc 等提供了 http,rpc 等主流应用层的连接协议。
方案厂商给了一份 Android 源码,没有 manifest.git 文件,不支持 Repo。为了基于这份代码搭建支持 Repo 的镜像服务器,断断续续摸索了两个星期,总算 hacking 成功。
https://chasecs.github.io/2019/07/28/2019-07-28-password-hashing-md/
密码哈希的基本知识: 加盐,key stretching 型加密算法;以及常见攻击方法:lookup tables ,rainbow tables
https://chasecs.github.io/2019/11/20/introduction-to-swagger-a-tool-simplify-your-api-development/
swagger 可以通过 yaml 文件自动生成 api 文档,客户端代码等,减少了许多繁琐的工作和前后端沟通,从而提高开发效率。
https://chasecs.github.io/posts/grpc-go-a-working-demo/
demo 的代码仓库:github.com/chasecs/grpc-sorter
一、基础知识
rpc
RPC 是一种用于主要用于服务器通讯的 API 协议,于 2005 年左右发布,在它出现之前,常用的服务器 API 协议是 REST 和 SOAP 。
https://chasecs.github.io/2019/11/01/how-to-build-your-Golang-Web-App/
对前后端分离的 Golang Web 项目,既可以用 http.FileServer
提供前端静态文件的访问,也可以使用 go-bindata-assetfs
将它打包和后端一起编译成一个二进制文件。
https://chasecs.github.io/2020/06/08/go-scheduler-introduction/
注意:本文涉及的源码为 go 1.13 版本 Go 调度器(scheduler)负责把各个 goroutine 分配到相应的操作系统线程 (OS thread )上执行。它是 Go runtime 的两大组成部分之一,另一个是内存分配/垃圾回收(memory allocator/garbage collector)原文 。 Go 调度器相关的代码主要在 runtime 的 proc.go , ru
https://chasecs.github.io/2019/08/09/redis-usage-and-its-datatype/
redis 的使用场景总结有以下几种: 缓存/数据存储。涉及大部分 redis 的数据类型, string,Hash ,Zset ,set 等 队列。利用 list 类型的 push pop 操作。 事件通知。利用 publish/subscribe 消息系统 1. 缓存/数据存储 主要应对大量读取请求、保存临时数据的等场景 保存临时数据场景:保存用户的session,把通过验证的用户数
https://chasecs.github.io/2019/08/19/golang-channel-buffered-or-unbuffered/
go 通过 goroutine 实现并发,而不同的 goroutine 之间需要通过 channel 来通讯,否则就是两段各行其是的代码。 channel 解决 goroutine 的通讯看一个 code 12345678func main() { go func(){ fmt.Println("I'm gotoutine") //不会执行 
https://chasecs.github.io/2017/09/02/2017-09-02-react-redux-shopping-cart-demo/
Redux 是最热门的 React 架构。介绍 Redux 的文章不少,官方文档的内容也非常丰富。 本文根据个人对 Redux 的理解,提供一种和官方文档不一样的视角,阐述如何从零开始开发一个 React + Redux 应用...
https://chasecs.github.io/2020/01/03/analysis-the-bias-of-a-naive-shuffle-algorithm/
将一个长度为 n 的有序数组,重新打乱,随机排序,它算法实现被称作洗牌算法,得名于它的典型应用,扑克牌洗牌。 这个问题有一个 O(n) 复杂度的算法,Fisher–Yates shuffle),也称 knuth shuffle,简洁优雅,用 go 实现如下: 123456func shuffle(arr []int) { for i:=len(arr)-1, i >=0, i-
https://chasecs.github.io/posts/golang-channel-buffered-or-unbuffered/
go 通过 goroutine 实现并发,而不同的 goroutine 之间需要通过 channel 来通讯,否则就是两段各行其是的代码。
https://chasecs.github.io/posts/unix-io-introduction/
5 种 I/O 模型及一些示例
目前主流的 I/O 方案 epoll / kqueue
https://chasecs.github.io/posts/the-philosophy-of-go-error-handling/
最近阅读了不少关于 Go 错误处理的材料和讨论,总结出 Go Error 的设计哲学主要有两点:
处理所有潜在的错误
Errors Are Value
Go 对错误处理的最初设计和后续优化方案,以及编程过程中处理错误的各种方法,基本都是围绕着这些理念展开的。
https://chasecs.github.io/2020/09/24/unix-io-introduction/#more
内容提要 5 种 I/O 模型及一些示例 目前主流的 I/O 方案 epoll / kqueue
to be completed… Introduction to percolation modelEstimate percolation threshold via Monte Carlo simulationUsing Union-find to get the value, Golang ImplementationReference: youtube.com Case Study: Un
https://chasecs.github.io/posts/go-scheduler-introduction/
注:本文涉及的源码为 go 1.13 版本
最近一直在看 Go 调度器的源码,查了不少资料,对 goroutine 的调度过程有了一些了解,也对 Go 如何支撑高并发、并行计算有个大概的认识。
Go 调度器(scheduler)负责把各个 goroutine 分配到相应的操作系统线程 (OS thread )上执行,是 Go runtime 的两大组成部分之一,另一个是内存分配/垃圾回收(memory allocator/garbage collector)1 。
调度器相关的代码主要在 runtime 的 proc.go , runtime1.go , runtime2.go 等几个文件,此外还有一些 Go 汇编代码,这些代码大部分在 2015 年成形,至今没有大的修改,目前看来还是比较稳定的。
https://chasecs.github.io/2020/07/22/golang-network-programming-implementation/#more
提要: TCP 服务端、客户端示例 Network system calls TCP 编程是如何实现的 Go 网络编程主要通过 net 包(package)实现,它支持 TCP/IP, UDP, domain name resolution, Unix domain sockets 等连接,此外,还通过 net/http ,net/rpc 等提供了 http,rpc 等主流应用层的连接协议。
https://chasecs.github.io/2019/08/20/grpc-go-a-working-demo/
demo 的代码仓库:github.com/chasecs/grpc-sorter 一、基础知识rpcRPC 是一种用于主要用于服务器通讯的 API 协议,于 2005 年左右发布,在它出现之前,常用的服务器 API 协议是 REST 和 SOAP 。 gRPC 其中一种 RPC 框架,同类的还有 HTTP RPC,JSON RPC,TCP RPC,关于其它 RPC 协议的介绍见 RPC。 pro
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.