<!--{{{-->

<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>

<!--}}}-->
Background: #fff

Foreground: #000

PrimaryPale: #8cf

PrimaryLight: #18f

PrimaryMid: #04b

PrimaryDark: #014

SecondaryPale: #ffc

SecondaryLight: #fe8

SecondaryMid: #db4

SecondaryDark: #841

TertiaryPale: #eee

TertiaryLight: #ccc

TertiaryMid: #999

TertiaryDark: #666

Error: #f88
/*{{{*/

body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}



a {color:[[ColorPalette::PrimaryMid]];}

a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}

a img {border:0;}



h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}

h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}

h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}



.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}

.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}

.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}



.header {background:[[ColorPalette::PrimaryMid]];}

.headerShadow {color:[[ColorPalette::Foreground]];}

.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}

.headerForeground {color:[[ColorPalette::Background]];}

.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}



.tabSelected{color:[[ColorPalette::PrimaryDark]];

	background:[[ColorPalette::TertiaryPale]];

	border-left:1px solid [[ColorPalette::TertiaryLight]];

	border-top:1px solid [[ColorPalette::TertiaryLight]];

	border-right:1px solid [[ColorPalette::TertiaryLight]];

}

.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}

.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}

.tabContents .button {border:0;}



#sidebar {}

#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}

#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}

#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}

#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}

#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}



.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}

.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}

.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}

.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];

	border:1px solid [[ColorPalette::PrimaryMid]];}

.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}

.wizardFooter {background:[[ColorPalette::PrimaryPale]];}

.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}

.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;

	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}

.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}

.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;

	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}



#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}

#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}



.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}



.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}

.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}

.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}

.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}

.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}

.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}

.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}



.tiddler .defaultCommand {font-weight:bold;}



.shadow .title {color:[[ColorPalette::TertiaryDark]];}



.title {color:[[ColorPalette::SecondaryDark]];}

.subtitle {color:[[ColorPalette::TertiaryDark]];}



.toolbar {color:[[ColorPalette::PrimaryMid]];}

.toolbar a {color:[[ColorPalette::TertiaryLight]];}

.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}

.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}



.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}

.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}

.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}

.tagging .button, .tagged .button {border:none;}



.footer {color:[[ColorPalette::TertiaryLight]];}

.selected .footer {color:[[ColorPalette::TertiaryMid]];}



.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}

.sparktick {background:[[ColorPalette::PrimaryDark]];}



.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}

.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}

.lowlight {background:[[ColorPalette::TertiaryLight]];}



.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}



.imageLink, #displayArea .imageLink {background:transparent;}



.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}



.viewer .listTitle {list-style-type:none; margin-left:-2em;}

.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}

.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}



.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}

.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}

.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}



.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}

.viewer code {color:[[ColorPalette::SecondaryDark]];}

.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}



.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}



.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}

.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}

.editorFooter {color:[[ColorPalette::TertiaryMid]];}



#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}

#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}

#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }

#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}

#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}

#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}

.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}

.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}

#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}

/*}}}*/
/*{{{*/

* html .tiddler {height:1%;}



body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}



h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}

h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}

h4,h5,h6 {margin-top:1em;}

h1 {font-size:1.35em;}

h2 {font-size:1.25em;}

h3 {font-size:1.1em;}

h4 {font-size:1em;}

h5 {font-size:.9em;}



hr {height:1px;}



a {text-decoration:none;}



dt {font-weight:bold;}



ol {list-style-type:decimal;}

ol ol {list-style-type:lower-alpha;}

ol ol ol {list-style-type:lower-roman;}

ol ol ol ol {list-style-type:decimal;}

ol ol ol ol ol {list-style-type:lower-alpha;}

ol ol ol ol ol ol {list-style-type:lower-roman;}

ol ol ol ol ol ol ol {list-style-type:decimal;}



.txtOptionInput {width:11em;}



#contentWrapper .chkOptionInput {border:0;}



.externalLink {text-decoration:underline;}



.indent {margin-left:3em;}

.outdent {margin-left:3em; text-indent:-3em;}

code.escaped {white-space:nowrap;}



.tiddlyLinkExisting {font-weight:bold;}

.tiddlyLinkNonExisting {font-style:italic;}



/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */

a.tiddlyLinkNonExisting.shadow {font-weight:bold;}



#mainMenu .tiddlyLinkExisting,

	#mainMenu .tiddlyLinkNonExisting,

	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}

#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}



.header {position:relative;}

.header a:hover {background:transparent;}

.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}

.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}



.siteTitle {font-size:3em;}

.siteSubtitle {font-size:1.2em;}



#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}



#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}

#sidebarOptions {padding-top:0.3em;}

#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}

#sidebarOptions input {margin:0.4em 0.5em;}

#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}

#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}

#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}

#sidebarTabs .tabContents {width:15em; overflow:hidden;}



.wizard {padding:0.1em 1em 0em 2em;}

.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}

.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}

.wizardStep {padding:1em 1em 1em 1em;}

.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}

.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}

.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}

.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}



#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}

.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}

#messageArea a {text-decoration:underline;}



.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}

.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}



.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}

.popup .popupMessage {padding:0.4em;}

.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}

.popup li.disabled {padding:0.4em;}

.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}

.listBreak {font-size:1px; line-height:1px;}

.listBreak div {margin:2px 0;}



.tabset {padding:1em 0em 0em 0.5em;}

.tab {margin:0em 0em 0em 0.25em; padding:2px;}

.tabContents {padding:0.5em;}

.tabContents ul, .tabContents ol {margin:0; padding:0;}

.txtMainTab .tabContents li {list-style:none;}

.tabContents li.listLink { margin-left:.75em;}



#contentWrapper {display:block;}

#splashScreen {display:none;}



#displayArea {margin:1em 17em 0em 14em;}



.toolbar {text-align:right; font-size:.9em;}



.tiddler {padding:1em 1em 0em 1em;}



.missing .viewer,.missing .title {font-style:italic;}



.title {font-size:1.6em; font-weight:bold;}



.missing .subtitle {display:none;}

.subtitle {font-size:1.1em;}



.tiddler .button {padding:0.2em 0.4em;}



.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}

.isTag .tagging {display:block;}

.tagged {margin:0.5em; float:right;}

.tagging, .tagged {font-size:0.9em; padding:0.25em;}

.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}

.tagClear {clear:both;}



.footer {font-size:.9em;}

.footer li {display:inline;}



.annotation {padding:0.5em; margin:0.5em;}



* html .viewer pre {width:99%; padding:0 0 1em 0;}

.viewer {line-height:1.4em; padding-top:0.5em;}

.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}

