Create new file with custom file extension? - cocoa

How can I create a new file with a file format of say .kuy.This file would be holding encrypted data. And then later I could choose that file with extension .kuy to decrypt. So if I encrypted soundfile.aup, the encrypted file would be soundfile.aup.kuy, then the user would proceed to decrypting that file in which case the output would be soundfile.aup.
Thank you,
Bobby

You can assign a file extension to your application by going to your Target's info window and selecting the Properties tab:
After that, you just need to add your desired extension when you save a file.

As Steve suggests, first you have to create a custom file format. After that, whenever a custom file gets open - double click or whatever - its path will be passed to application:openFile:. http://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-SW29
Once you have the path, do your logic and you should be fine.

Related

Create a .txt file and store it on a specific folder Laravel

So basicly, I have to make a Laravel command which will create a .txt file. The command accepts as arguments the index of the file(id) and one or more tokens(words inside file). I am finding unable to create the file with it's content inside my desired folder(Called 'files' inside the root directory).
I found a way to create it inside the Storage, but that's not exactly what i need.
Would appreciate some help, thank you
Check out the filesystems.php file and add a specific configuration for the directory you want to read/write. After doing so, you will be able to create a file using the File facade by specifying your disk like so: File::disk('my-disk').

How to append the file using Ansible

I'm trying to append a file to the existing file. When I hit a specific url I get the updated data everytime. my requirement is to append the updated to the same file instead of creating a new file everytime. I'm using get_url module to get the file. but the file is not being updated. If I give the destination as new file then data is being copied to new file.
get_url doesn't appear to support that operation. You may need to retrieve the file and use the Assemble module to concatenate (or combine) the files.

How to hide a password in a .bat file?

I'd like help in setting password in a batch file but without exposing password.
If I SET password="abc123", I don't want abc123 to be visible in the batch file, as other people will be running the .bat file.
There is unfortunately no good solution to hide a password in batch
Even if you crypt it, change it to HEX, hide it in an Alternative Data Stream (ADS) or whatever you want.
At a moment you have to test the value in your code with an IF test.
At this point the password, crypted or not, will be visible or settedin a variable that can be echoed.
You can also compress your BAT in a self-extracting .EXE, but this is very easy to crack, while the .BAT file have to be decompressed before you run it (in the %temp% folder).
So there is no way to really hide a password in a .BAT file
You can try this method : Password hidden using ADS
create and save your batch file
use the ECHO command to 'place' your password into an ADS attached
to your batch file
use redirection to read the password from the ADS (Alternative Data
Stream) file

How to create a UI.inputbox which prompts for browse path? [SketchUp 8 API]

I have a ruby script for SketchUp 8 which collects data and needs to write it into a csv file. When the code creates the csv file, I want an inputbox to show up which asks for the filename and directory to save too.
Does anyone know how to create an inputbox with the 'browse directory' option?
UI.inputbox is a very simple and limited API method - it only allow textbox input and dropdown selectionbox input as described in the API docs: http://ruby.sketchup.com/UI.html#inputbox-class_method
But there are other methods for opening the file dialogs:
UI.savepanel http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#savepanel
UI.openpanel http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#openpanel
There are no further customization offered than what is described in the API docs.
If you need to design you own custom dialog then you have to resort to either webdialogs (http://www.sketchup.com/intl/en/developer/docs/ourdoc/webdialog - https://github.com/thomthom/sketchup-webdialogs-the-lost-manual) or making your own Ruby C Extension and make system calls natively (https://github.com/SketchUp/ruby-c-extension-examples).

How to check and copy for newly added content in a .txt file

I need to create a file watcher which will look up a newly added file in directory for newly added data.
When ever new data is adding to a .jrn file.The newly added data should copy to a temporary file. I am using window service (C#) to develop this.
I solved this by following the below steps:
Create a timer in order to check any new file created
Use the substring method to get new added content
Swap the last added two contents

Resources