EzDevInfo.com

package interview questions

Top package frequently asked interview questions

How to update bower.json with installed packages?

In my project I installed bower components without save options. now I would like update bower.json?

How can I Update bower.json with installed packages?


Source: (StackOverflow)

Java: Subpackage visibility?

I have two packages in my project: odp.proj and odp.proj.test. There are certain methods that I want to be visible only to the classes in these two packages. How can I do this?

EDIT: If there is no concept of a subpackage in Java, is there any way around this? I have certain methods that I want to be available only to testers and other members of that package. Should I just throw everything into the same package? Use extensive reflection?


Source: (StackOverflow)

Advertisements

How to view hierarchical package structure in Eclipse package explorer

OK here's what I would like: in the Eclipse package explorer, I see the following: (dot represents a clickable arrow that I can use to expand the folder)

  • PROJECT
    • Source Folder
      • Package
          Class
      • Package.SubPackage
          Foo
          Bar
      • Package.OtherSubPackage
      • Package.OtherSubPackage.VerySubPackage
      • OtherPackage
          Foobar
      • OtherPackage.SubPackage
          Baz

Long story short, I want to have many packages, each with many subpackages, in a source folder (and several source folders, so making more won't solve the problem)--so on the order of a couple hundred packages per source folder--ten to twenty packages each with fifteen subpackages. Therefore, I want the hierarchy to look like this:

  • PROJECT
    • Source Folder
      • Package
          Class
        • Package.SubPackage
            Foo
            Bar
        • Package.OtherSubPackage
          • Package.OtherSubPackage.VerySubPackage
      • OtherPackage
          Foobar
        • OtherPackage.SubPackage
            Baz

so I can open or close a package and see a list of subpackages instead of having package and subpackage all at the same level in the hierarchy--which again makes far too many packages simultaneously displayed. Note this is not a question about filesystem; the file system works fine as far as I can tell--it is only a question about the visual display in the Eclipse package explorer.

So: is there a way to add levels to the hierarchy? Thanks!! (Eclipse Helios on OS X 10.6)


Source: (StackOverflow)

Java packages com and org

What are the meaning of the packages org and com in java?


Source: (StackOverflow)

How to remove a package from Laravel using composer?

What is the right way to remove a package from Laravel 4? So long I've tried:

  1. Remove declaration from composer.json (in "require" section)
  2. Remove any Class Aliases from app.php
  3. Remove any references to the package from my code :-)
  4. Run composer update
  5. Run composer dump-autoload

Not working! Am I missing something?

Some packages publish their configuration via "artisan config:publish ...". Is there a way to "unpublish" them?


Source: (StackOverflow)

How to remove a package in sublime text 2

I would like to remove and/or desactivate the Emmet package in Sublime Text 2. Should I just remove the Emmet directory?


Source: (StackOverflow)

How to install a private NPM module without my own registry?

I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?

The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.

Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?

npm install --from-git git@server:project

Source: (StackOverflow)

Adding code to __init__.py

I'm taking a look at how the model system in django works and I noticed something that I don't understand.

I know that you create an empty __init__.py file to specify that the current directory is a package. And that you can set some variable in __init__.py so that import * works properly.

But django adds a bunch of from ... import ... statements and defines a bunch of classes in __init__.py. Why? Doesn't this just make things look messy? Is there a reason that requires this code in __init__.py?


Source: (StackOverflow)

Find the version of an installed npm package

How to find the version of an installed node.js/npm package?

This prints the version of npm itself:

npm -v <package-name>

This prints a cryptic error:

npm version <package-name>

This prints the package version on the registry (i.e. the latest version available):

npm view <package-name> version

How do I get the installed version?


Source: (StackOverflow)

Why do people use tarballs?

As a primarily Windows developer, perhaps I'm missing something cultural in the Linux community, but it has always confused me when downloading something that the files are first put into a .tar archive, then zipped. Why the two step process? Doesn't zipping achieve the file grouping? Is there some other benefit that I'm not aware of?


Source: (StackOverflow)

MSBuild target package not found

I want to package my VS2010 web application project ready for deployment with msdeploy. On development machine I can do this using:

MSBuild.exe "C:\path\to\WebApp.csproj" /target:package

