Amateur PANSTARRS Comet

PANSTARRS CometI managed to get a somewhat blurry shot of the PANSTARRS comet this evening. You can see it on the left hand side in the larger photo. It was a lot further south of the moon (right hand side) than I expected. I did not even wind up seeing it with my eye, but thankfully my 300m lens got it! I was holding the camera by hand, resting on a window sill. Wish I could have focused a bit better though.

Expedit Bunk 2 plus upgrade on #1

Expedit 2

Since my daughter liked my son’s raised bed so much, I made one for her as well. Her room was slightly larger, giving me some more space to work with.n I used 5 of the same 2×2 Expedit bookshelves plus an additional 2×1 (found in store but not online), and some birch board instead of MDF.

 

Read more »

Building HyperDex from Git on Ubuntu 12.10

I decided to look in to HyperDex again and found someone beat me to making a php extension. Emboldened to get it up and running for a pet project, I wanted to see if I could build Hyperdex itself from source on my newest Ubuntu 12.10 VM before tackling the php extension.

I followed Göran Krampe‘s install instructions and ran into a few hiccups. He installs a couple libraries we don’t need, and misses python-sphinx as well. Here is my update:

$ sudo apt-get install git autoconf automake autoconf-archive \
libtool python-dev python-pyparsing cython libpopt-dev \
libcityhash-dev g++ libgoogle-glog-dev libleveldb-dev \
bison gperf flex python-sphinx

The rest is mostly the same until the end since we don’t need the python bindings.

git clone git://git.hyperdex.org/po6.git
git clone git://git.hyperdex.org/e.git
git clone git://git.hyperdex.org/busybee.git
git clone git://git.hyperdex.org/replicant.git
git clone git://git.hyperdex.org/HyperDex.git
cd po6 && autoreconf -i; ./configure; make && sudo make install
cd ../e && autoreconf -i; ./configure; make && sudo make install
cd ../busybee && autoreconf -i; ./configure; make && sudo make install
cd ../replicant && autoreconf -i; ./configure; make && sudo make install
cd ../HyperDex && autoreconf -i; ./configure; make && sudo make install

When it came time to test HyperDex out, it showed me no love.

$ hyperdex daemon --help
hyperdex daemon: error while loading shared libraries: libe.so.0: cannot open shared object file: No such file or directory

Looking back through the build spam I see that I need to add /usr/local/lib to my LD_LIBRARY_PATH. Since I want this in my path on boot, lets add it to our ld.so

$ sudo nano /etc/ld.so.conf.d/e.conf
#export needed for 'e' library for HyperDex execution
/usr/local/lib

Save it then reload the ldconfig:

$ ldconfig

Now, HyperDex starts up swimmingly:

$ hyperdex daemon --help

Next step: building php-hyperdex!

Expedit Bunk 1 with Crawlspace

Expedit Bunk 1

For a long time I have been wanting to make bunk/lofted beds for my kids. Their rooms are rather small with limited storage space. Secretly, I also always wanted to have a bunk bed as a kid. Ok, it isn’t much of a secret. Frustrated by the cost of some options, scared about the quality of others, limited in headroom by an ceiling fan, and inspired by IkeaHackers, I finally got in gear and made this Expedit bunk with a crawlspace underneath.

Read more »

AngularJs Zend Framework 1 Resource Plugin

I whipped up a simple ZF1 resource plugin for AngularJs called AngularZF1 and dropped it onto github. We have started using Angular at work and I thought, why not mimic how the ZendX_JQuery plugin works. Right now it doesn’t add much beyond just adding the script tag to your <head>. Enjoy, all you who are still on ZF1!

Raising them right : Oct 2012

My daughter had to do a hero project, so she picked King Arthur. Definitely points for that one. She also had to make a visual in addition to the written assignment. Here is what she came up with.

 Yes, I am very proud of her. Now I need to teach her about Ada Lovelace.

What Not To Do In the Pediatric Ward

I had to spend the night in the pediatric ward due to a sick child. Here are some notes I want to share with parents.

  1. Don’t call your family on speaker phone after 9pm. The little patient next door may be trying to sleep. Better yet, don’t use speaker phone.
  2. No matter how old your child is, whether or not they are asleep, don’t carry on a cuss filled conversation. Your neighbor in the next room doesn’t want to hear it.
  3. If you have multiple visitors, one of them can go get some Gatorade from the vending machines instead of calling the nurse to do it. A hospital is almost always shorter staffed at night and the other children could be more sick than yours.
  4. The TV is not there for you to watch your favorite foul mouthed late night host. If the bleeping is more frequent than your health monitor’s beeping, something is wrong with the show. Turn it down or preferably turn it off.

