How do you export pictures from 4D's tool box? - 4d-database

I am using 4D version 11.6 (72398) in remote mode and am trying to export three pictures from a database. How do you extract pictures from the tool box? Screenshots and editing are not acceptable if avoidable.

The Picture Library area of the Tool Box does not have an export feature. However, the following commands will help you export the pictures:
PICTURE LIBRARY LIST gets an Array of Picture Names and an Array of Picture Reference ID's
GET PICTURE FROM LIBRARY uses the Picture Reference ID to get the picture from the Picture Library into a Picture variable.
WRITE PICTURE FILE writes the Picture variable to disk.
The following code could be used to export all of the pictures in the Picture Library to disk as PNG files.
C_TEXT($vsPicName;$vsFileName)
C_LONGINT($vlNbPictures;$vlPicture;$vlPicRef)
C_PICTURE($vgPicture)
ARRAY TEXT($asPicName;0)
PICTURE LIBRARY LIST($alPicRef;$asPicName)
$vlNbPictures:=Size of array($alPicRef)
If ($vlNbPictures>0)
For ($vlPicture;1;$vlNbPictures)
$vlPicRef:=$alPicRef{$vlPicture}
$vsPicName:=$asPicName{$vlPicture}
GET PICTURE FROM LIBRARY($alPicRef{$vlPicture};$vgPicture)
If (OK=1)
$vsFileName:=String($vlPicRef)+$vsPicName+".png"
WRITE PICTURE FILE($vsFileName;$vgPicture;".png")
End if
End for
Else
ALERT("The Picture Library is empty.")
End if
If you run the code above from Single-user or from the Server the files will be placed next to the structure file.
If you run the code above from from the Client the files will be placed into the 4D Client Cache folder which can be quickly opened using the following code:
SHOW ON DISK(Get 4D folder(4D Client Database Folder);*)

Related

Plotly: Is it possible to dynamically change colors of traces on a .html file generated from a plotly figure using plotly's '.to_html()' function?

I've created an app that allows users to upload an excel or .csv file, extract the data and generate a plot for their desired data. I'm using plotly to produce the figures. I've included an option to create an .html file (so the user can access it later) containing the plot by using plotly's .to_html() function.
By default, this function creates plots with some level of interaction such as dynamic zoom, and capability to hide/unhide traces on the figure. This is great, but as I push this app out for others to use, I'd like them to also be able to change the colors of the traces on the figures, without requiring them to go into the source code. Ideally, the user would simply click on the plot/trace of interest on the legend (or some other button) then choose a new color.
Is it possible to add additional or custom interactive/dynamic functionality to the .html files generated by plotly? Specifically, is there a way to allow users to change the color of plots on a figure that has already been written to an .html file?
For context, I am using the python version of plotly.

D3.js Can't Load Full CSV Dataset

I'm currently following the tutorial in Scott Murray's D3 book. His code for my specific problem is here: https://github.com/scotthmurray/d3-book/blob/master/chapter_07/09_time_scale.html
I copied his code into my index.html directly (for trouble shooting purposes) but it doesn't appear to be loading in my csv data correctly when I open my local host browser.
I'm trying to read in my "time_scale_data.csv" file which looks like below:
Below is I believe the relevant part of my D3 code but please see my link above for full code:
When I check my browser / console ... it looks like only the last row of data in my CSV file was loaded in instead of the whole dataset
According to the book, this is what the data should look like after I add dataset to the console:

ArangoDB Example graph data is missing flights.csv

Following the ArangoDB "Graph Course for Freshers: The Shortest_Path to first graph skills" requires flights.csv data to go along with airports.csv. Airports.csv is found at GitHub - arangodb/example-datasets: Demo Data for ArangoDB. However, I do not find flights.csv there (or anywhere else that turned up in a search).
Does anyone have a copy of it to share?
The airports.csv file in the example-dataset repository (https://github.com/arangodb/example-datasets/blob/master/Airports/airports.csv) is a different file than is intended to be used for the Graph Course.
The right Graph Course files airports.csv and flights.csv can be downloaded via the link you find on page 15 of the PDF, with the headline Download and Import the Dataset:
The download link for the 2019 Edition graph course dataset is:
https://www.arangodb.com/graphcourse_demodata_arangodb-2/

Nodejs/Express Save select avatar from web client and save directly to MySQL Database

Looking for some guidance here. I am building Nodejs/Express app with MySQL Database. I want to be able to click on the users image on the web page (initial image is generic), select a different image and upload/save new image into MySQL database. I using:
$('#file-input').trigger('click').change (function(){
alert($('#file-input').val());
})
I get C:/fakepath... for image location. I would like to how to upload/save selected image to the MySQL database. Connection to database is established, and routes for regular data work just fine.
Before answering your question will suggest you to not save image into your MySql or any database, use IPFS, local application directory/folder, or best AWS s3 bucket.
You can use busboy.js NPM module or multer.js NPM module for file upload to server, there's lots of good reason to not save any kind of file in local database.
Now back to how you can save image in database. You can do so by first converting your image to a data format your MySql understand. By default image is binary and depending upon image selected some image binary is so big that even MySql text datatype is small for them. Converting binary to hexadecimal does help but still too big for MySql text datatype. Also you will need multipart/form-data for file upload.
You can easily find "How to upload file in nodeJs?" in a google search. Still if need an example here's one "Upload file using multer.js"

CK Editor JSON file creation for inserting images

I am using CK Editor on my web site and have built a simple uploader script in php to add images to my server. I am using the image browser plugin to enable the inclusion of images into my text. The image browser seems to work using a JSON file which must list all images in the image folder.
I am completely new to JSON and to get around learning how to build a JSON file I created a PHP file which simply reads the names of my images from a database and includes them in the JSON file.
This, as a workaround seems to be perfectly functional, however it is reliant on my upload script having to add the image names to the database (an unnecessary step) and it is also bad practice.
I am looking for a good tutorial or explanation on how to make a very simple JSON file which lists the images in my uploads folder in the correct format for CK Editor so that I can free myself from my image names database and program like a big boy.
Any and all help would be apreciated.