How to add copyrights to my current app in xcode using MAC OS - xcode

I am working on an app.I have finished the app development module ,now i am working on getting it ready for delivery to client.
I have to add client's copyrights to all the .h,.m files inn my projects.As there are around 700+ files in this .Also i don't want to use the cntrol+find in entire app and replace it with the copyright content required.
Is there any other approach i can look into to add the copyrights content to it.I heard of creating some sort of batch file and then using terminal to add copyrights to project but i am not sure how to implement this.
Any help would be appreciated.
Thanks

Hmm, this may need just a little shell scripting. In general, this is how I would attempt to tackle it:
Create a text file with your copyright.
Create a text file with the (code) file names you need to add the copyright to. (Should be pretty easy with something like ls *.m > script).
Open the script file with a text editor and modify each line so that it reads:
cat copyright 'filename' >
Should be pretty easy to do with a macro
Set the script file's execution bit: chmod a+x script
Run the script by: ./script
Notice that this produces files with '_out' at the end. Change it to what fits you.

Related

How to compile a lex file on windows?

I have correctly downloaded and installed flex, bison and Dev C++ in C:\ . Then I tried to compile myfile.l in command prompt, but it gives the error:
flex: can't open myfile.l.
What is the problem?
I can see from your question that you are a beginner in need of some instruction, so what follows is in tutorial style. I hope you don't mind the tone. Many of my students encounter the same problem as you did when first starting.
The files containing the code for flex, bison or the compiler gcc (or g++) are just text files, and not some specially encoded form of file. They are only named something.l, something.y and something.c (or something.cpp) by convention. We could just call them something.txt or even something.l.txt if we wanted to. The reason they are named the way they are is to enable all the different components of one program to be distinguished without cluttering up the name space. So, if we have a project, such as some homework done in flex and bison, we can use the word homework as the base name and have the following file set:
homework.l <-- The lexer source file for flex created for the homework
homework.y <-- The parser source file for bison created for the homework
homework.cpp <-- The C++ source file for g++ created for the homework
homework.obj <-- The object file created by g++
homework.exe <-- The final windows executable created by g++
(There will be many other files as well, but I'll skip over that for now).
As the source files are just forms of a text file they can be created by a text editor. You indicated you are using Dev C++ which is an IDE (Integrated Development Environment) which combines a text editor, a compiler and a debugger into one package. The text editor part works just like any other text editor, such as Notepad, NotePad++, vim, emacs or one of the myriad of other editor tools.
Commonly, by default, a text editor tool on Windows will save a text file with the postfix language code of .txt. Here is an example dialogue of saving such a file:
You can see that if I saved my file, which I called SOlexer.l by pressing the Save button, I would get a file called SOlexer.l.txt because the default is to always make a file withe the suffix of .txt.
Now this does not need to be a problem. If I tried to invoke flex, as you did:
$ flex SOlexer.l
flex: can't open SOlexer.l
I would get the same error message. However I can just call flex with the actual file name used and it would work:
$ flex SOlexer.l.txt
$
Alternatively, I could rename the file, and then use it:
$ rename SOlexer.l.txt SOlexer.l
$ flex SOlexer.l
$
Problem solved!
However, as you have discovered, it is best to just create the file with the desired (and more convenient) name in the first place. To do this one has to just make a different selection from the menu when saving the file, like this:
If we click on All types (*.*) we can create the file without the .txt suffix. This should work for most similar tools also.
To help my students who had difficulty using flex and bison on Windows I made a series of video tutorials. You are welcome to use them also.
In conclusion, although you had trouble getting your flex file to build, your problem is nothing to do with flex or bison, but a simple beginners problem with learning how to create and edit files on a Windows system.

Open ZIP/RAR automatically

do you know some kind of software, or way to script automatic dearchivation on Windows?
Ideally this thing should work like this:
Open file with this script/software
It will search files inside by mask (doc, pdf, jpg...) and if there is <2 of that files - script will open them, if > - unpack to C:/Temp or whatever
If there is archives inside - go to 1 and perform same thing to them
Any help would be appreciated:)
You should use the jolly character("*").
Try telling the script to open a file called *.doc, *pdf or *.jpg.

How to create a batch file in Mac?

I need to find a solution at work to backup specific folders daily, hopefully to a RAR or ZIP file.
If it was on PC, I would have done it already. But I don't have any idea to how to approach it on a Mac.
What I basically want to achieve is an automated task, that can be run with an executable, that does:
compress a specific directory (/Volumes/Audio/Shoko) to a rar or zip file.
(in the zip file exclude all *.wav files in all sub Directories and a directory names "Videos").
move It to a network share (/Volumes/Post Shared/Backup From Sound).
(or compress directly to this folder).
automate the file name of the Zip file with dynamic date and time (so no duplicate file names).
Shutdown Mac when finished.
I want to say again, I don't usually use Mac, so things like what kind of file to open for the script, and stuff like that is not trivial for me, yet.
I have tried to put Mark's bash lines (from the first answer, below) in a txt file and executed it, but it had errors and didn't work.
I also tried to use Automator, but it's too plain, no advanced options.
How can I accomplish this?
I would love a working example :)
Thank You,
Dave
You can just make a bash script that does the backup and then you can either double-click it or run it on a schedule. I don't know your paths and/or tools of choice, but some thing along these lines:
#!/bin/bash
FILENAME=`date +"/Volumes/path/to/network/share/Backup/%Y-%m-%d.tgz"`
cd /directory/to/backup || exit 1
tar -cvz "$FILENAME" .
You can save that on your Desktop as backup and then go in Terminal and type:
chmod +x ~/Desktop/backup
to make it executable. Then you can just double click on it - obviously after changing the paths to reflect what you want to backup and where to.
Also, you may prefer to use some other tools - such as rsync but the method is the same.

Xcode run script, is it possible to run only if a file changes?

I want to execute the script only when a certain file changes. Is this possible inside a run script phase? I donĀ“t see anything in the docs.
Thank you so much.
I would recommand reading http://indiestack.com/2014/12/speeding-up-custom-script-phases/ which is a great example of using this rarely known Build Phases little gem.
In Input Files of Run Script Phase, add the file to depend on. For example:
$(TARGET_BUILD_DIR)/$(PRODUCT_NAME).framework
In Output Files, add the file which the script will generate:
./SomeFile.txt
In script:
touch SomeFile.txt
Now the script will be called if SomeFile.txt is missing or is older than input file's date.

Creating an executable file to download a file, then upload the file to new location

I'm having trouble finding the correct method to accomplish a relatively simple task
I'm trying to make a simple executable that I can run/schedule to run.
That
1. Downloads a file from an intranet location (192.168.100.112/file.txt)
2. Uploads the new version file to web (fpt.website.com/docs/file.txt)
There are 5 pdf files that auto generate on an intranet and I would like to keep the web versions updated. Ideally create one executable that does all 5 files at once and have the ability to do each one individually.
thanks
Use the windows ftp command. Is has a -s option for providing ftp "scripts". Basically just add all the commands you need to accomplish your task to something.txt for example:
open 192.168.100.112
get file.txt
close
open fpt.website.com
cd docs
put file.txt
close
bye
then do:
ftp -s:something.txt
You could make ftp scripts, one for each upload. Then put all five commands in a batch file

Resources