And as always, be nice to your nurses and orderlies. They may just need to save your child’s life.

Oracle in PHP Frameworks

I have been using Zend Framework 1.x at work for some time now. I appreciate the large number of components, many of which my system uses on a daily basis. Yes, it is a large library, but we have a very large application that probably does too many things.

ZF2 is coming out soon and it seems quite different from 1.x. I downloaded the betas and skeleton app, and looked at the well written tutorials, but I am still having a difficult time wrapping my mind around it. So I have decided to see if the grass is greener elsewhere. There are plenty of PHP frameworks out there to choose from, but I have one particular requirement: Oracle support. I work in a somewhat regulated space and the big vendors are preferred over the Open Source databases. And not just any Oracle support, we need to use the oci8 driver.

Most of the new frameworks prefer to use PDO for their database abstraction layer. This is fine for most people who are using MySQL or PostgreSQL. This is not great for us Oracle users. Although there is a pdo_oci extension, it is very buggy. We have to use the oci8 driver instead. And no, I cannot just switch to MySQL.

So, which of the frameworks support oci8? *feel free to correct me in your comments

Framework DBAL oci8 Notes
ZF 1.x Internal  Y
CodeIgniter 2 -  Y
Symfony2 Doctrine  Y  According to the Doctrine 2.0x docs oci8 is supported.
ZF2 Internal/Doctrine  Y
CakePHP 2.x -  + http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/
Lithium Internal  N MySQL, SQLite3, CouchDB, MongoDB
Aura Wrappers around PDO  N MySQL, PostgreSQL, SQLite3, SQLServer
DooPHP Wrappers around PDO  N
Yii Internal  ?  Found a note from 2009 saying it worked
FuelPHP Internal  ?
Slim - No DB support in framework

When I was researching frameworks 3 years ago I looked at Doctrine as a DBAL and even contributed a few patches to the project, but eventually got frustrated enough to bail on it and go with ZF’s vanilla approach. Should I try out Doctrine again or use something like Slim and keeping all my existing ZF1 database code?

Installing PHP 5.4.0RC8 and Apache 2.4 on Ubuntu 11.10

About once every other week I try and spend some time at work thinking ahead. With PHP 5.4 on the horizon I began to wonder how our current Zend Framework application would fare if the SysAdmins decided to jump straight from PHP 5.2 to PHP 5.4. Would the site work at all? One way to find out. Lets install PHP 5.4RC8 and Apache 2.4.

I started by creating a fresh Ubuntu 11.10 VM. In complete disclosure, I removed some of the unneeded packages like LibreOffice first. I then cloned it so I would always have a base to work off of in the future.

Build Environment

Open a terminal prompt and switch to root.

sudo su -

This just makes life easier throughout the process. Normally I would recommend only switching to root when you fully need to, like when you run apt-get install or make install. Now lets make sure we have all the build environment pieces we need.

apt-get update
apt-get -y -q install make g++ flex bison build-essential zlib1g-dev binutils \
cmake automake autoconf libmcrypt-dev libmhash-dev libxslt1-dev \
libtidy-dev libbz2-dev libxml2-dev libssl-dev libmysqlclient16 libmysqlclient16-dev \
libpng12-dev libpng12-0 libpng3 libjpeg62 libjpeg62-dev libxpm-dev libpcre3 \
libpcre3-dev zlib1g zlib1g-dev libltdl-dev libltdl7 pkg-config \
libcurl4-openssl-dev libfreetype6 libfreetype6-dev libc-client2007e \
libc-client2007e-dev libkrb5-3 libkrb5-dev openssl libglobus-openssl \
libglobus-openssl-dev libcurl4-openssl-dev libicu-dev libicu44 libpspell-dev \
linux-libc-dev libc-dev-bin libc-bin libc-client2007e-dev eglibc-source \
libkrb5-3 libkrb5-dev libkrb53 libkrb5support0 libncurses5-dev libncurses5 \
ncurses-base ncurses-bin ncurses-term libaio-dev libedit-dev lynx

Certainly some of those are not totally needed if we are only checking to see if things install, but I want to make sure we have lots of bases covered. Now, time to get Apache 2.4. You can skip this portion if you want to only install PHP 5.4.

Apache

