Posts

  • 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.

  • Refactoring 2nd Edition: Chapter 3: Bad Smells in Code

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

    Overview

    This chapter covers various “bad” practices that are a good indicator that you should refactor your code.

    My One Takeaway

    It’s a good thing the back cover has a list of these and what to do because it’s hard to know what to do with this list. It almost seems like there should be some kind of tool that looks for these. I’m not going to make it but it would be a good check.

subscribe via RSS