Real time collaboration with CodeMirror - firebase

I started this little project where I would do real time collaboration on code using CodeMirror.
I have a msgs system setup such its easy to pass objects from one user to another. My problem is getting it integrated with CodeMirror. I found out that it have events for onchange and a replaceRange(string, from, to).
I pass the onchange objects to the other users and uses the replaceRange to update the view. Problem is then when using replaceRange, it triggers an new onchange and it sends msgs back and forward. Anyone know if there are some way of updating the local view without it triggering an onchange. Or suggestings for other paths to take. (the msgs system is already set up and its easy to pass javascript objects to other clients).

You Can Use Firepad
FirePad is an open-source (on GitHub) realtime collaborative plug-in to codemirror. You can get it setup with codemirror in 4 extra lines of code and a few minutes. It's uses Firebase for the backend.

To get this to work properly, you'll have to merge changes as well. See http://ot.substance.io/ for a demo of an open-source solution (also using CodeMirror).

Related

Firebase REST-API to create shorted dynamic-links with iOS minimum version

I'm using Firebase to generate dynamic links backend side.
I need to generate shorted links, so I'm using this approach as suggested into the documentation:
https://firebase.google.com/docs/reference/dynamic-links/link-shortener
I noticed that, into this documentation, there isn't a parameter to specify the minimum version of the iOS app (similar like 'androidMinPackageVersionCode').
This is strange because using the manual approach this seams possible: https://firebase.google.com/docs/dynamic-links/create-manually
imv: The version number of the minimum version of your app that can
open the link. This flag is passed to your app when it is opened, and
your app must decide what to do with it.
Wrong documentation?
This is a known feature request. The only workaround for this is to add imv in the long link manually and creating a short Firebase Dynamic Link using a long link.

Iron:router waitOn issues

Im using Iron:router and meteor-node-csv, after uploading a file i want to read each row of it and insert it on a collection, but when i process the file the whole web freeze (buttons dont respond). Time ago this same code worked 100% fine, after some upgrades it started working like this.
So, after a lot of testing a partner found that the waitOn is a flag here.
If i process the file and try to navigate to a route having a subscription to any other collections it freeze.
If i process the file and try to navigate to a route without a subscription it works perfect
If your file is big, then reactivity is causing this issue. There are variations of that on stackoverflow in a few questions. My recommendation, described here, is to disable reactivity while processing data. You can do that using a "guard" around reactive elements, e.g., using a session variable as described in the linked answer.

How to handle offline mode for Google visualisation in GWT

I have a GWT application that uses many Google maps and charts. I want to have an offline mode where the user have the application installed on his the computer and without using the Google apps, he can continue using the other features.
For now the maps in the application throught a nullpointer error because they cannot initialize. I thought about checking the internet connection in EntryPoint and change the behaviour accordingly, but I am hoping for a simpler solution. Any thought ?
per https://developers.google.com/chart/interactive/faq#offline
You cannot do that:
Can I use charts offline?
No; your computer must have live access to http://www.google.com/jsapi in order to use charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included jsapi script, and is called when you invoke the google.load() method. Our terms of service do not allow you to download the google.load or google.visualization code to use offline.
Can I download and host the chart code locally, or on an intranet?
Sorry; our terms of service do not allow you to download and save or host the google.load or google.visualization code
Update
I thinks the terms and conditions are changed now. As you can save and download JsAPI, ServiceBase to use charts offline.
But you still can't make ajax calls :Ajax
Hope it will be available soon, cheers!

WF4 versioning - how do I cancel / terminate an invalid instance?

I've got a state machine workflow implemented using WorkflowFoundation 4.1. I'm using the SQL Server persistence store and the WorkflowApplication class for loading and running workflows.
I'm making changes to the state machine workflow model, and am finding that existing instances break very easily. I've written code that can replay the workflow back into the correct state, which is basically a migration, which works fine, however I need to be able to clear out the old workflow instance as well.
The main issue is that if the workflow is invalid, I can't even load it, so I can't terminate or cancel it either.
Is there a way to use the workflow API to remove a workflow without loading it (ie, some command on the SqlPersistenceStore), or do I have to clean the database manually?
The SqlWorkflowInstanceStore doesn't allow you to do so directly. You will need to go into the database and delete the record there. If you are using AppFabric there is actually a command to delete a workflow instance without loading it first for just that purpose. There should be a PowerShell command to do that using code.

Integration testing using Selenium and NUnit - From UI to DB

I am having some problems while trying to create integration tests with Selenium and NUnit.
I'm trying to use Selenium RC in NUnit test to drive my ASP.NET web app, and would like the tests to actually do all the stuff in DB that the real user would do. Naturally it would be nice if the database could get rolled back after Selenium has done it's thing, and i've asserted that db contains the new rows (etc) with the data from the ui.
So, here's the setup i have (in some sort of pseudocode):
TestMethod()
{
Using(new TransActionScope)
{
Selenium.StartSelenium()
Selenium.SelectAndClickAndDoStuffInUI()
AssertSomething()
}
}
Now, the SelectAndClickAndDoStuffInUI-method clicks around in UI and thus fires up our proprietary da-framework. Our framework writes all the stuff into db, and the AssertSomething-method asserts that everything is fine in db. Framework uses transactions ("required") in it's inner workings.
So everything is fine, right? No, sadly not. The TransActionScope in the example above shouldn't get committed (no txScope.Complete()-call there), and thus all the inner transactions should get rolled back too, right? Well they do not, and everything Selenium does through the UI gets committed to DB.
I've really tried to understand where this goes wrong, but so far haven't found the answer.
Thanks for reading, and (finally) here's the actual question:
Why the TransactionScope does not get rolled back in the case shown in my example?
I will gladly provide additional information about the situation and setup!
You are using a UI to an asp app. That means your test is not able to rollback the changes you made.
The transaction scope can only work in your own process. How is the transaction manager able to undo the click inside a webinterface? It could be anywhere. Selenium is just remote controlling a browser.
You should create your "real" unit tests with mock objects, and not access the database at all. Its a little hard with a normal asp page, but you cant take a look at asp.MVC to find a possible solution to this problem.

Resources