Archive

Archive for August, 2008

Google Analytic – API

August 11th, 2008

What’s up with Google Analytic. Wonderful service for HTML available content but what about offline content?
The javascript API provided by Google blocks sends when not all values are fulfilled.

So how to do this in an AIR application, or a Widget???
After a lot of Google Searching online and Help Sections there is no answer. What I got to so far is that it’s the Cookie handling that mess up the sending of tracker code.

Using a HTMLLoader in AIR I’m trying to get it to send my tracker data but with no success. Everything goes fine and with the startup of the _gat (JavaScript API Class), all values even cookie looks correct.
The problem gets when trying to run the _trackPageview(”); it starts to loose data, mainly the cookie and then the API stops to work.

A bug in the API or some security problem? Anyone out there has any suggestion please advice.

Life , ,

Cairngorm – Chain Events

August 7th, 2008

Found an Example of Chain Events at http://www.cairngormdocs.org/bjorn_schultheiss/eventChaining/EventChainExample.html (right click and check source).

So I put the code to an default Cairngorm Structure that you can download here. Just make sure that you have the Cairngorm.swc package in libs.

This is what files that exist.

cairngormdefault

Important to think of:
1.) All events extends ChainEvent

public class TestAEvent extends ChainEvent

2.) All commands extends SequenceCommand

public class TestACommand extends SequenceCommand implements ICommand

3.) All commands take the nextEvent and execute when done.

override public function execute(event:CairngormEvent):void
{
    nextEvent = ChainEvent(event).nextChainedEvent;
    // Do Command Action
    this.executeNextCommand();
}

That’s is…
Here is an example of executing a couple of commands.

var beginChain : ChainEvent = EventChainFactory.chainEvents([
    new UpdateViewEvent(ModelData.VIEW_LOADING),
    new CheckSoftwareVersionEvent(),
    new GetLocalSettingsEvent(),
    new GlobalApplicationEvent(),
    new GetFeedListEvent(),
    new UpdatePostStatusEvent(),
    new UpdateViewEvent(ModelData.VIEW_POSTS)
    ]);
cgDispatcher.dispatchEvent( beginChain );

————–
UPDATE: 2008-02-21
I’ve added a couple of changes for the demo files.
E.g. when creating an event it’s possible to send custom data
new TestAEvent( “CustomValue” )
and it’s just as easy to extract it in the command

var customEventValue:* = event.data;

You can add any data to the next event in the chain from the command, maybe to pass forward the data or something new. Here is an example.

nextEvent.data = customEventValue;

You can as well runtime change the next event from a command, here is an example.

nextEvent = new TestCEvent();

Flex , ,

Blog Header Images

August 3rd, 2008

Tried to look at AMFPHP and by doing that I need to learn some basics in PHP. So with that I did a little image header swap for my blog. Did 4 small images.

The PHP looks like this.

// Change this to the total number of images in the folder
$total = "4";
// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";
// Change to the location of the folder containing the images
$image_folder = "images";
// You do not need to edit below this line
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
 
echo "<div id=\"header\" style=\"background-image: URL($image_folder/header-bg$image_name);background-repeat:no-repeat\">";

Life , , , ,