This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/fish | |
# Catered and used for production servers only | |
# Collab | |
cd ~/collab | |
npm run build | |
pm2 start npm -i 0 --no-automation --name collab -- run start | |
# Collab Dashboard | |
cd ~/collab-dashboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eliom-base-app depends on dev version of Eliom (branch shared react), | |
and dev version of js_of_ocaml, ojquery, macaque, ocsigen-widgets and reactiveData. Use opam to install it, after pinning the github repositories. | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list' | |
# Also probably optional but I like to update sources and upgrade | |
sudo apt-get update | |
sudo apt-get upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure A { | |
m = 5; //1 | |
call B; // 2 | |
while looper{ //3 | |
if looper then{ //4 | |
p = p * (x+y-z); //5 | |
call B; //6 | |
p = p + q; //7 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(int i = 0 ; i < nodes.size(); i++) { | |
TNode * currentNode = nodes[i]; | |
if(currentNode->getTType() == PLUSN) { | |
result += "+"; | |
} else if(currentNode->getTType() == MINUSN) { | |
result += "-"; | |
} else if(currentNode->getTType() == VARN) { | |
result += "|" + getValue(PKB::getPKB()->getVarTable()->getVarName(getValue(currentNode))); | |
} else if(currentNode->getTType() == CONSTN) { | |
result += "|" + getValue(currentNode); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sample input/output Input | |
2 | |
3 2 | |
1 -2 3 | |
-1 2 -3 | |
6 4 | |
1 2 4 | |
-2 3 -5 | |
-3 4 -5 | |
-3 5 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Algorithm for Wildcard Support | |
Rational: We need to support PQL query such as Uses(a,v) which has 2 unknowns and our current API only accepts 1 unknown which is mostly stmtLine or VarIndex. | |
Data Structure: | |
A multimap can be used to store all StmtLine of a certain type and this multimap can be preprocessed during parsing. | |
Pre-parsing Example: | |
Currently parsing stmt #7, check stmt root for type. If assign, push 7 into multimap eg. Multimap.insert(ASSIGNN, 7) | |
So at the end of the preparsing, we can now retrieve all stmt# of the same type by calling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static { // suppress log output from Jetty | |
try { | |
Logger.getLogger("org.mortbay.log").setLevel(Level.WARNING); | |
} catch (Exception ignored) { | |
} | |
try { | |
System.setProperty("org.apache.commons.logging.simplelog.log.org.mortbay.log", "warn"); | |
} catch (Exception ignored) { | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void sortAlphabetically() { | |
clearFile(); | |
assertEquals("Test empty sort should return message", | |
"nothing to sort", TextBuddy.executeCommand("sort")); | |
assertEquals("Test whether add function works", "added to " + TEST_FILE | |
+ ": \"z\"", TextBuddy.executeCommand("add z")); | |
assertEquals("Test whether add function works", "added to " + TEST_FILE | |
+ ": \"c\"", TextBuddy.executeCommand("add c")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* base case when the tree is empty */ | |
if(expressionTree == null){ | |
return null; | |
} | |
/* base case when the tree is a leaf */ | |
if(expressionTree.isLeaf()){ | |
return new BinaryTree<String>(new Node<String>(expressionTree.root.getData())); | |
} |