MySQL Alter Locking Tables

I happen to get to work with some decent size data. I don’t know that I would say Big Data because that is a buzz word and I know there are people dealing with MUCH more data than I get to.

However, on the main application I work on, we do have over 2TB of data. With this much data comes a price to pay when you want to make a schema change. Locking tables being the biggest price, as sometimes this will render an application unusable.

There are ways around this sometimes. Percona has some great tools to make altering tables work without locking. It involves a lot of really cool magic, including creating a new table, creating triggers on the old table to populate the new table, and then copying all of the data. Once done, remove the old table and rename the new table. It’s fascinating when you think about the simplicity of it.

However, I still often go old school with a simple ALTER TABLE command. In the past, when I wanted to see the progress that has been made, I simply looked at the files on disk and compared the table being updated’s file size and the temporary table. As the temporary table grew close to the same size, I knew it was done.

Today I learned there was a SQL query you can run. I then modified what was given to me to also include the number left (I don’t know what the number means), and the percentage completed. That final number is the one I am finding most fascinating right now.

I am documenting this here for my future self as I will one day ask what that query was and go digging trying to find it.

    WORK_COMPLETED/WORK_ESTIMATED*100 as PercentDone    

PHP|Architect being acquired by

To me this is HUGE news in the PHP World.

If you are in the PHP community and don’t know PHP|A, then you have been missing out.  I learned about them when I decided I HAD to grow and improve my skillset.  I was a sole developer that was stuck.  I wanted to be better, but to do so, you have to work with better people than you are.  So I set out a goal of learning things, and luckily enough I kind of knew what I was looking to learn.  Part of my whole speech about needing to know what you don’t know.

PHP|A offers a magazine (used to be in print, maybe again soon?), books, trainings, and conferences.  The conferences are what first drew me in.  I attended TEK-X, back in May of 2010 and thus start of the new me.  Within 2 years, I completely transformed myself for the better, and made some huge life changing decisions.

I met all of the members of while on my new quest.  I met @EliW first at Tek-X, and while he won’t remember it, I certainly do.  I got to hang out with a large group of people in his room playing Rock Band until late in the night.  I was very shy that year, and stayed to myself.  I met the rest of the team (@omerida, @SandyS1, and @kevinbruce) this year at Tek12.  I talked with them way more than I thought I would have, and it was a great experience.

The Musketeers were the team behind, until funding ran out and the backers pulled the plug.  At least this is how I interpreted the story.  They decided they liked working together and formed a new company called Musketeers.met.

This is a great story for potential PHP startups.  I am looking forward to what comes of all of the changes at PHP|A.  Will the conferences continue?  If so, will they be as good as they were, or better?  Congratulations GUYS!!!


VimDiff: How Have I Not Used This Before?

Ok, I have been using Vim for about 15 years now, and even did a whole presentation on vim at my SD PHP Meetup, and had a reference to vimdiff in one of my slides. But honestly I have never used it.

WOW, what a great tool. Here are a couple of links that I found useful.

The video shows you how to use vimdiff as your git diffing tool.

One thing to add. If you follow the steps for using vimdiff as your git diff external tool, make sure to add this to your .gitconfig
diff =

Otherwise you will get errors.

Also, when editting more than 2 files at once, those shortcuts won’t work.
Instead of :dp, use :diffput b#
Instead of :do, use :diffget b#

b# is just a number of the window pane starting at 1, counting left to right.
Shorthand :diffpu or :diffg


Do Not Hire Or Be A Sole Developer

I was a sole developer for for eight years. While there, I was very happy to be the only tech person. I was able to do things my way. There was even an employee that encouraged the owner to outsource the programming, and to get rid of me. Needless to say, I was very unhappy when I heard this.

Looking back… being a sole developer is bad for both the company and the developer themself.

    For Developers:

Developers should strive to be part of a team. It is so hard to grow by yourself. If you have to be willing to put yourself out there and work very hard to learn. If you have co-workers, you will learn from each other. Someone will have your back if you make a mistake. Learning best practices is easier with more people.

    For Companies:

