CouchDB: Workflow for creating documents? - couchdb

Beginner question.
My goal is to add documents to my CouchDB database on a remote server.
Is this the a good way?
Create CouchDB documents using a code editor and store them on my hard drive.
Post them to my CouchDB database on a remote server.
If yes, how to do #2 on Windows?

I suggest using your browser, and use the Futon web app, which all CouchDB servers support. Just go to /_utils/ in your browser and you can get started adding and modifying documents.
Once you are comfortable, I suggest the curl tool, however keep in mind that Windows is a little different from the examples.
In Linux and Mac, curl looks like this
curl -X POST http://localhost:5984/db/ -d '{"_id":"something"}'
In Windows, you cannot use the single-quote:
curl -X POST http://localhost:5984/db/ -d "{\"_id\":\"something\"}"

Related

Is there a way to use cURL commands in Azure Data Factory?

So I am trying to create a Pipeline in Azure Data Factory and part of the process involves uploading a CSV to a temporary URL generated earlier in the Pipeline by an earlier REST API request. The API's documentation say's to use a cURL command or "a similar application". I have gotten the cURL command to work on my local environment but have had no luck doing it in ADF. the cURL command I am currently using is curl --upload-file "<file location>" "<api URL>" --ssl-no-revoke -v
While ADF supports web requests, it does not seem to support cURL commands at least directly. Currently I am trying to automate the cURL command through a Automation Account which runs a PowerShell Script and then use a web hook to continue from there within the pipeline but I have my doubt that this will work due to having to pass the temporary URL from the pipeline to the PowerShell script.
The questions can be summed up as follows:
Is it possible to put a cURL command in a web request? I have not found any good examples of this as most cURL commands seem to take place in PowerShell and Command Prompt
Is there some ADF functionality I am not aware of that runs cURL commands?
What are the alternatives to cURL that I could use for this process? Are they friendlier than cURL when it comes to ADF?
Any other potential advice I may need to know
I appreciate any input on this matter!
Only way to do that is by creating your own batch / *.bat files which have the curl commands in it and execute them from server side , you may save results on text files which you can also read them from your server side .
Read more here

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

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.

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

WGET and Google Save Browsing API v4 -

I'm configuring Mod_Security on my server. The problem that im strugling with pulling Google Save Browsing Database into my server as SecGsbLookupDb.dat file. They recommend to use WGET, but i cannot find example command, im not fluent with wget command as well. Cpanel doesn't have sample command in documentation, so im stucked.
Here is the commands that im use:
wget ttps://safebrowsing.google.com/safebrowsing/threatMatches:find?key=mykey
wget ttps://safebrowsing.google.com/safebrowsing/list?key=mykey
Its showing me 400 errors, 404 errors, don't know what im doing wrong. Maybe my wget command is wrong.
cPanel forum mentioned
You will need to consult with Google if you have obtained an API key and there's no valid download location. The feature was deprecated in Mod_Security after Google began forcing the use of an API key to download the file.

Admin panel for postgresql on Node.js server

I want to host a Node project running with a postgreSQL db. However, when it is on the server I won't have a UI tool to easily view database entries. Does anyone know how I would go about creating a /admin domain to view / edit my postgreSQL db through an admin panel?
I'm using https://github.com/brianc/node-postgres as the client.
If you want to use DB admin tools on a remote server you have a few options:
ssh in and use psql. Easiest once you learn your way around psql.
Use PgAdmin-III via an SSL connection to the sever, or using its ssh tunnel features
Set up a web-based tool like phpPgAdmin on your web server, properly locked down, and access it over the browser.
Personally I'd stick with the basics.

Resources