how to check if a protobuf file is corrupted - protocol-buffers

I am new to protobuf but so far I have used it without problems in python. I have a .bin file encoded through protobuf and I have the .proto file with which this .bin should be "interpreted".
However, when I try to open the file with file_bin.ParseFromString(f.read()) I get the following error: google.protobuf.message.DecodeError: Error parsing message . I googled this error and many of them seem to point in the direction that something might be wrong with the .bin file itself (e.g., it is corrupted or not well "generated").
I was wondering if there is a way, given the .proto to understand if the .bin is actually corrupted or not.

Related

VS Code default path problem with SFML header

I have been trying to get this to work for two days now. I have read every forum thread I could find and I still don't have a solution. I am trying to use the SFML libraries on a mac in VS code and I am getting the error "fatal error: 'SFML/Graphics.hpp' file not found". I used cmake to build the libraries with the Unix makefiles, and transferred the dylib files into my working directory and libraries folder.
I have created a make file that links my compiler to the libraries and double checked my pathing but it still isn't working. Curiously it can find the header file when I write "src/include/" before the header but I would like this to work without me having to manually add that to every include within the header files. I think the problem is to do with my default path but I can't figure out how to fix it. I have tried using multiple paths in the default file path in "c_cpp_properties.json" but nothing I have tried has worked.
Any help would be a lifesaver. I have attached some images to help spot any problems.
My main.cpp
My current default path
My make file
Thanks

load yaml files from outside current directory

I want to load a yaml file from outside the working directory. I use c++. I used YAML::LoadFile("/home/example.yaml") and it complains YAML::BadFile. Please let me know if there is any way to do that.
YAML::LoadFile does nothing else than reading the file via std::ifstream. So your actual problem is that you cannot open the file at all in your application.
Check whether the file exists and has the proper permissions so that your application may open it. Try opening it directly with a std::ifstream and hand that over to YAML::Load so you can inspect the stream directly to see what error occurred.

FileZilla won't upload properly

I recently installed WordPress on my hosting server and all went fine, however one of my pages "/wp-admin/update-core.php" is having issues. Upon opening, the file appears to be cut off mid way.
I've compared this file against the file in the zip file I uploaded and the original copy is not truncated.
Where this gets even weirder is that, if I edit the file on the server to paste in the missing code, after I save and open again, the file is still missing the code I just added AND is now missing an additional line of code.
I've also tried deleting the file, and re-uploading the original copy again and it appears to be cutting off at the same point.
Anyone experienced this or have any ideas?
I've got a similar problem with v3.37.3 - uploaded .zip file is truncated, and .svg files have zero length. This is true even when I set the transfer type to 'binary' rather than 'auto'. Also, when repeating the copy operation for the .zip file, I am prompted more than once to confirm the overwrite of th eexisting file, almost as though Filezilla sees several files instead of just the one .zip archive.
I had the same problem. I uploaded a file (a Linux executable) and it was truncated from 4,396,728 bytes to 4,392,145 bytes. My fix was to change the transfer type, which you can set using the Transfer menu, from Auto to Binary. I guess that FileZilla assumes that files with no extension are text; other files, with extensions dmg (Apple disk image) and zip (compressed file) were correctly treated as binary. I am using a very recent version of FileZilla: 3.29.0.

ChemSpider refuses to accept the .MOL file I present it

I converted a .pdb file to a .MOL file through BABEL (Converter Software). I do get the .MOL file, but when I submit the file online for a similar structure search It doesn't even load the file in ChemSpider.
To use PubChem's database you need SMILES format, which BABEL cannot properly convert my .pdb file to. So I'm out of luck there.
Any way I can search my .MOL file on any chemical database that's out there?
Thanks

Checking files for errors

I have lots of files in different formats (mostly pdf files) and I need to check if they can be opened without errors and get a list of those that are broken.
Other than opening them all separately is there a way to find out which won't open / are corrupt?
Not really, no. Because there are so many file types it would be impossible to know if a file was corrupt without opening it. It might open without errors but still be corrupt so even that isn't going to help you. You could try a general file opening solution like KeyView which can open most file formats. If it fails then chances are the file is corrupt.

Resources