Awesome Free PHP Resources: Web & PHP Magazine

I'm doing a little cross posting here to promote a post I wrote on the SDPHP site:

There are a ton of good PHP resources out on the net, both free and paid. Web & PHP Magazine is one of those resources that raises that bar from your typical smart developer posting blog articles on the weekend to a very polished, well-organized publication. Best of all, IT’S FREE!!

Rest of the story Awesome Free PHP Resources: Web & PHP Magazine.

Asking Github how it’s feeling

One recent project I worked on depended very heavily on Github. If you don't know what Github is it's a hosting service for projects that uses Git version control and if I really needed to explain that to you then the rest of this post probably won't do much for you.

The problem with depending on external services and API is that when they are having a bad day, then you are probably having a bad day. The project I was a part of was a Node application that would have to be built and rebuilt several times on several different machines, we are talking in the thousands. This application would reach out to Github for several modules which were essential to the build process. Needless to say there are ways to architect this solution to remove this dependency but that isn't the point of this post 😉

Github has a great status page which does a good job at keeping you informed on the current going on with the Github platform but the problem with it is you need to go to the page, get the status, and if there is an issue continually return to see if there are any updates. Thanks to developer Romin Irani (@iromin on twitter) you can now interact with Github over IM and more importantly have his GitHub Status Bot send you notifications whenever Github has any sort of disruption, planned or otherwise.

GitHub Status Bot is pretty simple and easy to use. Its worth noting that GitHub Status Bot is not an "official" Github Bot and is hosted Google AppEngine. Romin Irani also makes his source code available on Github

Using GitHub Status Bot is pretty straight forward

  • First, simply add githubstatusbot@appspot.com to your Gtalk buddy list
  • Once added send a message to the bot by typing 'help'. This will provide you a list of commands that the bot will respond to.

GitHub Status Bot - Help

  • 'status' gives you the current system status

Screenshot_1_26_13_10_17_PM-2

  • 'last-message' gets the last human communication, status, and timestamp.

Screenshot_1_26_13_10_23_PM

  • 'messages' will get you a list of the most recent communications with status and timestamp.

Screenshot_1_26_13_10_28_PM

  • 'subscribe' is a key command, what this does is lets the bot know you want to be notified via Google Talk if GitHub is down.

Screenshot_1_26_13_10_34_PM

  • 'unsubscribe' will remove yourself from any 'GitHub is down' status updates. I've found, unless I was having issues or needed to keep a close eye on Github that the status message will tend to get a little chatty for day to day following.

Screenshot_1_26_13_10_38_PM

  • And finally if you just want to be reminded who you have to thank for this awesome service, and what version you are on, type in 'about'

Screenshot_1_26_13_10_43_PM

That's pretty much it, hope you find the GitHub Status Bot as helpful as I do.

BASH Prompt Pr0n

So I've been asked a couple of times for this post and I keep not getting around to it so thought I would take some time and get this out. My bash prompt is very informative, long, and functional and that is they way I like it. One prompt actually results in 2 lines in my terminal being used. This is my current Bash Prompt in terminal:

BashPrompt

  1. First thing to notice is my command prompt is actually on the second line, below all the information. This is by design.
  2. The first part of the prompt in the typical username and computer name. Nothing special. A lot of people remove this but I keep it. When all the voices in my head start shouting at each other I can always look at my command prompt and remember who I am.
  3. Next is my location on the computer. Again, a lot of people will just have this piece represent only the current folder but I like to see the entire path. Main reason is I might have several Project folders on my system and this helps me to see which Project folder I am in.
  4. Then comes this little piece of magic that I love, my Git Branch. This section only displays when I am in a directory structure related to a Git checkout and shows me which branch of that git checkout I am working on. This section, depending on your system, may require different set ups. Since I am on my OSX system what I am using is git-completion.bash (or git-prompt.sh). One of the better post on how to install this correctly can be found on a StackOverFlow.com thread. Keep in mind, if I am not on a Git branch none of this section displays, not even the []- which makes it is very clean.
  5. Finally I like to add a time stamp to the end of my prompt. This allows me to return to a console and figure out when I last ran something from that window. It's very helpful. The time doesn't stay current, meaning it won't continue to keep time, it will only show you the time when that prompt was created and that is it.

The prompt does include the different colors for the different sections if your system supports it and most Unix type console do support it. Here is the magic that makes this happen.

