Archive

Posts Tagged ‘sdk’

beWeeVee SDK - January 2010 Released

January 18th, 2010

Reading time: 1 - 2 minutes

After the feedback received during the lasts months, we’re ready to publish our latest release of the SDK of beWeeVee. As we always do, we hope to count on your feedback and advices.

Features

  • API for .Net to include live collaboration features.
  • Conflict-free Data Synchronization through Operational Transformation.
  • Native API Support for Simultaneous Text Edition.
  • Extension model for the beWeeVee API base classes.
  • Support for Client-Server and Peer-to-Peer architectures.
  • WPF and Winforms technology samples.
  • Javascript/Silverlight interoperation example.
  • Microsoft Peer-Networking (P2P) technology samples.
Supported Runtimes
  • .Net 3.5 on Visual Studio 2008
  • .Net 4.0 Beta 2 on Visual Studio 2010
  • Silverlight 3.0 (special built version for Silverlight 4.0 Beta also available for licensees)
  • Javascript (through Silverlight Interoperation, requires Silverlight installed on the client).
Download
  • Share/Bookmark

Technology , ,

Announcing the availability of the beWeeVee SDK September CTP

September 29th, 2009

Reading time: 4 - 6 minutes

One of the most important outcomes of showing what you are doing face to face is that you get immediate feedback. That was exactly what happened last Saturday at the Buenos Aires’ CodeCamp 2009 event where we gave talks about beWeeVee and Microsoft Surface.

We had a booth at the event, so feedback started to come pretty fast. Some of the developers there, had already heard about Google Wave; so the concept of co-operation aka “really real-time collaboration” was already understood. From 1500 attendees, only a few knew that there was a company in Argentina that had been pursuing a similar vision, so they were set for a surprise.

Furthermore, a vision where someone can author digital artifacts in co-operation with many peers, through software designed from the ground up to exploit those interactions; was simple to realize when they were able to play with the Notepad Tech Preview at the booth. Definitely it gave a hint of what was going to be expected from our talk about it.

We called the talk “Cocinando una aplicación Silverlight en una hora” (that in english would sounds like “Cooking a Silverlight Application in 1 hour”), that scored another very important point. We were set for a live coding session where we would start the application from the very beginning, aka “File->New Project” and we would end with a beWeeVee enabled application using Model-View-ViewModel in Silverlight 3.

Then we where set for a surprise, the session was scheduled to start after the lunch break at 3:00 PM. When we arrived there at 2:35PM to setup everything, the room was already full. With the help of the organization team, we took out from the room all the extra stuff (like some tables) to make more room; without much success at 2:45PM with the extra room already taken and people already sitting in the floor we had to close the door. To be true, that was a little shocking but it gave us an idea of the kind of feedback we were going to get.

We started from the design and moved through the implementation of the sketching application using MVVM, until we “faked” the synchronization using a single ViewModel in the same instance. It was the time to introduce beWeeVee, the why and how to achieve the co-operation goals. That part of the presentation was fast, but people was also excited. They wanted to know when we were going to release the bits we were using to achieve those results.

The questions regarding the SDK continued after the session at the booth, so we decided to build and release a Community Tech Preview of beWeeVee for everyone to try out. Those are the bits that we used for the CodeCamp demo and presentation with our own internal documentation that we know is a little bit too sketchy, but it shows the most important parts of the API.

In the SDK we had included: Download beWeeVee SDK Community Tech Preview

- beWeeVee API Binaries for .Net 3.5 and Silverlight 3.
- beWeeVee API Documentation in Compiled HTML (.chm).
- “How to write beWeeVee enabled applications in Word 2007 Format” also available on the blog.
- 2 WPF Notepad examples (Server based and P2P -wcf peer channel- based example).
- 3 “Silverlight 3″ examples (including point based sketching, stroke based sketching with server in the same form and stroke based sketching with server).
- 1 beginners very basic WinForm example on how to write your own control with the Low-Level API.

