Xamarin Android custom NOTICE file - xamarin

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.

Related

Replace text by focus on enable code by ifdef

Does it exist any way to replace only text that is enabled by C preprocessor macro like #if/#ifdef in Visual Studio?
If you're asking whether such a capability is built in, the answer is "no."
If you're asking whether it's possible to create a way to do it, then depending on how hard you're willing to work, the answer is "maybe." Obviously the editor knows what code is enabled by the preprocessor in a source file, because a scanner runs on it, using the current project settings to find out which preprocessor symbols are defined. That information is used by a colorizer to color the source file. The standard search and replace function, however, ignores that information (and anything else that's not the base text). If you want to badly enough, you can use the Visual Studio SDK to write an extension that implements your own search and replace function, and have it use the scanner output (or possibly, the collection of text adornments created by the colorizer) to guide which parts of the source file to do the search and replace in. That would be a lot of work, probably a lot more than any manual search and replace process. On the other hand, maybe you could sell the resulting extension in the VS Gallery.
The easiest way to do what you want is to do the search and replace with the existing tool, one search at a time (F3 is your friend here), and to make the change only if the text is the "enabled" color.

Create an application that generates a DLL

Currently, I have an MFC C++ visual studio project that is built to a DLL. Let's call it the FinalDLL.
I need this FinalDLL to be configurable. So, I want a GUI such that the users can generate the FinalDLL based on the information the enter via GUI. Please consider that I don't want to make the sources available at any points.
I do not have a clear idea how to integrate these steps. The solution I came up with was to have something like a button in my GUI, so that when it is clicked, the FinalDLL gets generated based on the information entered via GUI. Is it possible to do something like that? Probably I need another DLL library, as the information entered via GUI can be calls to functions that are used inside the FinalDLL source.
The solution to this would be very complex and complicated, mainly due to the fact that you don't want to disclose the source code of the DLL.
Basically you need to compile those source files every time you want to generate the DLL, and without the user having access to them.
Firstly, this is also required for the users that you want your DLL-generator app distributed to.
Secondly, you'll need to store those files somewhere in the app, and in an encrypted form, so that hackers won't just look at you app binaries and extract the source code for the DLL.
As a prerequisite on the user side, he will need to have a compatible Visual Studio installation, which will be used to compile on the fly the source code files.
What the DLL-generator application will need to do is to compile on the fly those source code files along with the customised ones via the form that the application will present.
So what you will need to do (the list might not be exhaustive due to the complex requirements):
Gather all compiler/linker commands that Visual Studio executes when building your project
Store all source code files into your application, in an encrypted form. Now if you want to allow your application to decode the files then you need to either store the encryption key within the application, and obfuscate it so its not that easy to find, or have the app communicate with your server and ask for the encryption key via https (this is a more secure approach, however neither this is 100% bullet-proof, insistent/trained hackers can still peek into the memory used by your app)
After the user fills all DLL generating details, the app will need to decrypt the source code files, updated the ones affected by the customised parameters, and start the build process by using the commands gathered at step #1. The compiler/linker should allow reading from stdin, so you'll use pipes to write the source code contents to the compiler/linker stdin, and to obtain the compiled/linked objects from stdout.
As I said, the solution is not pretty, and the main problem will be having the users install a Visual Studio that comes with a compiler compatible with the one from your machine, otherwise the commands you gathered at step #1 will not work.

Is there a way to link two comments together in an IDE?