There are a couple of ways to play around with this, tweak it until you find what you like, without impacting your system permanently until you want to. At the command prompt simply copy and past the entire line including the word "export", you should be able to see the new prompt immediately. Once you've tweaked it to exactly what you want you can add it to either you .profile or .bash_profile files however you can remove the word export when you do that and just start the line at PS1

If you would like a version without the Git Branch indicator this version should work for you

Here is a link to some other helpful and fun Bash Prompts

Enjoy and Happy Bash'ing
Update: My buddy @johncongdon on twitter pointed out by adding export GIT_PS1_SHOWDIRTYSTATE=1 to your .profile or .bash_profile then you will also get the status of the Git branch.

Screenshot_2_7_13_2_55_PM-2

I learned US Airways likes to hold its seats hostage for more money

airline-seats2This is going to be a quick rant about US Airway's Poor Customer Service. I'll try and keep short. I basically just want to rant and vent about what I consider to be a appalling practice and customer service when I attempted to make a purchase of a couple airline tickets with US Airways. You have been warned.

First, let me say I understand and appreciate everything airlines try to do to stay competitive and in business. I personally can't imagine all the logistics and cost involved with running an airline. I also feel as a consumer you need to step up when you feel you are treated unfairly. Typically there is a shared blamed for the scenario, and in that spirit I will share mine.

The week between Christmas and New Year is not typically the best time of year to travel if you don't have to. More importantly you try not to do any "last minute" traveling during this time but unfortunately I had a passing of a close Aunt that put me into a situation where I need fly from California to Maryland with little planning to do so. For the past couple days I've been cursing the various travel sites trying to find the best deal on air fares. I was paying for 2 tickets, my sister and myself, and since this happen unexpectedly and after holiday gift shopping, funds would be an issue. Found an OK price with US Airways of $1500 which would get both of us round trip tickets to Maryland in time to make the funeral and be back in California for work.

On US Airways web site I started the ticket purchasing process, this is where it gets weird. I am a big guy, around 6'5 and over 300 lbs so traveling on planes in general isn't usually a pleasant experience. As such I am pretty insistent that I select my seats, typically an aisle seat and if I can swing it an exit row. This is also one of the reasons why I avoid flying an airline like Southwest unless as an absolute last resort. I believe I was on one of my last clicks to complete the purchase with US Airways when I got to the section to select my seat, however I couldn't select a seat, not without paying an additional fee?

The fees ranged from $45 to $15 depending on which leg of the trip I was purchasing. Yes I would need to preform this process for each layover when I changed planes. This is where I got really confused, what was my $1500 purchasing? There were also seats that could only be reserved by their Preferred Travels, OK I get it all airlines have perks like this but I surely must have been missing something for the rest of the seats. Confused a call was placed to US Airways customer support, which oddly enough had me calling the Philippines.

I explained the scenario as I best understood it to the customer support representative and to my shock they explained to me that in fact US Airways "reserved" 25% of the seats for same day travel. This further confused me and so I asked, was I buying 2 seats on the plan or not? The US Airway representative assured me I would have 2 seats they just couldn't guarantee which seats they would be and that it was "impossible for them to assign seats" at that point. My question in reply was, "Would it be possible if I paid the additional fee?" and their response was "Yes we could then reserve the seats."

So it wasn't impossible, in fact it was very possible, it was more a matter of US Airways trying to scam me out of more money for something I was already prepared to pay for. This practice really seems to boarder on the criminal and racketeering. I was floored and disappointed with this practice from US Airways. Needless to say I opted not to purchase tickets with US Airway because of the very deceptive behavior. And I am still not honestly sure if I had purchased the tickets if we would have actually had seats on the plan or risked being "bumped" for someone who opted to pay the additional fee for the seats.

That's pretty much it, end of rant. Thanks for listening InterTubes.

15 Minutes with CakePHP

I recently gave a quick, and I mean quick, presentation on CakePHP to our San Diego PHP User Group. The presentation consisted of 5 slides of which only 2 were actually about CakePHP. The rest of my presentation was me building a quick blog which I might add I successfully did in about 15 minutes.

SDPHP CakePHP Presentation 1 SDPHP CakePHP Presentation

So the presentation went something like this:

But it probably goes without saying that 2 slides and a quick 15 minute demo really doesn't do a framework like CakePHP justice. CakePHP is an awesome framework with a ton features and of course you can always read the documentation yourself. However, there did seem to be a lot of interest in the command line interface I was using to build my demo code with.

I showed a lot of the functionality of the 'Console/cake bake' command. To recap a little.

> Console/cake bake
---------------------------------------------------------------
App : app
Path: /path-to/project/app
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
>

