Re: So, how do we get the Mac binary on the home page?

2012-06-13 Thread Luca Matteis
Tried the installer for 10.7.3 and it works great!
Great job even with the upper right panel :)

On Wed, Jun 13, 2012 at 2:11 PM, Jan Lehnardt j...@apache.org wrote:
 Hans, any news? :)

 On Jun 10, 2012, at 19:48 , Jan Lehnardt wrote:


 On Jun 10, 2012, at 12:38 , Hans J Schroeder wrote:

 Hi,

 I have checked how the others (Membase, CouchBase) are doing it and suggest 
 the following disk layout:

 Data Dir / Application Support Folder
 =

 ~/Library/Application Support/CouchDB/etc
      couchdb-server.ini

 Bikeshed alert: I'd mirror what the CouchDB source distro does:

 ~/Library/Application Support/CouchDB/etc/default.d/
 ~/Library/Application Support/CouchDB/etc/default.ini
 ~/Library/Application Support/CouchDB/etc/local.d/
 ~/Library/Application Support/CouchDB/etc/local.ini

 I'd be more than happy to ship whatever is there today and
 fix this down the road. If it is easy to fix (see below),
 we may as well do that too.

 ~/Library/Application Support/CouchDB/var/run/couchdb
      couch.uri

 +1

 ~/Library/Application Support/CouchDB/var/lib/couchdb
      views  dbs

 +1

 * * *

 We may want to revisit this based on a close reading of the
 AppStore submission guidelines, when we get to that, but until
 then, I believe that is fine.

 Logs
 

 ~/Library/Logs
      couchdb-server.log

 I'd drop -server and go with just couchdb.log

 Is this ok?

 - Hans

 P.S. I have also found the incompatibility between OS X versions 10.6.8 - 
 10.7.2 and the later ones. I guess we can serve all with one binary

 Great news! :) If you want to/can compile a new one
 (and if the paths above are easy to adjust), then
 I'd say let's get that right and then ship.

 And then improve on all the other things that have
 been mentioned in this thread.

 Thanks all for pushing this along! :)

 Cheers
 Jan
 --




 On Jun 8, 2012, at 8:54 PM, Dave Cottlehuber wrote:

 On 8 June 2012 16:40, Jan Lehnardt j...@apache.org wrote:

 On Jun 8, 2012, at 16:31 , Hans J Schroeder wrote:

 Hi Jan,

 Can you specify what systems should use which versions, so we can label 
 them correctly on the website?

 For Mac OS X 10.6.8 to 10.7.2:
 https://github.com/downloads/cloudnode/couchdbx-app/CouchDB%20Server-1.2.0.zip

 For Mac OS X 10.7.3 and later
 https://github.com/downloads/cloudnode/couchdbx-app/CouchDB%20Server-1.2.0-OS%20X%2010.7.3.zip

 Thanks Hans!

 With this, I think we are good to go to put this on the website. Anyone 
 disagreeing? :)

 Cheers
 Jan

 Some things, files are scattered across various places.

 #1 dbs  views are in ~/Library/Application Support/CouchDBServer/
 #2 there's no local.ini as such, its in 
 ~/Library/Preferences/couchdb-server.ini
 #3 couch.log is in 
 $APPROOT/Contents/Resources/couchdbx-core/var/log/couch.log
 #4 couch.uri is in 
 $APPROOT/Contents/Resources/couchdbx-core/var/run/couch.uri

 If its not hard to fix #3 and #4 we should do that first. This means
 CouchDB.app could
 run read-only in /Applications, which it doesn't atm.

 #1 and #2 make sense, but might not be immediately obvious. They could
 wait, its more
 about documenting somewhere.

 A+
 Dave





[jira] [Commented] (COUCHDB-1483) Update handlers allow documents with empty ids to be created

2012-05-25 Thread Luca Matteis (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13283783#comment-13283783
 ] 

Luca Matteis commented on COUCHDB-1483:
---

Shouldn't your app avoid this by putting proper logic inside 
validate_doc_update functions?

 Update handlers allow documents with empty ids to be created
 

 Key: COUCHDB-1483
 URL: https://issues.apache.org/jira/browse/COUCHDB-1483
 Project: CouchDB
  Issue Type: Bug
  Components: Database Core
Affects Versions: 1.2, 1.3
 Environment: I've tested this on multiple versions including 1.2.0 on 
 linux and a build from git master.
Reporter: Brian Mitchell
Assignee: Robert Newson
Priority: Blocker

 If an update document returns a document without an _id field it will create 
 or attempt to update a document with an id of .
 To reproduce simply invoke an update handler which does a return [{}, 
 'oops'].

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




Re: I have build a CouchDB 1.2.0 Mac OS X Binary

