Ubuntu 16.04 and PHP 7 not rendering

After reloading my work laptop with Ubuntu 16.04 LTS (I prefer to do a reload versus an upgrade, for each LTS version) I was very excited to install PHP 7, and installed using the standard Ubuntu repositories using typical commands:

$ sudo apt-get install apache2
$ sudo apt-get install php7.0

However, after doing the installs I discovered PHP scripts would not render in a browser. After a small amount of digging I realized that doing the base installs did not include one important piece. The package ‘libapache2-mod-php7.0’ was not automatically installed as expected, as it did in the past. (I don’t remember needing to install it separately in the past.) Hopefully the package maintainers fix this at some point. Your mileage may vary.

$ sudo apt-get install libapache2-mod-php7.0

So one quick install like shown previous and all is working fine.

Happy PHP’ing.

Copy and paste from virtual machines to host

With the growth of using virtual machines as development environments, thanks to great projects like Vagrant and Puphpet.com, I have been using virtual environments for most of my development these days.  On some occasions, because I use Ubuntu as my primary operating system on my development laptop, I have the need for a Windows environment in order to work with certain clients. (Sad, I know.)

Well, while using these Windows environments it is a royal pain if I cannot copy and paste back and forth between the host and virtual machine.  So I have always resorted to installing the Guest Additions (I use VirtualBox) to make this possible.  However, recently this stopped working for some reason.  I honestly didn’t have the time to investigate so just overlooked it and kept going. (I honestly don’t use a gui very often within a vm.)

Today I finally got tired of looking the other way and investigated why I couldn’t copy/paste between host and vm.

The Fix

Turns out there is a very easy solution.  I guess at some point the copy/paste functionality setting is turned off by default.  So I simply needed to click on the VirtualBox “Devices” menu drill into the “Shared Clipboard” submenu and then select the option I desired.

Now things are working as I expected.

Skype sounds audio distorted in Ubuntu

Now that I have Skype installed on Ubuntu 13.04 I discovered that the various Skype sounds were distorted.  It was almost like the sounds had some static mixed in with them.  I thought it was probably just a problem with the new version of Skype, or the new sound drivers.  However, I made a discovery that fixed the issue.

I tried the AlsaMixer fix, but it didn’t work. (A reboot simply resets the PCM to 100 again, and the sound is still crackly.)  So it all came down to a simple file edit to get it fixed.

Edit the file /etc/pulse/default.pa using the command:

sudo gedit /etc/pulse/default.pa

Add the following to the end of the line shown:

pulse audio file

So after adding “tsched=0” to the end of the line “load-module module-udev-detect” you will be all set.  After a reboot the sounds is still good.

Enjoy!  Hope it works for you.

Skype for Ubuntu 13.04 Ringtail

I am running the new version of Ubuntu 13.04 Raring Ringtail, and so far really like it.  However I’ve had a bit of trouble with Skype, because I could not get it to use the indicator area of the tray.  Other than that it seemed to work fine.

When I installed Skype I did it from the Skype website, and didn’t realize there was a package at http://archive.canonical.com/ partners already carrying it because that repository is not turned on by default for Aptitude.

The repository can be activated by either command line, or by using the Software & Updates which enable it for command line or Ubuntu Software Center, or Synaptic Package Manager.

Via terminal:

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update

Via GUI:

Open the System Settings and click on the Software & Updates icon, or using the Dash you can simply type “Software & Updates”.  Once it opens you can select the “Other Software” tab and check the first box titled Canonical Partners.

Software and Updates

Now we are able to install Skype from the Canonical Partners repository no matter what method you wish to use.

Install Methods:

From terminal

sudo apt-get install skype

Or search for it through Ubuntu Software Center or Synaptic Package Manager and install nromally.

It will install some other required packages with it, but after the install it now works as expected with the indicator and all.

Enjoy!

My experience at Code Retreat Miami 2012

This past weekend (Dec. 8th, 2013) I had the great opportunity to experience my first Code Retreat in Miami, for the Global Day of Code Retreat, here is a post about it to help inform others about this wonderful event.  If you have a chance in the future to get to one, it is a “must do”.

The Crowd

