Hi,
I am implementing a memcached client library. I want it to support several servers and so I wish to add some load-balancing system.
Basically, you can do two operations on a server:
Store a value given its key.
Get a value given its key.
Let us say I have N servers (from 0 to N - 1), I'd like to have a repartition function whic...
If I start using a HiLo generator to assign ID's for a table, and then decide to increase or decrease the capacity (i.e. the maximum 'lo' value), will this cause collisions with the already-assigned ID's?
I'm just wondering if I need to put a big red flag around the number saying 'Don't ever change this!'
Note - not NHibernate specific...
Is there some way to calculate the inverse factorials of real numbers?
For example - 1.5 ! = 1.32934039
Is there some way to obtain 1.5 back if I have the value 1.32934039?
I am trying
http://www.wolframalpha.com/input/?i=Gamma^(-1)[1.32934039]
but that is a fail.
...
In my application, a string generated its length can varying from 1 to 100 (not using random number algo). But I want if length is less than 7 than need to add integers 1,2,3.. untill its size reach to 7. I implements it using while loop as :
If generatedUserName.Length < 7 Then
Dim count As Int32 = 0
While generatedUserName.Len...
Hello all,
For use in a language-learning web application, do you know of data structures and underlying database schema/ layout that would allow efficient storage, processing and querying of sentences, verbs, nouns etc. for different natural languages? For example I would like to store each verb only once and link sentences to a verb o...
Given n points on the plane. No 3 are collinear.
Given the number k.
Find the subset of k points, such that the convex hull of the k points has minimum perimeter out of any convex hull of a subset of k points.
I can think of a naive method runs in O(n^k k log k). (Find the convex hull of every subset of size k and output the minimum)...
I'm currently reading through Real-Time Rendering (3rd ed.) and I love the book, but there aren't any exercises.
Where can I find some exercises to help solidify my grasp on the content?
Edit: Real-Time Rendering is a heavily conceptual book; I'm looking for math exercises, not programming exercises.
...
Does size matter when choosing the right algorithm to use for a session hash.
I recently read this article and it suggested using whirlpool to create a hash for session id. Whirlpool generates a 128 character hash string, is this too large?
The plan is to store the session hash in a db. Is there much of a difference between maybe using...
Hello together,
i need some decision help today :-)
interface A) an input field where the user can type his search parameters.
interface B) next step he will come to some mask, where he can refine his search.
if he enters some defined words (there are about 10) in A the corresponding checkboxes in B should be be checked. Next to the...
an input integer is limited by an array of data:
[Maski, possible-value-i], (i from 0-n)
which means the input param is a legal parameter only there is at least one i makes ,
param & Maski == possible-value-i,
Maski may equal to Maskj.
So far I have to check each Mask one by one for parameter legality.
Is there a way to compress thes...
There are ones, zeroes and ‘U’s in a particular order. (E.g. “1001UU0011”) The number of ones and zeroes are the same, and there’s always two ‘U’s next to each other. You can swap the pair of ‘U’s with any pair of adjacent digits. Here’s a sample move:
__
/ \
1100UU0011 --> 11001100UU
The task is to put all the zeroes befo...
i say really i did not understand method of this site totaly
http://en.wikipedia.org/wiki/Excess-3
please help me i dont understand entire methods
...
I have the following algorithm which scan a large circular array (data). At certain point in the array, I need to take a look at the past values (0 = newest data point, n = oldest data point) and determine if there was a value 5% below the current value. I ended up writing a O(n^2) algorithm which works okay, but this doesn't scale.
...
Z = TRAPZ(X,Y) computes the integral
of Y with respect to X using
the trapezoidal method.
TRAPZ is an existing function in MATLAB, but how to implement it in PHP?
...
What is the principle behind creating rain effect or water drops regardless of using any particular language. I've seen a few impressive rain and water effects done in Flash, but how does it actually work?
Rain Effect Example
Rain Drop Water Effect Example
...
I'm trying to make a decent Java program that generates the primes from 1 to N (mainly for Project Euler problems).
At the moment, my algorithm is as follows:
Initialise an array of booleans (or a bitarray if N is sufficiently large) so they're all false, and an array of ints to store the primes found.
Set an integer, s equal to the ...
I'm planning to write an interactive C++ geometry processing plug-in that will frequently sort large amounts of data. Although preliminary indications are that the sort will take only a second or two, I'd prefer to show progress during that time - i.e I'd like to update a progress indicator a few times per second. This would be prefera...
Assume we have an integer 'x' and 'n' possible values that 'x' can be mapped/binned to. What is an elegant way in C to have a function that returns the closest 'nth' value to x?
Pseudo code example;
int x = 40;
int res;
int bins[] = { 0, 20, 80, 200 }; /* Sorting is guaranteed */
res = int_bin(x, bins);
assert(res == 20); /* 40 is clo...
I'm looking for a drop-in replacement of Ruby's Marshal capability, which hopefully has one or more of the following advantages over Marshal:
faster serialization/deserialization
more concise (or simply smaller) object-graph
Thanks!!
...
Given a matrix of boolean values (example):
a b c
+--------
X | 1 0 1
Y | 1 1 1
Z | 0 1 1
+--------
What's the optimum way to find all sequences [a|b|c] such that each sequence has at least one "true" (1) value for each of X, Y and Z.
In the example above, the set of sequences is (in no particular order):
abc...