Why do I quit Leetcode contest?

Foreword

The title is quite "Yin-ish" as it seems, but I'm not a "Yin-ist". You know what I mean.

Why I quit?

I did a quite a good job in Leetcode Weekly Contest, at least in my point of view. I won a 4th place and a 6th place in …

more ...

STUP - the Implementation (3)

throughput and window size

The wisdom of STUP protocol is all about the window size. The throughput of a TCP communication is limited by two windows: the congestion window and the receive window. The congestion window can determine how many bytes that can be send a simple piece of time …

more ...

STUP - Packet Structure and State Machine (2)

STUP Packet Structure

Brief Introduction of TCP & UDP Packet Structure

STUP pretend itself as a protocol at the Transmission Layer, but actually it's absolutely an Application Layer protocol. So before we start, I'd like to recall some knowledge of two important Transmission Layer protocol: TCP & UDP.

It is well known …

more ...

STUP - another (stupid) TCP over UDP protocol (1)

What is STUP?

STUP is the abbreviation of "Speeded/Secure Tcp-like Udp Protocol", which means that it's another TCP over UDP protocol.

Why TCP over UDP?

TCP is a network protocol for general purpose, and it's one of the most commonly used internet protocol on this planet. It is reliable …

more ...

WorkflowyMd Release Note

What is it?

I've writen several workflowy enhance plugins by UserScript. The very first one is show the full content of the note of a bullet. The second one is to show images under the bullet. Then I worked on the background image to make a more colorful workflowy.

Yeah …

more ...

Parallel patterns in C#

写在前面

与C/C++所使用的,传统的基于线程的并行模式不同,C#实现了丰富的并发编程模型,其中以异步模型最为流行。

本文中我们重点讨论C#在发展过程中出现的几种异步编程模型:

  • Async Programming Model(APM)
  • Event-based Async Pattern (EAP)
  • Task-based Async Pattern(TAP)
  • async/await语法糖

异步编程入门

同步模式是最常见,也是最被人熟知的编程模型,每一个任务按顺序执行,前一个任务执行完之后才会执行下一个任务。

异步编程和同步编程不同,程序的执行流程是由“事件”所驱动的。异步编程有两种实现方式,回调与future模式。

回调函数在Javascript中被大量使用,相信大家也都不会陌生。但是大量的回调函数会让代码失去可读性,陷入“Callback hell”。

Promise模式是回调函数的一种“包装”。我们使用一个占位符来表示“未来”将会产生的一个异步处理结果。

这个占位符在不同的语言/框架里面有不同的名字,其定义也不尽相同:

  • Task …
more ...