I'm trying to merge pdfs with an external CSV file. The CSV file and all pdfs are in the same directory. I've got the following code, but it keeps spitting back errors.
Call sejda-console.bat merge -f C:\temp -l C:\temp\book3.csv -o C:\temp\temp2.pdf
The tutorial uses calls for "[--filesListConfig -l value]", I'm just not sure if I'm using it right.
Thanks in advance.
You should not provide -f and -l at the same time.
Here's an example that works (commands are Unix format):
./bin/sejda-console merge -l /tmp/files.csv -o /tmp/output.pdf
And files.csv contains:
> sejda-console-1.0.0.M9 $ cat /tmp/files.csv
/tmp/file1.pdf,/tmp/file2.pdf
Related
I try to make a simple shell script to make a jar file. The jar command combined with -C does not work with wildcards. Therefor I use a wildcard to find the files I want. Write them to a file, and loop over them.
It looks something like this:
the_classes=''
cd "$bin_folder"
tmp_dir=$(mktemp -d -t java_sucks)
find "imui/core/" -type f -name "IMUI_Widget_Agent*.class" >"$tmp_dir/classes.txt"
while IFS="" read -r p || [ -n "$p" ]
do
the_classes="${the_classes} -C '$bin_folder' '$p'"
done < "$tmp_dir/classes.txt"
Using the above I complete the command:
cmd='jar cfm build/IMUI_Widget_Agent.jar'
cmd="${cmd} \"$bin_folder/imui/core/IMUI_Widget_Agent_MANIFEST.MF\" $the_classes"
printf "\n\n\ncmd\n\n\n"
echo $cmd
Now if I copy and paste this command to execute it works!
But I want to avoid the manual labour of doing the copy and paste by hand every time.
Now I have:
eval "$("$cmd")"
But I get an error File name too long. No matter what I try, every fix I do creates a new problem. I have been working 6 hours now to make this script.
What would be a good step forward?
Since you cd "$bin_folder" you don't actually need -C "$bin_folder":
#!/bin/bash
shopt -s globstar
cd "$bin_folder"
jar cfm build/IMUI_Widget_Agent.jar \
imui/core/IMUI_Widget_Agent_MANIFEST.MF \
imui/core/**/IMUI_Widget_Agent*.class
However, if you still want to add them as part of a larger script, you can easily and robustly build your command in an array:
#!/bin/bash
shopt -s globstar
cmd=(jar cfm build/IMUI_Widget_Agent.jar imui/core/IMUI_Widget_Agent_MANIFEST.MF)
cd "$bin_folder"
for file in imui/core/**/IMUI_Widget_Agent*.class
do
cmd+=(-C "$bin_folder" "$file")
done
echo "About to execute: "
printf "%q " "${cmd[#]}"
echo
"${cmd[#]}"
Alternatively, you can simply do eval "$cmd" with your code, which is equivalent to echo and copy-pasting. However, be aware that this is fragile and error prone because it requires careful escaping of the filenames which you're not currently doing.
I am running load test on one of my sftp server application using jmeter. I run my jmx script as below
nohup sh jmeter.sh -n -t <jmx_file> -l <jtl_file> &
Script does have Simple Data Writer which creates csv file with result, which i convert into html using below command running on cmd from bin folder of jmeter.
jmeter -g <csv_path> -o <html_folder>
It was working couple of days back and now if i run the above command it gives error as below
The system cannot find the path specified.
errorlevel=3
Press any key to continue . . .
There was an update in my jdk from 1.8_241 to 1.8_251 and i have updated my java_home as well.
Do i need to do anything else in jmeter to make this work?
Double check that you can launch JMeter normally without nohup like:
./jmeter.sh --version
Ensure that the test is producing the .jtl results file and the file is up to date and not from the previous executions
Check the contents of nohup.out file
In general you should not be using any listeners, it is sufficient to have the .jtl results file in order to generate the dashboard and the dashboard can be generated during the test run like:
jmeter -n -t <jmx_file> -l <jtl_file> -e -o <html_folder>
if you don't have any background logic to remove "stale" jtl_file and html_folder you will need to add -f command-line argument to force JMeter to overwrite the old result file and dashboard folder like:
jmeter -n -f -t <jmx_file> -l <jtl_file> -e -o <html_folder>
I am running a weka command to predict by loading an already trained and saved model. I need these predictions of the test file on the loaded model to be saved as a CSV file. What command should I use in commandline to do the same.
I have already tried the following:
java -cp /usr/share/java/weka.jar -Xmx28G weka.classifiers.meta.FilteredClassifier \
-classifications "weka.classifiers.evaluation.output.prediction.CSV -p 1-3,20,29" \
-T test.arff -l ./j48.model > only_predictions.csv
I have tried the above command with all the permutations of placing the -classifications "weka..." at different places in the same command itself as was suggested in some answer to similar question. It gives me illegal option "-classifications" error each time.
-classifications "weka.classifiers.evaluation.output.prediction.CSV -p first" \
-l $model \
-T $dataset \
|tail -n+6 |head -n -1
This also didn't work for me as was suggested in one of the similar question.
Also tried training and predicting in a single command but didn't work
java -cp /usr/share/java/weka.jar -Xmx28G weka.classifiers.meta.FilteredClassifier -classifications \
"weka.classifiers.evaluation.output.prediction.CSV -p 1-3,20,29 -distribution -file predictions.csv" \
-t ${g1_train_arff} -T test.arff -F "weka.filters.unsupervised.attribute.Remove -R 1,26,28" \
-W weka.classifiers.trees.J48 -c last -- -C 0.25 -M 5
Also, using java -cp /usr/share/java/weka.jar weka.core.Version command gives me 3.6.10.
I expected a proper csv file created with the output prediction values along with the attribute range given with the -p option.
Please help me with the problem. Thanks in advance.
For some research purpose, I want to download 1000 java classes (".java") files from the given website. I don't want to do this manually.
For example, below has many Java Source files which I want to get using scripting/programming. I've worked with Linux shell scripts, PHP, and Java. So any solution using these is appreciated.
http://www.cs.uic.edu/~sloan/CLASSES/java/
Thanks!
Based on the question
wget -A java -r https://www.cs.uic.edu/~sloan/CLASSES/java/
will download all ".java" files in the same directory structure as on the server.
This will also download the robots.txt file.
For the particular example you gave,
curl -vs https://www.cs.uic.edu/~sloan/CLASSES/java/ 2>&1 | grep -oP '(?<=").*.java(?=")' | sed -e 's|^|https://www.cs.uic.edu/~sloan/CLASSES/java/|' | xargs wget
Explanations
1) Get the page and print to stdout. It will give you entire html.
curl -vs https://www.cs.uic.edu/~sloan/CLASSES/java/ 2>&1
2) Find the word with .java in quotes, but output without quotes "[ANYTHING].java". It will give you something like HelloWorld.java.
grep -oP '(?<=").*.java(?=")'
3) Add prefix to make it full url, so you can download them. It will give you something like https://www.cs.uic.edu/~sloan/CLASSES/java/HelloWorld.java
sed -e 's|^|https://www.cs.uic.edu/~sloan/CLASSES/java/|'
4) Download them to the current directory.
xargs wget
Thank you all !!
I've done using "wget -r -l1 -nd -nc -A.java http://www.cs.uic.edu/~sloan/CLASSES/java/"
This was however my required task. But am just thinking, may be we can improve same "wget" to go on internet and get me 1000 ".java" files. Perhaps, we can invoke google search (from script) for a keyword "java tutorials" and then from the returned URL, scan for ".java" files.
Thank again all
Viki.
I am trying to create a Jar file from command line using -C flag, but every time it returns a help screen.
I am giving following command.
user#ubuntu:~/CDH/JAVA_WORKSPACE/JAVA-SETUP$ jar cvfm ./build/jar/Setup.jar MANIFEST -C build/classes/com/demo/Setup.class
If I remove -C command then it archives fine.
But if -C flag is there, then it always returns jar help page.
Am I doing something wrong here?
Your command line option is:
-C build/classes/com/demo/Setup.class
The jar tools wants the directory name to follow the -C and then the file. You need two words to follow "-C" like this:
-C build/classes/com/demo Setup.class