Upgrading from Zend 1.12.7 to Zend 1.12.9

Zend released 1.12.9 a bit ago.  At work I started looking into how to upgrade to the recent framework to keep as current as possible but still ran into some pitfalls when trying to follow the documentation for upgrading.

Zend Framework 1.12.8+ introduces some backwards compatibility issues and it isn’t documented too well (don’t even get me started on introducing BC in a minor version).  I was able to upgrade LPi’s product by making some minor changes.  Zend mentions:

 

#418 can introduce potential BC breaks in the presence of complex SQL statements (for instance using SQL sub-functions). To fix this, use Zend_Db_Expr in group(), order(), or from() method calls.

 

That is a little confusing for me without examples.

Continue reading “Upgrading from Zend 1.12.7 to Zend 1.12.9″

How to profile and debug PHP with XDebug

RSS bugWhile working help desk tickets with LPi, there was a show stopper that came across one of our products.  PHP was causing our flagship product to crash the server! As I started flowcharting out the issue it was becoming clear that I would need to profile with Xdebug to properly debug the issue in our application.  Our flagship product is a multi-tenant application responsible for serving half a million visitors a month.  At the time of writing this, it all runs on a single instance.  This was my first time using Xdebug’s profiler to do serious debugging work.  Read on and I’ll tell you how I did it and the lessons I learned.

Continue reading “How to profile and debug PHP with XDebug”

Making Home Made Pasta with Charlotte

Learning by doing

The Smiths love pasta.  I think it goes back to growing up in a family of nine and having several pounds of it made for dinner to feed the hungry clan.  Pasta somehow changed my DNA and now Charlotte possesses that gluten loving, carb-fueled, Italian gene.  Now our family of four can demolish a full pound of pasta in one sitting, and Henry doesn’t eat pasta yet.  We have not reached the four pounds that Grandma Zignego makes but I wouldn’t mind if we did.  I love making pasta and enjoy that my daughter can learn how to make pasta by doing it with me.

Continue reading “Making Home Made Pasta with Charlotte”

Refactoring legacy PHP code

Spaghetti Code - John Trainer Flicker
‘Spaghetti Code’ cc John Trainor – flickr

Spaghetti code is frightening, but it is something that we all have hanging out there on the Internet that our 14 year old self would be amazed by.  Spaghetti code is technically known as legacy code.  I struggled with refactoring a larger application I did into a MVC architecture.  It was about half of a million lines of PHP code.  Refactoring it was an uphill battle and was well worth it.  Wanting to call it quits was tempting and now I can share with you pitfalls and strategies to use when evaluating your next project.  I’ll go through the steps and thought process I had when it came to refactoring my PHP application.

Continue reading “Refactoring legacy PHP code”

REST route with Zend Framework 1

Rest Route with Zend Framework 1At LPi I was in charge of programming a REST server that would communicate with our internal data source.  I was under the requirement of using Zend Framework 1 as the REST server – which isn’t ideal but it is workable!  Building a rest route with Zend should be easy – but again… this is utilizing Zend Framework 1.  This post details out to utilize a rest route in Zend 1.

The original thinking for the routing was to pass it to Zend\Controller\Router\Regex.  Now I must admit, it seemed elegant at first… the fallacy in using regex becomes clear as the project begins to grow with more and more routes.

The API can adapt quickly and should have an elegant way to use RESTful resources.  Introducing a simple Rest Route modification.  It quickly checks the method before loading the rest of the application in.

Continue reading “REST route with Zend Framework 1″

Baby sign language for Henry

Today, Henry is a little over eight months and signed his first word clearly.  “Milk” is now signed clearly!  A child grows at an extraordinary rate within their first year and language is one of those growth areas.

Henry signs milkYouTube of Henry signing

Kym and I started signing with our first, Charlotte.  Charlotte took to signing two months earlier than Henry and still signs at the age of three.  As with most things in life when your child finally grasps a concept you have been showing them.  You have to expose that “A-hah!” moment and take advantage as much as possible.  We are now teaching Henry Mom, Dad, Eat, Diaper and other basic baby signs.

Continue reading “Baby sign language for Henry”

PHP ecommerce integration for The Elegant Farmer

