category / Code
Writing code is like writing poetry – do it right or you’ll end up in some anthology of shame.
So Yoast’s Google Analytics for WordPress plugin has a somewhat annoying “bug”, or oversight rather, where it rewrites relative link URLS to full URLs, including anchors. For example, <a href="#anchor"> becomes <a href="https://planetjon.ca/blah/#anchor">. There is more information about this on the wordpress forums.
A workaround for binding to the intended static scope without using the static:: operator introduced in PHP 5.3
Cutting straight to the point, here’s a quick way with PHP for removing empty values from an array and shifting the indices appropriately. Nothing too fancy but I found it useful at work and figure that I might as well share the tip.
Do you know what happens when you add a KeyListener to JFrame to capture global keystrokes? Nothing.
Much to my frustration, I discovered recently that KeyEvents are not bubbled up through the JComponent hierarchy by default. The only component that consumes the event is the one currently focused.
Java 7’s recent release has sparked some interesting discussion, some excited by the new features, some disappointed that it’s too little too late… But this isn’t one of those internet rants about the future of Java; this is about using a language to its full extent!
Java 8 lies ahead and with it promises of native Collection support. But that’s a while away, we want it now! And with Espresso4J, a small language-augmenting library designed to put a shot of liveliness into Java syntax, we can have it now too.