Is there a way to programmatically open a server-side file in a new tab? - jupyter

I'm running Jupyter notebook on a server and executing it from a client computer. In Rstudio server, one can programmably open a server-side file in a new tab via file.show. This is sometimes very convenient. For example, I have a script that processes a rather large image. Because of its size I don't want it to show directly in the output panel, rather I want to view it in a new tab. In Rstudio server I would normally do:
... image processing code ....
ggsave('temp.png')
file.show('temp.png')
This will automatically pop up the new image in a new tab once the script is finished.
Is it possible to do something similar in Jupyter?
I noticed that I could achieve this by clicking the image file in the built-in file browser, but I wonder if this could be programmed.
Similarly, is it possible to programmably open a webpage in a new tab like browseURL in Rstudio server? Note that webbrowser.open(url) doesn't quite do it because it tries to open a local browser, which in the server-client scenario will not open the new tab on the client side.

You can make a link. Relative URLs will open in a new browser tab. Files are served relative to the directory containing the notebook you are currently working on.
In Python:
from IPython.display import display, HTML
display(HTML('see image'))
Opening new tabs programmatically often triggers pop-up blockers, but publishing a link that the user clicks should be reliable.

Related

VS Live Share and Live Server

We are using VS Live Share inside Visual Studio Code and the person who joined cannot open a shared HTML file with the Live Server extension. It says: Cannot GET .../index.html. Does Live Server only work with "local files"? There is also no option to open the shared HTML file in the file system and to open it that way. Help would be nice as quick as possible.
1-press the live share extension icon in the sidebar.
2-inside session details hover over shared servers sub-category.
3-an electrical plug with a green plus sign will show, press on it and an input field will pop up.
4-inside the input field write your localhost port like this e.g: localhost:5500 and press enter.
you can find the number of your port from the bottom right of vs code if you have a live server running. it will look like this: Port:5500.
once you do this a notification will automatically show in your partner's vs code to open the shared live server.

Read/parse application content

I wanted to see the possibility of getting the text displayed by a certain installed application and running on windows in a certain open window.
Is there a generic way to access the contents of an open window?
Thanks for all your help

Prevent Chrome from closing tab that downloads CSV

I want to find out the URL to a specific CSV file on a web page. The page is built using some arcane system called QLIK, and for some reason, the CSV path does not show up in my networks panels in Chrome when hitting the download button.
When I download the CSV, a new tab is opened. I want to keep that tab open and inspect the developer tools. But Chrome immediately closes it. How do I prevent Chrome from closing the tab?
Chrome doesn't pipe network information on downloads to the network panel. They go through a different pathway then page-pound network operations. You can't inspect binary downloads.

jQuery File Upload Using Siebel OUI in IE11 Does Not Work

When I attempt to drag and drop a file onto a Siebel attachment list applet, IE11 is opening the file instead of uploading/creating new record in the applet. I can see the drop zone tag "Copy" when I hover over the applet but when I drop the file it gets opened in the same browser window. Expected result should be that the file is uploaded and added to the applet in Siebel without any prompts.
Figured it out, the browser was running in elevated mode for the dedicated client. The drag and drop does not work for local dedicated client unless you are running IE in non-elevated mode. Also, the new button on our applet was invoking "NewRecord" method instead of "NewFileAttachment" as it does in OOB Siebel account attachment applet. So I changed MethodInvoked for the New button to "NewFileAttachment" and ran the dedicated client in regular mode and drag and drop works beautifully :)

WWW::Mechanize::Plugin::Display - Always open a new window

How can I configure WWW::Mechanize::Plugin::Display, so that the plug-in always opens a new window and not only a new tab?
The module uses HTML::Display for opening a browser, which in turn uses the environment variable PERL_HTML_DISPLAY_COMMAND for determining the command for opening a browser. So, if you want to use Firefox, for example, you can set that variable to firefox -browser %s to force opening a new window.
http://search.cpan.org/~corion/HTML-Display-0.39/lib/HTML/Display.pm
EDIT:
Sorry, this doesn't seem to work either. It opens a new empty window for each call to $mech->display, but also one tab for each call in which it then displays the content. Maybe you can find other command line options for Firefox or another browser that allows you to get the wanted behavior.
As an alternative you can configure your browser to always open new windows in new windows instead of new tabs (for Firefox: Preferences -> Tabs -> Open new windows in a new tab instead). If you want to keep that setting for your normal browsing, you can create an own profile for your Mechanize tests and add -P <your-test-profile> to your display command.