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 def query(q: String) = { | |
val responses: Seq[Future[HttpResponse]] = clients.map {client => client.query(q)} | |
val allResponses: Future[Seq[HttpResponse]] = Future.collect(responses) | |
val successResponses: Future[Seq[HttpResponse]] = allResponses.map(responses => responses.filter(_.getStatus == HttpResponseStatus.OK)) | |
successResponses.map { responses: Seq[HttpResponse] => | |
if (responses.isEmpty) { | |
errorResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR, "No successful responses") |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# downloads a CentOS 6.5 base image for the VM from https://vagrantcloud.com/chef/centos-6.5 | |
# although the box is from the people that make Chef, we use Ansible below for provisioning the VM | |
config.vm.box = "chef/centos-6.5" |
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
public class GenericsTest { | |
public void doesNotCompile() { | |
Container<String> container = new Container<String>(); | |
assertThat(container, hasSomethingWhich(is("foo"))); | |
} | |
public static class Container<T> { |
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
/** | |
* Testing claims made in | |
* http://stackoverflow.com/questions/4346521/what-are-the | |
* -dangers-in-upgrading-to-java-1-5-and-beyond/4346599#4346599 | |
* | |
* @date Dec 3, 2010 | |
*/ | |
public class ClassLoadingTest { |
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
screen -t 'errors' tail -F current.log | grep -A 3 "ERROR" |
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
# window 1 | |
chdir /home/matt/code/project/logs | |
screen -t 'logs' | |
# window 2 | |
chdir /home/matt/code/project/logs | |
screen -t 'errors' | |
# window 3 | |
chdir /home/matt/code/project |
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
screen -t 'logs' tail -F current.log |
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
screen -t 'errors' | |
stuff 'tail -F /var/ec/current.log | grep -A 3 "ERROR"^M' |
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
/** | |
* Code sample for http://stackoverflow.com/questions/5877226/better-way-to-check-if-a-joda-time-interval-spans-exactly-1-calendar-week-accoun | |
* @author: matt b | |
* @since: 5/4/11 | |
*/ | |
public class JodaTimeWeekPeriodTest { | |
public static void main(String[] args) { | |
DateTime start = new DateTime(2011, 5, 4, 0, 0, 0, 0); |
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
octave-3.4.0:1> a = [ 1 2 3 4] | |
a = | |
1 2 3 4 | |
octave-3.4.0:2> mean(a) | |
ans = 2.5000 | |
octave-3.4.0:3> b = (a == 2) | |
b = |
OlderNewer