pthreads mutex vs semaphore

semaphores have a synchronized counter and mutex’s are just binary (true / false). A semaphore is often used as a definitive mechanism for answering how many elements of a resource are in use — e.g., an object that represents n worker threads might use a semaphore to count how many worker threads are available. Truth … Read more

How to use Git on Android?

Since this question was first posted, an Android app has been added to the market that can checkout Git repos, called Agit. It can’t commit or push yet, but the clone/fetch/pull functionality is useful. The other issue is that a patched version of ConnectBot needs to be installed before Agit if you want to use … Read more

Loop doesn’t see value changed by other thread without a print statement

The JVM is allowed to assume that other threads do not change the pizzaArrived variable during the loop. In other words, it can hoist the pizzaArrived == false test outside the loop, optimizing this: while (pizzaArrived == false) {} into this: if (pizzaArrived == false) while (true) {} which is an infinite loop. To ensure … Read more

Symbolic links and synced folders in Vagrant

The accepted answer is no good. The question describes an issue with synced folders, not shared folders. The proposed solution would have no effect on an rsynced (not shared) folder. And even if the OP was using a shared folder, the accepted answer’s suggestion is something that had already been integrated into vagrant as of … Read more

Make Requests in Sequential Order Node.js

Using deferreds like Futures. var sequence = Futures.sequence(); sequence .then(function(next) { http.get({}, next); }) .then(function(next, res) { res.on(“data”, next); }) .then(function(next, d) { http.get({}, next); }) .then(function(next, res) { … }) If you need to pass scope along then just do something like this .then(function(next, d) { http.get({}, function(res) { next(res, d); }); }) .then(function(next, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)