Denny C. Dai

Denny C. Dai


16 posts

gcd-netlib

A C++ networking library built on top of Apple's grand central dispatch (libdispatch) and low-level TCP socket API

  • internal serial dispatch queue for IO processing
  • listener and delegate callback using blocks
  • non-blocking socket I/O

The library is cross-platform with build system available for Mac OS, Linux, Node.js and iOS.

Usage

const char* hostname = "localhost";  
const char* servname = "8888";

libgcdnet::NetworkAgent server(NetworkAgent::SERVER, NULL);  
server.listen(NULL, servname);

libgcdnet::NetworkAgent client(NetworkAgent::CLIENT,NULL);  
client.connect(hostname, servname);

Source Code

https://github.com/dennycd/gcd-netlib

rna-dv

RNA-DV provides an interactive GUI toolkit for visualizing and designing RNA secondary structures. It allows users to interact directly with the RNA 2-d planar structure and modify it by altering primary sequence content and connect/disconnect nucleotide bonds. It integrates thermodynamic energy calculations including

  • efn2
  • HotKnots
  • Major
  • RNAeval

It also recognizes a number of secondary structure formats including CT, RNAML and dot bracket (dp). For details, please look at the following papers

  • Herbert H. Tsang and Denny C. Dai, “RNA-DV: an interactive tool for editing and visualizing RNA secondary structures”. BCB ’12 Proceedings of the ACM Conference on Bioinformatics, Computational Biology and Biomedicine. 2012 (link)

A user manual is here GUIManual. There is also a screencast demo

RNA-DV

Source Code

https://github.com/dennycd/rna-dv

dnode-objc

An Objective-C native implementation of dnode asynchronous RPC protocol for iOS and OSX. It uses the following library

Usage

Start by subclassing DNode and define your local dnode interface in a header file.

#import "DNode.h"

@interface TestClient : DNode
-(void)foo; //the method your would like to call on remote
@end

To expose your local dnode interface to the remote, use C++ macro DEFINE_CLIENT_METHOD(local_name). For example

//the direct call from remote dnode
DEFINE_CLIENT_METHOD(hello) {  
    NSLog(@"hello from server: %@ ", args); 
}

To explicitly declare a method on remote and receive callback, use DEFINE_SERVER_METHOD_WITH_CALLBACK(remote_name)

//the callback from a previous local-to-remote call
DEFINE_SERVER_METHOD_WITH_CALLBACK(echo) {  
    NSLog(@"callback from server %@", args);
}

To invoke a method on remote, use CALL_SERVER_METHOD(remote_name, arg) whose remote_name must match the name defined in DEFINE_SERVER_METHOD_WITH_CALLBACK. For example

-(void)foo
{
    id arg = @[@"hello from client"];
    CALL_SERVER_METHOD(echo, arg);
}

To create a dnode instance and connect to a remote

TestClient* client = [[TestClient alloc] init];  
[client connectToHost:@"192.168.1.100" Port:8000 Callback:^(BOOL success, NSNumber* err){
        NSLog(@"connected %d with err %@", success, err);
    }];

Set up a delegate object to get notified on connection status

[client addListener:self CallbackQueue:dispatch_get_main_queue()];

A number of delegate callbacks are

-(void)connectSuccess; //connected to remote
-(void)connectFailed:(NSNumber*)code; 
-(void)disconnected; 
-(void)remoteReady; //remote interface ready

For details please look into the test directory for OSX and iOS demo projects.

Todo List

  • local listening server that receives remote connection
  • callback to remote from a previous remote-to-local invocation
  • more unit testing and examples

Source Code

https://github.com/dennycd/dnode-objc

Research

My research work in MSc (2004-2006) and PhD (2007-2010) has been focused on the design and performance analysis of stochastic local search algorithms for solving combinatorial optimization problems. One underlying theme of the work is to achieve a balance between search efficiency (e.g. runtime cost) and solution quality, which in particular, involves the performance tuning of the designed algorithms and the empirical comparison among them. Besides classical local search algorithms, I am interested in cooperative & distributed search frameworks such as ant colony optimization (ACO) and particle swarm optimization (PSO) which has demonstrated to solve hard problems in a more efficient and effective manner. My other interest in the area involves applying probabilistic models to the optimization domain by integrating reasoning & learning models as a way to improve the overall search results (e.g. Estimation of Distribution Algorithm and Bayesian Optimization Algorithms).