But on my build server I get this error:

error MSB4057: The target "package" does not exist in the project.

What am I missing on the build server?


Source: (StackOverflow)

Rd file name conflict when extending a S4 method of some other package

Actual question

How do I avoid Rd file name conflicts when

  1. a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) depends on the package containing the generic) and
  2. using roxygenize() from package roxygen2 to generate the actual Rd files?

I'm not sure if this is a roxygen2 problem or a common problem when the generic and its method(s) are scattered across packages (which IMHO in general definitely is a realistic use-case scenario if you follow a modular programming style).

What's the recommended way to handle these situations?

Illustration

In package pkga

Suppose in package pkga you defined a generic method foo and that you've provided the respective roxygen code that roxygenize() picks up to generate the Rd file:

#' Test function
#' 
#' Test function.
#' 
#' @param ... Further arguments.
#' @author Janko Thyson \email{janko.thyson@@rappster.de}
#' @example inst/examples/foo.R
#' @docType methods
#' @rdname foo-methods
#' @export

setGeneric(
    name="foo",
    signature=c("x"),
    def=function(
         x,  
        ...
    ) {
    standardGeneric("xFoo")       
    }
)

When roxygenizing() your package, a file called foo-methods.Rd is created in the man subdirectory that serves as the reference Rd file for all methods that might be created for this generic method. So far so good. If all of the methods for this generic are also part of your package, everything's good. For example, this roxygen code would make sure that documentation is added to foo-methods.Rd for the ANY-method of foo:

#' @param x \code{ANY}.
#' @return \code{TRUE}.
#' @rdname foo-methods
#' @aliases foo,ANY-method
#' @export

setMethod(
    f="foo", 
    signature=signature(x="ANY"), 
    definition=cmpfun(function(
        x,
        ...
    ) {
    return(TRUE)
    }, options=list(suppressAll=TRUE))
)

However, if package pkga provides the generic for foo and you decide in some other package (say pkgb) to add a foo-method for x being of class character, then R CMD check will tell you that there is a name clash with respect to Rd file names and/or aliases (as there already exists a Rd file foo-methods.Rd in pkga):

In package pkgb

#' @param x \code{character}.
#' @return \code{character}.
#' @rdname foo-methods
#' @aliases foo,character-method
#' @export

setMethod(
    f="foo", 
    signature=signature(x="character"), 
    definition=cmpfun(function(
        x,
        ...
    ) {
    return(x)
    }, options=list(suppressAll=TRUE))
)

To be more precise, this is the error that's thrown/written to file 00install.out

Error : Q:/pkgb/man/foo-methods.Rd: Sections \title, and \name must exist and be unique in Rd files
ERROR: installing Rd objects failed for package 'pkgb'

Due dilligence

I tried to change the values for @rdname and @aliases to foo_pkgb* (instead of foo*), but \title and \name still are set to foo when roxygenizing and thus the error remains. Any ideas besides manually editing the Rd files generated by roxygenize()?


EDIT 2012-12-01

In light of starting the bounty, the actual question might get a slightly broader flavor:

How can we implement some sort of an "inter-package" check with respect to Rd files and/or how can we consolidate S4 method help files scattered across packages into one single Rd file in order to present a single source of reference to the end-user?


Source: (StackOverflow)

How to select a CRAN mirror in R

I'm trying to install a package through the R prompt by doing the following:

install.packages('RMySQL')

But the output is as follows:

--- Please select a CRAN mirror for use in this session ---

And nothing else! I can't find a solution to this very basic problem. What am I supposed to type in order to select a CRAN mirror?

EDIT:

OS: Mac-OS X 10.6.8 R Version: 2.15.0


Source: (StackOverflow)

What's the difference between a Python module and a Python package?

What's the difference between a Python module and a Python package?

See also: What's the difference between "package" and "module" (for other languages)


Source: (StackOverflow)

How do I install an R package from source?

A friend sent me along this great tutorial on webscraping NYtimes with R. I would really love to try it. However, the first step is to installed a package called RJSONIO from source.

I know R reasonably well, but I have no idea how to install a package from source.

I'm running Mac OSX.


Source: (StackOverflow)