Saturday, December 1, 2012

Root Cause Analysis: cheap plastic bit

We recently started having trouble with our 10 yr old fridge, it wasn't keeping the fridge side at the right temp. The repair man said $300+ to repair it. That led us to toying with getting a nice shiny new fridge. We looked and looked and looked, and couldn't quite line up the exact features we wanted.

So.... Suzy ordered a replacement part from Amazon ($50), and spent a chunk of this morning replacing the busted air diffuser.

Afterwards, the engineer in me had to dissect the broken part, and it looks like a tiny cheap flimsy scrap of plastic .




That cheap scrap of plastic in the middle of the photo was almost my justification for spending $2k on a nice new shiny fridge.



Monday, February 13, 2012

Etiquette for Social Media

Later this week I'm participating in a panel discussion at IBM on social media, and using it for business. Since I might not (read: might forget) to bring it up, I wanted to make a list of some of the guidelines I try to follow. Note that I said guidelines, and not rules.


  1. I try to avoid spamming people with tweets or facebook updates.  I try to recognize that what color shirt I decided to wear today probably isn't something my friends and followers are all that interested in. hint to parents: play-by-play at your kids softball game falls into this category.
  2. I don't tweet anything I wouldn't want my mother to see.  
  3. When tempted to post something rude or crass, I try to imagine what a prospective employer might think of it. I've heard of interviewers actually putting interviewee's on the spot with "log into FB, and show me your profile page".  
  4. I do not share that I am on flight 123 leaving Austin. I do not checkin or typically share the geolocation of my tweets or blog entries..  Please see http://pleaserobme.com/why for more details.  
  5.  When I do need to bend the no-geo rule, I use facebook.  It's less open ended than having anyone be able to see your tweets.  For instance, last summer when we were caught in the middle of hurricane Irene in Vermont, I used FB to let folks know I was ok.
  6. Check FB privacy rules regularly. Zuckerboy is tricky
  7. I try to tweet once a day. It ends up being a lot less than that. 
  8. I try to blog once a month (also ends up being less).  Of course blogs follow the don't blog what you wouldn't want Mom to see rule.
  9. Every so often, I try to do tweets/status updates that my non geek friends will comprehend.  I've actually had multiple friends in facebook complain about how geeky my updates are. 

A friend linked to this in facebook recently, I especially like G+.


Tuesday, January 10, 2012

IBM_DB2 PHP extension on Mac with MAMP


I recently worked through all the pain and suffering to get the ibm_db2 php extension working on MAMP on my Mac running Snow Leopard. It wasn't easy, and if you are struggling through the same thing, I wrote this post for you. My next step now that I have the php extension working is to see if it will work with Symfony2, since IBM DB2 support was added to the base of Doctrine2.

The only DB2 for Mac is the beta for 9.5. I didn't want the full blown db2 installed on my OSX machine, I only wanted the headers and libraries required to build the php extension. There was a separate 'Remote Tools' download that contained client type db2 stuff, including headers and libs. It's on the same download page as the full package after you log in with your free IBM id.

After installing (as non root user) in a path without spaces, I tried the straightforward pecl install. Note the path info, otherwise it will try to build the extension for the php that ships with OSX (/usr/bin/php) instead of the one in the MAMP install directory:



The next issue was caused by a crufty pear.conf:


So removing pear.conf fixed it.


The next issue was that the MAMP default install no longer includes the php source, so it complained about not finding php.h when I did the pecl install. I resolved this by downloading the MAMP source code and grabbing the php 5.3.6 source bundle. Since it was complaining about not finding /Applications/MAMP/bin/php/php5.3.6/include/php/main/php.h , I made an include directory under php5.3.6, and untared the php source there, and renamed the directory to match what pecl was seeking.

The extension then built, and was in the right spot, and I added  "extension=ibm_db2.so" to the MAMP php.ini (make sure you find the right php.ini).

I then coded up a test php file to try the db2_connect command. No love yet, the ibm_db2 extension wasn't even loading properly. This error popped up in my MAMP php error log:


That last line and a fair amount of googling indicated that it was probably a 32 vs 64 bit thing. I confirmed it by using 'file' on both php executable, and on the ibm_db2 library i had just built:



So I needed to rebuild the ibm_db2 extension for 32 bit by hand, since pecl was doing 64 bit. In retrospec, maybe the fact that my sqllib/lib is actually a symbolic link to lib64 is why this happened, and maybe there was some way to make pecl do it's thing 32 bit. But I didn't realize this til later, so I rebuilt by hand.

I created a new directory for the pecl extension (location of dir not important), and downloaded the pecl extension, set some compiler flags, and did the build. Note the specification of the --with-IBM_DB2 pointing to my DB2 client directory install:


At this point the ibm_db2 extension loaded (yay!). I now wanted to try my simple test of connecting again. When I tried, the browser gave me a 404. Nothing in the http log or php error log. But I found this in /var/syslog/system.log:


Opening that showed that it could not resolve  _SQLAllocHandle. At this point I realized that  my sqllib/lib is actually a symbolic link to lib64. I noticed that even with all my fancy stuff in the compile flag step above, the Makefile still was pointing to sqllib/lib64 (verified the so was mucked up by doing: otool -L ibm_db2.so ). At this point I coulld have changed the symbolic link, but instead I changed one line in the Makefile, and repeated the make steps.
In Makefile, I changed this line to be lib32 in both spots:


One other change I made, that I wasn't sure was needed was putting this in my php.ini. Since MAMP wasn't sourcing the db2profile in /Users/suzyq/sqllib, I added this:


That got me to a ibm_db2 php extension that loaded, and eventually I got the right incantation of db2_connect(), and connected. Whew!


The simple connect.php test....