Archive for the ‘coding’ Category

ZF Tip: Don’t use ‘index’ as a module name.

Sunday, December 13th, 2009

I’ve been using Zend Framework for a while and when I do my own sites things always work as expected.  But a couple of times in the past I’ve had the honor of working on other sites with other people that have lead me to a few ‘wtf?’ issues.

The most recent one was as to why the shorter urls ie: “/index/pants” would not work.  It would always complain and blow up that the controller ‘pants’ doesn’t exist.  Even though I know for a fact that I want the index controller in the default module and the action ‘pants’… (more…)

Summer Project: Updates (Aka WTF Am I Doing?)

Thursday, October 1st, 2009

My ‘summer project‘ has now been demoted to just a ‘random project.’  Although I still intend on finishing it at some point, it’s clearly become far too delayed to call it a summer project anymore. I got overly distracted throughout the summer by family, fun, non-fun, and other projects.  Projects that I’ll explain a bit here… (more…)

All I Need is REST, Vimeo, Flickr, Zend and More

Sunday, July 12th, 2009

Here’s my skeleton for my magical REST interface. It’s still missing a lot of method calls for Flickr and Vimeo, but the guts are there and the remaining methods will be done in priority when I need them.  Right now it supports automatic caching and logging via simple options.

At some point I’ll probably put it on a public SVN repository, but for now you can have the tarball.  There’s a README in the file with a simple sample. And the source is pretty self explanatory so you should be able to figure it out if you want to.

The remainder of the work will be done in the order I see fit.  Likely read-only methods (most of the getters) Authentication and write methods will be much much later.

I’ll also add more RESTful interfaces as I need them.  Probably Facebook soon, Twitter later.  Who knows.

Drop your comments here if you’ve got any questions.

Feeling Up Django: First Impressions From a PHP Guy

Thursday, June 11th, 2009

As I whipped through the tutorial on getting started with Django I made some mental notes on things I thought were interesting and things I thought weren’t so interesting. I have a feeling I’ll be saying similar things about Ruby on Rails…

(more…)

PHP Java Bridge vs. Zend Platform Java Bridge

Friday, June 5th, 2009

A long time ago I posted some instructions on installing PHP/Java Bridge on Ubuntu and that post is getting quite a few reads, so I figured I’d post a follow up on how it was used.

Over the last year I had been using a Java Bridge from a Zend Framework application to access a Java only API.  And really, between the two bridges there are no differences.  They both work identical, they both work great.  Would I pay Zend for Zend Platform’s Enterprise license? No.  Why? Because both bridges perform the same.  The only differences are:

  1. Zend’s Java bridge already has a function called java_require and the open source PHP/Java Bridge needs you to include a file.
  2. PHP/Java Bridge has a java_cast function, and you need it.  Zend’s Java Bridge does not have, or need this.

With these two differences all you need is a little code in your bootstrap (or somewhere else useful) to cover them and all is golden. Your app should work with both Java Bridges without any issue.

/* no java_require() include the java.inc for PHP/Java Bridge */
if ( ! function_exists('java_require') ) {
    include "java/Java.inc";
}

/* declare this, it doesn't exist with Zend Java, but is needed for PHP/Java Bridge */
if ( ! function_exists('java_cast')) {
    function java_cast($whatever) {
        return $whatever;
    }
}

There’s probably a more graceful way of checking and doing this but that’s it, and it’s worked on a multi tiered build environment for over a year now.