text:
/*
 * Build Report JavaScript library
 *
 * The build reports use HTML visibility settings to hide and show errors and
 * messages from the build reports.  The functions specified in this file
 * perform the visibility actions required for this.
 *
 * @author Shawn Stafford
 */

/**
 * Toggle the visibility of the element using the stylesheet
 * visibility attribute.
 *
 * @param   elementId     Unique id of an HTML element
 */
function toggleElement(elementId) {
    if (isVisible(elementId)) {
        hide(elementId);
    } else {
		show(elementId);
    }
}

/**
 * Display the HTML element to the user
 *
 * @param   elementId     Unique id of an HTML element
 */
function show(elementId) {
    getStyleReference(elementId).display="";
}

/**
 * Hide the HTML element from the user
 *
 * @param   elementId     Unique id of an HTML element
 */
function hide(elementId) {
    getStyleReference(elementId).display="none";
}

/**
 * Return a browser-independent reference to the HTML element.
 *
 * @param    elementId     Unique id of an HTML element
 * @return   A document reference to the element
 */
function getElementReference(elementId) {
    var value=false;

    if(document.layers) {
        value=document.layers[elementId];
    } else {
        if(document.all) {
            value = document.all[elementId];
        } else if(document.getElementById) {
            value = document.getElementById(elementId);
        }
    }

    return value;
}

/**
 * Return a browser-independent reference to the HTML element.
 *
 * @param    elementId     Unique id of an HTML element
 * @return   A document reference to the element
 */
function getStyleReference(elementId) {
    var value=false;

    if(getElementReference(elementId)) {
        value=getElementReference(elementId);
        if(!document.layers) {
            value=value.style;
        }
    }

    return value;
}

/**
 * Return the stylesheet visibility value of the element.
 *
 * @param    elementId     Unique id of an HTML element
 * @return   The visibility value of the element
 */
function isVisible(elementId) {
    var vis = getStyleReference(elementId).display;

    return !(vis == "none");
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">PreviewOCR</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world!</string>

</resources>

redpajama_set_name: RedPajamaGithub


text:
DISK="/dev/sdc"
DEVICE="/dev/sdc1"
MOUNTPOINT="/datadisks/disk1"

echo "Partitioning the disk."
echo "n
p
1

t
83
w"| fdisk ${DISK}

echo "Creating the filesystem."
mkfs -j -t ext4 ${DEVICE}

echo "Updating fstab"
LINE="${DEVICE}\t${MOUNTPOINT}\text4\tnoatime,nodiratime,nodev,noexec,nosuid\t1\t2"
echo -e ${LINE} >> /etc/fstab

echo "Mounting the disk"
mkdir -p ${MOUNTPOINT}
mount ${MOUNTPOINT}


text:
"""Add moteur to roles

Revision ID: 4e62a5e5f592
Revises: 42e1b5e7b295
Create Date: 2015-05-27 16:08:49.275230

"""

# revision identifiers, used by Alembic.
revision = '4e62a5e5f592'
down_revision = '42e1b5e7b295'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table, column
from sqlalchemy import String, Integer

role_table = table('role',
        column('id', Integer),
        column('name', String)
        )

def upgrade():
    op.bulk_insert(role_table, [{"name": "moteur"}])

def downgrade():
    pass


text:
class DistributionMailerPreview < ActionMailer::Preview
  def partner_mailer
    DistributionMailer.partner_mailer(Organization.first, Distribution.last, 'Your Distribution', {})
  end

  def reminder_email
    DistributionMailer.reminder_email(Distribution.last.id)
  end
end


text: * http://venturebeat.com/2015/06/15/githubs-next-funding-round-could-value-it-at-2b/


text:
https://github.com/influxdb/influxdb

Scalable datastore for metrics, events, and real-time analytics http://influxdb.com

An Open-Source, Distributed, Time Series Database

InfluxDB is an open source distributed time series database with no external dependencies. It’s useful for recording metrics, events, and performing analytics.

Features

Built-in HTTP API so you don’t have to write any server side code to get up and running.

Clustering is supported out of the box, so that you can scale horizontally to handle your data.

Simple to install and manage, and fast to get data in and out.

It aims to answer queries in real-time. That means every data point is
indexed as it comes in and is immediately available in queries that
should return in < 100ms.

Starting InfluxDB

service influxdb start if you have installed InfluxDB using an official Debian or RPM package.

$GOPATH/bin/influxd if you have built InfluxDB from source.

Creating your first database

curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE DATABASE mydb"

Insert some data

curl -H "Content-Type: application/json" http://localhost:8086/write -d '
{
    "database": "mydb",
    "retentionPolicy": "default",
    "points": [
        {
            "timestamp": "2014-11-10T23:00:00Z",
            "name": "cpu",
             "tags": {
                 "region":"uswest",
                 "host": "server01"
            },
             "fields":{
                 "value": 100
            }
         }
      ]
}'

Query for the data

curl -G http://localhost:8086/query?pretty=true \
--data-urlencode "db=mydb" --data-urlencode "q=SELECT * FROM cpu"


text:
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'WC_WSPay' ) ) {
	class WC_WSPay {
		/**
		 * Config object, should contain all the data for the choosen env.
		 *
		 * @var WC_WSPay_Config
		 */
		private $config = null;

		/**
		 * Init WSPay settings.
		 *
		 * @codeCoverageIgnore
		 * @param WC_WSPay_Logger $logger: defaults to null
		 */
		public function __construct( $logger = null ) {
			$dir_path = dirname( plugin_dir_path( __FILE__ ) );
			require_once $dir_path . '/utilities/class-wc-wspay-config.php';
			require_once $dir_path . '/utilities/class-wc-wspay-logger.php';

			$this->config = new WC_WSPay_Config();
			if ( is_a( $logger, 'WC_WSPay_Logger' ) ) {
				$this->logger = $logger;
			}
		}

		/**
		 * Check response for any error messages or invalid status. Return false
		 * in case of error.
		 *
		 * @param array    $response
		 * @param WC_Order $order
		 * @return boolean
		 */
		public function is_response_valid( $response, $order ) {
			if ( ! isset( $response['Success'] ) || intval( $response['Success'] ) !== 1 ) {
				if ( ! isset( $response['ErrorMessage'] ) ) {
					$this->maybe_log( 'Payment for Order #' . $order->get_order_number() . ' unsuccesful. Reason: unknown, missing error message.', 'error' );
					$order->update_status( 'pending', __( 'Payment unsuccesful', 'wcwspay' ) );

					if ( function_exists( 'wc_add_notice' ) ) {
						wc_add_notice( __( 'Payment unsuccesful, reason unknown!', 'wcwspay' ) . '! ' . __( 'Try again or contact site administrator.' ), $notice_type = 'error' );
					}
				} elseif ( strtoupper( $response['ErrorMessage'] ) === 'ODBIJENO' ) {
					$this->maybe_log( 'Payment for Order #' . $order->get_order_number() . ' denied.', 'error' );
					$order->update_status( 'pending', __( 'Payment denied', 'wcwspay' ) );

					if ( function_exists( 'wc_add_notice' ) ) {
						wc_add_notice( __( 'Payment for your order is rejected!', 'wcwspay' ) . ' ' . __( 'Please contact site administrator.', 'wcwspay' ), $notice_type = 'error' );
					}
				} else {
					$this->maybe_log( 'Payment for Order #' . $order->get_order_number() . ' unsuccesful. Reason: ' . $response['ErrorMessage'], 'error' );
					/* translators: %s: error message */
					$order->update_status( 'pending', sprintf( esc_html__( 'Payment unsuccesful! Reason: %s', 'wcwspay' ), $response['ErrorMessage'] ) );
					if ( function_exists( 'wc_add_notice' ) ) {
						wc_add_notice( __( 'Payment unsuccesful', 'wcwspay' ) . '! ' . __( 'Try again or contact site administrator.' ), $notice_type = 'error' );
					}
				}
				return false;
			}
			return true;
		}

		/**
		 * Return testing or production request URL.
		 *
		 * @param boolean $is_testing_mode
		 * @return string
		 */
		public function get_request_url( $is_testing_mode ) {
			if ( $is_testing_mode ) {
				return $this->config->get( 'test_request_url' );
			} else {
				return $this->config->get( 'production_request_url' );
			}
		}

		/**
		 * Generate and return WSPay params array or return false in case of failure.
		 *
		 * @param string $gateway_id  should be something like 'neuralab-wcwspay'
		 * @param int    $order_id
		 * @param string $shop_id
		 * @param string $secret_key
		 * @param string $form_lang
		 * @return array|boolean
		 */
		public function get_wspay_params( $gateway_id, $order_id, $shop_id, $secret_key, $form_lang ) {
			global $woocommerce;
			$order = new WC_Order( $order_id );

			$return_url  = $woocommerce->api_request_url( $gateway_id );
			$order_total = $this->process_order_total( $order );

			$signature = $this->get_signature( $order_id, $order_total, $shop_id, $secret_key );
			if ( empty( $signature ) || ! is_string( $signature ) ) {
				$this->maybe_log( 'Invalid signature', 'error' );
				return false;
			}

			$wspay_params = [
				'ShopID'            => $shop_id,
				'ShoppingCartID'    => $order_id,
				'TotalAmount'       => $order_total,
				'Signature'         => $signature,
				'ReturnURL'         => $return_url,
				'ReturnErrorURL'    => $return_url,
				'CancelURL'         => $order->get_cancel_order_url_raw(),
				// optionals parameters:
				'Lang'              => $form_lang,
				'CustomerFirstName' => $order->get_billing_first_name(),
				'CustomerLastName'  => $order->get_billing_last_name(),
				'CustomerAddress'   => $order->get_billing_address_1(),
				'CustomerCity'      => $order->get_billing_city(),
				'CustomerZIP'       => $order->get_billing_postcode(),
				'CustomerCountry'   => $order->get_billing_country(),
				'CustomerEmail'     => $order->get_billing_email(),
				'CustomerPhone'     => $order->get_billing_phone(),
			];

			if ( ! empty( $order->get_billing_address_2() ) ) {
				$wspay_params['CustomerAddress'] .= ', ' . $order->get_billing_address_2();
			}

			return $wspay_params;
		}

		/**
		 * Generate and return md5 encrypted signature.
		 * Signature is generated from the following string:
		 * shop_id + secret_key + order_id + secret_key + order_total + secret_key
		 *
		 * @param int    $order_id
		 * @param string $order_total
		 * @param string $shop_id
		 * @param string $secret_key
		 * @return mixed encrypted string or false in case of failure
		 */
		private function get_signature( $order_id, $order_total, $shop_id, $secret_key ) {
			// total amount must be striped from any dots and/or commas
			$order_total = str_replace( [ ',', '.' ], '', $order_total );

			if ( empty( $shop_id ) || empty( $secret_key ) || empty( $order_id ) || empty( $order_total ) ) {
				$this->maybe_log( 'Missing data for generating encrypted signature', 'error' );
				return false;
			}

			return md5( $shop_id . $secret_key . $order_id . $secret_key . $order_total . $secret_key );
		}

		/**
		 * Compares the given incoming signature with the one generated from the
		 * rest of the parameters. Returns true if they match or false otherwise.
		 *
		 * @codeCoverageIgnore
		 * @param string $incoming_signature
		 * @param int    $order_id
		 * @param string $shop_id
		 * @param string $secret_key
		 * @param int    $success
		 * @param string $approval_code
		 * @return boolean
		 */
		public function is_incoming_signature_valid( $incoming_signature, $order_id, $shop_id, $secret_key, $success, $approval_code ) {
			$new_signature = md5( $shop_id . $secret_key . $order_id . $secret_key . $success . $secret_key . $approval_code . $secret_key );
			if ( $incoming_signature === $new_signature ) {
				return true;
			}
			return false;
		}

		/**
		 * Return order's total amount in right format for WSPay.
		 *
		 * @param WC_Order $order
		 * @return string
		 */
		private function process_order_total( $order ) {
			$order_total = explode( '.', $order->get_total() );
			$decimal     = ! isset( $order_total[1] ) || empty( $order_total[1] ) ? '00' : $order_total[1];

			return $order_total[0] . ',' . $decimal;
		}

		/**
		 * Create log entry if logger is defined.
		 *
		 * @param  string $message
		 * @param  string $level
		 */
		private function maybe_log( $message, $level = 'info' ) {
			if ( property_exists( $this, 'logger' ) ) {
				$this->logger->log( $message, $level );
			}
		}

	}
}


