Hi,
Memcached provides a cache expiration time option, which specifies how long objects are retained in the cache. Assuming all writes are through the cache I fail to understand why one would ever want to remove an object from the cache. In other words, if all write operations update the cache before the DB, then the cache can never con...
I work in a consulting organization and am most of the time at customer locations. Because of that I rarely meet my colleagues. To get to know each other better we are going to arrange a dinner party. There will be many small tables so people can have a chat. In order to talk to as many different people as possible during the party, ever...
Suppose you have two objects, Person and Address and they have a relationship, that is a Person has an address. Obviously the person object has a reference to the address object but does the address object really have to know about the Person object? What gives that it has to be a two way relationship?
Thanks!
...
Lately, I've been making use a lot of the Strategy Pattern along with the Factory Pattern. And I really mean a lot. I have a lot of "algorithms" for everything and factories that retrieve algorithms based on parameters.
Even though the code seems very extensible, and it is, having N factories seems a bit of an abuse.
I know this is pre...
I'm pulling items from a database (in this case, comments, but it should apply to anything) and have the following information about them:
The number of up votes
The number of down votes (consequently, the total score and number of votes)
The date the item was created
I'm interested in coming up with a way to sort them with the followin...
As the title says, what is the differences between vectors, sets, and tuples in programming?
...
When my application starts up it needs to get an instance of the correct DAL class (currently there are 4) based on what user is logged in. Certain users are pulling down from certain databases.
Is it still considered a "factory" pattern if instead of instantiating instances of those DAL classes, I simply return the correct static inst...
Hi,
that may be a dumb question... but I have a quite large java program that i'm debugging using the old System.err.println method, like I do using print* in any other language...
But after a while, I've so many of them, I don't know how to manage them (and sometimes I put twice the same message concatenated with other information mak...
I am looking for a way to uniformly choose values in GF(2^M) between two bounds.
GF(2^M) is a Galois Field - See GF(4) as defined on this page - http://www.math.umbc.edu/~campbell/Math413Spr09/Notes/12-13_Finite_Fields.html
From a technical, non-math perspective, this is most similar to CRC operations.
For example:
ulong gf2step...
I have some data, up to a between a million and a billion records, each which is represented by a bitfield, about 64 bits per key. The bits are independent, you can imagine them basically as random bits.
If I have a test key and I want to find all values in my data with the same key, a hash table will spit those out very easily, in O(1)...
I've been tasked with re-writing a fairly large web application for a company. This application provides certain financial/risk analysis to 3 clients that we currently have.
The huge issue around this app is each client is different and has slightly different data. They all log into the same website but after that their experience ca...
I'm trying to write a regular expression engine. I'd like to write a recursive descent parser by hand. What would a context-free grammar without left recursion for the language of regular expressions (not the languages that can be described by regular expressions) look like? Would it be easiest to re-factor out the syntactic sugar, i.e. ...
In order to decouple code you can have service locater's but is this not the same as global variables/state?.
I know these often run off interfaces, so you pass in an interface and get a concrete class back but still my question stands.
For example:
class Something {
void DoSomething() {
IMyType myType = ServiceLocator.Ge...
I've been reading about dependency injection and have a simple question. I can understand how via constructor or setter injection required dependencies are autowired by the DI framework. What happens when an object decides it needs to create a new object due to some business process? Do I need to always create a Factory in these situa...
I cannot think of a situation where I'd want to use '??' in a regular expression, but maybe I'm not thinking hard enough.
...
So, I often have trouble describing a function in a succinct name. It's usually not a problem in functions that are made for reuse, but often a large process needs to be broken into sub-functions. Often these get strange names, such as connectionsToAccessLines or handleWallVisionSplit or something like that. And while these functions onl...
I need to rollout an application in appliance form factor and have been asked to design a CLI as exposing BASH is problematic from a simplicity/usability perspective. I would like to understand the best practices for CLI development around:
Security
Configuration backup and restore
Making it work not only via IP but also serial port
Cr...
I have a large amount of data that was encrypted by a third party tool before it was backed up, now we no longer have access to the tool and I NEED the data what is the most effective way to try and determine how the data was encrypted?
...
How far back up the implementation hierarchy do I want to go when returning an object?
Using the Java collection interface as an example, would this be appropriate?
Collection outerMethod() {
return innerMethod();
}
List innerMethod() {
List list = new ArrayList();
//do something with the list that requires a method in the...
I was watching one of those incredibly retarded tv quiz money scams last night as I was reading reddit and they posed the question:
if you wrote down all the numbers between 32 to 287 how may times would you write down the number 6?
So I did some quick maths in my head (there are 11 sixes in each 100, there are two hundreds in betw...