The Dev Pages

A knowledge base for simple (and beyond) web applications development

Archive for July, 2009




-When you setup additional folders outside of the ‘Sites’ folder to serve files, they cannot be in a directory path where in higher up directory has restricted rights (you can’t serve files from anywhere in the ‘Documents’ folder).

-If you add a virtual host, make sure the home directory/ doc root has a corresponding directory entry. So the <VirtualHost>’s docroot needs to have a <Directory> to make it so the default apache settings for directories don’t deny the server access.

-When you uncomment the link to the virtual hosts file, make a vhost for localhost too.

-When you specify an error log output file for php, chmod it to be globally writable (so php can write to it).

-Eclipse in Mac OS X is funky (Ganymede) with the pdt plugin.

-The debugger module does not work for php unless you compile a 64-bit version of xdebug, which didn’t work easily.

-the zend_path or whatever sucks! This needs to point to the xdebug.so, this was not documented anywhere for mac os x. You have to move it to the weird extensions folder in usr/lib/php or edit the extension_dir, after you have compiled and put the xdebug.so in that location.

-The extension_dir should not be ‘./’, which just means current folder, but should point to ‘usr/lib/php/extensions’ or something (by mem, update later)

-Updating the mysql values in php.ini is pretty straight forward.




So I was loving the MVC framework Mate, but started to run into issues trying to figure out best-practices for dispatching and handling events.

Researching:

1) How you dispatch events from non-view parts of your Flex Mate app

2) Is this a good practice and what is the best practice for using events in Mate with regards to loading an app’s data from a remote source and handling server data?

Results:

1) In a non-DisplayObject, don’t just use dispatchevent(), but you need to instantiate a Mate dispatcher.

At the top make sure you import the class.

import com.asfusion.mate.events.Dispatcher;

Then:

var myDispatcher:Dispatcher = new Dispatcher();
var qlEvt:QuotesLoadedEvent = new QuotesLoadedEvent(QuotesLoadedEvent.QUOTES_LOADED, true);
myDispatcher.dispatchEvent(qlEvt);

This worked for me. I was dispatching the event from a QuoteManager that was responding to the result of a RemoteObject call. But it seems that the listening component (a Box with a datagrid) would only hear the event when I did the following in an injector tag (target=”{QuoteGrid}”) in the eventMap:

If I used:



The QuoteGrid component did not hear the event.

2)TBD

See: http://mate.asfusion.com/page/documentation/tags/dispatcher

The main issue was dealing with events that were being launched from a Manager class, which was handling a remote response from php. After the response, in the manager, I was firing a custom Event that signaled the initial data had been loaded for the app, and then trying to listen for this data_loaded event to signal to the view to update the display (wasn’t a simple property injection since the display had filters, etc. which was making the data layer far more complex with a filteredArray, etc.).

This post: http://mate.asfusion.com/forums/topic.php?id=317 was helpful, when I realized why the hell my eventmap was not able to assign a responsive listener for the data_loaded event. The event was being fired from a Manager class, but nothing was listening or responding and I guess that is because the event map doesn’t handle events dispatched from non-DisplayObjects (like my QuoteManager).

So what is the best practice for notifying views that data has been loaded, when I cannot relying on simple property injection to get the data from the Manager to the view? TBD. Also, is injecting a listener int the eventMap the same as handling an event and invoking a method in the eventMap?

I want to 1) get a bunch of stock quotes for a dataGrid 2)After the data has been received, send it to the view, and not just update a property on the view but copy the data into various other properties so I can manipulate the data on the view with several filters and preserve the original state of the master ArrayCollection. I wonder if using expanded getters/setters on the original/master stock ArrayCollection and its source will be necessary. I would love to see some clear documentation on manipulating/filtering ArrayCollections and what happens to the Array source when the filter function is set.

I would also like to figure out a best-practice for handling server data, and responding to this data using the model concept of MVC and events in Mate. The documentation so far has been good, but not clear on how to accomplish the aforementioned goal.