HIdden characters in cytoscape names - filenames

I am attempting to upload a .cys file to a journal website as part of a submission. Although they accept all file types, when I try to upload the .cys file, the name exceeds the 64-character limit, apparently due to some hidden characters in the name. Is there anyway to see the hidden characters in the file name and/or change them so the filename is less than 64 characters?

You should be able to simply rename the .cys file, however, they might be attempting to unzip it automatically (a .cys file is actually just a zip archive of everything in a Cytoscape session), in which case, they might be having problems with some of the filenames inside of the .cys file, which can't be renamed. You'll need to ask the journal about that.
-- scooter

Related

Remove portion of a remote file using SFTP

I would like to remove a portion of a file using the SFTP protocol. Example:
This is a sample text. --> This is a text.
The standard protocol write operation takes an offset and a string of data as inputs. However, the interface does not specify a file length to possibly remove characters from the file. That way the file can only ever grow in size. In the above example, if I attempted to update the file using write, the resulting output would be:
This is a text.e text.
What is the proper way of removing characters in SFTP? Is there perhaps a terminating character which is used to signal the end of a file when using write? Or do I have to just delete the entire file and re-upload a new one?
You cannot remove a part of a file contents. Not even from a local file, let only from a remote file over SFTP.
You have to overwrite the file – or at least whole part of the file starting with the first changed byte. And then truncate the file, in case the new contents is shorter than the original.
You can use copy-data SFTP extension to copy data within the file itself to avoid need to reupload the existing contents. If your SFTP server supports the extension. In OpenSSH, it's supported only in very recent version 9.0.

Modify the content of an MS Word file contained inside a .zip file, without extracting it?

Is it possible to manipulate the content of an MS Word file contained inside a .zip file, without extracting it?
I have 2,000 zip files containing Word files. I need to modify the same field in each of the 2,000 zipped MS Word files. Is this possible without extracting the file first?
Yes it is possible, but the difference is semantics. When I do this, with single documents, I COPY (not extract) the xml file from the zip container, edit as required, and then OVERWRITE back into the zip container.
I've also tried to edit the file from within the zip file, but it can't be saved directly (at least not the way I have tried) - so (for example in NotePad++) file SaveAs would be required...

My bashrc file has a comma in it

My bashrc file is listed like this when viewed in the file explorer:
,bashrc
I believe the filename should be formatted like this:
.bashrc
Will the comma affect how the program runs?
Is it ok to replace the comma with a period?
From this answer:
.bashrc is a shell script that Bash runs whenever it is started
interactively.
The .bashrc file must start with a period, not a comma, as it's a "hidden" file.
From wikipedia regarding hidden files:
In computing, a hidden folder (sometimes hidden directory) or hidden
file is a folder or file which filesystem utilities do not display by
default when showing a directory listing. They are commonly used for
storing user preferences or preserving the state of a utility, and are
frequently created implicitly by using various utilities.
Before renaming the file (replacing the comma with a period) you should first read it's contents and make sure that there is nothing potentially harmful there.
Someone could have potentially changed the period to a comma to ensure that the file isn't run while making risky or temporary changes.

Preventing other application from opening custom file vb.net

I have a text file. Now I have changed its file type from .txt to .abc. My VB.NET program loads the text into textboxes from that file. After changing the file type, however, other apps like NotePad and Word are able to open and read my .abc file.
Is there any way that only my application will be able to open/read from the file and no other app would be able to do so? What I mean is, suppose I have a PhotoShop document .psd file, no other app, rather that photoshop itself, can open it. How do I make my file unreadable by other apps?
There is no way to prevent an app that you don't develop from opening any file. The extensions are just there for helping us humans, and maybe a bit for the computer to know the default app you select for an extension.
Like you said, a .txt file can be opened by many many apps. You can open a .txt file with Notepad, Firefox, VSCode, and many others.
Same way, a .psd file can be opened by many many apps. You can open that .psd file with Photoshop, but also Notepad, Firefox, and VSCode, and probably the same apps as above.
The difference is which apps can read and understand the file.
In order to make a file not understandable by other apps, you need to make it into a format that cannot recognize, because you planned it "in secret".
Like Visual Vincent said above, you could encrypt the file in a way, or you can have a binary file, that basically only your app knows know to understand.
Since you dont own the app you want the file to be understood by, then you either have to accept that it can be opened by any app that can open files, or you can try to encrypt the file outside the app, or like zipping it with a password, and then decrypting or unzipping when you want to use it.
Firstly, any file can be read unless it is still open by a particular process or service. Even PhotoShop files can be 'read' by NotePad - try it!
So, an attempt at my first answer...
You can try a couple of methods to prevent opening the file, for instance, applying a file lock. As an example, SQL Server .mdf files are locked by the SQL Server service. This happens because the files are maintained in an open state, however; your application would have to remain running to keep these files open. Technically, though, the files can still be copied.
Another way is to set the hidden attribute for the file. This hides the file from the less savvy users, but it will be displayed if the user show's hidden files.
And my second answer: You refer to the format of files by saying only PhotoShop can read or write its own files (not true, but I know what you're saying).
The format of the file must be decided by yourself. You must determine how you are going to store the data that you output from your application. It looks like you have been attempting to write your application data into a text file. Perhaps you should try writing to binary files instead. Binary files, while not encrypted, as suggested by Visual Vincent in the comments to your question, still provide a more tailored approach to storing your data.
Binary files write raw binary data instead of humanised text. For instance, if you write an integer to the file it will appear as a string of four bytes, not your usual 123456789 textual format.
So, you really need to clarify what data you want to write to the file, decide on a set structure to your file (as you also have to be able to read it back in to your application) and then be able to write the information.

Changing hash of a files

I have a folder full of binary files and I want to make a change to these files so that the hash of these files will change. I want to do this is a fashion that doesn't pertinently corrupt the files. Meaning that the change should still allow the file to operate normally or that I should be able to undo the change at any point in time.
Does anyone know of a script that I could use to do this or many a program that will automate this?
Cheers
UPDATE
Its a edge case that I am trying to deal with. I have a system that only allows me to store a file with a given hash once. Hence I am wanting to change the content hash of the file to allow the file to be stored. Note the system in question is not one I control or can change.
Couldn't I just add a random 1 to the end of the file and then remove it afterward without breaking anything? I'm just not sure how to script this - as in how to modify the binary data in this way. Note I'm in a windows environment.
Without knowing the format of the files, we can't tell. It may in fact be impossible - for instance if these binary files are self-signed with some private key. Changing any single bit within the file is likely to render it invalid.
Is your hash calculated purely from the contents, and not any other metadata that you can change (such as filename or modified date)? If so, you're probably out of luck. If the hash is meant to detect when the content changes, but you're trying to change the hash without actually changing the content, you've clearly got a problem...
What is the hash used for? Why do you want to change it? There may be an alternative solution if you could give us more information about the bigger picture.
EDIT: One alternative is to effectively create your own container format - so while a file is stored in your container format, it's not usable in its original form, but it can be extracted easily. Your container could be as simple as "add four bytes at the end as a seed to disturb the hash" - "extracting" the file would just involve copying it and removing the last four bytes. But the important point is that what you end up with isn't an MP3 file or whatever you started with - it's your custom format, simple as it is. You need to package/extract the file any time you interact with the store.