Use text from CSV in Imagemagick - csv

I have a CSV with information relating to images such as name etc. , is there a way that I can use the CSV file information to push to imagemagick (via PHP on windows) to add to the images?

Sure, check out http://php.net/manual/en/function.fgetcsv.php to get the CSV information into the script, then I'd assume you are using the PHP ImageMagick extension, so just run the commands against the given image, or read the image in from some variable from the file. If you are not using the extension in PHP, you could try running it through the exec PHP method: http://php.net/manual/en/function.exec.php

Related

Getting Minizinc output as .txt from IDE

Imagine I ran a .mzn with .dzn and got an output in IDE as follows:
Supplier01,100,100,100,100,100,100,100,100,100,100,100,100
Supplier02,200,200,200,200,200,200,200,200,200,200,200,200
Supplier03,40,49,359,834,1067,1377,334,516,761,1001,1251,1583
Supplier04,500,500,500,500,500,500,500,500,500,500,500,500
Supplier05,161,200,200,200,200,200,200,200,200,200,200,200
Supplier06,500,500,500,500,500,500,500,500,500,500,500,500
----------
==========
Is there any way that I can generate this output in a .txt or .csv file in a preferred location on my computer? I know that we can perform this in command prompt, but is there any way we can do using the IDE it self?
The MiniZinc IDE currently does not include functionality to export solutions for other applications.
The current expectation is that if you want to integrate MiniZinc with other applications that you would use something like MiniZinc Python, iMiniZinc, or the command line tools, to facilitate the connection. In your case using MiniZinc Python or iMiniZinc might be a good solution since Python can generate csv files using the csv module. If you want to see and interact with the solution as well as outputting the csv file, then iMiniZinc can provide the right tooling in Jupyter Notebook to do both.
If you are very happy with the MiniZinc IDE and you want to continue using it, then the other option would to just minimize the inconvenience. Your output statement already provides the solution in csv style. So the only remaining part is making the file. The MiniZinc IDE can open .csv files. So my suggestion would in this case be to create an empty .csv file, open it in the IDE. Once you get the solution from your instance in the output window, then you copy directly into the file.

Retrieve and process JSON pages on Windows

On Windows I need to retrieve the contents of multiple JSON pages like this and append them to one large text file. What would be the easiest way to do this? I don't have a lot of programming experience, but I can use batch files and JScript/Windows Scripting Host. Thanks.
wget or curl are great command line tools for pulling down a web page and saving to file from a command line script. Either one will likely work for you. Google for either.
To append one file onto another from the command line or batch file, you can do something like this:
copy FILE1+FILE2 FILE3
That will append the contents of FILE1 and FILE2 together and save it as FILE3. You can chain more than two files too. E.g. copy A.txt+B.txt+C.txt D.txt
You could likely combine wget/curl with the copy command and have a reasonable BAT file to accomplish what you describe.

How does phpmyadmin writes a table in a pdf file?

There is an export option in phpmyadmin which can be used to write a database table in a pdf file. How does phpmyadmin do that? Basically, what I am asking is if I want to write a table in pdf using command prompt then how can it be done? Is php required somehow to do it or it can be done purely using MySQL command prompt?
You can store the results of a query to a text file like this:
SELECT * from someTable
INTO OUTFILE 'file.txt'
(See: http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/)
From there, you can use enscript and ps2pdf to convert the text to a pdf
enscript file.txt --output=- | ps2pdf - > file.pdf
(See: a light solution to convert text to pdf in Linux)
That's one possible way to do it.
There is no capability within SQL to write to a PDF. phpMyadmin uses php to do this. It's open source so you can look at the code if you want
However, rather than copying the method used by phpMyadmin, if you want the capability to do this, I recommend looking into tcpdf or fpdf, which are php libraries designed to handle this. Take a look here: http://sourceforge.net/projects/tcpdf/

IrfanView generate HTML file from Thumbnails in cmd

I try generate from IrfanView cmd interface HTML page from directory with Thumbnails, but I can't find any parameter or options, how I can do it.
I can generate Thumbnails via:
"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Test\FullScreens\*.jpg" /resize=(100,100) /aspectratio /resample /convert="C:\Test\*.png
I can't find this in cmd:
It is possible to realize this?
Thank you, Regards,
  Peter
The text file i_options.txt in program files folder of IrfanView contains all options which can be used on command line. There is no option to create an HTML file. This must be done via GUI using the captured dialog.
But after creating the thumbnails for the images, it would be of course possible to create with a batch file also the HTML file using the commands echo, for, if and set with output created by several echo command lines redirected to the HTML file to create. Executing in a command prompt window help echo, help for, ... displays help on those internal commands of command interpreter cmd.
However, it would be a lot of work to create a batch file with all the parameters of the dialog. And it would make the batch file slower to really support all those parameters. A tailor-made batch file for creating the HTML file exactly like you want them would be much easier to code.
I suggest to try by yourself coding the batch file to create the HTML file. Create a new question with a link to this question, if you have somewhere a problem which you can't solve by yourself. Post in this question the batch code you have so far and the content of the HTML file created by IrfanView which should be instead created by the batch file.

Inputting a file in R without setwd()

I'm trying to input a text file into R using grep and using setwd() (I can use other methods, I'm not sure what, I'm only starting to learn R).
I'm writing a json template for a third-party server that runs a docker image as an env but currently there is a bug that can't change the working directory. Is there another way to get this file?
If you're trying to do something like this:
setwd('/tmp')
read.csv('hello.csv')
You can do without setwd:
read.csv('/tmp/hello.csv')