Case: One source file has a comment in it that is directly linked to a comment in another source file (it says see line 315 in xxx.cs for more information). The problem with this approach is that the comment on line 315 may not be at that line number in the future. Is there a way to link comments together in an IDE? (currently using Visual Studio 2010, but use other IDEs from time to time)
You can try this addin (I haven't used this):
http://hyperaddin.codeplex.com/
Besides this addin, the only thing I can think of is using a file link to directly go to the linked file; something like:
// ...
// See file://path_to_file
//...
The link will be converted to an actual link that you can click using Ctrl+Left Click but it won't take you to a given line number - it just opens the file.
The path can be a relative file path or a full file path - full paths work best if all team members use the same folder structure in the project. For example:
// file://w:/projects/GUI/frmMain.cs
Referring to a particular source file and line number is never a good idea, because someone might move things around in the other file without being aware that something is pointing at it. It's better to point at the particular type/method, for example See DoThings() in the MyThing class..
In Java, using Javadoc, you can use #link to do this, for instance See {#link MyThing#doThings()}. Eclipse will automatically update these when using its refactoring tools (e.g. renaming the class or the method). If the change is done manually, Eclipse will still warn that the target of the #link is invalid. (There is also #see which is more appropriate in some situations.)
I'm not sure about C# and Visual Studio, but it's likely that its XML-based doc format offers similar functionality.
The only way to handle this is to put the comment in the same file. Duplicating a comment is not the same as duplicating code, although ideally the code wouldn't need too much explanation in comments.
There are many, many reasons why the comment being in another file will cause pain. As you have stated, the line number may change but also it could be deleted (as they won't know another comment references it), updated in a way that changes its meaning and it is annoying to have to open another file in any case.

What file extension to use for custom file type?

I have a program which creates certain save files during its use. Technically they are XML files, however I don't want to use the .xml extension as I will be modifying the shell so that my program opens when the files are double clicked in Explorer.
Is there any guidance on what file extensions I can effectively "invent"? I can't find any official guidelines anywhere.
I want to use .senx but I have no idea if this is safe to do so?
There is no "official" registry of file extensions (although there probably should be).
An Internet search will reveal several different sites that contain unofficial listings of the file extensions in common use by various applications, but if you go by that, there are hardly any file extensions still available to choose from.
The important thing is to figure out which applications your target audience is likely to have installed, and then make sure that your custom file extension doesn't conflict with any of those. (If you must do so, you also must provide the user with an option to revert your file extension associations, and preferably make it a configurable option during installation.)
Remember that there's no reason you should have to limit yourself to three or even four character file extensions. You can use as many as you need, which exponentially increases the likelihood that your choice will be unique. For example, Visual Studio persists its environment settings in a .vssettings file; it's very unlikely any other application will conflict with that any time soon.
In fact, this is Microsoft's official advice:
Do Not Use Short File Name Extensions
Long file name extensions offer the following advantages:
The limited length of short extensions make them prone to extension collisions. An extension collision occurs when the same extension is used to classify multiple file types. Using long extensions significantly decreases the chances of a collision.
Short file names tend to be somewhat cryptic. Long extensions tend to be more meaningful because additional information can be embedded in the extension.
For more information, see file name extensions.

How to customize generated Source Code Using Altova Mapforce Project

Background: When I generate the code for my mapping project, only one map will run, regardless of which file type I send in to the command.
I would like to modify the project code generation so that when the maps are generated the applicationConsole.cs allows multiple files and file types, and chooses the appropriate map based upon the parameters I send in.
so far, my project contains 4 maps, each one is different and has a parameter indicating whether or not to run the map. Once the code is generated, the applicationConsole.cs does not differentiate when running the maps. the first map listed in the applicationConsole.cs is run and the others are not. if the first map matches the given parameters, the output is correct, but if the next file coming in does not match, the console closes rather than moving on to the next map.
I am trying to avoid direct manipulation of the applicationConsole.cs, due to having to generate the code frequently.
the question: Does anyone know how to modify the output of Mapforce Project code generation to add a switch for map type based on file type?
In altova mapforce Application Install Directory,there is one SPL Directory. this is generate auto generate code as per your selected Language.
Take the backup of that Directory and modify SPL Directory code as per your requirement.
You need to learn SPL (Spy Programming Language) .
http://manual.altova.com/Mapforce/mapforce-enterprise/index.html?cgthewaytospl(spyprogrammingla.htm
If you need anything else then please inform me here. I have Good command on Customize the SPL.
Thank you
Take a look at refactoring under Java and C#
Really when you look at the stub code generated and you need to combine a couple maps the first refactoring task is to rename the namespace, Altova uses it's namespace as a default, so a mapa namespace would be helpful mapb namespace etc.
I'll provide the C# examples
http://msdn.microsoft.com/en-us/library/vstudio/6kxxabwd.aspx
Then you have the console app so you want to copy the applicationConsole.cs and rename it your project name or class name and then extract the method
http://msdn.microsoft.com/en-us/library/vstudio/0s21cwxk.aspx
Finally you would want to extract the interface so as to return the exception Constructor
http://msdn.microsoft.com/en-us/library/vstudio/fb3dyx26.aspx
and:
http://msdn.microsoft.com/en-us/library/tz6bzkbf.aspx
What you would have is a project with your start-up being the original applicationConsole.cs that you copied and renamed in a project or solution folder. When you update the map you should be able to over-write the code in that folder with what Mapforce generated.
This file was generated by MapForce 2013r2sp2.
YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
Refer to the MapForce Documentation for further details
This is what you will see in that file, use the technique outlined above and the tool is very easy to use. If you are a desktop programmer the refactoring might be new but it saves allot of time and effort down the road and makes the product complete.

Resources