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
mysql> SELECT category_id, categories.name, count(*) as count FROM article_categories LEFT JOIN categories ON categories.id = category_id WHERE article_id in (select article_id from article_categories where category_id = 2179) AND category_id <> 2179 GROUP BY category_id ORDER BY count DESC LIMIT 100; | |
+-------------+------------------------+-------+ | |
| category_id | name | count | | |
+-------------+------------------------+-------+ | |
| 334 | olympics | 2806 | | |
| 280214 | olympícs | 2243 | | |
| 123916 | commentid=sports | 754 | | |
| 8023 | mlb | 530 | | |
| 36 | news | 435 | | |
| 199103 | london-olympics | 344 | |
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
{ | |
"query" : { | |
"constant_score": { | |
"filter": { | |
"terms": { | |
"_id": [ "44554814", "44506463", "44504729", "44506997", "44524881", "44509720", "44511458", "44522991", "44516257", "44504696", "44510314", "44543302", "44511529", "44508846", "44553660", "44513106", "44523403", "44550041", "44546073", "44506741", "44510843", "44559504", "44546960", "44511807", "44511889", "44516652", "44508535", "44542304", "44548172", "44504430", "44560101", "44545461", "44505070", "44524517", "44512248", "44505853", "44510579", "44510031", "44545932", "44511065", "44504916", "44515151", "44505492" ] | |
} | |
} | |
} | |
}, |
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
final def updateClusterSize(docId: String, newClusterSize: Int) : ListenableActionFuture[UpdateResponse] = { | |
val fields = client.prepareGet(indexName, typeName, docId) | |
.setFields("_timestamp") | |
.execute().actionGet().fields() | |
val oldTimestamp = if (fields == null) | |
(new Date()).getTime | |
else | |
fields.get("_timestamp").value() | |
client.prepareUpdate(indexName, typeName, docId) | |
.setScript(""" |
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
organization := "com.busk" | |
name := "SearchServer" | |
version := "0.1.0-SNAPSHOT" | |
scalaVersion := "2.9.1" | |
seq(webSettings :_*) |
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
package com.redis | |
import redis.clients.jedis._ | |
object PerfTests { | |
def keys = (0 until 20000) map { "somekey:" + _ } | |
def populate() { | |
val jedis = new Jedis("localhost") | |
keys foreach { n => | |
jedis.set("somekey:"+n, n.toString) | |
} |
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 CrawlRoundSender(master: ActorRef, scheduler: CrawlScheduler) extends Actor { | |
def receive = { | |
case CrawlRound => { | |
scheduler.next() match { | |
case Some(crawlFeed) => { | |
master ! crawlFeed | |
self ! CrawlRound | |
} | |
case None => context.system.scheduler.scheduleOnce(100.millis, self, CrawlRound) | |
} |
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
[2012-10-19 19:59:54,085][INFO ][index.search.slowlog.query] [Elastic Search 4] [busk_prod_0310][0] took[566.9ms], took_millis[566], search_type[QUERY_THEN_FETCH], total_shards[8], source[...], extra_source[], | |
[2012-10-19 19:59:54,102][INFO ][index.search.slowlog.query] [Elastic Search 4] [busk_prod_0310][5] took[612.5ms], took_millis[612], search_type[QUERY_THEN_FETCH], total_shards[8], source[...], extra_source[], | |
[2012-10-19 20:02:21,702][INFO ][index.search.slowlog.query] [Elastic Search 4] [busk_prod_0310][0] took[745.8ms], took_millis[745], search_type[QUERY_THEN_FETCH], total_shards[8], source[...], extra_source[], | |
[2012-10-19 20:02:21,809][INFO ][index.search.slowlog.query] [Elastic Search 4] [busk_prod_0310][5] took[832.9ms], took_millis[832], search_type[QUERY_THEN_FETCH], total_shards[8], source[...], extra_source[], | |
[2012-10-19 20:08:27,309][WARN ][index.search.slowlog.fetch] [Elastic Search 4] [busk_prod_0310][5] took[54.3s], took_millis[54399], search_type[QUERY_THEN_FETCH], total_shards[8], sou |
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
name := "Test" | |
version := "0.1" | |
scalaVersion := "2.10.0" | |
resolvers += "Sonatype Repository" at "http://oss.sonatype.org/content/repositories/releases" | |
libraryDependencies ++= Seq( | |
"org.scalatra" % "scalatra" % "2.2.0", |
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
package com.busk.stepsgraph | |
import akka.dispatch.{ ExecutionContext, Promise, Future, Await } | |
import java.util.concurrent.{ Executors, ExecutorService} | |
import akka.util.duration._ | |
import collection.mutable.HashMap | |
object StepsGraph { | |
def step[R, U](stepname: String, depStep: Step[_, U])(f: U => R): Step[U, R] = { | |
Step[U, R](stepname, Seq(depStep), f) |
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
scala> trait MyTrait extends (String => Int => Int) | |
defined trait MyTrait | |
scala> class X extends MyTrait { | |
| def apply(x: String)(i: Int): Int = 10 | |
| } | |
<console>:8: error: class X needs to be abstract, since method apply in trait Function1 of type (v1: String)Int => Int is not defined | |
(Note that T1 does not match String) | |
class X extends MyTrait { |