Possible EOL issue during unrar? - linux

I have large CSV file that I have compressed with WINRAR in windows 8.
After uploading the file to Centos 7 x64 on my VPS, I used unrar. The file is exactly the same size as it should be after being uncompressed but when I run my import script exactly half the number of rows are imported.
The same script works file locally so my hunch is that rar/unrar might be doing something to EOL?
Just wondered if anyone has experienced anything like this before?

Rar was not the issue at all. It was a column I was using in the CSV to index the data that was not always present.

Related

YAML file one line filled with null characters, #0000 character not supported while reading

I've built a python based application(which runs 24/7) that logs some information in a YAML file every few minutes. It was working perfectly for a few days. Suddenly after approximately after 2 weeks, one line in the YAML file was filled with NUL characters (416 characters of NUL to be precise).
Now the suspicion is that someone might've tried to open the already running application again, so both the applications tried to write/access the same YAML file which could've caused this. But I couldn't replicate this.
Just wanted to know the cause of this issue.
Please let me know if someone faced the same issue before.
Some context about the file writing:
The YAML file will be loaded in append mode and a list is written inside it using the command below:
with open(file_path, 'a') as file:
yaml.dump(summary_list, file)
Concurrent access is a possible cause for this especially when you're appending. For example, it may be that both instances opened the file and set the start marker on the same position, but let the file grow to the sum of both appended data dumps. That cause some part of the file not to be written, which might explain the NULs.
Whatever happened is more dependent on your OS and your filesystem than it is on YAML. But even if we knew that we couldn't tell for sure.
I recommend using a proper logging framework to avoid such issues; you can dump YAML as string to log it.

Mac executable not working when downloaded online

I have made a small (8 MB) program into a MAC executable (.app?)
It works great if I share it using a thumbstick, but if I try to upload it to google drive and then download it it doesn't work. By this I mean It first tells me that It is an unidentified source (this seems reasonable)
But then if I click "open"
It opens as a text file with junk data:
If I try to force it to open on the terminal, how the other program opens, it just shows the heartbeat thing that MACs do when opening a file, but never opens anything.
It is certifiably the same exact file. Same size, same name, same goobldygoop if I open both of them as text files instead of executables.
I am really confused, the only thing I can think of is the "signature" that apple uses is lost when it is compressed into a zip, but I'm probably totally off base.
The code uses python 3.7, pyinstaller, pynput, and selenium.
I am using MAC OS Catalina to write and make into an EXE, then another Catalina to try to run the program.
EDIT: Clarify what doesn't work means
Please help.
I found the answer, simply zip the file from my mac and send it that way!
Yay!

Linux bash to compare two files but the second file must be find

I have a batch that integrates an xml file time to time but could happens daily. After it integrates it puts in a folder like /archives/YYMMDD(current day). The problem is if the same file is integrated twice. So I need a script what verifys the file (with diff command its possible but risky to make a bottleneck) but the problem is I can't find to resolve how to make to give the second files location.
P.S. I can't install on the server anything.
Thanks in advance.

Saving CSV in UTF-8 on Mac

I am having problems to save a CSV file for Core Data using my Mac, works if I save in Windows computer but not in the MAC. I am using Excel. Every time I run the CSV file saved in MAC there are different errors in the Xcode.
In my experience when you save CSV files in a Mac computer it is always a mess. I had several problems dug in the forums and realize only could save CSV in PC with windows. If you are using UTF-8 in your coreData you can workaround with this, I am doing this for some time and never had problem again in my Mac.The way I do:
Save the .CSV file (comma delimited) in Excel.
Open the .CSV file with (http://www.sublimetext.com/2
File > Save with Encoding > choose the one you want.
Done.
If you have to edit or open the file in Excel, you have to save in Sublime Text 2 again before you drag to your Xcode project.
Forget Windows computers :)
Hope this solve your problem.

x64 Portable executable not working

I created an exact replica of this file in a hex editor: https://i.imgur.com/LIImg.jpg
The problem is, the .exe file I made from it doesn't work, it says it's an invalid Win32 application when trying to run it. Is there something flawed in it? I've checked and double checked my file...
I'm not sure where I can host an exe file but I can email it if someone else wants to check it.
I should also mention I'm running Windows 7 64-bit.
The PE binary file from that illustration is already available here from the author, Ange Albertini. I have tested it both on Windows 7 and Windows 8/8.1, and it runs just fine, so you can use it for comparison with your binary.
In case anyone was wondering, the difference between the image and the executable is that there has to be 0's at the end of the file to match the section size. It doesn't work without that.

Resources