By using the SDK you are agreeing with the TECHNOLOGY PREVIEW LICENSE AGREEMENT found in the License.txt file.

As promised to those attending the session, you can also download in a separate bundle as academic support material from: Download CodeCamp Academic Material

- The CodeCamp MVVM example with “fake synchronization”.
- The CodeCamp MVVM example with real synchronization using beWeeVee.
- The PowerPoint we used at CodeCamp (the PowerPoint is in Spanish, but it has some interesting diagrams of how things look like).

Disclaimer: All background graphics had been used under what we considered academic fair use, with the aim to set the mood of the presentation (and because they allowed to show a more humane — and less technical — theme). If you are the owner and do not consider it fair use, send a mail to info@corvalius.com and we will remove it immediately.

We had setup a forum where you can leave and vote any idea, feedback, comment or bug report at http://beweevee.uservoice.com. For us your feedback is very important.

Happy Coding,
beWeeVee’s Team

  • Share/Bookmark

Corvalius, Technology , , ,

How to write beWeeVee enabled software – Part 3

September 21st, 2009

Reading time: 8 - 14 minutes

 

In the first two articles we explained how beWeeVee works under the hood [1] to create a seamlessly experience developing applications that can synchronize changes on data structures preserving positional intention [2].

We also introduced the ITextView and IElementView<T> client APIs to easy interact with linear data structures (aka Lists of stuff). Linear structures are more common that one may think at first though, so today we will present an example that shows how a linear structure can accomodate pretty interesting behaviors. All these examples, complete with source code will be released at part of the SDK of beWeeVee. We have already send some copies of a pre-CTP to some interested parties, if for some reason you think that it may be interest to you, and want early access to it; just let us know and we can arrange for an sneak peek. 

The sketcher sample explained

The ability to handle text is pretty understandable in itself (even though you can work on more structured things like XML), so we will focus on something a little bit different. We would like to create an application that will be able to show how beWeeVee can handle other not so common and simple scenarios.

Co-operation (aka Real-time Collaboration) is becoming pretty common in web environments, but with beWeeVee all applications can make use of those features; games have been doing it for years in the restricted model provided by the rules of the objects they use. Our rules are going to be simple:

1. When I draw something I want my other party to see the same thing.

2. But if the two of us draw at the same time we want everybody to be able to see exactly the same and be able to operate over it in exactly the same way; there is no room for inconsistency.

With beWeeVee we are able to achieve Convergence and that is the utility of the approach, when Convergence is achieved both of us will see exactly the same outcome up to the underlying representation level in a consistent way.

So if our representation is at the stroke level, we want to ensure that we are always drawing our strokes in the appropriate depth level. As noted before the data structure has to be linearizable, if we treat every stroke as a simple element (note that we can lift this requirement also ;) ) and put the strokes in a list and use the index of the list as the depth cue, we are simply creating a list of strokes.

We have seen before a way to achieve this using the following code:

public class SynchronizableStrokeCollection : ElementView<SerializableStroke>
{
   public SyncronizableStrokeCollection()
   {
      [...]
   }

   public StrokeCollection Strokes { get; set; }
   [...]
}

It is pretty simple to see that the SerializableStroke is our underlying representation, while the StrokeCollection is just a wrapper usable by WPF or Silverlight to perform the drawing on the screen.

But what is a SerializableStroke anyways? An Stroke is defined as a list of points in a 2D space so we can define it as:

public struct SerializableStylusPoint
{
   public double X { get; set; }
   public double Y { get; set; }
}

public class SerializableStroke
{
   public SerializableStroke()
   {
       StylusPoints = new List<SerializableStylusPoint>();
   }
   public IList<SerializableStylusPoint> StylusPoints { get; set; }
}

Adding and removing strokes is as simple as defining Add and Remove methods. We are going to concentrate on the adding because it is the only method provided in the Sample. But removing items is just selecting the appropriate object and well call Remove :)