.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}

.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}



.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}

.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}

table.listView {font-size:0.85em; margin:0.8em 1.0em;}

table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}



.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}

.viewer code {font-size:1.2em; line-height:1.4em;}



.editor {font-size:1.1em;}

.editor input, .editor textarea {display:block; width:100%; font:inherit;}

.editorFooter {padding:0.25em 0em; font-size:.9em;}

.editorFooter .button {padding-top:0px; padding-bottom:0px;}



.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}



.sparkline {line-height:1em;}

.sparktick {outline:0;}



.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}

.zoomer div {padding:1em;}



* html #backstage {width:99%;}

* html #backstageArea {width:99%;}

#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}

#backstageToolbar {position:relative;}

#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}

#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}

#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}

#backstage {position:relative; width:100%; z-index:50;}

#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}

.backstagePanelFooter {padding-top:0.2em; float:right;}

.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}

#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}



.whenBackstage {display:none;}

.backstageVisible .whenBackstage {display:block;}

/*}}}*/
/***

StyleSheet for use when a translation requires any css style changes.

This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.

***/

/*{{{*/

body {font-size:0.8em;}

#sidebarOptions {font-size:1.05em;}

#sidebarOptions a {font-style:normal;}

#sidebarOptions .sliderPanel {font-size:0.95em;}

.subtitle {font-size:0.8em;}

.viewer table.listView {font-size:0.95em;}

/*}}}*/
/*{{{*/

@media print {

#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}

#displayArea {margin: 1em 1em 0em 1em;}

/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */

noscript {display:none;}

}