2012-05-20 Thread Luca Matteis
Great stuff! Awesome work!

On Sun, May 20, 2012 at 10:34 PM, Carlton Gibson
carlton.gib...@gmail.com wrote:
 Yes. Definitely!

 Sent from my iPad

 On 20 May 2012, at 22:30, Ryan Ramage ryan.ram...@gmail.com wrote:

 Awesome work. I gave it a run and provided some issues in the github
 tracker, but its nice to see some osx love. I think a few others had
 also made a start, I wonder if they are around to collab with?

 R

 On Sun, May 20, 2012 at 5:06 AM, Hans J Schroeder cry...@dvbportal.de 
 wrote:
 I have uploaded the sources and the CouchDB 1.2.0 Mac OS X Binary to Github.

 https://github.com/cloudnode/couchdbx-app

 - Hans


Hierarchical comments Hacker News style

2012-05-16 Thread Luca Matteis
I'm trying to implement a basic way of displaying comments in the way
that Hacker News provides, using CouchDB. Not only ordered
hierarchically, but also, each level of the tree should be ordered by
a points variable. If you're familiar with sites such as Hacker News
or Reddit you know that each level of the comment tree is ordered by
the amount of points and also the date they were posted - however, for
sake of simplicity I'll just talk about a points variable.

The idea is that I want a view to return it in the order I except, and
not make many Ajax calls for example, to retrieve them and make them
look like they're ordered correctly.

This is what I got so far: Each document is a comment. Each comment
has a property `path` which is an ordered list containing all its
parents. So for example, imagine I have 4 comments (with _id `1`, `2`,
`3` and `4`). Comment `2` is children of `1`, comment `3` is children
of `2`, and comment `4` is also children of `1`. This is what the data
would look like:

{ _id: 1, path: [1] },
{ _id: 2, path: [1, 2] },
{ _id: 3, path: [1, 2, 3] }
{ _id: 4, path: [1, 4] }

This works quite well for the hierarchy. A simple `view` will already
return things ordered with each comment underneath the correct one.

The issue comes when I want to order each level of the tree
independently. So for example documents `2` and `4` belong to the same
branch, but are ordered, on that level, by their ID. Instead I want
them ordered based on a points variable that I want to add to the
path - but can't seem to understand where I could be adding this
variable for it to work the way I want it.

Is there a way to do this? Consider that the points variable will
change in time.

Thank you,
Luca


Re: Hierarchical comments Hacker News style

2012-05-16 Thread Luca Matteis
Hi Nick,
This in fact was also something I came up with. I ditched it because,
like you said, it requires to update all the descendants. Which means
a lot of extra overhead. Not only the direct descendants, but all the
descendants. So a top comment could easily be replied more than 20
times, and each of those other 20, etc. etc. This would mean that I
would have to update more than 50 documents each time a user clicks on
the upvote button - not to mention the conflicts.

Isn't there a better way?

On Wed, May 16, 2012 at 2:43 PM, Nick North nort...@gmail.com wrote:
 I may be misunderstanding the problem, but would it work if you represent
 each comment by a list of its score and its id? Say comments 1, 2, 3, 4
 have scores 40, 30, 20, 10 respectively, then the documents would become:

    { _id: 1, path: [[40,1]] },
    { _id: 2, path: [[40,1], [30,2]] },
    { _id: 3, path: [[40,1], [30,2], [20,3]] }
    { _id: 4, path: [[40,1], [10,4]] }
 Then indexing on the path will now put comment 4 before comment 2. If two
 comments with the same parent have the same score, they will be ordered by
 id. If you want the date in the ordering, that's just another element in
 the list.
 The problem with this is that any change to the score of a parent comment
 requires the paths of all its descendants to be updated. But it feels as if
 that might be inevitable, as changing the parent score may move an entire
 subtree around in the ordering so the index of all elements of the subtree
 must change.

 Nick

 On 16 May 2012 12:27, Luca Matteis lmatt...@gmail.com wrote:

 I know how the ranking works actually. I described how I'd like to
 concentrate on simply ranking each level by its points.
 The issue is actually in the adapting this structure to Couch.

 On Wed, May 16, 2012 at 12:26 PM, Tim McNamara
 paperl...@timmcnamara.co.nz wrote:
  It may be worth looking at the reddit  source code (
 github.com/reddit/reddit)
  to get some tips. Then you could adapt this into Couch.
  On May 16, 2012 9:41 PM, Luca Matteis lmatt...@gmail.com wrote:
 
  I'm trying to implement a basic way of displaying comments in the way
  that Hacker News provides, using CouchDB. Not only ordered
  hierarchically, but also, each level of the tree should be ordered by
  a points variable. If you're familiar with sites such as Hacker News
  or Reddit you know that each level of the comment tree is ordered by
  the amount of points and also the date they were posted - however, for
  sake of simplicity I'll just talk about a points variable.
 
  The idea is that I want a view to return it in the order I except, and
  not make many Ajax calls for example, to retrieve them and make them
  look like they're ordered correctly.
 
  This is what I got so far: Each document is a comment. Each comment
  has a property `path` which is an ordered list containing all its
  parents. So for example, imagine I have 4 comments (with _id `1`, `2`,
  `3` and `4`). Comment `2` is children of `1`, comment `3` is children
  of `2`, and comment `4` is also children of `1`. This is what the data
  would look like:
 
     { _id: 1, path: [1] },
     { _id: 2, path: [1, 2] },
     { _id: 3, path: [1, 2, 3] }
     { _id: 4, path: [1, 4] }
 
  This works quite well for the hierarchy. A simple `view` will already
  return things ordered with each comment underneath the correct one.
 
  The issue comes when I want to order each level of the tree
  independently. So for example documents `2` and `4` belong to the same
  branch, but are ordered, on that level, by their ID. Instead I want
  them ordered based on a points variable that I want to add to the
  path - but can't seem to understand where I could be adding this
  variable for it to work the way I want it.
 
  Is there a way to do this? Consider that the points variable will
  change in time.
 
  Thank you,
  Luca
 



