RSS
 

Archive for the ‘RIA’ Category

Pipe Architecture

13 Jun

Here’s a working architecture for modular applications utilizing PureMVC pipes.

Pipe Architecture

This allows you to have modules that load modules that load modules, etc. The modules communicate to each other via Pipes.

The sample diagram illustrates a parent, child, grandchild relationship (An app that loads a module that loads module). You can of course, have multiple siblings.

 

Two must haves for those ‘rigorous’ developers out there.

02 Jun

I’ve come across two [free] tools I find indispensable when working under the Windows platform.

Task Arrange
Aqua Dock

Task arrange
Task Arrange
Task arrange allows you to change up, on the fly, the order of programs listed on the taskbar.

Aqua Dock
Aqua Dock Desktop
I’ve moved all of my desktop icons off my desktop and onto the dock. No need to worry about my icons being shuffled around after hooking up to a digital projector for presentations :)

 
No Comments

Posted in RIA

 

XML => UID Associative Array

25 May

I found myself in need of ‘flattening’ an XML tree. Basically, I needed a means of storing XML elements in to database to search for results at a latter time. The following PHP code transforms the XML tree into an associative array with the following schema

$phparray['parent.child'][$i] = $value

Where $i would indicate the sibling number. The *combination* of the latter index and the sibling number conveniently constitute a primary key :)

Okay here’s the code…

$xml = new SimpleXMLElement('

Lunch

salad
chips
steak

‘);
$vals = array();

RecurseXML($xml,$vals);

foreach($vals as $key=>$value)
foreach($value as $k=>$v)
print(“{$key}[{$k}] = {$v}
\n”);

function RecurseXML($xml,&$vals,$parent=”")
{
$child_count = 0;
foreach($xml as $key=>$value)
{
$child_count++;
$k = ($parent == “”) ? (string)$key : $parent . “.” . (string)$key;
if(RecurseXML($value,$vals,$k) == 0) // no childern, aka “leaf node”
$vals[$k][] = (string)$value;
}
return $child_count;
}

/* OUTPUT
type[0] = Lunch
time[0] = 12:30
menu.entree[0] = salad
menu.entree[1] = chips
menu.maincourse[0] = steak
*/

?>

 
No Comments

Posted in RIA

 

Suse + Apache sendmail from() address

23 May

Here’s a quick tidbit on setting the [default] from address for php [sendmail] on a suse box. There are *two* settings that need to be changed, let’s look at the default “out-of-the-box” email from address.

WWW daemon apache

The wwwrun is the username that is being used to send the email. (See /etc/apache2/uid.conf). To alter this value, we need to masquerade it.

Computer->YaST->Network Services->Mail Transfer Agent
Click Next
Click Masquerading
At the bottom of the screen click “Add”
Select local user `wwwrun`
Enter the desired ‘Display as’ value (i.e. webmaster@yourdomain.com)

OK out of the dialog and YaST.

If you send a mail now, it will have a ‘from’ address of

WWW daemon apache

To alter the full name `WWW daemon apache`, you’ll need to update the wwwrun user itself.

Computer->YaST->Security and Users->User Management

You may need to set the filter options to show ‘system’ users. Select the `wwwrun` user, click Edit and modify the `User’s Full Name` field.

 
No Comments

Posted in RIA

 

Adobe Flex Upload +[PHP] Session + Firefox = Failure !

20 Apr

Well not quite but almost. Here’s my dilemma, I have a flex app that allows the user to upload files. My backend PHP script utilizes session variables to ensure the user has the appropriate credentials before proceeding with the upload. When ran under a firefox browser, it appears as though a brand-new session is created when flex calls the upload.php script.

Here’s a recap..
1) Flex app uploading a file via file.upload(request,"upload")
2) Upload.php check requires existing session vars to be present
3) When invoked via firefox upload.php has NO existing session variables
4) IE works great!! Yep, I can’t believe it either.

It *is* possible to pass the php session information (print("?".session_name().'='.session_id());) to the upload script but that’s not a viable option due to security concerns.

For now, I’ve coded up a hack around this problem, but I’m hoping to have some more time in the near future to investigate further.

 
3 Comments

Posted in RIA

 

Image cache and Adobe Flex

20 Apr

Okay, I kept running into the headache of images being cached within my flex application. I found a simple workaround, appending a URL parameter of the current time to the image’s path.

For example, the path img/simple.jpg becomes img/simple.jpg?date=12010103. Each time the page is refreshed, a new date parameter is generated, fixing our cache headache.

The flex code

url + "?d=" + (new Date()).getMilliseconds();

And the php code

$url . "?d=" . date("U");

Those two small take care of the images being cached.

 
No Comments

Posted in RIA