If a company can not afford to hire at least 3 people, they are doing themselves a disservice by hiring any. What happens when that person leaves? Who’s double checking that person? Did you really hire the “Best” you could?

Outsourcing to a group of developers is not necessarily as expensive as it sounds. Sure, per hour you may pay more, but you are basically buying the experience of a group of people. If someone leaves that group, there are others that can pick up where they left off easily. You should not be left hanging in a transition. You are not paying an employee when they are not working to 100% productivity or for them to spend time learning.


In the end, a sole developer really isn’t good for either party.


The Pragmatic Programmers: Practical VIM Review

I gave a presentation at SD PHP on Vim, and when I got home from giving the presentation, I had this book sitting on my doorstep. A little late for my presentation, but that’s probably a good thing.

All I have to say is WOW. I am going to have to give another presentation from just the new things I’ve learned. This book is not for beginners by any means. And if you think you know Vim well, I would say pick this up and have your mind blown.

I have been using Vim daily for over 14 years. It’s how I write code, which is how I make a living. The book starts off with the dot (.) command. Which is very useful, but not the first thing you would learn in Vim. I have used that command extensively for years. But nonetheless, with that kind of start, I knew that starting there meant the book would be advanced.

I am currently at page 33, and have said OMG many times with the cool things Vim can do, that I had no clue about. Based on this alone, go get this book. 5 out 5 stars/elephants/candy canes, whatever you want to use.

Practical Vim: Edit Text at the Speed of Thought


Solved: Facebook sharer.php Not Working for Some Reason

So, we have a ton of share links all over our various domains at work. And much of our domain structure is based on users have subdomains (example:

All of a sudden, the sharer.php seemed to stop working. Some browsers stayed white, Chrome showed a grey error message with a 500: internal server error.

It took me a long time to track down the problem. I tried so many different things, but in the end, it was the CASE of the subdomain. 🙁 Changing it to solved the issue. So strange, undocumented, and frustrating.

I hope this helps someone down the road.


Running a PHP User Group (2 Months In)

Running a user group was not in my thoughts prior to 2011. I joined Orlando PHP Dec 2010, but there was an hour commute. Then Daytona PHP started back up, and I was thrilled. Except they had 1 meeting and fell apart. 🙁

I planned on starting Daytona PHP on my own, but due to waiting for the OK from my then employer to use their conference room and then deciding to move to California, I put that idea to rest.

I started looking for a PHP Group in San Diego and was surprised to see that one did not exist. It became my goal to start it up (well start it up again, there used to be one). I had everything in place before I even moved.

Running a user group has to be one of the most satisfying experiences I have had in a long time. The people are great, and I have been very lucky to find members that want to be part of my team and co-organize. I was lucky to find a host that would provide space and pizza for the group.

We have had 3 meetups so far, and there have been a few regulars, which tells me something is going right. 🙂


Bluetooth Headset Purchase

After spending some time doing a lot of research, I settled on ordering the Motorola S10-HD.  I read some great reviews, some not so great as well.  We’ll see and I will post once I have them in hand.



Why You Should Not Style Major Elements

I have done this to myself many times.  Have you ever thought, I want all my tables to look like XYZ.  So you throw table { border-color: blue; … } into CSS.

The problem is now you are stuck with that for all tables.  I think you should have a table style like table.blue_border { border-color: blue; …} that you can now apply to only the tables you want to with <table class=’blue_border’>.

You will inevitably need a standard table somewhere without the same style as the rest, but now you have to do more work to make that happen.  Do yourself a favor, use a reset for all HTML elements, and don’t style them directly.  Style a class that you will put on those elements.



Feature I Would Like To See On PHP Tek Schedule

I am attending php tek12 next week.  One thing that I think the tek team should do is make it super simple for me to choose the sessions that I want to attend.

My vision: Since the majority of each session on the schedule page is a link, maybe add a check box/radio bottom for each time slot.  This would dim the other 2, making the ones I want to attend standout.  The printed version would look nicer.

Also, if I am logged into, a simple ajax call to store my choices, so when I came back, it would be all preselected set for me.  And I could make changes if I wanted to.

Probably a little to late for tek12, but there is always tek13 🙂