SEARCH KEYWORD -- Condition

function when(conditionFunc, execFunc, interval){
if (conditionFunc()){
execFunc();
}else{
setTimeout(function(){ when(conditionFunc, execFunc, interval);}, interval);
}
}
You have some code which should only execute when a condition is
true. E.g. You have code which relies on a javascript library but can't
be sure the library has loaded yet and don't want the code to execute
until it has. This is common if you have a bookmarklet which injects
more than one <...

The difference is subtle, but it is a big difference. The ON condition stipulates which rows will be returned in the join, while the WHERE condition acts as a filter on the rows that actually were returned.Simple example: Consider a student table, consisting of one row per student, with student id and student name. In a second table, a list of grades that students have received, with student_id, subject, and grade. Give me a list of all students, and show their grade in Math. This requires a LEF...

I have been playing around with Hybrid Word Aligned Bitmaps for a few
weeks now, and they turn out to be a rather remarkable data structure.
I believe that they are utilized extensively in modern column oriented
databases such as Vertica and MonetDB.
Essentially HWABs are a data structure that allows you to represent a
sparse bitmap (series of 0's and 1's) really efficiently in memory.
The key trick here is the use of run length encoding to compress the
bitmap into fe...

Concurrency and parallelism are two related concepts which deal with executing tasks "simultaneously". From Sun's Multithreaded Programming Guide:
Concurrency: A condition that exists when at least two threads are making progress. A more generalized form of parallelism that can include time-slicing as a form of virtual parallelism.
Parallelism: A condition that arises when at least two threads are executing simultaneously.
These two definitions are too formal to be understood easily. On t...

For most of you the patterns mentioned below should be nothing new. These are very basic stuff we slap into our code everyday and at times feels they are actually code smells than smart patterns. However, I've been doing some code reviewing lately and came across many code that lacks even these basic traits. So I thought of writing them down as a help for novice developers who would want to get a better grasp at these.These patterns are commonly applicable in most general purpose programming lan...

There are times where running IF statements inside a query can be
useful. MySQL provides a simple way to do this through the use of IF
and CASE statements.
The IF statement takes three arguments; the conditional, the true value and the false value. False and true values may be static values or column values. For example:
SELECT IF(score > 100, 100, score) AS score
FROM exam_results
this will return the value in the score column limited to a maximum value of 100. IF statements can a...

Why do people chew gum? If an anthropologist from Mars ever visited a
typical supermarket, they’d be confounded by those shelves near the
checkout aisle that display dozens of flavored gum options. Chewing
without eating seems like such a ridiculous habit, the oral equivalent
of running on a treadmill. And yet, people have been chewing gum for
thousands of years, ever since the ancient Greeks began popping wads of
mastic tree resin in their mouth to sweeten the breath. Socrates
probabl...

Innovation Works CEO Kai-Fu Lee is diagnosed with lymph cancer. He posted one weibo(Chinese version of Tweet) which indicates that his health in a bad condition at 10:17pm on 5 September Beijing time.
Later Innovation Works spokesman Zhaohui Wang confirmed this news. And Mr Lee is currently receiving treatment following doctor's instructions.
But now we still don't know how severe it is. Post Mr Lee's weibo, many Chinese netizens expressed their concerns for his health and wished hi...

This Bash shell scripting guide is not a detailed study but a quick reference to the BASH syntax. So lets begin...
Common environment variables
PATH - Sets the search path for any executable command. Similar to the PATH variable in MSDOS.
HOME - Home directory of the user.
MAIL - Contains the path to the location where mail addressed to the user is stored.
IFS - Contains a string of characters which are used as
word seperators in the command line. The string normally consists of the
spac...

If you are a newbie of C programmers in SPARC architecture (For example, working on Solaris), you should pay attention to the following tips:(1) By default, SPARC is big-endian (For Endianness, you can refer http://en.wikipedia.org/wiki/Endianness). It means for an integer (short, int, long, etc), the MSB will be stored in the lower address, while the LSB will be stored in the higher address. (2) SPARC requires byte-alignment. It means for a short (2 bytes long) variable, the star...