We decided to use an InkPresenter that is going to provide use with points created from the mouse.

clip_image002

When we find a MouseDown event we start to create an stroke (a list of points) and when we received the MouseUp we are done with the Stroke.

clip_image004

As we can see in the extract we are providing methods to compose a stroke internally until it is ready to be put in the beWeeVee managed collection.

public class SynchronizableStrokeCollection : ElementView<SerializableStroke>
{
    private Stroke stroke;
[...]

    public void StartStroke()
    {
        // start a new stroke
        stroke = new Stroke();
        // adds the stroke to the stroke collection
        Strokes.Add(stroke);
    }
    public void AddPointToStroke(StylusPointCollection point)
    {
        // checks if a stroke is being created
        if (stroke != null)
        {
            // add a new point to the stroke
            stroke.StylusPoints.Add(point);
        }
    }
    public void EndStroke()
    {
        if (stroke != null)
        {
            // inserts the stroke on the sync list
           End.Insert(stroke.ToSerializableStroke());
            // create the stroke positions
            stroke = null;
        }
    }
}

The most important part in the code is the: End.Insert(stroke.ToSerializableStroke()) statement. In there you can see that we are getting the End Range (a 0 length tracking range that always point to the end of the list) and inserting at the end a Serializable Stroke created from the real WPF/Silverlight constructed Stroke.

When you are adding the element into the stroke you are ensuring that beWeeVee is already tracking the positional information for that element into that position. However there is a very important thing that we haven’t discussed before, how to send out a message to other beWeeVee instances.

BeWeeVee itself prefers to know nothing about how you prefer to communicate with other instances; however, it provides a reference implementation using Protocol Buffers that can be embedded in almost any method of communication; we also provide the ability to serialize with standard binary encoding too (when available).

In this particular example we are using beWeeVee to synchronize 2 copies in the same process so it is as easy as to send the operation into the other instance. This is a pretty simple way to perform demos but a pretty unrealistic scenario; you can find a WCF implementation to the same idea in the SketcherWithDuplexSample with a very simple server. For high throughput you should use TCP sockets implementations or P2P (PeerNetworking) if in Desktop environments for better performance and low latency response. Don’t worry we will post about it soon, and yes, we have a sample covering P2P technologies too. BeWeeVee after all is designed to handle both standard Client/Server and PeerToPeer scenarios.  

The code to perform the reception is the following:

// creates synchronizable collections
var ssc1 = new SynchronizableStrokeCollection();
var ssc2 = new SynchronizableStrokeCollection();

// wires up the synchronization
ssc1.Controller.OnBroadcast += (operationSender, args) => ssc2.Controller.ReceiveOperation(args.Operation);
ssc2.Controller.OnBroadcast += (operationSender, args) => ssc1.Controller.ReceiveOperation(args.Operation);

It is pretty simple to notice that each SynchronizableStrokeCollection has also inherited its own ConcurrencyController. What we do is to cross wire them, when the Controller expects to broadcast an operation we are telling the other one to receive it.

If we want to use WCF instead of memory copy we would be doing something pretty similar. As in our example we are deciding that both parties are running in the same browser instance (for simplicity only) then we have 2 InkPresenters so we are sending and receiving from the Server in different proxies:

client1 = new ServerClient(binding, address);
client1.ReceivedReceived += (s, arg) => ssc2.Controller.ReceiveOperation(DeserializeOperation(arg.operation));

client2 = new ServerClient(binding, address);
client2.ReceivedReceived += (s, arg) => ssc1.Controller.ReceiveOperation(DeserializeOperation(arg.operation));

// wires up the syncronization
ssc1.Controller.OnBroadcast += (operationSender, args) =>
  {
     var buffer = SerializeOperation(sessionId, args.Operation);
     client1.ReceiveAsync(sessionId, buffer);
  };
