VS Live Share and Live Server - visual-studio-code

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.

Related

Can I upload a file to onedrive via Windows 10 command line?

I need to upload a file to OneDrive, via the command line. This will be done through a batch file which is distributed to end users.
From searching on Stack Overflow, I find questions like this one which say that you need to register an app and create an app password, using Azure. I don't have the necessary permissions to do this in the organization where I work, nor can I do anything that requires an admin account. So I can't any install software - I have to use what comes with Windows 10. I can't use VBA either as that's blocked.
I've managed to download files from OneDrive without anything like that, using the process described here:
Open the URL in either of the browser.
Open Developer options using Ctrl+Shift+I.
Go to Network tab.
Now click on download. Saving file isn’t required. We only need the network activity while browser requests the file from the server.
A new entry will appear which would look like “download.aspx?…”.
Right click on that and Copy → Copy as cURL.
Paste the copied content directly in the terminal and append ‘--output file.extension’ to save the content in file.extension since
terminal isn’t capable of showing binary data.
Example:
curl https://xyz.sharepoint.com/personal/someting/_layouts/15/download.aspx?UniqueId=cefb6082%2D696e%2D4f23%2D8c7a%2
…. some long text ….
cCtHR3NuTy82bWFtN1JBRXNlV2ZmekZOdWp3cFRsNTdJdjE2c2syZmxQamhGWnMwdkFBeXZlNWx2UkxDTkJic2hycGNGazVSTnJGUnY1Y1d0WjF5SDJMWHBqTjRmcUNUUWJxVnZYb1JjRG1WbEtjK0VIVWx2clBDQWNyZldid1R3PT08L1NQPg==;
cucg=1’ --compressed --output file.extension
I tried to do something similar after clicking 'upload' on the browser, but didn't find anything useful when trying to filter the requests.
I found these two questions but there is no keyboard shortcut to upload, AFAICT. Also the end user will be uploading a file to a folder I've shared with them from my OneDrive. Opening Chrome or Edge as a minimised window is fine, but I can't just shove a window in their face which automatically clicks on things - they won't like that.
It's just occurred to me that I might be able to use an office application to Save As the file to the necessary onedrive folder, where the keyboard shortcuts are pretty stable, but have no idea how to achieve that via the command line.
The best and more secure way to accomplish this goal I think is going to be with the Rest API for OneDrive.
(Small Files <4MB)
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online
(Large files)
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession?view=odsp-graph-online
You still need a Azure AD App Registration (which your admin should be able to configure for you), to provide API access to services in Azure. Coding with the API is going to be far easier and less complicated, not to mention more versatile.

Need to create a link to open Powerpoint app in Desktop mode from Power VIrtual Agent (Teams)

We have built a chatbot, which when engaged by user on one topic, opens a macro enabled powerpoint file from sharepoint.
we need the powerpoint file to be opened in dekstop mode, so as the macro file to be working, via power virtual agent in teams
Attempted two ways to make it work, which failed:
Tried to create the link from internet explorer which gets us the 'Save as' dialog box each time when we try to open it
Added 'ms-powerpoint:ofe|u|https://' before the link which gets translated to 'ms-powerpoint:ofe%7Cu%7Chttps://xxxx' which takes us to power virtual agent website.
Any guidance will be really helpful to us which enables us to open the file in desktop mode via chatbot.

How to capture network info in Chrome devtools when clicking a link pop up a new download tab and closed right away?

I’m trying to use chrome devtools to see what network requests are.
But for some links, a new tab will be created for downloading a file and once the file is downloaded the tab is immediately closed.
There is no time to for me to inspect what the network requests are involved in the new tab. Is there a way to force the download in the original window so that I can still see the network activity?
As this answer suggest, yo may want to use chrome net export using chrome://net-export/
How it works?
You open a new tab and enter chrome://net-export/
Press the start logging to disk button and select a file
Do whatever
Press the stop recording button and inspect the file (should be formatted to be readable)
How to reproduce?
function popup() {
window.open('https://google.com', '_blank')
}
<button onclick="popup()">
click me
</button>
You will get WAY more information than you wished for, so - be patient when going over all the traffic details and also - make your recording as targeted and short as possible
Enjoy
EDIT
#Nathan raises a fair point in the comment - this method is not visual. a tool that may help to visualize the data is netlog viewer
Use the link, press the choose file button and upload your json file
In the left menu select events - this will display all events in a big table
Filter table by using URL_REQUEST or
Click each item to inspect and get detailed information (such as: url, headers, method, etc.)
There are other cool tools there (such as timeline) but it is different from chrome dev tools. This solution is just another set of tools for developers, that's all

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.

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

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.