Posts Categorized: Programming

Updating Ubuntu 14.04 Reverts Command-Line PHP to Version 7

PHP version 7 looks really cool and I can’t wait to start using it, but for now, I’m still on PHP 5.6. But every time I do an update on my Ubuntu dev box, it sets the PHP command-line to PHP version 7. Here’s how to switch it back on Ubunut 14.04. ln -sfn /usr/bin/php5.6… Read more »

Symfony Load Twig Template From String

As is always the case with PHP, or open source technology, there’s a gazillion ways to rule the world, or solve a problem. I had a problem with a Symfony app I was building. I needed to load the Twig template from a string variable rather than a file. To do so is easy. All… Read more »

Software Engineering: Work Your Code

I see too often code written by others that is not finished but running as production code. The programmer wrote the code, it “worked,” and she moved on to making the next thing “work.” Even for people like myself who have been writing code for nearly two decades, the first draft is just that –… Read more »

How to Configure Postfix to Use a Relay not on Port 25

Sending email over port 25 is very 1990s. Most of us are running our email servers on cool ports like 587. Well for some reason I really stumbled getting Postfix to relay through my SMTP server for a new development environment. I’ve done this at least a half-dozen times, but I never had this difficult… Read more »

PHP SoapClient Create An Array of Objects

In PHP, you can’t create an array with the same key more than once. You can’t do this. $array[‘transaction’] = “success”; $array[‘transaction’] = “fail”; Obviously, you can DO that, but “fail” will overwrite “success.” But when making Soap calls, it’s often necessary to pass in a structure like this. <users> <user> <firstname>Jamal</firstname> </user> <user> <firstname>Acacia</firstname>… Read more »

Use these Credit Card Numbers to Test Paypal Credit Card Payments

I was trying to get Paypal credit card vault to work, but I couldn’t using the generic credit card numbers listed in the documentation. I contacted Paypal support and they said to use these two numbers. VISA : 4716 3248 7603 0777 Mastercard : 5453 9874 8085 6045

Symfony Doctrine To Flush or Not to Flush

I’m in the process of converting an old MySQL database to a shiny new MySQL database controlled via Doctrine. Some of the tables have tens of thousands of records in them, so I was curious if it made sense to flush after each insert, wait till the end and flush or flush periodically during the… Read more »