I also demonstrated you can run

> Console/cake bake all

and we saw all sorts of auto code generation magic happen.

But there are also other options I didn't touch one.

> Console/cake bake db_config
> Console/cake bake model
> Console/cake bake view
> Console/cake bake controller
> Console/cake bake project
> Console/cake bake fixture
> Console/cake bake test
> Console/cake bake plugin plugin_name

One of my complaints was that CakePHP didn't have built-in migrations. Cake does have a couple commands to make moving database around a little easier.

Now we take a look at Console/cake schema.

We start with

> Console/cake schema generate

This will generate a schema.php of the data in your projects database.

To then use this data on another project or database you run

> Console/cake create create

which uses that schema.php to import the schema.

You can also use the schema command to create a database dump file

> Console/cake schema dump --write filename.sql

Cake Shell also comes with a ACL Shell interface for managing and inspecting Acl databases. We spoke a lot about the need to run PHPUnit test and touched on how cake bake had the option to generate test files. As such the command line interface also includes

> Console/cake test

One of the more interesting commands, and one I have not tried using myself is the Upgrade command.

> Console/cake upgrade all

According to the Cake documentation "The upgrade shell will do most of the work to upgrade your CakePHP application from 1.3 to 2.0." which, if worked as advertised, would make updating projects to the latest version of the framework a lot easier.

The full list of shells available look like this

Available Shells:

[CORE] acl, api, bake, command_list, console, i18n, schema, test, testsuite, upgrade

Hope this perks the interest of some of you to give CakePHP a try.

3 on 3 wheelchair basketball tournament

Had the pleasure to play in a 3 on 3 wheelchair basketball tournament today for the San Diego Adaptive Sports Foundation. Good group of people offering a competitive athletic environment for everyone.

Why aren’t you using git flow?

Attended another great presentation put on by the San Diego PHP User Group (which I am now a co-organizer of) around a workflow built off Git called Gitflow, presented by John Congdon (@johncongdon). Unfortunately the slides, as good as they are, don't capture all the great discussion and examples that were sparked up from the presentation but its a good start.

As I mentioned, I've taken a more active role is the SDPHP Group so if you have any question feel free to ping me. You can also keep tabs on the groups in the normal spots:
Twitter: @sdphp
Facebook: San Diego PHP
Meetup: SanDiegoPHP

MySQL EXPLAIN Explained – SDPHP

A local PHP User Group is starting to get some traction here in San Diego again which makes me very happy. Last night we attend a pretty good presentation on MySQL help at the Oracle building here in San Diego. It was given by Dave Stokes who is the MySQL Community Manager there at Oracle and he was nice enough to share his presentation online.

http://www.slideshare.net/davestokes/san-diegophp via @slideshare

Guadalajara, Tequila, and Computing Power

Please specify a Flickr ID for this gallery

Full Stream can be seen on Flickr here - Trip to Guadalajara July 2012

Just sharing some pictures on a trip I took to Guadalajara And Tequila in Jalisco, Mexico July 2012. Most of the time was a lot of long hours working however meal times were pretty awesome. From breakfast at the RIU hotel to the many places we had lunch and dinner, all the meals were great. Also, the day before we left we managed to slip out for a tour of the Tequila distiller for José Cuervo which was pretty cool. Enjoy the pictures.

Great presentation on Nginx: Cranking Nginx to 11 – DPC 2012

New job uses Nginx a lot so been reading up on this topic and came across this presentation on Nginx which I thought was worthy or reposting.

Link to original presentation: https://speakerdeck.com/u/helgi/p/cranking-nginx-to-11-dpc-2012

Sony <<EOF

Today I bid adieu to my employment at Sony. I was fortunate in the sense that the decision to move on with my career was my own. My latest tenure here a Sony lasted over 7 years making it the longest I've ever spent with 1 employer. This being the second time I had been employed by Sony, previous time being as a contractor for 2 years early 2001.

I hope to get around to posting some of my experiences at Sony as one of their IT geeks. I especially would like to take sometime and do a few posts on my views of cyber activist and around the events of the attacks on Sony about a year ago, it was a very interesting time.

For now I just want to thank the people who help me grow, who worked the solutions with me, and who hacked away with me until things worked. You know you can always reach out to me, personally or professionally.

As for me, I am moving on to another organization here in San Diego. It's a company that creates solutions in the educational arena so I am hoping I am a little more comfortable posting on some of the cool things I am working on without worrying about leaking information that isn't suppose to be public yet.