/*}}}*/
<!--{{{-->

<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>

<div class='headerShadow'>

<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;

<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>

</div>

<div class='headerForeground'>

<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;

<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>

</div>

</div>

<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>

<div id='sidebar'>

<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>

<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>

</div>

<div id='displayArea'>

<div id='messageArea'></div>

<div id='tiddlerDisplay'></div>

</div>

<!--}}}-->
<!--{{{-->

<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>

<div class='title' macro='view title'></div>

<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>

<div class='tagging' macro='tagging'></div>

<div class='tagged' macro='tags'></div>

<div class='viewer' macro='view text wikified'></div>

<div class='tagClear'></div>

<!--}}}-->
<!--{{{-->

<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>

<div class='title' macro='view title'></div>

<div class='editor' macro='edit title'></div>

<div macro='annotations'></div>

<div class='editor' macro='edit text'></div>

<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>

<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:

* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)

* MainMenu: The menu (usually on the left)

* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened

You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser



Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)



<<option txtUserName>>

<<option chkSaveBackups>> SaveBackups

<<option chkAutoSave>> AutoSave

<<option chkRegExpSearch>> RegExpSearch

<<option chkCaseSensitiveSearch>> CaseSensitiveSearch

<<option chkAnimate>> EnableAnimations



----

Also see AdvancedOptions
<<importTiddlers>>
* Integration meeting: sit together, kill minor bugs (method name conform)
* Bug tracking system: submitted, reject, postponed, delayed

* Industry assertion density standard: 1-10 assertions per 100 LOC, at least 1-2 assertions per method

* Testings: Use test the own CAP to generate test cases. This is to test across different versions, after refactoring, after optimization

* Must know why your program's not working, and why some adjustments make it work (irreproducible bugs)

* Wrtie shy code: "Law of Demeter" (aka "don't talk to strangers") (don't reveal anything unnecessary, don't rely on other modules' implementation)

* YANGNI prinicle (you are not going to need it)
! Stop at page 19
* Software: SVN- http://www.comp.nus.edu.sg/~cs3215/tools/csharp/svn.html ; JetBrains Resharper - This is a refactoring tool; NUnit - This is a unit testing tool http://www.comp.nus.edu.sg/~cs3215/tools/csharp/NUnit.html

* CAP functionalities:
** design entities: class, method, variable, stmtList, stmt, plus, minus, times, constant, progline
** entity relationship: 
*** ''modifies''(stmt/method, variable), ''uses'' (stmt/method, variable)  [stmt level, container level, call level]
*** ''calls''(method, method) *
*** ''parent''(stmt1, stmt2): different nesting level, within a method * (stmt1: container)
*** ''follow''(stmt, stmt): at the same nesting level (not follow from if -> else, if -> its inside) * 
*** ''next'' (progline1, progline2): within the same method, in terms of execution * (if there exists a path, that progline1 follows immediately after progline2)
*** ''affects''(assign, assign): within the same method
** entity attributes

* CQL: 
** declaration clause: ~variable declaration
** result clause: SELECT (design entity | BOOLEAN) (with-cl | suchthat-cl | pattern-cl)*
** implicit existential quantifier
** implicit and operator among clauses
** _ : free synonym. E.g.: method p; Select p suchthat Calls (p, _)
** 4 types of syntactic patterns: assign, while, if, call

* Abstract syntax trees (AST)
* Control flow graphs (CFG)

* Errata:
** p.9 (l.3 up): 13 -> 8
** p.12 (l.9 down): asign -> assign


ExecuteSuchthat: 
 QueryResult returnedResult = new QueryResult();
             if (synonyms.Count == 1 && entType.Count == 1)
            {
                QueryResultItem item = new QueryResultItem(stringResult, entType[0]);
                returnedResult.addResultList(synonyms[0], item);
            }
	
	//QueryResultItem item = new QueryResultItem(stringResult, EntityType.Statement);
            //returnedResult.addResultList(rs[0], item);
CAP requirements:
* extendability: good modular design
* well-documented
* reusability: avoid code duplication
* error recovery
* exception handling and useful error messages

* COM1-240
* XploreTech: team name
* XploreCAP

* Punctuality
* Fund
* Agenda (deadline: Fri night)
* 15'-feadback time
* 
Todo:
+ Sort out classes: remove unused classes, moving suchthat, pattern, with handling, Heuristic handling out of QueryEvaluation
* Argue that WithUnitTest is inefficient, instead we perform rigorous WithSystemTest
* Discuss abt call with 2 attributes methodName, and stmt#
* Calls(p, q.methodName)
-> ''Stop at With, Call, methodName, check CallsS("main", "q")
* QPS evaluation strategy: make diagram
* CAP API: 
I have wrapped the CAP API functions into a class called CAPController. Therefore I have changed the code in GUI to call from CAPController instead of calling directly from cps and qps components.

I have also added the LoadQuery() into the documentation. This method is not used yet at the moment because currently query parsing and query execution are both executed inside the ExecuteQuery(). Maybe Bang will need to move the necessary query parsing code into parseQuery().

CAP CPI documentation changes:
added -- LoadQuery(String fileName);
we need to decide whether to remove the void LoadProgram (String fileName) or not.

* QPS parser bug: resolved by Bang
* AST bug: raised by Yi jin, assigned anyone?
* Sort out test case failure
* NUnit, 16bugs
* More xml documentation on cps, make method List public
* QPS: test cases to show feature of suchthat, pattern handle which?, query parser ready?
* bug public List<int> ListStmts(StmtType stmtType)
** return as a list of strings
* qET.TestEvaluation, assign a1; \nassign a2;\nSelect a2 suchthat Uses(a1, \"x\") with a2.stmt# = a1.stmt#
** work correct if select a1
** remove Select parameter
* What is the result for this? 
queryTree = qpsController.ParseQuery("stmt s1;\nstmt s2;\nSelect <s1, s2> suchthat Follows*(s1, 3) with s2.stmt# = s1.stmt#", false);
* Inception: project scope, objectives
* Elaboration: baseline architectures

* Get 1st prototype soon: see how feasibility the design is e.g. load large program
* Identify the risks among team: time commitment, people's weaknesses and strengths

!API
* CAP API
** Load program: LoadProgram(String fileName)
** Send a query and get answer: Answer SendQuery(String query)

* CPS API
** boolean isModifies(STMT stmt, Var v)
** boolean isUses(STMT stmt, Var v)

* Objects definition
Answer {
int numOfAnswers;
String[] answers;
}

Program{
String[] codeLine; //codeLine[i] is the code at progline i, .e.g. while(x) {
}

STMT{
int progLine; // to be reference to Program.codeLine
}

* Only with could reduce the 
* Change QueryResult namespace
* Fix List<string> List<int>
* ListStmts: ? any exception, no throw of invalid type

* To catch NoResultException from WithHandler
* assign a; with a.stmt#=11. What to return if stmt 11 is not an assign. No result for normal select, and false for Bool select?

* Refactor for if (reference.Constant != null) \/\/ synnonym.attribute = CONST. At first consider each case separately, get the result, deal the same for all cases

* parser: test for unknown attribute?

* Remove 1 result list, before add more constraints

* in a tuple, 2 synonym column will have the same value ?

^{.*}{( Boolean| void| List|  int|  Statement)}{.*}$
co the la can ham List<Integer> ListStmtsFollowedS(Statement stm, Enum returnType); :-?
* Start writing test driver
* Obtain cheat sheets for keyboard shortcut, and code snippet
* Suchthat: FollowsT, UseP1 doesn't check for result list
* check grammar for the rest of the features

Todo:
Implement:
* bool ContainSynonym(string synonym)
* bool IsSameTuples(string synonym1, string synonym2)
* QueryResultItem GetValueTuplesList(string synonym1, string synonym2)
* ExtendResult, extend the current tuple and add new column and rows 
* RemoveResult, remove tuples from the list
* Think about how to exploit all the cases of entity with attribute e.g. constant c, c.value = 9 (check with supervisor)
-> Testing

* stmt s; assign s; -> invalid?
* throw semantically-invalid exception during evaluation?


* assign a; Select a suchthat a.stmt#=12;
*CPS: need to ask questions abt entity with a particular attribute
Statement getStatement(int stmtNum)

*QPS: explain abt Declaration + QueryResult
With: case Method (''done'')
* confirm with Lien abt: ListMethodNamesWithCallPattern
* mention abt: List<string> ListStmtsString(StmtType stmtType); / / Thang added (''done'')
* JoinResultTest, and ProjecResultTest: but some simple Assertions (e.g. ToString) to run on NUnits
* ProjectResult: throw what exceptions?
* Suchthat: confirm with Dr.Soo abt Follows(_, _) whether it's ambiguous?
If var doesn't appear on the LHS, consider as a var?
* CAP API
** Load program: boolean LoadProgram(String fileName)
** Send a query and get answer: String[] SendQuery(String query)

* CPS API
* isModify(stmt/method, variable)
* isModifyS(stmt/method, variable)
* isUse(stmt/method, variable)
* isUseS(stmt/method, variable)
* isCall(method, method)
* isCallS(method, method)
* isParent(stmt1, stmt2)
* isParentS(stmt1, stmt2)
* isFollow(stmt, stmt)
* isFollowS(stmt, stmt)
* isNext(progline1, progline2)
* isNextS(progline1, progline2)
* isAffect(assign, assign)
* isAffectS(assign, assign)
x = 1000000000000000000000 is invalid
''Stop at slide 51''

* Single inheritance

!Simple program, compilation, and execution
* Counter.cs
class Counter{
int val = 0;
public void Add(int x) { val = val + x; }
public int Val() { return val; }
}

* Prog.cs
using System;
class Prog{
static void Main() {
Counter c = new Counter();
c.Add(3); c.Add(5);
Console.WriteLine("val = " + c.Val());
}
}
* Compilation: csc Counter.cs Prog.cs=> generates Prog.exe
ExecutionProg
* Working with DLLs: csc /target:libraryCounter.cs => generates Counter.dll
csc /reference:Counter.dllProg.cs=> generates Prog.exe

!Type
*Enum
enumColor {red, blue, green} // values: 0, 1, 2
enumAccess {personal=1, group=2, all=4}
enumAccess1 : byte{personal=1, group=2, all=4}

Color c = Color.blue; // enumeration constants must be qualified
Access a = Access.personal | Access.group;
if ((Access.personal & a) != 0) Console.WriteLine("access granted");

*Arrays
int[] a = new int[3];
int[] b = new int[] {3, 4, 5};
int[] c = {3, 4, 5};
int len = a.Length; // number of elements in a

** Jagged (~Java)
int[][] a = new int[2][];
a[0] = new int[3];
a[1] = new int[4];

** Rectangular
int[,] a = new int[2, 3];
int x = a[0, 1];
int len = a.Length; // 6
len = a.GetLength(0); // 2
len = a.GetLength(1); // 3

! Expression
Overflow is not checked by default
* Turned on in code
x = checked(x * x); // -> System.OverflowException
checked{
...
x = x * x; // -> System.OverflowException
...
}

* Turned on with compiler
csc /checked Test.cs

!Namespace
* Color.cs
namespace Util {
public enum Color {...}
}

* Figures.cs
namespace Util.Figures {
public class Rect {...}
public class Circle {...}
}

* Triangle.cs
namespace Util.Figures {
public class Triangle {...}
}

using Util.Figures;
class Test {
Rect r;// without qualification (because of using Util.Figures)
Triangle t;
Util.Color c;// with qualification
}

!Switch
int ch = Console.Read();
switch(country) {
case "Germany": case "Austria": case "Switzerland":
language = "German";
break;

case "England": case "USA":
language = "English";
break;

case null:
Console.WriteLine("no country specified");
if (ch = = 'g') { ch = Console.Read(); goto case "Germany";}
else if (ch = = 'e') goto case "England";
else goto default;
break;

default:
Console.WriteLine("don't know language of {0}", country);
break;
}

''No fall-through'': Every statement sequence in a case must be terminated with break(or return, goto, throw).

!foreach
int[] a = {3, 17, 4, 8, 2, 29};
foreach(int x in a) sum += x;

Queue q = newQueue();
q.Enqueue("John"); q.Enqueue("Alice"); ...
foreach(string s in q) Console.WriteLine(s);

! Structs
struct Point {
public int x, y;// fields
public Point (int x, int y) { this.x = x; this.y = y; }// constructor
public void MoveTo (int a, int b) { x = a; y = b; }// methods
}

* Value Types (objects stored on the stack): efficient, low memory consumption, no burden for the garbage collector
* no inheritance (but compatible with object)
* can implement interfaces
* no destructors allowed

* Fields must not be initialized at their declaration
struct Point {int x = 0;// compilation error}

* For every struct the compiler generates a parameterless default constructor(even if there are other constructors).
The default constructor zeroes all fields.

!Classes
class C {
... fields, constants... // for object-oriented programming
... methods...
... constructors, destructors...

... properties...// for component-based programming
... events...

... indexers...// for amenity

... overloaded operators...
... nested types (classes, interfaces, structs, enums, delegates)...
}

* Classes
** Reference Types (objects stored on the heap): suitable for dynamic data structures
** support inheritance (all classes are derived from object)
** can implement interfaces
** may have a destructor

!Visibility modifier
* public: visible where the declaring namespace is known
** Members of interfaces and enumerations are public by default.
** Types in a namespace (classes, structs, interfaces, enums, delegates)
have default visibility internal(visible in the declaring assembly)

* private: only visible in declaring class or struct
** Members of classes and structs are private by default (fields, methods, properties, ..., nested types)

class C {
int value = 0;
const long size = ((long)int.MaxValue + 1) / 4; //must be computable at compile time
''readonly'' DateTime date; //must be initialized in their declaration or in a constructor
}

!Parameters
*ref Parameters(transition values): pass by reference
void Inc(''ref'' int x) { x = x + 1; }
void f() {
int val = 3;
Inc(''ref'' val); // val == 4
}

* out Parameters (output values): get the values from a method
void Read (outint first, outint next) {
first = Console.Read(); next = Console.Read();
}

void f() {
int first, next;
Read(outfirst, outnext);
}

* variable numbers of parameters
void Add (out int sum, ''params'' int[]val) {
sum = 0;
foreach (int i in val) sum = sum + i;
}
! Static constructor
struct Point {
...
static Point(){
Console.WriteLine("Point initialized");
}
}

** Must be parameterless(also for structs) and have no public or private modifier.
** There must be ''just one'' static constructor per class/struct.
** Is invoked once before this type is used for the first time.

! Destructors
class Test {
~Test() {
... finalization work ...
// automatically calls the destructor of the base class
}
}

* Correspond to finalizers in Java.
* Called for an object before it is removed by the garbage collector.
* No public or private.
* Is dangerous (object resurrection) and should be avoided.

!Properties: Syntactic sugar for get/set methods
class Data {
FileStream s;
public string FileName {
set{s = new FileStream(value, FileMode.Create);}
get{return s.Name;}
}
}

Used as "smart fields"
Data d = new Data();
d.FileName= "myFile.txt";// invokes set("myFile.txt")
string s = d.FileName;// invokes get()

* get or set method can be omitted (write-only / read-only)

!Indexers: Programmable operator for indexing a collection ( merely get and set method with an extra parameter passed in)
class File {
FileStream s;
public int this [int index] {
get {s.Seek(index, SeekOrigin.Begin); return s.ReadByte();}
set {s.Seek(index, SeekOrigin.Begin);s.WriteByte((byte)value);}
}
}

Use
File f = ...;
int x = f[10];// calls f.get(10)
f[10]= 'A';// calls f.set(10, 'A')

* Indexers can be overloaded with different index typestype

!Overloaded Operators: Static method for implementing a certain operator
struct Fraction {
int x, y;
public Fraction (int x, int y) {this.x = x; this.y = y; }
public ''static'' Fraction ''operator'' +(Fraction a, Fraction b) {
return new Fraction(a.x * b.y + b.x * a.y, a.y * b.y);
}
}

Use
Fraction a = new Fraction(1, 2);
Fraction b = new Fraction(3, 4);
Fraction c = a + b; // c.x = = 10, c.y = = 8

!Conversion operator
!Nested types
! Inheritance
class ''B: A''{// subclass (inherits from A, extends A)
int b;
public B() {...}
}

* Single inheritance, multiple interfaces
* Not inherit from a struct

* Runtime check
if (a ''is'' C) ...// true, if dynamic type of ais Cor a subclass; otherwise false
B b = a ''as'' B;// if (a is B) b = (B)a; else b = null;



!Dynamic Binding (with hiding)
class A {
public virtualvoid WhoAreYou() { Console.WriteLine("I am an A"); }
}
class B : A {
public overridevoid WhoAreYou() { Console.WriteLine("I am a B"); }
}
class C : B {
public new virtualvoid WhoAreYou() { Console.WriteLine("I am a C"); }
}
class D : C {
public overridevoid WhoAreYou() { Console.WriteLine("I am a D"); }
}
C c = new D();
c.WhoAreYou();// "I am a D"
A a = new D();
a.WhoAreYou();// "I am a B" !!  ''Why???''

!Abstract Properties and Indexers
abstract class Sequence {
public abstract void Add(object x);// method
public abstract string Name { get;} // property
public abstract object this [int i] { get; set;}// indexer
}
class List : Sequence {
public ''override'' void Add(object x) {...}
public ''override'' string Name { get {...}}
public ''override'' object this [int i] { get {...} set {...}}
}

!Sealed Classes
sealed class Account : Asset {
long val;
public void Deposit (long x) { ... }
public void Withdraw (long x) { ... }
...
}

* sealedclasses cannot be extended (same as ''final'' classes in Java),but they can inherit from other classes.
* override methods can be declared as sealed individually

!Interface
public interfaceI List : ICollection, IEnumerable {
int Add (object value);// methods
bool Contains (object value);
...
bool IsReadOnly { get;}// property...
object this [int index] { get; set;} // indexer
}

!Delegate = Method Type
delegate void Notifier (string sender);/ / ordinary method signature with the keyword delegate
Notifier greetings; / /greetings could be used to ''represent for any method of the same signature'' e.g. that takes in a string, a return void

void SayHello(string sender) {
Console.WriteLine("Hello from " + sender);
}
greetings = new Notifier(SayHello);
greetings("John");/ / invokes SayHello("John") => "Hello from John"

void SayGoodBye(string sender) {
Console.WriteLine("Good bye from " + sender);
}
greetings = new Notifier(SayGoodBye);

!Events = Special Delegate Variables
class Model {
public event Notifier notifyViews;
public void Change() { ... notifyViews("Model"); }
}

class View1 {
public View1(Model m) { m.notifyViews += new Notifier(this.Update1);}
void Update1(string sender) { Console.WriteLine(sender + " was changed"); }
}
class View2 {
public View2(Model m) { m.notifyViews += new Notifier(this.Update2); }
void Update2(string sender) { Console.WriteLine(sender + " was changed"); }
}

class Test {
static void Main() {
Model m = new Model(); new View1(m); new View2(m);m.Change();}
}
Only the class that declares the event can fire it(better abstraction).
greetings("John");// SayGoodBye("John") => "Good bye from John"
* "cw" + tab : Console.Writeline
* CTRL-B / Navigate To Definition functionality
* CTRL-R, R: rename
* Alt + Insert: generate code (constructor)
* CTRL + SHIFT + D: document using GHOSTDOC
* CTRL + J: suggest live template
* Ctrl + E: recent file list
* Ctrl + Shift + B: build project


* unverified
Ctrl+F2 takes you to the navigation bar!
To collapse all blocks Ctrl-M-O very helpful.
I like the CTRL+M, CTRL+M. I use regions extensively. This opens and closes the region on the cursor.

I use CTRL+R,CTRL+E a lot, too.
I use ctrl + M, ctrl + O quite often (to collapse code) so that I can see where I am.


Another one was Resharper's CTRL-Enter / add “using“ statement feature.  Simply a great feature.  There's a shortcut for it in VS2005.  Shift-Alt-F10. 

* Replace and insert
Now, if you hit "Tab" key to complete the identifier it will remove "Replace" and insert "Trim", then put caret into parenthesis. Very useful when you need to change existing identifier to another one. Note the light red highlighting which denotes text to be removed, if you hit Tab. If you hit "Enter" key, it will just insert "Trim()" and let you specify parameters, if needed.

* Type Completion
ReSharper comes to rescue with Type Completion, which shows all types matching prefix regardless of (un-)imported namespaces and inserts required using directives when you select a type.Default shortcut is Ctrl-Alt-Space. Start using it now!

* Smart Completion
ReSharper has deep knowledge about your code. Really! When you see variable declaration in gray, it is ReSharper who analysed execution flow and figured out that particular variable is not used. Some of this knowledge is available to you in completion. When it is known what type is expected at specific point, you may get filtered list of available symbols by invoking Smart Complete (default shortcut Ctrl-Shift-Space)
MSIL ~ Java bytecode
CLR (common language runtime) ~ JVM
CLI (common language infrastructure)



StreamReader
StreamWriter
ArrayList: Add, ToArray
Hashtable: Add, ContainsKey, Remove, Values
BitArray
Queue
Stach

operator overloading: public static <return_val> operator <operator to overload> (<operand>);

Local variables & method parameters: camelCasing
All other identifier: PascalCasing

!CAP V0.0 (elaboration 1)
* BOOL: 
method: 'void' NAME '(' ')' '{' (assign)+ '}'
assign: VAR '=' 'CONSTANT';

* Simple queries

!CAP V0.1(elaboration 2)
* production quality
* BOOL parser
* CKB: AST, CFG, UsesTable
* Design extractor

AST: with extra parent & follow link. Help answers ''Parent'' and ''Follow'' queries
CFG: Answer ''Next'' queries
MethodTable: 
VariableTable: answer ''Uses'' and ''Modifies'' queries, references to methods through indexes

* Tips: use index for efficiency
* C# progress: pairwise checking
* Revise CS2103 concept: software models, design pattern, and UML diagrams
* Each member write a simple BOOL program, and generate as set of query => construct test collections
* Member strengths: knowledge of CS3212?, C#, .NET?

* Construct grammar checking for BOOL and CQL (CS3212)
!14April
* Pattern: optimize ConvertIntToStrList

!13April
* Possible bug: when use != instead of Equals
* JoinResult bug: 
** 1 la globalResult co <s1, s2> , <c1, c2>, local result la <s1, c1> thi join result se thanh <s1, s2, c1> <c1, c2, s1>
** MergeItem : synonym order and value order must be synchronized
** mergeItem: lost constraint <c1, c2> where c1 = c2, <c1, s1>
* Look at those that call to GetAllPossibleValue, to find a room to improve
* TestRemoveInvalidValues, TestExistValueInProgram

!12 April
* Wrapper proper handle for tuple output

!11 April
* Select synonym that is not declared (clauses are true)

!10 April
* Unit Test for constant in ComplementResult, and UtilityMethods (''done'')

!9 April
* Case sensitive parser: write program to generate all possible cases
* Use of keywords as name
* ProjectResult: duplicate result (''fixed'', Bang)

!7 April:
* Suchthat: EntityType entType2 = entType[synonyms.IndexOf(param2)]; (index out of bound exception) (''done'', SheJian)
* JoinResult: <s1-Statement, s-Statement> <15, 27> + <s1-Statement> <15> = <s1-Statement, s1-Statement, s-Statement> <15, 27> (''done'', Bang)

! 6 April:
* ProjectResut: handle call c, select <c, c.methodName, c.stmt#, c, c.methodName, c.stmt#> ? (''done'', Bang)
* Pattern: "_" mean anything or nothing, handle nothing part?
* Suchthat: extract result from call "p,12", "p,23" ? 
* Pattern: why call(method) is not mentioned in grammar? (''done'')
* Select w; Follows(1, 2) : where there's no occurence of while statement in the BOOL program (''tested'')
* With: constant c1, c2; Select <c1, c2> with c1.value = c2.value (to check with Dr. Soo) (''done'')
* JoinResult: if globalResult has <x, y> <a> <b> <c>, would it join into <x, y, a, b, c>?  (''fixed'', Thang)

!
* Select a1 with a.stmt#=12
If a is an assign statement return all values of a1, in this case ProjectResult need to handle the case where no synonym is found in the GlobalResult
(''handled'', ''tested'')
* Select <a, p.methodName, v.varName> -> need to extend struture for select
-> Only ''call'' has two attribute, suppose call c, so use "c.methodName" and "c.stmt#" as two separate synonyms. Others as normal
(''handled'', ''untested'')

* Need to handle for the case Select <a.varName> where a is an assign?

* There will be no query (''done'')
constant c; stmt s; select s with c.value = 10 and s.stmt# = c; (wrong by syntax)

* With: false to specify call c; with c.methodName = 11 should be "11" (''done'')

* With: to ask for call c; with c.methodName = "q" -> check if q exist, otherwise no result

* Suchthat: need to take care of the case where ''progline'' is used 

* Suchthat: handle ''free synonym''

* Suchthat: handle ''short form''  e.g. Calls("main", q)

* Suchthat: after evaluate for each condition, check if globalResult.BoolResultFlag = false, return back
No documentation for:
* CAP.cs
* QPSController.cs
* CPSController.cs
/***
|''Name:''|CryptoFunctionsPlugin|
|''Description:''|Support for cryptographic functions|
***/
//{{{
if(!version.extensions.CryptoFunctionsPlugin) {
version.extensions.CryptoFunctionsPlugin = {installed:true};

//--
//-- Crypto functions and associated conversion routines
//--

// Crypto "namespace"
function Crypto() {}

// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
	var be = Array();
	var len = Math.floor(str.length/4);
	var i, j;
	for(i=0, j=0; i<len; i++, j+=4) {
		be[i] = ((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
	}
	while (j<str.length) {
		be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
		j++;
	}
	return be;
};

// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
	var str = "";
	for(var i=0;i<be.length*32;i+=8)
		str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
	return str;
};

// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
	var hex = "0123456789ABCDEF";
	var str = "";
	for(var i=0;i<be.length*4;i++)
		str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
	return str;
};

// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
	return Crypto.be32sToHex(Crypto.sha1Str(str));
};

// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
	return Crypto.sha1(Crypto.strToBe32s(str),str.length);
};

// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
	// Add 32-bit integers, wrapping at 32 bits
	add32 = function(a,b)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF);
		var msw = (a>>16)+(b>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Add five 32-bit integers, wrapping at 32 bits
	add32x5 = function(a,b,c,d,e)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
		var msw = (a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Bitwise rotate left a 32-bit integer by 1 bit
	rol32 = function(n)
	{
		return (n>>>31)|(n<<1);
	};

	var len = blen*8;
	// Append padding so length in bits is 448 mod 512
	x[len>>5] |= 0x80 << (24-len%32);
	// Append length
	x[((len+64>>9)<<4)+15] = len;
	var w = Array(80);

	var k1 = 0x5A827999;
	var k2 = 0x6ED9EBA1;
	var k3 = 0x8F1BBCDC;
	var k4 = 0xCA62C1D6;

	var h0 = 0x67452301;
	var h1 = 0xEFCDAB89;
	var h2 = 0x98BADCFE;
	var h3 = 0x10325476;
	var h4 = 0xC3D2E1F0;

	for(var i=0;i<x.length;i+=16) {
		var j,t;
		var a = h0;
		var b = h1;
		var c = h2;
		var d = h3;
		var e = h4;
		for(j = 0;j<16;j++) {
			w[j] = x[i+j];
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=16;j<20;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=20;j<40;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k2);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=40;j<60;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),(b&c)|(d&(b|c)),w[j],k3);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=60;j<80;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k4);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}

		h0 = add32(h0,a);
		h1 = add32(h1,b);
		h2 = add32(h2,c);
		h3 = add32(h3,d);
		h4 = add32(h4,e);
	}
	return Array(h0,h1,h2,h3,h4);
};


}
//}}}
Reading_plans
/***
|''Name:''|DeprecatedFunctionsPlugin|
|''Description:''|Support for deprecated functions removed from core|
***/
//{{{
if(!version.extensions.DeprecatedFunctionsPlugin) {
version.extensions.DeprecatedFunctionsPlugin = {installed:true};

//--
//-- Deprecated code
//--

// @Deprecated: Use createElementAndWikify and this.termRegExp instead
config.formatterHelpers.charFormatHelper = function(w)
{
	w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
};

// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
config.formatterHelpers.monospacedByLineHelper = function(w)
{
	var lookaheadRegExp = new RegExp(this.lookahead,"mg");
	lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var text = lookaheadMatch[1];
		if(config.browser.isIE)
			text = text.replace(/\n/g,"\r");
		createTiddlyElement(w.output,"pre",null,null,text);
		w.nextMatch = lookaheadRegExp.lastIndex;
	}
};

