Using Silex to Refactor a Legacy PHP Application

We have a legacy application here where I work, MRS.  In my last post I talked about putting in place a front controller as the next logical step.  I started to take a different, more thoughtful, approach after discussing with my co-workers.  I used Silex.

Continue reading “Using Silex to Refactor a Legacy PHP Application”

For the Love of Pasta

We returned home from a long summer trip recently and it was a learning experience for all.  Kym and I discovered a new fondness for flying compared to driving.  Charlotte was able to build a hotel in the sand by the beach.  Her beachfront property experienced several tidal disasters before she gave up on the endeavor coined “Hotel Charlotte”.  Henry discovered a new love for pasta made by Uncle Joe.  By discover I mean devour.

Continue reading “For the Love of Pasta”

Launch your idea early

Earlier last week I launched TrailStatus.io.  I have big plans for the website.  My thoughts are to grow it to help trail curators manage news for the trails in a central location.  I have been wanting to launch TrailStatus for about two or three months now but I didn’t.

I didn’t for the same reason that customer projects or work projects linger on, scope creep.  How do can you overcome scope creep? Here are a few tips to help you launch the app early.

Stick to the essentials

Stop worrying about what your app is going to be.  It is currently a fleeting thought in your brain, get coding on the essentials that you need to make it run.  In TrailStatus’s case, this was downloading and parsing out the John Muir trail information.

Focus on what you can do within a short period of time.  Short meaning one week or less.

Get feedback often

I originally had grand plans before even starting to code TrailStatus.  I asked for feedback on the Mt. Biking subreddit and received a lot of good feedback that helped me see more future feature implementations.  If I didn’t ask for feedback I could have very well implemented a feature not needed or not used.

Write, refine, reuse your code

Don’t focus on writing the perfect code the first go.  Write the code so it is clean and concise.  After the initial release you can focus on refining your code while keeping in mind the DRY principle.  I was trying to think too far out of scope with TrailStatus.  I know that I will need to have services in the future pulling down trail information, but do I need to program it now? No.

The parting words here have been echoed before: release early, release often.

Paper Programmers

I recently took a couple weeks vacation without access to cell service or the Internet.  It was a good experience and something that I had no hesitation doing.  My job depends on having an Internet connection but not my thoughts!

I wanted to share with something Aaron Saray taught me.  When you need to solve a complex problem start flowcharting or writing it down.  The solution eventually bubbled up before me as Aaron promised.

The only down fall to paper programming is no syntax checking or dependency injection in this iteration. 😛

 

View Your Beanstalk Queue in Three Simple Steps

Recently I had to see why some of the workers were not doing there jobs.  It was hard to see the entirety of the situation without understanding what messages were being sent to the workers.

Thanks to a PHP beanstalk_console by ptrofimov I was able to take a peek at our queues and determine where the hang up was.

How to View Your Beanstalk Queue Locally

  1. composer create-project ptrofimov/beanstalk_console -s dev ~/Sites/
  2. cd ~/Sites/beanstalk_console/public
  3. php -S localhost:8000

That’s it! I forgot to mention the requirements of php, composer, and command line tasks but I figure if you’re here you can garner that from this post.

Once you navigate to http://localhost:8000 you can then input the IP address of the beanstalk server you want to see and troubleshoot away.

Have any quick tips you’d like to share? What other php applications do you run locally to assist you in troubleshooting?

Camping with Charlotte and Henry

Charlotte biking by Crystal Lake in Rhinelander, WI
Charlotte biking by Crystal Lake in Rhinelander, WI

Charlotte loved camping in Rhinelander.  Henry enjoyed his time eating nature.  He eventually learned that nature belongs on the ground – not in his mouth.  Only a few leaves and rocks made their happy journey to the digestive system.  An unforgettable experience for the leaves, rocks, and Henry.  An unforgettable experience for all of us.  It is amazing how nature and being away from home tends to do that.

Continue reading “Camping with Charlotte and Henry”

Vagrant/Ansible causing ‘Too many authentication failures’

You might run into an SSH error that seems vague.  Here is the error

SSH Error: Received disconnect from 192.168.56.120: 2: Too many authentication failures for vagrant while connecting to 192.168.56.120:22

Your error will vary on port and IP address but it is all the same.  Here is how you fix it.

Create a file called `ansible.cfg` in the same directory as your Vagrantfile. Add the following to the ansible.cfg file:

[ssh_connection]
ssh_args = -o IdentitiesOnly=yes

That is it.  Now when you run `vagrant provision` you will see that Ansible has the correct settings to connect to the VM and provision the box.  You won’t need to do this when Vagrant 1.7.3 is released because they addressed this issue in the code.

Update 5/28/2015:

I found that making this small change allows host keys to also be checked.  Definitely a RTFM moment.  Still waiting for the 1.7.3 release to assist with too many identities.

ansible.host_key_checking = true

Hiking with Sir Henry

Henry explored John Muir in the Southern Kettle Moraine recently.  Don’t worry, we didn’t just let him crawl around out there.  He doesn’t have the same fear of grass that Charlotte did at that age.  He really enjoyed being hauled around on Kym’s back through the trails.  I also noticed that he signs when he is hitch-hiking a ride.  Typically he is signing milk, sometimes I wish I could read his mind.  Although if I read his mind he would probably just be saying: “I want milk, I want milk, I want milk…”, so maybe there is nothing of interest at this point.

We purchased an Osprey Poco Plus and have been testing it out for our planned camping trip through Canada, Maine, Connecticut, and Maryland.  The child carrier makes it easier to get out and exercise with the kids while distributing the weight well.  Charlotte is able to fit in it as well, but we will reserve that for when her legs don’t want to hike anymore.  She is happy to run along the trail and explore as much as possible.  Most of the time hopping on rocks and touching trees.

Mother Nature has this magnificent way to keep children fascinated, active, and immediately put them to sleep when they get back in the car.  I am somewhat envious of the controlled-narcoleptic hypnotism that she can cast on children at will.  The best way for Henry or Charlotte to nap or sleep is to take a walk or hike outside shortly before nap time or bed time and then it is lights out.  Unfortunately, all too often mother nature’s spell works on children at heart as well.

 

How to refactor a house of cards

Shuffling Cards - WikiMedia CommonsI was recently brought on board to assist in refactoring a legacy PHP application.  I have to be honest, seeing this code base made me want to start from a clean slate.  I’ve refactored a lot of applications over the years and have never blown any of them to bits.  This one was tempting me to do that.  It is truly a house of cards.

Unfortunately, this particular code base started violating object oriented principles before the universe knew what objects were.  It is bad.  If you are in a similar situation you are wondering the same thing as I am: what do I do first without breaking this?

Continue reading “How to refactor a house of cards”

Charlotte’s progress at Nature’s Classroom Montessori School

Charlotte lining up the seats and her brother
Charlotte lining up the seats and her brother

Kym and I recently attended Charlotte’s parent/teacher conference at Nature’s Classroom Montessori School.  Charlotte is doing well in school and we couldn’t be happier.  She is struggling with attention and has a unique way of learning something new.  When I observed her I noted down that she seemed to glance at another child and “seemed lost”.

Continue reading “Charlotte’s progress at Nature’s Classroom Montessori School”