8/02/2010

[Snippet PHP] apc_exists for APC < 3.1.4

Problem:


Fatal error: Call to undefined function apc_exists() in xxxx.php on line xx
That's because APC may not be activated or because your APC version is less than 3.1.4.

Fix:


How to know if $ is jQuery ?

Sometime (mostly in highly conflicted environement) you may want to know if $ is really a jQuery alias. Because $ can be an alias for Mootools too (and of course other libs).

Here is a way to detect jQuery:

How to get the call-stack of a javascript function

And to be more precise: How to get the call-stack of a Javascript function everytime she's called without blocking the execution.

From time to time you may want to see every call-stack of a specific function for profiling concerns.

Here is a naive approach:


When executed in firebug, only 1 Error is shown. We miss the alert() and the second call from doAnotherThing.

Solution? Prefer console.log instead of throw:


Now our 2 error (with call-stack) appear in Firebug while the alert('ok') pop-out as expected.
« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.