Wednesday, July 27, 2005

Test the E9-1-1 Server.

It has been pretty stressful for me to write the testing code for the E9-1-1 server these days. Multithreading programming is always challenging, it's hard to debug, the code is flowing all around, and it's easy to make mistakes with those locks, monitors, wait handles. But it's also enjoyful to dig into those codes.

After finishing the test codes, the server part also needs extensively refactoring, the I/O completion port should be used to replace the polling, the so called "virtual multithreading" should be replaced by true multi-threading.

Tuesday, July 26, 2005

Bing will go to Hospitality and Tourism Management Program - College of Charleston

Hospitality and Tourism Management Program - College of Charleston

This blog is a little bit late, but still, I am very proud of him when I heard that he will head to College of Charleston to become a faculty.

Bing inspired me a lot in my life. When I was still at Nanjing University, I saw him get very high score in GRE, go abroad successfully, all of those things have a very good impact on my life.

After coming to states, we have choosing different roads. He is finishing his PH.D. and then go to Cornell , firstly in the CS master program, then transfer to a PostDoc in the Info Lab. I know his road is not smooth, but he goes through this step by step.

I hope he will do well in the future as a faculty, which he could be even 7 years ago in Nanjing University.

Wednesday, July 20, 2005



keyboard shortcut assignment in textbox

keyboard shortcut assignment in textbox
All 2 messages in topic - view as tree

I'm building a form to allow the user to assign a keyboard shortcut.
Basically I have a textbox that I want to work like the "Press shortcut
key(s)" in the Visual Studio keyboard options, the user does the key
combination and it shows up in the textbox. It looks like it works on the
KeyDown event. The KeyDown event has an argument of KeyEventArgs. The docs
say "You can use constants from Keys to extract information from the KeyData
property. Use the bitwise AND operator to compare data returned by KeyData
with constants in Keys to obtain information about which keys the user
pressed. To determine whether a specific modifier key was pressed, use the
Control, Shift, and Alt properties." Unfortunately there is no example and
I don't know how to do bitwise compares in c#. Can someone help me out


first, set Form1.KeyPreview value to "true"

then, on Form's KeyDown Event

private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs
//Note: "T" is a sample designated shortcut key for textbox
if (e.Modifiers.ToString().ToUpper() == "ALT" &
e.KeyCode.ToString().ToUpper() == "T")



How Static Method works.

What if two users call the static method at the same time? Since the
method is static, is any data within this method (parameters passed in and
local variables declared within the method) also considered static and shared for all users of the class?

If the method is not accessing other static variables,
and is only working with references/values that are stored on the stack (in
other words, declared in the function), then you should have nothng to worry
about. The only thing you have to worry about at this point is other
resources you might be accessing (for example, the same file, if you are
working with files).

Tuesday, July 19, 2005

Can you find YY on this page?

This picture is supposed to taken by a professional photographer, well, can you tell how professional it is. If you cannot, then you have the same idea as mine, the so-called professional photographer is totally bullshit.

Monday, July 18, 2005

The priorty date issue.

