Using Servlet Filter and Spring Web with Jetty

I’ve been experimenting with servlet filter, along the same lines as my experimentation with aspects. Aspects are quite an interesting topic, however for the request instrumention task it seems that filters are much more suitable. Realising your approach is wrong and pivoting is, I feel, an important skill to learn in software development.

Filed under Tutorials

Aspect Oriented Programming with AspectJ and Spring AOP

Recently I have been experimenting with aspect oriented programming, and the ease with which you can handle cross-cutting concerns. It’s an extremely powerful tool, allowing you to insert pointcuts throughout your code, and inject bytecode around code without polluting your source code. AspectJ provides a great deal of flexibility in the methods through which you can instrument your code.

Filed under Tutorials, Uncategorized

Splitting Read & Writes using Replication Driver in Spring Boot

My team has recently been working on a new Spring Boot application. One of the many best practice requirements—see non-functional requirements—is that we separate our read and write layers when utilising RDBMS (such as MySQL). As a newbie to this particular problem in Java, it seems that the easiest way is to use the official replication driver provided by the com.mysql package.

Filed under Tutorials

… and we’re DNSSEC signed too 👏

So enabling DNSSEC was easier than I thought. All I had to do was transfer my domains to a new registrar! So i’m now registered with gandi.net — the transfer process was painless, and luckily I wasn’t charged for the privilege. I think the most gruelling part was entering the IPS tag for my 10-year old domain, and having it disappear from the dashboard. The on-boarding process took ten minutes or less, but if felt like a lifetime.

Filed under News

We’re http/2 and ipv6 compatible!

Well, it seems that way anyway. Unfortunately both my residential broadband and mobile connections lack ipv6 connectivity, so I’m relying on the Qualys SSL Test and various other on-line tools to assure me of the ipv6 compatibility. http/2 was easy to test; firefox developer tools tells you which protocol was used for each downloaded asset. Please let me know if I have gotten something obviously wrong!

Filed under Tutorials

Vagrant LAMP Stack with Debian Jessie

VagrantI thought it was about time I chucked my Vagrant LAMP stack into VCM, before I lost or broke it. For those unfamiliar with Vagrant, go do some reading!

It’s based upon a not-so-current version of Laravel Homestead. I switched it to the debian/jessie64 base box, and added an init shell script. The init script will run every time you run vagrant provision, so I have carefully crafted the script to ensure it will not break things when run multiple times.

Filed under Projects, Tutorials

PHP7 beta1 build process for Debian Wheezy

PHP-logoLast weekend I decided to give PHP7 a try. Given it’s beta, I had to compile from source. As I already run a stable package version, this guide doesn’t cover the Debian packaging process. Instead we concentrate on installing PHP to an alternate directory.

Filed under Tutorials

Favicon to PNG with convert and streams

I have WordPress set up to load, parse and cache the favicons for sites added as bookmarks. The PHP class I was using struggled with certain ICO files, such as alistapart.com and sitepoint.com.

In the below example, we load a favicon from the filesystem into memory. For my use-case, the favicon has been loaded directly from the external site. Wanting to avoid unnecessary temporary files, I found that you can pipe data to and from the convert program from ImageMagick using streams in PHP. Assuming that you have determined that the favicon is an ico file;

convert ico:- -thumbnail 16x16 -alpha on -background none -flatten png:-
Filed under Tutorials

Git: changed files between two commits

If you need a list of all modified files between two commits, you can use the following command;

git diff --name-only SHA1 SHA2

You can also pipe the output to a file (in the parent directory) as follows;

git diff --name-only SHA1 SHA2 > ../filename.txt 

Via http://stackoverflow.com/a/1552353

Filed under Snippets

Solving a Pound HTTPS Redirect Issue

I recently had a problem where a Magento store would infinitely redirect, from TLD to sub-domain (i.e. non-www to www). The server was configured behind a reverse proxy, which was handled by Pound (acting as a load balancer and SSL wrapper). Pound is great for handling hand-overs between a caching proxy and application servers, in addition to load balancing multiple servers and wrapping SSL connections to the client.

Filed under Servers