Last month I took a work-related trip to Toronto and made a pit stop at the Hockey Hall of Fame. Here is a link to the photos I took while I was there. If you ever get the chance I highly recommend it.
Ants
Remember that time everyone forgot how to play hockey at the same time?
It happened again.
Saw this while it happened the last night. It was hard to tell these were professional hockey players.
Recently while keeping my mind alive in my free time, I took a PHP project I created last year and decided to add tests around it. Basically I wanted to test an HTTP API confirming that POST and GET requests were working and that data was being inserted into and retrieved from a database. I’ve very much an amateur when it comes to this kind of thing (thus why I am doing in first place) so I had to do some research.
One of the first things I need to set up was the test data. Granted I could of just used the API to do the testing and confirm the results but I wanted to test each alone (this is where the unit part comes in). One way to do this would be to create a test database and the scripts to insert data to test and delete it once the test is over. Another option would be to use mock objects but since there weren’t really any classes involved with this app I couldn’t really figure out a good way to do that.
This is where RedBean came in. Their wikipedia entry does a good job of explaining what it can do. I started using this for the database abstraction stuff in the API code and it turns out it can do much more. Not only can you interact with the data with it but you can create tables, even databases right on the fly. Then you can also delete them on the fly.
The following example creates a table named message. This is all my application uses so this is another reason why it worked so well in this situation. The one thing you have to make sure is that this table does not exist prior to this so you have to create a property for each column. Otherwise you’ll get an error trying to insert into data into a column that doesn’t exist. This forced me to change a couple of things in my code. Also, this will insert an extra record for the test data, so you will have to either delete at the beginning of each test or ignore it.
$message = RedBean_Facade::dispense('message');
$message->app_name = 'application name';
$message->body = 'message body';
$message->type = 'message type';
$message->posted = RedBean_Facade::$f->now();
RedBean_Facade::store($message);
Then once you are done with the data, you can delete it. I ended up putting the following line in the tearDown() method which deletes the data from message and drops the table.
RedBean_Facade::nuke();
If I had to write a new PHP app I would definitely consider using RedBean for the ORM. One thing I found a little frustrating was the documentation. There is some out there but it seems to be a little lacking. Luckily there seems to be a pretty good community of users that make up for it.
Also, composer.org support seems to be an after thought. It appears that the author doesn’t use it. This caused a couple of quirks including losing the ability to use the R class directly. An easy workaround to this was just adding the following line to my code:
use RedBean_Facade as R;
Hit up RedBean’s website for more information.
1987 Cadillac Fleetwood Presidential Limousine concept
In case I need to reinstall pip again. What a pain in the smoker.
I went on a brewery tour last weekend and it was fun.
2012, like any year, didn’t disappoint in the music department. I was contemplating making one of these lists this year. I guess the main reason I am doing it is more a to create a list of what I listened to this year and suggest you check them out if you haven’t already. I did listened to more music than this over the course of the year, but these ones stood out. So without further ado, here are my favorite records of 2012.
The Snips: Highs of Low - I’d only heard of The Snips prior to listening to this record. I heard a song on a podcast in the spring and went to check it out. Turns out the record is free to download off their website so began listening right away. I instantly became a fan. The sounds are very melodic and I love the singers voice. I ended up revisiting it many times throughout the year.
The Holy Mess: Cande Ru Las Degas - I knew these guys were recording at some point and was anticipating this release. It didn’t disappoint at all and is probably my favorite form the list. Good old gruff punk from Philadelphia.
Propagandhi: Failed States - These guys keep taking each record to the next level. I know I am probably in the minority but I liked their last record (Supporting Caste) better. Some of the song’s lyrics are somewhere I can’t get to and don’t really want to. With that being said I think musically they hit it out of the park with this one.
Menzingers: On the Impossible Past - I loved their last record and this one was a bit more polished. The songs were a little slower and it took me a bunch of spins for it to click but it finally did. The final product is, to me, timeless.
No trigger: Tycoon - If you read my blog you know I’ve not only been anticipating this record but hyping it as well. Even though they haven’t put out a record in like 7 years it’s as if they never missed a beat. Which make me think how ahead of it’s time Canyoneer was. Every song on this record is great.
Bruce Springsteen: Wrecking Ball - What can I say? I’m a bing fan of The Boss but haven’t been blown away by anything he’s put out in the last 10 year. This record was an exception. The song Wrecking Ball is one of those that I think could live on forever.
Teeange Bottlerocket: Freak Out! - I don’t know why it took me so long to get into this band. Gratned the super poppy punk has been done a million times but these guys nail it. Even the jokier songs are good. If there is one band I want to see live in 2013 it’s these guys.
Daytrader: 12 Years - This was kind of a guilty pleasure. Even though I kind of dug the E.P. they put out last year I saw them play a show and was unimpressed . This full length was a great next step for the band. It has some super catchy songs on it. It’s too bad they broke up before the year was over.
Anchors: Lost at the Bottom of the World - Another solid release from a band that I don’t think gets much love from the media. I had no idea this record was out until near the end of the year. Every song is solid. It’s just good, catchy, fast punk that seems to be missing these days.
NOFX: Self-Entitled - To me, NOFX hasn’t released anything groundbreaking in the last 15 years but I do own and really like everything they’ve done. This record was great. It was was simple with no joke songs. You can hear many Bad Religion influences throughout it. It had a rawness to it as well that created a refreshing, back-to-basics sound.
Well, 2012 is officially over and I wanted to highlight a few things that happened this year.
Not to go unnoticed, I did write some code over the year. Here’s a list of projects I created:
As always I am looking ahead to 2013. This year with Protected Left done I think I am going to take a back seat to the music thing (at least for a few months) and focus on software development (that and of course raising my child). I want to get more involved with the local tech communities, write more code and contribute to an open source project. I also have a few trips in the making. I may finally get to see the west coast of this great nation!
So heres to 2012. It’s been real.
One of my favorite songs of 2012. Happy New Year!
Protected Left made a video.