// @Deprecated: Use <br> or <br /> instead of <<br>>
config.macros.br = {};
config.macros.br.handler = function(place)
{
	createTiddlyElement(place,"br");
};

// Find an entry in an array. Returns the array index or null
// @Deprecated: Use indexOf instead
Array.prototype.find = function(item)
{
	var i = this.indexOf(item);
	return i == -1 ? null : i;
};

// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
// @Deprecated: Use store.getLoader().internalizeTiddler instead
Tiddler.prototype.loadFromDiv = function(divRef,title)
{
	return store.getLoader().internalizeTiddler(store,this,title,divRef);
};

// Format the text for storage in an HTML DIV
// @Deprecated Use store.getSaver().externalizeTiddler instead.
Tiddler.prototype.saveToDiv = function()
{
	return store.getSaver().externalizeTiddler(store,this);
};

// @Deprecated: Use store.allTiddlersAsHtml() instead
function allTiddlersAsHtml()
{
	return store.allTiddlersAsHtml();
}

// @Deprecated: Use refreshPageTemplate instead
function applyPageTemplate(title)
{
	refreshPageTemplate(title);
}

// @Deprecated: Use story.displayTiddlers instead
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
{
	story.displayTiddlers(srcElement,titles,template,animate);
}

// @Deprecated: Use story.displayTiddler instead
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
{
	story.displayTiddler(srcElement,title,template,animate);
}