In my MSc., I conducted a comparative study of several metaheuristic algorithms to solve a fertilizer blends optimization problem for Western Ag. Inc. (Saskatoon, Canada). In my PhD study, I focused on developing local search algorithms for solving the RNA Secondary Structure Design (SSD) problem in Bioinformatics. A novel local search algorithm “rnaDesign” has been developed that solved the RNA design problem and is compared with existing literature solutions. A regression model framework has also been designed which is capable of predicting algorithm performance on the RNA design problem with good accuracy. Both works are accepted for the IEEE Computational Intelligence conference in 2009.


Publications

Journal Articles

  • H. A. Ebhardt, H. H. Tsang, Denny C. Dai, Yifeng Liu, Babak Bostan and Richard P. Fahlman. “Meta-analysis of small RNA sequencing errors reveals ubiquitous and tissue specific post transcriptional RNA modifications.” Nucleic Acids Research, Oxford Journals, 1-10, 2009 (NCBI)

Conference Papers

  • Herbert H. Tsang and Denny C. Dai, “RNA-DV: an interactive tool for editing and visualizing RNA secondary structures”. BCB ’12 Proceedings of the ACM Conference on Bioinformatics, Computational Biology and Biomedicine. 2012 (ACM)
  • Denny C. Dai and Kay C. Wiese, “Performance Prediction for RNA Design Using Parametric and Non-Parametric Regression Model”. IEEE Symposium on Computational Intelligence in Bioinformatics and Computational Biology, Nashville, TN, USA, April 2009. (IEEE)(slide)
  • Denny C. Dai, Herbert H. Tsang and Kay C. Wiese. “rnaDesign: Local Search for RNA Secondary Structure Design”. IEEE Symposium on Computational Intelligence in Bioinformatics and Computational Biology, Nashville, TN, USA, April 2009. (IEEE)(slide)
  • Denny C. Dai, Herbert H. Hsang and Kay C. Wiese, “An Incremental Redundancy Estimation for the Sequence Neighborhood Boundary”. The 4th Canadian Student Conference on Biomedical Computing and Bioinformatics, Vancouver, Canada (Mar. 2009) (RG)

Thesis

  • A Comparative Study of Metaheuristic Algorithms for the Fertilizer Optimization Problem. M.Sc. Thesis, Department of Computer Science, University of Saskatchewan, 2006. Supervisor: Dr. Michael C. Horsch (USASK)
  • Multi-Agent Robotic Soccer Design for the RoboCup Simulation Platform. B.Sc. Undergrad Thesis (distinguished), GuangDong University of Technology, China, 2004. Supervisor: Dr. Zeng, Bi

Technical Survey

  • RNA Design Optimization: A Survey and Recent Advances, Denny C. Dai. School of Computing Science, Simon Fraser University, 2009. (RG)

Tools

RNA-DV

demo github sourceforge

RNA-DV is an interactive design and visualization tool for researchers working in the field of RNA secondary structure. I collaborated with my SFU colleague Dr. Herbert Tsang on the project since 2008. I implemented the app in Java using Netbean IDE. RNA-DV is bundled into both a desktop version and a java applet version that can be run directly from the browser.

iSanGuo

Much of the game specs are in Chinese language so this page is just a brief outline of what the game is about. For details please check out the GDD.

In Tales of the Three Kingdom (WiKi), historical events occur chronologically but also spatially distributed across a variety of geo-locations in China, such as Cities, Mountains, Rivers, and Ancient Relics. The game maps the story to real geographical places and put players in it by allowing them to trigger those events via location check-in.

In iSanGuo, player assume the role of an out-of-power lord and need to work his way up to establish a new kingdom. While travelling in China, player can explore historical relics, check in to a city and find out its SanGuo history, or discover some of the famous hero character NPCs during the three kingdom war.



The game’s social system is Foursquare-alike, allowing players to compete for a city ruler and will rank players against each other based on their in-game activity. Player will receive quest which requires them to complete certain tasks that are usually location relevant.

On a high-level scope, the game consists a network of city nodes interconnecting with roads and sub-divided into geographical regions. This represents a collective influence of different players in game. Assuming the role of a city ruler will spread that player’s influence across the city region and therefore changing the influence boundary against other players.

