I’m getting in on this “Seven Things” deal by way of being “tagged” by Ben Ramsey. And yes, Ben, while I am technically your “boss,” we’re all still on vacation, so…that doesn’t count now. Or something. Cut it out.
So, here are my seven things, which have been rolling around my head all day. Here we go:
- I’m a triplet. My other two brothers, Brad and Brent, live in Baltimore and Kansas City respectively. We were born one-minute apart. Brad is also in the IT industry working for the government, while Brent is working for my Dad at Midwest Towers in estimating, sales, repairs, etc. for cooling towers.
- I started coding in BASIC on an Apple IIe around 4th or 5th grade. I later expanded into GWBASIC on DOS, and took Pascal and other programming classes in high school. Around age 14, I released various shareware applications written (and compiled!) in QuickBASIC under the name Untitled Software. I received a handful of registrations for my “most popular” product, “Master Menu III,” which was a DOS-based application launcher (complete with VGA mode screensavers!). My most distant registration was from the Netherlands, so I just gave him a free license in order to not deal with currency exchange stuff.
- While working at Best Buy from Summer 1997 to December 1998, I had the opportunity to wear the Idea Box costume during a holiday season. You can’t see them, but I’m wearing blue and yellow elf shoe covers over my shoes. I also couldn’t talk, would just have to wave and shake hands with people. My friends would come in the store, so I’d see them outside the mesh on the “B” in “Best” and break the no-talking rule. Occasionally I’d roam around the store being goofy, while trying to not knock things over. It was a great time! Normally, I worked in the Media Department, which sold music, movies, and software. Loved that job!
- I moved from the suburbs of Kansas City, MO to New York City at the ripe old age of 19. I was offered a job with VitalAging (now BenefitsCheckUp.org) as a Systems Administrator. I had nothing to lose, so…why not? Then I stayed there seven years before moving to Atlanta. Brooklyn, represent!
- After moving to the NYC area, I continued and completed my undergraduate education at Baruch College, CUNY by going to school in the mornings and evenings, while still working full-time. It was tough, but worth it. I got my degree in Computer Information Systems (more business-, accounting-, and management-focused), which has turned out to be very practical. I wish I had algorithms, compilers, and all of those other low-level Computer Science courses, but the practical things have served me very well.
- I met my wife, found my job at Schematic, and my last Brooklyn apartment on Craigslist (NYC).
- I have a long family history of being a huge fan of Hooters (the restaurant). I’ve been going there since I was pretty young. Whenever we’d travel as a family, we’d stop at locations during our trip. My Dad actually collects the menus for all of the ones be visits — he must have 50 to 60 at this point. I once drove from Boston to NYC via Rhode Island just to be the first DeShong to visit a location in that state. And yes, I took a menu and mailed it to my Dad. I go for the food, though — I’ll even get takeout (when my wife refuses to go), which proves my devotion to the food.
And here are my lucky seven!
- Robert Swarthout because I want to see if he’ll actually step up and write this blog post…and because he’s a co-worker of mine and a fellow Atlantan
- Graham Christensen, one of the youngest dudes in PHP, for having just visited Georgia, the state I now call home
- Shawn Stratton for being another fellow Atlantan, and for that time we randomly bumped into each other at the Envelope Building downtown
- Brian Moon for being my PHP Appalachia 2008 “Team Haystacks” teammate, and a fellow southerner
- Jason Sweat for attending my talk(s) at php|tek 2008, and having some awesome feedback. And for having an awesome last name?
- Lars Strojny for proving some comments and feedback on my Zend_Log_Writer_Mail proposal
- Nate Abele for being the CakePHP and OmniTI dude, and for that time a handful of us went drinking and to the Comedy Cellar in NYC
And, of course, the rules:
- Link your original tagger(s), and list these rules on your blog.
- Share seven facts about yourself in the post - some random, some weird.
- Tag seven people at the end of your post by leaving their names and the links to their blogs.
- Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
I have a case where I’m retrieving an array of associative arrays from a database as shown below:
Array
(
[0] => Array
(
[id] => 1
[some_id] => 100001
[some_company_name] => Foo
[name] => Bar
[created] => 2008-12-25 21:13:58
[last_updated] => 2008-12-30 23:32:43
)
)
…but I need to represent this structure in XML. I have a pre-defined standard in my XML request/response that the element names are to be camel cased.
Aliasing the field names at the query level is just…a hack. So, I needed a way to convert “foo_bar_baz” to “fooBarBaz” before adding the XML element.
To do this, you can use preg_replace_callback() as shown below, which uses a callback function on every match found.
class FooController
{
public function barAction()
{
$dao = new Some_Dao();
$rows = $dao->getWhateverRows();
foreach ($rows as $row) {
foreach ($row as $key => $value) {
// $key is "foo_bar_baz"
$key = preg_replace_callback(
'/_(\w)/',
array($this, '_convertToCamelCase'),
$key);
// $key is now "fooBarBaz"
}
}
}
private function _convertToCamelCase(array $matches)
{
return ucfirst($matches[1]);
}
}
There is an e modifier that can be used with preg_replace(), but that requires the replacement string to be a valid string of PHP code. This forces the interpreter to parse the replacement string into PHP on each iteration, which can be quite inefficient. Instead, the preg_replace_callback() uses a callback function, which only needs to be parsed once.
I suppose you could easily do the reverse, though I haven’t had a need to write that code yet.
But…there you go! A little end-of-year tip from myself and the preg_replace() examples.
As a follow-up to my recent post, my Zend_Log_Writer_Mail proposal has been accepted as-is into the Zend Framework Standard Incubator!
Thanks to Matthew Weier O’Phinney, my Zend Liasion, and everyone else that commented on it, reviewed it, and weighed in during the review process.
Truth be told, it’s a really simple, silly component, but based on some feedback received, a handful of people should find it useful.
I’ve now got to write some unit tests and documentation, but I’m hoping to get it into the repository by January 4th or so. I’ve got a bit more work to do, but…hooray!
Reflecting on my 2008 New Year’s resolutions, I didn’t accomplish all of them. The only one I really even began to tackle was contributing to Zend Framework.
I participated in PHP TestFest, and my tests ended up making their way into CVS, so that was a nice surprise. I did manage to speak at both php|tek 2008 and ZendCon 2008, so that was good…though not really a resolution of mine.
Regardless, it’s been a good year for accomplishing some of my technical- and PHP-related goals. But what about 2009?
Well, since it’s public knowledge now, my wife and I are expecting our first child in June 2009 (woohoo!), so I’m going to be taking a bit of time off of the conference circuit. I specifically didn’t propose anything for php|tek 2009, because it’s due to take place just a few weeks before the kid’s due date, so I don’t want to be away from home at such an important time. Maybe I’ll supplement that with more talks at Atlanta PHP?
So, since I’ll be stepping back from conferences a bit, what will I be focusing on? Here are some of my PHP/technical resolutions for 2009:
- Continue contributing to Zend Framework: With my first proposal now in the state of “Pending Recommendation,” I’d like to start drafting a proposal for a Zend_Cache_Profiler of sorts, ala Zend_Db_Profiler. I’ll be looking to write up and submit that proposal within Q1 2009, I think.
- Contribute to php|architect: The 2009 Editorial Calendar for php|architect has been released. There are at least two topics in there that I’d love to write on. Specifically, I want to attempt to adapt my “Rickroll To Go With PHP, WURFL, and Other Open Source Tools” presentation into an article format. That should prove to be an interesting, entertaining challenge.
- Catch up on my list of technical books I want to read: My Amazon Wish List is filled with all kinds of books that I want to read, so I’m really hoping to get through a handful of them this year.
- Finish my iPhone game: It’s a super top secret idea, of course, but the gameplay is largely done and works well. I’ve got to work on scoring, how leveling works, preferences, and finally, graphic design. So…I’ve got a long way to go on that. It’s been a great exercise in learning UIKit/Objective-C!
- Write an OS X Memcached GUI monitoring/profiling client?: I’ve wanted to build a little OS X desktop app for monitoring the performance of Memcached servers for a while now — think cool graphs of gets, puts, evictions, bytes used, etc. Something that, if you managed a pool of many Memcached servers, that it’d come in really handy at giving you a snapshot of performance and potential areas of improvement. This would be another great exercise at learning more about Cocoa/Objective-C, too. Desktop software development just feels a bit more legitimate sometimes, ya’ know? Or maybe that’s just me.
So, I think that’s it for now. We’ll see how I do this year.
Happy holidays to everyone! See you in 2009.
After much input from many of my colleagues, I have decided to move all of my DeShong.net sites and services to Slicehost.
I’ve been with DreamHost for almost three years now, but decided it was time for a change. Among the factors in this are:
- I want to move my email hosting to Gmail for Domains — it seems far superior to DreamHost nowadays
- DreamHost seems to be somewhat oversold; performance on my shared hosting package is pretty poor
- DreamHost recently moved me to a new server, which is fine, but my existing PHP CGI setup broke (which I had done during the days when they were still running PHP 4 as a module, but I wanted more custom configuration control)
- I never had enough control over my LAMP setup, which has always bugged me. I wanna’ run APC, Memcached, etc.!
- I’ve hosted all of my personal photos at Flickr for quite some time now, so I no longer need an old, crufty Gallery2 installation.
So, Slicehost gives me less physical resources (on their smallest slice, which is 256 MB RAM, and 10 GB storage), but they’re dedicated resources, so the performance is better. No oversold, shared hosting boxes for me, thanks!
Also, I get root access to the virtual machine. I tend to shy away from virtual machines, but they are all the rage these days. I figure I should give it a whirl, eh?
Anyways, I’ve carefully migrated all of my DNS to Slicehost, my Subversion repository, my Wordpress blog, and my Wiki, along with some other odds and ends. I also have chosen to not take some of my friends’ domains with me over to Slicehost due to the limited storage, so…sorry, guys!
So, if you notice anything funky, let me know. Otherwise, all existing URLs should work, so things should be completely transparent for the most part. I’ll get my Gmail email cutover done next week, but my MX records will still point to DreamHost for another week or so.
Wish me luck!