Open Bokeh application in different browser tab? - bokeh

I am running a bokeh application with different tabs. I love to open same application in different browsers. So I can use different application tabs in different monitors. For now, I can only connect one browser at a time. I am using
tabs = Tabs(tabs = [tab0,tab1])
curdoc().add_root(tabs)
for opening the application. And runs with
bokeh serve myapp.py
How can I use bokeh client or anything?? Any working example??
Open Bokeh application in different browser tab?

Bokeh works the following way: The application is a blueprint to create a document. There are two documents: one on the python side (on the server) and one on the javascript side (on the client in the browser). Bokeh automatically synchronizes both documents. This means if you open a tab on the client it will also be in the opened state on the server.
When you now open a specific python document twice (e.g. open twice localhost:5006/gui?bokeh-session-id=14831) you get one python document and two js documents and all are synchronized. That means if you open a tab it gets opened in all documents, so all js documents.
If you want two js documents with different state, you need to have two python documents (e.g. by opening localhost:5006/gui). Now these two python documents are not synchronized anymore, which enables you to have two different tabs open
Now you want to have multiple js documents with different state (you want different tabs active). These cannot be synchronized to the same python document, because otherwise opening a tab in js document 1 would open the tab in js document 2. So you need two different python documents, but now these two python documents are not synchronized anymore.
From your comments I think you want to synchronize part of your documents, but not everything. As far as I know bokeh has no support for this.
One hack you could try is to disable event propagation for the tabs. Another way would be to synchronize the data you care about yourself.

My intended purpose was to see different tabs in different browsers(in different monitors). It was quite difficult to do with bokeh alone. I can open two application at different browsers but it will be a mirror of other application (If I choose tabs the same is seen in the other) or it will completely independent.
To synchronise two application I used SAMP protocol in astropy. I created one application as Server and the other as the client. The server sends the variables to the client through the SAMP protocol. Now changes in the server are received in the client but I can do independent things with the client. Like I can switch to any tab as I like. Works pretty well for my purpose.
Please see
https://docs.astropy.org/en/stable/samp/example_table_image.html

Related

Word VBA / Macro run on server Application.Run, ASP.NET, DCOM

I am not a coder but need a task done.
We have a website that builds a word doc file using ckeditor based on answers from clients.
This documents needs afterwards to be formatted (TA/TC functions of word) which cannot be done with ckeditor.
Therefore we have a VBA/ macro that needs to be run in MS word after the doc file is generated.
I want to automate this step and have the VBA/macro run, before the doc is send to client.
So from my understanding, you have to take the CKeditor doc, run the macro on the server, and store it in the current database..
Possible or not?
This should not be done server-side. Working with Office applications server-side is not supported - Office applications are end-user applications. They can easily appear to "hang" when used, due to waiting for user input.
More information about using Office on a server can be found here
Possible: theoretically, yes, but impossible for anyone to guarantee as the code and document content are unknown. But, theoretically, if it works on a desktop it can work when run on a server.
The more "correct" way to manipulate Office documents on a server is to work directly with the Office Open XML files, instead of opening them in the application interface. The file formats were designed for this scenario and execution is also much faster. I'm guessing, however, since TC and TA fields are mentioned that the macro also builds TOCs? If yes, then the document would also have to be opened in order to generate the TOC (update the field). Server-side, that would mean using Word Automation Services, which is part of SharePoint.

Open a different Shiny application by clicking link in a Shiny application

I am building my first Shiny app and have been struggling with one issue that I am not even sure if it is possible to do.
I want to allow a user to click a link (or select something or click a button; some user action), and after this I want another Shiny app to be open in front of the user (the previous one might be shut down; I no longer care about it). To put it in other words, I want to make something like the following work:
if(input$datasetlist == "cars"){
runApp("C:/.../readdata")
}
Of course, trying this naive code returns a warning:
Error in startServer("0.0.0.0", port, httpuvCallbacks) :
Failed to create server
What is the correct approach for this, if it is even possible?
There's not a way to do this now in Shiny natively, but you might be interested in Shiny Server. It allows you to host multiple applications concurrently. It will manage the startup and shutdown of apps based on whether or not they're being used.
So you could just host all your apps in Shiny Server, then provide regular links (a(href="/anotherApp")) to allow users to navigate between apps.

Loading/Saving Word Documents from Web App (asp.net MVC)

