Can you disable file header templating for specific projects? - xcode

Normally, as part of our development process, want every file to have a standard file header comment section. Here's the default one Xcode creates for reference:
//
// SomeFile.swift
// MyProject
//
// Created by Joe Coder (Joe#JoeCoder.com) on 1/1/18.
// Copyright © 2018 JoeCoder, Inc. All rights reserved.
//
For my 'Day Job', we've set a custom version that includes our legal copyright information and other specific details. However, to my knowledge, this is set at the install-level, not at the project level, meaning even if I'm just spinning up a quick project to test with, or a utility that I'm going to use, all of those details get inserted even though technically they aren't relevant.
Is it possible to configure headers at a project-level to override the one at the installation-level?
Same question for the user info since it has my corporate email which again doesn't always apply.

Related

How can I update the copyright information of files in Xcode?

I want to change all copyright information of my whole project. For this, I changed the template of the copyright, but this change does not affect my existing project files, only newly created files.
Do you know how can I update all copyright information in a whole project?
I changed the template of the copyright, but this change does not affect my existing project files, only newly created files.
Right. It's like when you bend your cookie cutter into a new shape: you don't expect the cookies you've cut out previously to assume the new shape. ;-)
The templates in Xcode don't retain any association with the files that are created from them: once a file is created, it's just a plain old text file, and the templated fields like your name and the copyright year are just plain text.
Do you know how can I update all copyright information in a whole project?
I assume that we're talking here specifically about the copyright notice in the header comment of each file, like:
//
// FirstViewController.swift
// TestThis
//
// Created by Marcel Gangwisch 11/19/17.
// Copyright © 2017 Marcel Gangwisch. All rights reserved.
//
And you want to update that copyright notice to say 2018, right? Find and replace should do the job here. If you use the Find Navigator in Xcode, you can easily search using patterns, and all the files that match the pattern will be listed in the navigator.
Just to be clear, remember that the copyright notice in your source code comments doesn't affect the final product at all. If you're updating the source code copyright, you'll likely also want to update any copyright notices in the product(s) you're building. That's a little less straightforward because where you display a copyright notice in your app is up to you. But you should still be able to find the relevant files by searching for the © symbol, and of course just looking at the UI in your app will probably help.
If your app is distributed through Apple's App Store, you may need to update the app description and other metadata there. Same goes for your own web site, and also Github or whatever code repository you use.
But I would also like to restore some copyright information - so with the date, when the file was created, which I dont have.. - so I thought xcode can do some magic here
The current Xcode template does include a separate line for creation date, and if your files have that, changing the copyright year shouldn't affect the creation date line. If you need to preserve the existing year, you can again use regular expressions, and this time insert the matched pattern. For example, if you want to add an "Original copyright xxxx" comment line, you could do this:
That adds a line break at the end of the first line, and then adds a second line that re-uses the captured year.

Xamarin Android custom NOTICE file

We are developing an application in Xamarin, using the ZXing.Net.Mobile library. This library states that it is based on ZXing. Both libraries are released under Apache v2.0, which states that:
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
ZXing.Net.Mobile does not have a NOTICE file, however ZXing itself does. This leads me to believe that ZXing.Net.Mobile is actually violating the apache license, as they themselves state that the library is based on ZXing.
This in turn would still make us responsible for putting their NOTICE file contents in our own NOTICE file if present. It turns out that Xamarin actually generates a NOTICE file, containing Xamarin related licensing.
So, the main question is: How can I either append text to the Xamarin generated NOTICE file, or replace it by my own? EmbeddedResource does not seem to work.

Is there a way to force all cs files to include a header comments?

We are using visual studio 2012. Ideally all csharp file (xxx.cs) should include a copy right comment in the header of the file like
#region Copyright GOOGLE 2013
//
// All rights are reserved. Reproduction or transmission in whole or in part, in
// any form or by any means, electronic, mechanical or otherwise, is prohibited
// without the prior written consent of the copyright owner.
//
#endregion
My question is, if there is a way to automatically include that comment when we create the file? Or alternatively can use code-analysis to prevent non-comments cs file being checked in.
You can customize the templates Visual Studio uses when you create new files
http://msdn.microsoft.com/en-us/library/ms247119.aspx
Your own custom templates could include the desired copyright notice.
Whether and how automated analysis at check-in can flag such files depends on the source code management system you are using. Many provide pre- and post-checkin hooks.

Joomla Template Editing