// @Deprecated: Use functions on right hand side directly instead
var createTiddlerPopup = Popup.create;
var scrollToTiddlerPopup = Popup.show;
var hideTiddlerPopup = Popup.remove;

// @Deprecated: Use right hand side directly instead
var regexpBackSlashEn = new RegExp("\\\\n","mg");
var regexpBackSlash = new RegExp("\\\\","mg");
var regexpBackSlashEss = new RegExp("\\\\s","mg");
var regexpNewLine = new RegExp("\n","mg");
var regexpCarriageReturn = new RegExp("\r","mg");

}
//}}}
!15 April 08
* Doc on
!6 April 08
* Doc on the extendability to add new design entity, how to add, what modification should be made in cps and qps
* Doc on assertion (''done'')
** complementResult: no case for Variable, Debug.Assert(type != EntityType.Constant);
* Code reuse: 
** public static List<string> GetAllPossibleValues(EntityType type): used for With handling, and ComplementResult
** public static StmtType ConvertEntType2StmtType(EntityType entType): used for With, and Suchthat

!1 April 08
* Doc on the extension of Select in QueryTree to support ProjectResults for the cases Select <a, p.methodName, v.varName>
* As soon as seeing if globalResult.BoolResultFlag = false, no more evaluation

! 30 March 08
* Docs on query tree, changes to Moifies and Uses for semantics
* doc on first data structure design -> revised data structure
* Doc on our agreement on return signature and join results
Evaluate..Condition(globalResult, ...){
* if 2 unrelated syns -> return QueryResultItem
* if 1 unrelated syns -> updated globalResult directly, return null
* if 2 related syns
** if in the same tuple-> updated globalResult directly, return null
** if in separate tuple -> return QueryResultItem
}