Re: Hierarchical comments Hacker News style

2012-05-16 Thread Luca Matteis
Ok. Where would it be appropriate to build such a tree? Can I do it in
a list function?
I'm using Couch directly and not interacting with it using other
languages, so I need Couch to do all the work.

On Wed, May 16, 2012 at 3:14 PM, Dirkjan Ochtman dirk...@ochtman.nl wrote:
 On Wed, May 16, 2012 at 2:53 PM, Luca Matteis lmatt...@gmail.com wrote:
 Isn't there a better way?

 Since the ordering of descendants depends on the scores of ancestors
 (if you're talking about getting the whole thread in order), and you
 don't want to update descendants when ancestors get modified (scores),
 there by definition is no way to cleanly do this. I think the best way
 you can do it is to emit the [ancestor_id, score] for each comment,
 which I think would allow you to build the tree structure in a single
 loop over all documents:

 docs, roots = {}, []
 for key, doc in documents:
    if key[0] == null:
         roots.append(doc.id)
    docs[doc.id] = doc
    if key[0]:
         docs[key[0]].children.append(doc.id)

 (In horrible pseudo-Python-JS.)

 Cheers,

 Dirkjan


Re: Hierarchical comments Hacker News style

2012-05-16 Thread Luca Matteis
Sean,
interesting. What would be the drawbacks of this other than the
conflict issue? How would I order the comments by score - would my
view need to do the logic? Also, what if there's *many* comments to a
post. How much can a single document handle?

Luca

On Wed, May 16, 2012 at 5:32 PM, Sean Copenhaver
sean.copenha...@gmail.com wrote:
 Is it not possible to maintain the scores and ordering in a document by
 itself? Something like

 {
    _id: whatever
    post: post id
    comments: {
         top level comment id: { score: ##, children: comments of
 similar structure },
         another top level comment id : etc
    }
 }

 A view could easily allow one call to CouchDB retrieve the original post
 and this comment scoring doc. Then you can load whatever level of comments
 you need to and know the ordering and hierarchy.

 Score changes on a comment though you would need to keep updating this
 document which can lead to conflicts. An update handler to increment the
 score and reorder the comments will help with that and if a conflict causes
 the update handler to error back to the client you just submit the same one
 again.

 I have not implemented this solution myself, but throwing out ideas. I'm
 certainly curious what others think is the best way.

 On Wed, May 16, 2012 at 9:33 AM, Dirkjan Ochtman dirk...@ochtman.nl wrote:

 On Wed, May 16, 2012 at 3:19 PM, Luca Matteis lmatt...@gmail.com wrote:
  Ok. Where would it be appropriate to build such a tree? Can I do it in
  a list function?
  I'm using Couch directly and not interacting with it using other
  languages, so I need Couch to do all the work.

 Should be possible to do it in the list function, but I haven't worked
 with list functions before.

 Also note that this topic is solidly off-topic for dev@, and should
 actually be discussed on user@.

 Cheers,

 Dirkjan




 --
 “The limits of language are the limits of one's world. “ - Ludwig von
 Wittgenstein

 Water is fluid, soft and yielding. But water will wear away rock, which is
 rigid and cannot yield. As a rule, whatever is fluid, soft and yielding
 will overcome whatever is rigid and hard. This is another paradox: what is
 soft is strong. - Lao-Tzu