Posts

Link Post and Podcast Roundup: July 2019 Edition

Link Post Logo

July’s links.

Read More

Link Post and Podcast Roundup: April 2019 Edition

Link Post Logo

April’s links.

Read More

Finding Domains Name From Email Addresses in MySQL

Header

The other day I wanted to know how many unique domain names existed in the emails addresses of one of our databases. I started looking for an easily way to find them and how common each domain was. The query below will give you those details.

Read More

Link Post and Podcast Roundup: March 2019 Edition

Link Post Logo

March’s link.

Somehow I scheduled all my social media posts for March and not February so the Twitter feed is going to be FULL this month. :-)

Read More

Using array_search to Delete a Value From an Array

Header PHP has a distressingly large number of functions that allow you to manipulate an array. In this post, we’ll show you how to use array_search() to delete a specific value from an array.

Read More

Refactoring 2nd Edition: Chapter 6: A First Set of Refactorings

Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

Overview

This chapter introduces the first set of refactorings we’re going over in this book. Each section explains why you would want to do the refactoring and then walks through an example.

My One Takeaway

I’m going to deviate from my normal structure in order to post two takeaways:

  1. Extract Function and Extract Variable are now part of my normal day to day work. I’m amazed at how much cleaner this makes my code.
  2. It’s interesting how some refactorings are just combinations of other refactorings.

Refactoring 2nd Edition: Chapter 5: Introducing the Catalog

Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

Overview

This chapter explains the rest of the book and what’s to expect.

My One Takeaway

Normally, I have my co-workers skip these types of chapters because there isn’t anything of value in them. However, I think this chapter is important because it tells you that the following chapters contain refactoring methods that have been built up from Martin Fowler’s notes. I’m hoping that even two of them can be helpful.

Detecting PHP Files That Don't Start With <?php

Header In the past week I’ve had two weird bugs come up. After an hour or two of troubleshooting they both revolved around an extra character before the <?php tag in a PHP file. In one case I added an extra return line before the <?php and in another I added an extra “`”.

`<?php
class ... {
...
}

In trying to debug these problems I wrote a script to find PHP files with extra characters and I’ve added it to my pre-commit check.

Read More

Link Post and Podcast Roundup: February 2019 Edition

Link Post Logo

February’s links.

Read More

Refactoring 2nd Edition: Chapter 4: Building Tests

Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

Overview

This chapter explains the value of self-testing code and gives some examples.

My One Takeaway

The section “Probing the Boundaries” talks about writing code that tests for edge cases like negative numbers and invalid numbers/string. This is something I need to do more of in my own testing.

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