2015年8月15日 星期六

Sequence diagram reference



Sequence Diagrams Reference

NotationDescription
Lifeline
Lifeline data of class Stock.
Lifeline with name "data" of class Stock.
A Lifeline is shown using a symbol that consists of a rectangle forming its “head” followed by a vertical line (which may be dashed) that represents the lifetime of the participant.
Anonymous lifeline of class User.
Anonymous lifeline of class User.
Anonymous lifeline has no name - arbitrary representative of class.
Lifeline x selected with [k] of class X.
Lifeline "x" of class X is selected with selector [k].
Selector could be used to specify some lifeline from collection.
Execution
Execution specification represented as grey rectangle on the Service lifeline.
Execution specification shown as grey rectangle on the Service lifeline.
Execution (full name - execution specification, informally called activation) is interaction fragment which represents a period in the participant's lifetime when it is
  • executing a unit of behavior or action within the lifeline,
  • sending a signal to another participant,
  • waiting for a reply message from another participant.
The duration of an execution is represented by two execution occurrences - the start occurrence and the finish occurrence.
Execution is represented as a thin grey or white rectangle on the lifeline.
Execution Specification represented as wider rectangle labeled as action.
Execution represented as wider rectangle labeled as action.
Execution can be represented by a wider labeled rectangle, where the label usually identifies the action that was executed.
Overlapping execution specifications on the same lifeline - message to self.
Overlapping execution specifications on the same lifeline - message to self.
Overlapping executions on the same lifeline are represented by overlapping rectangles.
Overlapping execution specifications on the same lifeline - callback message.
Overlapping execution specifications on the same lifeline - callback message.