PHP ecommerce integration and The Elegant Farmer’s Apple Pie Baked in a Paper Bag.  A match made in heaven allowed this brick and mortar store to expand its ecommerce operations.  Their crisp apples, crunchy topping, and sugary crust will make your mouth water! I’m not a food editor by any means but I know good food when I taste it and was able to assist them in getting online.

The Elegant Farmer is a Wisconsin based business that primarily sells pies (really good pies).  They had the unique problem of having to ship perishable pies next day air, packed with ice, to customers so wonderful pies would not be ruined by mother nature.  The farmer’s paired up with a fulfilment center and me to connect the two systems and make them “talk” – if you will.

The original ecommerce system was Squirrel Cart.  I wrote a cron script that would query the MySQL database for orders and submit them to the fulfilment center in a specified format.  After the fulfilment center completed their processing they would keep a semi-colon delimited file on their FTP server to be fetched and parsed to retrieve the tracking information for the orders.

The code was written fairly modular.  When The Elegant Farmer switched the ecommerce platform to Open Cart I made a few modifications to the script to make it work.

Successes

The Elegant Farmer was able to lower their pricing by half and made their tens of orders rise to hundreds of orders.  The Elegant Farmer’s success allowed them to invest more time into increasing their products listed online.

Challenges

With any PHP ecommerce integration there are some challenges.  The challenge in this instance came down to getting the proper file formatting to the fulfilment center.  I encountered other challenges when I was trying to migrate to a different ecommerce solution but they were mainly data challenges.

I learned a lot about this project while doing it and will be contributing a PHP ecommerce plugin for several different commerce systems in the near future.  This plugin is aimed at connecting stores to other fulfilment centers.

Gardening and Coffee Grounds

This year, you were helping Mom and Dad plant the vegetable garden.  While we were planting, Dad added some coffee grounds to work into the soil.  You picked up a chunk of coffee grounds and began to inspect it.  I said to Dad, “she’s going to eat it.”  He said, “No, she won’t.”  You, of course, proceed to put it into your mouth.  Dad runs over and takes it out of your mouth.  We both tell you “Yucky” and you respond back “Yummy.”  Not only did you eat used ground coffee off the ground, but you liked it.  Gross :)

Terrific Twos and a New Baby

Charlotte, sorry that Daddy and I haven’t written you a note in a while.  Sometimes as parents you forget to do things because life gets very busy and you forget the little things.  You are two now and at times both terrific and terrible.  You are very independent and like to do things all by yourself.  You enjoy going down the “big slide” and “little slide” at the park down the street.  You enjoy going for walks and playing outside.  Sometimes you run away from mommy and give me a heart attack.  We try to explain to you that you are supposed to stay in the yard and not in the street.  Sometimes you don’t listen.

I am expecting your little brother or sister on June 19th (daddy’s birthday).  You think most of the time that I am having a boy, but you also think that you’re a boy most of the time and that mommy is a boy.  You are excited about mommy having a baby, but I think that you don’t understand some of the time still.  You know that mommy is going to the hospital and that nana is going to watch you.

You are very smart.  You can count to 10 in English, Spanish, and French.  You also know your ABCs (only in English for now).  You also enjoy singing Frère Jacques and Twinkle Twinkle Little Star (you repeat “what you are what you are”).  We are trying to get you into Nature’s Classroom Montessori School and find out tomorrow if you get in or not.  That will mean you will have to be potty trained by August when the program starts.  You are very stubborn with that too.  You like sitting on the potty when mommy shows you a “video” little movie on my Iphone where you can watch yourself.

I guess that’s all for now.  Hopefully daddy and I will write you a little more often.  I love you.

– Mommy

Santa is coming soon!

Charlotte,

Santa will be here any day now… probably around December 25th if I had to guess. It has been a crazy past few months with Mom and Dad looking for houses. That might be the best Christmas present for our family is that fact that we will be moving into our first house on December 28th of 2012.

You enjoyed your first Thanksgiving at Nana’s house this year and loved REAL turkey! No canned turkey for you! Just look at your face when you saw turkey! :D

701998_10151556218884899_1649913212_o

You and I play a lot more now. Just last night you were chasing me around and laughing hysterically when I hid and popped out to scare you. Mom might have some video of that happening. 10 months is a good age. You should stay this old. Okay?

I hope you know that everyone loves you.

Never be afraid to ask questions and keep your smile :).

Love, Dad