News for hackers. Stuff that matters.
Re:ShareJS – Live concurrent editing in your app by ilaksh on Wednesday May 02, 2012 @06:10AM (#3918306)
Based on the amount of trolling, 'penis' and other garbage inserted into that textarea, Hacker News readership must include a fairly large number of idiotic children.

This is why we can't have nice things.

Re:ShareJS – Live concurrent editing in your app by josephg on Wednesday May 02, 2012 @08:39AM (#3918720)
At the risk of spreading the trolls, for more civilized discussion check out the wiki: http://sharejs.org/wiki/Main
Re:ShareJS – Live concurrent editing in your app by tvon on Wednesday May 02, 2012 @03:24PM (#3920691)
Eh, I'm not sure I'd blame HN, someone was trying to insert various porn-related sub-reddit links when I was looking this morning.
Re:ShareJS – Live concurrent editing in your app by powertower on Wednesday May 02, 2012 @10:12AM (#3919120)
Careful. People are inserting and executing their own JS on that page.

I got several popups (alerts) with the word Faggot in them in my browser after I let the page sit for 10 minutes.

Re:ShareJS – Live concurrent editing in your app by pilap82 on Wednesday May 02, 2012 @05:39AM (#3918240)
After hitting HN, this could be viewed as a text version of chatroulette… you don't know what you'll find, but it's probably not pretty. :o)
Re:ShareJS – Live concurrent editing in your app by Inviz on Wednesday May 02, 2012 @10:51AM (#3919325)
Always wanted to ask: Isn't google's diff-match-patch library suitable for the same thing? It can apply patches to altered input pretty nicely.

Is there a conceptual difference? Diffs support all types of operations - insert, remove, replace. I'm really curious about realtime collaboration, but can't decide which is the right tool for the job.

Re:ShareJS – Live concurrent editing in your app by tarr11 on Wednesday May 02, 2012 @12:05PM (#3919769)
Operational transform is not the same as diff-match-patch.

DiffMatchPatch gets confused pretty easily around similar content. It uses lexical similarity to determine the patch. It often fails, and the API actually tells you that it was unable to apply a patch. For example, if you make a huge change to a file, diffMatchPatch will be unable to generate a patch file.

Operational Transform, on the other hand, uses some an ordered sync to ensure that changes are applied in a consistent way across all clients. It woudln't fail in the same way and is resilient to more kinds of changes.

Re:ShareJS – Live concurrent editing in your app by jhealy on Wednesday May 02, 2012 @09:25AM (#3918887)
We're using ShareJS in production for the authoring side of http://theconversation.edu.au - it's brilliant and solved most of our collaborative editing pain.

If only it wasn't written in node....

Re:ShareJS – Live concurrent editing in your app by josephg on Wednesday May 02, 2012 @09:31AM (#3918918)
[ShareJS author] I've considered rewriting ShareJS in C a couple times.

For science, I ported the core operational transform algorithm code from coffeescript into C and got a ~10% reduction in code size and an 8x performance boost. The networking and database code won't translate anywhere near as well, but it may still be worth doing at some stage.

Re:ShareJS – Live concurrent editing in your app by pie on Wednesday May 02, 2012 @10:00AM (#3919057)
See also: Google Wave, open-sourced as Apache Wave.

http://incubator.apache.org/wave/

The architecture for Wave is really difficult to get a handle on, though.

Relative ease of use is a major benefit of ShareJS, though I can't fully vouch for its algorithmic correctness. I've been meaning to contribute some additional tests to the project.

Re:ShareJS – Live concurrent editing in your app by paulirish on Wednesday May 02, 2012 @10:50AM (#3919316)
The engineer behind ShareJS worked on Google Wave for two years.
Re:ShareJS – Live concurrent editing in your app by pie on Wednesday May 02, 2012 @01:00PM (#3920056)
I know - but having developed an OT library and read the ShareJS code thoroughly, I think there MAY be 2 edge cases where conflict resolution is not symmetrical for some data types. Or I could be totally wrong.

As I mentioned, I hope to contribute tests to show that everything's peachy. Not trying to talk trash about this great library.

Re:ShareJS – Live concurrent editing in your app by nornagon on Wednesday May 02, 2012 @10:11PM (#3922072)
I'd be keen to know what those edge cases are. For JSON OT in particular I'm not entirely convinced it's correct (I wrote it), but it IS highly tested and fuzzed.
Re:ShareJS – Live concurrent editing in your app by zheng on Wednesday May 02, 2012 @05:53AM (#3918272)
Pasting in most of Shakespeare's works seems to have made editing non-responsive for about 30s. Pretty neat though.
Re:ShareJS – Live concurrent editing in your app by pixdamix on Wednesday May 02, 2012 @09:38AM (#3918947)
This would be a great way to enable collaborative email sharing. I always wanted a way to let someone spellcheck, review or edit a mail I was writing (Inside Gmail)

For now it's Google-docs, then copy/paste, but sharing the mail on the go would be so useful.

Re:ShareJS – Live concurrent editing in your app by lenart on Wednesday May 02, 2012 @07:16AM (#3918467)
Great work man! What I think it needs next is some sort of cursor indicator - preferably with some sort of user id. Something similar to how Google Docs did it. Keep it up!
Re:ShareJS – Live concurrent editing in your app by nornagon on Wednesday May 02, 2012 @08:02AM (#3918613)
Patches welcome ;) but see here: https://github.com/josephg/ShareJS/issues/24
Re:ShareJS – Live concurrent editing in your app by Johnyma22 on Wednesday May 02, 2012 @05:51AM (#3918270)
Also see Etherpad Lite, much easier to get started and way more features.
Re:ShareJS – Live concurrent editing in your app by sebastianhoitz on Wednesday May 02, 2012 @06:23AM (#3918333)
Well, that's not necessarilty true.

Maybe for editing a textarea with rich formatting.

But ShareJS supports much more than that. You can sync custom objects etc. Look at their examples!

Re:ShareJS – Live concurrent editing in your app by josephg on Wednesday May 02, 2012 @08:27AM (#3918682)
ShareJS is also designed to be integrated into existing applications. Etherpad is a standalone product.