text:
<?php

class Google_Service_Replicapool_PoolsListResponse extends Google_Collection
{
  protected $collection_key = 'resources';
  public $nextPageToken;
  protected $resourcesType = 'Google_Service_Replicapool_Pool';
  protected $resourcesDataType = 'array';

  public function setNextPageToken($nextPageToken)
  {
    $this->nextPageToken = $nextPageToken;
  }
  public function getNextPageToken()
  {
    return $this->nextPageToken;
  }
  /**
   * @param Google_Service_Replicapool_Pool
   */
  public function setResources($resources)
  {
    $this->resources = $resources;
  }
  /**
   * @return Google_Service_Replicapool_Pool
   */
  public function getResources()
  {
    return $this->resources;
  }
}


text:
package org.openqa.selenium.internal.seleniumemulation;

public class KeyState {
  public boolean metaKeyDown;
  public boolean altKeyDown;
  public boolean controlKeyDown;
  public boolean shiftKeyDown;
}


text:
import {Injectable} from '@angular/core';
import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {Subject} from "rxjs/Subject";

@Injectable()
export class TestAppService {
    private itemSubject = new BehaviorSubject({});
    public itemsObs = this.itemSubject.asObservable();

    showItem(number) {
        this.itemSubject.next(number);
    }
}

/*
// Observer Way
 export class TestAppService {
 private _observe: Observer<any>;
 itemsObs = new Observable(observer => this._observe = observer);
 // public itemsObs = this.itemSubject.asObservable();

 showItem(number) {
 this._observe.next(number);
 }
 }
 */


text:
<?php
class FournisseurManager{
//attributes
    private $_db;

    //constructor
    public function __construct($db){
        $this->_db = new PDO('mysql:host=db;dbname=annahda', 'root', 'test');
    }

