Coding

Creating a Custom ZF2 Controller Plugin

October 12, 2015 by

Creating a custom controller plugin in Zend Framework 2 is easy! First, begin by creating a new class. I will put this in the Application\Controller\Plugin namespace. namespace Application\Controller\Plugin; use Zend\Mvc\Controller\Plugin\AbstractPlugin; class HelloWorld extends AbstractPlugin { public function __invoke() { return $this->hello(); } public function hello() { return ‘Hello World!’; } } As you can see,… read more

Getting Query Parameter from URL in JavaScript

September 28, 2015 by

To most people’s surprise, there is not a standard way of accessing query string parameters from JavaScript without first having to parse the query string. Some frameworks and libraries have implemented ways of doing this, but it is not always the case. For example, the ever so popular jQuery has not implemented this, but rather… read more

Multi-column Lists with CSS3

September 26, 2015 by

Before CSS3, it was quite a struggle to have an ordered or unordered list span multiple columns. In fact, people often resorted to either rendering the lists in columns from the server (if possible) or using CSS hacks. Luckily this is no longer necessary in CSS3, because you can easily accomplish this with a new… read more

Generate CRC32 Checksum in Java

September 26, 2015 by

Generating a CRC32 checksum in Java is – as you would expect – extremely simple. All it takes is a few lines of code. Below is an example on how to generate a CRC32 checksum from a string. public final class AppUtils { private AppUtils() { } public static long crc32(String input) { byte[] bytes… read more

Updating Entities with Update Query in Spring Data JPA

March 25, 2015 by

With object-relational mapping (ORM) tools such as Hibernate, one usually modifies entities by first fetching them from the database, modifying some fields, and then persisting the entities again. This is a good approach in many cases, but in some scenarios this may not be desirable. For instance, if you want to update a collection of entities (i.e.… read more

Convert Byte Array to String in C#

March 24, 2015 by

Converting a byte array to a string in C# is easy. In fact, it can be done in a single line. Below is an example that converts a string into a byte array. In the example that follows, we will then convert that byte array back to a string, effectively showing you how to do the… read more