Tag Info

Hot answers tagged

8

It's a bounded queue (a first-in-first-out queue with a fixed capacity). This particular queue always allows addition of elements and silently remove head element for newly added element (when full). In Java there is the CircularFifoQueue that works exactly that way (see also Size-limited queue that holds last N elements in Java). For .NET you'd take a ...


5

There are few possible reasons for this sort of thing: As in JacquesB's answer it may simply be convenience for the library user to call a single method rather than two methods and keep their code more succinct. Performance may be a consideration. Calling .substring(3) will result in a new string being created, and therefore you are looping over the string ...


4

Naming things is hard. But in my experience, ambiguity like this can almost always be solved by using a slightly more verbose name in the right place. The alternative method names you suggested are indeed ugly; in this example my first choice would be to rename the parameters: public interface Component { int Read(int portID, byte[] outputBuffer); ...


4

These are called convenience functions. They are included so users can write shorter and simpler code. Note that almost every library is "redundant" in the sense that users could write the same code themselves outside of the library. However the point of using libraries is that you save time and code, and you can reuses the knowledge of the library in ...


2

If you look at the version control diff, it's nearly impossible to see what was added as whole table has been rewritten Then don't look at the version control diff. For instance WinMerge, which is free & runs on both Windows & Linux has an option " Line differences with Whitespace: Ignoring all". Couldn't you use that? It won't show those ...


2

One possible kludge which would allow you to keep you change history but align your code correctly would be to comment out the entire existing table. And add a new correctly aligned table after it. This would/should be recorded as just two changes in the source code. After the new table been saved in the repository you can delete the commented out section ...


2

Why not both? I suppose you want a quick turnaround, without waiting for the session to get stored in the database. But this does not prevent you from putting the data into the database eventually, because probably users do not register a new session at every request for prolonged periods. I'd have an in-memory cache of a limited size, a queue, and a ...



Only top voted, non community-wiki answers of a minimum length are eligible