    //CRUD operations
    public function add(Fournisseur $fournisseur){
        $query = $this->_db->prepare(
        'INSERT INTO t_fournisseur (nom, adresse, email, telephone1, telephone2, fax, code, created, createdBy)
        VALUES (:nom, :adresse, :email, :telephone1, :telephone2, :fax, :code, :created, :createdBy)')
        or die(print_r($this->_db->errorInfo()));
        $query->bindValue(':nom', $fournisseur->nom());
        $query->bindValue(':adresse', $fournisseur->adresse());
        $query->bindValue(':email', $fournisseur->email());
        $query->bindValue(':telephone1', $fournisseur->telephone1());
        $query->bindValue(':telephone2', $fournisseur->telephone2());
        $query->bindValue(':fax', $fournisseur->fax());
		$query->bindValue(':code', $fournisseur->code());
        $query->bindValue(':created', $fournisseur->created());
        $query->bindValue(':createdBy', $fournisseur->createdBy());
        $query->execute();
        $query->closeCursor();
    }

    public function update(Fournisseur $fournisseur){
        $query = $this->_db->prepare(
        'UPDATE t_fournisseur SET nom=:nom, adresse=:adresse, email=:email, telephone1=:telephone1,
        telephone2=:telephone2, fax=:fax, updated=:updated, updatedBy=:updatedBy
        WHERE id=:id') or die(print_r($this->_db->errorInfo()));
        $query->bindValue(':id', $fournisseur->id());
        $query->bindValue(':nom', $fournisseur->nom());
        $query->bindValue(':adresse', $fournisseur->adresse());
        $query->bindValue(':email', $fournisseur->email());
        $query->bindValue(':telephone1', $fournisseur->telephone1());
        $query->bindValue(':telephone2', $fournisseur->telephone2());
        $query->bindValue(':fax', $fournisseur->fax());
        $query->bindValue(':updated', $fournisseur->updated());
        $query->bindValue(':updatedBy', $fournisseur->updatedBy());
        $query->execute();
        $query->closeCursor();
    }

	public function delete($idFournisseur){
		$query = $this->_db->prepare('DELETE FROM t_fournisseur WHERE id=:idFournisseur')
		or die(print_r($this->_db->errorInfo()));;
		$query->bindValue(':idFournisseur', $idFournisseur);
		$query->execute();
		$query->closeCursor();
	}

	public function getFournisseurBySearch($recherche){
		$query = "";
		$query = $this->_db->prepare("SELECT * FROM t_fournisseur WHERE nom LIKE :recherche");
		$query->bindValue(':recherche', '%'.$recherche.'%');
		$query->execute();
        $fournisseurs = array();
        //get result
        while($data = $query->fetch(PDO::FETCH_ASSOC)){
            $fournisseurs[] = new Fournisseur($data);
        }
        $query->closeCursor();
        return $fournisseurs;
	}

	public function getOneFournisseurBySearch($recherche){
		$query = $this->_db->prepare("SELECT id FROM t_fournisseur WHERE id=:idFournisseur");
		$query->bindValue(':idFournisseur', $recherche);
		$query->execute();
        //get result
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return $data['id'];
	}

    public function getFournisseurNumbers(){
        $query = $this->_db->query('SELECT COUNT(*) AS fournisseurNumbers FROM t_fournisseur');
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return $data['fournisseurNumbers'];
    }

    public function getLastId(){
        $query = $this->_db->query('SELECT id AS last_id FROM t_fournisseur ORDER BY id DESC LIMIT 0, 1');
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $id = $data['last_id'];
        return $id;
    }

    public function getFournisseurs(){
        $fournisseurs = array();
        $query = $this->_db->query('SELECT * FROM t_fournisseur ORDER BY id DESC');
        //get result
        while($data = $query->fetch(PDO::FETCH_ASSOC)){
            $fournisseurs[] = new Fournisseur($data);
        }
        $query->closeCursor();
        return $fournisseurs;
    }

	public function getFournisseursByLimits($begin, $end){
        $fournisseurs = array();
        $query = $this->_db->query('SELECT * FROM t_fournisseur ORDER BY id DESC LIMIT '.$begin.' ,'.$end);
        //get result
        while($data = $query->fetch(PDO::FETCH_ASSOC)){
            $fournisseurs[] = new Fournisseur($data);
        }
        $query->closeCursor();
        return $fournisseurs;
    }

    public function getFournisseurById($id){
        $query = $this->_db->prepare('SELECT * FROM t_fournisseur WHERE id=:id');
        $query->bindValue(':id', $id);
        $query->execute();
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return new Fournisseur($data);
    }

    public function getFournisseurNameById($id){
        $query = $this->_db->prepare('SELECT nom FROM t_fournisseur WHERE id=:id');
        $query->bindValue(':id', $id);
        $query->execute();
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return $data['nom'];
    }

	public function getFournisseurByCode($code){
        $query = $this->_db->prepare('SELECT * FROM t_fournisseur WHERE code=:code');
        $query->bindValue(':code', $code);
        $query->execute();
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return new Fournisseur($data);
    }

	public function getCodeFournisseur($code){
        $query = $this->_db->prepare('SELECT code FROM t_fournisseur WHERE code=:code');
		$query->bindValue(':code', $code);
		$query->execute();
        $data = $query->fetch(PDO::FETCH_ASSOC);
        return $data['code'];
    }

	public function exists($nom){
        $query = $this->_db->prepare(" SELECT COUNT(*) FROM t_fournisseur WHERE REPLACE(nom, ' ', '') LIKE REPLACE(:nom, ' ', '') ");
        $query->execute(array(':nom' => $nom));
        //get result
        return $query->fetchColumn();
    }

}


text:
'use strict';

var t = new Date();
var pkg = require('../package.json');
var config = require('../config.json');

var assert = require('assert');
var cluster = require('cluster');
var http = require('http');
var fs = require('fs');

var q = require('q');
var express = require('express');
var redis = require('redis');

var hbs = require('hbs');
var logger = require('morgan');
var compress = require('compression');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var serveStatic = require('serve-static');
var methodOverride = require('method-override');
var connectRedis = require('connect-redis');
var multiparty = require('connect-multiparty');
var errorHandler = require('errorhandler');

var redisClient = redis.createClient(config.cache.port || 6379, config.cache.host || '127.0.0.1');
var RedisStore = require('connect-redis')(session);

var Manager = require('./manager.js');
var error = require('./errHandler.js');
var Test = require('./tests.js');

if (process.env.master) {
  var workerInit = require('./worker-init.js');
  workerInit();
}

var d = q.defer();
module.exports = d.promise;

if (cluster.isMaster) console.log('[%s]\nSystem started. Initializing system clusters.', t);
if (cluster.isWorker) console.log('Worker #%d @%s initializing.', cluster.worker.id, cluster.worker.process.pid)

// Server middlewares
var server = express();
server.locals.version = pkg.version;
if (pkg.production === true) {
  server.set('env', 'production');
} else {
  server.set('env', 'development');
  server.use(logger('dev'));
}
server.use(compress());
server.use(bodyParser.json());
server.use(bodyParser.urlencoded({ extended: false }));
server.use(multiparty({limit: '8MB'}));
server.use(cookieParser());
server.use(session({
  store: new RedisStore({client: redisClient}),
  secret: 'shiverview',
  saveUninitialized: true,
  resave: true
}));
server.use(serveStatic(process.cwd() + '/static'));
server.use('/usercontent', serveStatic(process.cwd() + '/usercontent'));
server.use(methodOverride());
server.use(errorHandler({ dumpExceptions: true, showStack: true }));
server.set('view engine', 'html');
server.set('views', process.cwd() + '/views');
server.engine('html', require('hbs').__express);

// Manager init
var man = new Manager(server, pkg);
man.init(function(err) {
  if (err) d.reject(err);
  server.manager = man;
  server.emit('ready');
  server.use(error.s404);
  server.use(error.s500);

  // Server methods
  server.listen = function (port) {
    http.createServer(server).listen(process.env.port || 80, function () {
      console.log('HTTP server booted in %d ms on port %d.', new Date().getTime() - t.getTime(), process.env.port || 80);
    });
  }

  server.test = function () {
    var test = new Test(man);
    test.execute()
    .then(function (result) {
      console.log('\nTest completed. %d out of %d routes tested.', result.tested.length, result.total.length);
      process.exit(0);
    }, function (result) {
      console.log('\nTest completed with failures. %d out of %d routes tested, %d failed.', result.tested.length, result.total.length, result.failed.length);
      process.exit(1);
    });
  }

  d.resolve(server);
});


text:
'use strict';

/**
 * Module dependencies.
 */
var _ = require('lodash'),
    mongoose = require('mongoose'),
    errorHandler = require('../errors.server.controller'),
    User = mongoose.model('User');

/**
 * List of Exam
 */
exports.list = function (req, res) {
    //Exam.find().sort('-created').populate('user', 'displayName').exec(function(err, exams) {
    //Exam.find().sort('-exam_name').exec(function(err, exams) {
    //User.find({'username':req.params.userName}).exec(function(err, users) {
    //console.log(req.query.userName);
    console.log('list-user-server-controller...' + req.query.userId);
    if (req.query.flag === 'query_ueser_byid') {

        User.findById(req.query.userId).exec(function (err, user) {
            if (err) {
                return res.status(400).send({
                    message: errorHandler.getErrorMessage(err)
                });
            } else {

                res.json(user);
                //console.log('userbyid2...'+user);

            }
        });
    } else {
        User.find({'username': req.query.userName}).exec(function (err, users) {
            if (err) {
                return res.status(400).send({
                    message: errorHandler.getErrorMessage(err)
                });
            } else {
                res.json(users);
            }
        });
    }

};
exports.list2 = function (req, res) {

    User.find().exec(function (err, users) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.header('Access-Control-Allow-Origin', '*');
            res.json(users);

        }
    });
};

exports.update = function(req, res) {
    var user = req.user;

    user = _.extend(user, req.body);

    user.save(function(err) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.json(user);
        }
    });
};

exports.createx = function (req, res) {
    console.log('listusers controller create x...');
    var user = new User(req.body);

    console.log(user);
    user.save(function (err) {
        res.header('Access-Control-Allow-Origin', '*');
        return  res.json(user);
//        if (err) {
//            return res.status(400).send({
//                message: errorHandler.getErrorMessage(err)
//            });
//        } else {
//
//            res.json(user);
//        }
    });
};
exports.userByName = function (req, res, next, userName) {
    //Exam.find().sort('-created').populate('user', 'displayName').exec(function(err, exams) {
    //Exam.find().sort('-exam_name').exec(function(err, exams) {
    User.find({'username': userName}).exec(function (err, user) {
        if (err) return next(err);
        if (!user) return next(new Error('Failed to load user ' + userName));
        req.user1 = user;
        next();
    });
};

exports.userByID2 = function (req, res) {

    console.log('userbyid2...');
    User.findById(req.query.userId).exec(function (err, user) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {

            res.json(user);
            console.log('userbyid2...' + user);

        }
    });
};
/**
 * exam middleware
 */
exports.userByID = function (req, res, next, id) {
    //Exam.findById(id).populate('user', 'displayName').exec(function(err, article) {
    //alert(id);
    console.log(id);
    User.findById(id).exec(function (err, user) {
        if (err) return next(err);
        if (!user) return next(new Error('Failed to load user ' + id));
        req.user = user;
        next();
    });
};

