text:
{{{
  "title": "Getting Started with MongoDB - Blueprint",
  "date": "3-17-2015",
  "author": "Keith Resar",
  "attachments": [],
  "contentIsHTML": false
}}}

### Overview

After reading this article, the reader should feel comfortable deploying the MongoDB database on CenturyLink Cloud.

### Partner Profile

MongoDB – "simple and elegant with the freedom to scale"

http://www.mongodb.org/

#####Customer Support

* [MongoDB Community Support ](http://www.mongodb.org/get-involved)

### Description

MongoDB database technology has been integrated for automated deployment on the CenturyLink Cloud platform.  The purpose of this KB article is to help the reader take advantage of this integration to achieve rapid time-to-value for this solution.

MongoDB is a cross-platform NoSQL document-oriented database. Its structure is JSON-like, making integration of data in certain types of applications easier and faster.

### Audience

CenturyLink Cloud Users

### Deploying on a new server

#### Steps

1. **Locate the Blueprint in the Blueprint Library**

  Determine whether you will be building a test cluster with small nodes or a production cluster whose nodes are configured with increased CPU and RAM.

  Starting from the CenturyLink Control Panel, navigate to the Blueprints Library. Search for "MongoDB" in the keyword search on the right side of the page.

2. **Click the Deploy Blueprint button.**

3. **Set Required parameters.**

  * **Database Admin Username** - Username created in new MongoDB instance
  * **Database Admin Password** - Password created in new MongoDB instance

4. **Set Optional Parameters**

  Password/Confirm Password (This is the root password for the server. Keep this in a secure place).

  Set DNS to "Manually Specify" and use "8.8.8.8" (or any other public DNS server of your choice).

  Optionally set the server name prefix.

  The default values are fine for every other option.

5. **Review and Confirm the Blueprint**

6. **Deploy the Blueprint**

  Once verified, click on the `deploy blueprint` button. You will see the deployment details stating the Blueprint is queued for execution.

  This will kick off the Blueprint deploy process and load a page where you can track the deployment progress. Deployment will typically complete within ten minutes.

7. **Deployment Complete**

  Once the Blueprint has finished execution you will receive an email confirming the newly deployed assets.  If you do not receive an email like the one shown below your cluster may have had a deployment error - review the *Blueprint Build Log* to for error messages.

### Pricing

The costs listed above in Steps 1 and 2 are for the infrastructure only.

MongoDB is Open Source community owned software with no associated cost to acquire.

### Frequently Asked Questions

**Where do I get my License?**

MongoDB is Open Source community owned software with no associated cost to acquire.

**Who should I contact for support?**

MongoDB is packaged and provided by CenturyLink as a courtesy to ease startup time. All support for this Open Source software is provided by the community. Please start at http://www.mongodb.org/

For issues related to cloud infrastructure, please open a ticket using the [CenturyLink Cloud Support Process](../../Support/how-do-i-report-a-support-issue.md).

**Creating a User for your Application**

The database server is created with the admin user as the only user.  From there you will need to create a user for your Application.  You can do that by executing the following from your server:

```
[root@SERVER ~]# mongo <IP_ADDRESS>:27017/admin -u <USER_YOU_CREATED> -p <PASSWORD_OF_ADMIN_USER>
MongoDB shell version: 2.6.7
connecting to: <IP_ADDRESS>:27017/admin

> use testdb
switched to db testdb
> db.createUser(
... {
...   user: "report",
...   pwd: "<PASSWORD>",
...   roles: [
...     { role: "readWrite", db: "testdb" }
...     ]
... }
... )
Successfully added user: {
                "user" : "report",
                "roles" : [
                                {
                                                "role" : "readWrite",
                                                "db" : "testdb"
                                }
                ]
}
> exit
Bye

[root@SERVER ~]# mongo <SERVER_IP_ADDRESS>/testdb -u report -p <PASSWORD>
MongoDB shell version: 2.6.8
connecting to: <SERVER_IP_ADDRESS>:27017/testdb
> person = { name : "Joe" }
{ "name" : "Joe" }
> db.testdb.insert(person)
WriteResult({ "nInserted" : 1 })
> show collections
system.indexes
testdb
```

**What operating systems are supported for Unmanaged MongoDB?**

Unmanaged Red Hat 7


text:
ios
===

ios source code

redpajama_set_name: RedPajamaGithub


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.kurento</groupId>
		<artifactId>kurento-room</artifactId>
		<version>6.5.1-SNAPSHOT</version>
	</parent>

	<artifactId>kurento-room-client</artifactId>
	<packaging>jar</packaging>

	<name>Kurento Room Client</name>
	<description>
        Kurento Room library for the client-side of Kurento Room Server
    </description>
	<url>http://www.kurento.org/docs/${project.version}</url>

	<licenses>
		<license>
			<name>Apache 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<organization>
		<name>Kurento</name>
		<url>http://www.kurento.org</url>
	</organization>

	<scm>
		<url>${kurento-room.scm.url}</url>
		<connection>scm:git:${kurento-room.scm.connection}</connection>
		<developerConnection>scm:git:${kurento-room.scm.connection}</developerConnection>
		<tag>develop</tag>
	</scm>

	<developers>
		<developer>
			<id>kurento.org</id>
			<name>-kurento.org Community</name>
			<organization>Kurento.org</organization>
			<organizationUrl>http://www.kurento.org</organizationUrl>
		</developer>
	</developers>

	<dependencies>
		<dependency>
			<groupId>org.kurento</groupId>
			<artifactId>kurento-jsonrpc-client</artifactId>
		</dependency>
		<dependency>
			<groupId>org.kurento</groupId>
			<artifactId>kurento-room-sdk</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>default</id>
			<activation>
				<property>
					<name>default</name>
					<value>true</value>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<skipTests>true</skipTests>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<configuration>
							<skipTests>true</skipTests>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>


text:
module Dotnet.System.Xml.XmlWhitespace where

import Dotnet
import qualified Dotnet.System.Xml.XmlCharacterData
import Dotnet.System.Xml.XmlWriter
import Dotnet.System.Xml.XmlNodeTy
import Dotnet.System.Xml.XmlNodeType

data XmlWhitespace_ a
type XmlWhitespace a = Dotnet.System.Xml.XmlCharacterData.XmlCharacterData (XmlWhitespace_ a)

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.WriteContentTo"
  writeContentTo :: Dotnet.System.Xml.XmlWriter.XmlWriter a0 -> XmlWhitespace obj -> IO (())

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.WriteTo"
  writeTo :: Dotnet.System.Xml.XmlWriter.XmlWriter a0 -> XmlWhitespace obj -> IO (())

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.get_LocalName"
  get_LocalName :: XmlWhitespace obj -> IO (String)

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.CloneNode"
  cloneNode :: Bool -> XmlWhitespace obj -> IO (Dotnet.System.Xml.XmlNodeTy.XmlNode a1)

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.get_NodeType"
  get_NodeType :: XmlWhitespace obj -> IO (Dotnet.System.Xml.XmlNodeType.XmlNodeType a0)

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.set_Value"
  set_Value :: String -> XmlWhitespace obj -> IO (())

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.get_Value"
  get_Value :: XmlWhitespace obj -> IO (String)

foreign import dotnet
  "method Dotnet.System.Xml.XmlWhitespace.get_Name"
  get_Name :: XmlWhitespace obj -> IO (String)


text:
package com.github.maven_nar.cpptasks;
import java.io.File;
import java.io.IOException;
/**
 * The history of a source file used to build a target
 *
 * @author Curt Arnold
 */
public final class SourceHistory {
    private/* final */long lastModified;
    private/* final */String relativePath;
    /**
     * Constructor
     */
    public SourceHistory(String relativePath, long lastModified) {
        if (relativePath == null) {
            throw new NullPointerException("relativePath");
        }
        this.relativePath = relativePath;
        this.lastModified = lastModified;
    }
    public String getAbsolutePath(File baseDir) {
        try {
            return new File(baseDir, relativePath).getCanonicalPath();
        } catch (IOException ex) {
        }
        return relativePath;
    }
    public long getLastModified() {
        return lastModified;
    }
    public String getRelativePath() {
        return relativePath;
    }
}


text:
#ifndef ALKES_TREE3D_OBJECT3D_H_INCLUDED_
#define ALKES_TREE3D_OBJECT3D_H_INCLUDED_

#include "alkes/tree3d/internal.h"
#include "alkes/tree3d/VertexResource.h"
#include "alkes/tree/TextureResource.h"
#include "alkes/tree/Visual.h"
#include "alkes/gfx/IRenderTarget3D.h"

namespace alkes {

/// \addtogroup scenegraph
//@{

class AL_TREE3D_EXPORT Object3D
    : public Visual
{
    AL_DECLARE_ELEMENT(Object3D, Visual);

public:
    Object3D();
    virtual ~Object3D();

    void setTexture(TextureResource* texture);
    void setVertex(VertexResource* vertex);

    void setPrimitiveType(PrimitiveType type);
    PrimitiveType getPrimitiveType() const;

    void setVertexCount(uint32_t count);
    uint32_t getVertexCount() const;

protected:
    virtual void onRender(GraphicsContext& gc);

private:
    resource_ptr<TextureResource> texture_;
    resource_ptr<VertexResource> vertex_;
    Image image_;
    PrimitiveType type_;
    uint32_t count_;
};

//@}

}

#endif


text:
<?php
namespace phpdotnet\phd;
/* $Id$ */

abstract class Format_Abstract_XHTML extends Format {
    public $role = false;

    /* XHTMLPhDFormat */
    protected $openPara = 0;
    protected $escapedPara = array();

    /* PhDThemeXhtml */
    protected $mediamanager = null;
    protected $lang = 'en';

    public function __construct() {
        parent::__construct();
    }

    public function transformFromMap($open, $tag, $name, $attrs, $props) {
        if ($open) {
            $idstr = "";
            if (isset($attrs[Reader::XMLNS_XML]["id"])) {
                $id = $attrs[Reader::XMLNS_XML]["id"];
                $idstr = ' id="' .$id. '"';
            }
            return '<' .$tag. ' class="' .$name. '"' . $idstr . ($props["empty"] ? '/' : "") . '>';
        }
        return '</' .$tag. '>';
    }

    public function TEXT($str) {
        return htmlspecialchars($str, ENT_QUOTES, "UTF-8");
    }

    public function UNDEF($open, $name, $attrs, $props) {
        if ($open) {
            trigger_error("No mapper found for '{$name}'", E_USER_WARNING);
        }
    }

    public function CDATA($str) {
        switch($this->role) {
        case '':
            return '

'
                . htmlspecialchars($str, ENT_QUOTES, "UTF-8")
                . '

';
        default:
            return '
role . 'code">'
                . $this->highlight(trim($str), $this->role, 'xhtml')
                . '
';
        }
    }

    /* Functions from PhDThemeXhtml */

    /**
    * Called after the constructor finished.
    * This is needed since themes set their outputdir and outputfile
    * in the constructor. That file/dir is used for mediamanager.
    * That means we cannot instantiate and complete the manager in our
    * constructor centrally.
    *
    * Each theme needs its own media manager, since the manager contains
    * the output path.
    *
    * @return void
    */
    public function postConstruct() {
        $this->mediamanager = new MediaManager(Config::xml_root());
        $outputdir = $this->getOutputDir();
        if (isset($outputdir) && $outputdir) {
            $this->mediamanager->output_dir = $outputdir;
        } else {
            $this->mediamanager->output_dir        = Config::output_dir() . '/' . strtolower($this->getFormatName()) . '-data/';
            $this->mediamanager->relative_ref_path = basename($this->mediamanager->output_dir) . '/';
        }
    }

    /* Functions from XHTMLPhDFormat */

    /**
    * Closes a para tag when we are already in a paragraph.
    *
    * @return string HTML code
    *
    * @see $openPara
    * @see restorePara()
    */
    public function escapePara() {
        if (!$this->openPara) {
            return '';
        }

        if (!isset($this->escapedPara[$this->openPara])) {
            $this->escapedPara[$this->openPara] = 1;
            return '
';
        } else {
            ++$this->escapedPara[$this->openPara];
            return '';
        }
    }

    /**
    * Opens a para tag again when we escaped one before.
    *
    * @return string HTML code
    *
    * @see $openPara
    * @see escapePara()
    */
    public function restorePara() {
        if (!$this->openPara || !isset($this->escapedPara[$this->openPara])) {
            return '';
        }

        if ($this->escapedPara[$this->openPara] == 1) {
            unset($this->escapedPara[$this->openPara]);
            return '
';
        } else {
            --$this->escapedPara[$this->openPara];
            return '';
        }
    }

}

/*
* vim600: sw=4 ts=4 syntax=php et
* vim<600: sw=4 ts=4
*/


text:
'use strict';

/**
 * @module Call
 * @description call schema used to log call start and end time as well as
 *              call dutation.
 *
 * @see {@link ServiceRequest}
 * @see {@link DurationSchema}
 * @author lally elias<lallyelias87@gmail.com>
 * @since  0.1.0
 * @version 0.1.0
 * @public
 */

//dependencies
const path = require('path');
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const Duration = require(path.join(__dirname, 'duration_schema'));

/**
 * @name CallSchema
 * @description duration schema
 * @type {Schema}
 * @since  0.1.0
 * @version 0.1.0
 * @private
 */
const CallSchema = new Schema({
  /**
   * @name startedAt
   * @description time when a call received at the call center
   * @type {Object}
   * @private
   * @since 0.1.0
   * @version 0.1.0
   */
  startedAt: {
    type: Date,
    default: new Date(),
    index: true
  },

  /**
   * @name endedAt
   * @description time when a call center operator end the call
   *              and release a reporter
   * @type {Object}
   * @private
   * @since 0.1.0
   * @version 0.1.0
   */
  endedAt: {
    type: Date,
    default: new Date(),
    index: true
  },

  /**
   * @name duration
   * @description call duration from time when call picked up to time when
   *              a call released by the call center operator in duration
   *              formats.
   *
   * @type {Object}
   * @see {@link DurationSchema}
   * @private
   * @since 0.1.0
   * @version 0.1.0
   */
  duration: Duration

}, { _id: false, timestamps: false });

//---------------------------------------------------------
// CallSchema Hooks
//---------------------------------------------------------

/**
 * @name  preValidate
 * @description pre validation logics for call
 * @param  {Function} next a callback to be called after pre validation logics
 * @since  0.1.0
 * @version 0.1.0
 * @private
 */
CallSchema.pre('validate', function (next) {

  //ensure call times
  this.startedAt = this.startedAt || new Date();
  this.endedAt = this.endedAt || new Date();

  //always ensure duration
  const time = this.endedAt.getTime() - this.startedAt.getTime();

  this.duration = { milliseconds: time };

  next(null, this);

});

/**
 * @name CallSchema
 * @description exports call schema
 * @type {Schema}
 * @since  0.1.0
 * @version 0.1.0
 * @public
 */
module.exports = exports = CallSchema;


text:
using System;
using System.Collections.Generic;
using System.Threading;

namespace Spinner.Fody
{
    internal static class CollectionExtensions
    {
        internal static int AddRange<T>(this ICollection<T> collection, params T[] source)
        {
            int count = 0;
            foreach (T item in source)
            {
                collection.Add(item);
                count++;
            }
            return count;
        }

        internal static int AddRange<T>(this ICollection<T> collection, IEnumerable<T> source)
        {
            int count = 0;
            foreach (T item in source)
            {
                collection.Add(item);
                count++;
            }
            return count;
        }

        internal static int InsertRange<T>(this IList<T> collection, int index, IEnumerable<T> source)
        {
            int count = 0;
            if (index == collection.Count)
            {
                foreach (T item in source)
                {
                    collection.Add(item);
                    count++;
                }
            }
            else
            {
                foreach (T item in source)
                {
                    collection.Insert(index++, item);
                    count++;
                }
            }
            return count;
        }

        internal static int InsertRange<T>(this IList<T> collection, int index, params T[] source)
        {
            int count = 0;
            if (index == collection.Count)
            {
                foreach (T item in source)
                {
                    collection.Add(item);
                    count++;
                }
            }
            else
            {
                foreach (T item in source)
                {
                    collection.Insert(index++, item);
                    count++;
                }
            }
            return count;
        }

        internal static void SortStable<T>(this IList<T> collection, Comparison<T> comparison = null)
        {
            SortStable(collection, Comparer<T>.Create(comparison));
        }

        internal static void SortStable<T>(this IList<T> collection, IComparer<T> comparer = null)
        {
            if (comparer == null)
                comparer = Comparer<T>.Default;

            QuickSort(collection, comparer, 0, collection.Count - 1);
        }

        private static void QuickSort<T>(IList<T> collection, IComparer<T> comparer, int left, int right)
        {
            int count = collection.Count;
            do
            {
                int i = left;
                int j = right;
                T x = collection[i + ((j - i) >> 1)];

                do
                {
                    while (i < count && comparer.Compare(x, collection[i]) > 0)
                        i++;

                    while (j >= 0 && comparer.Compare(x, collection[j]) < 0)
                        j--;

                    if (i > j)
                        break;

                    if (i < j)
                    {
                        T temp = collection[i];
                        collection[i] = collection[j];
                        collection[j] = temp;
                    }

                    i++;
                    j--;
                } while (i <= j);

                if (j - left <= right - i)
                {
                    if (left < j)
                        QuickSort(collection, comparer, left, j);

                    left = i;
                }
                else {
                    if (i < right)
                        QuickSort(collection, comparer, i, right);

                    right = j;
                }
            } while (left < right);
        }
    }
}


text:
Event store
===========

[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]

**It is highly recommended not to use this library for anything other than educational purposes**

This library is an experimental prototype (yes, not a normal one; an experimental one!). This means that
this very repository may be deleted without notice, the structure of the application invariably changed,
or other stuff that will break your environment if you depend on this.

## Security

If you discover any security related issues, please email me@mikevanriel.com instead of using the issue tracker.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/phpinpractice/event-store/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/phpinpractice/event-store.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/phpinpractice/event-store.svg?style=flat-square

[link-travis]: https://travis-ci.org/phpinpractice/event-store
[link-scrutinizer]: https://scrutinizer-ci.com/g/phpinpractice/event-store/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/phpinpractice/event-store


text:
<?xml version="1.0" encoding="utf-8"?>
<com.deange.githubstatus.ui.main.MainView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.deange.githubstatus.ui.MainActivity">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/app_bar_height"
            android:fitsSystemWindows="true"
            android:theme="@style/AppTheme.AppBarOverlay"
            app:elevation="@dimen/app_bar_elevation">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                app:contentScrim="?colorPrimary"
                app:expandedTitleGravity="center"
                app:expandedTitleTextAppearance="@style/HeaderTextAppearance"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:toolbarId="@+id/toolbar">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?actionBarSize"
                    app:layout_collapseMode="pin"
                    app:popupTheme="@style/AppTheme.PopupOverlay" />

            </android.support.design.widget.CollapsingToolbarLayout>
        </android.support.design.widget.AppBarLayout>

        <include layout="@layout/content_main" />

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/fab_margin"
            android:contentDescription="@string/action_settings"
            app:layout_anchor="@id/app_bar"
            app:layout_anchorGravity="bottom|end"
            app:srcCompat="@drawable/ic_settings" />

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab_dev_settings"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            android:layout_margin="@dimen/fab_margin"
            android:contentDescription="@string/action_settings"
            app:srcCompat="@drawable/ic_adb" />

    </android.support.design.widget.CoordinatorLayout>

</com.deange.githubstatus.ui.main.MainView>


text:
set -e
set -u
set -v

readonly location="$( cd $(dirname $0) && pwd -P )"

source $location/settings.sh

set +e
isReleaseBranch $TRAVIS_BRANCH
IS_RELEASE=$?
set -e

if [[ $TRAVIS_PULL_REQUEST == "false" && $IS_RELEASE -eq 0 ]]; then
    if [ $# -eq 0 ]; then
        echo "Please provide a target repository and an optional list of projects to deploy."
        exit 1
    else
        repository=$1
        artifactoryUrl="http://commbank.artifactoryonline.com/commbank/$repository"
        publishTo="set publishTo in ThisBuild := Some(\"$repository\" at \"$artifactoryUrl\")"
        publishIvyStyle="set publishMavenStyle in ThisBuild := false"
        projects=${*:2}
        if [ $# -eq 1 ]; then
            echo "Publishing to repository $repository"
            sbt -Dsbt.global.base=$TRAVIS_BUILD_DIR/ci "; $publishTo; $publishIvyStyle; + publish"
        else
            for project in $projects; do
                echo "Publishing $project to repository $repository"
                sbt -Dsbt.global.base=$TRAVIS_BUILD_DIR/ci ";project $project; $publishTo; $publishIvyStyle; + publish"
            done
        fi
    fi
else
    echo "Not a release branch. Nothing to deploy."
    if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
        echo "Travis has marked this branch as a Pull Request, so it will not be deployed to Artifactory."
    else
        # format the string describing the added branch nicely
        read -a branchesArray <<< "${RELEASE_BRANCHES-}"
        if [ ${#branchesArray[@]} -eq 0 ]; then
            addedBranch="\"$TRAVIS_BRANCH\""
        else
            addedBranch="\"$TRAVIS_BRANCH ${branchesArray[@]-}\""
        fi
        # tell the user what to do if they want their branch deployed
        echo "To deploy this branch ($TRAVIS_BRANCH), add it to the RELEASE_BRANCHES environment variable:"
        echo "  travis env set RELEASE_BRANCHES $addedBranch"
        echo "(Or, alternatively, set it using the Travis web interface.)"
    fi
fi


text:
package org.nutz.vfs.simple;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

import org.nutz.lang.Files;
import org.nutz.lang.Lang;
import org.nutz.lang.util.Disks;
import org.nutz.vfs.ZDir;
import org.nutz.vfs.ZFile;
import org.nutz.vfs.ZIO;

public class ZSimpleFile implements ZFile {

    protected File f;

    protected ZSimpleFile() {}

    public ZSimpleFile(File f) {
        if (null == f)
            throw Lang.makeThrow("NULL File");
        if (!f.isFile())
            throw Lang.makeThrow("'%s' should be Dir", f.getAbsolutePath());
        this.f = f;
    }

    public int hashCode() {
        if (null == f)
            return 0;
        return f.hashCode();
    }

    @Override
    public boolean isFile() {
        return true;
    }

    @Override
    public boolean isDir() {
        return false;
    }

    @Override
    public boolean isHidden() {
        return f.isHidden();
    }

    @Override
    public boolean exists() {
        return f.exists();
    }

    @Override
    public long lastModified() {
        return f.lastModified();
    }

    @Override
    public ZDir parent() {
        return new ZSimpleDir(f.getParentFile());
    }

    @Override
    public void createIfNoExists() {
        Files.createFileIfNoExists(f);
    }

    @Override
    public void copyTo(ZIO fromIO, ZIO toIO, ZFile zf) {
        zf.createIfNoExists();
        InputStream ins = fromIO.read(this);
        toIO.write(zf, ins);
    }

    @Override
    public void moveTo(ZFile zf) {
        if (zf instanceof ZSimpleFile) {
            try {
                Files.move(f, ((ZSimpleFile) zf).f);
            }
            catch (IOException e) {
                throw Lang.wrapThrow(e);
            }
            return;
        }
        throw Lang.makeThrow("ZSimpleFile can moveTo another ZSimpleFile only!");
    }

    @Override
    public boolean matchType(String regex) {
        return typeLower().matches(regex);
    }

    @Override
    public String relative(ZFile f) {
        return relative(f.path());
    }

    @Override
    public String relative(String path) {
        return Disks.getRelativePath(this.path(), path);
    }

    @Override
    public String name() {
        return f.getName();
    }

    @Override
    public String path() {
        return f.getAbsolutePath();
    }

    private String _type;

    public String toString() {
        return path();
    }

    @Override
    public String type() {
        if (null == _type) {
            _type = Files.getSuffixName(f);
        }
        return _type;
    }

    private String _type_lower;

    @Override
    public String typeLower() {
        if (null == _type_lower) {
            _type_lower = type().toLowerCase();
        }
        return _type_lower;
    }

}


text:
package com.microsoft.azure.management.recoveryservices.backup.v2017_07_01;

import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.microsoft.azure.management.recoveryservices.backup.v2017_07_01.implementation.RecoveryPointInner;

/**
 * SAPHana specific recoverypoint, specifcally encaspulates full/diff
 * recoverypoints.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType")
@JsonTypeName("AzureWorkloadSAPHanaRecoveryPoint")
@JsonSubTypes({
    @JsonSubTypes.Type(name = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint", value = AzureWorkloadSAPHanaPointInTimeRecoveryPoint.class)
})
public class AzureWorkloadSAPHanaRecoveryPoint extends RecoveryPointInner {
    /**
     * UTC time at which recoverypoint was created.
     */
    @JsonProperty(value = "recoveryPointTimeInUTC")
    private DateTime recoveryPointTimeInUTC;

    /**
     * Type of restore point. Possible values include: 'Invalid', 'Full',
     * 'Log', 'Differential'.
     */
    @JsonProperty(value = "type")
    private RestorePointType type;

    /**
     * Get uTC time at which recoverypoint was created.
     *
     * @return the recoveryPointTimeInUTC value
     */
    public DateTime recoveryPointTimeInUTC() {
        return this.recoveryPointTimeInUTC;
    }

    /**
     * Set uTC time at which recoverypoint was created.
     *
     * @param recoveryPointTimeInUTC the recoveryPointTimeInUTC value to set
     * @return the AzureWorkloadSAPHanaRecoveryPoint object itself.
     */
    public AzureWorkloadSAPHanaRecoveryPoint withRecoveryPointTimeInUTC(DateTime recoveryPointTimeInUTC) {
        this.recoveryPointTimeInUTC = recoveryPointTimeInUTC;
        return this;
    }

    /**
     * Get type of restore point. Possible values include: 'Invalid', 'Full', 'Log', 'Differential'.
     *
     * @return the type value
     */
    public RestorePointType type() {
        return this.type;
    }

    /**
     * Set type of restore point. Possible values include: 'Invalid', 'Full', 'Log', 'Differential'.
     *
     * @param type the type value to set
     * @return the AzureWorkloadSAPHanaRecoveryPoint object itself.
     */
    public AzureWorkloadSAPHanaRecoveryPoint withType(RestorePointType type) {
        this.type = type;
        return this;
    }

}


text:
//=============================================================================
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//=============================================================================

// ****************************************************************************
// Module app.layout
//

var m = angular.module('app.layout', [])

// ****************************************************************************
// Controller layout.navbar
//

m.controller('app.layout.navbar', ['$scope', '$state', 'security', 'services', ($scope: any, $state: ng.ui.IState, security: ISecurity, services: IServices) => {
    services.logger.debug('Loading app.layout.navbar controller')

    $scope.$state = $state

    security.principal.identity().then(data => {
        if(data) $scope.username = data.name
    })

    services.profile.me().then(data => {
        $scope.avataruri = data.avatar
    })

    $scope.toggleSidebar = () => {
        services.logger.debug('toggling sidebar')
        services.events.emit('event:sidebar-toggle')
    }

    $scope.signout = () => {
        security.principal.authenticate(null);
        services.state.go('app.login');
    }
}])

// ****************************************************************************
// Controller layout.sidebar
//

m.controller('app.layout.sidebar', ['$scope', '$state', 'security', 'services', 'settings',
    ($scope: any, $state: ng.ui.IState, security: ISecurity, services: IServices, settings: ISystemSettings) => {
    services.logger.debug('Loading app.layout.sidebar controller')

    $scope.$state = $state

    services.profile.me().then(me => {
        $scope.avataruri = me.avatar
        settings.currentTheme = me.theme
        $scope.firstname = me.nameFirst
        $scope.isAdmin = me.isAdmin
        services.events.emit('event:update-theme')
    })

    $scope.signout = () => {
        security.principal.authenticate(null);
        services.state.go('app.login');
    }
}])

// ****************************************************************************
// Controller layout.footer
//

m.controller('app.layout.footer', ['$scope', '$state', 'security', 'services', ($scope: any, $state: ng.ui.IState, security: ISecurity, services: IServices) => {
    services.logger.debug('Loading app.layout.footer controller')
}])


text:
package com.intellij.util.containers;

import com.intellij.testFramework.Timings;
import junit.framework.TestCase;

import java.util.stream.IntStream;

public class ConcurrentBitSetTest extends TestCase {
  public void test() {
    ConcurrentBitSet bitSet = new ConcurrentBitSet();
    final ConcurrentBitSet emptySet = new ConcurrentBitSet();
    assertEquals(0, bitSet.nextClearBit(0));
    assertEquals(bitSet, emptySet);
    int N = 3000;
    for (int i = 0; i < N; i++) {
      assertEquals(-1, bitSet.nextSetBit(i));
      assertEquals(i, bitSet.nextClearBit(i));
      assertFalse(bitSet.get(i));
      bitSet.set(i);
      assertTrue(bitSet.get(i));
      bitSet.clear(i);
      assertFalse(bitSet.get(i));
      assertEquals(bitSet, emptySet);
    }
    bitSet = new ConcurrentBitSet();
    for (int b=0;b<N;b++) {
      assertEquals(bitSet, emptySet);
      boolean set = bitSet.flip(b);
      assertTrue(set);
      assertEquals(b, bitSet.nextSetBit(0));
      assertEquals(b==0?1:0, bitSet.nextClearBit(0));
      assertEquals(b+1, bitSet.nextClearBit(b));
      assertFalse(bitSet.get(b==0?1:0));
      assertTrue(bitSet.get(b));
      for (int i=0; i<N;i++) {
        assertEquals(i<=b?b:-1, bitSet.nextSetBit(i));
        assertEquals(i==b?b+1:i, bitSet.nextClearBit(i));
        assertEquals(i == b, bitSet.get(i));
      }

      boolean after = bitSet.flip(b);
      assertFalse(after);
      assertEquals(-1, bitSet.nextSetBit(0));
      assertEquals(0, bitSet.nextClearBit(0));
      assertEquals(b, bitSet.nextClearBit(b));
      assertFalse(bitSet.get(0));
      assertFalse(bitSet.get(b));
      for (int i=0; i<N;i++) {
        assertEquals(-1, bitSet.nextSetBit(i));
        assertEquals(i, bitSet.nextClearBit(i));
        assertFalse(bitSet.get(i));
      }
    }
    bitSet.set(100, true);
    assertFalse(bitSet.equals(emptySet));
    bitSet.clear();
    assertEquals(bitSet, emptySet);
  }

  public void testStressFineGrainedSmallSet() {
    final ConcurrentBitSet bitSet = new ConcurrentBitSet();
    // must be even
    int N = Timings.adjustAccordingToMySpeed(100_000, true) / 2 * 2;
    final int L = 100;
    IntStream.range(0, N).parallel().forEach(__-> {
      for (int j = 0; j < L; j++) {
        bitSet.flip(j);
      }
    });

    assertEquals(-1, bitSet.nextSetBit(0));
  }

  public void testStressCoarseGrainedBigSet() {
    final ConcurrentBitSet bitSet = new ConcurrentBitSet();
    // must be even
    int N = Timings.adjustAccordingToMySpeed(1_000, true) / 2 * 2;
    final int L = 100_000;

    IntStream.range(0,N).parallel().forEach(__-> {
      for (int j = 0; j < L; j++) {
        bitSet.flip(j);
      }
    });

    assertEquals(-1, bitSet.nextSetBit(0));
  }
}


text:
package tcnpinstanceinfo

import (
	"context"

	"github.com/giantswarm/microerror"
)

func (r *Resource) EnsureCreated(ctx context.Context, obj interface{}) error {
	err := r.ensure(ctx, obj)
	if err != nil {
		return microerror.Mask(err)
	}

	return nil
}


text:
package edu.wustl.catissuecore.testcase.bizlogic;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;

import edu.wustl.catissuecore.bizlogic.ParticipantBizLogic;
import edu.wustl.catissuecore.domain.CollectionProtocol;
import edu.wustl.catissuecore.domain.CollectionProtocolEvent;
import edu.wustl.catissuecore.domain.CollectionProtocolRegistration;
import edu.wustl.catissuecore.domain.ConsentTier;
import edu.wustl.catissuecore.domain.ConsentTierResponse;
import edu.wustl.catissuecore.domain.Participant;
import edu.wustl.catissuecore.domain.ParticipantMedicalIdentifier;
import edu.wustl.catissuecore.domain.Site;
import edu.wustl.catissuecore.domain.Specimen;
import edu.wustl.catissuecore.domain.SpecimenCollectionGroup;
import edu.wustl.catissuecore.domain.User;
import edu.wustl.catissuecore.testcase.CaTissueSuiteBaseTest;
import edu.wustl.catissuecore.testcase.util.UniqueKeyGeneratorUtil;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.beans.SessionDataBean;
import edu.wustl.common.domain.AbstractDomainObject;
import edu.wustl.common.util.Utility;
import edu.wustl.common.util.logger.Logger;
import gov.nih.nci.system.query.hibernate.HQLCriteria;

public class ParticipantBizTestCases extends CaTissueSuiteBaseTest {

	AbstractDomainObject domainObject = null;

	public void testAddParticipantWithCPR()
	{
		try{
			Participant participant= BaseTestCaseUtility.initParticipantWithCPR();
			System.out.println(participant);
			participant = (Participant) appService.createObject(participant);
			Collection collectionProtocolRegistrationCollection = participant.getCollectionProtocolRegistrationCollection();
			Iterator cprItr = collectionProtocolRegistrationCollection.iterator();
			CollectionProtocolRegistration collectionProtocolRegistration = (CollectionProtocolRegistration)cprItr.next();

			BizTestCaseUtility.setObjectMap(collectionProtocolRegistration, CollectionProtocolRegistration.class);
			BizTestCaseUtility.setObjectMap(participant, Participant.class);
			System.out.println("Object created successfully");
			assertTrue("Object added successfully", true);
		 }
		 catch(Exception e){
			 System.out
					.println("ParticipantTestCases.testAddParticipantWithCPR()"+e.getMessage());
			 e.printStackTrace();
			 assertFalse(e.getMessage(), true);
		 }
	}

	public void testDisableParticipant()
	{
		try{
			Participant participant= BaseTestCaseUtility.initParticipantWithCPR();
			System.out.println(participant);
			participant = (Participant) appService.createObject(participant);
			participant.setActivityStatus("Disabled");
			participant.setParticipantMedicalIdentifierCollection(null);
			participant = (Participant)appService.updateObject(participant);
			assertTrue("Object added successfully", true);
		 }
		 catch(Exception e){
			 System.out
					.println("ParticipantTestCases.testAddParticipantWithCPR()"+e.getMessage());
			 e.printStackTrace();
			 assertFalse(e.getMessage(), true);
		 }
	}

	public void testUpdateCPAssociatedCPRWithDeleteCollectionProtocolEvent()
	{
	    try
		{
	    	CollectionProtocolRegistration cpr = (CollectionProtocolRegistration)BizTestCaseUtility.getObjectMap(CollectionProtocolRegistration.class);
	    	CollectionProtocol collectionProtocol = cpr.getCollectionProtocol();
	    	Collection cpeCollection = collectionProtocol.getCollectionProtocolEventCollection();
	    	Iterator itr = cpeCollection.iterator();
	    	Collection collectionProtocolEventList = new LinkedHashSet();
	    	while(itr.hasNext())
	    	{
	    		collectionProtocolEventList.add(itr.next());
	    	}
			CollectionProtocolEvent collectionProtocolEvent = null;
			for(int specimenEventCount = 0 ;specimenEventCount<2 ;specimenEventCount++)
			{
				collectionProtocolEvent= new CollectionProtocolEvent();
				BaseTestCaseUtility.setCollectionProtocolEvent(collectionProtocolEvent);
				collectionProtocolEvent.setCollectionProtocol(collectionProtocol);
				collectionProtocolEventList.add(collectionProtocolEvent);
			}
			collectionProtocol.setCollectionProtocolEventCollection(collectionProtocolEventList);
	    	CollectionProtocol updatedCollectionProtocol = (CollectionProtocol)appService.updateObject(collectionProtocol);
	    	Collection updatedCPECollection = updatedCollectionProtocol.getCollectionProtocolEventCollection();
	    	if(updatedCPECollection.size() > cpeCollection.size())
	    	{
	    		assertTrue("User can add events after participant regestered to CP", true);

	    	}
	    	else
	    	{
	    		fail("User can add events after participant regestered to CP");
			}

	    }
	    catch (Exception e)
	    {
	    	System.out
	    	.println("ParticipantTestCases.testUpdateCPAssociatedCPRWithDeleteCollectionProtocolEvent()" + e.getMessage());
	    	e.printStackTrace();
	    	fail("User can add events after participant regestered to CP");
	    }
	}

	/*public void testSearchParticipant()
	{
		Participant participant = new Participant();
    	Logger.out.info(" searching domain object");
    	participant.setId(new Long(1));

         try {
        	 List resultList = appService.search(Participant.class,participant);
        	 for (Iterator resultsIterator = resultList.iterator(); resultsIterator.hasNext();) {
        		 Participant returnedParticipant = (Participant) resultsIterator.next();
        		 Logger.out.info(" Domain Object is successfully Found ---->  :: " + returnedParticipant.getFirstName() +" "+returnedParticipant.getLastName());
        		// System.out.println(" Domain Object is successfully Found ---->  :: " + returnedDepartment.getName());
             }
          }
          catch (Exception e) {
           	Logger.out.error(e.getMessage(),e);
           	System.out.println("ParticipantTestCases.testSearchParticipant()"+e.getMessage());
           	e.printStackTrace();
           	assertFalse("Does not find Domain Object", true);

          }
	}
	*/
	public void testMatchingParticipant() {
		List<?> resultList1 = null;
		Participant  participant=new Participant();
		try {
			resultList1=appService.getParticipantMatchingObects(participant);
			System.out.println("testMatchingParticipant resultList1 "+ resultList1);
			for(int i=0;i<resultList1.size();i++)
			{
				System.out.println(resultList1.get(i));
			}
			assertTrue("Macthing participant list is retrieved using API", true);

		}catch(Exception e)
		{
			System.out.println("testMatchingParticipant"+ e.getMessage());
			e.printStackTrace();
			assertFalse(e.getMessage(), true);
		}

	}

	public void testUpdateParticipant()
	{
		Participant participant =  BaseTestCaseUtility.initParticipantWithCPR();
    	Logger.out.info("updating domain object------->"+participant);
	    try
		{
	    	participant = (Participant) appService.createObject(participant);
	    	BaseTestCaseUtility.updateParticipant(participant);
	    	Participant updatedParticipant = (Participant) appService.updateObject(participant);
	       	Logger.out.info("Domain object successfully updated ---->"+updatedParticipant);
	       	assertTrue("Domain object successfully updated ---->"+updatedParticipant, true);
	    }
	    catch (Exception e) {
	       	Logger.out.error(e.getMessage(),e);
	       	System.out.println("ParticipantTestCases.testUpdateParticipant()"+e.getMessage());
	 		e.printStackTrace();
	 		assertFalse(e.getMessage(), true);
	    }
	}

	public void testUpdateCPRWithBarcode()
	{
		Participant participant =  BaseTestCaseUtility.initParticipantWithCPR();

    	Logger.out.info("updating domain object------->"+participant);
	    try
		{
	    	participant = (Participant) appService.createObject(participant);
	    	BaseTestCaseUtility.updateParticipant(participant);
			Collection collectionProtocolRegistrationCollection = new HashSet();
			CollectionProtocolRegistration collectionProtocolRegistration=(CollectionProtocolRegistration)participant.getCollectionProtocolRegistrationCollection().iterator().next();
			collectionProtocolRegistrationCollection.add(collectionProtocolRegistration);
			collectionProtocolRegistration.setBarcode("PATICIPANT"+UniqueKeyGeneratorUtil.getUniqueKey());
			participant.setCollectionProtocolRegistrationCollection(collectionProtocolRegistrationCollection);
	    	Participant updatedParticipant = (Participant) appService.updateObject(participant);
	       	Logger.out.info("Domain object successfully updated ---->"+updatedParticipant);
	       	assertTrue("Domain object successfully updated ---->"+updatedParticipant, true);
	    }
	    catch (Exception e) {
	       	Logger.out.error(e.getMessage(),e);
	       	System.out
					.println("ParticipantTestCases.testUpdateCPRWithBarcode()"+e.getMessage());
	 		e.printStackTrace();
	 		assertFalse(e.getMessage(), true);
	    }
	}

	public void testUpdateCPRWithCaseSensitiveBarcode()
	{
		String uniqueKey=UniqueKeyGeneratorUtil.getUniqueKey();
		Participant participant1 =  BaseTestCaseUtility.initParticipantWithCPR();

    	Logger.out.info("updating domain object------->"+participant1);
	    try
		{
	    	participant1 = (Participant) appService.createObject(participant1);
	    	BaseTestCaseUtility.updateParticipant(participant1);
			Collection collectionProtocolRegistrationCollection = new HashSet();
			CollectionProtocolRegistration collectionProtocolRegistration=(CollectionProtocolRegistration)participant1.getCollectionProtocolRegistrationCollection().iterator().next();
			collectionProtocolRegistration.setBarcode("CPR"+uniqueKey);
			collectionProtocolRegistrationCollection.add(collectionProtocolRegistration);
			participant1.setCollectionProtocolRegistrationCollection(collectionProtocolRegistrationCollection);
	    	Participant updatedParticipant1 = (Participant) appService.updateObject(participant1);
	       	Logger.out.info("Domain object successfully updated ---->"+updatedParticipant1);
	       	assertTrue("Domain object successfully updated ---->"+updatedParticipant1, true);
	    }
	    catch (Exception e) {
	       	Logger.out.error(e.getMessage(),e);
	       	System.out
					.println("ParticipantTestCases.testUpdateCPRWithCaseSensitiveBarcode()"+e.getMessage());
	 		e.printStackTrace();
	 		assertFalse(e.getMessage(), true);
	    }

	    Participant participant2 =  BaseTestCaseUtility.initParticipantWithCPR();
    	Logger.out.info("updating domain object------->"+participant2);
	    try
		{
	    	participant2 = (Participant) appService.createObject(participant2);
	    	BaseTestCaseUtility.updateParticipant(participant2);
			Collection collectionProtocolRegistrationCollection2 = new HashSet();
			CollectionProtocolRegistration collectionProtocolRegistration2=(CollectionProtocolRegistration)participant2.getCollectionProtocolRegistrationCollection().iterator().next();
			collectionProtocolRegistrationCollection2.add(collectionProtocolRegistration2);
			collectionProtocolRegistration2.setBarcode("cpr"+uniqueKey);
			participant2.setCollectionProtocolRegistrationCollection(collectionProtocolRegistrationCollection2);
	    	Participant updatedParticipant2 = (Participant) appService.updateObject(participant2);
	       	Logger.out.info("Domain object successfully updated ---->"+updatedParticipant2);
	       	assertTrue("Domain object successfully updated ---->"+updatedParticipant2, true);
	    }
	    catch (Exception e) {
	       	Logger.out.error(e.getMessage(),e);
	       	System.out
					.println("ParticipantTestCases.testUpdateCPRWithCaseSensitiveBarcode()"+e.getMessage());
	 		e.printStackTrace();
	 		assertFalse(e.getMessage(), true);
	    }
	}

	public void testCollectedSCGAndNoOfChildSpecimens()
	{
		Participant participant =  BaseTestCaseUtility.initParticipantWithCPR();
		CollectionProtocolRegistration cpr = (CollectionProtocolRegistration)participant.getCollectionProtocolRegistrationCollection().iterator().next();
		System.out.println(cpr.getCollectionProtocol().getId());
		try
		{
			participant = (Participant) appService.createObject(participant);
			Collection cprCollection = participant.getCollectionProtocolRegistrationCollection();
			Iterator cprCPR = cprCollection.iterator();
			CollectionProtocolRegistration cprObj  = null;
			while(cprCPR.hasNext())
			{
				cprObj = (CollectionProtocolRegistration)cprCPR.next();
			}
			System.out.println("Befor");
			Collection scgCollection  = cprObj.getSpecimenCollectionGroupCollection();
			Iterator scgItr = scgCollection.iterator();
			SpecimenCollectionGroup sprObj  = null;
			while(scgItr.hasNext())
			{
				sprObj = (SpecimenCollectionGroup)scgItr.next();
			}

			BizTestCaseUtility.setObjectMap(sprObj, SpecimenCollectionGroup.class);
			BizTestCaseUtility.setObjectMap(participant, Participant.class);

			String hqlQuery2="select elements(scg.specimenCollection)" +
			" from edu.wustl.catissuecore.domain.SpecimenCollectionGroup as scg" +
	    	" where scg.id="+sprObj.getId();

            System.out.println("-------------------");
        	HQLCriteria hqlCriteria2= new HQLCriteria(hqlQuery2);
        	//List specimenCollection = appService.query(hqlCriteria2, SpecimenCollectionGroup.class.getName());
        	List specimenCollection = appService.search(hqlQuery2);
        	System.out.println("-------------------"+specimenCollection);

        	System.out.println("Criteria executed");

			//Iterator itr = sprObj.getSpecimenCollection().iterator();
        	Iterator itr =specimenCollection.iterator();
			Specimen sp = null;
			boolean specimenAdded=false;
			while(itr.hasNext())
			{
				sp = (Specimen)itr.next();
				if(sp.getLineage().equals("New")&&!specimenAdded)
				{
					BizTestCaseUtility.setObjectMap(sp, Specimen.class);
					System.out.println("This is Specimen"+sp.getId());
					specimenAdded=true;
				}
			}

			if(sp==null)
			{
				assertFalse("No Specimens created under SCG", true);
			}

		}
		catch(Exception e)
		{
			Logger.out.error(e.getMessage(),e);
	 		System.out.println("ParticipantTestCases.testCollectedSCGAndNoOfChildSpecimens() "+e.getMessage());
			e.printStackTrace();
	 		assertFalse(e.getMessage(), true);
		}
	}

	/*public void testAddParticipantWithUniquePMI()
	{
		try{
			Participant participant= BaseTestCaseUtility.initParticipant();
			Collection participantMedicalIdentifierCollection = new HashSet();
			ParticipantMedicalIdentifier pmi = new ParticipantMedicalIdentifier();
			Site site =(Site)  TestCaseUtility.getObjectMap(Site.class);
			pmi.setSite(site);
			pmi.setMedicalRecordNumber("1234");
			pmi.setParticipant(participant);
			participantMedicalIdentifierCollection.add(pmi);
			participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
			participant = (Participant) appService.createObject(participant);
			assertTrue("Object created successfully", true);
		 }
		 catch(Exception e){
			 e.printStackTrace();
			 assertFalse("could not add object", true);
		 }
	}

	public void testAddParticipantWithDuplicatePMI()
	{
		try{
			Participant participant= BaseTestCaseUtility.initParticipant();
			Collection participantMedicalIdentifierCollection = new HashSet();
			ParticipantMedicalIdentifier pmi = new ParticipantMedicalIdentifier();
			Site site =(Site)  TestCaseUtility.getObjectMap(Site.class);
			pmi.setSite(site);
			pmi.setMedicalRecordNumber("1234");
			pmi.setParticipant(participant);
			participantMedicalIdentifierCollection.add(pmi);
			participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
			participant = (Participant) appService.createObject(participant);
			assertFalse("Object created successfully", true);
		 }
		 catch(Exception e){
			 e.printStackTrace();
			 assertTrue("Submission failed because Participant with same PMI is already exist", true);
		 }
	}*/

	public void testAddParticipantRegistrationWithUniquePMI()
	{

		Participant participant= BaseTestCaseUtility.initParticipant();
		Collection participantMedicalIdentifierCollection = new HashSet();
		ParticipantMedicalIdentifier pmi = new ParticipantMedicalIdentifier();
		Site site =(Site)  BizTestCaseUtility.getObjectMap(Site.class);
		pmi.setSite(site);
		pmi.setMedicalRecordNumber("1234");
		pmi.setParticipant(participant);
		participantMedicalIdentifierCollection.add(pmi);
		participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
		try{
			participant = (Participant) appService.createObject(participant);
		 }
		 	catch(Exception e){
			 e.printStackTrace();
			 System.out
					.println("ParticipantTestCases.testAddParticipantRegistrationWithUniquePMI() 1"+e.getMessage());
			 assertFalse("Unable to create participant", true);
		 }
			CollectionProtocolRegistration collectionProtocolRegistration = new CollectionProtocolRegistration();

			CollectionProtocol collectionProtocol =(CollectionProtocol)BizTestCaseUtility.getObjectMap(CollectionProtocol.class);
			collectionProtocolRegistration.setCollectionProtocol(collectionProtocol);

			collectionProtocolRegistration.setParticipant(participant);

			collectionProtocolRegistration.setProtocolParticipantIdentifier("");

			collectionProtocolRegistration.setActivityStatus("Active");
			try
			{
				collectionProtocolRegistration.setRegistrationDate(Utility.parseDate("08/15/1975",
						Utility.datePattern("08/15/1975")));
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}

			//Setting Consent Tier Responses.
			try
			{
				collectionProtocolRegistration.setConsentSignatureDate(Utility.parseDate("11/23/2006",Utility.datePattern("11/23/2006")));
			}
			catch (ParseException e)
			{
				e.printStackTrace();
			}
			collectionProtocolRegistration.setSignedConsentDocumentURL("F:/doc/consentDoc.doc");
			User user = (User)BizTestCaseUtility.getObjectMap(User.class);
			collectionProtocolRegistration.setConsentWitness(user);

			Collection consentTierResponseCollection = new HashSet();
			Collection consentTierCollection = collectionProtocol.getConsentTierCollection();
			Iterator consentTierItr = consentTierCollection.iterator();
			while(consentTierItr.hasNext())
			{
				ConsentTier consentTier = (ConsentTier)consentTierItr.next();
				ConsentTierResponse consentResponse = new ConsentTierResponse();
				consentResponse.setConsentTier(consentTier);
				consentResponse.setResponse("Yes");
				consentTierResponseCollection.add(consentResponse);
			}
			collectionProtocolRegistration.setConsentTierResponseCollection(consentTierResponseCollection);
		try
		  {
			collectionProtocolRegistration = (CollectionProtocolRegistration) appService.createObject(collectionProtocolRegistration);
			assertTrue("Participant Registration successfully created",true);
		 }
		 catch(Exception e)
		 {
		 	 e.printStackTrace();
		 	 System.out
					.println("ParticipantTestCases.testAddParticipantRegistrationWithUniquePMI()"+e.getMessage());
			 assertFalse(e.getMessage(), true);
		 }
	}

	public void testParticipantRegistrationWithDuplicatePMI()
	{

		Participant participant= BaseTestCaseUtility.initParticipant();
		Collection participantMedicalIdentifierCollection = new HashSet();
		ParticipantMedicalIdentifier pmi = new ParticipantMedicalIdentifier();
		Site site =(Site)  BizTestCaseUtility.getObjectMap(Site.class);
		pmi.setSite(site);
		pmi.setMedicalRecordNumber("1234");
		pmi.setParticipant(participant);
		participantMedicalIdentifierCollection.add(pmi);
		participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
		SessionDataBean bean = (SessionDataBean)getSession().getAttribute("sessionData");
		try{
			participant = (Participant) appService.createObject(participant);
		 }
		 	catch(Exception e){
			 e.printStackTrace();
			 assertTrue("Unable to create participant", true);
		 }
			CollectionProtocolRegistration collectionProtocolRegistration = new CollectionProtocolRegistration();

			CollectionProtocol collectionProtocol =(CollectionProtocol)BizTestCaseUtility.getObjectMap(CollectionProtocol.class);
			collectionProtocolRegistration.setCollectionProtocol(collectionProtocol);

			collectionProtocolRegistration.setParticipant(participant);

			collectionProtocolRegistration.setProtocolParticipantIdentifier("");

			collectionProtocolRegistration.setActivityStatus("Active");
			try
			{
				collectionProtocolRegistration.setRegistrationDate(Utility.parseDate("08/15/1975",
						Utility.datePattern("08/15/1975")));
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}

			//Setting Consent Tier Responses.
			try
			{
				collectionProtocolRegistration.setConsentSignatureDate(Utility.parseDate("11/23/2006",Utility.datePattern("11/23/2006")));
			}
			catch (ParseException e)
			{
				e.printStackTrace();
			}
			collectionProtocolRegistration.setSignedConsentDocumentURL("F:/doc/consentDoc.doc");
			User user = (User)BizTestCaseUtility.getObjectMap(User.class);
			collectionProtocolRegistration.setConsentWitness(user);

			Collection consentTierResponseCollection = new HashSet();
			Collection consentTierCollection = collectionProtocol.getConsentTierCollection();
			Iterator consentTierItr = consentTierCollection.iterator();
			while(consentTierItr.hasNext())
			{
				ConsentTier consentTier = (ConsentTier)consentTierItr.next();
				ConsentTierResponse consentResponse = new ConsentTierResponse();
				consentResponse.setConsentTier(consentTier);
				consentResponse.setResponse("Yes");
				consentTierResponseCollection.add(consentResponse);
			}
			collectionProtocolRegistration.setConsentTierResponseCollection(consentTierResponseCollection);
			try
		  {
			collectionProtocolRegistration = (CollectionProtocolRegistration) appService.createObject(collectionProtocolRegistration);
			assertFalse("Shouldnot create object", true);

		 }
		 catch(Exception e)
		 {
		 	 e.printStackTrace();
			 assertTrue("Participant with same medical identifier ia already present", true);
		 }
	}

	public void testParticipantRegistrationWithUniquePPI()
	{

		Participant participant= BaseTestCaseUtility.initParticipant();
		try{
			participant = (Participant) appService.createObject(participant);
		 }
		 	catch(Exception e){
			 e.printStackTrace();
			 assertFalse(e.getMessage(), true);
		 }
			CollectionProtocolRegistration collectionProtocolRegistration = new CollectionProtocolRegistration();

			CollectionProtocol collectionProtocol =(CollectionProtocol)BizTestCaseUtility.getObjectMap(CollectionProtocol.class);
			collectionProtocolRegistration.setCollectionProtocol(collectionProtocol);

			collectionProtocolRegistration.setParticipant(participant);

			collectionProtocolRegistration.setProtocolParticipantIdentifier("123");
			collectionProtocolRegistration.setActivityStatus("Active");
			try
			{
				collectionProtocolRegistration.setRegistrationDate(Utility.parseDate("08/15/1975",
						Utility.datePattern("08/15/1975")));
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}

			//Setting Consent Tier Responses.
			try
			{
				collectionProtocolRegistration.setConsentSignatureDate(Utility.parseDate("11/23/2006",Utility.datePattern("11/23/2006")));
			}
			catch (ParseException e)
			{
				e.printStackTrace();
			}
			collectionProtocolRegistration.setSignedConsentDocumentURL("F:/doc/consentDoc.doc");
			User user = (User)BizTestCaseUtility.getObjectMap(User.class);
			collectionProtocolRegistration.setConsentWitness(user);

			Collection consentTierResponseCollection = new HashSet();
			Collection consentTierCollection = collectionProtocol.getConsentTierCollection();
			Iterator consentTierItr = consentTierCollection.iterator();
			while(consentTierItr.hasNext())
			{
				ConsentTier consentTier = (ConsentTier)consentTierItr.next();
				ConsentTierResponse consentResponse = new ConsentTierResponse();
				consentResponse.setConsentTier(consentTier);
				consentResponse.setResponse("Yes");
				consentTierResponseCollection.add(consentResponse);
			}
			collectionProtocolRegistration.setConsentTierResponseCollection(consentTierResponseCollection);
			try
		  {
			collectionProtocolRegistration = (CollectionProtocolRegistration) appService.createObject(collectionProtocolRegistration);

		 }
		 catch(Exception e)
		 {
		 	 e.printStackTrace();
			 assertFalse(e.getMessage(), true);
		 }
	}

	public void testParticipantRegistrationWithDuplicatePPI()
	{

		Participant participant= BaseTestCaseUtility.initParticipant();
		try{
			participant = (Participant) appService.createObject(participant);
		 }
		 	catch(Exception e){
			 e.printStackTrace();
			 assertFalse(e.getMessage(), true);
		 }
			CollectionProtocolRegistration collectionProtocolRegistration = new CollectionProtocolRegistration();

			CollectionProtocol collectionProtocol =(CollectionProtocol)BizTestCaseUtility.getObjectMap(CollectionProtocol.class);
			collectionProtocolRegistration.setCollectionProtocol(collectionProtocol);

			collectionProtocolRegistration.setParticipant(participant);

			collectionProtocolRegistration.setProtocolParticipantIdentifier("123");
			collectionProtocolRegistration.setActivityStatus("Active");
			try
			{
				collectionProtocolRegistration.setRegistrationDate(Utility.parseDate("08/15/1975",
						Utility.datePattern("08/15/1975")));
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}

			//Setting Consent Tier Responses.
			try
			{
				collectionProtocolRegistration.setConsentSignatureDate(Utility.parseDate("11/23/2006",Utility.datePattern("11/23/2006")));
			}
			catch (ParseException e)
			{
				e.printStackTrace();
			}
			collectionProtocolRegistration.setSignedConsentDocumentURL("F:/doc/consentDoc.doc");
			User user = (User)BizTestCaseUtility.getObjectMap(User.class);
			collectionProtocolRegistration.setConsentWitness(user);

			Collection consentTierResponseCollection = new HashSet();
			Collection consentTierCollection = collectionProtocol.getConsentTierCollection();
			Iterator consentTierItr = consentTierCollection.iterator();
			while(consentTierItr.hasNext())
			{
				ConsentTier consentTier = (ConsentTier)consentTierItr.next();
				ConsentTierResponse consentResponse = new ConsentTierResponse();
				consentResponse.setConsentTier(consentTier);
				consentResponse.setResponse("Yes");
				consentTierResponseCollection.add(consentResponse);
			}
			collectionProtocolRegistration.setConsentTierResponseCollection(consentTierResponseCollection);
			try
		  {
			collectionProtocolRegistration = (CollectionProtocolRegistration) appService.createObject(collectionProtocolRegistration);
			assertFalse("Failed to create CPR with duplicate PPI", true);
		 }
		 catch(Exception e)
		 {
			 Logger.out.error(e.getMessage(),e);
		 	 e.printStackTrace();
			 assertTrue("should not not create object", true);
		 }
	}

	public void testUpdateParticipantWithoutCollectionProtocol()
	{
		try
		{
			Participant participant=new Participant();
			participant.setFirstName("fisrtname"+UniqueKeyGeneratorUtil.getUniqueKey());
			participant.setLastName("lastName"+UniqueKeyGeneratorUtil.getUniqueKey());
			participant.setActivityStatus("Active");

			Collection participantMedicalIdentifierCollection = new HashSet();
			participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
			participant=(Participant)appService.createObject(participant);
			participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
			participant=(Participant) appService.updateObject(participant);
			assertTrue("Participant wihtout CPR updated successfully ", true);
		}
		catch (Exception e) {
			System.out.println(e.getMessage());
			assertFalse(e.getMessage(), true);
		}

	}

	public void testUpdateParticipantWithPMI()
	{
		try
		{
			Participant participant=new Participant();
			participant.setFirstName("fisrtname"+UniqueKeyGeneratorUtil.getUniqueKey());
			participant.setLastName("lastName"+UniqueKeyGeneratorUtil.getUniqueKey());
			participant.setActivityStatus("Active");

//			Collection participantMedicalIdentifierCollection1 = new HashSet();
//			participant.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection1);
			participant=(Participant)appService.createObject(participant);

			System.out.println("participant without PMI created !!! "+participant.getId());

			Participant participant2=new Participant();
			participant2.setId(participant.getId());

			String query = "from edu.wustl.catissuecore.domain.Participant as participant where "
 				+ "participant.id="+participant.getId();
        	 List resultList = appService.search(query);
        	 for (Iterator resultsIterator = resultList.iterator(); resultsIterator.hasNext();) {
        		  participant2 = (Participant) resultsIterator.next();
        	 }
        	 System.out.println("participant2 without PMI searched !!! "+participant2.getId());

			//participant2=(Participant)appService.search(Participant.class, participant2).iterator().next();

			Collection participantMedicalIdentifierCollection = new HashSet();
			ParticipantMedicalIdentifier pmi = new ParticipantMedicalIdentifier();
			Site site =(Site)  BizTestCaseUtility.getObjectMap(Site.class);
			pmi.setSite(site);

			System.out.println("Site is "+site.getName());
			String mrn="mrn"+UniqueKeyGeneratorUtil.getUniqueKey();
			pmi.setMedicalRecordNumber(mrn);
			pmi.setParticipant(participant2);
			participantMedicalIdentifierCollection.add(pmi);
			participant2.setParticipantMedicalIdentifierCollection(participantMedicalIdentifierCollection);
			participant2=(Participant) appService.updateObject(participant2);
			System.out.println("participant2 with PMI updated !!! "+participant2.getId());

			Participant participant3=new Participant();
			participant3.setId(participant.getId());

			 query = "from edu.wustl.catissuecore.domain.Participant as participant where "
 				+ "participant.id="+participant.getId();
        	  resultList = appService.search(query);
        	 for (Iterator resultsIterator = resultList.iterator(); resultsIterator.hasNext();) {
        		  participant3 = (Participant) resultsIterator.next();
        	 }
        	 System.out.println("participant3 with PMI searched !!! "+participant3.getId());
			//participant3=(Participant)appService.search(Participant.class, participant3).iterator().next();

			Collection pmiCollection=participant3.getParticipantMedicalIdentifierCollection();
			if(!pmiCollection.isEmpty())
			{
				Iterator<ParticipantMedicalIdentifier> pmiIterator=  pmiCollection.iterator();

				while(pmiIterator.hasNext())
				{
					ParticipantMedicalIdentifier pmIdentifier=pmiIterator.next();

					if(pmIdentifier.getMedicalRecordNumber()!=null&&pmIdentifier.getSite().getId()!=null)
					{
						if(pmIdentifier.getMedicalRecordNumber().equals(mrn)&&pmIdentifier.getSite().getId().equals(site.getId()))
						{

							System.out.println("Succecfully updated");
							System.out.println("participant3 PMI's !!! "+pmIdentifier.getId());
							assertTrue("Participant wiht medical identifier updated successfully ", true);

						}
					}
				}
			}
			System.out.println("participant3 with PMI searched  successs !!! "+participant3.getId());
		}
		catch (Exception e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
			assertFalse(e.getMessage(), true);

		}

	}

	public void testGetParticipantById()
	{
		try
		{
			ParticipantBizLogic participantBizLogic = new ParticipantBizLogic();
			Participant participant = (Participant)BizTestCaseUtility.getObjectMap(Participant.class);
			participantBizLogic.getParticipantById(participant.getId());
		}
		catch(Exception e)
		{
			System.out.println(e.getMessage());
			e.printStackTrace();
			assertFalse(e.getMessage(), true);
		}

	}
	public void testGetColumnList()
	{
		try
		{
			ParticipantBizLogic participantBizLogic = new ParticipantBizLogic();
			Participant participant = (Participant)BizTestCaseUtility.getObjectMap(Participant.class);
			List<String> colList = new ArrayList<String>();
			colList.add(Constants.PARTICIPANT_MEDICAL_RECORD_NO);
			List mrnList = participantBizLogic.getColumnList(colList,new StringBuffer());
		}
		catch(Exception e)
		{
			System.out.println(e.getMessage());
			e.printStackTrace();
			assertFalse(e.getMessage(), true);
		}

	}
}


text:
package alien4cloud.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import alien4cloud.model.components.DeploymentArtifact;

public class InputArtifactUtil {

    public static final String INPUT_ARTIFACT_FN_NAME = "get_input_artifact";

    private static final Pattern P = Pattern.compile("\\{\\s*" + INPUT_ARTIFACT_FN_NAME + ":\\s*(\\w+)\\s*\\}");

    private InputArtifactUtil() {
        super();
    }

    public static void updateInputArtifactIdIfNeeded(DeploymentArtifact dArtifact, String oldInputArtifactId, String newInputArtifactId) {
        Matcher m = P.matcher(dArtifact.getArtifactRef());
        if (m.matches() && m.group(1).equals(oldInputArtifactId)) {
            dArtifact.setArtifactRef("{ " + INPUT_ARTIFACT_FN_NAME + ": " + newInputArtifactId + " }");
        }
    }

    public static void setInputArtifact(DeploymentArtifact dArtifact, String artifactId) {
        dArtifact.setArtifactRef("{ " + INPUT_ARTIFACT_FN_NAME + ": " + artifactId + " }");
        dArtifact.setArtifactName(null);
    }

    public static void unsetInputArtifact(DeploymentArtifact dArtifact) {
        dArtifact.setArtifactRef(null);
        dArtifact.setArtifactName(null);
    }

    /**
     * @return the id of the related input artifact or null if this {@link DeploymentArtifact} is not related to an input artifact.
     */
    public static String getInputArtifactId(DeploymentArtifact dArtifact) {
        Matcher m = P.matcher(dArtifact.getArtifactRef());
        if (m.matches()) {
            return m.group(1);
        }
        return null;
    }

}


text: {{::item}}


text:
using System;
using System.Data;

namespace Mashup.Api.AuthADSP.HelperClasses
{

    /// <summary>
    /// Helper class for when dealing with Null values.
    /// </summary>
    public static class NullHelper
    {

        // ----------------------------------------------------------------------------------------------------------------
        // These are null helpers for TryParse which doesn't seem to understand nullable types.
        // ----------------------------------------------------------------------------------------------------------------

        // Returns null if the string cannot be parsed to int, otherwise returns the parsed value.
        public static int? ToNullableInt32(string s)
        {
            int i;
            if (Int32.TryParse(s, out i)) return i;
            return null;
        }
        // Returns null if the string cannot be parsed to bool, otherwise returns the parsed value.
        public static bool? ToNullableBool(string s)
        {
            bool i;
            if (bool.TryParse(s, out i)) return i;
            return null;
        }

        // Returns a null value if the string equals "null" or if the string cannot be parsed to int.
        public static int? FromStringNullToInt32(string s)
        {
            if (s == "null")
            { return null; }
            else
            {
                // Verify the string is an int.

                return ToNullableInt32(s);
            }
        }

        public static bool? FromStringNullToBool(string s)
        {
            if (s == "null")
            { return null; }
            else
            {
                // Verify the string is an int.

                return ToNullableBool(s);
            }
        }

        public static string FromStringNullToString(string s)
        {
            if (s == "null")
            { return null; }
            else
            {
                // Verify the string is an int.

                return s;
            }
        }

        // ----------------------------------------------------------------------------------------------------------------
        // These are null helpers for data readers.
        // ----------------------------------------------------------------------------------------------------------------
        public static DateTime GetDateFromReader(IDataRecord reader, string field, int? toLocalOffsetMinutes)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                DateTime date = reader.GetDateTime(index);

                if (toLocalOffsetMinutes != null)
                { date = GMT.GmtToLocal(date, (int)toLocalOffsetMinutes); }

                return date;
            }

            return DateTime.MinValue;
        }
        public static DateTime? GetDateFromReaderNullable(IDataRecord reader, string field, int? toLocalOffsetMinutes)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                DateTime date = reader.GetDateTime(index);

                if (toLocalOffsetMinutes != null)
                { date = GMT.GmtToLocal(date, (int)toLocalOffsetMinutes); }

                return date;
            }

            return null;
        }

        public static decimal GetDecimalFromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {   // The G29 string formate removes trailing zeros for decimals.
                // IE "1.1000" would become "1.1"
                decimal returnValue = reader.GetDecimal(index);
                return Convert.ToDecimal(returnValue.ToString("G29"));
            }

            return 0m;
        }

        public static Int16 GetInt16FromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                return reader.GetInt16(index);
            }

            return 0;
        }

        public static Int32 GetInt32FromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                return reader.GetInt32(index);
            }

            return 0;
        }
        public static Int32? GetInt32FromReaderNullable(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                return reader.GetInt32(index);
            }

            return null;
        }

        public static Int64 GetInt64FromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            { return reader.GetInt64(index); }

            return 0;
        }

        public static string GetStringFromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                //return reader.GetString(index).TrimEnd();
                return reader[index].ToString();
            }

            return String.Empty;
        }

        public static float GetFloatFromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            {
                float temp;
                float.TryParse(reader[index].ToString(), out temp);
                return temp;
            }
            //{ return reader.GetFloat(index); }

            return 0f;
        }
        public static bool GetBooleanFromReader(IDataRecord reader, string field)
        {
            int index = reader.GetOrdinal(field);

            if (!reader.IsDBNull(index))
            { return reader.GetBoolean(index); }

            return false;
        }

    }
}


