Accessing Properties in JavaScript

Accessing Properties

A property of an object is some piece of named data it contains. These are accessed with dot
operator applied to an object alternative to the dot operator is the array [ ] operator.

Syntax: – object_name.property_name

Ex:-

Accessing Properties

Accessing Methods

Object members that are functions are called methods. These are accessed with dot operator applied
to an object alternative to the dot, the operator is the array [ ] operator.

Syntax: – object_name.Method_name( );

Ex:-

Adding Properties/Methods

Syntax:-
Object_name.Property_name = value;
Object_name[„Property_name‟] = value;

Deleting Properties

Delete operator is used to delete instance properties.

Syntax:- delete object_name.property_name
Ex: – delete fees.Rahul

After removal with delete operator, the property has the undefined value.

Tagged : / / / /

Environment variables and properties defined in jenkins | Jenkins Tutorial

Environment variables and properties defined in jenkins

Jenkins Set Environment Variables

When a Jenkins job executes, it sets some environment variables that you may use in your shell script, batch command, Ant script or Maven POM 1. The following table contains a list of all of these environment variables.

Environment Variable Description
BUILD_NUMBER The current build number, such as “153”
BUILD_ID The current build id, such as “2005-08-22_23-59-59” (YYYY-MM-DD_hh-mm-ss, defunct since version 1.597)
BUILD_URL The URL where the results of this build can be found (e.g. http://buildserver/jenkins/job/MyJobName/666/)
NODE_NAME The name of the node the current build is running on. Equals ‘master’ for master node.
JOB_NAME Name of the project of this build. This is the name you gave your job when you first set it up. It’s the third column of the Jenkins Dashboard main page.
BUILD_TAG String of jenkins-${JOB_NAME}-${BUILD_NUMBER}. Convenient to put into a resource file, a jar file, etc for easier identification.
JENKINS_URL Set to the URL of the Jenkins master that’s running the build. This value is used by Jenkins CLI for example
EXECUTOR_NUMBER The unique number that identifies the current executor (among executors of the same machine) that’s carrying out this build. This is the number you see in the “build executor status”, except that the number starts from 0, not 1.
JAVA_HOME If your job is configured to use a specific JDK, this variable is set to the JAVA_HOME of the specified JDK. When this variable is set, PATH is also updated to have $JAVA_HOME/bin.
WORKSPACE The absolute path of the workspace.
SVN_REVISION For Subversion-based projects, this variable contains the revision number of the module. If you have more than one module specified, this won’t be set.
CVS_BRANCH For CVS-based projects, this variable contains the branch of the module. If CVS is configured to check out the trunk, this environment variable will not be set.
GIT_COMMIT For Git-based projects, this variable contains the Git hash of the commit checked out for the build (like ce9a3c1404e8c91be604088670e93434c4253f03) (all the GIT_* variables require git plugin)
GIT_URL For Git-based projects, this variable contains the Git url (like git@github.com:user/repo.git or [https://github.com/user/repo.git])
GIT_BRANCH For Git-based projects, this variable contains the Git branch that was checked out for the build (normally origin/master)

Promoted Build Plugin Environment Variables

If you are using the Promoted Build Plugin, you will have access to the following environment variables. This allows you to access information about your Jenkins build since certain environment variables stated above (such as BUILD_TAG now refer to the Promoted Build Plugin’s job.

Environment Variable Replaces Description
PROMOTED_URL BUILD_URL The URL of the original Jenkins job that is involved with the promotion. BUILD_URL now refers to the Promotion’s URL
PROMOTED_JOB_NAME JOB_NAME The name of the original Jenkins job that is involved with the promotion. JOB_NAME now refers to the Promotion’s job’s name
PROMOTED_NUMBER BUILD_NUMBER The Build Number of the job being promoted. BUILD_NUMBER now refer’s the the Promotion Number
PROMOTED_ID BUILD_ID The Build ID (ex. “2005-08-22_23-59-59” (YYYY-MM-DD_hh-mm-ss) ) of the original Jenkins job. BUILD_ID now refer’s to the Promotion’s build ID.

System Properties

Name  ↓ Value   
awt.toolkit sun.awt.X11.XToolkit
com.sun.akuma.Daemon daemonized
executable-war /usr/lib/jenkins/jenkins.war
file.encoding UTF-8
file.encoding.pkg sun.io
file.separator /
java.awt.graphicsenv sun.awt.X11GraphicsEnvironment
java.awt.headless true
java.awt.printerjob sun.print.PSPrinterJob
java.class.path /usr/lib/jenkins/jenkins.war
java.class.version 52.0
java.endorsed.dirs /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/endorsed
java.ext.dirs /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
java.home /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre
java.io.tmpdir /tmp
java.library.path /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 1.8.0_111-b15
java.specification.name Java Platform API Specification
java.specification.vendor Oracle Corporation
java.specification.version 1.8
java.vendor Oracle Corporation
java.vendor.url http://java.oracle.com/
java.vendor.url.bug http://bugreport.sun.com/bugreport/
java.version 1.8.0_111
java.vm.info mixed mode
java.vm.name OpenJDK 64-Bit Server VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Oracle Corporation
java.vm.specification.version 1.8
java.vm.vendor Oracle Corporation
java.vm.version 25.111-b15
JENKINS_HOME /var/lib/jenkins
jna.loaded true
jna.platform.library.path /usr/lib64:/lib64:/usr/lib:/lib:/usr/lib64/mysql
jnidispatch.path /tmp/jna–1712433994/jna4147775405825940943.tmp
line.separator
mail.smtp.sendpartial true
mail.smtps.sendpartial true
os.arch amd64
os.name Linux
os.version 3.10.0-514.el7.x86_64
path.separator :
sun.arch.data.model 64
sun.boot.class.path /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/classes
sun.boot.library.path /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/lib/amd64
sun.cpu.endian little
sun.cpu.isalist
sun.font.fontmanager sun.awt.X11FontManager
sun.io.unicode.encoding UnicodeLittle
sun.java.command /usr/lib/jenkins/jenkins.war –logfile=/var/log/jenkins/jenkins.log –webroot=/var/cache/jenkins/war –daemon –httpPort=8080 –debug=5 –handlerCountMax=100 –handlerCountMaxIdle=20
sun.java.launcher SUN_STANDARD
sun.jnu.encoding UTF-8
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.os.patch.level unknown
svnkit.http.methods Digest,Basic,NTLM,Negotiate
svnkit.ssh2.persistent false
user.country US
user.dir /
user.home /var/lib/jenkins
user.language en
user.name jenkins
user.timezone America/New_York

Environment Variables

Name  ↓ Value   
_ /etc/alternatives/java
HOME /var/lib/jenkins
LANG en_US.UTF-8
LOGNAME jenkins
NLSPATH /usr/dt/lib/nls/msg/%L/%N.cat
PATH /sbin:/usr/sbin:/bin:/usr/bin
PWD /
SHELL /bin/bash
SHLVL 2
USER jenkins
XFILESEARCHPATH /usr/dt/app-defaults/%L/Dt

Plugins

Name  ↓ Version    Enabled    Pinned   
ace-editor 1.1 true false
ant 1.4 true false
antisamy-markup-formatter 1.5 true false
bouncycastle-api 2.16.0 true false
branch-api 1.11.1 true false
build-timeout 1.18 true false
cloudbees-folder 5.16 true false
credentials 2.1.10 true false
credentials-binding 1.10 true false
display-url-api 0.5 true false
durable-task 1.12 true false
email-ext 2.53 true false
external-monitor-job 1.7 true false
git 3.0.1 true false
git-client 2.2.0 true false
git-server 1.7 true false
github 1.25.1 true false
github-api 1.84 true false
github-branch-source 1.10.1 true false
github-organization-folder 1.5 true false
gradle 1.25 true false
handlebars 1.1.1 true false
icon-shim 2.0.3 true false
jacoco 2.1.0 true false
javadoc 1.4 true false
jira 2.3 true false
jobConfigHistory 2.15 true false
jquery 1.11.2-0 true false
jquery-detached 1.2.1 true false
junit 1.19 true false
ldap 1.13 true false
mailer 1.18 true false
mapdb-api 1.0.9.0 true false
matrix-auth 1.4 true false
matrix-project 1.8 true false
maven-plugin 2.14 true false
momentjs 1.1.1 true false
pam-auth 1.3 true false
pipeline-build-step 2.4 true false
pipeline-graph-analysis 1.3 true false
pipeline-input-step 2.5 true false
pipeline-milestone-step 1.3 true false
pipeline-rest-api 2.4 true false
pipeline-stage-step 2.2 true false
pipeline-stage-view 2.4 true false
plain-credentials 1.3 true false
resource-disposer 0.3 true false
scm-api 1.3 true false
script-security 1.25 true false
sonar 2.5 true false
ssh-credentials 1.12 true false
ssh-slaves 1.12 true false
structs 1.5 true false
subversion 2.7.1 true false
thinBackup 1.9 true false
timestamper 1.8.7 true false
token-macro 2.0 true false
windows-slaves 1.2 true false
workflow-aggregator 2.4 true false
workflow-api 2.8 true false
workflow-basic-steps 2.3 true false
workflow-cps 2.23 true false
workflow-cps-global-lib 2.5 true false
workflow-durable-task-step 2.7 true false
workflow-job 2.9 true false
workflow-multibranch 2.9.2 true false
workflow-scm-step 2.3 true false
workflow-step-api 2.7 true false
workflow-support 2.12 true false
ws-cleanup 0.32 true false

Useful Plugins

https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Reference

https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project
http://jenkins:8080/systemInfo

Tagged : / / / / / / /

Introduction to MSBuild – Quick Intro Guide

msbuild-introduction

Introduction to MSBuild

  • Microsoft supported build engine
  • XML-based configuration file
  • Intellisense available from Visual Studio using supplied schema
  • Ships with .NET Framework 2.0, it is NOT part of Team Foundation Server
  • Both Visual Studio and Team Foundation Server leverage MSBuild
  • Command-line utility – MSBuild.exe

MSBuild Concepts

  1. Project
  2. Property
  3. Item
  4. Target
  5. Task

Projects

–        The root concept in MSBuild

–        Defines the build process

Example:


    Build

Properties

–        Name/value pairs

Items

–        Set of objects (commonly files)

–        Can specify meta-data to be applied to the objects

Example:






Targets

–        Defines a number of sequential tasks

–        Projects can have initial and/or default targets

Example:





Tasks

–        Performs an operation

–        Uses properties and items

–        Extensible

Exmaple:


    <MakeDir
        Directories="$(BuildDir)" />

Some Reference Link:

http://msdn.microsoft.com/en-us/library/ms171452%28VS.90%29.aspx

http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx

http://www.codeproject.com/KB/aspnet/Automate_Builds.aspx

http://www.codeproject.com/KB/aspnet/Automate_Builds.aspx

http://en.wikipedia.org/wiki/MSBuild

Tagged : / / / / / / /

Properties in Maven – List of Maven Properties

properties-in-maven

Intro
It is a collection of things found in the offcial maven documentation and postings to the maven user mailing list.
Build in properties

  • ${basedir} represents the directory containing pom.xml
  • ${version} equivalent to ${project.version} or ${pom.version}

Pom/Project properties
All elements in the pom.xml, can be referenced with the project. prefix or using pom. as prefix. This list is just an example of some commonly used elements.

  • ${project.build.directory} results in the path to your “target” dir, this is the same as ${pom.project.build.directory}
  • ${project.build.outputDirectory} results in the path to your “target/classes” dir
  • ${project.name} or ${pom.name} refers to the name of the project.
  • ${project.version} or ${pom.version} refers to the version of the project.
  • ${project.build.finalName} refers to the final name of the file created when the built project is packaged

Local user settings
Similarly, values in the user’s settings.xml can be referenced using property names with settings. prefix.

  • ${settings.localRepository} refers to the path of the user’s local repository.
  • ${maven.repo.local} also works for backward compatibility with maven1 ??

Environment variables
Environment variables can be referenced using the env prefix

  • ${env.M2_HOME} returns the Maven2 installation path.
  • ${java.home} specifies the path to the current JRE_HOME environment use with relative paths to get for example:
    ${java.home}../bin/java.exe

Java system properties
All Java System Properties defined by the JVM.
Custom properties in the POM
User defined properties in the pom.xml.

hello

  • ${my.filter.value} will result in hello if you inserted the above XML fragment in your pom.xml

Parent Project variables
How can parent project variables be accessed?
You can use the prefix: ${project.parent}.
A good way to determine possible variables is to have a look directly at the API. I’m currently using Maven 2.2.1, and to access the Parent you can use ${project.parent}. This will return an org.apache.maven.project.MavenProject instance.
To access the parent version: ${parent.version}.
Reflection Properties
The pattern ${someX.someY.someZ} can simply sometimes mean getSomeX().getSomeY().getSomeZ(). Thus, properties such as ${project.build.directory} is translated to getProject().getBuild().getDirectory().
List of Maven Properties

project (from [1])
o project.distributionManagementArtifactRepository
o project.artifact
o project.parent
o project.file
o project.artifacts
o project.parentArtifact
o project.pluginArtifacts
o project.remoteArtifactRepositories
o project.pluginArtifactRepositories
o project.attachedArtifact
* settings (from [2])
o settings.offilne
o settings.interactive
* rootless (from [3])
o localRepository
o reactorProjects
* java properties (from [4])
o java.version
o java.vendor
o java.vendor.url
o java.home
o java.vm.specification.version
o java.vm.specification.vendor
o java.vm.specification.name
o java.vm.version
o java.vm.vendor
o java.vm.name
o java.specification.version
o java.specification.vendor
o java.specification.name
o java.class.version
o java.class.path
o java.library.path
o java.io.tmpdir
o java.compiler
o java.ext.dirs
o os.name
o os.arch
o os.version
o file.separator
o path.separator
o line.separator
o user.name
o user.home
o user.dir

 

Tagged : / / / / / / / / / / / / /

How to access all Java system properties directly?

java-system-properties

You could access all Java system properties directly via ${name}, e.g.

${user.name}, ${user.dir}, ${user.home}, …

You could read environment properties and use them

  <properties environment=”env”/>

  ${env.ENVIRONMENT_VARIABLE}

e.g.

  ${env.USERPROFILE}, ${env.USERNAME}, ${env.PATH}

You could pass properties during Ants start

  ant -Dname=value -Danothername=anothervalue

Also you Ant could ask for input

  <input addproperty=”foo”/>

  ${foo}

Tagged : / / / / / / / / / / / / / / / / /

SET UNIX HOME DIR PROPERTY using ANT

set-unix-home-dir-property-using-ant

Set properties HOMEDIR in build.xml which will be set through user logged in the current system..

Example:

<project name=”test” default=”myhome”>

    <property environment=”env”/>

    <target name=”myhome”>

        <echo message=”My home is ${env.HOME}”/>

    </target>

</project>

Tagged : / / / / / / / / / / / /

Ant’s built-in properties – Ant Properties Guide

ants-built-in-properties

This is a simple example that illustrates how to find the basedir name, file name, project name, ant version, java version, operating system name, ant home directory name, java home directory name, user home directory name and user name. Ant provides you with certain built-in properties that you may find useful during your build process. The following table shows the property name and it’s description.

 

Ant’s built-in properties:

Property                                                              Description

 

ant.file                                                                  The absolute path of the build file

 

ant.project.name                                            The name of the project as set in the <project> element’s name attribute.

 

ant.home                                                            The root directory of ant

 

ant.version                                                         The version of this ant installation. This is not just the version number and includes information such as the compilation date.

 

ant.java.version                                               The version of the java that ant uses

 

basedir                                                                 The absolute path of the project

 

os.name                                                              Operating system name

 

java.home                                                          Java home directory name

 

user.home                                                          User directory name

 

user.name                                                          User name                         

 

 

Example Program:

<?xml version=”1.0″?>

 

<project name=”AntProperties” default=”echo” basedir=”.”>

 

  <target name=”echo”>

  <echo message=”The operating system is: ${os.name}”/> 

 

  <!– absolute path of the project. –>

  <echo message=”The home path is: ${basedir}”/>

 

  <!– absolute path of the build file. –>

  <echo message=”The file name is: ${ant.file}”/>

 

  <!– root directory of ant. –>

  <echo message=”The Project name is: ${ant.project.name}”/>

  <echo message=”The Ant home directory is: ${ant.home}”/>

  <echo message=”The Ant version is: ${ant.version}”/>

  <echo message=”The Java version is: ${ant.java.version}”/>

 

  <!– System properties. –>

  <echo message=”The Java home directory is: ${java.home}”/>

  <echo message=”The User home directory is: ${user.home}”/>

  <echo message=”The User name is: ${user.name}”/>

  </target>

 

</project>

 

Tagged : / / / / / / / / / / / / /

Command Line to find a Change list properties in perforce server

command-line-to-find-a-change-list-properties-in-perforce-server

Command Line to find a Change list properties and associated path of the file in perforce server view:

Examples of the command you want:
p4 describe 1231928
p4 describe -s 1231928
p4 files @=1231928

Where 1231928 is the change list number.

Tagged : / / / / / / / / / / / / /