/**
 * Article authorization middleware
 */
exports.hasAuthorization = function (req, res, next) {
//	if (req.exam.user.id !== req.user.id) {
//		return res.status(403).send({
//			message: 'User is not authorized'
//		});
//	}
    next();
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <file path="network-codegen.xml" />
  <file path="network-model.xml" />
</manifest>


text:
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
          Toggle navigation

        </button>

{{ lang('Topics') }}

专栏

{{ lang('Jobs') }}

问答

Wiki

资讯

文档

教程

          @if ((Request::is('users*') && isset($user)) || (Request::is('search*') && $user->id > 0))

              <form method="GET" action="{{ route('search') }}" accept-charset="UTF-8" class="navbar-form navbar-left">

                  <input class="form-control search-input mac-style" placeholder="搜索范围:{{ $user->name }}" name="q" type="text" value="{{ (Request::is('search*') && isset($query)) ? $query : '' }}">
                  <input class="form-control search-input mac-style"  name="user_id" type="hidden" value="{{ $user->id }}">
          @else
              <form method="GET" action="{{ route('search') }}" accept-charset="UTF-8" class="navbar-form navbar-left">

                  <input class="form-control search-input mac-style" placeholder="搜索" name="q" type="text" value="{{ (Request::is('search*') && isset($query)) ? $query : '' }}">
          @endif

          </form>

          @if (Auth::check())

                                 创作文章

                             $category->id]) : URL::route('topics.create') }}">
                                 发起讨论

                      notification_count + $currentUser->message_count > 0 ? 'important' : 'fade' }} popover-with-html" data-content="消息提醒" id="notification-count">
                          {{ $currentUser->notification_count + $currentUser->message_count }}

                      present()->gravatar }}" />
                       {{{ $currentUser->name }}}

                      @if (Auth::user()->can('visit_admin'))

                                 管理后台

                      @endif

                        @if(Auth::user()->can('access_board'))

                                     站务

                        @endif

                          id) }}" data-lang-loginout="{{ lang('Are you sure want to logout?') }}">
                               个人中心

                          id) }}" >
                               编辑资料

                               {{ lang('Logout') }}

          @else

                {{ lang('Login') }}

          @endif


text:
<?xml version="1.0" encoding="UTF-8"?><metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="OSGI-INF/metatype/metatype">
    <OCD id="org.apache.sling.auth.core.impl.LogoutServlet" name="Apache Sling Authentication Logout Servlet" description="Servlet for logging out users through the authenticator service.">
        <AD id="sling.servlet.methods" type="String" default="GET,POST" name="Method" description="Supported Methdos" cardinality="2147483647"/>
        <AD id="sling.servlet.paths" type="String" default="/system/sling/logout" name="%sling.servlet.paths.name" description="%sling.servlet.paths.description"/>
    </OCD>
    <Designate pid="org.apache.sling.auth.core.impl.LogoutServlet">
        <Object ocdref="org.apache.sling.auth.core.impl.LogoutServlet"/>
    </Designate>
</metatype:MetaData>


text:
set -x

local_ip=$LOCAL_IP
sgx_mem_size=$SGX_MEM_SIZE
sgx_log_level=$SGX_LOG_LEVEL

if [ -c "/dev/sgx/enclave" ]; then
    echo "/dev/sgx/enclave is ready"
elif [ -c "/dev/sgx_enclave" ]; then
    echo "/dev/sgx/enclave not ready, try to link to /dev/sgx_enclave"
    mkdir -p /dev/sgx
    ln -s /dev/sgx_enclave /dev/sgx/enclave
else
    echo "both /dev/sgx/enclave /dev/sgx_enclave are not ready, please check the kernel and driver"
fi

if [ -c "/dev/sgx/provision" ]; then
    echo "/dev/sgx/provision is ready"
elif [ -c "/dev/sgx_provision" ]; then
    echo "/dev/sgx/provision not ready, try to link to /dev/sgx_provision"
    mkdir -p /dev/sgx
    ln -s /dev/sgx_provision /dev/sgx/provision
else
    echo "both /dev/sgx/provision /dev/sgx_provision are not ready, please check the kernel and driver"
fi

if [ -f "/ppml/trusted-big-data-ml/secured-argvs" ]; then
    echo "/ppml/trusted-big-data-ml/secured-argvs is ready"
else
    echo "/ppml/trusted-big-data-ml/secured-argvs is not ready, please generate it before init.sh"
fi

ls -al /dev/sgx

make SGX=1 GRAPHENEDIR=/graphene THIS_DIR=/ppml/trusted-big-data-ml  SPARK_LOCAL_IP=$local_ip SPARK_USER=root G_SGX_SIZE=$sgx_mem_size G_LOG_LEVEL=$sgx_log_level


text:
package com.ifeng.at.testagent.driver.methodImpl;

import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

import com.robotium.solo.Solo;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;

/**
 * Created by lixintong on 2016/11/15.
 */
public class PlayerCommon {

    public static boolean isPlay(Solo solo, String player_name) {
        try {
            return mIsPlay(solo, player_name);
        } catch (NoSuchFieldException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
            e.printStackTrace();
            return false;
        }
    }

    public static boolean mIsPlay(Solo solo, String videoPlayerClass) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
        solo.sleep(3000);
        Class activityVideoPlayer = Class.forName(videoPlayerClass);
        Field[] declaredFields = activityVideoPlayer.getDeclaredFields();
        Field mPlayerHelperField = null;
        for (Field field : declaredFields) {
            if (field.getType().getName().equals("com.ifeng.newvideo.videoplayer.player.NormalVideoHelper")) {
                mPlayerHelperField = field;
                mPlayerHelperField.setAccessible(true);
                break;
            }
        }
        Object mPlayerHelper = null;
        if (videoPlayerClass.contains("UniversalChannelFragment")) {
            FragmentActivity fragmentActivity = (FragmentActivity) solo.getCurrentActivity();
            List<Fragment> fragments = fragmentActivity.getSupportFragmentManager().getFragments();
            for (android.support.v4.app.Fragment fragment : fragments) {
                if (fragment.getClass().getName().equals("com.ifeng.newvideo.ui.FragmentHomePage")) {
                    List<android.support.v4.app.Fragment> childFragments = fragment.getChildFragmentManager().getFragments();
                    for (int i = 0; i < childFragments.size(); i++) {
                        if (childFragments.get(i) != null && childFragments.get(i).getClass().getName().equals(("com.ifeng.newvideo.ui.UniversalChannelFragment"))) {
                            mPlayerHelper = mPlayerHelperField.get(childFragments.get(i));
                            break;
                        }
                    }
                    break;
                }
            }
        } else {
            Activity currentActivity = solo.getCurrentActivity();
            mPlayerHelper = mPlayerHelperField.get(currentActivity);
        }
        Field mPlayerField = mPlayerHelper.getClass().getDeclaredField("mPlayer");
        mPlayerField.setAccessible(true);
        Object mPlayer = mPlayerField.get(mPlayerHelper);
        Method isPlayingMethod = mPlayer.getClass().getDeclaredMethod("isPlaying");
        isPlayingMethod.setAccessible(true);
        boolean isPlay = (boolean) isPlayingMethod.invoke(mPlayer);
        return isPlay;
    }
}


text:
namespace unitscxx
{
namespace si
{
#pragma mark - Base units
	enum units
	{
		meter,
		gram, // the actual "base" unit is the kilogram
		second,
		ampere,
		kelvin,
		mole,
		candela,
	};

	template<units U>
	using si_base = unit_base<UNITSCXX_SI_ARITHMETIC_TYPE, units, U>;

	constexpr si_base<units::meter> m(1);
	constexpr si_base<units::gram> g(1);
	constexpr si_base<units::second> s(1);
	constexpr si_base<units::ampere> A(1);
	constexpr si_base<units::kelvin> K(1);
	constexpr si_base<units::mole> mol(1);
	constexpr si_base<units::candela> cd(1);
	// (little bit of cheating here)
	constexpr auto kg = std::kilo() * g;

#pragma mark - Named derived units
	// skipping radian: rad = m / m
	// skipping steradian: sr = (m*m) / (m*m)
	constexpr auto Hz = 1 / s;
	constexpr auto N = kg * m / (s * s);
	constexpr auto Pa = N / (m * m);
	constexpr auto J = N * m;
	constexpr auto W = J / s;
	constexpr auto C = s * A;
	constexpr auto V = W / A;
	constexpr auto F = C / V;
	constexpr auto Ohm = V / A; // for lack of a better Ω replacement
	constexpr auto S = A / V;
	constexpr auto Wb = V * s;
	constexpr auto T = Wb / (m * m);
	constexpr auto H = Wb / A;
	// skipping lumen: lm = (cd * sr)
	constexpr auto lx = cd / (m * m);
	// skipping becquerel: Bq = 1 / s
	constexpr auto Gy = J / kg;
	// skipping sievert: Sv = J / kg
	constexpr auto kat = mol / s;