I'm making a web app. Part of it includes the automatic generation of word documents (letters). Those documents need to be opened by the end user, then saved back to the server once they've finished editing.
I tried using webdav for this but the only browser I could actually launch word from (using active-x) was IE. I also found a plugin for firefox, but for Chrome I couldn't find a way that worked.
Next I thought about making the clients map a drive to webdav (or similar), then offering up the files as file://... links, but that only works if the webpage is on the local machine.
Before I resort to ditching word (the clients won't like this) and using CKEditor or TinyMCE, is there another way?
In short, I'd like to have links to a document on the page, which when clicked are opened in word, but the file should stay remote - and then when saving, it's the remote file that gets updated.
I've also looked at Zoho but it could be very expensive for this project, plus I don't think it can be white-labelled and also looks a bit old fashioned, UI wise.
Maybe Sharepoint can do what I need? Haven't looked at that much. Also thought of making a client app to run in the system tray and deal with things.
If there was a decent way of editing Word docs from within the browser with something like CKEditor/TinyMCE and once finished, conversion back to Word format actually worked 100%, that would suffice.
I'm open to totally fresh ideas if anyone has any...
Currently Chrome, Firefox and Safari support MS Office plugin. They can open and save documents directly to server. I have tested this with MS Office 2007 and MS Office 2007 just about a month ago.
Ideally, your users would be able to use Word natively. Is there any chance you could create an Office Add-In that hooks into the BeforeDocumentSave event, looks for some indicator that the file is associated with your application, and save the updated file to your server?
Saving to the server via the Word Add-In would probably need to include some unique identifier (in addition to file name), so you could overwrite the previous version server-side. Then, if you were using something like SignalR, you could trigger a refresh on the web page when the file was saved successfully (assuming they were still on that web page) on the server (via FileSystemWatcher).
Had same problem myself.
I solved it by setting up a webdav share on the server with digest authentication (SabreDAV), and tied it into the users table on my app backend.
In relation to the client end, I solved accessing this by creating a small java applet which uses the java Desktop class (getDesktop().open()) to open the file. You will need to make sure the path is handled right for the client machine type (Windows, OS X or Linux)
You will also need to get your end users to permanently mount or map the webdav share locally.

Advanced image editing off the web

I'm building an app in ASP.NET that will store some pictures of objects. The pictures will be uploaded by suppliers and downloaded by subscribers. In between, they will have to be edited before becoming available to subscribers.
The editing involves creating a cropping path tightly around the object in the picture, in which some advanced desktop image software will have to be used I suppose.
My problem is in exchanging pictures between my ASP.NET app and the desktop software in a manner that is easy and transparent for the user.
I've done some thinking and I've come up with:
- Manually downloading and uploading the image (Not much user friendly...)
- An image editing program that can upload to a web service (Haven't found yet...)
- Develop a plug-in for an image editing program (Too advanced...)
I'd appreciate any suggestions you may have, thank you!
It sounds like you need some automation to move files between the web server and a file share. I am assuming that the number of images that need to be processed is pretty large, because if it's not, then the overhead of downloading/re-uploading each would not be that much.
So do the following:
1) Create an API for your web app that lists files that are available, or new files since some date/time, or files that have been marked as "new". The API should probably also allow marking a status on them (so you can tell it when you've finishing pulling something down, and it won't be offered again) if you don't want to trust date/time as an indicator of it being new.
2) Write an app (non-web) that runs on a schedule and uses this API to automatically download files to a shared filesystem area in your local network, and marks them as "downloaded"
The app should also monitor these files (the ones it downloaded & saved to your local share) for changes, and if changed, upload them back to your web app. To do this you may need to keep a database of filenames and modification dates/times.
This shouldn't be too hard to write in whatever language you are using for your web (assume c# or vb). By "API" I just mean, a web page that provides a list in a standardized format (e.g. json) that you can parse with your automation application, and another page that allows posting the file back for re-upload.
I'm assuming that the web server is not your own, or generally, you can't simply have it save the file uploads directly to some area where your image editors can access them. Otherwise you could just do that.
Meanwhile I came out with another possible solution.
I'm thinking of having our own windows app on the editor's computers. This app will be associated with a custom extension. When an editor downloads a file (with this extension) for editing, it will be opened in our application which in turn will open the image in some editor program.
This app will be monitoring the files for changes, and in such case, it will upload these images.
Any thoughts on this?

Flex Write File

I checked in the API, that writing a file is only in Flex Air.
Despite of that, is there still a way in Flex to write a file on the server or on the client machine ?
More concretely, it's because I have a String and I will decode it by mx.utils.Base64Decoder
to a doc. And I need to open it by Word directly on the client side, or write it on the server and return the link to the client for downloading.
Thanks
I'm doing something similar - I have built a custom grid in Flex that contains an additional button on it that allows the user to open the data up in Excel. I've done this by writing a function in PHP on the server which my Flex speaks to. This creates the CSV file on the server and the function passes the link back to the client, which in turn offers the user the chance to open the data up in Excel.
I'm using the Zend technologies to accomplish this - I recommend you take a look; they're extremely good. I used to use Flex Data Services and Java do do this but just recently switched to PHP because development time is cut down drastically as a result.
Hope this helps.
Jamie.
AIR applications run on the users' desktops. They allow you to write to the users' desktops. Nothing stops Flex/AIR applications from communicating to the server, write some files there (using a suitable backend technology) and return a link back to the user.

Resources