Skip to content

Instantly share code, notes, and snippets.

case class Person(fname: String, lname: String)
val p = Person("Craig", "Tataryn")
p match {
case Person("Sandy", "Conner") => println("You thought I was a nurse!?!?!")
case Person("Craig", "Tataryn") => println("Hello handsome!")
case Person("Mayumi", "Liyanage") => println("Hello beautiful!")
case Person("Craig", _) => println("Great Name!")
}
private <T> List<T> fromJson(String json, Class<T> clazz) {
Gson gson = new Gson();
Type absUserListType = new TypeToken<Collection<T>>() {
}.getType();
// convert the json string back to object
List<T> objs = gson.fromJson(json, absUserListType);
return objs;
}
myRoute =
pathPrefix("user" / Segment) {
userId => {
path("profile") {
profileRoute(userId.toString)
}
}
}
def profileRoute(userId:String) = {
from("direct:start").routeId("insiderRoute")
.log("Choosing configuration: " + PROPS_FILE)
.log("Default Charset: " + Charset.defaultCharset())
.log("Processing feed configuration: " + FEED)
.to("direct:getPublishedArticles")
.log("Sourcing articles from: " + getFeedFormat(FEED) + FEED_URL + (FEED_URL.contains("?") ? "&" : "?") + "splitEntries=false")
.pollEnrich(getFeedFormat(FEED) + ":" + FEED_URL + (FEED_URL.contains("?") ? "&" : "?") + "splitEntries=false")
//.marshal().rss()
.split(xpath("//item"))
@ctataryn
ctataryn / gist:6329550
Created August 24, 2013 18:12
JRebel + GWT + IntelliJ. After updating a .java file in IntelliJ and right clicking on it and compiling it, I see the change reflected on the browser and then a few seconds later I get this GC overhead limit exceeded in the IntelliJ console.
GWT Compiler: Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
@ctataryn
ctataryn / gist:2158579
Created March 22, 2012 14:16
Chapter 13 CiA problem
Mar 22, 2012 9:12:48 AM org.apache.karaf.main.SimpleFileLock lock
INFO: locking
09:12:49,803 | INFO | FelixStartLevel | BlueprintExtender | 10 - org.apache.aries.blueprint - 0.3.1 | No quiesce support is available, so blueprint components will not participate in quiesce operations
09:12:50,536 | INFO | rint Extender: 2 | BlueprintContainerImpl | 10 - org.apache.aries.blueprint - 0.3.1 | Bundle org.apache.karaf.features.obr is waiting for namespace handlers
09:12:50,536 | INFO | rint Extender: 2 | BlueprintContainerImpl | 10 - org.apache.aries.blueprint - 0.3.1 | Bundle org.apache.karaf.shell.dev is waiting for namespace handlers
09:12:50,864 | INFO | FelixStartLevel | jmx | 27 - org.apache.aries.jmx - 0.3.0 | Starting JMX OSGi agent
09:12:50,926 | INFO | rint Extender: 3 | BlueprintContainerImpl | 10 - org.apache.aries.blueprint - 0.3.1 | Bundle org.apache.karaf.management.server is waiting for namespace handlers
09:12:50,957
@Configuration
public class CamelConfig {
@Resource
private SugarPlayerManagementService sugarService;
@Resource
private AdvantagePlayerManagementService advantageService;
@Resource
Manifest-Version: 1.0
Bnd-LastModified: 1331758040317
Build-Jdk: 1.6.0_30
Built-By: tataryc
Bundle-Description: Player Management Web Service wrapper
Bundle-ManifestVersion: 2
Bundle-Name: WEB SERVICES :: Player Management Web Services
Bundle-SymbolicName: ConvergencePlayerManagementWebServicesJar
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
@ctataryn
ctataryn / gist:2029904
Created March 13, 2012 16:55
Service.create problem
javax.wsdl.WSDLException: WSDLException (at /definitions/types/xsd:schema): faultCode=PARSER_ERROR: Problem parsing 'http://schemas.xmlsoap.org/soap/encoding/'.: java.net.ConnectException: Connection timed out