Sending data with PACKET_MMAP and PACKET_TX_RING is slower than “normal” (without)

Many interfaces to the linux kernel are not well documented. Or even if they seem well documented, they can be pretty complex and that can make it hard to understanding what the functional or, often even harder, nonfunctional properties of the interface are. For this reason, my advice to anyone wanting a solid understanding of … Read more

Circular buffer in JavaScript

Strange co-incidence, I just wrote one earlier today! I don’t know what exactly your requirements are but this might be of use. It presents an interface like an Array of unlimited length, but ‘forgets’ old items: // Circular buffer storage. Externally-apparent ‘length’ increases indefinitely // while any items with indexes below length-n will be forgotten … Read more

How to create a closed (circular) ListView?

My colleague Joe, and I believe we have found a simpler way to solve the same problem. In our solution though instead of extending BaseAdapter we extend ArrayAdapter. The code is as follows : public class CircularArrayAdapter< T > extends ArrayAdapter< T > { public static final int HALF_MAX_VALUE = Integer.MAX_VALUE/2; public final int MIDDLE; … Read more

efficient circular buffer?

I would use collections.deque with a maxlen arg >>> import collections >>> d = collections.deque(maxlen=10) >>> d deque([], maxlen=10) >>> for i in xrange(20): … d.append(i) … >>> d deque([10, 11, 12, 13, 14, 15, 16, 17, 18, 19], maxlen=10) There is a recipe in the docs for deque that is similar to what you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)