Archive for July, 2007

Finding top-N items in a stream

Wednesday, July 4th, 2007

How to (approximately) generate a top-N items list without counting the number of occurrences of all instances?
Two interesting papers I found on the topic: and . I also somebody’s seminar [powerpoint presentation](http://www.math.tau.ac.il/~haimk/seminar03/FindingFrequentItemsInDataStreams.ppt) explaining it.

Listing socket/network connection owners on OSX

Wednesday, July 4th, 2007

While playing with OSX I was wondering how to find out all the networks connections a particular process owns. On Linux I’d use `netstat -p` for this, which does not work on OSX.

It turns out that the solution is quite simple – `lsof -i` does the job and works on both Linux and OSX. Two other useful commands:

lsof -ai -p PID # all connections/sockets owned by PID
lsof -i:PORT # lists all connections/sockets with a particular PORT.