2012年3月25日 星期日

Regular Expression

Amazing Online Tool: http://gskinner.com/RegExr/

General Advice:
  1. Don't try to get everything in one reg exp. I spent many many hours trying to make one that would get all emails. Even if you minimize the false negatives, you'll have a ton of false positives to address.
  2. Try doing multiple pass reg exp. That is, if you get made a reg exp that gets all sorts of dots (dot,dt,.,;), group the variables that have a dot together and do a second pass that converts them to your normal .
  3. there is a very real difference between + * ? and the various combinations of them. Know these when you are trying to remove false positives
  4. Break up your reg exp in parts (see post by Sergey Zhidkov)
  5. Normalize your inputs

Feel free to add to this via comments, and if I can edit this post, I'll add em to the top. =]

=================================================

A couple of tips for writing complex regular expressions.

1) You can construct your regexp from smaller pieces. For example:

 # An oversimplified and likely incorrect python example.  :)   tld_list = ['edu', 'com']  tld_re = r'(?:%s)' % '|'.join(tld_list)  subdomain_re = r'(?:[a-z]+\.)+'  name_re = r'[a-z]+'   mail_re = r'(%s)@(%s%s)' % (name_re, subdomain_re, tld_re)

Then you compile your resulting expression as usual.

2) Both Python and Java have the 'x' flag for regular expressions that allows you to add whitespace and comments. So you could have written the above as:

   ([a-z]+)            # user name    @(                  # host name, consisting of:       (?:[a-z]+\.)+       # repeated subdomain labels       (?:com|edu)         # tld suffix    )''', re.I + re.X)

2009年5月19日 星期二

Stephen Wolfram and Wolfram Alpha

Stephen Wolfram, a genius of engineer on mathmatic, physic and computer science.
At 5/17, release his [computational knowledge engine]- Wolfram alpha.

Beside, he also wrote a book - A new kind of science. Hope someone can translate this book into Chinese.

2009年5月14日 星期四

[SQL] Stored Procedure & Trigger

Stored Procedure (wiki)

A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a proc, sproc, StoPro, or SP) are actually stored in the database data dictionary.

Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.

Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement[citation needed]

Trigger (wiki)

A database trigger is procedural code that is automatically executed in response to certain events on a particular table in a database. Triggers can restrict access to specific data, perform logging, or audit data modifications.

There are two classes of triggers, they are either "row triggers" or "statement triggers". Row triggers define an action for every row of a table, while statement triggers occur only once per INSERT, UPDATE, or DELETE statement. Triggers cannot be used to audit data retrieval via SELECT statements.

Each class can be of several types. There are "BEFORE triggers" and "AFTER triggers" which identifies the time of execution of the trigger. There is also an "INSTEAD OF trigger" which is code that gets executed instead of the triggering statement.

There are typically three triggering events that cause triggers to 'fire':

  • INSERT event (as a new record is being inserted into the database).
  • UPDATE event (as a record is being changed).
  • DELETE event (as a record is being deleted).

The trigger is used to automate DML condition process.

The major features of database triggers, and their effects, are:

  • do not accept parameters or arguments (but may store affected-data in temporary tables)
  • cannot perform commit or rollback operations because they are part of the triggering SQL statement (only through autonomous transactions)
  • can cause mutating table errors, if they are poorly written.
Reference
  1. MS SQL Server的T-SQL指令、Stored Procedure與Trigger
  2. 如何使用MySQL的Stored Procedure與Trigger
  3. CREATE TRIGGER (Transact-SQL)

EeeLearning Research

1. ubutu
ubutu is a E-learning platform with a grate authoring tool, it allows user to search, join and study course on Facebook, and the authoring tool is a friendly and easily using for teachers, even they are not familiar with computer editing.

2. Sakai
Sakai is a JAVA open source project, maybe I will using Sakai in our project.

3. Moodle
Moodle is a PHP open source project, the candidate of our project.

4. BlackBoard
The newest version of bb is fill of Web2.0 elements, drag and drop, i-google like blocks and so on.

2009年4月27日 星期一

Desktop UI Design

Bumptop was a project initiated from University of Toronto’s master student’s Anand Agarawala MS thesis a couple years ago.
http://bumptop.com/

from this application, there are some ideas that is good for next general UI
1. pop up list from sequent list to circular list.
2. gesture will bring good experience.
3. 3D or reall world behavior.

2009年4月23日 星期四

3D effect technick on Web browser

Today, beside Canvas 3D JS Library(C3DL) technology, Google announce their own 3D technic called O3D, using O3D API developer can easily creates 3D objects on any kind of browser.
The following URL is the related references.

C3DL: https://developer.mozilla.org/en/HTML/Canvas
O3D offical web site: http://code.google.com/intl/zh-TW/apis/o3d/
O3D news: http://droger.pixnet.net/blog/post/23710192

2009年2月23日 星期一

Hi, welcome to NokiaDDT's Blog

My cowork give me a suggestion that maybe I can start write down some technic news so that they can trace my blog to get new information.
So I'm tring now, hope this blog will help you in somewhere, and hope me can continue to manage this blog. ^^!