This file contains 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
fun getRuntimeParams(args: Array<String>) : #(String?, String?) { | |
var t = 0 | |
var targetListName : String? = null | |
var since : String? = null | |
while(t < args.size) { | |
if( args[t].equals("--list")) { | |
targetListName = args[++t] | |
} | |
if( args[t].equals("--since")) { |
This file contains 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
package extfun | |
import java.util.List | |
import java.util.ArrayList | |
fun main(args : Array<String>) : Unit { | |
swapEm() | |
/* | |
Output is | |
[3, 2, 1] |
This file contains 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
package litfunc | |
import java.util.ArrayList | |
import java.util.Collection | |
fun main(args : Array<String>) : Unit { | |
val l = ArrayList<String>() | |
l.add("one") | |
l.add("two") | |
l.add("buckle my shoe") |
This file contains 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
Use awk's multiline pattern matching to select, for example, create-table statements in a database schema: | |
$ mysqldump --no-data -u theuser -p mysql | awk '/CREATE TABLE/,/;/' | |
CREATE TABLE `columns_priv` ( | |
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', | |
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', | |
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', | |
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', | |
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', | |
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
This file contains 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
There are four different ways one can deploy a webapp to Tomcat. If TCHOME is the Tomcat top-level directory: | |
* Copy the war file foo.war or exploded war directory to TCHOME/webapps | |
* Create a context file context.xml in the webapp’s META-INF/ directory that contains a <Context> fragment that describes the webapp deployment | |
* Add a <Context> element to the <Host> element in Tomcat’s server.xml that describes the webapp deployment, including docBase. docBase is a <Context> attribute that locates the war file or exploded war directory in the filesystem. | |
* Create a context file foo.xml in TCHOME/conf/Catalina/localhost/foo.xml that contains a <Context> fragment that describes the webapp deployment, including docBase. | |
The first two methods do not provide the freedom to name the servlet context independent of file system names for the war file or exploded war directory, whereas the last two do. Of the two methods that provide control over context naming, the most appealing is the use of a context file foo.xml p |
This file contains 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
@Override | |
public void onTestStart(ITestResult iTestResult) { | |
// Attempt to count invocations of a DataProvider-instrumented test | |
Object instance = iTestResult.getInstance(); | |
ITestNGMethod testNGMethod = iTestResult.getMethod(); | |
Method testMethod = testNGMethod.getMethod(); | |
if (testMethod.isAnnotationPresent(Test.class) && testMethod.isAnnotationPresent(Count.class)) { | |
Test testMethodTestAnnotation = testMethod.getAnnotation(Test.class); | |
String dataProviderName = testMethodTestAnnotation.dataProvider(); | |
if (dataProviderName != null && !dataProviderName.isEmpty()) { |
This file contains 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
$scope.tail = function (tailbag) { | |
if (tailbag.processid.length === 0) { | |
console.log("Cannot tail " + tailbag.whoami + " because there is no processid"); | |
return; | |
} | |
$http.get("tail", {params: {"processid": tailbag.processid, "start": tailbag.currentStart, "limit": tailbag.pageSize}}) | |
.success(function (data, status, headers, config) { | |
tailbag.currentStart = tailbag.currentStart + data.page.length; | |
for (k = 0; k < data.page.length; ++k) { | |
tailbag.text = tailbag.text + data.page[k] + "\n"; |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<keymap version="1" name="MarkP" parent="Mac OS X"> | |
<action id="CloseAllEditorsButActive"> | |
<keyboard-shortcut first-keystroke="meta alt X" /> | |
</action> | |
<action id="CloseContent"> | |
<keyboard-shortcut first-keystroke="meta F4" /> | |
<keyboard-shortcut first-keystroke="meta alt W" /> | |
</action> | |
<action id="EditorCodeBlockEndWithSelection" /> |
This file contains 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
digraph G { | |
rankdir=LR; | |
main [shape=box]; | |
main -> f -> g; // main calls f which calls g | |
f -> f [style=dotted] ; // f is recursive | |
f -> h; // f calls h | |
} |
This file contains 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
{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Action":[ | |
"s3:ListBucket", | |
"s3:GetBucketAcl", | |
"s3:PutBucketAcl" | |
], |
OlderNewer