How do I retrieve files stored in azure or in one drive with labview application? - azure

I want to build a labview application starter which can check the main application version and eventually download and update the .exe file which is stored in my onedrive or even in somehow in azure.
I said azure because I think that there must be an option with it... But I can't get the correct keywords
Do anyone has some tip to share?

The benefit of LabVIEW being a higher level application is that it gives you access to this little vi:
This is the System Exec VI which allows you to run general command line scripts from within LabVIEW. So if you can find a windows command to force the sync or a batch file then you can interface with external programs.
The example Batch file there should work with OneDrive but with a little hunting around you should be able to find something to work with Azure.
P.S. Have a look at the 'Command Line Execution.vi' Example from LabVIEW to see more about how this vi works.

I wrote similar code that downloads and installs new releases from AWS S3. It is a real time-saver and worth the effort to get working.
I haven't interacted with OneDrive but from the documentation it looks a bit easier than AWS S3 because the Microsoft accepts OAuth2 tokens vs the more complex AWS Signature Version 4. If you are using LabView, you'll need to use the HTTP client functions to interact with the remote service. I recommend starting with the JKI HTTP REST API client toolkit. This toolkit works around a flaw in HTTPClient:OpenHandle function (it is globally blocking!) by maintaining a connection pool.
Microsoft's documentation looks pretty good; basically what you will want to do is open an HTTP session to the authorization endpoint, request an access token, close the HTTP session, open an HTTP session to the OneDrive endpoint, format the token into an Authorization: bearer header, add that header session, submit a list file request, find your file, submit a download request, save the output to a file, close the http session.
Along the way you will need to parse the API's JSON responses. As NI's built-in JSON parser is rather inflexible, I recommend JKI JSON. Both of the JKI tools are most easily installed with VIPM, which is installed by default in recent editions of LabView.

Related

Update database from external JSON with scheduled task on Windows server

I have an ASP.NET MVC 5 project with database and external JSON file that is updated once a day, by third-party website.
What I'm trying to do is to update my DB once a day accordingly with the JSON (the precision is not the issue here).
Currently I'm using a button that call to Action that parsing the JSON and update the database, and I want to do it automatically.
As far as I understood, running the scheduled task from the MVC application is bad practice and risky, and running external dedicated service is preferred.
If I understood it correctly, I can make a console application that will parse the JSON and update the DB automatically, but I'm not sure if this console application can run on the windows server, and if so, how to do it (and I'm also not sure that this is really good idea).
So, I would be very happy if you can advise me here.
Thanks.
Finally the solution was to build a console application that parse JSON and updating the database.
Then, I used the built-in task scheduler in my hosting control panel to run the application (in my case the control panel is plesk)

Python 3 SharePoint CSV Retrieval

I'm relatively new to Python and have been left scratching my head now for a few days whilst trying to resolve what I feel should be a relatively straightforward task.
The aim is to connect to a corporate SharePoint site (i.e. xxxxx.sharepoint.com) and download a CSV file that's stored there to somewhere on the network (or even local system).
The file can be found in the following location. If I copy and paste it in to a the web address field it downloads the file perfectly:
https://xxxxxx.sharepoint.com/sites/MSS/im/pa/ReportData/DirectorMap.csv
However, try as I might, I cannot seem to download it via a Python script. I believe we are behind a proxy server (no credentials required):
https://example.proxy.com:8080
I've tried using requests, requests_ntlm, sharepoint, urllib3 etc etc but constantly get a "403: Forbidden" error. I have tried passing it my own credentials (and given the file was created by myself on SharePoint I can't see that it would be down to me genuinely not having access).
Is anyone able to post a script that will achieve my aims, based on the proxy and url I've posted above?
Sounds like your python isn't picking up the assumed Windows proxy environment (presumably you are behind something like a corporate firewall).
The solution is to use cntlm which will allow you to tunnel your existing connections through a local proxy.
See this Q&A for more info on setting CNTLM up

Troi plugin function not working in FileMaker WebDirect

