Converting CUSIP-6, CUSIP-8 and CUSIP-9 to ISIN in PHP

When working with securities data, you often have to convert between security identifier schemes. Sometimes you get ISINs, other times you get CUSIPs (and other times, CIKs, but that’s another story). The result is that you need to be able to convert between these schemes. There are pseudo-code algorithms for converting a CUSIP-9 to an ISIN, but I couldn’t find any in PHP, and I also wanted to be able to convert a CUSIP-6 or CUSIP-8 to an ISIN.

Continue reading “Converting CUSIP-6, CUSIP-8 and CUSIP-9 to ISIN in PHP”

Custom checkbox form validation with (or without) Bootstrap

Your browser, as well as Boostrap, comes with built-in form validation, but when it comes to checkboxes, the validation options are limited. I created a form with three checkboxes, and the user is required to check at least one. Bootstrap only performs ‘required’ validation on checkboxes, which, in this case, won’t work, because only one – and any one – of the checkboxes is actually required. Here’s how to address this:

Continue reading “Custom checkbox form validation with (or without) Bootstrap”

Custom spam filter with Contact Form 7, no extra plugins needed

I have been receiving more and more spam through one of my sites’ contact form, which uses Contact Form 7. To help stop this, I created a simple custom function that blocks contact form messages that contain specific words, without any additional plugins or services.
Continue reading “Custom spam filter with Contact Form 7, no extra plugins needed”

Don’t use bridge mode on your EdgeRouter – use a dedicated switch

Until recently, I was using my Ubiquiti EdgeRouter in bridge mode. I had my LAN on one ethernet port, and my wireless access point was connected to another ethernet port. Then I configured a bridge between the LAN and wireless AP ports. Logically, this made sense. However, this forces the EdgeRouter to do network switching duties, which it does entirely in software, and this is very SLOW. Even Ubiquiti states upfront that running in bridge mode will affect performance. Don’t use bridge mode.

Continue reading “Don’t use bridge mode on your EdgeRouter – use a dedicated switch”

How to configure Telus Optik IPv6 on a Ubiquiti Edgerouter

After switching to Telus Optik, I wanted to take advantage of Telus IPv6 support, using my Ubiquiti Edgerouter Lite. After a lot of googling, I was able to put enough pieces together to get full IPv6 working across my network. This configuration will work with EdgeOS 1.9.0, and should work with versions of EdgeOS going back at least to 1.7.0.

Continue reading “How to configure Telus Optik IPv6 on a Ubiquiti Edgerouter”

How to upgrade Ubuntu, NGINX and PHP5 from 14.04 Trusty to 16.04 Xenial

I just upgraded this site’s Ubuntu OS from Trusty 14.04 to Xenial 16.04. There are a couple of pitfalls during the upgrade that are noteworthy.

The biggest issue when upgrading to Xenial: Nginx and PHP5-FPM will break when you upgrade. So, keep in mind that any of your sites that rely on PHP5-FPM will be down during the Xenial upgrade.
Continue reading “How to upgrade Ubuntu, NGINX and PHP5 from 14.04 Trusty to 16.04 Xenial”

Renewing a let’s encrypt certificate made even simpler: automatically

I have written about renewing certificates from Let’s Encrypt in the past, and to the project developers’ credit, they keep making the process of getting, installing and renewing certificates easier. There’s a new client called certbot (and certbot-auto) that can be used to almost completely automate the certificate process. As an added bonus, the certbot client’s --webroot method allows you to renew without having to stop your web server and restart, and you no longer need to pause services like Cloudflare.
Continue reading “Renewing a let’s encrypt certificate made even simpler: automatically”

Prevent Jquery Mobile popups from auto-closing in iOS

If you need to automatically/programmatically open a popup on iOS/Safari using Jquery Mobile, you will likely see your popup flash by very quickly and then close on its own. This is a huge annoyance, as there are times when an automatic popup is required, such as for on-load disclaimers, or confirmations.
Continue reading “Prevent Jquery Mobile popups from auto-closing in iOS”