for each (condition) {
* QueryResultItem item = Evaluate..Condition(globalResult, ...)
* if(item != null) JoinResults(globalResult, item)
}

!
http://www.softsteel.co.uk/tutorials/csharp/lesson19.html : documentation

http://msdn2.microsoft.com/en-us/library/aa288481(VS.71).aspx: sample code

* check for ''null'' return result
** e.g. StmtType stmtType = cps.GetStmtType(stmtNum);
* catch exception

* CPS, StmtType GetStmtType(int stmtNum) 
** make sure stmtNodeLst doesn't contain any null element after processing?
** there's no case return Stmt.InvalidType

/***
|''Name:''|LegacyStrikeThroughPlugin|
|''Description:''|Support for legacy (pre 2.1) strike through formatting|
|''Version:''|1.0.2|
|''Date:''|Jul 21, 2006|
|''Source:''|http://www.tiddlywiki.com/#LegacyStrikeThroughPlugin|
|''Author:''|MartinBudden (mjbudden (at) gmail (dot) com)|
|''License:''|[[BSD open source license]]|
|''CoreVersion:''|2.1.0|
***/

//{{{
// Ensure that the LegacyStrikeThrough Plugin is only installed once.
if(!version.extensions.LegacyStrikeThroughPlugin) {
version.extensions.LegacyStrikeThroughPlugin = {installed:true};

config.formatters.push(
{
	name: "legacyStrikeByChar",
	match: "==",
	termRegExp: /(==)/mg,
	element: "strike",
	handler: config.formatterHelpers.createElementAndWikify
});

} //# end of "install only once"
//}}}