	// special treatment for Celsius
	constexpr auto Czero = 273.15 * K;
	constexpr decltype(K) C2K(UNITSCXX_SI_ARITHMETIC_TYPE celsiusTemperature)
	{
		return celsiusTemperature * K + Czero;
	}

	constexpr UNITSCXX_SI_ARITHMETIC_TYPE K2C(decltype(K) kelvinTemperature)
	{
		return (kelvinTemperature - Czero) / K;
	}

#pragma mark - Commonly-accepted non-standard units
	namespace detail
	{
		constexpr auto dm = std::deci() * m;
		constexpr auto hm = std::hecto() * m;
	}

	constexpr auto deg = UNITSCXX_SI_ARITHMETIC_TYPE(M_PI / 180);
	constexpr auto ha = detail::hm * detail::hm;
	constexpr auto L = detail::dm * detail::dm * detail::dm;
	constexpr auto t = std::kilo() * kg;
	constexpr auto au = 1.496e11 * m;
}
}

#endif


text:
const mat4 = require('../../math/mat4')
const transform = require('./transform')

/** return a clone of the input shape, rotated by parameter
 * the clone's geometry still points to the original's, but the transforms are changed
 * @param  {Vec3} rotationCenter the rotation center
 * @param  {Vec3} rotationAxis the rotation axis
 * @param  {float} degrees the amount of rotation, in degrees
 * @param  {Shape3} shape the original shape
 * @returns {Shape3} the rotated shape
 */
const rotate = (rotationCenter, rotationAxis, degrees, shape) => {
  // Matrix4x4.rotation(rotationCenter, rotationAxis, degrees)
  const transformMatrix = mat4.fromRotation(degrees, rotationAxis)
  return transform(transformMatrix, shape)
}

module.exports = rotate


text:
namespace weblayer {
namespace switches {

// Stops new Shell objects from navigating to a default url.
const char kNoInitialNavigation[] = "no-initial-navigation";

// Starts the shell with the profile in incognito mode.
const char kStartInIncognito[] = "start-in-incognito";

}  // namespace switches
}  //  namespace weblayer


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.HDInsight.Models.Management;
using Microsoft.Azure.Management.HDInsight.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Microsoft.Azure.Commands.HDInsight.Test
{
    public class ScriptActionTests : HDInsightTestBase
    {
        private RuntimeScriptActionDetail scriptActionDetail;

        public ScriptActionTests()
        {
            base.SetupTestsForManagement();

            scriptActionDetail = new RuntimeScriptActionDetail
            {
                ApplicationName = "AppName",
                DebugInformation = "DebugInfo",
                EndTime = new DateTime(2016, 1, 1),
                ExecutionSummary =
                    new List<Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary>
                    {
                        new Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary
                        {
                            Status = "Succeeded",
                            InstanceCount = 4
                        }
                    },
                Name = "ScriptName",
                Operation = "PostCreation",
                Parameters = "Parameters",
                Roles = new List<string> { "HeadNode", "WorkerNode" },
                ScriptExecutionId = DateTime.UtcNow.Ticks,
                StartTime = new DateTime(2016, 1, 2),
                Status = "Succeeded",
                Uri = new Uri("http://bing.com")
            };
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void SubmitScriptAction()
        {
            var submitCmdlet = new SubmitAzureHDInsightScriptActionCommand
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName,
                Name = scriptActionDetail.Name,
                Uri = scriptActionDetail.Uri,
                Parameters = scriptActionDetail.Parameters,
                NodeTypes = scriptActionDetail.Roles.Select(r => (ClusterNodeType)Enum.Parse(typeof(ClusterNodeType), r, true)).ToArray(),
                PersistOnSuccess = true
            };

            hdinsightManagementMock.Setup(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName,
                It.Is<ExecuteScriptActionParameters>(param => CompareScriptActions(param.ScriptActions.First(), scriptActionDetail) && param.PersistOnSuccess == true)))
                .Returns(new OperationResource
                {
                    ErrorInfo = null,
                    StatusCode = HttpStatusCode.OK,
                    State = AsyncOperationState.Succeeded
                })
                .Verifiable();

            submitCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(f => f.WriteObject(
                It.Is<AzureHDInsightRuntimeScriptActionOperationResource>(
                    scriptOperationResource =>
                        CompareScriptActions(scriptOperationResource, new AzureHDInsightRuntimeScriptAction(scriptActionDetail)) &&
                            scriptOperationResource.OperationState == AsyncOperationState.Succeeded.ToString())));
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.IsAny<ExecuteScriptActionParameters>()),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void RemoveScriptAction()
        {
            var demoteCmdlet = new RemoveAzureHDInsightPersistedScriptActionCommand
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName,
                Name = scriptActionDetail.Name
            };

            hdinsightManagementMock.Setup(c => c.DeletePersistedScript(ResourceGroupName, ClusterName, scriptActionDetail.Name))
                .Returns(new OperationResource
                {
                    ErrorInfo = null,
                    StatusCode = HttpStatusCode.OK,
                    State = AsyncOperationState.Succeeded
                })
                .Verifiable();

            demoteCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.DeletePersistedScript(ResourceGroupName, ClusterName, scriptActionDetail.Name),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void PromoteScriptAction()
        {
            var promoteCmdlet = new SetAzureHDInsightPersistedScriptActionCommand
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName,
                ScriptExecutionId = scriptActionDetail.ScriptExecutionId
            };

            hdinsightManagementMock.Setup(c => c.PromoteScript(ResourceGroupName, ClusterName, scriptActionDetail.ScriptExecutionId))
                .Returns(new OperationResource
                {
                    ErrorInfo = null,
                    StatusCode = HttpStatusCode.OK,
                    State = AsyncOperationState.Succeeded
                })
                .Verifiable();

            promoteCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.PromoteScript(ResourceGroupName, ClusterName, scriptActionDetail.ScriptExecutionId),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetPersistedScriptActions()
        {
            var persistedScripts = new List<RuntimeScriptAction> { scriptActionDetail };
            var getCmdlet = new GetAzureHDInsightPersistedScriptAction
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName
            };

            hdinsightManagementMock.Setup(c => c.ListPersistedScripts(ResourceGroupName, ClusterName))
                .Returns(new ClusterListPersistedScriptActionsResponse
                {
                    PersistedScriptActions = persistedScripts,
                    StatusCode = HttpStatusCode.OK,
                    RequestId = null
                })
                .Verifiable();

            getCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(f => f.WriteObject(
                It.Is<IList<AzureHDInsightRuntimeScriptAction>>(
                    scripts =>
                        CompareScriptActions(scripts.Single(), new AzureHDInsightRuntimeScriptAction(scriptActionDetail))), true));
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.ListPersistedScripts(ResourceGroupName, ClusterName),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetPersistedScriptAction()
        {
            var persistedScripts = new List<RuntimeScriptAction> { scriptActionDetail };
            var getCmdlet = new GetAzureHDInsightPersistedScriptAction
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                Name = scriptActionDetail.Name,
                ResourceGroupName = ResourceGroupName
            };

            hdinsightManagementMock.Setup(c => c.ListPersistedScripts(ResourceGroupName, ClusterName))
                .Returns(new ClusterListPersistedScriptActionsResponse
                {
                    PersistedScriptActions = persistedScripts,
                    StatusCode = HttpStatusCode.OK,
                    RequestId = null
                })
                .Verifiable();

            getCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(f => f.WriteObject(
                It.Is<IList<AzureHDInsightRuntimeScriptAction>>(
                    scripts =>
                        CompareScriptActions(scripts.Single(), new AzureHDInsightRuntimeScriptAction(scriptActionDetail))), true));
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.ListPersistedScripts(ResourceGroupName, ClusterName),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetHistory()
        {
            var history = new List<RuntimeScriptActionDetail> { scriptActionDetail };
            var getCmdlet = new GetAzureHDInsightScriptActionHistory
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName
            };

            hdinsightManagementMock.Setup(c => c.ListScriptExecutionHistory(ResourceGroupName, ClusterName))
                .Returns(new ClusterListRuntimeScriptActionDetailResponse
                {
                    RuntimeScriptActionDetail = history,
                    StatusCode = HttpStatusCode.OK,
                    RequestId = null
                })
                .Verifiable();

            getCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(f => f.WriteObject(
                It.Is<IList<AzureHDInsightRuntimeScriptActionDetail>>(
                    scripts =>
                        CompareScriptActionDetails(scripts.Single(), new AzureHDInsightRuntimeScriptActionDetail(scriptActionDetail))), true));
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.ListScriptExecutionHistory(ResourceGroupName, ClusterName),
                Times.Once);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetScriptExecutionDetail()
        {
            var getCmdlet = new GetAzureHDInsightScriptActionHistory
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                ClusterName = ClusterName,
                ResourceGroupName = ResourceGroupName,
                ScriptExecutionId = scriptActionDetail.ScriptExecutionId
            };

            hdinsightManagementMock.Setup(c => c.GetScriptExecutionDetail(ResourceGroupName, ClusterName, scriptActionDetail.ScriptExecutionId))
                .Returns(new ClusterRuntimeScriptActionDetailResponse
                {
                    RuntimeScriptActionDetail = scriptActionDetail,
                    StatusCode = HttpStatusCode.OK,
                    RequestId = null
                })
                .Verifiable();

            getCmdlet.ExecuteCmdlet();

            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(f => f.WriteObject(
                It.Is<IList<AzureHDInsightRuntimeScriptActionDetail>>(
                    scripts =>
                        CompareScriptActionDetails(scripts.Single(), new AzureHDInsightRuntimeScriptActionDetail(scriptActionDetail))), true));
            hdinsightManagementMock.VerifyAll();
            hdinsightManagementMock.Verify(c => c.GetScriptExecutionDetail(ResourceGroupName, ClusterName, scriptActionDetail.ScriptExecutionId),
                Times.Once);
        }

        private static bool CompareScriptActions(RuntimeScriptAction scriptA, RuntimeScriptAction scriptB)
        {
            return CompareScriptActions(new AzureHDInsightRuntimeScriptAction(scriptA), new AzureHDInsightRuntimeScriptAction(scriptB));
        }

        private static bool CompareScriptActions(AzureHDInsightRuntimeScriptAction scriptA, AzureHDInsightRuntimeScriptAction scriptB)
        {
            return scriptA.Name == scriptB.Name
                && scriptA.Parameters == scriptB.Parameters
                && scriptA.NodeTypes.Count() == scriptB.NodeTypes.Count()
                && scriptA.NodeTypes.Zip(scriptB.NodeTypes, (nodeA, nodeB) => nodeA == nodeB).All(x => x)
                && scriptA.Uri == scriptB.Uri;
        }

        private static bool CompareScriptActionDetails(AzureHDInsightRuntimeScriptActionDetail scriptA, AzureHDInsightRuntimeScriptActionDetail scriptB)
        {
            if (!CompareScriptActions(scriptA, scriptB)) { return false; }

            return scriptA.ApplicationName == scriptB.ApplicationName
                && scriptA.DebugInformation == scriptB.DebugInformation
                && scriptA.EndTime == scriptB.EndTime
                && scriptA.ExecutionSummary.Count == scriptB.ExecutionSummary.Count
                && scriptA.ExecutionSummary.Zip(scriptB.ExecutionSummary, (summaryA, summaryB) => summaryA  == summaryB).All(x => x)
                && scriptA.Operation == scriptB.Operation
                && scriptA.ScriptExecutionId == scriptB.ScriptExecutionId
                && scriptA.StartTime == scriptB.StartTime
                && scriptA.Status == scriptB.Status;
        }
    }
}


