Permalink
Browse files

remove some console clutter

  • Loading branch information...
alexch committed Jun 2, 2011
1 parent f11df48 commit a6f88da5f05b9e9a0490ea37d0e11ad93431f5bd
Showing with 79 additions and 52 deletions.
  1. +1 −1 LICENSE
  2. +43 −42 README.markdown
  3. BIN builds/whence.crx
  4. BIN builds/whereami.crx
  5. +13 −7 ext/background.html
  6. +1 −2 ext/whence.js
  7. +21 −0 notes.markdown
View
@@ -1,4 +1,4 @@
-Copyright (c) Alex Chaffee
+Copyright (c) 2011 Alex Chaffee
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,65 +1,66 @@
# Whence
-Once a second, it logs the currently active tab or window (if any) in Chrome into CouchDB / a file in your home directory.
+Once a second, it logs the currently active tab or window (if any) in Chrome into CouchDB.
+
+Complaints to [@alexch](http://twitter.com/alexch) / <mailto:alex@stinky.com>
# Instructions
- gem install crxmake
- rake install
- install CouchDB e.g. http://info.couchbase.com/couchbaseCEdownload.html
+## Install
-Complaints to @alexch / alex@stinky.com
+1. Install CouchDB e.g. http://info.couchbase.com/couchbaseCEdownload.html
+2. Open [builds/whence.crx](builds/whence.crx) in Google Chrome
## Chromium vs Google Chrome
-Multiple Chromes installed? Drag builds/whence.crx to
-whichever is your favorite.
+Multiple Chromes installed? Drag [builds/whence.crx](builds/whence.crx) to whichever is your favorite.
-## Uninstall it
+## Uninstall
rake uninstall
+## Rebuild
+
+ gem install crxmake
+ rake install:chrome
+
# Algorithm
Whence uses what's called a "sampling algorithm" -- approximately once a second, the currently selected tab says "hey, the user is on me". While this can miss some quick context shifts, it's reasonably accurate, and very high performance -- which is very important, since we can't gather data at all if the user disables us!
-# TODO
+We could gather all sorts of other events as well, like tab opens and closes. But beware, since these are sometimes missed (e.g. if the computer crashes).
-Include crxmake library
-Include CouchDB executable
-Write server in node.js
-Stick node.js *inside* CouchDB
- http://www.livelycouch.org/
-Use IndexedDB for local storage (in case Couch is missing)
-Smoosh successive hits together
-Use tab.favIconUrl (tab is "sender" param of onRequest)
-Change icon
- http://raphaeljs.com/icons/
+# Discussion
-## Credits
+<http://groups.google.com/group/whence-dev>
-- DotJS: <http://github.com/defunkt/dotjs>
+# TODO
+
+* Better error if CouchDB is not running/installed
+* Smoosh successive hits to same host together
+ * possibly using map/reduce
+* Store path as well as host
+* Change icon
+ * http://raphaeljs.com/icons/
+* Visualization
+* Replicate/synchronize DBs from multiple computers
+* Gather info on which app (other than browser) is active
+* Settings page
+* Clone RescueTime
+* Firefox version
+* Safari version
+* Include crxmake library
+* Include CouchDB executable
+* Use IndexedDB for local storage (in case Couch is missing)
+* Write server in node.js
+* Stick server *inside* CouchDB
+ * see http://www.livelycouch.org/
+* Store tab.favIconUrl (tab is "sender" param of onRequest)
+
+# Credits
+
+- Written by [Alex Chaffee](http://alexch.github.com)
+- Originally based on [DotJS](http://github.com/defunkt/dotjs)
- Icon: <http://raphaeljs.com/icons/>
- jQuery: <http://jquery.com/>
-# Developer notes
-
-"CouchDB is specifically intended to run in the client, and to provide a form of location transparency where your entire application can be running locally or remotely and you really don't know the difference except that perhaps some of your data is stale until you reconnect to the server."
-
-Unfortunately you can't connect to it via XHR (JS in a browser) so we need an intermediate Ruby server to add the "Access-Control-Allow-Origin" header. See bug https://issues.apache.org/jira/browse/COUCHDB-431
-
-http://css.dzone.com/articles/couchdb-javascript
-
-Built-in Couch APIs:
-http://localhost:5984/_utils/script/couch.js
-http://localhost:5984/_utils/script/jquery.couch.js
-
-Couch admin console:
-http://127.0.0.1:5984/_utils/
-
-CouchDB Cheat Sheets
-http://wiki.apache.org/couchdb/API_Cheatsheet
-http://www.sowbug.org/mt/2008/06/couchdb-cheat-sheet.html
-http://blog.fupps.com/2010/04/20/the-antepenultimate-couchdb-reference-card/
-http://www.andyjarrett.co.uk/blog/index.cfm/2010/3/29/CouchDB-quick-refstarting-guide
-
View
Binary file not shown.
View
Binary file not shown.
View
@@ -2,7 +2,6 @@
<head>
<script>
function say(msg) {
- alert(msg)
console.log(msg)
}
@@ -34,20 +33,22 @@
data: JSON.stringify(data), // data = request // use https://github.com/douglascrockford/JSON-js/blob/master/json2.js to get JSON in non-Chrome environments
contentType: "application/json",
success: function(response) {
- if (options.onSuccess == undefined) {
+ if (options.success == undefined) {
console.log("Success during " + method + " " + urlPrefix + dbName)
console.log(response);
} else {
- onSuccess(response);
+ console.log("calling callback")
+ console.log(options.success)
+ options.success(response);
}
},
error: function(e) {
- if (options.onError == undefined) {
+ if (options.error == undefined) {
console.log("Error during " + method + " " + urlPrefix + dbName)
console.log(e);
}
else {
- onError(e);
+ options.error(e);
}
}
})
@@ -62,6 +63,7 @@
if (error.status == 412) {
console.log("Found database " + dbName);
} else {
+ say(e.responseText);
console.log(e);
}
}});
@@ -74,9 +76,13 @@
couch('post', {
data: request.data,
success: function(response) {
- console.log("Success! from background");
- console.log(response);
callback(response);
+ },
+ error: function(response) {
+ console.log("Error");
+ console.log(response);
+ callback();
+ // how to set error? jam it into chrome.extension.lastError?
}
});
}
View
@@ -9,11 +9,10 @@ var whence = {
if (this.ticker == null) {
console.log("starting tracking " + this.host);
function tick() {
- console.log("saving doc to couch");
var blob = {host: self.host};
chrome.extension.sendRequest({'action' : 'save', data: blob}, function(response) {
- console.log(response);
+ // console.log(response);
if (response == undefined) {
// error
console.log("Error on " + self.host + " saving " + blob);
View
@@ -0,0 +1,21 @@
+# Developer notes
+
+"CouchDB is specifically intended to run in the client, and to provide a form of location transparency where your entire application can be running locally or remotely and you really don't know the difference except that perhaps some of your data is stale until you reconnect to the server."
+
+Unfortunately you can't connect to it via XHR (JS in a browser) so we need an intermediate Ruby server to add the "Access-Control-Allow-Origin" header. See bug https://issues.apache.org/jira/browse/COUCHDB-431
+
+http://css.dzone.com/articles/couchdb-javascript
+
+Built-in Couch APIs:
+http://localhost:5984/_utils/script/couch.js
+http://localhost:5984/_utils/script/jquery.couch.js
+
+Couch admin console:
+http://127.0.0.1:5984/_utils/
+
+CouchDB Cheat Sheets
+http://wiki.apache.org/couchdb/API_Cheatsheet
+http://www.sowbug.org/mt/2008/06/couchdb-cheat-sheet.html
+http://blog.fupps.com/2010/04/20/the-antepenultimate-couchdb-reference-card/
+http://www.andyjarrett.co.uk/blog/index.cfm/2010/3/29/CouchDB-quick-refstarting-guide
+

0 comments on commit a6f88da

Please sign in to comment.