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

Mounting Windows Shares with cifs in Debian Squeeze

openlogo-ndI run Debian Squeeze with Gnome 3 on a laptop. I mainly use this to offload my e-mail from the main machine, where I can concentrate my workflow across two screens without the constant need to ALT-Tab. This means that there is a need to share files between the Windows desktop machine and Laptop, using regular windows file shares.

I had a series of “bookmarks” that allowed me to access various Samba shares. These bookmarks (GVFS mounts) are configured in Nautilus, and really simple to set up. Unfortunately, they are not so easy to use; you can’t drag and drop a file from a GVFS share into a non-supporting application (such as Google Chrome), and they don’t usually generate file previews in nautilus either. This could be due to the fact that they use protocol addresses (e.g. smb://)? That means that I was having to copy files—from the shares to a local directory—before being able to work with them.

Filed under Tutorials