text:
package core.server.command;

import core.server.session.Session;
import core.server.session.SessionAuthType;
import core.server.session.SessionStageLevel;
import core.server.toolbox.ListLoginParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Send message.
 * <pre>
 *     OpCode: msg_user
 *     Args  : 1. login or list of login
 *             2. msg (hard-coded)
 *             3. the message to send (URL encoded)
 * </pre>
 *
 * @author Thibault Meyer
 * @version 1.1.0
 * @since 1.0.0
 */
public class MsgUserCommandImpl implements Command {

    /**
     * Logger.
     *
     * @since 1.0.0
     */
    private static final Logger LOG = LoggerFactory.getLogger(MsgUserCommandImpl.class.getName());

    /**
     * Get the minimal number of arguments needed. The command OpCode is
     * included in the number of arguments.
     *
     * @return The minimal number of arguments needed
     * @since 1.0.0
     */
    public int getMinimalArgsCountNeeded() {
        return 3;
    }

    /**
     * Get the maximal number of arguments needed. The command OpCode is
     * included in the number of arguments. If this method return -1, the
     * command can take any number of arguments.
     *
     * @return The maximal number of arguments needed
     * @since 1.0.0
     */
    public int getMaximalArgsCountNeeded() {
        return -1;
    }

    /**
     * Get the type of this command.
     *
     * @return The command type
     * @since 1.0.0
     */
    @Override
    public CmdType getType() {
        return CmdType.COMMAND;
    }

