Saturday, 13 July 2013

Some good study material link about JMS/ActiveMQ(Chinese)

http://www.360doc.com/content/10/0913/14/2795334_53325069.shtml
 http://blog.csdn.net/wangdongsong1229/article/details/8219536

What I tried is,
1. cd $ACTIVE_MQ$/example/
2. ant producer
3. ant consumer

4. Then try the configuration by different values
    <property name="topic" value="false" />
    <property name="durable" value="true" />
in build.xml.

5. Check the status in MQ by http://localhost:8161/admin/.
 

Friday, 12 July 2013

Some Thoughts about New Feature Integration

Now I am working on new features implementation based on existing system. How to reduce the impact on the system?

Just thinking of SOA, How about defining the services provided in the running system? And then considering the interaction between the new features and the services?

Based on this, you view your system as a service provider. If the service is not declared clearly, then add them.

After this, go through the scenarios by the messaging flow and enhance the flow progressively. 

The idea above is, talking about high level design. The next thing is, to decide the implementation. I find the common practice is to have a messaging mechanism. It is quite natural to map to service request and response. It will become powerful enough to implement most of the complex logic if providing timing functionality.

Within the process level, the new features can use a queue and a frequent checking to communicate with the services. The checking can be put either in a standalone thread or in the main loop.

Within the system level, the new features can communicate with other components in the same system by network/share memory, so call inter-process communication. The exchanged information is embedded in the messages.

Overall, the idea is simple. Define the services you are relying on. Based on them, check the communication flows whether it can accomplish the domain logic you want. The rest just to decide how the interactions are passed through.

Monday, 8 July 2013

Training Program Design

It is quite interesting in considering a training as a project.

It needs a clear scope; Break the tasks into a more clear sub tasks; Define the performing time, review time and make evaluation plan.

Thursday, 4 July 2013

Some useful Python function in daily work

It is a very good script language and I start to learn it for system integration purpose. For example, packaging automation, system administration and process monitoring.

Below are some useful functions for memo: 

1. Parameter checking:

if(len(sys.argv) != 2):
        print 'COMMAND: ERROR'
        sys.exit(1)
sys.argv[1]

2. File existence

if(os.path.exists(path) == False):
        print "ERROR: %s doesn't exist." %(path)
        sys.exit(1)

3. System Call

os.system("cd " + path + "; cvs update -d -P; cd -;")

if(subprocess.call(["tar", "-czvf", tar_package, "sys", "app"]) != 0):
        print "ERROR: fail to tar the package %s" %(tar_package)
        sys.exit(1)

It seems subprocess is preferable due to portability.



4. Print

print 'copy %s to %s' %(src, dest)

5. File Copy

shutil.copy2(src, dest)

6. Variable Declaration

dev_path = '../..'

7. Environment Variable

os.environ['PLATFORM']

8. File Path Join

os.path.join(path, os.environ['PLATFORM'], "binary")

9. Find file Name with Pattern
files = glob.glob(os.path.join(gui + '/resource/') + '*.' + format)
        for file in files:
                shutil.copy(file, target_resource)

10. File System Visit Support
It is a very good design to make it flexible to define customized operations on folder.

def remove_CVS(arg, dirname, names):
        (head, tail) = os.path.split(dirname)
        if(tail == "CVS"):
                shutil.rmtree(dirname)
                print "%s is removed. " %(dirname)

os.path.walk(package_sys, remove_CVS, "")