My first open source project Q-Comet was launched

Posted by Wayne Wan in open source on 29-02-2012

Tags: , , ,

    Q-Comet is a simple comet framework based on tomcat6's comet support, currently it only realized a point-point and broadcast message.

    This project was hosted by google code (http://code.google.com/p/q-comet/)

Observer pattern implementation in web application using Comet

Posted by Wayne Wan in About Work, Programming on 23-02-2012

Tags: , ,

     Observer pattern can be implemented easily in C/S based applications, but in web application area it is not easy to implement caused by the shortcoming of HTTP protocol. Currently we have some solutions : 

  1. browser plugins: we can use socket communication in flash or applet etc. by this we can implement C/S likely applications, the server side can push messages to the small application in browser side,  when the small application receives messages, it can communication with javascript engine. 
  2. comet : it also can be called "server push". it was based on long time polling, we start a request from browser side, the server side application keep the request live, by this we can keep sending messages to browser side. nowadays, some web application servers start to support comet, like : tomcat6/tomcat7 , jetty etc.. In tomcat, NIO is used to optimized the IO performance and decrease the expense of CPU. 
  3. HTML5 web socket. 

    Thinking of implementing the Observer pattern:

  1. send a request with the concerning message types, when server side received these messages, save these concerning message types in the session scope. Of course we can persistence these concerning message type in database, then we can design a customer independent notification user experience.  
  2. open a long time polling from the browser side, when server side received this request, we save the request related  response in a message send thread, at the same time we must keep this request live. Then we can send message signal to the message send thread. In the message send thread we can determine which message must write to which response.

MySQL replication configuration for Community Edition

Posted by Wayne Wan in DataBase on 22-02-2012

Tags: , ,

    This is just a brief summary for the whole steps, more details please refer to : http://dev.mysql.com/doc/refman/5.5/en/replication.html

Steps: 

1. master and slave server must have the same database structure and same data;(dump data from master to slave).

2. for master server:set server-id=1 and open binary log(log-bin=mysql-bin.log)

    for slave server : set server-id=2.

3. start master server, use "show master status\G" to show binary log file name and position;

4. start slave server, use below command to set slave server's related master server info.

mysql> CHANGE MASTER TO

         ->     MASTER_HOST='master_host_name',

         ->     MASTER_USER='replication_user_name',

         ->     MASTER_PASSWORD='replication_password',

         ->     MASTER_LOG_FILE='recorded_log_file_name',

         ->     MASTER_LOG_POS=recorded_log_position;

5. check the log of master and slave server, if no errors, then means all ready, then execute start slave in slave server.
Reference command :  "show processlist\G" , "show master status\G", "show slave status\G" , "start slave" , "stop slave" , "reset slave" , "show variables like
*** "

BCDEdit Command-Line Options

Posted by Wayne Wan in OS Related on 14-02-2012

Tags: ,

 

Boot Configuration Data (BCD) files provide a store that is used to describe boot applications and boot application settings. The objects and elements in the store effectively replace Boot.ini.

BCDEdit is a command-line tool for managing BCD stores. It can be used for a variety of purposes, including creating new stores, modifying existing stores, adding boot menu options, and so on. BCDEdit serves essentially the same purpose as Bootcfg.exe on earlier versions of Windows, but with two major improvements: