Asked  7 Months ago    Answers:  5   Viewed   44 times

I often see examples in PHP that files. What is the meaning of .inc? What it is used for? What are the disadvantages and advantages of using it?



It has no meaning, it is just a file extension. It is some people's convention to name files with a .inc extension if that file is designed to be included by other PHP files, but it is only convention.

It does have a possible disadvantage which is that servers normally are not configured to parse .inc files as php, so if the file sits in your web root and your server is configured in the default way, a user could view your php source code in the .inc file by visiting the URL directly.

Its only possible advantage is that it is easy to identify which files are used as includes. Although simply giving them a .php extension and placing them in an includes folder has the same effect without the disadvantage mentioned above.

Wednesday, March 31, 2021
answered 7 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 7 Months ago

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
answered 5 Months ago

I could never get command line xcodebuild to ever work with automatic code signing. I assume because the automated build machine runs as a different account which is only accessed via SSH - It's never had "full" Xcode run as that user account and it doesn't have any certificates in it's Login keychain or anything like that.

I didn't want to use something like shenzhen because I've had nothing but bad experiences from those kinds of things in the past. The Xcode build system is complicated and fragile enough without having to add in more scripts and things that could go wrong or out of date.

Here's what I ended up doing to fix the problem (it's horrible, but it was the only thing I could find that made it work in the end)

  1. In the automated build script, edit the .pbxproj to search and replace Provisioning Style = Automatic; with Provisioning Style = Manual;. Also replace iOS Developer with iOS Distribution for the code signing stuff in the same pbxproj file. These two things turn off automatic signing

  2. Run xcodebuild to build (but not archive) the project in the same way I did in Xcode7 . Xcode compiles the app and signs it, but it's not valid yet, as it contains libswiftRemoteMirror.dylib and also for some reason hasn't got any entitlements file

  3. Delete libswiftRemoteMirror.dylib from the app bundle (this invalidates the signature)

  4. Generate an Entitlements.plist in the app bundle folder by extracting the entitlements bit from the provisioning profile (Like what BlackBerry's script does)

    1. Re-sign the app bundle using codesign --entitlements <file>

    2. From there, use a similar technique to what bq/ does and copy the SwiftSupport folder, then zip the file into an ipa.

I couldn't actually use file, I needed to re-implement similar logic instead because I need to reference Swift_2.3.toolchain to get the SwiftSupport from as my app is still swift 2.3 - not XcodeDefault.toolchain (which is swift 3)

It seems like I should be able to use xcodebuild --archive in combination with some other things to avoid some of these steps. I could never get that to work under Xcode7, but I might try again with XC8 if I have time

Tuesday, September 7, 2021
answered 2 Months ago

Many Android apps rely on instantiating objects that often require other dependencies. For instance, a Twitter API client may be built using a networking library such as Retrofit. To use this library, you might also need to add parsing libraries such as Gson. In addition, classes that implement authentication or caching may require accessing shared preferences or other common storage, requiring instantiating them first and creating an inherent dependency chain.

Dagger 2 analyzes these dependencies for you and generates code to help wire them together. While there are other Java dependency injection frameworks, many of them suffered limitations in relying on XML, required validating dependency issues at run-time, or incurred performance penalties during startup. Dagger 2 relies purely on using Java annotation processors and compile-time checks to analyze and verify dependencies. It is considered to be one of the most efficient dependency injection frameworks built to date.


Here is a list of other advantages of using Dagger 2:

  • Simplifies access to shared instances. Just as the ButterKnife library makes it easier to define references to Views, event handlers, and resources, Dagger 2 provides a simple way to obtain references to shared instances. For instance, once we declare in Dagger our singleton instances such as MyTwitterApiClient or SharedPreferences, we can declare fields with a simple @Inject annotation:

    public class MainActivity extends Activity {
       @Inject MyTwitterApiClient mTwitterApiClient;
       @Inject SharedPreferences sharedPreferences;
       public void onCreate(Bundle savedInstance) {
           // assign singleton instances to fields
  • Easy configuration of complex dependencies. There is an implicit order in which your objects are often created. Dagger 2 walks through the dependency graph and generates code that is both easy to understand and trace, while also saving you from writing a large amount of boilerplate code you would normally need to write by hand to obtain references and pass them to other objects as dependencies. It also helps simplify refactoring, since you can focus on what modules to build rather than focusing on the order in which they need to be created.

  • Easier unit and integration testing Because the dependency graph is created for us, we can easily swap out modules that make network responses and mock out this behavior.

  • Scoped instances Not only can you easily manage instances that can last the entire application lifecycle, you can also leverage Dagger 2 to define instances with shorter lifetimes (i.e. bound to a user session, activity lifecycle, etc.).

Thursday, October 7, 2021
answered 2 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :