Edit File During it is processing in Unity - file

I am making a unity app in which it read data from a text file and
take actions accordingly and I want to update this file after regular intervals.
When I tried to update my file it says file is in process you can't edit it.
I have also tried .xml file extension for editing it but it didn't work
Which file format can be edited during processing?

We we can’t help without code. But Unity can process any file format like .txt .xml etc but you need to give read/write permission and also you need to check, is the process done before writing the file. This is the whole how read/write works in any platforms. I hope you get idea.

Related

Moving file to another directory in ABAP

I have got a service running in a specific directory in 5-second-intervals which is picking up an XML file created in that directory sending it for some necessary authorization checks to another client and then requesting a response file.
My issue is that my Z_PROGRAM creating the XML file might take longer than 5 seconds as a result of the file's size. Therefore creating the file in that specific directory is not preferable. I thought about creating a new folder in that directory called "temporary" and creating the file inside that folder, then once I'm done with it, moving it back outside for the service to pick it up.
Is there any way to move files from one directory to another via ABAP code only?
Copying the file manually is not an option since the problem that I have during file creation still persists. I need 2 alternatives, one used for local directories and one for application server directories. Any ideas?
Generally, we create another empty file for completed files after the file creation process ends. Third parties must be firstly checked empty file is there. Example:
data file.csv
data file.ok
If you already completed your integration and it is not easy to make any change with third parties, I prefer using OS level file moving commands. Sample document here. You can use mv for Linux server and move for Windows. If your file is big, you will get same problem with OPEN DATASET concept. We have ARCHIVFILE_SERVER_TO_SERVER FM for moving files but it is also using OPEN DATASET.
there is no explicit move command in ABAP code that move or copy files between directories in application server.
there is two tips can be helpfull in your case. if you are writing big file you may seperate the logic behind collecting data and writing file. I would say don't execute transfer data inside your loop. instead collect you data into an internal table once you're done, loop over this internal table and write direclty strings without any delay you should be able to write a big files upp to several hundred of MB under 1 sec.
next tips is to not modify your program, or if you are using function modules to construct xml is, write to a temp directory after finishing, then have another program open you file on source directory by read dataset and directly write data to the new directory again just strings without interruptions.
you should be ok if you just write strings.
You can simply use System Call Commands to perform actions in Application Directory.
CALL 'SYSTEM'
ID 'COMMAND'
FIELD 'mv /usr/sap/temporary/File.xml
/usr/sap/final/file.xml'

Quickest way to create a .bat file (as .txt)

I have a couple lines of code in a batch file in Windows 10 that open a session of Octave, and load a script that uses design parameters contained in a .txt file. The batch file is named (for example) "Design123.bat", and when Octave runs, it automatically finds the design parameters in the file "Design123.txt" by simple string manipulation of the file name, i.e. strrep(filename,".bat",".txt"), where filename = '%~dpn0' is passed to Octave from the batch file. This allows for the contents of the batch file to stay simple and constant, and the file name of the batch file is the only thing tying it to the .txt file.
I do all of this to allow running the Octave script by double-clicking the batch file for convenience, instead of being forced to use the more tedious process of uigetfile in Octave. This works very well, but the catch is that I have to place a copy of the batch file in the same directory with the design (.txt) files (of which there are thousands, but each within their own directory) and give it the same file name to get it to work. Is there a way to quickly create the batch files somehow? The most ideal situation I can think of is to be able to right-click (or somehow select) a .txt design file, and create a batch file (replacing .txt with .bat) and place my lines of code into it.
Any ideas? I have coding experience, but only in software packages like VBA and Octave, not within operating systems themselves, though certainly willing to learn if I could get pointed in the right direction. The design file names follow a distinctive pattern, so they could be filtered easily within an operation on the active "File Explorer" window in Windows 10, if something like that is possible. Thanks in advance.
You might want to compose the answer to your question from calling the script on the right click and running the .m script with command line arguments.
If that fails, uigetfile is certainly not the only method to get file. At the very least you could always copypaste a path string to a folder from explorer to octave function call.
Finally, I guess I'll mention the existence of octave-cli which runs in terminal instead of gui. It might be better suited for running non interactive scripts.

ePub mimetype - anyone encountered a situation where it's needed?

I'm wondering if anyone has ever encountered a situation where it was necessary that the mimetype file be put into the zip file first (and uncompressed) to make the ePub work. And I'm not talking about the ability to pass an ePub validation.
I've been trying to write a script to create ePubs and it's not working. I tried several variations of the 7zip flags and every time the validation complains about the mimetype file.
I got fed up and just opened one of the files in Digital Editions and it worked fine. Then opened it in Calibre, dropped it into Chrome (ePub Reader), in iBooks, and even made a Kindle file. Everything worked as expected without throwing up an error.
Is there any situation where this matters...apart from the OCD part of me wanting an error-free file?
The answer appears to be "no"...
But here are a sampling of posts fighting with the Mimetype file error:
Make MIMETYPE file the first file in an EPUB ZIP file?
Creating an Epub file with a Zip library
creating *.epub with perl Archive::Zip -- epubchecker error
How to create ePub with System.IO.Compression.ZipArchive?
The mimetype file has an extra field of length n. The use of the extra field feature of the ZIP format is not permitted for the mimetype file

How can I put a file path into the clipboard so that it can be pasted as file in a file manager?

I want the user to be able to copy a file that's stored on disk from my GTK application to a normal file manager like Nautilus. How can I do that? I would prefer to just write a path into the clipboard and let the file manager take care of actually copying, is that possible?
I just found an example in which it seems as if the actual file data is transferred through the clipboard – but is that the only possible way?
You need CF_HDROP and possibly other shell clipboard formats.
See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776902(v=vs.85).aspx;

What is tsr file

i have a requirement to export data to tsr file only. Previously we used to export to csv file.
Can anyone tell me what is tsr file and what is the content format? Is the contents in someway similar with csv?
Google does not come up with something convincing. I suggest you ask your client to explain the requirement in more detail. TSR does not seem to be a generally understood format.
Maybe TSV (tab-separated values, VERY similar to CSV)?
TSR are shared repository file. Basically you can see this type of file in HP UFT. Whenever you create object in UFT it goes into repository with extension .tsr.
See this: http://www.computerfileextensions.com/file-extensions.php/TSR
But the results are not so clear/convincing.
Can not you ask for a sample tsr file from your client?
Another result for related to TSR files, but it's probably another format the OP was looking for.
The TSR file extension is related to TSR Launcher, a fan-made program for The Sims 3 computer game series that allows users to quickly install Sims3Pack files without using the Launcher provided by EA. It looks like the program is no longer available for download.
A *.tsr file is used for download basket function. Most likely some sort of container.
http://www.file-extensions.org/tsr-file-extension

Resources