I'm using template at this url for my site. In page footer of my site, displays Joomla! is Free Software released under the GNU General Public License. phrase under the Copyright © 2012 MySite. All Rights Reserved. phrase . i need to remove Joomla! is Free Software released under the GNU General Public License. phrase. how can i do it ?
You need to edit your en-GB.mod_footer.ini file. Assuming you have Joomla installed in your site's root directory, the file is located at:
www.YOURSITE.com/language/en-GB/en-GB.mod_footer.ini
Among other things, you'll see some code that looks like this:
FOOTER=Footer
FOOTER_LINE1=Copyright © %date% %sitename%. All Rights Reserved.
FOOTER_LINE2=Joomla! is Free Software released under the GNU/GPL License.
MOD_FOOTER=<em>mod_footer</em>
THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This module shows the Joomla! copyright information.
Get rid of FOOTER_LINE2, then save the file and re-upload it to the /language/en-GB/ folder.
Good luck!
Cynthia
Starting with Joomla 1.5 and its move to Internationalization and full support of UTF-8, messages for footer.php and other Joomla pages has been moved to a language specific file.
If you want to change the text, go to the language directory, go to the folder of the language you want to change, find the mod_footer.ini file and change the relevant text. For British English, the specific file is language/en-GB/en-GB.mod_footer.ini. Remember that you may not remove copyright and license information from the source code.
If you want to remove the footer entirely, go to Extensions > Module Manager and unpublish the footer module.
Other places where can look for options to make changes are these. If you find code related to footers in these files, you can either "comment it out" or remove it:
/includes/footer.php file.
index.php file for your active template
Source: http://docs.joomla.org/Can_you_remove_the_%22Powered_by_Joomla!%22_message%3F
You can also edit the following for the Admin page, <InstallationFolder>/administrator/language/en-GB/en-GB.ini line 332:
JGLOBAL_ISFREESOFTWARE="%s is free software released under the GNU General Public License."

Managing the Free version of my app

My paid app has been published on the WP7 marketplace. Now I would like to create a free version of the app.
I figure I would have a constant IsFreeVersion = true; and then based on that disable some functionality.
What would be the best approach to setting up my project for this? I definitely do not want to have two versions of the code. So should I create a new project and link the files?
Also, how do I handle the different application icons? Finally, wouldn't I need a separate GUID for my application Id?
If you want to have a Free and Paid version of your app in the same project without using a 'Trial' version, this is how I do it:
Each project is assigned a single ProductID which distinguishes the app from other apps at install time. You could create a second project and link to all the files in the first project, but that would require maintenance as the project grows. My solution allows using the Build Configuration to select the free or paid app to build.
First you need a separate ProductID for each version of the app. This ProductID is declared in the manifest file 'Properties/WMAAppManifest.xml'. So the first step is to create two versions of WMAAppManifest.xml. I call them WMAAppManifestPaid.xml and WMAAppManifestFree.xml.
In each of these manifest files, provide a separate GUID for the ProductID and also change the Title of the free version so you can tell them apart when they are installed.
Next we need to add two new Build Configurations in the project. I call them ReleaseFree and DebugFree.
Next you add a few Pre-Build Events to all the build configuations to copy the appropriate manifest file:
if $(ConfigurationName)==Release copy $(ProjectDir)\Properties\WMAppManifestPaid.xml $(ProjectDir)\Properties\WMAppManifest.xml
if $(ConfigurationName)==Debug copy $(ProjectDir)\Properties\WMAppManifestPaid.xml $(ProjectDir)\Properties\WMAppManifest.xml
if $(ConfigurationName)==ReleaseFree copy $(ProjectDir)\Properties\WMAppManifestFree.xml $(ProjectDir)\Properties\WMAppManifest.xml
if $(ConfigurationName)==DebugFree copy $(ProjectDir)\Properties\WMAppManifestFree.xml $(ProjectDir)\Properties\WMAppManifest.xml
You should now be able to build either the free or paid versions of the app by simply changing the Build Configuration.
Next, to allow for actually making the free version different than the paid version, such as limiting features, showing different pages etc., you need to add a Conditional Compilation Symbol, such as FREE_VERSION to the two free build configurations.
then you can simply use compiler directives to change the code such as:
#if FREE_VERSION
s = "My App Free";
#else
s = "My App Paid";
#endif
If you want separate apps for the free and paid versions (Presumably you're limiting the functionality of the free app or adding ads) then I'd create a separate project and then link to the exisiting files of the other (use "add as link").
You can then customize the different versions as necessary. When doing things like this I like to use partial methods (and classes) to extend and customize the different versions.
You may also want to use app specific compiler directives to limit functionality to a specific version.
The Trial API is designed to handle such a situation. You can check if IsTrial is true, in which case you can limit functionality all in one code base. I assume you avoided this in order to ensure your app appears in the Free section of the Marketplace. In this case, you'll have to submit it as a new app, which means a new GUID.
AFAIK (maybe someone has another method), you'll have to create a new project and run a separate build. You can include your existing code base for the most part, but you'll end up with two versions if you don't include the Trial API. Since it's a new project, you can change the tile icons to whatever you want.
Jeff Brand has also prepared a very nice TrialManager library which allows you to implement different types of trial management.
Scenarios like:
Expires after N number of use
Expires after T minutes of use
...
http://www.slickthought.net/post/2010/08/30/Managing-Trial-Applications-for-Windows-Phone-7.aspx

Resources