ssc2.Controller.OnBroadcast += (operationSender, args) =>
  {
     var buffer = SerializeOperation(sessionId, args.Operation);
     client2.ReceiveAsync(sessionId, buffer);
  };

Up to this moment we have seen how to receive an operation and how to broadcast the operation to the other parties, however, nothing have been done to act when remote operations come from the other sites.

To that we are going to go back again to the SynchronizableStrokeCollection as it has the Controller that should be able to act when operations are sent from the outside. The ElementView<T> is already wired to handle the remote operations, but as we want to also perform those changes into the local stroke collection we also need to wire up the OnRemoteOperationReceived event to execute the operation in the StrokeCollection.

public SynchronizableStrokeCollection()
{
   // stroke collection creation
   Strokes = new StrokeCollection();
   // wires up the operation received event
   Controller.OnRemoteOperationReceived += (sender, args) =>
   args.Operation.Execute(Strokes, serializableStroke => serializableStroke.FromSerializableStroke());
}

As seen in this code extract that is pretty simple, however as we are using  SerializableStrokes to bypass the serializable restriction, we must be able to execute the operation on different type of list. For that, we use a special version of the Execute Command that allows us to convert from a serializable version into a WPF/Silverlight native version.

With that in mind you have all the required building blocks to start synchronizing your linearizable data structures.

Special thanks to Daniel Iglesias from Huddle Group because he programmed the first sketcher demo. Moreover if you are here in Argentina, we will be showing an extended version of this example at Buenos Aires’ CodeCamp 2009 next saturday (26th of September). We will start from the classic “New Project” on Visual Studio up to a WCF Server aware implementation running with a custom server. All, except the server, coded step-by-step in 1 hour using Silverlight 3, Model-View-ViewModel and WCF’ duplex channels. So see you there if you are around.

  • Share/Bookmark

Technology , ,

How to write beWeeVee enabled software – Part 2

September 14th, 2009

Reading time: 4 - 6 minutes

 

In the first part of this article we have been exploring how beWeeVee works under the hood, as many other frameworks like Google Wave it resorts to an Operational Transformation Framework.

We also talked about linearizable structures, that is the base of the current beWeeVee implementation that will be released in the CTP. Text as we know it easily linearizable, as you can treat each character as an element on a list. Other things require a little more though, but we are going to show how to create a type independent elements list.

We will focus on explaining how to modify the structures using a Range API that is the base of the ITextView and IElementView<T> helpers.

 

How to use it for ITextView

The ITextView is a high level representation of a simple text document with edition capabilities based on Range primitives. Ranges are primitive types lately popularized by Andrei Alexandrescu at the Boost Conference [1] and are defined as a pair of begin/end iterators that are packed together as a high level entity. Ranges are perfectly suited to handle the signaling process required by beWeeVee, provide a verifiable and extensible API as they allow easy composition and are a superior abstraction.

The current SDK version only supports non-tracking Ranges, so they are invalidated after an editing operation is performed. After any edition operation is performed it will be returned a new Range accounting for the edition operations that were performed.

Let’s suppose that we want to create a Text Document with “ABC” as its content, and then create a range spanning the entire document.

var textView = new TextView(”ABC”);
Range all = textView.CreateRange(0, 3);

Now all is a range that has “ABC” as its content. If we would wanted to create a range that has on “BC” we would have do the following:

var textView = new TextView(”ABC”);
Range partial = textView.CreateRange(1, 2);

Note that we are starting the range at position 1 and giving it a length of 2. Now let’s suppose that we want to add an “X” before the “B”. It is as simple as:

var textView = new TextView(”ABC”);
Range partial = textView.CreateRange(1, 2);
partial = partial.InsertBefore (”X”);

Now the new partial range contains “AXBC” because it has added before “X” so its length is 4 and the start position is still 1. You can also insert at a specific position inside the range with the InsertAt method.

