Tag: software
-
Google Javascript style guide
Google Javascript style guide
-
Javascript string and number
“3” + 1 : “31” 1 + “3” : “13” But, “3”-1 : 2 “4” / 2 : 2 “2” * 2 : 4 “2” * “2”: 4
-
Consistent Hashing
http://en.wikipedia.org/wiki/Consistent_hashing A hash scheme that does not affects the entire hash table when a node is inserted or deleted. Machines are assigned to the circular nodes, and if a machine crashes, the keys in the crashed machine are moved to the following node in the circle. This is becoming really popular due to no SQL…
-
Gossip Protocol
http://en.wikipedia.org/wiki/Gossip_protocol Pairewise periodic comm. based protocol to spread information which resembles the way how gossip spreads among ppl. This protocol assumes a faulty network and decentralized. Epidemic algorithms are the ones that adopt gossip protocol. Simple algorithm w/ cute name.
-
Hash Teee(Merkle Tree)
http://en.wikipedia.org/wiki/Hash_tree A tree where a parent contains hash of it’s children. Likewise, root has hash of all nodes. Useful for contents comparison without downloading entire tree or files. Also useful for file synchronization(e.g., Amazon Dynamo); detect missing files easily and sync.
-
Interpolation search – beating the binary search
http://sna-projects.com/blog/2010/06/beating-binary-search/ Instead of just picking the middle, guess the position where the target value appears, and compares the value in the position with the target. This obtains O(loglogN).
-
simhash (minhash)
Near duplicate documents 를 찾는 식 중에 Jaccard coefficient라는 것이 있습니다. 어떤 문서내 term id들이 로 정의된다고 하면, Jaccard coefficient는 로 정의됩니다. 즉 term이 몇개나 겹치나하는 것이죠. 이런 term의 겹침을 계산하는 방법 중 하나는 locality sensitive hashiing입니다. 위키의 식 중 하나를 인용해서 설명하면 가 localitiy sensitive hashing입니다. 즉, 어떤 해싱 함수를 써서 a와 b를 변환한다음…
-
Never, ever, swallow your stack trace.
I came across this kind of exception handling code. This is pretty common pattern. Right? You create a list of several instances and iterate over them to do something. Actually, that’s the beautiful pattern commonly used. But, the code actually has a pitfall. Look at the error handling part. Can you identify it? At first…
-
Broken javascript word counting code that irritates me
Based on the Javascript: The Good Parts by Douglas Crockford. (I highly recommend this book to everyone.) Output: constructor: function Object() { [native code] }11 is: 1 a: 1 Reason: Because you have ‘Constructor’ in your parent class (or prototype) of word_cnt!!!!!! And that’s a string! So you add 1 to that string! and 1…
-
Bind function for binding parameters in javascript
I’ve written a bind function that binds the given parameters to the designated function as a practice.