text:
<?php
namespace Concrete\Core\Gathering\DataSource;

use Loader;
use Concrete\Core\Gathering\DataSource\Configuration\Configuration as GatheringDataSourceConfiguration;

class RssFeedDataSource extends DataSource
{
    public function createConfigurationObject(Gathering $ag, $post)
    {
        $o = new RssFeedGatheringDataSourceConfiguration();
        $o->setRssFeedURL($post['rssFeedURL']);

        return $o;
    }

    public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
    {
        $fp = Loader::helper('feed');
        $feed = $fp->load($configuration->getRssFeedURL(), false);
        $feed->init();
        $feed->handle_content_type();
        $posts = $feed->get_items(0);

        $gathering = $configuration->getGatheringObject();
        $lastupdated = 0;
        if ($gathering->getGatheringDateLastUpdated()) {
            $lastupdated = strtotime($gathering->getGatheringDateLastUpdated());
        }

        $items = array();
        foreach ($posts as $p) {
            $posttime = strtotime($p->get_date('Y-m-d H:i:s'));
            //if ($posttime > $lastupdated) {
                $item = RssFeedGatheringItem::add($configuration, $p);
            //}

            if (is_object($item)) {
                $items[] = $item;
            }
        }

        return $items;
    }
}


text:
package org.apache.sanselan.formats.jpeg.segments;

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

import org.apache.sanselan.ImageReadException;

public class UnknownSegment extends GenericSegment
{
	public UnknownSegment(int marker, int marker_length, InputStream is)
			throws ImageReadException, IOException
	{
		super(marker, marker_length, is);
	}

	public UnknownSegment(int marker, byte bytes[]) throws ImageReadException,
			IOException
	{
		super(marker, bytes);
	}

	public String getDescription()
	{
		return "Unknown (" + getSegmentType() + ")";
	}
}


text:
package org.apache.solr.search;

import org.noggit.ObjectBuilder;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.TestHarness;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

import static org.apache.solr.core.SolrCore.verbose;

public class TestStressVersions extends TestRTGBase {

  @BeforeClass
  public static void beforeClass() throws Exception {
    initCore("solrconfig-tlog.xml","schema15.xml");
  }

