Posts

Checking to see if PHP is Running at the Command Line

We've been working on writing unit testing for our code. One of the things I struggle with is that on our production server we're logging a message to New Relic when we run into a condition that isn't planned for (in the future we'll have unit testing for this but it's a large code base and it needs a lot of work).

The problem that I've been running into is that when we do this we want these messages displayed on the command line when we run the unit tests and not send to New Relic. The code below allows us to do this:

<?php
class Application_Model_Error{
    public static function log($message){
        if(php_sapi_name() === 'cli'){
            echo PHP_EOL, PHP_EOL;
            echo '*****************************', PHP_EOL;
            echo $message, PHP_EOL;
            echo '*****************************', PHP_EOL;
            echo PHP_EOL, PHP_EOL;
        } elseif (extension_loaded('newrelic')) {
            newrelic_notice_error($message);
        }
    }
}

The following determines if PHP is running at the command line:

if(php_sapi_name() === 'cli'){

Link Post: Wal-Mart's Answer To Apple Pay Has Already Been Hacked

It was only some emails but not a good start for a company that's going to broker a trillion dollars a year...

Within the last 36 hours, we learned that unauthorized third parties obtained the e-mail addresses of some of our CurrentC pilot program participants and individuals who had expressed interest in the app. Many of these email addresses are dummy accounts used for testing purposes only. The CurrentC app itself was not affected.

We have notified our merchant partners about this incident and directly communicated with each of the individuals whose email addresses were involved. We take the security of our users’ information extremely seriously. MCX is continuing to investigate this situation and will provide updates as necessary.

http://www.businessinsider.com/currentc-hacked-2014-10

Link Post: CurrentC Is The Big Retailers’ Clunky Attempt To Kill Apple Pay And Credit Card Fees

With a heavyweight like Walmart behind CurrentC (say it out loud it makes more sense then) I'm guessing this will never go away. It's funny to me that very few people even knew this existed before Apple Pay went live. My guess is Apple Pay will be the default choice unless you must use CurrentC. Much like how I use my American Express first and then my Visa now.

http://techcrunch.com/2014/10/25/currentc/

Link Post: How To Protect your Server Against the POODLE SSLv3 Vulnerability

SSL is starting to drive me up the wall...

https://www.digitalocean.com/community/tutorials/how-to-protect-your-server-against-the-poodle-sslv3-vulnerability

How to Determine What Branches Have Been Merged in GIT

I use branches a lot but occasionally I forget to delete the branch after I merge it into master and then when I look at my list of branches I get a list of branches that I can't remember:

user@server:/var/www$ git branch 
  feature-calendarupdate 
  feature-calltype-filters 
  feature-multiselect 
  feature-newbilling 
  fixduplicatefields 
  fixresults 
* master 
  problemtracking  

If you want a quick way to determine which branches have already been merged into the current branch (I usually run this at master because then I know they're "finished" branches) you can run git branch --merged to get just the merged branches.

user@server:/var/www$ git branch --merged 
  feature-calendarupdate 
  feature-multiselect 
  feature-newbilling 
  fixresults
* master
  problemtracking

Then you can git branch -d blah to your heart's content.

You can also run git branch --no-merged to see the branches that haven't been merged yet.

Link Post: How I feel when I audit a client’s current website

So true...

http://www.commitstrip.com/en/2014/10/20/how-i-feel-when-i-audit-a-clients-current-website/

Link Post: Your Community Door

What are the real world consequences to signing up for a Twitter or Facebook account through Tor and spewing hate toward other human beings?

As far as I can tell, nothing. There are barely any online consequences, even if the content is reported.

But there should be.

http://blog.codinghorror.com/your-community-door/

Link Post: When someone’s had enough of a project and hands it over to me

Been there and done that.

http://www.commitstrip.com/en/2014/09/18/when-someones-had-enough-of-a-project-and-hands-it-over-to-me/

Link Post: Push it to the limits - Symfony2 for High Performance needs

I've always wondered if you could use Redis as a primary data store and just use MySQL for reporting. This statement makes me think I could:

So, as you can see, some unusual things are happening here - Redis is our primary data store and MySQL is our last cache layer.

http://symfony.com/blog/push-it-to-the-limits-symfony2-for-high-performance-needs?utm_campaign=Feed%3A+symfony%2Fblog+%28Symfony+Blog%29&utm_medium=feed&utm_source=feedburner

Zimco is Looking for a New PHP Developer

If you're interested in the topics covered here you would be a good fit for us. We have medical and dental and allow for remote workers.

A. The successful candidate must have at least two years of demonstrated web applications Programming Experience in CSS, JavaScript, HTML, PHP, and MySQL. Programming experience in Zend Framework and PhoneGap Framework are a plus. The successful candidate must also provide examples of at least two quality websites developed by the candidate with a list of technologies used in each.

B. Demonstrated experience with jQuery and a PHP framework are required, with Zend Framework experience a plus.

C. The successful candidate must be able to estimate/quote projects, oversee projects from start to finish with minimal supervision, and research new techniques/tools when needed.

D. A professional demeanor and customer service skills, attention to detail, excellent oral & written communication skills, the ability to work and exchange ideas with a team of programmers, and the ability to work reliably and effectively from home are also required.

http://saginaw.craigslist.org/web/4712284607.html

RSS

Join Our Mailing List!

View previous campaigns.

Top Posts

  1. Working With Soft Deletes in Laravel (By Example)
  2. Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
  3. Upgrading to Laravel 8.x
  4. Get The Count of the Number of Users in an AD Group
  5. Multiple Vagrant VMs in One Vagrantfile
  6. Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
  7. Changing the Directory Vagrant Stores the VMs In
  8. Accepting Android SDK Licenses From The OSX Command Line
  9. Fixing the 'Target class [config] does not exist' Error
  10. Using Rectangle to Manage MacOS Windows

subscribe via RSS

All content copyright This Programming Thing 2012 - 2021
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general