CedictPlus is released

CedictPlus

Add POS information into CEDICT dictionary

What is a CEDICT

It is a Chinese-English dictionary. CEDICT (present name CC-CEDICT) is merely a text file. The entry number is about 100K. See Wikipedia

The basic format of a CC-CEDICT entry is:

	Traditional Simplified [pin1 yin1] /English equivalent 1/equivalent 2/

For example:

	中國 中国 [Zhong1 guo2] /China/Middle Kingdom/

What does this Project do?

  1. Add POS information into dicionary

    中國 中国 [Zhong1 guo2] (noun) /China/Middle Kingdom/
  2. Add semantic information of translation if possible. (this is not opened yet)

Which kinds of POS does it support?

  • verb
  • noun
  • adj
  • adv
  • sub (for all other types)

Where is the dictionary?

download from github

Release

initial, Sat Apr 28 17:35:51 CST 2012

On in

Why I have no friend in SO ?

Description

A very intersting discuss about adding more Social Function into SO, and the conclusion is "SO is not SN, and StackOverflow is not FriendOverflow".


Orz...TooSocialException

"http://meta.stackoverflow.com/questions/886/a-friends-list-on-stack-overflow-would-be-nice"

If I had any friends. This would be a great idea. Ólafur Waage

Olafur.Friends.AddNew(new Friend("Jonathan Sampson")); Jonathan Sampson

Aww thank you, so nice. Ólafur Waage

Olafur.Enemies.AddNew(new Enemy("R. Bemrose")); // Just to even things out Powerlord

Error: Undefined Method "Enemies". Ólafur Waage

Olafur.prototype.Enemies = Olafur.prototype.Friends; //I'm sorry, what language are we writing on again? perbert

These comments happen to explain why you have no friends :) John Rasch

I have lots of friends.... on facebook. Ólafur Waage

Chacha102.Powers.Add(new Role("Super Admin")); Chacha102

I would love to vote all the comments up in this answer. But that would throw a new TooSocialException; sorry folks. Shaharyar

delete Ólafur; // :o!. GManNickG

Friend[] getNewFriend () { friends.Add( new Friend() ); yield return getNewFriend; } uh-oh.... FriendOverflow Atomiton

@Jonathan Sampson NullPointerException Daniel Moura

Do you want a FaceOverflow ?

IMHO, "a is a, b is b." (in Chinese "A是A,B是B")

In SO, I am struggling to gain my Reputation at here.

And, I have just posted my first message in Weibo. Welcome go to see see "My Weibo".

On in

This is not the way to do a tree structure

from codeproject Auther: Daniel Parnell

This is not the way to do a tree structure!

I don’t know how many times I’ve had to deal with tree structures implemented like this. I know I made this same mistake when I was starting out with databases. On the surface it looks like the way to do it, but there are several much better ways to do it. The problem with this approach is that traversing the tree is a very expensive operation. If the tree is only 2 or 3 levels deep this may not be a problem, but as soon as the tree starts to get deep it does not scale well (I remember getting yelled at by a DBA for doing this ).

One of the easiest ways to implement a tree structure that is easy to traverse is to use a structure as follows:

 
create table my_tree (
  id int IDENTITY(1,1) NOT NULL,
  path VARCHAR(200) not null,
  title nvarchar(200) not null
)

We make a trade off between disk space and access speed. This would allow us to easily store a tree with 50 levels or more (make the path column longer to allow deeper trees).

idpathtitle
1/this is the root
2/1this is the first item under the root
3/1another item under the root
4/1/2an item under the first item under the root
5/1/2/4a deeper item

To get the whole tree you can then do the following:

  
select * from my_tree order by  path+'/'+cast(id as varchar)

The expression in the order by could be eliminated if the path were updated to contain the full path to the node rather than the path to the parent. To do this nicely we would need to pre-allocate the node ID or use some other method for identifying the nodes that does not relate to the ID column.

To get a sub-tree:

select * from my_tree where path like '/1/2/%' order by  path+'/'+cast(id as varchar)

Similarly deleting a sub-tree becomes:

 
delete from my_tree where path like '/1/2/%'

Moving items around in the tree becomes a little more complicated.

update my_tree set path='/1/3/'+substring(path, 6, 1000) where path like '/1/2/%'

There are a couple of even more efficient ways of implementing trees, but they are a lot more complicated to implement. See here an example

More about Sqlite3 (by wuliang)

In SQlite3, there should be some modification like this:

update my_tree set path='/1/3/'|| substr(path, 6) where path like '/1/2/%'
On in

My Resume

个人简历 (Resume)

我的个人简历发布了。My resume is released.

alternate text

– install wl as soon as possible –

#

中文在线(Chinese Online)

英文在线(English Online)

中文PDF(Chinese PDF)