  // This version doesn't synchronize on id to tell what update won, but instead uses versions
  @Test
  public void testStressGetRealtimeVersions() throws Exception {
    clearIndex();
    assertU(commit());

    final int commitPercent = 5 + random().nextInt(20);
    final int softCommitPercent = 30+random().nextInt(75); // what percent of the commits are soft
    final int deletePercent = 4+random().nextInt(25);
    final int deleteByQueryPercent = 1 + random().nextInt(5);
    final int optimisticPercent = 1+random().nextInt(50);    // percent change that an update uses optimistic locking
    final int optimisticCorrectPercent = 25+random().nextInt(70);    // percent change that a version specified will be correct
    final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));
    int nWriteThreads = 5 + random().nextInt(25);

    final int maxConcurrentCommits = nWriteThreads;   // number of committers at a time... it should be <= maxWarmingSearchers

    // query variables
    final int percentRealtimeQuery = 75;
    final AtomicLong operations = new AtomicLong(50000);  // number of query operations to perform in total
    int nReadThreads = 5 + random().nextInt(25);

    initModel(ndocs);

    final AtomicInteger numCommitting = new AtomicInteger();

    List<Thread> threads = new ArrayList<Thread>();

    for (int i=0; i<nWriteThreads; i++) {
      Thread thread = new Thread("WRITER"+i) {
        Random rand = new Random(random().nextInt());

        @Override
        public void run() {
          try {
            while (operations.get() > 0) {
              int oper = rand.nextInt(100);

              if (oper < commitPercent) {
                if (numCommitting.incrementAndGet() <= maxConcurrentCommits) {
                  Map<Integer,DocInfo> newCommittedModel;
                  long version;

                  synchronized(globalLock) {
                    newCommittedModel = new HashMap<Integer,DocInfo>(model);  // take a snapshot
                    version = snapshotCount++;
                  }

                  if (rand.nextInt(100) < softCommitPercent) {
                    verbose("softCommit start");
                    assertU(TestHarness.commit("softCommit","true"));
                    verbose("softCommit end");
                  } else {
                    verbose("hardCommit start");
                    assertU(commit());
                    verbose("hardCommit end");
                  }

                  synchronized(globalLock) {
                    // install this model snapshot only if it's newer than the current one
                    if (version >= committedModelClock) {
                      if (VERBOSE) {
                        verbose("installing new committedModel version="+committedModelClock);
                      }
                      committedModel = newCommittedModel;
                      committedModelClock = version;
                    }
                  }
                }
                numCommitting.decrementAndGet();
                continue;
              }

              int id = rand.nextInt(ndocs);
              Object sync = syncArr[id];

              // set the lastId before we actually change it sometimes to try and
              // uncover more race conditions between writing and reading
              boolean before = rand.nextBoolean();
              if (before) {
                lastId = id;
              }

              // We can't concurrently update the same document and retain our invariants of increasing values
              // since we can't guarantee what order the updates will be executed.
              // Even with versions, we can't remove the sync because increasing versions does not mean increasing vals.
              //
              // NOTE: versioning means we can now remove the sync and tell what update "won"
              // synchronized (sync) {
              DocInfo info = model.get(id);

              long val = info.val;
              long nextVal = Math.abs(val)+1;

              if (oper < commitPercent + deletePercent) {
                verbose("deleting id",id,"val=",nextVal);

                Long version = deleteAndGetVersion(Integer.toString(id), null);
                assertTrue(version < 0);

                // only update model if the version is newer
                synchronized (model) {
                  DocInfo currInfo = model.get(id);
                  if (Math.abs(version) > Math.abs(currInfo.version)) {
                    model.put(id, new DocInfo(version, -nextVal));
                  }
                }

                verbose("deleting id", id, "val=",nextVal,"DONE");
              } else if (oper < commitPercent + deletePercent + deleteByQueryPercent) {
                verbose("deleteByQyery id",id,"val=",nextVal);

                Long version = deleteByQueryAndGetVersion("id:"+Integer.toString(id), null);
                assertTrue(version < 0);

                // only update model if the version is newer
                synchronized (model) {
                  DocInfo currInfo = model.get(id);
                  if (Math.abs(version) > Math.abs(currInfo.version)) {
                    model.put(id, new DocInfo(version, -nextVal));
                  }
                }

                verbose("deleteByQyery id", id, "val=",nextVal,"DONE");
              } else {
                verbose("adding id", id, "val=", nextVal);

                // assertU(adoc("id",Integer.toString(id), field, Long.toString(nextVal)));
                Long version = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal)), null);
                assertTrue(version > 0);

                // only update model if the version is newer
                synchronized (model) {
                  DocInfo currInfo = model.get(id);
                  if (version > currInfo.version) {
                    model.put(id, new DocInfo(version, nextVal));
                  }
                }

                if (VERBOSE) {
                  verbose("adding id", id, "val=", nextVal,"DONE");
                }

              }
              // }   // end sync

              if (!before) {
                lastId = id;
              }
            }
          } catch (Throwable e) {
            operations.set(-1L);
            throw new RuntimeException(e);
          }
        }
      };

      threads.add(thread);
    }

    for (int i=0; i<nReadThreads; i++) {
      Thread thread = new Thread("READER"+i) {
        Random rand = new Random(random().nextInt());

        @Override
        public void run() {
          try {
            while (operations.decrementAndGet() >= 0) {
              // bias toward a recently changed doc
              int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);

              // when indexing, we update the index, then the model
              // so when querying, we should first check the model, and then the index

              boolean realTime = rand.nextInt(100) < percentRealtimeQuery;
              DocInfo info;

              if (realTime) {
                info = model.get(id);
              } else {
                synchronized(globalLock) {
                  info = committedModel.get(id);
                }
              }

              if (VERBOSE) {
                verbose("querying id", id);
              }
              SolrQueryRequest sreq;
              if (realTime) {
                sreq = req("wt","json", "qt","/get", "ids",Integer.toString(id));
              } else {
                sreq = req("wt","json", "q","id:"+Integer.toString(id), "omitHeader","true");
              }

              String response = h.query(sreq);
              Map rsp = (Map)ObjectBuilder.fromJSON(response);
              List doclist = (List)(((Map)rsp.get("response")).get("docs"));
              if (doclist.size() == 0) {
                // there's no info we can get back with a delete, so not much we can check without further synchronization
              } else {
                assertEquals(1, doclist.size());
                long foundVal = (Long)(((Map)doclist.get(0)).get(field));
                long foundVer = (Long)(((Map)doclist.get(0)).get("_version_"));
                if (foundVer < Math.abs(info.version)
                    || (foundVer == info.version && foundVal != info.val) ) {    // if the version matches, the val must
                  verbose("ERROR, id=", id, "found=",response,"model",info);
                  assertTrue(false);
                }
              }
            }
          } catch (Throwable e) {
            operations.set(-1L);
            throw new RuntimeException(e);
          }
        }
      };

      threads.add(thread);
    }

    for (Thread thread : threads) {
      thread.start();
    }

    for (Thread thread : threads) {
      thread.join();
    }

  }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:wheel="http://schemas.android.com/apk/res-auto"
    android:id="@+id/constraintOnError"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <ImageView
        android:id="@+id/imageViewStatus"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:contentDescription="@string/icon"
        android:tint="@color/colorGrayTint"
        android:visibility="invisible"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.3"
        app:srcCompat="@drawable/ic_cloud_off_black_24dp" />

    <TextView
        android:id="@+id/textViewError"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="32dp"
        android:layout_marginTop="24dp"
        android:layout_marginRight="32dp"
        android:text="@string/info_nothing_to_show"
        app:layout_constraintTop_toBottomOf="@+id/imageViewStatus"
        wheel:layout_constraintLeft_toLeftOf="parent"
        wheel:layout_constraintRight_toRightOf="parent" />

    <Button
        android:id="@+id/buttonRefresh"
        style="@style/Widget.AppCompat.Button.Borderless"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="8dp"
        android:text="@string/refresh"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textViewError" />
</androidx.constraintlayout.widget.ConstraintLayout>


text:
package chk.commons.test.util

trait RandomGenerator[+T] {
  self =>

  def random: T

  def foreach[U](f: T => U) {
    f(random)
  }

  def map[S](f: T => S): RandomGenerator[S] = new RandomGenerator[S] {
    def random = f(self.random)
  }

  def flatMap[S](f: T => RandomGenerator[S]): RandomGenerator[S] = new RandomGenerator[S] {
    def random = f(self.random).random
  }
}

object RandomGenerators {

  def choose(from: Int, to: Int) = new RandomGenerator[Int] {
    def random = if (from == to) from else scala.util.Random.nextInt(to - from) + from
  }

  def single[T](x: T) = new RandomGenerator[T] {
    def random = x
  }

  def pairs[T, U](t: RandomGenerator[T], u: RandomGenerator[U]): RandomGenerator[(T, U)] = for {
    x <- t
    y <- u
  } yield (x, y)

  def strings(maxLength: Int) = choose(0, maxLength).map(int => scala.util.Random.nextString(int))

  val integers = new RandomGenerator[Int] {
    def random = scala.util.Random.nextInt()
  }
  val positiveIntegers = integers.map(_ & Int.MaxValue)
  val negativeIntegers = integers.map(_ | Int.MinValue)

  val longs = new RandomGenerator[Long] {
    def random = scala.util.Random.nextLong()
  }
  val positiveLongs = longs.map(_ & Long.MaxValue)
  val negativeLongs = longs.map(_ | Int.MinValue)

  val doubles = new RandomGenerator[Double] {
    def random = scala.util.Random.nextDouble()
  }

  val booleans = integers.map(_ >= 0)

  val shortStrings = strings(20)

  def emptyLists = single(Nil)

  def nonEmptyLists[T](generator: RandomGenerator[T]) = for {
    head <- generator
    tail <- lists(generator)
  } yield head :: tail

  def lists[T](generator: RandomGenerator[T]): RandomGenerator[List[T]] = for {
    cutoff <- booleans
    list <- if (cutoff) emptyLists else nonEmptyLists[T](generator)
  } yield list

}


text:
package org.wso2.carbon.apimgt.application.extension.api.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.registry.api.Resource;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 * This class provides utility functions used by REST-API.
 */
public class APIUtil {

    private static Log log = LogFactory.getLog(APIUtil.class);
    private static final String DEFAULT_CDMF_API_TAG = "device_management";
    private static final String DEFAULT_CERT_API_TAG = "scep_management";
    public static final String PERMISSION_PROPERTY_NAME = "name";

    public static String getAuthenticatedUser() {
        PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        String username = threadLocalCarbonContext.getUsername();
        String tenantDomain = threadLocalCarbonContext.getTenantDomain();
        if (username.endsWith(tenantDomain)) {
            return username.substring(0, username.lastIndexOf("@"));
        }
        return username;
    }

    public static String getTenantDomainOftheUser() {
        PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        return threadLocalCarbonContext.getTenantDomain();
    }

    public static APIManagementProviderService getAPIManagementProviderService() {
        PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        APIManagementProviderService apiManagementProviderService =
                (APIManagementProviderService) ctx.getOSGiService(APIManagementProviderService.class, null);
        if (apiManagementProviderService == null) {
            String msg = "API management provider service has not initialized.";
            log.error(msg);
            throw new IllegalStateException(msg);
        }
        return apiManagementProviderService;
    }

