Given a set of documents, each associated with multiple tags, how can I retrieve the documents tagged with an arbitrary set of tags?
My solution
| { | |
| map : function (doc) { | |
| if (doc.type === 'usage' && doc.service && doc.time) { | |
| var d = new Date(doc.time); | |
| var y = d.getFullYear(); | |
| var m = d.getMonth() + 1; | |
| var stamp = y + '/' + m; | |
| var rec = { | |
| stamp : stamp, |
| def get_or_create_db(self, db_name, designs=ALL_DESIGNS): | |
| from couchapp import dispatch | |
| couchapp_dir = os.path.join( | |
| settings.PROJECT_DIR, '..', '..', 'couchdb', 'tweet_counts' | |
| ) | |
| server = couchdbkit.Server(uri=settings.COUCHDB_SERVER_URI, | |
| resource_class=couchdb.RequestsResource) | |
| db = server.get_db(db_name) | |
| try: | |
| db.info() |
| -module(t). | |
| -export([start/0, go/0, analyze/0, server/0]). | |
| start() -> | |
| percept:profile("test.dat", {t, go, []}, [procs]). | |
| go() -> | |
| Led = led:start(1), | |
| Led1 = led:start(1), |
| Another mustache.erl example, this time showing off lists and asking for context in one of the view functions. |
| // make check for navigator properties not fail. | |
| var navigator = {}; | |
| // support some basic HTML5 localStorage operations | |
| function _localStorage() { | |
| this.ls = {}; | |
| this.getItem = function(key) { |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Simple Address Book</title> | |
| <link rel="stylesheet" href="style/main.css" type="text/css"> | |
| <script src="/_utils/script/json2.js"></script> | |
| <script src="/_utils/script/jquery.js?1.3.1"></script> | |
| <script src="/_utils/script/jquery.couch.js?0.9.0"></script> | |
| <script type="text/javascript"> | |
| $db = $.couch.db("addressbook"); |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| #!/usr/bin/env python | |
| """appdotnet | |
| Usage: | |
| appdotnet authenticate <client_id> | |
| appdotnet set-accesstoken <access_token> | |
| appdotnet global | |
| appdotnet | |
| appdotnet -h | --help |