Makesure:
+ everyone not only code but perform documentation as well as unit testing
* After parsing query tree, rule out semantically invalid query
! 26/01/08
+ finish 2 set of slides on C#
+ Use Case Modeling , Domain Modeling / Business Modeling (CS2103 lecture)

+ Design API
+ Parser people: start writing ur own simple parsers (probably used CS3212 source code)
+ Test cases: each person target at 2 programs + 100 queries ??
+ Learn to use C# special comment (like Javadoc)

+ Remember to use BitVector to store relationships such as Modifies and Uses
* Test on tuple
1 select <a,s> suchthat follows (s,a)
2 select <a,s suchthat follows (s,a)
3 select a,s suchthat follows (s,a)

method p;
select p suchthat p.methodname =       "       first      "

stmt B, b;
select B suchthat follows(B,b)
http://www.snippetcenter.org/en/queryparser-s4.aspx
with s.stmt# = a.stmt#, why can't link s and a lists?
* A - ''Foundations of OOP using NET 2.0 patterns''
** A.2 Using NUnit for test-driven development
** A.9 Refactoring to patterns

* B - ''UML distilled'': reference for UML diagram

* C - ''Design patterns: elements of Reusable Object-Oriented Software'' [Gang of Four book]: reference for design pattern, 

* D - ''The unified process for practitioners'': good with clear examples at each stage of UP framework to give details on what we should we do , and yet short enough to be read quickly
** D.5 requirement workflow
** D.6 analysis workflow
** D.7 design workflow
** D.9 Test workflow
** D.11.3 Documenting pattern

* E - ''Agile: principles, patterns, and practices in C#'': selected chapters are extremely short :D
** E.2 Overview of Extreme programming
** E.4 Test-driven development: think quite important
** E.5 Refactoring
** E.21-25: command and active object, template method and strategy, facade and mediator, singleton and monostate, null object

Ctrl + X: delete a line
Software engineering
CS3215
/***
|''Name:''|SparklinePlugin|
|''Description:''|Sparklines macro|
***/
//{{{
if(!version.extensions.SparklinePlugin) {
version.extensions.SparklinePlugin = {installed:true};

//--
//-- Sparklines
//--

config.macros.sparkline = {};
config.macros.sparkline.handler = function(place,macroName,params)
{
	var data = [];
	var min = 0;
	var max = 0;
	var v;
	for(var t=0; t<params.length; t++) {
		v = parseInt(params[t]);
		if(v < min)
			min = v;
		if(v > max)
			max = v;
		data.push(v);
	}
	if(data.length < 1)
		return;
	var box = createTiddlyElement(place,"span",null,"sparkline",String.fromCharCode(160));
	box.title = data.join(",");
	var w = box.offsetWidth;
	var h = box.offsetHeight;
	box.style.paddingRight = (data.length * 2 - w) + "px";
	box.style.position = "relative";
	for(var d=0; d<data.length; d++) {
		var tick = document.createElement("img");
		tick.border = 0;
		tick.className = "sparktick";
		tick.style.position = "absolute";
		tick.src = "data:image/gif,GIF89a%01%00%01%00%91%FF%00%FF%FF%FF%00%00%00%C0%C0%C0%00%00%00!%F9%04%01%00%00%02%00%2C%00%00%00%00%01%00%01%00%40%02%02T%01%00%3B";
		tick.style.left = d*2 + "px";
		tick.style.width = "2px";
		v = Math.floor(((data[d] - min)/(max-min)) * h);
		tick.style.top = (h-v) + "px";
		tick.style.height = v + "px";
		box.appendChild(tick);
	}
};


}
//}}}
/* horizontal main menu */

#displayArea { margin: 1em 15.5em 0em 1em; } /* use the full horizontal width */

#topMenu { background: [[ColorPalette::PrimaryMid]]; color: [[ColorPalette::PrimaryPale]]; padding: 0.2em 0.2em 0.2em 0.5em; border-bottom: 2px solid #000000; }

#topMenu br { display: none; }

#topMenu .button, #topMenu .tiddlyLink, #topMenu a { margin-left: 0.25em; margin-right: 0.25em; padding-left: 0.5em; padding-right: 0.5em; color: [[ColorPalette::PrimaryPale]]; font-size: 1.15em; }