    public static RealmService getRealmService() {
        PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        RealmService realmService =
                (RealmService) ctx.getOSGiService(RealmService.class, null);
        if (realmService == null) {
            String msg = "Device Management service has not initialized.";
            log.error(msg);
            throw new IllegalStateException(msg);
        }
        return realmService;
    }

    public static DeviceManagementProviderService getDeviceManagementProviderService() {
        PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        DeviceManagementProviderService deviceManagementProviderService =
                (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null);
        if (deviceManagementProviderService == null) {
            String msg = "Device Management service has not initialized.";
            log.error(msg);
            throw new IllegalStateException(msg);
        }
        return deviceManagementProviderService;
    }

    public static String[] getDefaultTags() throws DeviceManagementException {
        String[] allowedApisTags = new String[1];
        allowedApisTags[0] = DEFAULT_CDMF_API_TAG;
        return allowedApisTags;
    }

    public static List<String> getAllowedApisTags() throws DeviceManagementException {
        List<String> allowedApisTags = getDeviceManagementProviderService().getAvailableDeviceTypes();
        allowedApisTags.add(DEFAULT_CDMF_API_TAG);
        allowedApisTags.add(DEFAULT_CERT_API_TAG);
        return allowedApisTags;
    }

    public static void putPermission(String permission) {
        try {
            StringTokenizer tokenizer = new StringTokenizer(permission, "/");
            String lastToken = "", currentToken, tempPath;
            while (tokenizer.hasMoreTokens()) {
                currentToken = tokenizer.nextToken();
                tempPath = lastToken + "/" + currentToken;
                if (!checkResourceExists(tempPath)) {
                    createRegistryCollection(tempPath, currentToken);

                }
                lastToken = tempPath;
            }
        } catch (org.wso2.carbon.registry.api.RegistryException e) {
            log.error("Failed to creation permission in registry" + permission, e);
        }
    }

    public static void createRegistryCollection(String path, String resourceName)
            throws org.wso2.carbon.registry.api.RegistryException {
        Resource resource = getGovernanceRegistry().newCollection();
        resource.addProperty(PERMISSION_PROPERTY_NAME, resourceName);
        getGovernanceRegistry().beginTransaction();
        getGovernanceRegistry().put(path, resource);
        getGovernanceRegistry().commitTransaction();
    }

    public static boolean checkResourceExists(String path)
            throws RegistryException {
        return getGovernanceRegistry().resourceExists(path);
    }

    public static Registry getGovernanceRegistry() throws RegistryException {
        return getRegistryService().getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
    }

    public static RegistryService getRegistryService() {
        PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        RegistryService registryService =
                (RegistryService) ctx.getOSGiService(RegistryService.class, null);
        if (registryService == null) {
            String msg = "registry service has not initialized.";
            log.error(msg);
            throw new IllegalStateException(msg);
        }
        return registryService;
    }
}


text:
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'web_service.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    #url(r'^admin/', include(admin.site.urls)),
    url(r'^usuario/', include('usuario.urls')),
    url(r'^exercito/', include('jogo.urls_exercito')),
    url(r'^tatic/', include('jogo.urls_tatic')),
    url(r'^soldato/', include('jogo.urls_soldato')),
    url(r'^personage/', include('vocabulary.urls')),
)


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.timeseriesinsights.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for WarmStoragePropertiesState. */
public final class WarmStoragePropertiesState extends ExpandableStringEnum<WarmStoragePropertiesState> {
    /** Static value Ok for WarmStoragePropertiesState. */
    public static final WarmStoragePropertiesState OK = fromString("Ok");

    /** Static value Error for WarmStoragePropertiesState. */
    public static final WarmStoragePropertiesState ERROR = fromString("Error");

    /** Static value Unknown for WarmStoragePropertiesState. */
    public static final WarmStoragePropertiesState UNKNOWN = fromString("Unknown");

    /**
     * Creates or finds a WarmStoragePropertiesState from its string representation.
     *
     * @param name a name to look for.
     * @return the corresponding WarmStoragePropertiesState.
     */
    @JsonCreator
    public static WarmStoragePropertiesState fromString(String name) {
        return fromString(name, WarmStoragePropertiesState.class);
    }

    /** @return known WarmStoragePropertiesState values. */
    public static Collection<WarmStoragePropertiesState> values() {
        return values(WarmStoragePropertiesState.class);
    }
}


text:
/************************************************************************************
 *
 *  Umbraco Data Layer
 *  MIT Licensed work
 *  ©2008 Ruben Verborgh
 *
 ***********************************************************************************/

using umbraco.DataLayer.Utility;
using umbraco.DataLayer.Utility.Installer;

namespace umbraco.DataLayer.SqlHelpers.MySql
{
    /// <summary>
    /// Utility for an MySql data source.
    /// </summary>
    public class MySqlUtility : DefaultUtility<MySqlHelper>
    {
        #region Public Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="MySqlUtility"/> class.
        /// </summary>
        /// <param name="sqlHelper">The SQL helper.</param>
        public MySqlUtility(MySqlHelper sqlHelper) : base(sqlHelper)
        { }

        #endregion

        #region DefaultUtility Members

        /// <summary>
        /// Creates an installer.
        /// </summary>
        /// <returns>The MySql installer.</returns>
        public override IInstallerUtility CreateInstaller()
        {
            return new MySqlInstaller(SqlHelper);
        }

        #endregion
    }
}


text:
// The MIT License (MIT)
//
// Copyright (c) 2017 Timothy D. Jones
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 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.
package io.github.jonestimd.swing.table;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTableUI;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;

/**
 * Extends {@link BasicTableUI} to handle section tables.
 */
public class SectionTableUI extends BasicTableUI {
    public static ComponentUI createUI(JComponent c) {
        return new SectionTableUI();
    }

    @Override
    public void paint(Graphics g, JComponent c) {
        super.paint(g, c);
        Rectangle clip = g.getClipBounds();
        Rectangle bounds = table.getBounds();
        // account for the fact that the graphics has already been translated
        // into the table's bounds
        bounds.x = bounds.y = 0;

        JTableHeader header = table.getTableHeader();
        if (bounds.intersects(clip) && (header == null || header.getDraggedColumn() == null)) {
            Point upperLeft = clip.getLocation();
            Point lowerRight = new Point(clip.x + clip.width, clip.y + clip.height);

            int rowMin = Math.max(table.rowAtPoint(upperLeft), 0);
            int rowMax = table.rowAtPoint(lowerRight);
            if (rowMax == -1) {
                rowMax = table.getRowCount()-1;
            }
            for (int row = rowMin; row <= rowMax; row++) {
                if (((SectionTable<?, ?>) table).isSectionRow(row)) {
                    Rectangle cellRect = table.getCellRect(row, 0, false);
                    cellRect.add(table.getCellRect(row, table.getColumnCount()-1, false));
                    paintCell(g, cellRect, row);
                }
            }
        }
    }

    private void paintCell(Graphics g, Rectangle cellRect, int row) {
        TableCellRenderer renderer = table.getCellRenderer(row, 0);
        Component component = table.prepareRenderer(renderer, row, 0);
        forceFillBackground(g, cellRect, component);
        rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y,
                cellRect.width, cellRect.height, true);
    }

    private void forceFillBackground(Graphics g, Rectangle cellRect, Component component) {
        // make sure isOpaque() returns correct value for instance of DefaultTableCellRenderer.UIResource
        if (component.getParent() != rendererPane) {
            rendererPane.add(component);
        }
        if (! component.isOpaque()) {
            g.setColor(component.getBackground());
            g.fillRect(cellRect.x, cellRect.y, cellRect.width, cellRect.height);
        }
    }
}


text:
namespace StartupBusinessSystem.Web.ViewModels.Campaigns
{
    using System;
    using StartupBusinessSystem.Models;

    public class DetailsCampaignViewModel
    {
        public int Id { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        public int GoalPrice { get; set; }

        public int Shares { get; set; }

        public int UnitPerShare { get; set; }

        public CampaignStatus Status { get; set; }

        public DateTime CreatedOn { get; set; }

        public string CompanyName { get; set; }

        public string CompanyDescription { get; set; }

        public string CompanyAddress { get; set; }

        public string CompanyPhone { get; set; }

        public string CompanyEmail { get; set; }

        public int CampaignAvailableShares { get; set; }

        public int CampaignTotalShares { get; set; }

        public User Owner { get; set; }

        public bool IsOwner(string name)
        {
            return this.Owner.UserName.Equals(name);
        }
    }
}


text:
define([
  '../core'
], function (jQuery) {
// Support: Android 2.3
  // Workaround failure to string-cast null input
  jQuery.parseJSON = function (data) {
    return JSON.parse(data + '')
  }

  return jQuery.parseJSON
})