More Coda SVN and OS X 10.7.3 Issues

Apparently when I updated my laptop back at the end of 2011, I didn’t take the time to record how to or update my desktop to get past a few issues with Coda, SVN, and OS X 10.7.3.

Today, while working on my desktop, I started having issues with file to file comparisons using FileMerge and Coda. When trying to perform the comparison, nothing happened.

I immediately remembered from my earlier instance that I needed to manually download the OS X Lion Combo Update for 10.7.3 and update  developer tools. This is where I ran into my new problems. My problem wasn’t fixed. I later discovered my laptop is running Xcode 4.2 where as my desktop is running 4.3.1.

Xcode 4.3.1 was modified to be updated from the App Store, removing the package installer and treating it as a full app in your Applications folder. This change inheritantly changed the file location and broke all references to Xcode.

After a little bit of research through the Google Groups, I looked to see what my Xcode path was, running the following command:

xcode-select -print-path
~ xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.

To set the path, I ran the following :

sudo xcode-select -switch /Applications/Xcode.app

After running this command, I restarted Coda and tried to perform my comparison. It worked successfully. Hopefully this helps you.

Limiting CakePHP Pagination Results

While working on a MediaLeaf project, I ran into an issue with pagination and associations.

Apparently, when you add a fourth association, the default pagination changes to the associated recursive functions. To get just one association that is needed, I had to to return all associations. Needleess to say, this is very cumbersome.

After tinkering for a bit, trying unbindModel, bindModel, and various recursive functions, I discovered the containable behavior. Contain is beautiful. You can modify your associations on the fly and return just the associated data you want.

Here’s how:

// use this to modify your model to be containable on the fly.
$this->Post->Behaviors->attach('Containable');

// only return the post data
$this->Post->contain();

// return tags data with your post
$this->Post->contain("Tag");

This stuff is great. Unfortunately, you have to take it a step further to use it with pagination. Contain has to be added to the pagination array (Hat Tip: Richard @ Home).

// use this to modify your model to be containable on the fly.
$this->Post->Behaviors->attach('Containable');

// now contain your pagination results
$this->paginate = array('order' => array('article_date desc'), 
                        'limit' => 3, 
                        'contain' => array("Tag"));		

Give it a try and hopefully this helps you out.

CODA: SVN Invalid Server Certificate

I was doing some general maintenance on my laptop over the last day, primarily updating the operating system to OS X 10.7, Lion.

Upon the install, I opened up Coda to do some development work and I kept on getting “invalid server certificate” errors when trying to connect to my svn repositories. After a quick search, I found a quick method to fix this problem. I guess we will see how long that lasts.

The resolution is a quick terminal command that provides a method to accept the certificate and continue development.

svn list https://www.example.com/svn/

Replace the url above the with url to your repository and you will be ready to go. Restart Coda before trying to reestablish your connections.

Hat Tip: Dave Blencowe

Fixing __PHP_Incomplete_Class Object in CakePHP Sessions

I ran into an issue today while testing a new Twitter application using CakePHP and an OAuth Vendor that kept giving me a __PHP_Incomplete_Class Object error causing my callback to fail from Twitter.

Here is my original code.

<?php

class MembersController extends AppController {

    function twitter_callback_authenticate() {
      // import oauth vendor
      App::import('Vendor', 'oauth', array('file' => 'OAuth'.DS.'oauth_consumer.php'));
      $consumer = $this->createConsumer();
      $requestToken = $this->Session->read('twitter_request_token');
      .
      .
      .
   }
}
?>

After spending a few hours, I found out what was causing it. Apparently the load process for php objects in CakePHP is delayed if you import your vendor directly in the function. The solution is simple. Just move it outside of the class and it is loaded before the class is.

<?php

App::import('Vendor', 'oauth', array('file' => 'OAuth'.DS.'oauth_consumer.php'));
		
class MembersController extends AppController {

    function twitter_callback_authenticate() {
      $consumer = $this->createConsumer();
      $requestToken = $this->Session->read('twitter_request_token');
      .
      .
      .
   }
}
?>

Hopefully this helps you save a little time before getting hung up on this like I did today.

iPhone Owners, You Are Screwed

Yes, you heard that right. Current iPhone owners got the shaft!

My wife and I was one of the fortunate individuals to be able to buy a iPhone last year when they came out. I had worked out a great deal with my wife and aunt to sell her my current iPhone so I could go by the 16BG – 3G iPhone. Yes! No!

I learned today on AT&T’s website that I was not going to be eligible for the advertised price at WWDC. That’s right, if you are a current owner and you want to upgrade, you have to pay $400 for the 8GB and $500 for the 16GB models.

When did Apple agree with AT&T to do the special pricing they do on every other phone. Apparently when they had to find a way to meet their 10 Million units mark by the end of the year.

And the saddest part is, Apple and AT&T knows that the early adopters will probably opt and pay the additional $200-$300 to have the latest and greatest.

So, I am now left with a challenge, my 1 year old iPhone battery is croaking. My phone (with wi-fi off) could go up to 3 days without a charge and heavy usage. It now struggles to make it 1 1/2 days. I am left with a decision…pay $80 for a battery and phoneless (in the middle of campaign season) for several weeks or suck it up and by the 3G.