[Email from my attorney:

You are going to create a serious problem for yourself if you continue to try and use multiple avenues to push this along. The DOL and USCIS are going to start to push back. Up to now, I think your calls and actions have been just a question of impatience, but you are about to cross the line to a problem. I have seen cases where the agencies get calls from several sources, dig in their heels, and do nothing just to spite the individual because they feel there is too much pressure.

Please, I am serious. If you want me to work on this, you are going to have to back off and be patient. If you are convinced that you need to call dozens of people and push hard, I will be happy to submit a withdrawal letter, and you can handle it on your own. However, I can't do both. You need to make a decision whether you are going to handle your case on your own, or whether you want me to continue to work on it.

I called John today and left a voice mail. I will talk to him when he calls, and see what I can do to find out where in the process the information is stuck, if in fact it is stuck at all. But if you are going to make calls through Congressional offices, have the lawyer call, have the manager call, and check back a few days later for all, you are going to sabotage the process. I know that the government agencies will ignore the file if they think that is what is going on.

Well, I feel a little bit frustrating. I think Rob did a pretty good job on my case, and I don't have any issues with him. After all, the whole thing is not his responsbilty. But it still frustrates me, I have been waiting for this for the last three years, and every step seems to have a lot of pains. I adimit it is an issue because I have limited ability. If I am truley outstanding, I may not have to go through this painful process.

Life is life, you just have to live with it. If you spend more time improve yourself, there will be less pain ahead.

Sunday, July 17, 2005

Columbus, Ohio: Dentist Reviews, Dentist Ratings, Dentist Recommendations and Dentist Help.

Columbus, Ohio: Dentist Reviews, Dentist Ratings, Dentist Recommendations and Dentist Help.

Well, I was suggested by my dentist to get my wisdom teeth out. Since xiaoyi had very bad experiences when she did it two year ago, and I am a little bit worried. I don't want to lie on the bed for two weeks after doing the surgery.

This seems a pretty good place to see other people's reviews about a particular dentist. Unfortunately, it is not very complete.

Tactus Touch Typing Keyboard - Keyboard Posture - Correct Posture

Tactus Touch Typing Keyboard - Keyboard Posture - Correct Posture

I feel a little bit hurt on my back of arms, and I think it is caused by incorrect posture of typing posture. It is very important to keep it right.

Friday, July 15, 2005

A regular expression help from C# newsgroup

: I am trying to parse out the apratment number in a regular expression :
: If I use
: Regex regex = new
: Regex(@"[...](?\bAPT|#|UNIT\b)[...]",
: RegexOptions.ExplicitCapture);
: I will be able to parse out "100 main ST # C)
: But if I move "#" position in regular expression, I won't be able to
: parse out the same address anymore.
: Regex regex = new
: Regex(@"[...](?\bAPT|UNIT|#\b)[...]",
: RegexOptions.ExplicitCapture);

The latter fails to match because there's no word boundary (\b) between
an octothorpe and a space. Remember, a word boundard occurs between a
\w and a \W or vice versa, but '#' and ' ' both match \W.

A start in the right direction is (line breaks inserted):


Hope this helps,

Thursday, July 14, 2005

The powerful unit testing.

The whole idea of unit testing is to ensure that you won't break already-working codes when you refactoring. Address Parsing is a very good example, there are a lot of different situations, and it's very easily that you break some codes when you modify the regular expression rules.

The better way is to put everything into an XML file, and run the parsing through the XML file every time when modifying something. That way, you will always ensure that something already working well won't be broken when regular expression rules are added, modified, or delete.

Another way to learn from JTS, the great library.

Wednesday, July 13, 2005

How JTS cropping works.

JTS is very cool, the algorithm is complex but really powerful. All the intersection/union/difference/symmetry difference operations in all kinds of geometry types could be done in a very generic algorithm.

How the cropping works, here is what I understood:

1> The first step is to get all the intersection points between two geometries. The algorithm used here is the sweep-line algorithm.

2> Then it will need to create the split edges based on those intersection points. The split edge is the edge between two intersection points on the same geometry.

3> For each split edge, we have two directed edge end generated from it. One is starting from the beginning, and the other one is starting from the end. For the labelling, if it starts from the beginning, it will use the parent edge label, if it starts from the end, it will filp the parent edge label.

4> Based on those directed edges, we can create a planar graph, and all the vertices in the graph are made from the starting point of the directed edge end.

5> We need compute the labels (topological relationship) of the directed edge and vertice relative to the two different geometries.
a> Each edge end in the edge end map has a label.
b> The edge end star map has its own label, which will be used to update the label of the node.
c> Get the starting edge in the edge end star map, loop through each edge in the edge end map, and compute the labelling location.
d> We also need to merge the label from one directed edge with its symmentric directed edge.
e> Merge the label of the node with the label of the edge end star map.

6> We can determine whether each edge is in result or not based on the topological relationship with two geometries. For each different operation like intersection / union / difference, the criteria to determine whether it is in result is different.

7> We sort each vertice in the planar graph firstly by X coordinate, then by Y coordinate. By looping each vertice in the graph, we will determine how the edges in each vertice link together.

8>For the polygon building, we must determine which edge will actually qualify for the result polygon. There are generally three conditions which will make it qualify for the polygon edge:
8-a. The label of the edge has to show that it is an area edge to both geometries.
8-b. The edge is not an interior area edge. The interior area ege means that the label is an area label for both geometries and for each geometry, both sides are interior.
8-c. The right sides of the edge to both geometries should be inside.

9>We build the maximal edge ring and minimum edge ring based on linking results.
The maximal edge rings will be built firstly, and then we loop through each node. If there are more than one outgoing directed edge which is in result, we must consider the minimal edge ring too. Because if we have one more outgoing edge in one particular vertice, it means that we cannot simply link the edge to form a polygon, we must do another step to form the minimum edge ring, which is based on the maximum edge ring.

10> The actual geometries are built based on the linking results. If there are only maximum edge rings, then build polygons based on that. If there are minimum edge rings, then we need build polygon based on it instead of maximum edge rings.

11> We will collect the geometries in the following order: polygons firstly, lines second, and points last. The lines could be generated by an input geometry of line, or
two touching polygons.

Monday, July 11, 2005

Very good regular expression site.

Very good regular expression site.

The world of regular expression is very exciting, but it is also very error prone when you try to build those complex rules. A good rule is very helpful to understand and build the rules. Regular Expression Workbench at is very powerful tool to build the expression rules dynamically.

I mainly use the regular expression rule for the address parsing. The previous method I used is brute-force parsing, it's not very pleasant though it does the work. In the newer version, I hope I can build a much powerful tool to parse the address, and hopefully, publish it to the

Thursday, July 07, 2005

UML Diagrams

UML Diagrams

A simple introduction to UML diagrams.

Obfuscation and Decompilation

Obfuscation and Decompilation

Good Article about Obfuscation and Decompilation.