Skip to content

Thank You for Small Acts of Kindness

Dear Reader,

Five or six years ago, my good friend – and the Don of the PHP Community- Mr. Michelangelo van Dam – was listening to me ramble  at a conference.  I was rambling on about the fact that every time I go over to Europe, I have to lug around my crappy power converter, and sometimes the converter won’t fit on the power strips provided at conferences at the podiums. I’ve actually had to present on batter and hope that the battery lasts. (it always did)

A while later, I ran into Mike in the hall and he handed me a cord. It was the cord to an Apple power adapter but with the European end on it. He told me that he had several spares and asked me to take this one. I smiled and took it and thanked him for his kindness. When I got home, I put it gently int my “cable box” (any audio geek or programmer knows what that is) and honestly, I forgot about it…that is until last week.

I am working  with a company that is Mac-centric so while my primary machine is now Windows, I am carrying my Mac with me so I can get work done. The problem is that I still have that 1 crappy power converter. While packing, I remembered Mike’s gift. I dug through my cable box and there it was just waiting for me to remember it and use it. I’m happy to say that as I sit here and type this on my Windows machine, my Mac is quietly humming away building a docker container or some such nonsense. Both machines are powered. :)

I know that any Mac user usually has 2 or more of these cables laying around from old power supplies that have crapped out but the cord is still good, so I know that it didn’t cost him much to give it to me; but that’s not the point. He saw a need, and he quietly did what he could to fill it. It doesn’t matter that I didn’t use the cable until years later, what matters is that he made the effort to solve my problem…and it eventually did.

Open source developers are like this. They give of their time to build things, things that you may not need right now. When you do need them, they are there and ready for you. Their acts of kindness – small or large – come into play exactly when you need them.

The next time you install a new open source package because it’s exactly what you need to build the project you are working on…take a moment to drop the author an email and thank them. Thank them for their act of kindness. You’d be surprised at home many of them never hear from users and are appreciative of your small act of kindness.

Until next time,
I <3 |<
=C=

 

p.s. Thanks Mike for the power cord…it is EXACTLY what I needed. :)

Accessing Twitter via Zend_Service_Twitter

Dear Reader,

Ok, I know there are a lot of OAuth haters out there and maybe it is not the easiest protocol to work with but really, I was able to get connected and running in about 15 minutes. (and that included 5 minutes of Google time)

The Project

I am playing around with Klout’s API and wanted to pull in some info from twitter to augment the Klout info I was seeing. Klout is easy – as just about every Mashery API I’ve worked with has been – you just register for a key and they make your calls. Twitter however, requires OAuth. I knew the Zend_Service_Twitter had recently undergone a revamp to support OAuth but there was one small problem. The script I am playing with is all backend. There is no front end at all. It just collects info and stores it in a database so I can query it later. (I’m an old-school database guy and love just writing ad-hoc queries to see what I can see) Twitter wants to redirect you to a site once you have authorized access. Since I don’t actually have a site to redirect it to, this was a problem.

The Solution – in two parts.

Ok, second things first, this script is straight procedural code at the moment. It isn’t even good enough to qualify as prototype code, more proof-of-concept. There’s no way in heck I’m sharing it with anyone so don’t even ask. I know, however that if things progress as I expect them to, the script will end up as a Zend Framework application. For that reason I wanted to use Zend_Service_Twitter. A quick Google showed me that my good friend and Zend Framework community member Michelangelo van Dam had a tutorial already written on this very subject titled Single User Zend_Service_Twitter. Part 2 is solved because everything I need to know is in that tutorial. So I move on to the first problem, how to get a valid OAuth token and secret. It turns out, that wasn’t hard at all either, it just required a little imagination.

Jaisen Mathai wrote up a blog post titled Twitter, PHP and OAuth a little while back explaining OAuth. In it he links to a quick piece of sample code that he put together to showcase his Twitter API wrapper. The wrapper itself is good and if I had not already decided to go with Zend Framework, I would have used it. The sample code however, allowed me to authenticate with twitter and then store the token and secret, the two things you must have to make this work. So I took his sample code, put it on my development server, followed his instructions to the letter and voilà, I had my token and and token secret.

I then went back to Dragonbe’s blog post, grabbed his code, modified it slightly so that I didn’t have to use Zend_Config and it worked too!

Conclusion

If you want to get started with Twitter’s OAuth, the two tutorials I’ve linked to are great jumping off points. Enjoy!

Until next time,
I <3 |<
=C=

Photo Credit:erikeldridge