I was very surprised there was a large group of Rails developers, and it was nice to see there were a few PHP people from the South Florida PHP Users Group (SoFloPHP) because I had posted the event on the group page.  It’s comical how the Rails folks (I do not refer to them as Ruby developers, because generally they do not know Ruby.) seem to feel their framework makes it the best tool for everything, and completely disregard every other language and framework on the planet to blindly evangelize.  I say “blindly” because Rails users seem to feel the need to push the framework on me by selling wonderful features, as if no other language/framework in the world has it.  (But I digress, that is another subject for another post.)

It was nice to see all of the programming languages represented.  There was PHP, Ruby on Rails, Java, Smalltalk, C#, and even some Python.  This made for a nice mix to view other languages, and how developers of those languages operate.

Overall everyone was friendly and it made for a great day of learning and fun.

What is Code Retreat?

Code Retreat is a single day pair-programming workshop giving a chance to practice Test Driven Development (TDD) while trying to solve a pretty challenging sample application, and follow the 4 rules of simple design.  The sample application is to build Conway’s Game of Life.  I will not try to explain the Game of Life here, so if you are curious you can click the link and learn of it on your own.

For many, the sample application is not an easy one to grasp. I found that all of my pairs kept trying to pre-define the game board size at the beginning of the process, though one of the criteria of the game is to have infinite size. (Even the moderator seemed to be stuck on the concept as well, and claimed that predefining a size was OK, because it is how he did it.  I found this disturbing, but overlooked it.)

Others found that forcing ourselves to write the tests first (TDD) was the hardest part of the event, and that is what it was all about.  The event is all about learning TDD, so it was justifiable that it was the challenging part.  I, for one, was up for the challenge and forced myself to NOT WRITE A SINGLE LINE OF CODE WITHOUT A TEST WRITTEN FIRST TO COVER IT.  Because of this I had 100% code coverage the entire day.

The day is broken down into 45 minute sessions where pairs work together and get as far as they can.  Usually the first 5 minutes are spent as each member of the pair explains how they envision the logic to work out.  Following that the initial tests are built to test the game board, then code is written to satisfy the tests.  Then more tests to populate the board, then more code to satisfy tests.  Then tests to makes sure the 4 rules of the game work, then code to carry them out.  Finally, if you got this far, tests to ensure a new turn is executed, and code to satisfy the test.

One of the parts of the interesting parts of the challenge is that prior to each 45 minutes pairing session the pairs were changed.  Which required that the pairs started over by explaining their vision.  Then at the end of each 45 minute session ALL code was deleted to ensure you start from scratch again.  This included any hand-written notes you took during previous pairings.

Of course, due to the 45 minutes restriction I don’t believe that anyone could truly get the completed application running.  But that is OK.  The purpose of the event is achieved by showing the benefits of pair-programming, using TDD (Test Driven Development), and bringing the various communities together.

Additional requirements

In addition to the rules and steps defined above, there was additional criteria placed upon the teams for each iteration.  The first round had no additional criteria, but each additional round carried a new requirement to follow.  For this event we had the following criteria set for each round respectively:

  1. Team with someone using a different programming language.
  2. 5 lines or less per method/function.
  3. No usage of mouse.  All keyboard shortcuts.
  4. No talking.

The additional requirements made it fun and forced attendees out of their comfort zone, in most cases.  It was interesting to see how, when faced with the difficulties of the additional requirements, it brought the pairs closer together to tackle the obstacle.

Possible Tweaks

While I did find the event awesome, and enabled developers from across the board to experience new things, I would love to do such an event where everyone used the same technologies.  This would enable to see how other developers in our own area of expertise have adjusted their workflow, and allow further learning.

By having a group using the same technologies it would allow juniors and seniors to learn from each other and grow the individual communities.

My Take-away

For me this was an awesome way to force myself to use TDD to develop.  Too often I get in a hurry and just skip right to the code, then come back and write tests later…maybe.  However, I found that by writing tests first during this event I actually got more coding done and ended up with less code overall.  And it also led me to do less back and forth refactoring during coding, that is normally a HUGE time waster.

I also found that pair-programming was very enjoyable, and led to time savings.  The person at the keyboard tended to get more done while the second person was free to think a bit more, rather than being occupied with the manual tasks of writing the code.

In Closing

I enjoyed the event thoroughly, and would love to do it again….today!  If you get a chance to attend one of these events in the future, I highly recommend it.