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
| def max_depth(map, depth=0): | |
| """return's the max depth of a n-arry tree""" | |
| if isinstance(map, dict): | |
| depth += 1 | |
| val = 0 | |
| for x in map.itervalues(): | |
| val = max(val, max_depth(x, depth)) | |
| return val | |
| else: | |
| return depth |
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
| def merge(as: Stream[Int], bs: Stream[Int], cs: Stream[Int]): Stream[Int] = { | |
| val h = as.head min bs.head min cs.head | |
| Stream.cons( | |
| h, | |
| merge(as dropWhile {_ == h}, bs dropWhile {_ == h}, cs dropWhile {_ == h}) | |
| ) | |
| } | |
| This function produces a stream containing a constant times each value from another: |
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
| class Config(private val envConf: Map[String, _],private val defaultConf: Map[String, _], environment: String) { | |
| def findInteger(key : String ) : Option[Int] = find[Int](key) | |
| def findString(key : String ) : Option[String] = find[String](key) | |
| private def find[T](key : String ) : Option[T] = { | |
| val keyList = key.split("\\.").toList | |
| lookInMap[T](keyList,envConf) match { | |
| case None => lookInMap(keyList,defaultConf) |
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
| func() = { | |
| var dataList = List[Array[Byte]]() | |
| breakable { | |
| for (i <- 0 until noItems) { | |
| val response: GetResponse = channel.basicGet(queueName, true) | |
| if (response != null) { | |
| dataList = response.getBody :: dataList | |
| } | |
| else { | |
| break() |
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
| import java.util.concurrent.TimeUnit | |
| import com.google.common.cache.{LoadingCache, CacheLoader, CacheBuilder} | |
| /** | |
| * using google guave instead of building our own like in the previous case. | |
| */ | |
| class QueueMetaCache extends ConfigSupport { | |
| private val queueRefreshCache :LoadingCache[String, Long]= CacheBuilder.newBuilder() | |
| .maximumSize(10000) |
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
| Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from class path resource [spring/codahale-metrics-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'. | |
| at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) | |
| at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) | |
| at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) | |
| at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) | |
| at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) | |
| at org.springframework.beans.factory.xml.DefaultBeanDefiniti |
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
| com.yammer.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:36) | |
| org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) | |
| org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) | |
| $Proxy69.healthAsHTML(Unknown Source) | |
| sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | |
| sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | |
| java.lang.reflect.Method.invoke(Method.java:597) | |
| com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) | |
| com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) |
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
| import com.yammer.metrics.annotation.Timed; | |
| import javax.ws.rs.GET; | |
| import javax.ws.rs.Path; | |
| import javax.ws.rs.Produces; | |
| import javax.ws.rs.core.Response; | |
| @Path("/healthcheck") | |
| public interface HealthCheck | |
| { |
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
| import time |
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
| [11:11:57] <shekispeaks> are there any limits on the data size which can be stored against a super-column | |
| [11:15:01] <driftx> http://www.quora.com/Cassandra-database/Why-is-it-bad-to-use-supercolumns-in-Cassandra don't use supers | |
| [11:17:27] patricioe (~patricioe@99-28-161-222.lightspeed.miamfl.sbcglobal.net) joined the channel. | |
| [11:18:18] Torgan (~Torgan@vil31-1-78-245-104-71.fbx.proxad.net) left IRC. (Quit: This computer has gone to sleep) | |
| [11:18:51] mmalone (~mmalone@c-24-130-137-135.hsd1.ca.comcast.net) left IRC. (Read error: Connection reset by peer) | |
| [11:19:24] mmalone (~mmalone@c-24-130-137-135.hsd1.ca.comcast.net) joined the channel. | |
| [11:20:19] <nickmbailey> use composite columns instead: http://www.datastax.com/dev/blog/introduction-to-composite-columns-part-1 | |
| [11:20:42] <shekispeaks> ha thanks | |
| [11:21:01] <nickmbailey> or just use regular columns | |
| [11:21:35] wlian (~wlian@c-76-126-197-65.hsd1.ca.comcast.net) left IRC. (Quit: wlian) |