var textView = new TextView(”ABC”);
Range partial = textView.CreateRange(0, 3);
partial = partial.InsertAt (1, “XX”);

The result of inserting “XX” at position 1 of the range starting and 0 with Length equal to 5 is “AXXBC”. You can also shrink or expand the ranges in any direction using the appropriate methods and delete or replacing range content with something else.

On the background, the Range will signal the ConcurrencyController of the TextView of the changes and transform those operations into canonical form to be sent to the other parties.

 

How to use the IElementView

The IElementView<T> is a high level representation for elements lists similar to the ITextView but allowing any arbitrary serializable type. It also provides a Range based interface to interact with the content.

It’s usage pattern similar to the TextView, but provides the ability to synchronize more complex structures. The biggest advantage is that allows the developer to control the representation and complexity of the information exchange. For example, you can use Silverlight Stroke class (a non serializable type) and create a synchronized data structure with just a few lines of code.

In the SketcherSample, that we will cover in the third part of this series, we will show a sample where you will be able to see how to perform non serializable types’ adaptation and extending the ElementView<T> through inheritance (it can be possible to also use it without inheriting) to create a synchronized drawing pad.

As a sneak peak I think you can fill in the blanks of what it is needed from this simple code:

public class SynchronizableStrokeCollection : ElementView<SerializableStroke>
{
   public SyncronizableStrokeCollection()
   {
      [...]
   }

   public StrokeCollection Strokes { get; set; }
   [...]
}

In the SynchronizableStrokeCollection example we are creating an ElementView with a SerializableStroke that is a wrapper over the Stroke data structure used in WPF and Silverlight. We exposed the StrokeCollection to perform data binding on the InkPresenter that will show those strokes.

You may be asking yourself: “Could it be so easy?”. You will know pretty soon, so stay tuned.

  • Share/Bookmark

Technology , , , ,

How to write beWeeVee enabled software – Part 1

September 7th, 2009

Reading time: 4 - 6 minutes

 

In the process of preparing the SDK for public consumption, I have been writing some stuff that may be of interest to understand how beWeeVee works under the hood.

Overview

The basis of the beWeeVee engine is an Operational Transformation that has been designed to work with standard .Net collections. Operational Transformation (OT) is a technology that allows a wide range of collaboration functions. In short it allows to synchronize shared copies of data structures achieving convergence, no matter how many processes are involved in modifying it at the same time. Typically OT Frameworks are composed of an OT function and a Concurrency Control algorithm that ensure Causality Preservation, Convergence and Intention Preservation (CCI Model).

BeWeeVee achieves synchronization of shared copies using an OT function that is formally proved to achieve convergence and intention preservation and a concurrency control protocol that allows to execute the operations performed over the copies in a P2P distributed system.

The concurrency control algorithm determine:

1. Which operation should be transformed against which causally ready operation,
2. The order of the transformations to be performed,

while the Transformation function define how different operations are transformed.

The basic idea is that given a linealizable data structure, you can signal beWeeVee of any Insert and Delete operation performed over a data structure allowing it to be modified by several parties without violating the CCI model. That frees you (the developer) of ensuring that the data structure of the parties are equal.

BeWeeVee provides a low level API that allows the developer to notify the concurrency control algorithm of the changes (Operations) that were performed externally to the data structure and the Operations that arrive from the external sites. There are 3 types of operations that the ConcurrencyController may know about:

- Insertion operations,
- Delete operations and
- Identity Operations.

The latter is for internal use and really it doesn’t have any use from the users point of view. On the other hand, Insertion and Deletions are the basic operations that in the end allows the shared copies to be synchronized.

BeWeeVee also provides a high level API that provides the ability to create synchronizable lists that perform all the signalling necessary by themselves. The ITextView and the IElementView<T> are those; they are optimized for random insertions and deletions and allows you to handle Text in the first, and any Serializable type in the latter. Other mapping mechanisms to handle non serializable types are also in place.

