Thursday, September 30, 2010

I am always on the look out for a great IDE and for the price (free) NetBeans is truly one of the greats, for any web dev. It has great code completion and even lets you define custom code completion for things like CodeIgniter. Where the loading stucture tends to confuse standard code completion methods.

As I said it truly is a great IDE unless of course you are on a Mac. Unfortunately do to the way they package their executable in OSX, NetBeans cannot open a file from finder. Meaning if you open finder and double click, or select open with NetBeans on a php file or some other code file NetBeans will start if it hasn't already but will never open the file in question.

Now 70% of the time this isn't an issue using the tree view project structure on the left to open your files in your project is pretty basic and straight forward, but if you ever need to open a file out side of that you are forced to use File -> Open menu options on NetBeans, something I think hardly anyone does and something that is extremely annoying.

After having a bug ticket on this open since 2008 myself and a few others finally got enough attention drawn to the matter to get it escalated to have someone look at it. So a month or so goes by and finally the results are in: Closed, Wont Fix.

Now I do understand why they wont fix the issue. Who in their right mind would completely rewrite some of the base code of their project just to handle an annoyance in a single OS? I know I wouldn't, and I can't blame them for that either. It just sucks that this issue is annoying enough to me that I am now looking for a new IDE in OSX that can handle the "magic" of CodeIgniter. Currently I use Komodo Edit which does an alright job, but lacks many of the great features of a true IDE, and no CI code completion, or debug support.

My requirements for a good IDE are, debug support, subversion support, CI code completion, a good find/replace implementation, and works in OSX obviously. I have tried Eclipse but its bulk tends to leave a bad taste in my mouth before the program even finishes loading. That may be my only option though (sad face)

Since the release of ExpressionEngine 2.0 I have been writing plugins for it like crazy. There have been a few frustrations here and there. Also some WTF moments when I look at the EE code (Have you seen how they do custom fields in the database?). Overall though I have had little trouble bending EE to my will.

Some neat plugins I have written which due to my current employment might be sold instead of given away despite my own personal wishes.

A simple input plugin that handles both get and post input values. (There are tons of these but I am particularly proud of how I was able to leverage CI for an extremely clean code set.)

A field injection plugin which takes on EE field and puts it into another at a specified position.

A simple email plugin that sends an email out. (There are tons of these)

A module to populate a channel via CSV. This one probably took me the longest and is the most complex, it also brought to the surface a code bug in EE that I made a bug ticket for you can read more about it here: http://expressionengine.com/bug_tracker/bug/13549/

I also wrote a plugin that is an extremely simple shopping cart implementation it is unique in that it doesn't have any kind of check out methods or anything of that nature it is just a cart (as the plugin's name implies). This was quite a challenge because for some reason EE does not grant access to a users session. They actually override the CI implementation which despite many complaints still remains true. I was able to get around this by copying CI's session library and renaming it, then using it as a custom library. I documented all the steps involved here: http://expressionengine.com/archived_forums/viewthread/138599/P18/

After working out that session stuff I made a plugin around that as well.

All in all having CI to fall back on (in most cases) makes plugin writing for EE a dream. It is amazingly easy to get EE to do whatever you want, and you already have a powerful CMS on your hands.

Wednesday, September 29, 2010

The site I am currently working on GamerGameOn requires authentication with youtube to pull videos to show. Needless to say this has been quite a task. OAuth documentation while good tends to be quite technical, and in some cases, out of date but getting it to work isn't impossible and most of the issues I have encountered have ended up being my own fault. Here is my youtube library. I wrote this instead of using the Zend GData implementation because I didn't want to include a number of other libraries and files that I wouldn't be using. The link to the article is here: http://codeigniter.com/wiki/OAuth_for_Google/ This is just the OAuth request and access library the actual youtube library needs some cleaning up but it all works pretty well. Read the doc in there for a very detailed look at OAuth for google and CodeIgniter.

As I say in the wiki post this is supposedly a general Google OAuth library according to docs all you need to do is change the scope constant to have it work with another google service. I never tested this so I don't know if it's true but in theory it should work.

Here are dropbox links to the files if you would rather download them.

CodeIgniter is currently my framework of choice. I love it's small size and useful libraries I try to contribute as much as I can on the CodeIgniter wiki. With handy helpers and libraries like: OAuth Helper and Language Library Extension I have a ton of libraries besides those which I will probably share on this site instead of the Wiki which is a bit bloated and difficult to navigate.

OAuth Helper is meant to aid in signing OAuth requests which can be pretty tricky. All you do is provide your consumer key, consumer secret (either a string or a path to a .pem cert file), then also an array of additional parameters (so if you have an oauth_token and oauth_token_secret)

The Language library extension provides some functionality which seems to be missing from the stock CodeIgniter language library, which is the ability to add a parameter to a language string. It uses standard sprintf notation in the language line and takes passed in parameters of either a single string or an array of strings.

Well I have finally made a blog. The main purpose of this is to have all of my code in a single place more for my own use than anything else. If someone else can glean any new knowledge from the stuff I have learned then I consider that a bonus. I don't know how often I will post but you can bet that when I do it will knock your socks off.