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 Mac Postfix to Use Gmail for SMTP Relay

If you’re like me and you do your development work on a Mac, you’ll want to configure Postfix to send you email messages. It’s pretty easy to do. vi /etc/postfix/ Edit and add the following to the end of the file. smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd smtp_sasl_security_options=noanonymous smtp_sasl_mechanism_filter=plain smtp_use_tls=yes smtp_tls_security_level=encrypt tls_random_source=dev:/dev/urandom The key one is the… 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 »