Does all apps have their code inside "com" folder? - reverse-engineering

I have a very basic question with respect to app development. I have no experience in app development, but, I need to reverse engineer android apps. When I reverse engineer (decompile using apktool or androguard) apps, I am seeing that every app has a package (folder structure) that begins with "com". Does every app have this com folder (I guess eclipse creates this folder, inside which the developers code). Is this assumption valid for all apps?

No its not necessary to have com folder.
The com folder is because of package name.
If you take any package, lets say - com.sudosaints.android
So in this case src code directory structure will be - src -> com -> sudosaints -> android.
In case of in.sudosaints.android, directory structure will be - src->in->sudosaints->android
So assumption of com folder is not valid for all apps.

No, it's not. You can choose what to use as namespace. Many developers uses "com" for commercial applications and "org" for free ones but it's entirely up to you.

I am not 100% sure whether or not this can be overridden, but it is based on the package name of the application. The recommended way, which as far as I have seen, all developers do follow create a package called com.yourcompany.yourappname.
In this example the source code would be found in:
com.yourcompany.yourappname/src.
Hope this helps.

General convention for naming packages is based on domain owned by author of the program.
For example, if your company has webpage
www.mycompany.com
their programs will generaly have package structure starting with
com.mycompany.nameofproject
So thats why most packages start with com, because most companies have webpage ending with .com.

Related

PhpStorm: multiple projects with common core

Due to security reasons, I have to split one project to divisions (client, admin, ...), and deploy them to different web servers. These divisions have one common script base, but each division has its own functions. As an IDE I use PhpStorm.
The question: what is the best way to organize project's structure and settings, so the common core part will be visible for IDE indexing in all project's divisions, but at the same time, being maintained from a single project (perhaps, standalone)?
In Java you can do lib jar files for further linking in various projects.
But how it can be done in PHP?
There are multiple ways of how to reference extra PHP code in a project.
If you plan to actively edit such extra code in the same project (and want to see their TODOs, code inspection warnings, include references in code refactoring etc):
You can just add it as an additional Content Root: Settings/Preferences | Directories. Folder added this way will be treated as a part of the project itself and will be shown as a separate node in the Project View panel (just as the main code, which is a Content Root as well).
Or you can open 2nd project while 1st one is already opened and when asked, just chose "Attach":
It's not going to be full 2 projects in one frame, more like something in between attaching Content Root and having 2 projects opened in separate frames.
https://www.jetbrains.com/help/phpstorm/opening-multiple-projects.html
Simple symlink will also do the job (but you need to place it somewhere in a project, e.g. PROJECT_ROOT/libs/my_symlinked_code). You then will need to provide a path mapping for that folder for debugger (if you will debug it of course) as PHP/Xdebug works with "final/resolved path" while IDE works with the path as is.
If you do not need to actively edit that extra code in the same window (and ignore any TODOs, code inspection warnings and other inspection results etc):
Do it as a composer package then? Composer can use custom sources (e.g. GitHub repo or a folder on a local filesystem).
Just add the path to that folder as a "Include Path" at Settings/Preferences | Languages & Frameworks | PHP --> Include Path tab. Code referenced this way is meant for 3rd party libraries (the code that you just use but not edit, e.g. framework code, your send mail/ORM library etc). Composer packages will also be included here by default.
https://www.jetbrains.com/help/phpstorm/php.html#include-path-tab

Windows Phone 8 , how to share code,xmal,asset between multiple projects

Now I have AppA finished. but I want to make AppB,AppC. and AppB,AppC share most of the code in AppA(including xaml, asset, code,etc.). only a few changes for the AppB,AppC respectively.I mean, the 3 apps can be installed on the same windows phone separately with different icons.
Does anybody know how to build AppB,AppC referring AppA in code?
thanks.
Either extract as much as you can in a shared/common project or use "Add as Link" to include files from AppA into AppB and AppC.
Note that XAML files don't support conditional compilation so they must be identical for all projects in order to link them. You can potentially extract XAML differences into App.xaml StaticResources (identical keys) in order to make them identical and link them.
Sharing XAML is very reasonable when targeting the same platform.
You can also link cs files even if they are similar (few changes) by using conditional compilation.
Partial classes can also spare you the conditional compilation ceremony in many cases.
Finally Resource files are very good candidate for reuse. If you decide to put them on a shared library remember to wrap the generated Resource class in another public one with a public constructor shown here in order to avoid the internal constructor issue.
You can put all your code in an external class library. As far as I know though your assets and pages need to exist in each project.
If you want to share code and assets between multiple assemblies, you can create a class library for Windows Phone and put all the code inside it. When you need to use that library, simply link it in your target applications.
When you want to navigate to a page in your library, use the following syntax:
NavigationService.Navigate(new Uri("/AssemblyName;component/page.xaml", UriKind.Relative));

