Posts

Making dataProviders More Maintainable

I'm a big fan of using PHPUnit's data providers feature because it allows you to easily run a lot of data through the same kinds of tests over and over again without having a bunch of duplicate code sitting around. But they aren't always the easiest thing to come back to an understand.

Read More

Are We Learning Programming the Right Way?

I just finished reading Test Driven Development: By Example by Kent Beck (more on this later because this has really changed my workflow) and as I was reflecting on the concepts explained in the book I've started to wonder if people are learning to program all wrong.

Read More

Lessons Learned When Building a Time Machine

Why we have a Time Machine

One of the more interesting projects I've worked on while at STAGES has been our time machine.

I know what you're thinking but it's not a real time machine, it's just a way for use to look into the past and see the state of our site on a given day. The idea is that if a user says they did something on June 15th but the data isn't there we can go back and say "at 6 PM the data wasn't there" and then use one of the mid-day backups to investigate further. This way instead of having to restore lots of backups to determine the date the data was deleted we have easy to access data that our support department can look at without even having to involve DevOps.

Read More

Link Post and Podcast Roundup: July 2015 Edition

The Verge's web sucks

It's information like this that makes me happy I'm not dependent on ad revenue for my lively hood. I can't say I wouldn't do the same if I were in their shoes.

The decline of Stack Overflow

I think 90% of my google searches are now answered using on of the Stack Exchange sites but this article make some good points.

i want hue

I used this to get a bunch of colors for a graphing program that needed a bunch of colors.

Shields IO

I wasn't aware there were this many projects that had these shields. It's a little crazy if you ask me.

What It’s Like to Work for a Bad Contracting Company

In my line of work, I get to see a whole lot of SQL Server projects – both good and bad – and work with the teams involved in building them. More often than not, I see contracting companies who have taken some disturbing shortcuts with horrifying results.

See, bad contracting companies have a huge sales force that goes out and asks customers, “Hey, what problems are you having? Sure, we can solve those. Just sign here.” They make impossible promises about their – well, YOUR – capabilities and timelines.

PDF Rotate

I had a client email me a PDF that was rotated 90 degrees and they wanted it posted. This page made it a quick fix.

Improved Server Defaults in 5.7

The items that I know needed to be changed are nice to see but I wonder how many pieces of software are going to break because of this and the quick fix is going to be change the settings back. Still a good step forward for new deployments.

This post has some examples of what will happen.

MySQL Extension, Going, Going, almost Gone

I was thinking I was going to need to write a wrapper to upgrade the old mysql_* functions in my code but it looks like someone has already done that.

Developer Escapades: Recruitment Redflags

This one is my favorite:

5 years experience – that framework came out 2 years ago!

Podcast: Systems Thinking: Less Coding, More Thinking with Kishau Rogers

An interesting discussion on how to thing about how our code fits into the bigger picture. I know we've had conversations about features that seemed like a quick no brainier but then ate up a lot of time adding refinements and fixing bugs.

Podcast: Relationships, Geek Culture, and Raising Nerds with Anjuan Simmons

Another interesting conversation about geeks and how they fit in with normals. Also some comic book talk that went a little over my head...

Podcast: How to Prewire a Meeting

I don't have to do this type of meeting much but this has some helpful times (including to practice fully [not just read the slides in your head]).

Podcat: Corey Haines - The 4 Rules of Simple Design

In this episode, Adam talks to Corey Haines, author of "Understanding the 4 Rules of Simple Design". They talk about the importance of low-level design decisions, tricks for naming things well, why you shouldn't model your objects after the real world, and of course, Active Record.

Exporting a Query to CSV From the Command Line

I've written about how you can use mysqldump to output specific records before but what if you need to export data from a complex query for a one off report:

SELECT lastName, firstName, count(*)
FROM User
INNER JOIN User_Log on User.id = User_Log.UserId
GROUP BY lastName, firstName;

In order to export this to a CSV file you can tack the following on to the end of you're query and it will be exported:

INTO OUTFILE '/tmp/data.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Then you just need to download the file and send it to your client.

Quick Tip: Determine an Element's Type in jQuery

The other day I needed to determine the type of an element returned from a jQuery search. It's done through the prop() function and it returns an upper case string:

var element = $(this);
if (element.prop('tagName') == 'TD') {
     // do something
}

Link Post and Podcast Roundup: June 2015 Edition

Link: Donald Trump Speech Perfectly Exemplifies How Web Developers Are (De)Valued

Link: A Crusade Against Bad Code

The existence of BAD CODE being copied and pasted by newcomers is probably the biggest source of exploitable security vulnerabilities in the entire industry.

Podcast: Diagnosing Performance using New Relic with Anna Brown

Podcast: Building Community around the XPRIZE with Jono Bacon

Telling MySQL Which Index to Use

