can't show output from binary file - visual-studio-code

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?

Related

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.

conversion from jpeg to png algorithm

On a linux machine, you can change file name from "abc.jpeg" to "abc.png" by just doing rename. I am still able to open my pic in image viewer.
I wanted to know if the compression technique also changes when we change the name, or just the name changes and the image viewer itself opens it the way it likes?
The file name has nothing whatsoever to do with the contents of a file stream. Every decoder I have ever encountered will decode the stream based upon its contents; and not the file name. Some decodes will warn if the file name does not correspond with the stream type.
To your question, renaming does not change the contents of the file on any system I have ever seen.
As pointed out by yacc in comments, renaming that file won't change the compression method, if we want a true png we will have to convert it.
The hex signature of image/file is checked before opening it in the image viewer. Changing name does not change this signature and hence, even though your file name is .png, it is actually a jpeg and your viewer knows it by the hex signature.
https://en.wikipedia.org/wiki/List_of_file_signatures

Find corrupt data in xlsx file

We are generating xlsx files using a perl script. Files usually contains thousands of records. This makes spotting errors a very difficult operation.
This process was working since years without problems.
This week we got a request to check a file which contains errors. While opening Excel prompted that the file contains errors and asked whether we want to repair them.
In fact we do not want to recover the data but want to know which part of the file is corrupt. The error should be coming from corrupt data and we are interested to identify these data.
the log message shows the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error068200_01.xml</logFileName> </br>
<summary>Errors were detected in file 'D:\Temp\20161020\file_name.xlsx'</summary>
<repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord>
</repairedRecords>
</recoveryLog>
The error should come from corrupt data. Is there any tool/method which helps to spot this corrupt data?
I tried renaming it a zip file, extracting it and opening it via an XML editor but was not able to find any errors in XML file.
We also checked that the different XML file structures are fine.
Thank you and best regards
As expected, the problem was coming from text cells containing numbers having an E in the middle.I used the following steps to identify the erronous cells.
1. Wrote small Java class to read the file. The class was checking the cell type and displaying the value afterwards.The java program generated an Exception at some line "Cannot get a numeric value from a text cell" even If I was correctly checking the cell type before displaying the content.
2. I checked the opened Excel file at that line and found that the cell contains only 'inf'.
3. I opened the file using open office and looked at the same cells. They contain 0.
4. I debugged the program generating the data and found out that these cells contain data like '914E5514'. Seems that E which was interpreted by Excel as an exponent.We changed the program to use the format '#' for that cell and this solved the issue.
Thank you.
Thank you very much, you helped me a lot by saying that 1 particular content item may be the root problem.
My corrupted content was https://www.example.com XYZ ... ASDAS
Solution: www.example.com XYZ ... ASDAS
This is something which cannot be handled by excel. Would be nice to have a list of thing which do not work

load unix executable file to ascii

I am simply trying to load ascii files with two columns of data (spectral data).
They were saved originally as .asc.
I need to open and edit them using text editor before I can load them into Matlab to erase the headers, but some of them somehow got converted to unix executable foramt with the .asc extension. And others are plain text docs also with the same extension. I have no idea why they got saved with the same extension and with my same manipulation as different kind formats.
When I use the load command in Matlab, the plain text docs load normally as expected but the ones saved as unix executable kinds give me this error:
Error using load Unable to read file filename.asc: No such file or
directory.
How can I either resave them (still with the same extension) or otherwise load them to be read by Matlab as standard two column data matrixes?
Thanks!
If these are truly plain text files, try renaming the file from xxx.asc to xxx.txt. Then, see if you are able to edit them as desired.

pdftk crashes with large document

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.