Tips & Tricks

node global and local installations

 
Type of node installation
In npm 1.0, there are two ways to install things:

    1.    globally —- This drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. It also installs man pages in{prefix}/share/man, if they’re supplied.

npm install packagename -g

   2.    locally —- This installs your package in the current working directory. Node modules go in ./node_modules, executables go in./node_modules/.bin/, and man pages aren’t installed at all.

npm install packagename

WHICH TO CHOOSE
Whether to install a package globally or locally depends on the global config, which is aliased to the -g command line switch.
Just like how global variables are kind of gross, but also necessary in some cases, global packages are important, but best avoided if not needed.

In general, the rule of thumb is:
    1.    If you’re installing something that you want to use in your program, using require(‘whatever’), then install it locally, at the root of your project.
    2.    If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

Source: http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation

Getting Installed App details on Mac

To get detailed info of installed app on Mac we can use following command in mac terminal,

mdls /Applications/Xcode.app

it will return very useful info about any installed app like in above command if I want to see the BundleId of Xcode app,

kMDItemAlternateNames          = (
    “Xcode.app”
)
kMDItemAppStoreCategory        = “Developer Tools”
kMDItemAppStoreCategoryType    = “public.app-category.developer-tools”
kMDItemCFBundleIdentifier      = “com.apple.dt.Xcode”
kMDItemContentCreationDate     = 2013-08-13 23:34:45 +0000
kMDItemContentModificationDate = 2013-08-13 23:34:45 +0000
kMDItemContentType             = “com.apple.application-bundle”
kMDItemContentTypeTree         = (
    “com.apple.application-bundle”,
    “com.apple.application”,
    “public.executable”,
    “com.apple.localizable-name-bundle”,
    “com.apple.bundle”,
    “public.directory”,
    “public.item”,
    “com.apple.package”
)
kMDItemCopyright               = “Copyright © 1999–2013 Apple Inc. All rights reserved.”
kMDItemDateAdded               = 2014-04-04 19:25:48 +0000
kMDItemDisplayName             = “Xcode”
kMDItemExecutableArchitectures = (
    “x86_64”
)
kMDItemFSContentChangeDate     = 2013-08-13 23:34:45 +0000
kMDItemFSCreationDate          = 2013-08-13 23:34:45 +0000
kMDItemFSCreatorCode           = “”
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 1
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = “Xcode.app”
kMDItemFSNodeCount             = 1
kMDItemFSOwnerGroupID          = 80
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 4368446595
kMDItemFSTypeCode              = “”
kMDItemKind                    = “Application”
kMDItemLanguages               = (
    English
)
kMDItemLastUsedDate            = 2014-05-26 07:16:26 +0000
kMDItemLogicalSize             = 4368446595

Selenium WebDriver : getSize() Vs getLocation()

In Selenium WebDriver getSize() and getLocation() methods are different:

getSize() : will return the “Dimension” object, from which we can get Height and Width of specific element
Dimension vDimesions = vDriver.findElement(By.id(“id“)).getSize();
System.out.println(“Height :” + vDimesions.height + ”Width : “+ vDimesions.width);

getLocation() : will return the “Point” object, from which we can get X and Y coordinates of specific element
Point vPoint=driver.findElement(By.id(“id”)).getLocation();

System.out.println(“X : “+ vPoint.x + “Y : “+ vPoint.y);