02 2013 档案
摘要:BloomFilter–大规模数据处理利器转自下面两篇文章http://www.dbafree.net/?p=36http://www.sigma.me/2011/09/13/hash-and-bloom-filter.html Bloom Filter是由Bloom在1970年提出的一种多哈希函数映射的快速查找算法。通常应用在一些需要快速判断某个元素是否属于集合,但是并不严格要求100%正确的场合。一.实例 为了说明Bloom Filter存在的重要意义,举一个实例: 假设要你写一个网络爬虫程序(web crawler)。由于网络间的链接错综复杂,爬虫在网络间爬行很可能会形成“环”。为...
阅读全文
摘要:大数据量的问题是很多面试笔试中经常出现的问题,比如 google、淘宝、百度、 腾讯 这样的一些涉及到海量数据的公司经常会问到。下面的方法是我对海量数据的处理方法进行了一个一般性的总结,当然这些方法可能并不能完全覆盖所有的问题,但是这样的一些方法也基本可以处理绝大多数遇到的问题。下面的一些问题基本直接来源于公司的面试笔试题目,方法不一定最优,如果你有更好的处理方法,欢迎与我讨论。1.Bloom filter适用范围:可以用来实现数据字典,进行数据的判重,或者集合求交集基本原理及要点:对于原理来说很简单,位数组+k个独立hash函数。将hash函数对应的值的位数组置1,查找时如果发现所有hash
阅读全文
摘要:Getting started with HeapyUsage exampleThe following example showsHow to create the session context: hp=hpy()How to use the interactive help: hp.doc, hp.doc.docHow to show the reachable objects in the heap: hp.heap()How to create and show a set of objects: hp.iso(1,[],{})How to show the shortest pat
阅读全文
摘要:1,简介毕业答辩搞定,总算可以闲一段时间,把这段求职经历写出来,也作为之前三个半月的求职的回顾。首先说说我拿到的offer情况:微软,3面->终面,搞定百度,3面->终面,口头offer搜狗,2面,悲剧腾讯,1面,悲剧布丁移动,3面,搞定涂鸦游戏,3面,搞定友盟,3面->CEO面,搞定雅虎,4面->终面,搞定微策略,2面,悲剧人民搜索,3面->终面,搞定人人,2面+终面+Special面,搞定Google,7面,搞定求职经历分为定位、准备、简历、笔试和面试这五个部分,大家挑感兴趣的看就成。我的求职经历适用但不限于码农,不适用与企事业单位(据说是完全不同的考察标准和
阅读全文
摘要:准备翻译从http://pl.atyp.us/content/tech/servers.html摘过来的文章Server DesignI actually wrote this ages ago – the individual chapters are still in the blog archive as posts in July/August of ’02 – and then made a separate document out of it. This version is just the same thing imported as a WordPress page. Am
阅读全文
摘要:beanstalk把监听socket加入了epoll,当客户端有连接时,在主循环sockmain中通过处理epoll事件完成对连接的处理。1. 客户端连接处理代码通过前面对主循环的分析可以看出,监听socket的回调处理函数为srvaccept(见如下函数)。通过分析h_accept可以看出,客户端连接的处理包括三个步骤:a.建立连接socket,并将连接设置为非阻塞;b.创建连接管理对象,c.将和客户端的连接加入epoll连接处理#监听服务回调函数,用作接受连接voidsrvaccept(Server *s, int ev){ h_accept(s->sock.fd, ev, s);}
阅读全文
摘要:以后的分析都是基于beanstalk版本1.6版本的源码。1. 服务实例Serverbeanstalk中将一个监听实例抽象成为一个Server, 服务实例是监听指定地址(ip:port)的运行实例。结构如下:serverstruct Server { char *port; //端口 char *addr; //地址 char *user; //用户 Wal wal; //binlog文件 Socket sock; //监听socket连接 Heap conns; //连接堆};2.epoll抽象beanstalk对epoll相关的函数...
阅读全文
摘要:<rem_hr>Object Oriented Programming Oversold!OOP criticism and OOP problems The emperor has no clothes! Reality Check 101 Snake OOilUpdated: 8/27/2006OOPMythsDebunked:Myth: OOP is a proven general-purpose techniqueMyth: OOP models the real world betterMyth: OOP makes programming more visualMyt
阅读全文
摘要:"If you look back at where object orientation came from with Smalltalk-80 with message passing, and look at the current state of inheritance and things like that, have we gone down the wrong path?" This is the opening question of aQCon London 2010 interviewwith Joe Armstrong, the original
阅读全文
摘要:If anyone knows the joys and sorrows of managing software development projects, it would be Linus Torvalds, creator of the world's most popular open-source software program: the Linux operating system. Formore than 20 years, Torvalds has been directing thousands of developersto improve the open
阅读全文
摘要:When I get asked "What's a good first programming language to teach my [son / daughter / other-person-with-no-programming-experience]?" my answer has been the same for the last 5+ years: Python. That may be unexpected, coming from someone who often talks about non-mainstream languages,
阅读全文
摘要:在过去的N年中,我遇到了很多使用囧然不同风格的开发者,下面是我所知道的一些,你还知道其它的吗?散弹枪编程这种编程风格是一种开发者使用非常随意的方式对待代码。“嗯,这个方法调用出错了……那么我会试着把传出的参数从 false 变成 true!”,当然依然出错,于是我们的程序员会这样:“好吧,那我就注释掉整个方法吧”,或是其它更为随意的处理方式,直到最后让这个调用成功。或是被旁边的某个程序员指出一个正确的方法。如果我们把一个正规的程序员和一个撞大运的程序员放在一起做结地,那么,那个正规的程序可以马上变得发疯起来,并且,可以把正规的程序员的智商降到最低。两个撞大运的程序员不应该在一起做结对编程,这是
阅读全文