Convert MS-Office to pdf - perl

I'm using OfficeToPDF to convert the MS-Office files to pdf. However, I only can run the command:
OfficeToPDF test.doc test.pdf
in cmd (windows)
I want to embed this code into my cgi file (Perl). Can anyone show me how to do this, thank you!
(I used:
system("OfficeToPDF test.doc test.pdf");
but seems it's not work)

That should work but your envormental parameters might not be setup right, you should include full paths(or proper relative ones) and see if that fixes the problem up. If not you might want to post your debug log, or enable verbose output. Your perl also might not be setup to execute shell commands for security reasons when in cgi mode and the logs would help clarify that.

Try to:
use the full paths to OfficeToPDF and target PDF location because usually, the CGI scripts are run in another user context,
check, the CGI user has reading and writing rights for both files (and, off sure, right to execute the OfficeToPDF)
But it depends what means "it's not work", of sure.

Related

Any command to use in PowerShell to copy few lines from Console?

in my powershell script a lot of items are getting printed in the console.
I want to copy them and validate a data is present or not. Any way I can do it?
I am yet to get any solution for this. thank you in advance
One Way to record everything thats going on with your Script is Powershell Transcript
Or you can just Copy the Output from your Console to a Text file in Notepad++ or something like that...
But to be honest I don't quite understand what you are trying to achieve with that, wouldn't be the goal with a script that you don't have to check something like that?
My suggestion would be that you look for a way to validate anything you need within your Script, and maybe implement some sort of Logging to have the Option to review it when something has gone wrong...
I used $variable = command and it is working.
if your case is to validate your logs I suggest saving the logs into a file and then validating them and don't use the console for that purpose.
if you still want to copy them from the console try this: Copy text from a Windows CMD window to clipboard
In your situation, i would use Start-Transcript into a log file.
And then get information from the log file using filters.

ESGF `wget` scripts incorrectly generating; linking to a random unrelated file

About half the time when I click on WGET script following a CMIP6 data search on the ESGF (LLNL node), I get a wget script that only points to one, unrelated file. It's always the same one, too. Here's the relevant line that shows up in each wget file:
download_files="$(cat <<EOF--dataset.file.url.chksum_type.chksum
'famipc5_ne120_v0.3_00001_01_198001_198401_climo.nc' 'http://esgf.anl.gov/thredds/fileServer/esg_dataroot/ACME/climo/amip/v0_3/atm/mon/native/ne120/ens1/famipc5_ne120_v0.3_00001_01_198001_198401_climo.nc' 'SHA256' 'e5040c5df9d080437418943f02a41e84712dbe1c4a69982447712d7c7334241d'
EOF--dataset.file.url.chksum_type.chksum
)"
This happens with a wide variety of datasets. Here's one file where that happens, for example:
CMIP6.CMIP.CCCma.CanESM5.amip.r1i1p1f1.day.pr.gn
I've been searching for a reason, so far without success. A workaround is to hit the "download HTML" button 1000 times for each individual needed file instead (or set up a Globus endpoint for the files where that's possible), but it's very inconvenient and doesn't provide the functionality of a bash script.
Does anyone know what may be causing this? Is there some sort of limit to how many wget scripts an ESGF user can generate per day and these are downloaded as placeholders afterwards instead?
Grateful for any insight!
PS: I apologize for the cdo tag; I know this isn't a cdo problem, but it's hard to find relevant tags for this, and I figured that community may know what's up.
Turns out this is a browser issue. Repeating the search with chrome fixed it.
(Also that stack overflow may have not been the right venue to post this question; but I want this to be searchable somewhere at least)

How to embed an exe file into webpage?

I have a Windows executable, XAMPP, and ngrok. On the receiving end of my makeshift server, I would like my client(s) to be able to click a link that would open the before mentioned executable on my side, and stream the image to my user(s).
I would like if some user input could get through, as arrow keys & space bar, and I'm willing to do this by whatever means possible. Thank you!
You could look into CGI which provides a way for a webserver to interact with an executable via standard input and output. There is also a stack overflow answer detailing what CGI is. For user input, the CGI can pass data both ways, so it should be capable of what you are trying to achieve.

Powershell import encoded module

I am writing a script with a lot of modules but I don't really want the user to see my source code so I figured to encode everything in base64 since the user won't be able to decode it even if it is that basic.
I tried to somehow add an encoded module but no luck.
So my question is -
Is it possible to import a base64 encoded module to the main script file?
If you have any better solutions to hide source code please share, I would be more than happy to try them out.
P.S. I tried to find some info on making a .dll files but found out I would have to rewrite the script in C#. (if I didn't missed anything)
Also I tried to put all modules into one encoded file, but then the file gets too big and Powershell is not able to process it anymore.
You've got two options, which can be combined if you would like to be extremely sure that no one will be able to access your code, making your code into an exe was already mentioned, there are several projects to do this but This one is nice as it is wholly contained within PS. The other, imo better, method is to use an obfuscator, which will take your code and replace variable names with nonsense strings and make other changes to make your code very difficult to read, it's still possible to work out your code but generally not worth the effort, you can find a working one Here. But I do have to add that obfuscating your code really goes against the powershell ethos and I recommend against doing it unless you have some sort of requirement too being passed down from management. And please note that this NOT an acceptable method of obscuring code that includes passwords, api keys, or any other information that needs to be secured as all of those are quite easy to extract from code that has been obfuscated this way.
You could change your ps1 to an exe file by using
https://ps2exe.codeplex.com/
You'd still be able to get at the code if you tried, but it would prevent a casual look.
Why do you want to hide the modules?

What/where are the "quote site" options for z/OS FTP server?

I'm writing a script using Perl and Net::FTP, which is trying to upload a rather large file to the mainframe and I can't seem to get the primary/secondary allocations right.
I try to change them but it appears that, because the data sets are SMS-managed, they go to a different volume each time.
So I went looking the the quote site option which would (hopefully) lock the upload to a specific volume.
The current options I have are:
$ftp->site ("bl=10204 lr=170 rec=vb cy pri=100 sec=100")
and space is pretty tight on most volumes. However, I've located a volume with the required space but don't know how to specify that in the FTP options.
Is there a document somewhere detailing them? I couldn't find anything in the CommServer stuff nor did a Google search for ftp zos quote site turn up anything useful.
Alternatively, does anyone know the option to specify a fixed volume? Obviously I'd prefer the former since there may be other useful things in there but, at this point, I'd take the latter gratefully - I've darn near pulled out all my hair :-)
Log onto your mainframe's FTP using an interactive FTP program (e.g. FTP). Then type "quote help site" and you should get a good list of the options.
Just a little explanation... "site" is a command for the mainframe's FTP server. Typing "help" in front of it gets you help on the function. However, just typing "help site" will look for help on your FTP client (which probably never heard of the site command), so you have to pump the command to the server, which is what the "quote" command does.
BTW, your site command is asking for 100 primary and 100 secondary cylinders. That's a hefty chunk of DASD. Do you really need all that?
Good luck... let me know if you have any questions. I practically live on FTP on the mainframe and have written dozens (maybe hundreds) of Perl scripts to make things easier.
As a general FTP reference for z/os try Z/OS V1R7.0 Comm Svr: IP User's Guide and Commands.
Site commands can be found here.
Why not let SMS find the appropriate volume by using a DataClass appropriate for the file size?
How much hair did you start out with? Some can't afford to pull too much!