<br><br><div class="gmail_quote">2012/3/21 Othmane Moustaouda <span dir="ltr"><<a href="mailto:othmane.moustaouda@gmail.com" target="_blank">othmane.moustaouda@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi!<br>
<br>
>From mailing list I have known that I have a "concurrent", good! A<br>
little bit of competition will encourages both us to pull out the<br>
best! :D<br>
<br>
Returning to the project, after reading documents and after some<br>
investigations now I have clearer ideas about how to implement it:<br>
since is a plain text editor I have to focus only on the text content,<br>
omitting details like font size, font type ecc., so I thought that<br>
should be possible to manage the text's changes through a mechanism<br>
based on diffs, i.e. each time an user makes a change to the shared<br>
text, a diff will be generated and shared to all other participants.<br>
<br>
In order to make this possible, in my vision, something like a<br>
checksum is needed, to ensure that all participants are working on the<br>
same text. Another key point is that one of participants must act as a<br>
"central node", why? Because if, for example, due to a network issue,<br>
one or more participants have a different version, what is the right<br>
version on which to base the different others? Is the one hosted by<br>
the participant that is acting as central node. Who can play this role<br>
can be, for example, who has started the collaboration, or maybe<br>
better, who has the fastest connection.<br>
<br>
All these informations will be transmitted via a D-Bus Tube, I thought<br>
that for this case a D-Bus Tube is more convenient for use than a<br>
Stream Tube as it offers the possibility to handle events via signals<br>
(for example an user login or logout, or a text modify).<br>
<br>
About the diff part, since Qt doesn't offer something for generating a<br>
diff between two strings, I have to use some kind of library that<br>
offers a diff algorithm, searching I found  a very few of interesting<br>
things, one of them is this (<br>
<a href="http://code.google.com/p/google-diff-match-patch/" target="_blank">http://code.google.com/p/google-diff-match-patch/</a> ) a very nice<br>
library! I thought that maybe is better using a well known library<br>
available already packaged?<br>
<br>
I made an initial UI draft, it's very basic, something like a starting point<br>
<a href="http://dl.dropbox.com/u/61029609/ui_draft1.png" target="_blank">http://dl.dropbox.com/u/61029609/ui_draft1.png</a><br>
a little graphical detail (adopted by almost collaborative editors)<br>
could be that each participant will have its own color and every<br>
addition made by him will have that color as background.<br>
<br>
Surely I wrote something stupid, let me know please! :D<br>
<br>
<br>
Othmane<br>
_______________________________________________<br>
KDE-Telepathy mailing list<br>
<a href="mailto:KDE-Telepathy@kde.org" target="_blank">KDE-Telepathy@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-telepathy" target="_blank">https://mail.kde.org/mailman/listinfo/kde-telepathy</a><br>
</blockquote></div><br><div>Hi, Othmane!</div><div><br></div><div>I'm glad to know I'm not alone in this kind of research :)</div><div><div><br></div><div>But, unfortunately, I see some disadvantages of your methods. Finding diffs in strings is a good idea, but until you work only with simple text information (or it would be something big like git). Also because this you need to know what is the right version of a document and need to apply client-server based architecture.</div>
<div><br></div><div>I want to offer other proposal. In this kind of situation (when we have possibility of massive collisions) i think it would be appropriate take a look on the DB architecture. In my project every action of the users would be a transaction. Each transaction would have the exactly time and simple (atom) sequence of action (likewise "create document", "add character a", "users 1 cursor go to left"). In that way I can manipulate any kind of date, not only the text. <a href="http://dl.dropbox.com/u/10671824/im1.png">Owerview</a></div>
<div><br></div><div>Take a look on the <a href="http://dl.dropbox.com/u/10671824/im2.png">collision detection</a>. Every client send his own transaction to other clients and receive transactions from other clients. If time in received transaction is grater then in the last transaction in transaction list, then the last transaction undo and time compares in received and second from the tail. When program find right place for received transaction it just applies needed action of this transaction and redo all cancelled transactions.</div>
<div><br></div><div>In this way I get rid from the server, because all of the clients know what and when  has been done. Plus I can extend my text editor in somethig big like a basket in the future.</div><div><br></div><div>
I think in the first I must choose right architecture for the program and in the second - implementation details. For this purpose I already start writing some prototype on the Qt and, I hope, I can represent it to you, guys, in just a couple of days. :)</div>
<div><br></div><div>Good luck!</div><div>Mikhail</div></div>