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
// this adds a "truncate(#)" method to String | |
String.metaClass.truncate = { len -> | |
if (delegate == null) {return''} | |
if (delegate.length() > len) {return delegate[0..(len - 2)] + "\u2026"} | |
return delegate | |
} |
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
<target name="build-jar" depends="compile"> | |
<jar destfile="${dist.dir}/app.jar" compress="true"> | |
<manifest> | |
<attribute name="Main-Class" value="main"/> | |
</manifest> | |
<fileset dir="${build.dir}/classes" includes="**/*.class"/> | |
<zipgroupfileset dir="${lib.dir}"> | |
<includesfile name="dependencies.list"/> | |
</zipgroupfileset> | |
</jar> |
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
-module(zeroconf). | |
-include("zeroconf.hrl"). | |
-export([open/0,start/0]). | |
-export([stop/1,receiver/0]). | |
-export([send/1]). | |
-define(ADDR, {224,0,0,251}). | |
-define(PORT, 5353). |
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
-module(counter). | |
-export([inc/1,inc/2,dec/1,dec/2,current/1,reset/1,start/1,loop/1]). | |
start(Name) -> | |
register(Name,spawn(counter,loop,[0])), | |
ok. | |
inc(Name, Amount) -> | |
Name ! {inc_counter, Amount}, | |
current(Name). |
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
% gets a timestamp in ms from the epoch | |
get_timestamp() -> | |
{Mega,Sec,Micro} = erlang:now(), | |
(Mega*1000000+Sec)*1000000+Micro. |
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
-module(inet_mdns). | |
-include_lib("kernel/src/inet_dns.hrl"). | |
-export([open/2,start/0]). | |
-export([stop/1,receiver/1]). | |
-export([subscribe/2,unsubscribe/2,getsubs/1]). | |
% gets a timestamp in ms from the epoch | |
get_timestamp() -> | |
{Mega,Sec,Micro} = erlang:now(), |
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
public class TestThreadStackSizes | |
{ | |
public static void main(final String[] args) | |
{ | |
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { | |
public void uncaughtException(final Thread t, final Throwable e) | |
{ | |
System.err.println(e.getMessage()); | |
System.exit(1); | |
} |
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
#define XP_UNIX | |
#include "jsapi.h" | |
/* The class of the global object. */ | |
static JSClass global_class = { | |
"global", JSCLASS_GLOBAL_FLAGS, | |
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, | |
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub, | |
JSCLASS_NO_OPTIONAL_MEMBERS | |
}; |
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
<dependency> | |
<groupId>net.sf.jasperreports</groupId> | |
<artifactId>jasperreports</artifactId> | |
<version>3.7.4</version> | |
<exclusions> | |
<exclusion> | |
<artifactId>jdtcore</artifactId> | |
<groupId>eclipse</groupId> | |
</exclusion> | |
</exclusions> |
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
ps -ax | grep "java -jar" | grep -v "grep" | cut -d " " -f 1 |