**Disclamer: ** I'm sure MySQL database administrators will tell me that this is SUPER wrong because I should always let the database engine pick what indexes to use but this feature exists for a reason. That being said I'm NOT a database administrator I'm just a programmer that plays one on TV.

The other day we ran into an issue where a page would take about 60 seconds to rendering and the problem was tracked back to a single query. Lets say it looked like something like this:

SELECT * 
FROM Table1
INNER JOIN Table2 ON Table2.id = Table1.Table2Id 
WHERE Table2.column = 'true';

When I ran explain on the query I got the following:

screenshot.1433185205

I've never seen it use intersection before and I had a index set for all the columns I was using. In MySQL you can force it to use an index:

SELECT * 
FROM column
INNER JOIN Table2 USE INDEX (column_idx) ON Table2.id = Table1.Table2Id 
WHERE Table2.column = 'true';

This simple change took the query from 60 seconds to 0.5.

Link Post Roundup: May 2015 Edition

[SLIDES] WHAT TO EXPECT WHEN YOU’RE EXPECTING: PHP 7 (PHPDAY 2015)

An overview of some of the more important improvements to PHP7. I'm super happy to see the mysql_* functions going away.

How to Design Indexes, Really

An overview of how you should be adding indexes to your MySQL tables.

How many people are missing out on JavaScript enhancement?

Horrible take away from this article:

1.1% of people aren't getting JavaScript enhancements

I love the way they tested this:

So @tombaromba hacked some code in the GOV.UK homepage (similar to an approach inspired by an experiment Yahoo! Conducted in 2010). We chose this page because of its high volume of traffic and low likelihood of any bias towards a particular user group or demographic.

This code included three images, of which browsers should request two.

First, an image that virtually all browsers would request (the ‘base image’).

And either

  • an image that only browsers executing JavaScript would request (the ‘script image’)
  • an image that only browsers not executing JavaScript would request (the ‘noscript image’)

We deployed this code and then collected the log data from over half a million visits. I expected that number of ‘base image’ requests would closely equal the combined ‘script image’ and ‘noscript image’ requests.

I'm curious what the numbers are for sites I manage...

The God Login

I wish more sites would get behind this:

User identity is always email, plain and simple. What happens when you forget your password? You get an email, right? Thus, email is your identity. Some people even propose using email as the only login method.

Most common git screwups/questions and solutions

This is the scariest one in the bunch:

Remove all local untracked files (and directories) from your local clone

Careful! You might want to take a backup before doing this:

git clean -f -d

The why, what and how of automated static asset pipelines

A good overview of why you should be using a static asset pipelines but it doesn't go into enough details to actually be helpful. :-)

paragonie/awesome-appsec

A curated list of resources for learning about application security

NisreenFarhoud/Bash-Cheatsheet

The main topics of this cheatsheet include an intro to the shell, navigating around the shell, common commands, environment variables, connectors, piping, I/O redirection, permissions, and keyboard shortcuts.

Podcast Roundup: May 2015 Edition

I've been trying to figure out how to communicate Podcasts and links that I found to be informational or interesting but I don't want to clutter up my site with junk so I'm going to start creating roundups every month so I can still communicate these but not have 100 one link posts.

FLOSS

#335 Taiga.io

This sounds like a really interesting Agile project management system. I've created an account and it looks amazing.

This Week In Startups

Episode: 543: LAUNCH Incubator 2: Des Traynor, Cofounder Intercom, on product vision, roadmap, virality, & everything you need to know for "Starting Up"

This is a really interesting presentation about a bunch of topics that are important if you're creating a project. I've listened to it twice and I'll keep coming back to it. I might even listen to it again and post my notes. It was packed with information.

Sound of Symfony

Episode 7 - Talking about tools

An overview of various tools use in PHP development. I'm always looking for better tools to improve my work.

Episode 8 - Concerning command buses

An interesting overview of command buses.

HANSELMINUTES PODCAST

Accessibility (a11y) with OpenDirective's Steve Lee

TIL a11y = Accessibility because it starts with an "a", ends with a "y", and has 11 characters in between.

Accessibility is one of those things that I think I should do more with but never do. I'm really going to make it a goal to get my stuff together and test my sites for accessibility.

Saving Bletchley Park with Dr. Sue Black

Bletchley Park is where Turing helped create the computer that broke the Enigma. This interview talks to one of the people who was involved in converting it to a mueseum and clears up some inaccuracies in The Imitation Game (a great movie if you haven't seen it yet)

Diversity Hiring

We just finished hiring a new programmer at Zimco and almost all of the candidates we got were white men (a lot of that is due to our office's location in Mid-Michigan). It was interesting to hear two separate podcasts that discussed diversity hiring within as many days.

  1. Stack Exchange Podcast #64: Diverse Hiring and a Cat Named Alan Turing
  2. Improving Diversity in Tech with Ashe Dryden & Faruk Ateş
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