There exists an artificial economic model in each city that governs what benefits a city ruler will receive and how other player’s activity can collectively affect it. In general, this produces a micro system that allows players to play either co-operatively or competitively in the game.



Background

I started working on the game in 2012, following my previous adventure (Btwxt Games) on location-based game (WhereWars!). Though not a graphic or game designer myself, I find that potential still exist in location-based game and that much need to be done to realize the goal. I worked collaboratively with friends and various teams in China on the game. So watch this space :-)

AskMath

The Pitch

What is it ?
The objective is to enable searchable math and help people find math content on the web more easily and accurately.

What problem it is trying to solve ?
Students learn math by examples via observing how a math formula or equation is used in a variety of places. Through this, they gain perspective and deeper understanding of the knowledge. However it is difficult for them to collect these information outside the scope of textbooks: existing search engines mostly provide text-based search which makes expressing math-related query difficult.

On the other hand, academic researchers develop their knowledge and base their work on existing literatures. Academic publications contain a lot of structured math content that is valuable but difficult to index and search for. There also exist inter-dependencies among these knowledge that are up to now could only be identified with a reader’s experience and memory.

On a broader scope, the world-wide web is growing exponentially, while in the mean time, the quality of existing search engine is continuously degrading. The inherent issue is the noise being introduced by indexing mass amount of uncategorized, hard-to-filter content from heterogeneous sources. However, the reality is that people are using them as their essential learning tool on a daily basis. We believe that this is not the most effective and efficient way of self-education and knowledge discovery.

The above problems are essentially the same: the lack of a search tool to help people express structured content such as math, and the lack of ways to index, organize and present these knowledge with good quality.

How
Askmath will provide a WYSIWYG web app that allows user to enter math formulas in their natural written form. On the backend, the search involves applying heuristic algorithms to convert a presentational form of the math (e.g. MathML) to its unambiguous semantic counterparts, and then search against an indexed database of mathematic corpus to identify the relevant ones that are semantically similar to user’s query.

Why
AskMath started as a side project and I had been working with my undergrad (GDUT) friends in GuangZhou, China since 2008. The motivation is simple: we looked at the online education market in China and thought there is a gap in between what students demand to learn outside classrooms and the lack of a quality tool to do so. Especially for science and engineering study where mathematical content are the central elements, it is not easy for people to collect, organize and search for the information using existing search engines. Having had 2+ years of experiences working in a start-up (Btwxt Games) and some 5 years of academic research practice in the field of empirical algorithm design, I decided to give it a try and see what it would become.

The Architecture



  • Index DB: inverse indexing database of mathematical corpus that conforms to Apache Lucene index format
  • Redis DB: contains original raw document content that can be retrieved via unique document ID
  • Lucene Indexer: A heterogeneous parser that consumes existing mathematic content (latex source file, pdf, html, etc.) and convert into lucene index DB.
  • Search Server: Search engine core that parses user query and retrieves semantically similar content from the Index DB.
  • Web Server: serving WYSIWYG web app to the user.

Prototype Demo

http://askmath.dennycd.me
I implemented a barebone prove-of-concept prototype to demonstrate the idea. It allows you to enter simple math formulas and query against a sample database of latex documents. A few implementation details of the front-end are:

  • html layout using Bootstrap
  • math rendering with MathJax math editor is a modification on MathJax that enables interactive editing on part of the math formulas. Keyboards are enabled (direction arrows) for easier navigation within the formula.
  • socket.io and DNode are being used for client app communication with the search server.

The search server and indexer are implemented in Node.js with two native C++ module extension

  • clucene for content indexing and query that conforms to apache lucene format
  • tralics library for parsing latex source to xml expressJS, dnode and socket.io are used for communication with the front-end web app.

RoadMap

There are a lot needs to be done.

  • Scoring Function: that takes two math formulas and calculates a similarity value in between them. This would be implemented as an addon to the apache lucene’s scoring framework and ultimately drives the math indexing and search query.
  • Java-based Search Server: the clucene project is outdated and hasn’t been kept in sync with the official Apache Lucene Core. To integrate with the java-based lucene core while maintaining a high-performance web service platform, Netty.io would be a good choice.
  • Content Parsing and Aggregation: including existing online repository of academic publications, as well as mathmml content on the web.