BeWeeVee supports discrete revisions but the Low Level API provided by this CTP is poised to be deprecated in favor of continuous snapshots and playback abilities. Playback is a feature that allows any party to start from a predefined moment in time and transform back and forth the data structure to see what was the state at any moment in time. The Playback feature API is not being released in this CTP but it is an intrinsic property of how beWeeVee solves the concurrency problem.

How Operations work.

The operations are the basis of the beWeeVee synchronization engine, and as such the building block of any application using the Operational Transformation Engine. For simplicity we are going to do an example based on text (the usual OT example), even though the approach is valid for other data structures, not just text.

Given a text document with a string “abc” replicated at two collaborating sites; and two concurrent operations generated by two users at collaborating sites 1 and 2, respectively. We get:

O1 = Insert[0, "z"] (to insert character “z” at position “0″)
O2 = Delete[2] (to delete the character at position “2″, note that in this case we are deleting “c”)

Now supposing the two operations are executed in the order of O1 and O2 (at site 1). If we execute O1 first, the document becomes “zabc”; when we execute O2 after O1 the operation Delete[2] would delete “b” instead of the generating site intention that was deleting “c”. Therefore O2 must be transformed against O1 to become: O2′ = Delete[3, "c"]. The end result is that the positional parameter is incremented due to the prior insertion of “z” in O1. When we execute O2′ on “zabc” we are deleting “c” and the document becomes “zab”. The OT transformation will adjust the positional parameter of an operation according to the intended effect of the generating site when presented with concurrent operations, so all sites converge and maintain consistency.

The ConcurrencyController’s Low Level API is responsible in beWeeVee of all the housekeeping necessary to perform the required transformations so the developer get notified of the correct operation to perform on the data structure. Luckily for the majority of developer beWeeVee already provides High Level API constructs for text and typed serializable objects lists. Even though creating your own is not that difficult either, full source code for the ITextView and IElementView<T> is provided as examples.

This is the end of Part 1, in the next we will explain what ITextView and IElementView<T> are and how to use it in a simple way.

  • Share/Bookmark

Corvalius , ,

New version of beWeeVee and some announcements

August 21st, 2009

Reading time: 2 - 4 minutes

Today we are releasing a new improved version of the technical preview of beWeeVee’s Silverlight technology that can be accessed from: http://www.beweevee.com/notepad. [*]

Since the last time we did a public update we have added a couple of features, like revisions, colored users and faster response. From the beginning releasing the technical preview was aimed into acquiring hard-data on the behavior of the underlying technology in what we called an “on-the-wild” scenario. Thanks to early users feedback we were able to pinpoint performance issues, understand the features required to make the user experience more humane, and even suggestions on how to better improve the API (some of which didn’t get it into this release).

Serious improvements have been done at the technology level, just to name a few:

- The operational transformation is 68% faster.
- Revisions have been added allowing the users to save snapshots of their work at anytime.
- The bandwidth required to sustain proper operations have been reduced considerably.
- We have fixed some defects involving losing connection with the server after prolonged idle time.

We want to announce too that next week we are going to release a CTP of the core components of the Software Development Kit (SDK) for people that wants to experiment with the API. We definitely want to know what you are doing with it :). Another interesting development is that we have finished the proof of concept stage of beWeeVee for Visual Studio and starting on full development in 2 weeks.

You can see the concept work here:

We are extending our thanks also to the development teams at Huddle Group that used beWeeVee first preview when doing real work, the attention to detail of Dayanna pointing out defects and early feedback and Daniel Iglesias for suggestions in improving the API usability. Stay tuned for a pretty interesting demo he is preparing using beWeeVee API and Silverlight 3.0 (yes, beWeeVee is Silverlight 3.0 compliant).

Hope you will enjoy it as we do,
Federico  

[*] You can still access your old documents from http://www.beweevee.com/incrediwrite

  • Share/Bookmark

Business, Technology , ,