pdftk crashes with large document - pdftk

I use pdftk 'dump_data' function to find the bookmark pages in a large pdf. Sometimes, it returns an error.
pdftk main.pdf dump_data
Error: Failed to open PDF file:
main.pdf
Done. Input errors, so no output created.
The file main.pdf is produced with pdflatex. Whether it crashes or not seems to be dependent on the length of the document. If I take a chapter out of the .tex and recompile, then pdftk works fine. Which chapter I take out doesn't seem to matter. The full document is 173 pages.
Update
I am now not sure that it is related to its length. The document is 224 pages now, and can run sometimes on pdftk, but often not. The file is about 30mb. When I run any pdftk function, eg.
pdftk main.pdf cat output ../out1.pdf verbose
Error: Failed to open PDF file:
main.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.

Related

Reading the last 2 lines of a .log file via Matlab

The problem that I am attempting to solve is as follows:
I have a .log file that is updated every x seconds (an interval that I can change), with updated status information from a piece of test equipment. At each interval, another line is added to the .log file, with the updated information. My goal is to have the most recent status information (the last two lines of the .log file) easily viewable in Matlab.
Here is an example of what each update looks like, in case that is relevant (a single line of text):
What I have tried:
I used the readtable command (shown below) to view the information in the .log file, but that gives me the entire .log file every time the function is called, when I only want/need the last two lines.
data = readtable('FileName.log','FileType','text')
I know that this would be simpler if I was working with a .csv or .xlsx file, but the test equipment only updates the .log file, so I cannot just change the file type, as it would not get updates then.
Any advise would be appreciated.
If the .log file is in plain text format (as I assume based on your code snippet), you can get the last 2 lines of the file by using the following system command in MATLAB:
[status,output] = system(['tail -n 2 ', path]);
Please do keep in mind that this requires the tail command to be available, which is not available in windows by default - however you can get around this by installing a package containing the tail command, for example Cygwin.

can't show output from binary file

I create a file that give a binary data, when I try to open it, it shows a message like this "the file is not displayed in the editor because it is either binary or uses an unsupported text coding". I looked in the web that I can use hexdump to read it.
I would say that reading it, is not a big issue even using hexdump, but when I try to read it and showed it in the console the data become unreadable and an error message popped up with the output
123
PLUU
?????
free(): invalid pointer
is there a way to read binary file in vscode?

Adding to exifdata using undefined tags

I am trying to write some tags to the exifdata of an image, but i keep getting errors. It says that
exiftool -o /volumes/xsan2/lvis/level1/mjd/58680/camera2/images/LVISCAM2_ABoVE2019_0716_R2002_083194.JPG -GPSDateStamp 2019-07-16 -GPSTimeStamp 23:06:34 -GPSLatitude 62.090340 -GPSLongitude 114.193019 -GPSLatitudeRef N -GPSLongitudeRef W -GPSAltitude 2822.12 -GPSRoll=-2.76 -GPSPitch=-0.19 -GPSImageDirection=-96.38 -GPSImageDirectionRef T -Creator "Nasa's Classic (lvis.gsfc.nasa.gov)" -UserComment "Instrument: NASA's Classic (lvis.gsfc.nasa.gov), Mission: ABoVE2019, Platform: GLF5_N95NA" /volumes/xsan2/lvis/archive/mjd/58680/GLF5_N95NA/camera/classic/LVISCAM1_2019_07_16_051912.JPG
This is the error that i get when i run the command
Warning: Tag 'GPSRoll' is not defined
Warning: Tag 'GPSPitch' is not defined
Warning: Tag 'GPSImageDirection' is not defined
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: Can't create JPEG files from scratch
Error: '/volumes/xsan2/lvis/level1/mjd/58680/camera2/images/LVISCAM2_ABoVE2019_0716_R2002_083194.JPG' already exists - /volumes/xsan2/lvis/archive/mjd/58680/GLF5_N95NA/camera/classic/LVISCAM1_2019_07_16_051912.JPG
0 image files updated
1 files weren't updated due to errors
10 files weren't created due to errors
How do I define the tags that have errors,
And what does the error about creating JPEGs from scratch mean?
With regards to the JPEG files from scratch errors, your command is missing a lot of equal signs. For example, this part
-GPSDateStamp 2019-07-16
What your telling exiftool is to display the GPSDateStamp tag. Then, since 2019-07-16 is set off by itself and it's not any exiftool command option, exiftool believes you want to process a file named 2019-07-16. What that option should be is:
-GPSDateStamp=2019:07:16
Take note that the date/time formats are supposed to be separated by colons. Exiftool is flexible about such things (see FAQ #5) but the habit might lead to a hard to find error at some point.
The problem with the not defined errors is the fact that these tags (GPSRoll, GPSPitch, GPSImageDirection) are not tags defined by the EXIF standard. Exiftool doesn't know how to write these unless there's a definition written for them. If you download the exiftool example config file, save it to the same directory as exiftool, and rename it to .ExifTool_config, this will add definitions so you can write GPSRoll and GPSPitch.
For the last one, I think the actual tag you want to use is GPSImgDirection, not GPSImageDirection.

Doxygen command line - error handling

I use Doxygen in command line mode(via a batch file scheduled to run at certain time) for generating code documentation.
I supply it with a Doxyfile that has all the settings.
And it overwrites the previously generated documentation for same code.
My problem is, the input location name may change at some time.
So, in the log, doxygen shows that it cannot find ONE of the input locations.
What my aim is that the documentation should be generated/overwritten ONLY IF there is NO ERROR.
There are three possible solutions in my mind(in the order of decreasing convenience):
Interrupt docs generation in case of ANY error.
If its not possible to interrupt the docs generation, I can generate docs in some other place and then replace older ones using simple move command in batch file IF Doxygen has not thrown any errors. For this, I will somehow have to get hold of Doxygen errors in batch file runtime.
Save docs to different folder, save log to txt, scan txt in batch for errors(This, I can do but prefer avoiding)
So, is there any way I can get hold of this error while running Doxygen via batch file?

Perforce "Translation of file content failed" error

I'm trying to add a fairly large number of files to a Perforce depot. On submit, I get the following error, which I think means it's having trouble working out the file type for one of the files:
Locking 16380 files ...
Translation of file content failed near line 1
Submit aborted -- fix problems then use 'p4 submit -c 5851'.
Some file(s) could not be transferred from client.
How do I get more information about this, specifically which file it's actually having trouble with? The error isn't entirely helpful when it comes to fixing the problem.
Typically, I found the answer 5 minutes after posting. Turns out the file log from p4v shows more information than the log window. Turn on file logging, and the log file will show you where the problem is.
I just had this issue. And yes, it is due to a file type problem.
But if you have hundreds of thousands of files, it is not easy to find the offending files.
"p4 opened -c pendingchangelist#" lists files (along with their file types) that are open in a pending changelist. Pipe the output to a text file. On some servers, for example, utf16 is not supported. search for 'utf16' and retype them to binary (again, for example).
You can move the offending files from the pending changelist to a different pending changelist and retype the files all in one shot with "p4 reopen".Now you can resubmit the original pending changelist and next, submit the new pending changelist with file types corrected.
My situation was a little bit different from amir's but the solution worked. Sadly I didn't know which keyword to search in the opened file, so I eyeballed the output of "p4 submit" on console and found a c-file was opened as "unicode". After reopening the file as "text" I successfully submitted my changelist.
Next time I will try the filetype listed in p4 manual before eyeball the output, here is the list: Base filetypes