#topMenu .button:hover, #topMenu .tiddlyLink:hover { background: [[ColorPalette::PrimaryDark]]; }

 .firstletter{ float:left; width:0.75em; font-size:400%; font-family:times,arial; line-height:60%; }

.viewer .FOO table tr.oddRow { background-color: #bbbbbb; }
.viewer .FOO table tr.evenRow { background-color: #fff; } 


/*Invisible table*/

.viewer .invisibletable table { 
border-color: white;
 }

.viewer .invisibletable table td { 
font-size: 1em;
font-family: Verdana;
border-color: white;
padding: 10px 20px 10px 0px;
text-align: left;
vertical-align: top;
} 

.viewer .invisibletable table th { 
color: #005566;
background-color: white;
border-color: white;
font-family: Verdana;
font-size: 1.2em;
font-weight: bold;
padding: 10px 20px 10px 0px;
text-align: left;
vertical-align: top;
} 

/* GIFFMEX TWEAKS TO STYLESHEETPRINT (so that nothing but tiddler title and text are printed) */


@media print {#mainMenu {display: none ! important;}}
@media print {#topMenu {display: none ! important;}}
@media print {#sidebar {display: none ! important;}}
@media print {#messageArea {display: none ! important;}} 
@media print {#toolbar {display: none ! important;}}
@media print {.header {display: none ! important;}}
@media print {.tiddler .subtitle {display: none ! important;}}
@media print {.tiddler .toolbar {display; none ! important; }}
@media print {.tiddler .tagging {display; none ! important; }}
@media print {.tiddler .tagged {display; none ! important; }}
@media print {#displayArea {margin: 1em 1em 0em 1em;}}
@media print {.pageBreak {page-break-before: always;}}

a.button{
 border: 0;

} 

/*Color changes*/


#sidebarOptions input {
	border: 1px solid [[ColorPalette::TertiaryPale]];
}

#sidebarOptions .sliderPanel {
	background: [[ColorPalette::TertiaryPale]];
}

#sidebarOptions .sliderPanel a {
	border: none;
	color: [[ColorPalette::PrimaryMid]];
}

#sidebarOptions .sliderPanel a:hover {
	color: [[ColorPalette::Background]];
	background: [[ColorPalette::TertiaryPale]];
}

#sidebarOptions .sliderPanel a:active {
	color: [[ColorPalette::PrimaryMid]];
	background: [[ColorPalette::TertiaryPale]];
}

/*Makes sliders bold*/

.tuduSlider .button{font-weight: bold;
}

/* (2) Adjusts the color for all headlines so they are both readable and match my color schemes. */

h1,h2,h3,h4,h5 {
 color: #000;
 background: [[ColorPalette::TertiaryPale]];
}

.title {
color: [[ColorPalette::PrimaryMid]];
}

/* (2) Makes text verdana. */

body {
/* font-family: verdana;*/
font-size: 9pt;
}

/* (4) Allows for Greek - one way */

   .greek {
      font-family: Palatino Linotype;
      font-style: normal;
      font-size: 150%;
   }

/* (5) Shortens the height of the Header */

.headerShadow {
 padding: 1.5em 0em 1em 1em;
}

.headerForeground {
 padding: 2em 0em 1em 1em;
}

/* (8) Makes ordered and unordered lists double-spaced between items but single-spaced within items. */

/*.viewer li {
   padding-top: 0.5em;
   padding-bottom: 0.5em;

} */

/*Makes block quotes line-less*/

.viewer blockquote {
border-left: 0px;
margin-top:0em;
margin-bottom:0em; 
}

/* Cosmetic fixes that probably should be included in a future TW... */

.viewer .listTitle { list-style-type:none; margin-left:-2em; }
.editorFooter .button { padding-top: 0px; padding-bottom:0px; }

Important stuff. See TagglyTaggingStyles and HorizontalMainMenuStyles

[[Styles TagglyTagging]]
[[Styles HorizontalMainMenu]]

Just colours, fonts, tweaks etc. See MessageTopRight and SideBarWhiteAndGrey

body { 
  background: #eee; }
.headerForeground a { 
  color: #6fc;}
.headerShadow { 
  left: 2px; 
  top: 2px; }
.siteSubtitle { 
  padding-left: 1.5em; }

.shadow .title {
  color: #999; }

.viewer pre { 
  background-color: #f8f8ff; 
  border-color: #ddf }

.tiddler {
  border-top:    1px solid #ccc; 
  border-left:   1px solid #ccc; 
  border-bottom: 3px solid #ccc; 
  border-right:  3px solid #ccc; 
  margin: 0.5em; 
  background:#fff; 
  padding: 0.5em; 
  -moz-border-radius: 1em; }

#messageArea { 
  background-color: #eee; 
  border-color: #8ab; 
  border-width: 4px; 
  border-style: dotted; 
  font-size: 90%; 
  padding: 0.5em; 
  -moz-border-radius: 1em; }

#messageArea .button { text-decoration:none; font-weight:bold; background:transparent; border:0px; }

#messageArea .button:hover {background: #acd; }

.editorFooter .button { 
  padding-top: 0px; 
  padding-bottom:0px; 
  background: #fff;
  color: #000; 
  border-top:    1px solid #ccc; 
  border-left:   1px solid #ccc; 
  border-bottom: 2px solid #ccc; 
  border-right:  2px solid #ccc; 
  margin-left: 3px;
  padding-top: 1px;
  padding-bottom: 1px;
  padding-left: 5px;
  padding-right: 5px; }
  
.editorFooter .button:hover { 
  border-top:    2px solid #ccc; 
  border-left:   2px solid #ccc; 
  border-bottom: 1px solid #ccc; 
  border-right:  1px solid #ccc; 
  margin-left: 3px;
  padding-top: 1px;
  padding-bottom: 1px;
  padding-left: 5px;
  padding-right: 5px; }

.tagged {
  padding: 0.5em;
  background-color: #eee;
  border-top:    1px solid #ccc; 
  border-left:   1px solid #ccc; 
  border-bottom: 3px solid #ccc; 
  border-right:  3px solid #ccc; 
  -moz-border-radius: 1em; }

.selected .tagged {
  padding: 0.5em;
  background-color: #eee;
  border-top:    1px solid #ccc; 
  border-left:   1px solid #ccc; 
  border-bottom: 3px solid #ccc; 
  border-right:  3px solid #ccc; 
  -moz-border-radius: 1em; }

Clint's fix for weird IE behaviour
body {position:static;}
.tagClear{margin-top:1em;clear:both;}