For Apache we need three pieces: the Apache Portable Runtime, APR Utils, and the Httpd server itself. Feel free to find a closer mirror. This code will download the latest greatest for today and install it into /usr/local/

# APR
wget http://mirrors.axint.net/apache//apr/apr-1.4.6.tar.gz
tar -xvzf apr-1.4.6.tar.gz
cd apr-1.4.6/
./configure
make
make install
cd ..

# APR Utils
wget http://mirrors.axint.net/apache//apr/apr-util-1.4.1.tar.gz
tar -xvzf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
make
make install
cd ..

# Apache
wget http://apache.petsads.us//httpd/httpd-2.4.1.tar.gz
tar -xvzf httpd-2.4.1.tar.gz
cd httpd-2.4.1
./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-ssl --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-apr=/usr/local/apr/
make
make install
cd ..

The above worked rather painlessly for me once I knew that I had to install APR and APR Utils before the Httpd server. We will do the configuring of Apache in a bit. Lets install PHP 5.4RC8 first.

PHP

wget http://downloads.php.net/stas/php-5.4.0RC8.tar.gz
tar -xvzf php-5.4.0RC8.tar.gz
cd php-5.4.0RC8
'./configure' '--disable-debug' '--enable-inline-optimization' '--disable-all' '--enable-libxml' '--enable-session' '--enable-xml' '--enable-hash' '--with-pear' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-layout=GNU' '--enable-filter' '--with-pcre-regex' '--with-zlib' '--enable-simplexml' '--enable-xmlwriter' '--enable-dom' '--with-openssl' '--enable-pdo' '--with-pdo-sqlite' '--with-readline' '--with-sqlite3' '--with-iconv' '--disable-phar' '--with-libedit' '--enable-exif' '--with-bz2' '--with-gettext' '--with-mcrypt' '--with-mhash' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib-dir' '--with-xpm-dir' '--with-xsl' '--with-tidy' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-mbstring' '--enable-sockets' '--enable-dom' '--enable-xml' '--enable-soap' '--enable-libxml' '--enable-session' '--enable-simplexml' --with-kerberos --with-curl '--with-mysql-sock' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-config-file-path=/usr/local/etc'

make
make install

PHP has tons of config options. I recommend checking your current install to see what it was built with and add those flags. Once nice thing here is that mysqlnd comes with PHP 5.4 so we do not have to link to an existing MySQL install. Another thing to note is that this sets php’s config directory to /usr/local/etc. Make sure to customize –with-config-file-path to wherever you want to store your php.ini.

Configuration

Speaking of php.ini, lets put one in place now.

cp php.ini-development /usr/local/etc/php.ini

And lets set up where Apache can find our files (unless you like putting things in /usr/local/apache2/htdocs/).

mkdir /var/www/
chgrp -R www-data /var/www/

Ready to configure Apache? I wasn’t! It had been over 4 years since I had done a source compile (I used to use Gentoo linux). Open up /usr/local/apache2/conf/httpd.conf in your favorite editor.

  1. Replace instances of /usr/local/apache2/htdocs with /var/www . There should be two.
  2. Add index.php to the DirectoryIndex line
  3. I uncommented #LoadModule rewrite_module modules/mod_rewrite.so and
  4. #Include conf/extra/httpd-vhosts.conf because I knew I was going to need them for my later testing.
  5. And finally I added 2 lines to make sure we parse the PHP
AddHandler php5-script .php
AddType text/html .php

I wanted to make sure Apache would start on boot so I added it to the main runlevel.

ln -s -T /usr/local/apache2/bin/apachectl /etc/rc2.d/S80apache

To find out what rcX.d you should use just execute runlevel. Shove the number it returns (2 in my case) in for X.

Moment of Truth

Three steps left. First, start up apache. If everything has gone well so far this should cause you no grief.

/usr/local/apache2/bin/apachectl start

Create a test php page:

echo "<?php phpinfo();" | cat > /var/www/index.php

And finally navigate to http://localhost/ on your VM.

Final Notes

I re-ran this process a couple times on copies of the initial VM clone to refine it a bit. It all worked stellar today. YMMV of course. I had to do some additional steps after this to test our ZF application since we use Oracle instead of MySQL. So far I have only found one minor Notice that popped up in 5.4 which was trivial to clean. Now if I could convince the SAs to upgrade to 5.4 once it goes gold…

Enjoy testing your code on PHP 5.4!

Otto’s, for the cure

Otto’s Cure.
The German Remedy
for Throat and Lung Diseases

Part of my Dad’s old medicine collection.