Message
Message is a named element that defines one specific kind of communication between lifelines of an interaction. The message specifies not only the kind of communication, but also the sender and the receiver. Sender and receiver are normally two occurrence specifications (points at the ends of messages).
A message is shown as a line from the sender message end to the receiver message end. The line must be such that every line fragment is either horizontal or downwards when traversed from send event to receive event. The send and receive events may both be on the same lifeline. The form of the line or arrowhead reflects properties of the message.
Messages by Action Type
Depending on the type of action that was used to generate the message, message could be one of:
Synchronous Call
Web Client searches Online Bookshop and waits for results.
Web Client searches Online Bookshop and waits for results.
Synchronous call typically represents operation call - send message and suspend execution while waiting for response. Synchronous Messages are shown with filled arrow head.
Asynchronous Call
Service starts Task and proceeds in parallel without waiting.
Service starts Task and proceeds in parallel without waiting.
Asynchronous call - send message and proceed immediately without waiting for return value. Asynchronous Messages have an open arrow head.
Asynchronous Signal
Asynchronous signal message corresponds to asynchronous send signal action.
Create Message
Online Bookshop creates Account.
Online Bookshop creates Account.
Create message is sent to lifeline to create itself. Note, that it is weird but common practice in OOAD to send create message to a nonexisting object to create itself. In real life, create message is sent to some runtime environment.
Create message is shown as a dashed line with open arrowhead (same as reply), and pointing to created lifeline's head.
Delete Message
Online Bookshop terminates Account.
Online Bookshop terminates Account.
Delete message (called stop in previous versions of UML) is sent to terminate another lifeline. The lifeline usually ends with a cross in the form of an X at the bottom denoting destruction occurrence.
UML 2.3 specification provides neither specific notation for delete message nor a stereotype. Until they provide some notation, we can use custom «destroy» stereotype.
Reply Message
Web Client searches Online Bookshop and waits for results to be returned.
Web Client searches Online Bookshop and waits for results to be returned.
Reply message to an operation call is shown as a dashed line with open arrow head.
Messages by Presence of Events
Depending on whether message send event and receive events are present, message could be one of:
Lost Message
Web Client sent search message which was lost.
Web Client sent search message which was lost.
Lost Message is a message where the sending event is known, but there is no receiving event. It is interpreted as if the message never reached its destination. Lost messages are denoted with as a small black circle at the arrow end of the message.
Found Message
Online Bookshop gets search message of unknown origin.
Online Bookshop gets search message of unknown origin.
Found Message is a message where the receiving event is known, but there is no (known) sending event. It is interpreted as if the origin of the message is outside the scope of the description. This may for example be noise or other activity that we do not want to describe in detail.
Found messages are denoted with a small black circle at the starting end of the message.
Destruction Occurrence
Account lifeline is terminated.
Account lifeline is terminated
Destruction occurrence is a message occurrence which represents the destruction of the instance described by the lifeline. It may result in the subsequent destruction of other objects that this object owns by composition. No other occurrence may appear below the destruction on a given lifeline.
Complete UML name of the occurrence is destruction occurrence specification. Until UML 2.4 it was called destruction event, and earlier - stop.
The destruction of instance is depicted by a cross in the form of an X at the bottom of a lifeline.
State Invariant
Attribute t of Task should be equal to complete.
Attribute t of Task should be equal to complete.
A state invariant is an interaction fragment which represents a runtime constraint on the participants of the interaction. It may be used to specify different kinds of constraints, such as values of attributes or variables, internal or external states, etc.
State invariant is usually shown as a constraint in curly braces on the lifeline. 
Task should be in Finished state.
Task should be in Finished state.
It could also be shown as a state symbol representing the equivalent of a constraint that checks the state of the object represented by the lifeline. This could be either the internal state of the classifier behavior of the corresponding classifier or some external state based on a "black-box" view of the lifeline.
Combined Fragment
Interaction operator could be one of:
Alternatives
Sequence operator alt example.
Call accept() if balance > 0, call reject() otherwise.
The interaction operator alt means that the combined fragment represents a choice or alternatives of behavior. At most one of the operands will be chosen. The chosen operand must have an explicit or implicit guard expression that evaluates to true at this point in the interaction.
Option
Interaction operator opt example.
Post comments if there were no errors.
The interaction operator opt means that the combined fragment represents a choice of behavior where either the (sole) operand happens or nothing happens. An option is semantically equivalent to an alternative combined fragment where there is one operand with non-empty content and the second operand is empty.
Loop
Potentially infinite loop.
Potentially infinite loop.
If loop has no bounds specified, it means potentially infinite loop with zero as lower bound and infinite upper bound.
Loop to execute exactly 10 times.
Loop to execute exactly 10 times.
If only min-int is specified, it means that upper bound is equal to the lower bound, and loop will be executed exactly the specified number of times.
Loop will execute minimum 5 times max 10 times unless guard is false.
We may guess that as per UML 2.3, the loop is expected to execute minimum 5 times and no more than 10 times. If guard condition [size<0 becomes="" do="" false="" hen="" iterations="" loop="" min="" minimum="" need="" number="" of="" p="" regardless="" specified.="" specified="" terminates="" that="" the="" we="" why="">
If both bounds are specified, loop will iterate minimum the min-int number of times and at most the max-int number of times.
Besides iteration bounds loop could also have an interaction constraint - a Boolean expression in square brackets. To add to the other confusions, UML 2.3 also calls both of them guards.
UML tries to shuffle the simplest form of for loop and while loop which causes weird UML 2.3 loop semantics on p.488: "after the minimum number of iterations have executed and the Boolean expression is false the loop will terminate". This is clarified - with opposite meaning - on the next page as "the loop will only continue if that specification evaluates to true during execution regardless of the minimum number of iterations specified in the loop."
Break
Break enclosing loop if y>0.
Break enclosing loop if y>0.
The interaction operator break represents a breaking or exceptional scenario that is performed instead of the remainder of the enclosing interaction fragment.
Note, UML allows only one level - directly enclosing interaction fragment - to be abandoned. This could become really annoying if double loop or loop with other combined fragments should be broken.
Parallel
Search Google, Bing and Ask in any order, possibly parallel.
Search Google, Bing and Ask in any order, possibly parallel.
The interaction operator par defines potentially parallel execution of behaviors of the operands of the combined fragment. Different operands can be interleaved in any way as long as the ordering imposed by each operand is preserved.
Coregion - search Google, Bing and Ask in any order, possibly parallel.
Coregion - search Google, Bing and Ask in any order, possibly parallel.
Parallel combined fragment has a notational shorthand for the common situations where the order of events on one lifeline is insignificant. In a coregion area of a lifeline restricted by horizontal square brackets all directly contained fragments are considered as separate operands of a parallel combined fragment.
Strict Sequencing
Search Google, Bing and Yahoo in the strict sequential order.
Search Google, Bing and Yahoo in the strict sequential order.
The interaction operator strict requires a strict sequencing (order) of the operands on the first level within the combined fragment.
Weak Sequencing
Search Google, Bing and Yahoo in the strict sequential order.
Search Google possibly parallel with Bing and Yahoo, but search Bing before Yahoo.
Weak sequencing seq is defined by the set of traces with these properties:
  • The ordering of occurrence specifications within each of the operands are maintained in the result.
  • Occurrence specifications on different lifelines from different operands may come in any order.
  • Occurrence specifications on the same lifeline from different operands are ordered such that an occurrence specification of the first operand comes before that of the second operand.
Thus weak sequencing seq reduces to a parallel merge when the operands are on disjunct sets of participants. Weak sequencing reduces to strict sequencing when the operands work on only one participant.
Critical Region
Add() or remove() could be called in parallel, but each one should run as a critical region.
Add() or remove() could be called in parallel, but each one should run as a critical region.
The interaction operator critical defines that the combined fragment represents a critical region. A critical region is a region with traces that cannot be interleaved by other occurrence specifications (on the lifelines covered by the region). This means that the region is treated atomically by the enclosing fragment and can't be interleaved, e.g. by parallel operator.
Ignore
Ignore get and set messages, if any.
Ignore get and set messages, if any.
Interaction operator ignore means that there are some messages that are not shown within this combined fragment. These message types can be considered insignificant and are implicitly ignored if they appear in a corresponding execution.
The list of ignored messages follows the operand enclosed in a pair of curly braces "{" and "}". Ignore operation is typically combined with other operations such as "assert ignore {m, s}."
Consider
Consider only add() or remove() messages, ignore all others, if any.
Consider only add() or remove() messages, ignore any other.
The interaction operator consider defines which messages should be considered within this combined fragment, meaning that any other message will be ignored.
The list of considered messages follows the operand enclosed in a pair of curly braces "{" and "}". Consider operation is typically combined with other operations such as "assert consider {m, s}."
Assert
Commit() message should occur, following with state invariant evaluation.
Commit() message should occur at this point, following with evaluation of state invariant.
The interaction operator assert means that the combined fragment represents the assertion that the sequences of the assert operand are the only valid continuations (must be satisfied by a correct design of the system). All other continuations result in an invalid trace.
Negative
Should we receive back timeout message, it means the system has failed.
Should we receive back timeout message, it means the system has failed.
The interaction operator neg describes combined fragment of traces that are defined to be negative(invalid). Negative traces are the traces which occur when the system has failed. All interaction fragments that are different from the negative are considered positive, meaning that they describe traces that are valid and should be possible.
Interaction Use
Web customer and Bookshop use (reference) interaction Checkout.
Web customer and Bookshop use (reference) interaction Checkout.
Interaction use is interaction fragment which allows to use (or call) another interaction. Large and complex sequence diagrams could be simplified with interaction uses. It is also common reusing some interaction between several other interactions.
The interaction use is shown as a combined fragment with operator ref.
Use Login interaction to authenticate user and assign result back to the user attribute of Site Controller.
Use Login interaction to authenticate user and assign result back to the user attribute of Site Controller.
The syntax of the interaction use of the ref operator is:
interaction-use ::= [ attribute-name '=' ] [ collaboration-use   '.' ]   interaction-name [ io-arguments ]   [ ':' return-value ] 
io-arguments ::= '(' io-argument   [ ',' io-argument ]*   ')' 
io-argument ::= in-argument   |   'out'   out-argument

reference : http://www.uml-diagrams.org/sequence-diagrams-reference.html

2015年8月13日 星期四

Microsoft Visio 2010 extensions - stencil and template

Stencil and Template for Visio 2010
Visio 2010 represents the first noticeable improvement in usability since Visio 2000, but no enhancement in the funtionality, upon which the UML 2.2 shapes are built upon. Therefore, the shapes for Visio 2010 are the same as for Visio 2007; there are minor changes in the template.

Install: If you'd like the template to appear in the "Software and Database" category when you click File/New, together with Visio's own templates, create in any folder a subfolder called "Software and Database", for example, "...\My Documents\My Shapes\Software and Database". You could choose any folder, except of the Visio program folder, i.e., don't use C:\Program Files\Microsoft Office\Office14\Visio Content\1033. Unzip the stencils and template into "...\My Documents\My Shapes\Software and Database" or the folder you created.

Start Visio, click the File tab, click Options, click Advanced, and then, under General at the very bottom, click File Locations. Type full path of this folder without the last segment "Software and Database" into the fields "Stencils" and "Templates". That is, type in "C:\Document and Settings\\My Documents\My Shapes\" . The template "UML 2.2 Template (Visio 2010)" will appear in the category "Software and Database".

If you'd like the UML 2.2 template to appear in another category, such as a "UML" category, use "UML" instead of "Software and Database" in the steps above.
The stencils and template are here: UML2.2-Visio2010.zip.

reference : http://www.softwarestencils.com/uml/#Visio2010

2015年7月28日 星期二

Bootstrap 3 smooth accordion transitions

Just updating transition should work
.collapsing { transition: height 0.6s; }

reference : http://stackoverflow.com/questions/20874492/bootstrap-3-smooth-accordion-transitions

2015年7月23日 星期四

超強的Linux指令解釋網站《explainshell.com》,學Linux必備!

image
雖然現代的作業系統都已經有圖形化使用者界面(GUI)了,但是作業系統也都有提供純文字的指令模式,讓使用者可以直接下指令或撰寫script。當我們在學Linux指令時,最怕的就是一堆又臭、又長又看不懂的指令及參數,如果遇到複合指令時,想查說明頁(manpage)真的相當相當麻煩。今天阿正老師要推薦一個非常好用的Linux指令解釋網站《explainshell.com》,當你遇到看不懂的指令時,只要將指令貼到該網站,就有完整的說明可以使用,讓你學習或使用Linux指令更加得心應手喔!快來試試看吧!

學過計算機概論的讀者,應該都知道「Shell」這個東西。維基百科對於Shell的解釋為:
殼層(英語:Shell)在電腦科學中,是指「提供使用者使用介面」的軟體,通常指的是命令列介面的解析器。一般來說,這個詞是指作業系統中,提供存取核心所提供之服務的程式。Shell也用於泛指所有為使用者提供操作介面的程式,也就是程式和使用者互動的層面。因此與之相對的是程式核心(英語:Core),核心不提供和使用者的互動功能。
不過這個詞也拿來指應用軟體,或是任何在特定元件外圍的軟體,例如瀏覽器或電子郵件軟體是HTML排版引擎的shell。Shell這個詞是來自於作業系統(核心)與使用者介面的外層介面。
通常將殼層分為兩類:命令列與圖形介面。命令列殼層提供一個命令列介面(CLI);而圖形殼層提供一個圖形使用者介面(GUI)。

因為作業系統是人類與電腦之間的橋樑,如果把電腦比喻為一顆雞蛋,電腦的硬體就是蛋黃,作業系統就是蛋白,而作業系統提供給人們操作的環境就是蛋殼,也就是「Shell」,早期的作業系統都只提供文字模式的界面,如DOS、UNIX …,後來才有圖形使用者界面的產生,讓人們可以用滑鼠來操作電腦。
不過純文字的命令模式還是相當重要,例如你想批次執行一些指令,在Windows內可以編寫一個.BAT(批次檔),在UNIX-Like作業系統則是編寫script。如下圖就是Windows裡面的「命令提示字元」視窗:
SNAGHTML38d691
今天阿正老師要介紹的這個explainshell.com是一個專門幫你解釋Linux指令的網站,網站作者Idan Kamara利用Python語言擷取了多達29761頁的Ubuntu說明文件(manpages),幫你輕鬆將複雜的Linux指令給翻譯成容易理解的說明,不論你是Linux使用者、學習者或網路管理者,相信這個網站都是不可或缺的一個好工具,非常值得一試喔!

使用方式

ExplainShell


用瀏覽器打該explainshell網站,在中間的欄位輸入你欲查詢的Linux指令。下面有提供了幾個範例,可以直接點選範例來查看解釋。
SNAGHTML300167
例如我輸入了一個常用的解壓縮指令 「tar zxvf test.tar.gz」,該網站的解釋結果如下圖,可看到它清楚地將各個指令及參數以線條的方式連到底下的說明文字,當你將游標停在指令或參數上方時,該線條還會以高亮度來顯示解釋喔!
SNAGHTML30d7a9
如果你要解釋的是管道(pipeline)指令時,還可選擇要解釋全部(explain all)或是逐一指令解釋,可按下上方的←或→按鈕來切換(下圖紅色箭頭處)要解釋的指令。
image
當你想查看完整的指令說明(指令的後面會出現一個(1))時,只要用滑鼠點一下該指令,就會出現完整的說明頁面。以「find . –type f –print0」為例,按下畫面上方的「find(1)」:

image
就會顯示find的完整參數說明,是不是相當方便呢?
image

還在為了複雜的Linux指令所苦嗎?快來試試看ExplainShell.com這個好網站吧!

類似網站


解釋C語言:http://cdecl.org/
SNAGHTML48d5a7
解釋「正規表示法」(Regular expression)的網站:http://www.regexper.com/
SNAGHTML4c872a
###

reference : http://blog.soft.idv.tw/?p=1628

2015年7月17日 星期五

jQuery - Get the closest form

Native DOM elements that are inputs also have a form attribute that points to the form they belong to:
var form = element.form;
alert($(form).attr('name'));
According to w3schools, the .form property of input fields is supported by IE 4.0+, Firefox 1.0+, Opera 9.0+, which is even more browsers that jQuery guarantees, so you should stick to this.
If this were a different type of element (not an ), you could find the closest parent with closest:
var $form = $(element).closest('form');
alert($form.attr('name'));

reference : http://stackoverflow.com/questions/991367/how-to-get-the-form-parent-of-an-input

2015年5月11日 星期一

Installing pip on Mac OS X

All you need to do is
sudo easy_install pip

wibiya widget