For purposes of being able to select from multiple file from the computer or network, I am using the following script command which works great in native FileMaker 14:
Set Variable [$dosFN; value: TrFile_SelectFileDialog( " -AllowMultipleFiles" ; "Please select one or more files" ;)]
In testing to make sure this works, I am doing a custom dialog to display the value of $dosFN and an example that successfully comes back would show:
From drive as:
C:\Files\img1.jpg
C:\Files\img2.jpg
or from network as:
\\ACI-2008-01\Files\img1.jpg
\\ACI-2008-01\FIles\img2.jpg
What is not work is when I attempt the same thing in a webdirect environment which is only showing the following when I perform the same script without even a file selection dialog box:
$$-4222
So how can I possibly make this work as desired in a webdirect environment?
This is not possible. This call is supposed to display the select file dialog. The plug-in does this by calling a function from one of the system libraries. In Web Direct you work with the database via a browser. Behind the scenes FileMaker silently converts the layouts and scripts into something that can run in the browser (lots of HTML, CSS, and JavaScript). But it cannot convert all and this call is one of things it cannot convert. As a result the plug-in only runs on the FileMaker server in a completely different environment and has no way to make a system call on another computer.
You may have better luck with FileMaker's own Insert File script step. It seems to be compatible with Web Direct. It cannot select multiple files though. (Also, other plug-in functions may still work in Web Direct but keep in mind that they actually run on the server, not the computer that runs the browser.)
The latest version of Troi file seems to be webdirect compatible, but it has to be installed on the FileMaker server as a server-side plugin. In any case check their documentation first, as it is usually quite detailed and if it does not help, you might get in touch with their support.
From how I understand it, the plug-in is running server side and has no way to display an interface on the client side (web browser). I do not believe there is a way to do what you are trying to do with Troi File, but you may just need to contact Troi.

Launch a local file with default file handler from chrome packaged app (or extension)

I'm building a launcher for internal use with a Chrome packaged app which includes links to internal resources (databases, web links, etc.).
The problem is with local files. I want them to launch using whatever program is the default handler for them. For example, access databases open in Access, etc.
I've tried:
Creating a file link file:///. Nothing happens in this scenario on click and the link is not followed.
I found an extension (locallinks) here: https://code.google.com/p/locallinks/, which will open local file links. I've tried borrowing from that extension and passing the file link to the background script in my packaged app which would then open a new window with that url. Unfortunately, that results in a file not found, even for simple types such as text files. So obviously the local filesystem is sandboxed. Not surprising.
I thought maybe it would work to pass the link to an extension to open, but in that case, the file would be opened in Chrome and if Chrome does not support it, it would attempt to download the file locally.
The reason I'm using Chrome Packaged Apps is:
1. This will be updated often and the Chrome Web Store update feature would make it easy to keep clients updated without having to build our own update mechanism.
2. We can restrict installation of the app through CWS to internal users.
3. The app would be used in a Windows, Linux and Mac environment. Obviously the file paths here would be different but since they would point to a samba share, and mount points and network share drive's are known this is an easy problem to overcome.
4. There is additional functionality we will be building into the Chrome app in the future other than the launcher which fits very well with how Chrome Apps are designed.
My thoughts are:
Native Client? I have read a bit about these, but I think I would end up with the same limitations where the native client app would be sandboxed and may not actually have any better way of launching a local file.
Sockets? Maybe a simple Qt app listening on a socket to launch apps? Since the Qt app would be run with user permissions, and the socket would only accept connections from localhost, I guess the socket could in theory be used by a non-privileged app to launch something with user-level permissions. Is there a way for me to limit connections through the socket to only be accessible from my extension?
The sockets solution isn't ideal but may work since the app would not be updated often (if ever) since functionality is so simple.
Am I missing an obvious way of doing this that wouldn't require another component (a Qt app?)
Relating to your thought #2, not sure what local installation footprint you are willing to tolerate, but you may consider:
Hosting a miniscule local web server, or Qt app as you mention, which can also launch local programs (any of those lightweight web server frameworks). Have your packaged app, or your own chrome extension rewrite links such that they point at your web server along with the url of the original link, which can easily launch whatever program. Downsides: this may cause bypassing some browser security screening of the original links in some forms of implementation.
You may also look at this stackoverflow question if it helps.
You can limit access by confirming the requests originate from the local machine, or by embedding a key or hash inside your chrome extension. You may generate the key upon installation so that it's unique per machine. None of this will pass very proper security scrutiny so it depends on your risk profile. You will have a hard time justifying how each part is secure and clean of exploitation attack potential.
It seems you will need both a chrome extension and a local miniscule web server to make this work. Maybe it's easier to let users just download the files and click them...
Sorry if this isn't help enough, but basically you are trying to do something that is by design not made possible in Chrome, so at this state of affairs there would likely not be a simple solution.

creating a performance tool for web based GUI

I want to create an automated performance metric gathering tool, to get various metrics for page load times for a flash based web application. I am doing the web automation using a batch script, and then I want to collect the various metrics using browsermob-proxy (http://opensource.webmetrics.com/browsermob-proxy/), it exports the metrics in a HAR file. I've never done this before so I was wondering if this approach is okay? What are the steps to using browswermob-proxy for windows (firefox). There is no information about windows in the documentation, just linux. I know I run the proxy from the /bin directory, then what do I need to do?
I had downloaded the copy from the browsermob zip from here..http://opensource.webmetrics.com/browsermob-proxy/ Unzip and refer the readme.md
The readme file in the browsemob zip, specifies the instructions to start the proxy server. Once the server is started, you would need to specify the server port and machine ip in your firefox proxy settings (from options->advanced->network>settings. Then trigger your urls on this browser.

Resources