Skip to content

Instantly share code, notes, and snippets.

View russelldb's full-sized avatar

Russell Brown russelldb

View GitHub Profile
@russelldb
russelldb / MyClient.java
Created February 24, 2011 16:11
Snippet on creating your own HttpClient for RiakConfig
MultiThreadedHttpConnectionManager m = new MultiThreadedHttpConnectionManager();
m.getParams().setMaxTotalConnections(64);
m.getParams().setMaxConnectionsPerHost(64);
HttpClient myClient = new HttpClient(m);
RiakConfig riakConfig = new RiakConfig("http://127.0.0.1:8098/riak");
riakConfig.setHttpClient(myClient);
RiakClient riak = new RiakClient(riakConfig);
@russelldb
russelldb / ITestDataLoad.java
Created February 24, 2011 20:32
One riak client shared by many threads.
/*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@russelldb
russelldb / unzip_map.erl
Created March 21, 2011 15:34
unzip first
ungzip_map_object_value(RiakObject, _, _) ->
O = riak_object:get_value(RiakObject),
O1 = zlib:gunzip(O),
[O1].
@russelldb
russelldb / gist:1008293
Created June 4, 2011 20:02
Erlang content type map reduce from pb client
diff --git a/src/main/java/com/basho/riak/pbc/mapreduce/MapReduceBuilder.java b/src/main/java/com/basho/riak/pbc/mapreduce/MapReduceBuilder.java
index e6994a8..78e73c6 100644
--- a/src/main/java/com/basho/riak/pbc/mapreduce/MapReduceBuilder.java
+++ b/src/main/java/com/basho/riak/pbc/mapreduce/MapReduceBuilder.java
@@ -13,7 +13,9 @@
*/
package com.basho.riak.pbc.mapreduce;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
@russelldb
russelldb / erm
Created July 5, 2011 08:27
leveldb build error
Compiling c_src/eleveldb.cc
/usr/bin/ld: c_src/leveldb/libleveldb.a(db_impl.o): relocation R_X86_64_32S against `vtable for leveldb::DBImpl::RecoverLogFile(unsigned long, leveldb::VersionEdit*, unsigned long*)::LogReporter' can not be used when making a shared object; recompile with -fPIC
c_src/leveldb/libleveldb.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
ERROR: $CC c_src/eleveldb.o $LDFLAGS $DRV_LDFLAGS -o priv/eleveldb.so failed with error: 1
@russelldb
russelldb / ITestMapReduce.java
Created August 31, 2011 09:13
Test filter_notfound
/*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@russelldb
russelldb / config.log
Created August 31, 2011 14:58
build erlang_js on os x leopard
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:635: checking host system type
configure:656: checking target system type
configure:674: checking build system type
configure:1071: checking for whoami
configure:1889: checking for gcc
configure:2002: checking whether the C compiler (gcc ) works
configure:2018: gcc -o conftest conftest.c 1>&5
@russelldb
russelldb / ebloom nif compile error
Created August 31, 2011 15:31
./rebar -v compile
Compiling c_src/ebloom_nifs.cpp
INFO: sh: $CXX -c $CXXFLAGS $DRV_CFLAGS c_src/ebloom_nifs.cpp -o c_src/ebloom_nifs.o
[{"Apple_PubSub_Socket_Render","/tmp/launch-y4ZukS/Render"},
{"BINDIR","/Users/russell/erlang-r14b02/erts-5.8.3/bin"},
{"CC","cc"},
{"CFLAGS","-m32"},
{"COMMAND_MODE","unix2003"},
{"CXX","c++"},
{"CXXFLAGS","-m32"},
{"DISPLAY","/tmp/launch-RdHD3a/org.x:0"},
@russelldb
russelldb / search 500
Created September 6, 2011 12:16
search 500
< HTTP/1.1 500 Internal Server Error
< Vary: Accept-Encoding
< Server: MochiWeb/1.1 WebMachine/1.8.1 (participate in the frantic)
< Date: Tue, 06 Sep 2011 12:15:05 GMT
< Content-Type: text/plain
< Content-Length: 6369
<
Error:
{precommit_fail,
{hook_crashed,
@russelldb
russelldb / hum
Created September 6, 2011 12:40
riak_search precommit error
PUT /riak/mr_stest_java/java_0?returnbody=true HTTP/1.1
connection: keep-alive
accept: */*, multipart/mixed
x-riak-clientid: aZCZ0w==
Content-Length: 14
Content-Type: application/json
Host: 127.0.0.1:8098
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
{"foo":"zero"}