英文PDF(English PDF)

中文简版PDF(Chinese Plain PDF)

#

如有疑问,请留言。或者发邮件。

(If you have any question, please feel free to add comment or mail me.)

On in

Tibet Travel

Tibet Travel

This post contains some pictures taken in Tibet, during the travel in May 2011.

alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text

Go to Flickr Set “Tibet Travel” for more travel records.

On in

Japan Scenes

Japan Scenes

This post contains some beautiful pictures taken in Japan, most by my wife.

alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text alternate text

Go to Flickr Set “Japan Scenes” for more beautiful photos.

On in

Secrets Of The Javascript Ninja

http://ejohn.org/apps/learn

Secrets of the JavaScript Ninja

This tutorial contains code and discussion from the upcoming book “Secrets of the JavaScript Ninja” by John Resig. It is a perfect tuition including 90 pages, and reader can edit code ,run code and see the result.

Check my studying

Goal: To be able to understand this function (according to page 2)

// The .bind method from Prototype.js 
Function.prototype.bind = function(){ 
  var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift(); 
  return function(){ 
    return fn.apply(object, 
      args.concat(Array.prototype.slice.call(arguments))); 
  }; 
};

My Answer:

// The .bind method from Prototype.js 
Function.prototype.bind = function(){ 
/*
[1] "this" used to record the context when call function is bound.
Usually "this" is the object contain the function to be bound.

[2] "slice" is used to generate  real array from a pesudo-array(here is arguments), 
so array functions can be used. Use "call" to give slice a context(data)  to operate on. 
By default, we "new Array()" to generate a object and "object.slice" will make "object" as context.

[3] "shift" fetch the 1st parameter, and remain others in "args"

[4] variants of "fn, object, args" in the anonymous function will be  
closured(record their values and used when the function is invoked) 

[5] "args.concat" means the real parameters feed the function (object) 
will include the parameters given in "binding" phase, and parameters 
given in "callback" phase. 
*/

  var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift(); 
  return function(){ 
    return fn.apply(object, 
      args.concat(Array.prototype.slice.call(arguments))); 
  }; 
};
On in

Function Apply Vs Call

http://www.mennovanslooten.nl/blog/post/65

Function.apply() and Function.call()

I’ve been meaning to write this post for a while, now, mostly as a reminder to myself. The subject is the two methods available for all JavaScript functions: apply() and call(). Confusingly, they both do the same thing in very, very similar ways: executing the function in the scope of a specified object. I’ve always had trouble remembering their major difference, however, so I decided to finally write this post and hope it sticks.

What they both do

I can make this a very technical post about the ins and outs of these methods or I can just summarize by writing the following: apply() and call() allow you to specify whatthiswill refer to inside that function, even when that function is a method on another object. An example:

var someObject = {
    myProperty : 'Foo',
    myMethod : function() {
        alert(this.myProperty);
    }
};
someObject.myMethod(); // alerts 'Foo'

var someOtherObject  = {
    myProperty : 'Bar'
};
someObject.myMethod.call(someOtherObject); // alerts 'Bar'
someObject.myMethod.apply(someOtherObject); // alerts 'Bar'

As you can see, even thought it is someObject’s method that is executed, call() and apply() allows me to specify that the keyword this refers to someOtherObject.

The difference

The difference between these methods is in the way you can pass arguments to the original function. Let’s extend the example to include arguments:

var someObject = {
    myProperty : 'Foo',
    myMethod : function(prefix, postfix) {
        alert(prefix + this.myProperty + postfix);
    }
};
someObject.myMethod('<', '>'); // alerts '<Foo>'

var someOtherObject  = {
    myProperty : 'Bar'
};
someObject.myMethod.call(someOtherObject, '<', '>'); // alerts '<Bar>'
someObject.myMethod.apply(someOtherObject, ['<', '>']); // alerts '<Bar>'

Obviously, the difference is this: If you want to pass arguments to the function apply() needs an array and call() needs a list of arguments. That’s it! Ridiculously hard to remember, I know.

On in

请在这里留言

欢迎在这里留言

这里是讨论组

Welome to discuss board.

Any words will be recorded by system.

On in

I Love Jekyll and Github

I love Jekyll Bootstrap and GitHub as a blog platform — so much so that I’m sure I’ll write posts more often than once a year. Really. As a frontend developer and pixel-pusher, it might be the most pleasurable way to blog that I’ve tried yet. Not that I’ve tried much, but hear me out.

On in

中文可以吗

这是吴亮的个人博客.

标题一

标题二

Jekyll is a parsing engine bundled as a ruby gem used to build static websites from dynamic components such as templates, partials, liquid code, markdown, etc. Jekyll is known as “a simple, blog aware, static site generator”.

教学

下一步

On in