Steve Gricci
Geek. Coder. Father.

February 29th, 2012

Fighting Repetitive Stress Injury

Yesterday I read this article, about how Henrik Warne beat RSI. As a programmer for as long as I can remember, I too have had similar issues with Repetitive Stress Injury. Coding for very long stints of time can be hell on the wrists.

I figured I'd jump in and add a few things that worked for me.

Equipment

It should be obvious, but if it's not, the best way to fight an issue with your wrists is to use better equipment. We're talking mouse and keyboard here.

Keyboard

Probably after my 2nd year of programming in my bedroom (as a teen), I started having issues with my wrists. I looked it up on forums, figured out that it was mostly due to the fact that I would sit in front of my computer for 10+ hours at a time, and asked for this keyboard for my birthday that year. Problem solved, right?

Of course not. Fighting RSI is something you'll likely due for your entire career. Eventually, I switched over to the current edition of the Microsoft Ergonomic keyboard. It did a lot to get rid of the pain at first, but eventually, I would find that my wrists would start hurting again, especially after extended coding marathons. I would usually blame it on the age of the keyboard and buy a new one every year or so. On those newer Microsoft ergonomic models, the PSI to push down a key increased several orders of magnitude as it ages.

Last year, I switched to the Kinesis Advantage keyboard. The prices from the manufacturer are a bit inflated, check out Amazon.com and you can score one for a bit less. This keyboard is a dream. The PSI is pretty constant, even going into my 2nd year of use. It also has optional foot pedals, but I don't use those. This keyboard is hard to transition to, as the key layout is a bit different. If you are coding every day, it might be a good idea to keep your old keyboard around for a bit while you get used to this one. I believe it took me around 2 weeks to get fully used to this keyboard. It's also very customizable, I use it on a Mac, and it comes with extra keys and a key puller to make it easy to switch layouts.

Since I've switched, I've never even thought about going back. I have literally zero pain in my wrists now, and I'm coding more hours than I have in a long time (being a freelance consultant, that equates to money).

Mouse

I pride myself on never really having to touch the mouse. I do everything possible by shortcut keys, hot keys or macros. I use Vim as my everything editor. For this reason, I don't really care about the mouse I use. I am currently using the Apple Magic Mouse that came with my 27" iMac.

Desk

One of my favorite upgrades I made when changing over to work at home full-time was getting a standing desk. While this doesn't directly change my RSI issues, it does help get me away from the computer more often. When you are standing and are faced with a programming conundrum that you need some time to think about, it's quite easy to just wander away from the keyboard and go take out the trash. That's something I'm sure my wife loves as well.

Breaks

I just mentioned it above, and the original post by Henrik Warne mentions it as well, but taking regular breaks is a great idea. 20 years ago, people weren't sitting in front of a computer, operating it with their fingers the way we are today. It's going to take a few more cycles of evolution before I think we'll adapt. For the moment, the best thing you can do is to do something else every hour or so, for a few minutes at a time.

Hope that helps!

--Steve

December 16th, 2011

Interesting Reads

I've been contracting since the beginning of the year and decided to go full-time with it this July and work really started to get the better of me. During the last 2 months, I haven't posted much, but have finally made some room to begin anew. Here are some stories I've read that I haven't had time to post, but that I thought my readers might find interesting:

  • What's In A GIF -- I recently had to implement multi-frame GIFs in PHP and found this byte by byte guide pretty helpful in understanding how GIFs work.

  • Parenthood by Jeff Atwood -- Mirrors a lot of my own feelings about being a geek dad.

  • Google+ Style Buttons -- A great and thorough set of Google+-like buttons and styles to match, if you're into the Google+ look.

  • High Performance PHP Session Storage at Scale -- Great post about using PHP sessions from a memcache layer rather than from disk, because disk doesn't scale well.

  • PHP Advent 2011 -- The PHP Advent site is live for 2011, lots of great reads already up, too many to link to them individually.

That's all for now. Hopefully I'll return to my previous blogging schedule after the weekend.

October 14th, 2011

Lights

This WebGL music video is amazing. Great song by a great artist as well. I can't believe we've come so far in so little time.

October 10th, 2011

Show git branches that haven't been merged

Quick tip on how to show your git branches that haven't been merged yet.

git branch --no-merged

Very useful when trying to clean-up after a long week of developing many features in tandem.

October 7th, 2011

Now on GitHub: gmail-biggestfiles

I generally tend to write short scripts for a one time task. Gmail-biggestfiles was born in that same vein. Then the other day, a colleague was commenting on how he wanted to find the biggest files in his GMail account and remove them, since he was running out of space.

Thus, I put this up on GitHub. He said it was "too slow", and so I refactored it to use imap_sort rather than imap_fetch_overview. This is why sharing code via GitHub is profoundly useful in my eyes, quick feedback and interations.

Hopefully someone finds it useful as well. It still can be a bit slow on large mail boxes, but it's offloading all of the sorting to the IMAP (Google) server now.

You can find the code on GitHub, feel free to fork it and make it faster if you feel the need.

Note: it's required that you have imap extensions installed alongside PHP, and IMAP access turned on in your GMail account

October 6th, 2011

