Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- condition



  A Javascript When Function

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 <...

   JavaScript,When,Implementation,When function     2012-02-24 05:08:34

  LEFT OUTER JOIN with ON condition or WHERE condition?

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...

   SQL,Outer jo0in,On,Where,On vs where,where vs on     2011-11-01 02:04:29

  Why are column oriented databases so much faster than row oriented databases?

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...

   Database,Column oriented,Speed analysis,Vertica     2012-01-29 04:27:05

  Concurrency vs Parallelism

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...

   Concurrency,Parallelism,Thread     2013-08-07 23:42:33

  Deep Understanding of ReentrantLock: Unlocking the Mysteries of Java Concurrent Programming

ReentrantLock introduction ReentrantLock is a class in the Java concurrent package, java.util.concurrent.locks, and is an implementation of the Lock interface. As its name suggests, it is a reentrant mutual exclusion lock. A mutual exclusion lock is a synchronization tool used to protect shared resources, ensuring that only one thread can access the resource at a given time. Reentrant means that a thread can acquire the same lock multiple times without causing a deadlock. This lock provides some...

   JAVA,REENTRANTLOCK,CONCURRENCY,MULTITHREADING     2023-05-22 08:01:13

  Basic Patterns for Everyday Programming

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...

   Pattern,Code,NULL,Function,JavaScript,Assign default value     2011-11-23 08:03:55

  Inline IF and CASE statements in MySQL

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...

   MySQK,IF,Condition,CASE,SQL     2012-04-22 10:37:01

  Japanese Used Cars-Top Six Myths about Buying One in Russia

With the prices of brand new vehicles steadily increasing. Prospective car owners in Russia have started to move towards buying used vehicles. Being a reliable name in the automobile manufacturing world, Japanese used vehicles are playing a good contribution in fulfilling this increasing demand. Japanese used vehicles have become a major contributor to the overall trade of automotive industry. Keeping this fact in mind, it could be easily assumed that buying one should be a completely hassle-fr...

   JAPANESE USED CARS FOR SALE IN RUSSIA     2017-11-06 13:29:15

  Java Concurrency Basics: CountDownLatch and CyclicBarrier

CountDownLatch CountDownLatch can be used in synchronizing behavior among threads, it makes one or more threads wait for some actions in other threads to be completed. It has a property count which defines how many countDown() need to be called before other threads which called await() to be waked up.  When a thread calls CountDownLatch.await(), the thread will be blocked until the value of count becomes 0. The initial value of count can be specified when creating the CountDownLatch instanc...

   JAVA,JAVA CONCURRENCY,COUNTDOWNLATCH,CYCLICBARRIER     2018-03-25 07:02:40

  What is Hystrix and How does Hystrix work

Background In distributed systems, there is one effect where the unavailability of one service or some services will lead to the service unavailability of the whole system, this is called service avalanche effect. A common way to prevent service avalanche is do manual service fallback, in fact Hystrix also provides another option beside this. Definition of Service Avalanche Effect Service avalanche effect is a kind of effect where the service provider fails to provide service which causes t...

   AVALANCHE EFFECT,HYSTRIX,DISTRIBUTED SYSTEM     2019-02-04 06:00:38