CodeCraft
  • 首页
  • 归档
  • 标签
  • 关于
  • English

BitTorrent协议(三)之磁力链接获取元数据

磁力链接的含义如果把tracker给封了,那么就无法下载torrent。于是磁力链接为了解决这个问题而出现了。
2019-01-21
#bitTorrent #protocol #p2p

BitTorrent协议(二)之获取下载源

如何获取下载源作为一个downloader开始下载资源首先要向tracker宣布自己的存在,同时获得其他downloader的地址。 这里的downloader我们统一称为对等节点(peer),因此接下来要做的事情就是与tracker通信,获取peers。
2019-01-10
#bitTorrent #protocol #p2p

BitTorrent协议(一)之解析种子文件

bt种子文件bt通过种子文件分享已经是一个过去时了,2009年btChina就已经关闭了。现在一般都是 使用磁力链接来分享文件。那么为什么种子文件分享不再流行了呢?为什么要用磁力链接呢? 磁力链接怎么实现的呢? 嗯这是这个系列要研究的问题。但是要研究磁力链接的实现原理,最好先从种子文件开始。
2019-01-09
#bitTorrent #protocol #p2p

宏扩展的执行逻辑初探(二)

再来一个例子看看以下运行的结果是什么呢? 1234(defmacro a_macro [x] (list '+ 1 x))(macroexpand-1 '(a_macro (+ 1 2)) ) ;; => ? 如果是一个函数呢? 1234(defn a_func [x] (list '+ 1 x))(a_func (+ 1 2)) ;; => ?
2018-12-09
#clojure #lisp #macro

宏扩展的执行逻辑初探(一)

宏是怎么扩展的呢?比较流行的编程语言中,Java,Python都没有定义宏的功能。c语言中的宏限制比较大, 没有Lisp中的宏强大。以下提到的宏,指的是Lisp方言中的宏。 宏的求值可以分为两个步骤 扩展(expand)–编译期 求值(eval) –运行期 这看起来很简单,但是实际写macro的时候,就会有很多的困惑。这里的主要矛盾就是理解 以下两个过程, 在一个宏的内部调用另一个函
2018-11-09
#clojure #lisp #macro

[leetcode 352]原创解法

题目概述原题链接 Given a data stream input of non-negative integers a1, a2, …, an, …, summarize the numbers seen so far as a list of disjoint intervals. For example, suppose the integers from the data strea
2018-11-08
#leetcode #算法 #python

[leetcode 341]练练手

题目概述原题链接 Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list – whose elements may also be integers or other lists. Input: [[1,1],
2018-08-18
#leetcode #算法 #python

[leetcode 337]打败了100%的解法

题目概述原题链接 The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent
2018-02-24
#leetcode #算法 #python

从大文件中找到出现次数最多的10个数

问题这是一个经典题,面试的时候经常会遇到。 例如:文件的内容如下 26329 46184 94842 9036 96555 40954 38187 15548 51452 861 51010 8721 13666 69837 每行一个数字,找到出现次数最多的数。通常的解法是遍历文件一遍,用hashmap维护一个(number => freq), 然后用最小堆找到最大的10个数
2017-11-27
#java #algorithm #trie

[leetcode 312]Burst Balloons原创解法

题目概述312原题链接 Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you wil
2017-10-07
#leetcode #算法 #python
12345

搜索

Hexo Fluid