The Online Portfolio of Craig Morris. An all round web guru including custom development, flash & actionscript, php, cake php, email marketing, graphic design, consulting, e-commerce, content management systems & blogs. Nice to meet you.

Archive \ Ramblings

Flash Mailto Link Not Working

I was dumb founded dismorning when the “send to friend” link in my flash file wasn’t working, in any browser. If I loaded that SWF file directly in the browser, it worked perfectly.

I did some investigating around the Internet and couldn’t find any reason why it shouldn’t be working. I began thinking what was different about this SWF file which would cause it not to work.

Then it hit me…

You need to assign the allowScriptAccess parameter to “always” if the SWF file is loaded from another domain for mailto links to work.

Upgrading SVN to 1.5 on Leopard

I use the awesome app Versions for my SVN needs on my Macbook Pro. Unfortunately, it automaticaly updated my working copies to version 1.5, which wasn’t compatible with the native command line SVN pre-installed with leopard.

Sometimes, I need to go back to the command line to add individual folders (rather than the folder and everything inside it). I can’t imagine this would be hard for the Versions guys to implement, come on!

However they have impressed me with offering a Mac SVN 1.5 DMG download to install the latest subversion with ease! It’s downloading at the moment and I’ll just assume it’s going to work.

You rock, Versions App.

ExternalInterface.addCallback - Object doesn’t support property or method

If your facing some EXTREMELY frustating JavaScript mesages in IE when trying to a utilise a call method from javascript into action script, maybe I can help. I’ve just spent 4 hours tearing my hair out about this problem and finally got it solved. It was so frustrating and all google searches were returning lots of unrelated information with alot of fixes but no ultimate solution (for my problem anyway).

So, to make sure that IE can use ExternalInterface:

  • To get a reference to the flash movie, it shouldn’t be inside a form. If it must, in the case of .NET or Qcodo, use the solutions found at http://www.adobe.com/go/kb400730 OR use the swfobject.getObjectById function to get a reference.
  • Update to the latest version of SWFObject (at time of writing this is 2.1) to place the flash in your page.
  • The flash file must be visible on the page

I’ve placed the last point in bold as nowhere on the web was this a documented fix. I assume Internet Explorer might think this is “security” feature. I was displaying a modal window on top of the flash, which hid the flash from view as the flash can appear ontop of the modal window if the wmode parameter isn’t set to transparent.

The modal window needed to interact with the flash file, but couldn’t in IE because it was hidden.

When CakePHP save doesn’t work - a possible solution

After some frustrating experiences with Cake’s save() and saveAll() functions. They would simply not save the data! I thought the whole thing was messed up and I actually wrote a massive blog post about how to fix it last night. However in my editing and checking dismorning I found the following snippet of code in model.php’s method set.

731
732
733
734
735
736
737
738
739
740
741
if (is_array($one)) {
	$data = $one;
	if (empty($one[$this->alias])) {
		$keys = array_keys($one);
		if (in_array($keys[0], array_keys($this->_schema))) {
			$data = array($this->alias => $one);
		}
	}
} else {
	$data = array($this->alias => array($one => $two));
}

I was trying to save some data which had some fields that wasn’t going to be saved into the database, these were things like credit card numbers which I would process in beforeSave etc. Since the code above will disable your save attempts if the first key in your data array is not a field in the model schema.

Where is Weave 0.2????

For those of you not in the recent know! Google has ceased it’s development of the EXTREMELY useful Google Browser Sync for Firefox. Which is sadly incompatible with the latest version of Firefox, Firefox 3. I could no longer have a seamless browsing experience between home and work, my life was in shatters.

In true Firefox styles…

Our Firefox at work, hallowed be your name, your bookmarks and passwords, your settings be saved at work as it is in home.

(If you don’t know what I’m talking about type “about:mozilla” in your Firefox 3 address bar).

My world was saved a few days later when I discovered the Mozilla made Weave. I tried Weave before and wasn’t too impressed with the way it worked. It was a 0.1 release after all. Maybe I was biased because Google Browser Sync was soo good. However, now I was forced to install Weave again and it has seemed to be far more stable than my last attempt. I especially like the idea how there can be a web interface for all your bookmarks.

I use a PC at work and come home to my shiny Mac Book Pro at night, which I hear is common place nowadays. Weave on my Mac seems to hang itself every 5 minutes and the smooth rotating icon in my Firefox status bar slows down to about 5 pixels every second.

So, as the title states. Where is Weave 0.2? The latest update from Mozilla suggests…

Update: We expect this major update to Weave to be available for wider testing and feedback by Friday, June 20th.

At time of writing is June 26th. I’m wondering, as are others where is Weave 0.2??

In the final moments of this article, I discovered this article from Mozilla. I hope to see it tomorrow, or if not Monday. That gives the Mozilla guys a weekend!

Combine your JS & CSS files for faster loading..

With the relatively recent publication of YSlow, it brought to my attention that while seperating your CSS and JS files into seperate files for a more structured application - it can greatly reduce the load time for your users. This solution aims to solve that by keeping your files seperate, and implementing the advantages of cake so ultimately your users will only have to download one aggregated JS and CSS file.

(more…)

Qcodo vs CakePHP

At work our main PHP framework is Qcodo. However I’m in love with CakePHP. So I set out on creating a presentation which is a comparision of the two frameworks. In the end I concluded that it was like comparing apples and oranges. Qcodo seems like a port of ASP.NET, relies havily on Code Generation whereas CakePHP seems like a port of Ruby on Rails and relies on Metaprogramming.

(more…)