Skip to content

Instantly share code, notes, and snippets.

View ingenthr's full-sized avatar

Matt Ingenthron ingenthr

View GitHub Profile
@ingenthr
ingenthr / App.java
Created February 8, 2012 18:18
Showing the basics of CAS
package com.couchbase.sample.showingcas;
import com.couchbase.client.CouchbaseClient;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import net.spy.memcached.CASResponse;
import net.spy.memcached.CASValue;
@ingenthr
ingenthr / Main.java
Created February 8, 2012 18:41
Couchbase Server Java example of iterating over document results
View view = cbc.getView("$dev_testing", "atest");
Query myQuery = new Query();
myQuery.setRange("M", "N");
ViewResponse queryResults = cbc.query(view, myQuery);
Iterator<ViewRow> walkthrough = queryResults.iterator();
System.err.println("Found " + queryResults.size() + " docs.");
while (walkthrough.hasNext()) {
ViewRow next = walkthrough.next();
System.err.println(next.getDocument());
@ingenthr
ingenthr / urlcheck.text
Created February 20, 2012 19:32
URL check
For URL: http://www.couchbase.com/agreement/community
HTTP/1.1 200 OK
For URL: http://www.couchbase.com/agreement/free-license
HTTP/1.1 200 OK
For URL: http://www.couchbase.com/agreement/services
HTTP/1.1 200 OK
@ingenthr
ingenthr / StoreHandler.java
Created March 29, 2012 03:19
Sample of exponential backoff on a set with Couchbase Server
package com.couchbase.sample.dataloader;
import com.couchbase.client.CouchbaseClient;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.ops.OperationStatus;
/**
ingenthr-mbp:~ ingenthr$ ssh -v cbgw
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/ingenthr/.ssh/config
debug1: Applying options for cbgw
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 12.218.209.71 [12.218.209.71] port 22.
debug1: Connection established.
debug1: identity file /Users/ingenthr/.ssh/id_dsa-northscale type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
@ingenthr
ingenthr / gist:2777410
Created May 23, 2012 19:59
Finding and restarting the master node (not what you think it is) in Couchbase Server
wget -O- --user=Administator --password=asdasd --post-data="M = mb_master:master_node(), rpc:call(M, erlang,apply, [fun () -> exit(whereis(mb_master), kill) end, []])." http://lh:8091/diag/eval
@ingenthr
ingenthr / git-config
Created June 5, 2012 22:13
hook for adding reviewers
[remote "for-review-r"] 1:45
url = ssh://alk@review.membase.org:29418/ns_server.git 1:45
receivepack = git receive-pack --reviewer=aliaksiej.artamonau@gmail.com 1:45
push = HEAD:refs/for/branch-20
@ingenthr
ingenthr / App.java
Created August 7, 2012 21:38
Example of adding a view to Couchbase Server 2.0 build 1495 and later
package com.couchbase.sample.designdlocloader;
import java.io.IOException;
import java.io.StringWriter;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
@ingenthr
ingenthr / gist:3314476
Created August 10, 2012 14:11
diff of changes to add error handling and content-type
$ git show 32ae6c458ae10372954b55b83dfb6f23895ccc1a | cat
commit 32ae6c458ae10372954b55b83dfb6f23895ccc1a
Author: Matt Ingenthron <ingenthr@cep.net>
Date: Thu Jul 26 22:55:49 2012 -0700
WIP: fixed adding views in tests, now trying to make tests pass
Change-Id: I29e6c9894a6bc83b0a1ad5758d7ac609fcfe28b4
diff --git a/build.xml b/build.xml

Test Coverage

  • Increase test coverage to show coverage for at least 95% of defined functions. (PCBC-51)
  • Add test coverage for compression.
  • Add test coverage for error handling of encoded strings.
  • Add test coverage ensuring keys are handled as UTF-8.
  • Fix tests in 006.phpt and 007.phpt to work correctly with a cluster that has multiple nodes. (PCBC-97)
  • Develop and execute a test for whether persistent connections are maintained properly. This may be separate from the automated testing included in the project.

Development of 1.1 Extension Features

  • Develop a compatibility mode for working with JSON strings in Couchbase Server from Java and .NET.