NVP TransactionProcessorWse could not found

I am using a cybersource web service (http://www.cybersource.com/developers/).I am using simple order api.I have installed that software and wse 3.0.But in their sample project, i am getting error like (The type or namespace name 'TransactionProcessorWse' could not be found)
Please help me, i have been trying to find a solution since yesterday.
You need to download the Clients Solution from here:
http://www.cybersource.com/developers/develop/integration_methods/simple_order_and_soap_toolkit_api/dot_net_2_0/
the zip file is called simapi-net-2.0-5.0.2.msi Once you download, unzip, and run the installer. The files should be located under Program Files (x68)/CyberSourceCorporation/simapi-net-2.0-5.0.2 folder.
Go then to the "lib" folder where you will find the CyberSource.Clients.dll, as well as all the other dll's needed, and import them into your solution.
CyberSource.Clients.dll has the TransactionProcessorWse client.
Good luck

Deploy support files from secondary assembly

I'm, porting a phone application written using MVVMCross to Windows RT. The application uses SQLite and has a database that is not empty at deploy so I want it to be packaged in the installation folder anc copied to LacalFolder when the application starts.
The database really belongs to the "Core" assembly shared between phone and WinRT but if I put the file in the Core project (in a custom directory called Data), define it as Content and set the Copy Always flag the file does not get copied to the application installation folder.
If I put the file in a directory under the UI project the file gets copied as expected. Any suggestion to avoid keeping two files for the same resource (and the troubles this will cause) ?
Thanks for help
Windows 8 WinRT projects by default use the Content type which does loose packing of files (they are not included in the assembly). If your Core assembly is part of your solution as a project - VS will properly package it copying all the content to the "Core" subfolder of the appx. If you simply have the dll file referenced in your solution - the resource files will not be packaged. The solution in that case is to do something to get these additional files to deploy with the dll. One option is to package the dll as a .vsix together with the assets as described in Tim Heuer's blog post. Another is to do what you did and put the file in the app project. You can add the file to the app project "As Link" to avoid having a copy of the file - it makes Visual Studio create a sort of logical/symbolic link to the file instead of creating a copy - simply right click a folder in the Solution Explorer/app project, select "Add/Existing Item", browse to the file and instead of hitting the "Add" button - use the dropdown triangle on the button to select "Add As Link".

how access actionscript file in a different project?

I have two ActionScript projects in Flash Builder 4.5. The second project needs to use some of the actionscript files in the first project. Is there a way to do this without duplicating those files in the second folder? Is library project the answer? Any details appreciated.
I use Library projects for this type of sharing. It works well.
Create a new library project
File -> New -> Flex Lilbrary Project
Any files that you want to be shared can go into that project. I tend to organize it by folder, depending on what the classes do. (example: Views, Models, DTOs, Utilities, etc).
The output will be a SWC file in the bin folder.
Manually referencing the library project
If you aren't actively developing the library project, you can build it and drop it into the libs folder and use the classes like you normally would.
If you are like me and you are constantly working on the library projects, then I like to set it up so that the projects actually reference each other in a way that changes to the library project don't require a manual step.
Automatically referencing the library project
In the project that wants to reference the library project, do the following:
Go to Project Properties -> Flex Build Path -> Add SWC Folder
Add /LibraryProjectName/bin
Go to Project Properties -> Project References
Select the library project
That's it
Once you set it up this way, you can share files via the library project. I do this all the time. Reasons you might want to do this:
Library Project: MyProject.Behavior
Web Project: MyProject.Web
Mobile Project: MyProject.Mobile
Desktop Project: MyProject.Desktop
Administrator Desktop Project: MyProject.Administrator
Testing: MyProject.Specs
As you can see, I can have several projects that all use the same behavior (models, views, etc).
you can make a library project, and add this output library file into library of used project, and add this library used project by adding library in Eclipse.
Making library project sample:
http://cookbooks.adobe.com/post_Creating_a_Flex_Library_Project_in_Flash_Builder-17629.html
Or
you can share reference of the library project by adding reference project in Eclipse, it works fine to me.
HTH.