Edit a MySQL command from the $EDITOR

When using MySQL from the command line, you can get into a pretty long SQL statement, and then realize you wanted to change something. For example, a LEFT JOIN to an INNER JOIN. Well, MySQL has a handy little function for making it easier to edit a long command. Much like the Unix command 'fc', which I've written about before, you can use your defined $EDITOR environment variable to be edit your previous SQL statement. At the MySQL command line:

mysql> \e

This will pop open your defined $EDITOR and allow you to edit the command. After editing, save and quit (:wq for you vim users), and just type a semi-colon (;) and hit enter. It will run whatever command you've written into your editor. Voila!

October 5th, 2011

mysqldump and gzip one-liner

I frequently download mysql backups from our production environment (at off hours of course) to do testing with actual data. As a force of habit, I've always just mysqldump'ed the data and then gzip'ed as two separate commands.

Here's a one liner that I've started using instead.

mysqldump <mysql_options> | gzip -9 > file.sql.gz

Note: the -9 in the gzip command is the compression level, 9 being the maximum compression

October 4th, 2011

How To: Revert a merge (by resetting to what is on a remote repo)

I generally do (as a force of habit) my integration testing on my master branch. I'll typically look at the change on GitHub and if I see something amiss, I'll denote it and move on. Every once in a while, I can't tell just by looking at the code, or have a suspicion that something will break but want to make sure.

In these cases, I generally am at a stopping point. (E.g. I have all my code checked in and pushed). In order to reset my local copy back to what's on the origin server, I do the follwing:

git reset --hard origin/master

Origin being the remote that I want to pull from and master being the branch.

October 2nd, 2011

Code Your Own Multi-User Private Git Server in 5 Minutes

I was actually thinking about something very similar to this when it popped up on HackerNews. I may port the gitserve to python before I use it, and if so, will gist the code.

September 30th, 2011

Stripe

Full stack-payments. Saw it on HackerNews. Looks pretty easy to integrate, now I just need a project that needs it.

April 16th, 2011

Masters of Doom

I've been reading Masters of Doom, which is a very inspiring book for a developer such as myself to read. I came across this quote attributed to John Carmack, founder at id Software and one of the subjects of the book, and it really resonated with me.

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.

March 22nd, 2011

I’m also addicted to analytics...

I read this (lengthly) post on RailsTips.org and it got me thinking. I am also pretty obsessed with numbers, whether it be benchmarks or web traffic.

I've spent the majority of the day (when not coding) looking at Mozilla's Glow visualization (Firefox 4 downloads), and reading about how it works.

Are you an analytics junky as well?

March 3rd, 2011

Useful Unix Commands: fc

Slowly becoming my favorite, my Useful Unix Command of the moment is: fc

fc allows you to open the last run command in an editor. By default, it will open with the editor set up in $EDITOR (vim for me).

If you have ever had to type a really long command out, and missed something, or wanted to run it for several more files, fc is very useful as it opens in Vim ($EDITOR) and then, upon closing, will run the command again.

This command works on most Linux systems, Unix systems and on Mac OS X. Give it a try.

Februrary 28th, 2011

(Mac)Vim Tip: Configure MacVim to start without the Top Toolbar Expanded

I figured I'd share this one:

To remove the MacVim top toolbar, set this in your .vimrc file:

set guioptions-=T

And never have to close that toolbar again.

February 27th, 2011

Just watched: Exit Through the Gift Shop

My wife and I just watched Exit Through the Gift Shop, a hilarious documentary by Banksy, which to my surprise was not as much about Banksy as I would've thought.

If you are in the mood for a documentary, you can not go wrong with this film. Go. Watch it.

P.S. It's available on Netflix Instant Streaming as well.

June 6th, 2011

Git submodules are awesome

Recently, I've switched all of my personal repositories over to Git from Subversion. When working on personal projects in subversion, I've always included some base functionality (my own boilerplate, if you will). These include my Zend Framework Authentication wrapper and controller and Smarty template wrapper, as well as some simple configuration files that these modules rely on. I've always used svn externals for these but I have to say that the git submodule system is making me smile.

For my own future reference, he is how to use them:

Adding a submodule:

git submodule add user@host:~/path/to/git/repo.git path/to/check/out
git submodule init

This will add and then initialize the repository under your current project. If the path doesn't exist, it will create it.

Updating a submodule:

The following will update the submodules under your current project.

git submodule update

If necessary, you can also go into the directory and perform the usual git tasks, since it is its own repository.

Have fun with git submodules!

September 19th, 2011

Why I Go Home: A Developer Dad's Manifesto

I echo Adam's message in this post. I too have been guilty of working long hours much to the chagrin of my family and his story stands as a reminder to me that I can always get another job..

September 18th, 2011

Mac OS X: Change your hostname

Here are two ways to change your hostname in Mac OS X.

The first, open a new terminal and type this:

sudo hostname <new hostname>

Note: You will be asked for your password, because you are performing this command as root

The second, go to System Preferences -> Sharing -> Computer Name.

The first option will be more immediate.

 

I like to create stuff here.

You can find me at these places:

GitHub
Twitter
Flickr
Gimme Bar
Last.fm

Subscribe