    /**
     * Check if this command can by executed by this user session.
     *
     * @param usrSession The current user session
     * @return {@code true} is the command can be executed, otherwise, {@code false}
     * @since 1.1.0
     */
    @Override
    public boolean canExecute(final Session usrSession) {
        return usrSession.stageLevel == SessionStageLevel.AUTHENTICATED;
    }

    /**
     * Execute the command. The first entry (0) of the payload always
     * contain the command OpCode.
     *
     * @param payload           The command arguments
     * @param usrSession        The user session who call this command
     * @param connectedSessions The collection of connected sessions
     * @param globalFollowers   The map of all followers
     * @throws IndexOutOfBoundsException if payload don't contain enough arguments
     * @since 1.0.0
     */
    @Override
    public void execute(final String[] payload, final Session usrSession, final Collection<Session> connectedSessions, final Map<String, List<Session>> globalFollowers) throws ArrayIndexOutOfBoundsException {
        final List<Session> lstSessDest = ListLoginParser.parseToSession(payload[1], connectedSessions);
        final String cmdHeader = String.format("%s %d:user:%d/%d:%s@%s:%s:%s:ext",
                (usrSession.authType == SessionAuthType.EXTERNAL_AUTHENTICATION) ? "user_cmd" : "cmd",
                usrSession.network.fd,
                usrSession.user.trustLevelClient,
                usrSession.user.trustLevelUser,
                usrSession.user.login,
                usrSession.network.ip,
                usrSession.user.operatingSystem,
                usrSession.user.location);
        for (final Session s : lstSessDest) {
            if (payload[2].compareToIgnoreCase("msg") == 0 && payload.length >= 3) {
                if (LOG.isTraceEnabled()) {
                    LOG.trace(String.format("Client from %s (%s) send message to %s (%s): %s",
                            usrSession.network.address,
                            usrSession.user.login,
                            s.network.address,
                            s.user.login,
                            payload[3]
                    ));
                }
                final String cmdFormat = String.format("%s | msg %s\n", cmdHeader, payload[3]);
                s.addOutputDataAsChunk(cmdFormat);
            } else {
                String data = "";
                for (int i = 3; i < payload.length; ++i) {
                    data = " " + payload[i];
                }
                final String cmdFormat = String.format("%s | %s%s\n", cmdHeader, payload[2], data);
                s.addOutputDataAsChunk(cmdFormat);
            }
            s.network.registerWriteEvent();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="20dp"
    android:orientation="horizontal"
    android:minHeight="?android:attr/listPreferredItemHeight"
    >

    <ImageView
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_gravity="center_vertical"
        android:src="@drawable/play"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:id="@+id/tv_trailer_name"
        />

</LinearLayout>


text:
namespace syncer {
class SyncChange;
}

namespace dom_distiller {

typedef sync_pb::ArticleSpecifics ArticleEntry;
typedef sync_pb::ArticlePage ArticleEntryPage;

// A valid entry has an entry_id and all its pages have a URL.
bool IsEntryValid(const ArticleEntry& entry);

bool AreEntriesEqual(const ArticleEntry& left, const ArticleEntry& right);

sync_pb::EntitySpecifics SpecificsFromEntry(const ArticleEntry& entry);
ArticleEntry EntryFromSpecifics(const sync_pb::EntitySpecifics& specifics);

ArticleEntry GetEntryFromChange(const syncer::SyncChange& change);
std::string GetEntryIdFromSyncData(const syncer::SyncData& data);
syncer::SyncData CreateLocalData(const ArticleEntry& entry);

}  // namespace dom_distiller

#endif  // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ENTRY_H_


text:
<?php

class Mage_Adminhtml_Promo_WidgetController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Prepare block for chooser
     *
     * @return void
     */
    public function chooserAction()
    {
        $request = $this->getRequest();

        switch ($request->getParam('attribute')) {
            case 'sku':
                $block = $this->getLayout()->createBlock(
                    'adminhtml/promo_widget_chooser_sku', 'promo_widget_chooser_sku',
                    array('js_form_object' => $request->getParam('form'),
                ));
                break;

            case 'category_ids':
                $ids = $request->getParam('selected', array());
                if (is_array($ids)) {
                    foreach ($ids as $key => &$id) {
                        $id = (int) $id;
                        if ($id <= 0) {
                            unset($ids[$key]);
                        }
                    }

                    $ids = array_unique($ids);
                } else {
                    $ids = array();
                }

                $block = $this->getLayout()->createBlock(
                        'adminhtml/catalog_category_checkboxes_tree', 'promo_widget_chooser_category_ids',
                        array('js_form_object' => $request->getParam('form'))
                    )
                    ->setCategoryIds($ids)
                ;
                break;

            default:
                $block = false;
                break;
        }

        if ($block) {
            $this->getResponse()->setBody($block->toHtml());
        }
    }

    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('promo/catalog');
    }

    /**
     * Get tree node (Ajax version)
     */
    public function categoriesJsonAction()
    {
        if ($categoryId = (int) $this->getRequest()->getPost('id')) {
            $this->getRequest()->setParam('id', $categoryId);

            if (!$category = $this->_initCategory()) {
                return;
            }
            $this->getResponse()->setBody(
                $this->getLayout()->createBlock('adminhtml/catalog_category_tree')
                    ->getTreeJson($category)
            );
        }
    }

    /**
     * Initialize category object in registry
     *
     * @return Mage_Catalog_Model_Category
     */
    protected function _initCategory()
    {
        $categoryId = (int) $this->getRequest()->getParam('id',false);
        $storeId    = (int) $this->getRequest()->getParam('store');

        $category   = Mage::getModel('catalog/category');
        $category->setStoreId($storeId);

        if ($categoryId) {
            $category->load($categoryId);
            if ($storeId) {
                $rootId = Mage::app()->getStore($storeId)->getRootCategoryId();
                if (!in_array($rootId, $category->getPathIds())) {
                    $this->_redirect('*/*/', array('_current'=>true, 'id'=>null));
                    return false;
                }
            }
        }

        Mage::register('category', $category);
        Mage::register('current_category', $category);

        return $category;
    }
}


text:
<!DOCTYPE HTML>

<META content="text/html">
<TITLE>Mezzanine Boards Template</TITLE>

96Boards

Mezzanine Board Template

This is a project template for developing a 96Boards Mezzanine board (compatible with these boards).

This project's schematic only contains the necessary connectors needed for a mezzanine board. The current connectors are surface mounted, which can be easily changed to through hole. This is noted in the schematic.

The PCB includes the connectors, and mounting holes. The connectors and holes have been positioned so that the boards are aligned when mounted. The edge cuts also aligns with the base board. All the mezzanine board IO is connected to the header pins.

The board outline looks like the following:

Copyright (c) 2016, Linaro, Inc.


text:
#include "fsl_adc16.h"

/*******************************************************************************
 * Prototypes
 ******************************************************************************/
/*!
 * @brief Get instance number for ADC16 module.
 *
 * @param base ADC16 peripheral base address
 */
static uint32_t ADC16_GetInstance(ADC_Type *base);

/*******************************************************************************
 * Variables
 ******************************************************************************/
/*! @brief Pointers to ADC16 bases for each instance. */
static ADC_Type *const s_adc16Bases[] = ADC_BASE_PTRS;

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
/*! @brief Pointers to ADC16 clocks for each instance. */
static const clock_ip_name_t s_adc16Clocks[] = ADC16_CLOCKS;
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */

/*******************************************************************************
 * Code
 ******************************************************************************/
static uint32_t ADC16_GetInstance(ADC_Type *base)
{
    uint32_t instance;

    /* Find the instance index from base address mappings. */
    for (instance = 0; instance < ARRAY_SIZE(s_adc16Bases); instance++)
    {
        if (s_adc16Bases[instance] == base)
        {
            break;
        }
    }

    assert(instance < ARRAY_SIZE(s_adc16Bases));

    return instance;
}

void ADC16_Init(ADC_Type *base, const adc16_config_t *config)
{
    assert(NULL != config);

    uint32_t tmp32;

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
    /* Enable the clock. */
    CLOCK_EnableClock(s_adc16Clocks[ADC16_GetInstance(base)]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */

    /* ADCx_CFG1. */
    tmp32 = ADC_CFG1_ADICLK(config->clockSource) | ADC_CFG1_MODE(config->resolution);
    if (kADC16_LongSampleDisabled != config->longSampleMode)
    {
        tmp32 |= ADC_CFG1_ADLSMP_MASK;
    }
    tmp32 |= ADC_CFG1_ADIV(config->clockDivider);
    if (config->enableLowPower)
    {
        tmp32 |= ADC_CFG1_ADLPC_MASK;
    }
    base->CFG1 = tmp32;

    /* ADCx_CFG2. */
    tmp32 = base->CFG2 & ~(ADC_CFG2_ADACKEN_MASK | ADC_CFG2_ADHSC_MASK | ADC_CFG2_ADLSTS_MASK);
    if (kADC16_LongSampleDisabled != config->longSampleMode)
    {
        tmp32 |= ADC_CFG2_ADLSTS(config->longSampleMode);
    }
    if (config->enableHighSpeed)
    {
        tmp32 |= ADC_CFG2_ADHSC_MASK;
    }
    if (config->enableAsynchronousClock)
    {
        tmp32 |= ADC_CFG2_ADACKEN_MASK;
    }
    base->CFG2 = tmp32;

    /* ADCx_SC2. */
    tmp32 = base->SC2 & ~(ADC_SC2_REFSEL_MASK);
    tmp32 |= ADC_SC2_REFSEL(config->referenceVoltageSource);
    base->SC2 = tmp32;

    /* ADCx_SC3. */
    if (config->enableContinuousConversion)
    {
        base->SC3 |= ADC_SC3_ADCO_MASK;
    }
    else
    {
        base->SC3 &= ~ADC_SC3_ADCO_MASK;
    }
}

void ADC16_Deinit(ADC_Type *base)
{
#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
    /* Disable the clock. */
    CLOCK_DisableClock(s_adc16Clocks[ADC16_GetInstance(base)]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
}

void ADC16_GetDefaultConfig(adc16_config_t *config)
{
    assert(NULL != config);

    config->referenceVoltageSource = kADC16_ReferenceVoltageSourceVref;
    config->clockSource = kADC16_ClockSourceAsynchronousClock;
    config->enableAsynchronousClock = true;
    config->clockDivider = kADC16_ClockDivider8;
    config->resolution = kADC16_ResolutionSE12Bit;
    config->longSampleMode = kADC16_LongSampleDisabled;
    config->enableHighSpeed = false;
    config->enableLowPower = false;
    config->enableContinuousConversion = false;
}

#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
status_t ADC16_DoAutoCalibration(ADC_Type *base)
{
    bool bHWTrigger = false;
    volatile uint32_t tmp32; /* 'volatile' here is for the dummy read of ADCx_R[0] register. */
    status_t status = kStatus_Success;

    /* The calibration would be failed when in hardwar mode.
     * Remember the hardware trigger state here and restore it later if the hardware trigger is enabled.*/
    if (0U != (ADC_SC2_ADTRG_MASK & base->SC2))
    {
        bHWTrigger = true;
        base->SC2 &= ~ADC_SC2_ADTRG_MASK;
    }

    /* Clear the CALF and launch the calibration. */
    base->SC3 |= ADC_SC3_CAL_MASK | ADC_SC3_CALF_MASK;
    while (0U == (kADC16_ChannelConversionDoneFlag & ADC16_GetChannelStatusFlags(base, 0U)))
    {
        /* Check the CALF when the calibration is active. */
        if (0U != (kADC16_CalibrationFailedFlag & ADC16_GetStatusFlags(base)))
        {
            status = kStatus_Fail;
            break;
        }
    }
    tmp32 = base->R[0]; /* Dummy read to clear COCO caused by calibration. */

    /* Restore the hardware trigger setting if it was enabled before. */
    if (bHWTrigger)
    {
        base->SC2 |= ADC_SC2_ADTRG_MASK;
    }
    /* Check the CALF at the end of calibration. */
    if (0U != (kADC16_CalibrationFailedFlag & ADC16_GetStatusFlags(base)))
    {
        status = kStatus_Fail;
    }
    if (kStatus_Success != status) /* Check if the calibration process is succeed. */
    {
        return status;
    }

    /* Calculate the calibration values. */
    tmp32 = base->CLP0 + base->CLP1 + base->CLP2 + base->CLP3 + base->CLP4 + base->CLPS;
    tmp32 = 0x8000U | (tmp32 >> 1U);
    base->PG = tmp32;

#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE
    tmp32 = base->CLM0 + base->CLM1 + base->CLM2 + base->CLM3 + base->CLM4 + base->CLMS;
    tmp32 = 0x8000U | (tmp32 >> 1U);
    base->MG = tmp32;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */

    return kStatus_Success;
}
#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */

#if defined(FSL_FEATURE_ADC16_HAS_MUX_SELECT) && FSL_FEATURE_ADC16_HAS_MUX_SELECT
void ADC16_SetChannelMuxMode(ADC_Type *base, adc16_channel_mux_mode_t mode)
{
    if (kADC16_ChannelMuxA == mode)
    {
        base->CFG2 &= ~ADC_CFG2_MUXSEL_MASK;
    }
    else /* kADC16_ChannelMuxB. */
    {
        base->CFG2 |= ADC_CFG2_MUXSEL_MASK;
    }
}
#endif /* FSL_FEATURE_ADC16_HAS_MUX_SELECT */

void ADC16_SetHardwareCompareConfig(ADC_Type *base, const adc16_hardware_compare_config_t *config)
{
    uint32_t tmp32 = base->SC2 & ~(ADC_SC2_ACFE_MASK | ADC_SC2_ACFGT_MASK | ADC_SC2_ACREN_MASK);

    if (!config) /* Pass "NULL" to disable the feature. */
    {
        base->SC2 = tmp32;
        return;
    }
    /* Enable the feature. */
    tmp32 |= ADC_SC2_ACFE_MASK;

    /* Select the hardware compare working mode. */
    switch (config->hardwareCompareMode)
    {
        case kADC16_HardwareCompareMode0:
            break;
        case kADC16_HardwareCompareMode1:
            tmp32 |= ADC_SC2_ACFGT_MASK;
            break;
        case kADC16_HardwareCompareMode2:
            tmp32 |= ADC_SC2_ACREN_MASK;
            break;
        case kADC16_HardwareCompareMode3:
            tmp32 |= ADC_SC2_ACFGT_MASK | ADC_SC2_ACREN_MASK;
            break;
        default:
            break;
    }
    base->SC2 = tmp32;

    /* Load the compare values. */
    base->CV1 = ADC_CV1_CV(config->value1);
    base->CV2 = ADC_CV2_CV(config->value2);
}

#if defined(FSL_FEATURE_ADC16_HAS_HW_AVERAGE) && FSL_FEATURE_ADC16_HAS_HW_AVERAGE
void ADC16_SetHardwareAverage(ADC_Type *base, adc16_hardware_average_mode_t mode)
{
    uint32_t tmp32 = base->SC3 & ~(ADC_SC3_AVGE_MASK | ADC_SC3_AVGS_MASK);

    if (kADC16_HardwareAverageDisabled != mode)
    {
        tmp32 |= ADC_SC3_AVGE_MASK | ADC_SC3_AVGS(mode);
    }
    base->SC3 = tmp32;
}
#endif /* FSL_FEATURE_ADC16_HAS_HW_AVERAGE */

#if defined(FSL_FEATURE_ADC16_HAS_PGA) && FSL_FEATURE_ADC16_HAS_PGA
void ADC16_SetPGAConfig(ADC_Type *base, const adc16_pga_config_t *config)
{
    uint32_t tmp32;

    if (!config) /* Passing "NULL" is to disable the feature. */
    {
        base->PGA = 0U;
        return;
    }

    /* Enable the PGA and set the gain value. */
    tmp32 = ADC_PGA_PGAEN_MASK | ADC_PGA_PGAG(config->pgaGain);

    /* Configure the misc features for PGA. */
    if (config->enableRunInNormalMode)
    {
        tmp32 |= ADC_PGA_PGALPb_MASK;
    }
#if defined(FSL_FEATURE_ADC16_HAS_PGA_CHOPPING) && FSL_FEATURE_ADC16_HAS_PGA_CHOPPING
    if (config->disablePgaChopping)
    {
        tmp32 |= ADC_PGA_PGACHPb_MASK;
    }
#endif /* FSL_FEATURE_ADC16_HAS_PGA_CHOPPING */
#if defined(FSL_FEATURE_ADC16_HAS_PGA_OFFSET_MEASUREMENT) && FSL_FEATURE_ADC16_HAS_PGA_OFFSET_MEASUREMENT
    if (config->enableRunInOffsetMeasurement)
    {
        tmp32 |= ADC_PGA_PGAOFSM_MASK;
    }
#endif /* FSL_FEATURE_ADC16_HAS_PGA_OFFSET_MEASUREMENT */
    base->PGA = tmp32;
}
#endif /* FSL_FEATURE_ADC16_HAS_PGA */

uint32_t ADC16_GetStatusFlags(ADC_Type *base)
{
    uint32_t ret = 0;

    if (0U != (base->SC2 & ADC_SC2_ADACT_MASK))
    {
        ret |= kADC16_ActiveFlag;
    }
#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
    if (0U != (base->SC3 & ADC_SC3_CALF_MASK))
    {
        ret |= kADC16_CalibrationFailedFlag;
    }
#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */
    return ret;
}

void ADC16_ClearStatusFlags(ADC_Type *base, uint32_t mask)
{
#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
    if (0U != (mask & kADC16_CalibrationFailedFlag))
    {
        base->SC3 |= ADC_SC3_CALF_MASK;
    }
#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */
}

void ADC16_SetChannelConfig(ADC_Type *base, uint32_t channelGroup, const adc16_channel_config_t *config)
{
    assert(channelGroup < ADC_SC1_COUNT);
    assert(NULL != config);

    uint32_t sc1 = ADC_SC1_ADCH(config->channelNumber); /* Set the channel number. */

#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE
    /* Enable the differential conversion. */
    if (config->enableDifferentialConversion)
    {
        sc1 |= ADC_SC1_DIFF_MASK;
    }
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */
    /* Enable the interrupt when the conversion is done. */
    if (config->enableInterruptOnConversionCompleted)
    {
        sc1 |= ADC_SC1_AIEN_MASK;
    }
    base->SC1[channelGroup] = sc1;
}

uint32_t ADC16_GetChannelStatusFlags(ADC_Type *base, uint32_t channelGroup)
{
    assert(channelGroup < ADC_SC1_COUNT);

    uint32_t ret = 0U;

    if (0U != (base->SC1[channelGroup] & ADC_SC1_COCO_MASK))
    {
        ret |= kADC16_ChannelConversionDoneFlag;
    }
    return ret;
}