Performing Controlled PHP Refactorings in Emacs

By day, I work as a PHP developer at Research Square. My time is spent developing new functionality for the RS suite of products. This may include working in greenfield code bases or extending our legacy products. In either case, dozens of times a day, I find myself performing various code refactorings. Continue reading

Generate Daily Messages with Org Journal

One of the requirements of my job is to send out a daily message. This message should summarize what I did the day before, and what I hope to accomplish for the current day. At first, I would spend my day jumping from task to task, and then the next morning, I would rack my brain to make sure I included all the things I worked on.

It didn’t take long to realize that this was no way to live. I definitely needed a better solution. So I started looking around. Continue reading

Embedding Code Snippets In Org Mode

Without a doubt, Org Mode is one of the most impressive and versatile features of Emacs.  Great for writing structured documents, managing lists and planning, and for exporting those documents into a variety of formats, it’s my go to tool for flexible, efficient editing.

In the video below, I cover one small aspect of Org Mode; namely, the ability to embed code snippets within your document.  I’ll cover some of the problems you will run into when first attempting to embed code, how to overcome them, and some shortcuts that make the whole process much more streamlined.

Enjoy!

Efficient Command Line Navigation

I live on the command line. Between vim, tmux, and xmonad, there isn’t much I have to use the mouse for these days. Given my love for keyboard navigation, it only makes sense that I learn as many of the command line shortcuts available as possible. Here I detail some of the most helpful navigation tricks, and those I use on a daily basis. Continue reading

A Note on Recovering From InnoDB Corruption

InnoDB is a great storage engine for MySQL offering, among other things, transaction support. One of its drawbacks is the difficulty that you can face when corruption inevitably hits.

At work we have dealt with corrupt InnoDB tables often enough to make the procedure fairly routine. Last week I was faced with a situation that had me pulling my hair out; in fact we almost threw in the towel.

In this particular instance I was connecting to the database with the standard command line client mysql. Every time I ran any query (against the corrupt table or not) I was slapped in the face with the annoying “MySQL Server Has Gone Away” message. Even queries like SHOW PROCESSLIST; would trigger the problem.

Right before we gave up I had an idea. When you start the client it gives you the following message:


Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

What this means is that the client looks up meta information about the tables and columns in your selected database so that when you hit TAB it will auto fill the table names like you would get on the command line. The list of tables and columns is rebuilt any time you change databases or issue the REHASH; command.

On a hunch I tried starting the client with the -A flag to prevent this table scanning. I don’t know the technical reason within MySQL’s binaries but with this option enabled my problem went away. I can only assume that when the client scans the tables (including the corrupt table) something goes horribly wrong.

So just file that away in your DBA utility belt :)

Git: From Init Through Commit

I recently presented for the first time at the UpFront Wichita developer group, covering the topic of Git.  As everyone knows, Git is an amazing tool, but for those new to it, it can seem daunting.  In this talk, I cover the basics so a developer can get started using Git for their personal projects, such as staging files, reviewing the history of commits, and simple merging.

This talk was recorded, and is available on YouTube, so it’s never too late to catch Git: From Init Through Commit.

You can also download a copy of the slides from the UpFront community GitHub page.

At the next meetup, I will be discussing Git from the team aspect.  We will cover pushing and pulling, rebasing, tagging, and we’ll walk through the process of using GitHub to contribute to an open source project.

If you’re local to the Wichita area, I hope you’ll come out and join us.  If you’re not, all of these talks are hosted live on the Google+ community page for your convenience.  But don’t wait until the talk to say hi.  Check us out on irc.freenode.net at #upfrontwichita

Regular Expressions 101

I recently joined a a great group of local developers called UpFront Wichita. The organizers were so gracious as to let me present last night on one of my favorite topics: Regular Expressions.

We recorded the presentation using Google Hangouts on Air. The video is available on YouTube. The slides, source code, and text files used for examples are available on GitHub.

The video was our first attempt at recording one of these presentations. At our next meetup we will do things a little differently to produce a better video and to provide better support for remote participants that want to participate in the hangout.

The presentation covers the most commonly used features of regex and some of the nicer advanced features like backreferences and assertions. Most of the research for the presentation comes from regular-expressions.info. Interested readers should check out that site’s references on some of the crazier things you can do.