Thursday, August 16, 2012

Continuous Integration (CI) && Configuration Management (CM). Links.

I am trying to find out a best solution for Builds\Deployments.
Still have nothing, except some notes.

Requirements\Facts:
- Distributed software usually runs on a lot of servers\nodes;
- Deploy must be automated;
- User should be able to control deployment from one place (web UI);
- Automated deployment system must be able to Revert changes;
- Servers\Nodes should use Push\Pull mechanism to update themselves;
- Web UI should have health status monitor for all Servers\Nodes;
- to be continued...



Links:
Comparison of Continuous Integration Software
Comparison of open source configuration management software

Hadoop/HBase automated deployment using Puppet

Monday, August 13, 2012

RemoteObject mapping (deserialization). RPC result has not been deserialized properly.

If you have a ValueObject (marked with RemoteClass metadata tag) and you don't use it in your Flex code, It will not be registered in generated SWF and your RPC result will not be deserialized.

You will get results, but instead of proper classes inside it, you will have Objects.

There are some topics on the internet about this (How do I get a strongly typed collection from BlazeDS?)... People are trying to find out why class has not been deserialized properly, and as a result, they suggest solutions\workarounds like new instance that never will be used (http://stackoverflow.com/questions/1756755/how-do-i-get-a-strongly-typed-collection-from-blazeds#comment2245464_1764544):

var dummyClass:MyVOClass = new MyVOClass();


Is it right?... don't think so.

Why are you trying to send any data that will never be used on Client? If it is used, why don't you use VOs for it? Why do you address that data as Object?
Those are the questions that should help to figure out what is wrong with design.. of course it is not a complete list.

But.. enough of that. Here is some notes that can be helpful:

0) Do not send unnecessary data to Client application;

1) If you have VOs declared, use them instead of just working with the Objects;


2) Use "-keep-generated-actionscript=true" compiler argument and try to look into generated code. If Flex aware of your VO (RemoteObject), you will be able to find something like this:

       // com.localnamespace.vo.EMail
       try 
       { 
           if (flash.net.getClassByAlias("Remote.Namespace.EMail") != com.localnamespace.vo.EMail) 
           { 
               flash.net.registerClassAlias("Remote.Namespace.EMail", com.localnamespace.vo.EMail); 
               if (fbs != SystemManagerGlobals.topLevelSystemManagers[0]) 
               { 
                   trace(ResourceManager.getInstance().getString( "core", 
                         "remoteClassMemoryLeak",
                         ["com.localnamespace.vo.EMail","test7","_test7_FlexInit"]));
               } 
           } 
       } 
       catch (e:Error) 
       { 
           flash.net.registerClassAlias("Remote.Namespace.EMail", com.localnamespace.vo.EMail); 
           if (fbs != SystemManagerGlobals.topLevelSystemManagers[0]) 
           { 
               trace(ResourceManager.getInstance().getString( "core", 
                     "remoteClassMemoryLeak",
                     ["com.localnamespace.vo.EMail","test7","_test7_FlexInit"]));
           } 
       } 

3) If you cannot find registerClassAlias() call for you class, you can explicitly tell compiler to include your class. Just use another compiler option: "-includes com.localnamespace.vo.EMail"

Wednesday, August 1, 2012

Apache Flex SDK 4.8.0

  1. It was released... some time ago... 
  2. Nothing new in sdk, mostly "rebranding"
  3. It is not enough to just download binaries from incubator's downloads, you also need to download and "install" all dependencies (to use in IDE). But there is an alternative way to install the sdk - packager. The packager is an AIR application that will download sdk and all dependencies and "install" them properly. But you need to compile it first :)

mx.core.Singleton

IMyInterface
package xxx
{
    public interface IMyInterface
    {
        function foo():void;
        function bar():void;
    }
}

MyClass
package xxx
{
    public class MyClass implements IMyInterface
    {
        private static var _instance:IMyInterface;
        /**
        * Must be implemented. Will be called from mx.core.Singleton;
        */
        public static function getInstance():IMyInterface
        {
            if (!_instance)
            {
                _instance = new MyClass();
            }
            return _instance;
        }

        public function foo():void
        {
            // Some code here
        }

        public function bar():void
        {
            // Some code here
        }

    }
}

Somewhere in a 'registration' module:
import mx.core.Singleton;
import xxx.IMyInterface;
import xxx.MyClass;


Singleton.registerClass(getQualifiedClassName(IMyInterface), Class(MyClass));

How to use:
import mx.core.Singleton;
import xxx.IMyInterface;

var myi:IMyInterface = Singleton.getInstance(getQualifiedClassName(IMyInterface)) as IMyInterface; 

myi.foo();
myi.bar();