text:
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#include "mpiimpl.h"
#include "oputil.h"

/*
 * In MPI-2.1, this operation is valid only for C integer, Fortran integer,
 * Floating point, and Complex types (5.9.2 Predefined reduce operations)
 */
#define MPIR_LSUM(a,b) ((a)+(b))

#undef FUNCNAME
#define FUNCNAME MPIR_SUM
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
void MPIR_SUM (
    void *invec,
    void *inoutvec,
    int *Len,
    MPI_Datatype *type )
{
    int i, len = *Len;

    switch (*type) {
#undef MPIR_OP_TYPE_MACRO
#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPIR_LSUM)
        /* no semicolons by necessity */
        MPIR_OP_TYPE_GROUP(C_INTEGER)
        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        /* extra types that are not required to be supported by the MPI Standard */
        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)

        /* complex addition is slightly different than scalar addition */
#undef MPIR_OP_TYPE_MACRO
#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) \
        case (mpi_type_): {                                \
            c_type_ * restrict a = (c_type_ *)inoutvec;    \
            const c_type_ * restrict b = (c_type_ *)invec; \
            for ( i=0; i<len; i++ ) {                      \
                a[i].re = MPIR_LSUM(a[i].re ,b[i].re);     \
                a[i].im = MPIR_LSUM(a[i].im ,b[i].im);     \
            }                                              \
            break;                                         \
        }
        /* C complex types are just simple sums */
#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_,type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_,c_type_,MPIR_LSUM)
        MPIR_OP_TYPE_GROUP(COMPLEX)
        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
        /* put things back where we found them */
#undef MPIR_OP_TYPE_MACRO
#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_,type_name_) MPIR_OP_TYPE_MACRO(mpi_type_,c_type_,type_name_)
        /* --BEGIN ERROR HANDLING-- */
        default: {
            MPIU_THREADPRIV_DECL;
            MPIU_THREADPRIV_GET;
            MPIU_THREADPRIV_FIELD(op_errno) = MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_SUM" );
            break;
        }
        /* --END ERROR HANDLING-- */
    }
}

#undef FUNCNAME
#define FUNCNAME MPIR_SUM_check_dtype
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_SUM_check_dtype( MPI_Datatype type )
{
    switch (type) {
#undef MPIR_OP_TYPE_MACRO
#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) case (mpi_type_):
        MPIR_OP_TYPE_GROUP(C_INTEGER)
        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        /* extra types that are not required to be supported by the MPI Standard */
        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)

        MPIR_OP_TYPE_GROUP(COMPLEX)
        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
#undef MPIR_OP_TYPE_MACRO
            return MPI_SUCCESS;
        /* --BEGIN ERROR HANDLING-- */
        default:
            return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_SUM" );
        /* --END ERROR HANDLING-- */
    }
}


text:
<?php
ini_set('display_errors','0'); error_reporting(0);
header("Content-Type:text/html; charset=utf8");

   $anket_tarihi=$_GET['anket_tarihi'];
   $anket_cesidi=$_GET['anket_cesidi'];
   $anket_yapilanbolge=$_GET['anket_yapilanbolge'];
   $anket_yapilanil=$_GET['anket_yapilanil'];
   $anket_sonuclari=$_GET['anket_sonuclari'];
$conn_string = "host=localhost port=5432 dbname=postgis user=postgres password=123";
$dbconn = pg_connect($conn_string);
$sorgu= "insert into anket(anket_tarihi,anket_cesidi,anket_yapilanbolge,anket_yapilanil,anket_sonuclari)
              values ('$anket_tarihi','$anket_cesidi','$anket_yapilanbolge','$anket_yapilanil','$anket_sonuclari')";
pg_query($dbconn, $sorgu);
pg_close($dbconn);
?>

redpajama_set_name: RedPajamaGithub


text:
package org.ihtsdo.rvf.helper;

import javax.persistence.EntityNotFoundException;

import org.ihtsdo.rvf.controller.InvalidFormatException;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

/**
 * A custom exception handler that handles missing entities.
 */
@ControllerAdvice
@Order(Ordered.HIGHEST_PRECEDENCE)
public class RestApiExceptionHandler extends ResponseEntityExceptionHandler {
	@ExceptionHandler(value = {EntityNotFoundException.class, org.ihtsdo.rvf.helper.EntityNotFoundException.class})
	protected ResponseEntity<Object> handleEntityNotFoundException( final RuntimeException exception, final WebRequest request) {
		final String bodyOfResponse = exception.getMessage();
		final HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.TEXT_PLAIN);

		return handleExceptionInternal(exception, bodyOfResponse, headers, HttpStatus.NOT_FOUND, request);
	}

	@ExceptionHandler(value = { InvalidFormatException.class })
	protected ResponseEntity<Object> handleFormatNotValidException(final RuntimeException exception, final WebRequest request) {
		final String bodyOfResponse = exception.getMessage();
		final HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.TEXT_PLAIN);
		return handleExceptionInternal(exception, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request);
	}
}


text:
from __future__ import print_function
import dxpy
from pprint import pformat
import sys
import re
import traceback
import logging
from time import sleep

logging.basicConfig()
logger = logging.getLogger(__name__)

# E3_PROJECT_ID = 'project-BKp5K980bpZZ096Xp1XQ02fZ'
# FRIP_DEV_PROJECT_ID = 'project-F3BpKqj07z6y979Z4X36P6z9'
# FRIP_PROJECT_ID = 'project-F3Bvp4004vxZxbpZBBJGPyYy'
# TEST_ANALYSIS_ID = 'analysis-F2v67b80bpZV0p9q788kgBGp'
# TEST_ANALYSIS_ID = 'analysis-F3BZ8v8036977yg98x815zB3'\
ACCESSION_OUTPUT_FOLDER = "/accession_log/"

APPLETS_PROJECT_ID = next(dxpy.find_projects(
    name='ENCODE - ChIP Production',
    return_handler=True)).get_id()
APPLETS = {}

ASSAY_SPECIFICS = {
    'tf': {
        'pre_stage': 'SPP Peaks',
        'final_stage': 'Final IDR peak calls',
        'applet': 'encode_idr',
    },
    'histone': {
        'pre_stage': 'ENCODE Peaks',
        'final_stage': 'Final narrowpeaks',
        'applet': 'overlap_peaks',
    }
}

EPILOG = '''Notes:

Examples:

    %(prog)s
'''

def get_args():
    import argparse
    parser = argparse.ArgumentParser(
        description=__doc__, epilog=EPILOG,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    def t_or_f(arg):
        ua = str(arg).upper()
        if ua == 'TRUE'[:len(ua)]:
            return True
        elif ua == 'FALSE'[:len(ua)]:
            return False
        else:
            assert not (True or False), "Cannot parse %s to boolean" % (arg)

    parser.add_argument('analysis_ids', help='List of analysis IDs to rerun', nargs='*', default=None)
    parser.add_argument('--infile', help='File containing analysis IDs', type=argparse.FileType('r'), default=sys.stdin)
    parser.add_argument('--accession', help='Automatically accession the results to the ENCODE Portal', type=t_or_f, default=None)
    parser.add_argument('--debug', help="Print debug messages", type=t_or_f, default=None)
    parser.add_argument('--dryrun', help="Set up workflow but don't run.", type=t_or_f, default=None)
    parser.add_argument('-a', '--assay_type', choices=['tf', 'histone'], help='Assay type. Required.', required=True)

    return parser.parse_args()

def find_applet_by_name(applet_name, applets_project_id=APPLETS_PROJECT_ID):
    if (applet_name, applets_project_id) not in APPLETS:
        found = dxpy.find_one_data_object(
            classname="applet",
            name=applet_name,
            project=applets_project_id,
            zero_ok=False,
            more_ok=False,
            return_handler=True)
        APPLETS[(applet_name, applets_project_id)] = found
    return APPLETS[(applet_name, applets_project_id)]

def stage_named(name, analysis):
    try:
        stage = next(
            stage for stage in analysis.describe()['stages']
            if stage['execution']['name'] == name
        )
    except StopIteration:
        stage = None
    except:
        raise

    return stage

def get_assay_specific_variables(analysis, assay_type):
    '''
    Find final stage input and applet and update them with
    inputs from penulitmate stage.
    '''
    pre_stage_input = stage_named(
        ASSAY_SPECIFICS[assay_type]['pre_stage'], analysis
    )['execution']['input']
    final_stage = stage_named(
        ASSAY_SPECIFICS[assay_type]['final_stage'], analysis
    )
    new_input = final_stage['execution']['input']
    new_input.update(
        {
            name: input_file
            for name, input_file in pre_stage_input.items()
            if name in ['rep1_ta', 'rep1_xcor', 'rep2_ta', 'rep2_xcor']
        }
    )
    new_input.update(
        {
            'paired_end': pre_stage_input['rep1_paired_end']
        }
    )
    new_applet = find_applet_by_name(ASSAY_SPECIFICS[assay_type]['applet'])
    return final_stage, new_input, new_applet

def rerun_with_frip(analysis_id, dryrun, assay_type):
    logger.debug(
        'rerun_with_frip: analysis_id %s'
        % (analysis_id))
    analysis = dxpy.DXAnalysis(analysis_id)
    project_id = analysis.describe()['project']
    temp = dxpy.api.workflow_new({
        'name': analysis.describe()['executableName'],
        'project': project_id,
        'initializeFrom': {'id': analysis.get_id()},
        'temporary': True})
    new_workflow = dxpy.DXWorkflow(temp['id'])
    logger.debug(
        'rerun_with_frip: new_workflow %s %s'
        % (new_workflow.get_id(), new_workflow.name))
    final_stage, new_input, new_applet = get_assay_specific_variables(
        analysis,
        assay_type
    )
    accessioning_stage = stage_named('Accession results', analysis)
    if accessioning_stage:
        new_workflow.remove_stage(accessioning_stage['id'])
    logger.debug(
        'rerun_with_frip: new_applet %s %s'
        % (new_applet.get_id(), new_applet.name))
    logger.debug(
        'rerun_with_frip: new_input \n%s'
        % (pformat(new_input)))
    new_workflow.update_stage(
        final_stage['id'],
        executable=new_applet.get_id(),
        stage_input=new_input,
        force=True)

    m = re.match('ENCSR.{6}', analysis.name)
    accession = m.group(0)

    analysis_properties = analysis.describe()['properties']
    analysis_properties.update({
        'experiment_accession': accession,
        'original_analysis': analysis_id
    })
    if dryrun:
        logger.debug(
            'rerun_with_frip: workflow created but dryrun so no analysis run')
        return new_workflow
    else:
        logger.debug(
            'rerun_with_frip: running workflow')
        return new_workflow.run(
            {},
            project=project_id,
            name="%s frip" % (analysis.name),
            properties=analysis_properties)

def accession_analysis(analysis):
    accession_analysis_applet = find_applet_by_name('accession_analysis')
    logger.debug(
        'accession_analysis: found accession_analysis_applet %s'
        % (accession_analysis_applet.name))
    accession_output_folder = ACCESSION_OUTPUT_FOLDER
    accession_job_input = {
        'analysis_ids': [analysis.get_id()],
        'wait_on_files': [],
        'fqcheck': False,
        'force_patch': True,
        'encoded_check': False
    }
    sleep(5)
    max_retries = 10
    retries = max_retries
    accession_job = None
    while retries:
        logger.debug('accession_analysis: running accession_analysis_applet with input %s' % (accession_job_input))
        try:
            accession_job = accession_analysis_applet.run(
                accession_job_input,
                name='Accession %s' % (analysis.name),
                folder=accession_output_folder,
                depends_on=[analysis.get_id()],
                project=analysis.describe()['project']
            )
        except Exception as e:
            logger.error(
                "%s launching auto-accession ... %d retries left"
                % (e, retries))
            sleep(5)
            retries -= 1
            continue
        else:
            logger.debug(
                "Auto-accession will run as %s %s"
                % (accession_job.name, accession_job.get_id()))
            break
    else:
        logging.error("Auto-accession failed with %s" % (e))

    return accession_job

def main():

    args = get_args()

    if args.debug:
        logger.setLevel(logging.DEBUG)
        logger.debug("Logging level set to DEBUG")
    else:
        logger.setLevel(logging.INFO)

    if args.analysis_ids:
        ids = args.analysis_ids
    else:
        ids = args.infile

    first_row = True
    for string in ids:
        analysis_id = string.strip()
        if not analysis_id:
            continue

        try:
            new_analysis = rerun_with_frip(analysis_id, args.dryrun, args.assay_type)
        except:
            row = "%s\terror" % (analysis_id)
            print("%s\t%s" % (analysis_id, "error"), file=sys.stderr)
            traceback.print_exc(file=sys.stderr)
        else:
            if args.dryrun:
                # since it's only a temporary workflow, the project is just a termporary
                # container, which has only an ID and not a name
                project_name = new_analysis.describe().get('project')
            else:
                project = dxpy.DXProject(new_analysis.describe().get('project'))
                project_name = project.name
            row = "%s\t%s\t%s" % (
                analysis_id,
                new_analysis.get_id(),
                project_name
            )

            if args.accession:
                try:
                    accessioning_job = accession_analysis(new_analysis)
                except Exception as e:
                    logger.error("acccession_analysis failed with %s" % (e))
                    row += "\tfailed"
                else:
                    row += "\t%s" % (None if not accessioning_job else accessioning_job.get_id())
            else:
                row += " manually"

        if first_row:
            print("old_analysis\tnew_analysis\tproject\taccession_job")
        print(row)
        first_row = False

if __name__ == '__main__':
    main()


text:
import Promise from 'bluebird';
import { extractAllParams } from "../../../utils";
import { ResetPasswordLink } from "../../../models";

export function changePasswordRequest(req, res, next) {
  return Promise.resolve().then(() => {
    return changePassword(extractAllParams(req));
  }).then(result => res.json(result)).catch(next);
}

export async function changePassword(params) {
  let {
    resetKey,
    password,
    passwordConfirm,
  } = params;

  if (password !== passwordConfirm) {
    throw new HttpError('Пароли не совпадают');
  }

  if (password.length < 6) {
    throw new HttpError('Пароль не может быть меньше 6 символов');
  }

  const resetLink = await ResetPasswordLink.findOne({
    where: {
      resetKey
    }
  });

  if (!resetLink) {
    throw new HttpError('Данная ссылка уже не действительна');
  }

  const user = await resetLink.getUser();

  await user.update({
    password
  });

  return resetLink.destroy();
}


text:
package ons

import (
	"fmt"
	"testing"
)

func TestOnsWarnAdmin(t *testing.T) {
	var req OnsWarnAdminRequest
	req.Init()
	req.SetFormat("JSON")
	req.SetRegionId("cn-shenzhen")
	var accessId = "Ie65kUInu5GeAsma"
	var accessSecret = "8cCqoxdYU9zKUihwXFXiN1HEACBDwB"
	resp, err := OnsWarnAdmin(&req, accessId, accessSecret)
	if err != nil {
		t.Errorf("Error: %s", err.Error())
	}
	fmt.Printf("Success: %v\n", resp)
}


text:
set -x              # essentially debug mode

# they have to pass in the PGPOOL_VERSION that pgpool will be updated to.
if [[ -n "$1" ]]; then
  PGPOOL_VERSION=$1
else
    echo "You need to provide the pgpool version number to update to."
    exit 1
fi

#-------------------------------------------------------------------------------
# put the build down in /installs...there was one there when the instance was
# created so it should still be there.
#-------------------------------------------------------------------------------
sudo mkdir -p /installs
pushd /installs

#-------------------------------------------------------------------------------
# get the tarball that has the specified PGPOOL_VERSION number
#-------------------------------------------------------------------------------
sudo wget --quiet http://www.pgpool.net/download.php?f=pgpool-II-$PGPOOL_VERSION.tar.gz -O pgpool-II-$PGPOOL_VERSION.tar.gz

#-------------------------------------------------------------------------------
# untar it and move to that directory
#-------------------------------------------------------------------------------
sudo tar -xvf pgpool-II-$PGPOOL_VERSION.tar.gz && \
pushd pgpool-II-$PGPOOL_VERSION

#-------------------------------------------------------------------------------
# and build it
#-------------------------------------------------------------------------------
sudo ./configure && sudo make --silent && sudo make --silent install

#-------------------------------------------------------------------------------
# all done so pop back out to where this started
#-------------------------------------------------------------------------------
popd
popd


text:
require "models/job"

class User < ActiveRecord::Base
  has_secure_token
  has_secure_token :auth_token, length: 36

  has_and_belongs_to_many :jobs_pool,
    class_name: "Job",
    join_table: "jobs_pool"

  has_one :room
  has_one :owned_room, class_name: "Room", foreign_key: "owner_id"
  has_one :family_tree, -> { where(token: nil) }, foreign_key: "member_id"
  has_one :family, through: :family_tree
  has_many :family_members, through: :family, source: :members
end

class UserWithNotification < User
  after_create -> { Notification.create! message: "A new user has been created." }
end


text:
#include "JniBridge.h"
#include "socket-api.h"
#include <jni.h>
#include <stdio.h>
// va_list, vsnprintf
#include <stdarg.h>
// errno
#include <errno.h>
// strerror_r, memset
#include <string.h>
// socket, bind, getsockname, listen, accept, recv, send, connect
#include <sys/types.h>
#include <sys/socket.h>
// sockaddr_un
#include <sys/un.h>
// htons, sockaddr_in
#include <netinet/in.h>
// inet_ntop
#include <arpa/inet.h>
// close, unlink
#include <unistd.h>
// offsetof
#include <stddef.h>

/**
 * Constructs a new Local UNIX socket.
 *
 * @param env JNIEnv interface.
 * @param obj object instance.
 * @return socket descriptor.
 * @throws IOException
 */
static int NewLocalSocket(JNIEnv *env, jobject obj) {
    // Construct socket
    LogMessage(env, obj, "Constructing a new Local UNIX socket...");
    int localSocket = socket(PF_LOCAL, SOCK_STREAM, 0);

    // Check if socket is properly constructed
    if (-1 == localSocket) {
        // Throw an exception with error number
        ThrowErrnoException(env, "java/io/IOException", errno);
    }

    return localSocket;
}

/**
 * Binds a local UNIX socket to a name.
 *
 * @param env JNIEnv interface.
 * @param obj object instance.
 * @param sd socket descriptor.
 * @param name socket name.
 * @throws IOException
 */
static void BindLocalSocketToName(
        JNIEnv *env,
        jobject obj,
        int sd,
        const char *name) {
    struct sockaddr_un address;

    // Name length
    const size_t nameLength = strlen(name);

    // Path length is initiall equal to name length
    size_t pathLength = nameLength;

    // If name is not starting with a slash it is
    // in the abstract namespace
    bool abstractNamespace = ('/' != name[0]);

    // Abstract namespace requires having the first
    // byte of the path to be the zero byte, update
    // the path length to include the zero byte
    if (abstractNamespace) {
        pathLength++;
    }

    // Check the path length
    if (pathLength > sizeof(address.sun_path)) {
        // Throw an exception with error number
        ThrowException(env, "java/io/IOException", "Name is too big.");
    } else {
        // Clear the address bytes
        memset(&address, 0, sizeof(address));
        address.sun_family = PF_LOCAL;

        // Socket path
        char *sunPath = address.sun_path;

        // First byte must be zero to use the abstract namespace
        if (abstractNamespace) {
            *sunPath++ = NULL;
        }

        // Append the local name
        strcpy(sunPath, name);

        // Address length
        socklen_t addressLength =
                (offsetof(struct sockaddr_un, sun_path))
                + pathLength;

        // Unlink if the socket name is already binded
        unlink(address.sun_path);

        // Bind socket
        LogMessage(env, obj, "Binding to local name %s%s.", (abstractNamespace) ? "(null)" : "",
                   name);

        if (-1 == bind(sd, (struct sockaddr *) &address, addressLength)) {
            // Throw an exception with error number
            ThrowErrnoException(env, "java/io/IOException", errno);
        }
    }
}

/**
 * Blocks and waits for incoming client connections on the
 * given socket.
 *
 * @param env JNIEnv interface.
 * @param obj object instance.
 * @param sd socket descriptor.
 * @return client socket.
 * @throws IOException
 */
static int AcceptOnLocalSocket(JNIEnv *env, jobject obj, int sd) {
    // Blocks and waits for an incoming client connection
    // and accepts it
    LogMessage(env, obj, "Waiting for a client connection...");
    int clientSocket = accept(sd, NULL, NULL);

    // If client socket is not valid
    if (-1 == clientSocket) {
        // Throw an exception with error number
        ThrowErrnoException(env, "java/io/IOException", errno);
    }

    return clientSocket;
}

void
Java_com_ztiany_bionic_tcpudp_LocalEchoActivity_nativeStartLocalServer(JNIEnv *env, jobject obj,
                                                                       jstring name) {
    // Construct a new local UNIX socket.
    int serverSocket = NewLocalSocket(env, obj);
    if (NULL == env->ExceptionOccurred()) {
        // Get name as C string
        const char *nameText = env->GetStringUTFChars(name, NULL);
        if (NULL == nameText)
            goto exit;

        // Bind socket to a port number
        BindLocalSocketToName(env, obj, serverSocket, nameText);

        // Release the name text
        env->ReleaseStringUTFChars(name, nameText);

        // If bind is failed
        if (NULL != env->ExceptionOccurred())
            goto exit;

        // Listen on socket with a backlog of 4 pending connections
        ListenOnSocket(env, obj, serverSocket, 4);
        if (NULL != env->ExceptionOccurred())
            goto exit;

        // Accept a client connection on socket
        int clientSocket = AcceptOnLocalSocket(env, obj, serverSocket);
        if (NULL != env->ExceptionOccurred())
            goto exit;

        char buffer[MAX_BUFFER_SIZE];
        ssize_t recvSize;
        ssize_t sentSize;

        // Receive and send back the data
        while (1) {
            // Receive from the socket
            recvSize = ReceiveFromSocket(env, obj, clientSocket, buffer, MAX_BUFFER_SIZE);

            if ((0 == recvSize) || (NULL != env->ExceptionOccurred()))
                break;

            // Send to the socket
            sentSize = SendToSocket(env, obj, clientSocket, buffer, (size_t) recvSize);

            if ((0 == sentSize) || (NULL != env->ExceptionOccurred()))
                break;
        }

        // Close the client socket
        close(clientSocket);
    }

    exit:
    if (serverSocket > 0) {
        close(serverSocket);
    }
}


text:
test_name 'C3500 - checkout with compression 5'

# Globals
repo_name = 'testrepo_checkout'

hosts.each do |host|
  tmpdir = host.tmpdir('vcsrepo')
  step 'setup - create repo' do
    git_pkg = 'git'
    if host['platform'] =~ /ubuntu-10/
      git_pkg = 'git-core'
    end
    install_package(host, git_pkg)
    my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
    scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
    on(host, "cd #{tmpdir} && ./create_git_repo.sh")
  end

  teardown do
    on(host, "rm -fr #{tmpdir}")
  end

  step 'checkout with compression 5 with puppet' do
    pp = <<-EOS
    vcsrepo { "#{tmpdir}/#{repo_name}":
      ensure => present,
      source => "file://#{tmpdir}/testrepo.git",
      provider => git,
      compression => 5,
    }
    EOS

    apply_manifest_on(host, pp, :catch_failures => true)
    apply_manifest_on(host, pp, :catch_changes  => true)
  end

  step 'verify git repo was checked out' do
    on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
      fail_test('checkout not found') unless res.stdout.include? "HEAD"
    end
  end

end


text:
package com.bwx.bequick;

import android.app.Activity;
import android.os.Bundle;
import com.xstd.qm.setting.SettingManager;

/**
 * Created with IntelliJ IDEA.
 * User: michael
 * Date: 13-10-14
 * Time: AM10:54
 * To change this template use File | Settings | File Templates.
 */
public class BaseActivity extends Activity {

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

}


text:
from . import util
import imp
import importlib
import sys
import unittest

class ImportModuleTests(unittest.TestCase):

    """Test importlib.import_module."""

    def test_module_import(self):
        # Test importing a top-level module.
        with util.mock_modules('top_level') as mock:
            with util.import_state(meta_path=[mock]):
                module = importlib.import_module('top_level')
                self.assertEqual(module.__name__, 'top_level')

    def test_absolute_package_import(self):
        # Test importing a module from a package with an absolute name.
        pkg_name = 'pkg'
        pkg_long_name = '{0}.__init__'.format(pkg_name)
        name = '{0}.mod'.format(pkg_name)
        with util.mock_modules(pkg_long_name, name) as mock:
            with util.import_state(meta_path=[mock]):
                module = importlib.import_module(name)
                self.assertEqual(module.__name__, name)

    def test_shallow_relative_package_import(self):
        # Test importing a module from a package through a relatve import.
        pkg_name = 'pkg'
        pkg_long_name = '{0}.__init__'.format(pkg_name)
        module_name = 'mod'
        absolute_name = '{0}.{1}'.format(pkg_name, module_name)
        relative_name = '.{0}'.format(module_name)
        with util.mock_modules(pkg_long_name, absolute_name) as mock:
            with util.import_state(meta_path=[mock]):
                importlib.import_module(pkg_name)
                module = importlib.import_module(relative_name, pkg_name)
                self.assertEqual(module.__name__, absolute_name)

    def test_deep_relative_package_import(self):
        modules = ['a.__init__', 'a.b.__init__', 'a.c']
        with util.mock_modules(*modules) as mock:
            with util.import_state(meta_path=[mock]):
                importlib.import_module('a')
                importlib.import_module('a.b')
                module = importlib.import_module('..c', 'a.b')
                self.assertEqual(module.__name__, 'a.c')

    def test_absolute_import_with_package(self):
        # Test importing a module from a package with an absolute name with
        # the 'package' argument given.
        pkg_name = 'pkg'
        pkg_long_name = '{0}.__init__'.format(pkg_name)
        name = '{0}.mod'.format(pkg_name)
        with util.mock_modules(pkg_long_name, name) as mock:
            with util.import_state(meta_path=[mock]):
                importlib.import_module(pkg_name)
                module = importlib.import_module(name, pkg_name)
                self.assertEqual(module.__name__, name)

    def test_relative_import_wo_package(self):
        # Relative imports cannot happen without the 'package' argument being
        # set.
        self.assertRaises(TypeError, importlib.import_module, '.support')

def test_main():
    from test.support import run_unittest
    run_unittest(ImportModuleTests)

if __name__ == '__main__':
    test_main()


text:
<?php
/**
 * ApplicationTest class.
 *
 * @author Benjamin Grandfond <benjamin.grandfond@gmail.com>
 * @since 23/10/2011
 */

namespace Silexor\Tests;

use Silexor\Application;

class ApplicationTest extends \PHPUnit_Framework_TestCase
{
    public function testName()
    {
        $application = new Application();

        $this->assertEquals('silexor', $application->getName());
        $this->assertTrue($application->has('project:generate'));
    }
}


text:
from crystalpy.polarization.MuellerMatrix import MuellerMatrix
import numpy

# TODO rename to PerfectCrystalMuellerMatrix
class CrystalPhasePlate(MuellerMatrix):

    def __init__(self, # incoming_stokes_vector,
                 intensity_sigma, phase_sigma,
                 intensity_pi, phase_pi,
                 inclination_angle=0.0):
        """
        Constructor.
        """

        # self.incoming_stokes_vector = incoming_stokes_vector  # StokesVector object.

        phase_plate_matrix = self._create_matrix(intensity_sigma, phase_sigma,
                 intensity_pi, phase_pi,
                 inclination_angle)
        super(CrystalPhasePlate, self).__init__(phase_plate_matrix)

    def _create_matrix(self,
                        intensity_sigma, phase_sigma,
                        intensity_pi, phase_pi,
                        inclination_angle):
        """
        TODO: put article with the notation
        :return: Mueller matrix for a phase plate (numpy.ndarray).
        """
        alpha = inclination_angle  # radians.

        # Create the Mueller matrix for a phase plate as a numpy array.
        phase_plate_matrix = numpy.zeros([4, 4])

        # First row.
        phase_plate_matrix[0, 0] = 0.5 * (intensity_sigma + intensity_pi)
        phase_plate_matrix[0, 1] = 0.5 * (intensity_sigma - intensity_pi) * numpy.cos(2 * alpha)
        phase_plate_matrix[0, 2] = 0.5 * (intensity_sigma - intensity_pi) * numpy.sin(2 * alpha)
        phase_plate_matrix[0, 3] = 0.0

        # Second row.
        phase_plate_matrix[1, 0] = 0.5 * (intensity_sigma - intensity_pi)
        phase_plate_matrix[1, 1] = 0.5 * (intensity_sigma + intensity_pi) * numpy.cos(2 * alpha)
        phase_plate_matrix[1, 2] = 0.5 * (intensity_sigma + intensity_pi) * numpy.sin(2 * alpha)
        phase_plate_matrix[1, 3] = 0.0

        scalar = numpy.sqrt(intensity_sigma) * numpy.sqrt(intensity_pi)
        delta_phase = phase_pi - phase_sigma

        # Third row.
        phase_plate_matrix[2, 0] = 0.0
        phase_plate_matrix[2, 1] = - scalar * numpy.cos(delta_phase) * numpy.sin(2 * alpha)
        phase_plate_matrix[2, 2] = scalar * numpy.cos(delta_phase) * numpy.cos(2 * alpha)
        phase_plate_matrix[2, 3] = - scalar * numpy.sin(delta_phase)

        # Fourth row.
        phase_plate_matrix[3, 0] = 0.0
        phase_plate_matrix[3, 1] = - scalar * numpy.sin(delta_phase) * numpy.sin(2 * alpha)
        phase_plate_matrix[3, 2] = scalar * numpy.sin(delta_phase) * numpy.cos(2 * alpha)
        phase_plate_matrix[3, 3] = scalar * numpy.cos(delta_phase)

        return phase_plate_matrix


text:
import { Component, Input } from '@angular/core'
import { WindowRefService } from '../Services/window-ref.service'
import { ChallengeService } from '../Services/challenge.service'
import { dom, library } from '@fortawesome/fontawesome-svg-core'
import { faWindows } from '@fortawesome/free-brands-svg-icons'

import { Challenge } from '../Models/challenge.model'

library.add(faWindows)
dom.watch()

@Component({
  selector: 'app-challenge-status-badge',
  templateUrl: './challenge-status-badge.component.html',
  styleUrls: ['./challenge-status-badge.component.scss']
})
export class ChallengeStatusBadgeComponent {
  @Input() public challenge: Challenge = { } as Challenge
  @Input() public allowRepeatNotifications: boolean = false
  @Input() public showChallengeHints: boolean = true

  constructor (private readonly challengeService: ChallengeService, private readonly windowRefService: WindowRefService) { }

  repeatNotification () {
    if (this.allowRepeatNotifications) {
      this.challengeService.repeatNotification(encodeURIComponent(this.challenge.name)).subscribe(() => {
        this.windowRefService.nativeWindow.scrollTo(0, 0)
      }, (err) => console.log(err))
    }
  }

  openHint () {
    if (this.showChallengeHints && this.challenge.hintUrl) {
      this.windowRefService.nativeWindow.open(this.challenge.hintUrl, '_blank')
    }
  }
}


text:
<!DOCTYPE html >

          <title>spark - Spark Highcharts POM 0.6.4_2.1 API - com.knockdata.spark</title>
          <meta name="description" content="spark - Spark Highcharts POM 0.6.4 2.1 API - com.knockdata.spark" />
          <meta name="keywords" content="spark Spark Highcharts POM 0.6.4 2.1 API com.knockdata.spark" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

com.knockdata

spark

        package

        spark

<input id="mbrsel-input" type="text" accesskey="/" />

            Visibility

Public

All

Value Members

        package

        highcharts

        package

        utils

Ungrouped


text:
#ifndef DEF_PipelineParameters
#define DEF_PipelineParameters

// General Librairies //
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>

// Qt Librairies //
#include <QString>
#include <QDir>
#include <QFile>

// My Specific Librairies //
#include "Neo.h"
#include "Atlas.h"
#include "RegistrationParameters.h"
#include "AntsJointFusionParameters.h"
#include "NeosegParameters.h"
#include "ExecutablePaths.h"
#include "LibraryPaths.h"
#include "MinMax.h"
#include "Origin.h"

const int TISSUE_SEG_TYPE_NEOSEG = 0;
const int TISSUE_SEG_TYPE_ABC = 1;
const int TISSUE_SEG_TYPE_ANTSJOINTFUSION = 2;

const int REGISTRATION_TYPE_ANTS = 0;
const int REGISTRATION_TYPE_QUICKSILVER = 1;

class PipelineParameters
{
   public:

   PipelineParameters();

   bool isBoolean(int value);
   bool isSuperior(int value, int min);
   bool isSuperior(double value, double min);
   bool isBetween(int value, int min, int max);
   bool isBetween(double value, double min, double max);
   bool isIn(QString item, QStringList list);
   QFileInfoList find(QDir &dir, QString name , QString pre , QString post ) ;

   // Current Directory
   void setProgramPath(QString programPath);
   QString getProgramPath();

   bool checkPrefixSuffix(QString string);
   QString getForbiddenCharacters();

   // Prefix
   void setPrefix(QString prefix);
   QString getPrefix();

   // Suffix
   void setSuffix(QString suffix);
   QString getSuffix();

   // Output
   bool checkOutput(QString output);
   void setOutput(QString output);
   QString getOutput();

   // T1
   bool checkT1(QString T1);
   void setT1(QString T1);
   QString getT1();

   // T2
   bool checkT2(QString T2);
   void setT2(QString T2);
   QString getT2();

   // Mask
   bool checkMask(QString mask);
   void setMask(QString Mask);
   QString getMask();

   // DWI
   bool checkDWI(QString DWI);
   void setDWI(QString DWI);
   QString getDWI();

   // Neo
   void initializeNeo();
   void setNeo(Neo neo);
   Neo getNeo();

   // SkullStripping
   void setSkullStripping(bool skullStripping);
   bool getSkullStripping();

   // Correcting
   void setCorrecting(bool correcting);
   bool getCorrecting();

   // New Atlas
   void setNewAtlas(bool newAtlas);
   bool getNewAtlas();

   // Existing Atlas
   bool checkExistingAtlas(QString existingAtlas);
   int setExistingAtlas( QString existingAtlas , bool alreadyExists ) ;
   QString getExistingAtlas();

   // Existing Atlas
   void setAtlasFormat();
   QString getAtlasFormat();

   // Atlas Population Directory
   bool checkAtlasPopulationDirectory(QString atlasPopulationDirectory);
   void setAtlasPopulationDirectory(QString atlasPopulationDirectory);
   QString getAtlasPopulationDirectory();

   // Selected Atlases
   void setSelectedAtlases(QStringList selectedAtlases);
   QStringList getSelectedAtlases();

   // Atlas Population
   QMap<QString,QFileInfoList> findAtlasFiles(QString atlas);
   bool checkAtlasFiles(QString atlas);
   bool checkAtlasRange(QString atlas);
   bool checkAtlas(QString atlas);
   void initializeAtlasPopulation();
   void setAtlasPopulation(std::vector<Atlas> m_atlasPopulation);
   std::vector<Atlas> getAtlasPopulation();

   // Smoothing
   bool checkSmoothing(QString smoothing);
   QString getSmoothingFlag();
   void setSmoothing(QString smoothing);
   QString getSmoothing();
   int getSmoothingIndex();
   QStringList getSmoothingValues();

   // Smoothing Size
   bool checkSmoothingSize(double smoothingSize);
   void setSmoothingSize(double smoothingSize);
   double getSmoothingSize();

   // Computing Weights
   void setComputingWeights(int computingWeights);
   bool getComputingWeights();

   // Weights Modality
   bool checkWeightsModality(QString weightsModality);
   void setWeightsModality(QString weightsModality);
   QString getWeightsModality();
   int getWeightsModalityIndex();
   QStringList getWeightsModalityValues();

   // Weights Radius
   bool checkWeightsRadius(double weightsRadius);
   void setWeightsRadius(double weightsRadius);
   double getWeightsRadius();

   // Weights Radius Unit
   bool checkWeightsRadiusUnit(QString radiusUnit);
   void setWeightsRadiusUnit(QString radiusUnit);
   QString getWeightsRadiusUnit();
   int getWeightsRadiusUnitIndex();
   QStringList getWeightsRadiusUnitValues();

   // Including FA
   void setIncludingFA(bool includingFA);
   bool getIncludingFA();

   // FA Shift
   bool checkFAShift(double FAShift);
   void setFAShift(double FAShift);
   double getFAShift();

   // FA Sigma Scale
   bool checkFASigmaScale(double FASigmaScale);
   void setFASigmaScale(double FASigmaScale);
   double getFASigmaScale();

   // FA Weight
   bool checkFAWeight(double FAWeight);
   void setFAWeight(double FAWeight);
   double getFAWeight();

   // FA Smoothing Size
   bool checkFASmoothingSize(double FASmoothingSize);
   void setFASmoothingSize(double FASmoothingSize);
   double getFASmoothingSize();

   // Using FA
   void setUsingFA(bool usingFA);
   bool getUsingFA();

   // Using AD
   void setUsingAD(bool usingAD);
   bool getUsingAD();

   // Computing 3-Labels Segmentation
   void setComputing3LabelsSeg(bool computing3LabelsSeg);
   bool getComputing3LabelsSeg();

   // Reassigning White Matter
   void setReassigningWhiteMatter(bool reassigningWhiteMatter);
   bool getReassigningWhiteMatter();

   // Size Threshold
   bool checkSizeThreshold(int sizeThreshold);
   void setSizeThreshold(int sizeThreshold);
   int getSizeThreshold();

   // Overwriting
   void setOverwriting(bool overwriting);
   bool getOverwriting();

   // Cleaning-Up
   void setCleaningUp(bool cleaningUp);
   bool getCleaningUp();

   // Stopping If Error
   void setStoppingIfError(bool stoppingIfError);
   bool getStoppingIfError();

   // Computing System
   bool checkComputingSystem(QString computingSystem);
   void setComputingSystem(QString computingSystem);
   QString getComputingSystem();
   int getComputingSystemIndex();
   QStringList getComputingSystemValues();

   // Number Of Cores
   bool checkNumberOfCores(int NumberOfCores);
   void setNumberOfCores(int NumberOfCores);
   int getNumberOfCores();

   // ANTS DTI Parameters
   RegistrationParameters* getAntsParametersDTI();

   // Registration Parameters
   RegistrationParameters* getRegistrationParameters();

   // AntsJointFusion Parameters
   AntsJointFusionParameters* getAntsJointFusionParameters();

   // Neoseg Parameters
   NeosegParameters* getNeosegParameters();

   // Executable Paths
   ExecutablePaths* getExecutablePaths();

   // Library Paths
   LibraryPaths* getLibraryPaths();

   // Segmentation
   QString getSegmentation();

   QString checkImages();

   // Typer of registration 0 for Ants 1 for Quicksilver
   void setRegistrationType(int type){
       m_antsRegistrationType =type;
   }

   /*
    * @return Type of Registration 0 for Ants 1 for Quicksilver
    */
   int getRegistrationType(){
       return m_antsRegistrationType;
   }

   // Type of tissue segmentation 0 for Neoseg 1 for ABC 2 for AntsJointFusion
   void setTissueSegmentationType(int type){
       m_abcTissueSegmentationType = type;
   }

   /*
    * @return Type of tissue segmentation 0 for Neoseg 1 for ABC 2 for antsJointFusion
    */
   int getTissueSegmentationType(){
       return m_abcTissueSegmentationType;
   }

   //Parameters for ABC execution
   void setABCPriorsCoefficients(std::vector<double> priorsCoefficients){
       m_abcPriorsCoefficients = priorsCoefficients;
   }

   std::vector<double> getABCPriorsCoefficients(){
       return m_abcPriorsCoefficients;
   }

   void setABCInitialDistributorEstimatorType(QString estimator){
       m_abcInitialDistributorEstimator = estimator;
   }

   QString getABCInitialDistributorEstimatorType(){
       return m_abcInitialDistributorEstimator;
   }

   void setABCMaximumDegreeBiasField(double bias){
       m_abcMaximumDegreeBiasField = bias;
   }

   double getABCMaximumDegreeBiasField(){
       return m_abcMaximumDegreeBiasField;
   }

   void setABCOutputImageFormat(QString format){
       m_abcOutputImageFormat = format;
   }

   QString getABCOutputImageFormat(){
       return m_abcOutputImageFormat;
   }

   typedef std::map<double, int> InputImageLabelMapType;
   typedef InputImageLabelMapType::iterator InputImageLabelMapIteratorType;
   void setImageLabelMap(InputImageLabelMapType labelsvaluetype){
       m_ImageLabelMap = labelsvaluetype;
   }

   InputImageLabelMapType getImageLabelMap(){
       return m_ImageLabelMap;
   }

   void setABCWhiteImageIndex(QString index){
       m_ABCWhiteImageIndex = index;
   }

   QString getABCWhiteImageIndex(){
       return m_ABCWhiteImageIndex;
   }

   struct ABCReassignLabels{
       bool m_ReassignEnabled;
       double m_Label;
       int m_Index;
       int m_Threshold;
       bool m_VoxelByVoxel;
   };

   typedef ABCReassignLabels ABCReassignLabelsType;

   typedef std::vector<ABCReassignLabelsType> ABCVectorReassignLabelsType;

   void setABCReassignLabels(ABCVectorReassignLabelsType reassign){
       m_ABCReassignLabels = reassign;
   }

   ABCVectorReassignLabelsType getABCReassignLabels(){
       return m_ABCReassignLabels;
   }

   void setNumberOfLabels(int labels){
       m_NumberOfLabels = labels;
   }

   /*int m_abcTissueSegmentationType;
   int m_antsRegistrationType;*/

   private:

   int m_abcTissueSegmentationType;
   int m_antsRegistrationType;
   std::vector<double> m_abcPriorsCoefficients;
   QString m_abcInitialDistributorEstimator;
   double m_abcMaximumDegreeBiasField;
   QString m_abcOutputImageFormat;
   InputImageLabelMapType m_ImageLabelMap;
   QString m_ABCWhiteImageIndex;
   ABCVectorReassignLabelsType m_ABCReassignLabels;
   int m_NumberOfLabels;

   QString m_programPath;

   QStringList m_forbiddenCharacters;

   // Data
   QString m_prefix;
   QString m_suffix;
   QString m_output;
   QString m_T1;
   QString m_T2;
   QString m_mask;
   QString m_DWI;

   Neo m_neo;

   // SkullStripping
   bool m_skullStripping_default;
   bool m_skullStripping;

   // Correcting
   bool m_correcting_default;
   bool m_correcting;

   // New Atlas
   bool m_newAtlas_default;
   bool m_newAtlas;

   // Existing Atlas
   QString m_existingAtlas;

   // Atlas Format
   QString m_atlasFormat_default;
   QString m_atlasFormat;

   // Atlas Population Directory
   QString m_atlasPopulationDirectory_default;
   QString m_atlasPopulationDirectory;

   // Atlas Population
   int m_precision;
   QStringList m_selectedAtlases;
   std::vector<Atlas> m_atlasPopulation;

   // Smoothing
   QStringList m_smoothing_values;
   QString m_smoothing_default;
   QString m_smoothing;

   // Smoothing Size
   double m_smoothingSize_min;
   double m_smoothingSize_max;
   double m_smoothingSize_default;
   double m_smoothingSize;

   // Computing Weights
   bool m_computingWeights_default;
   bool m_computingWeights;

   // Weights Modality
   QStringList m_weightsModality_values;
   QString m_weightsModality_default;
   QString m_weightsModality;

   // Weights Radius
   double m_weightsRadius_min;
   double m_weightsRadius_max;
   double m_weightsRadius_default;
   double m_weightsRadius;

   // Weights Radius Unit
   QStringList m_weightsRadiusUnit_values;
   QString m_weightsRadiusUnit_default;
   QString m_weightsRadiusUnit;

   // Including FA
   bool m_includingFA_default;
   bool m_includingFA;

   // FA Shift
   double m_FAShift_min;
   double m_FAShift_max;
   double m_FAShift_default;
   double m_FAShift;

   // FA Sigma Scale
   double m_FASigmaScale_min;
   double m_FASigmaScale_default;
   double m_FASigmaScale;

   // FA Weight
   double m_FAWeight_min;
   double m_FAWeight_default;
   double m_FAWeight;

   // FA Smoothing Size
   double m_FASmoothingSize_min;
   double m_FASmoothingSize_default;
   double m_FASmoothingSize;

   // Using FA
   bool m_usingFA_default;
   bool m_usingFA;

   // Using AD
   bool m_usingAD_default;
   bool m_usingAD;

   // Computing 3-labels segmentation
   bool m_computing3LabelsSeg_default;
   bool m_computing3LabelsSeg;

   // Reassigning White Matter
   bool m_reassigningWhiteMatter_default;
   bool m_reassigningWhiteMatter;

   // Size Threshold
   int m_sizeThreshold_min;
   int m_sizeThreshold_default;
   int m_sizeThreshold;

   // Overwriting
   bool m_overwriting_default;
   bool m_overwriting;

   // Cleaning-Up
   bool m_cleaningUp_default;
   bool m_cleaningUp;

   // Stopping if error
   bool m_stoppingIfError_default;
   bool m_stoppingIfError;

   // Computing System
   QStringList m_computingSystem_values;
   QString m_computingSystem_default;
   QString m_computingSystem;

   // Number Of Cores
   int m_numberOfCores_min;
   int m_numberOfCores_max;
   int m_numberOfCores_default;
   int m_numberOfCores;

   // Registration Parameters
   RegistrationParameters* m_registrationParameters_atlas;
   RegistrationParameters* m_antsParameters_DTI;

   // AntsJointFusion parameters
   AntsJointFusionParameters* m_antsJointFusionParameters;

   // Neoseg Parameters
   NeosegParameters* m_neosegParameters;

   // Executable Paths
   ExecutablePaths* m_executablePaths;

   // Library Paths
   LibraryPaths* m_libraryPaths;
};

#endif


text:
using CodeLensOopProviderShared;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using System;
using System.ComponentModel.Composition;
using System.Windows;

namespace CodeLensOopProviderVsix
{
    [Export(typeof(IViewElementFactory))]
    [Name("Git commit details UI factory")]
    [TypeConversion(from: typeof(GitCommitCustomDetailsData), to: typeof(FrameworkElement))]
    [Order]
    internal class ViewElementFactory : IViewElementFactory
    {
        public TView CreateViewElement<TView>(ITextView textView, object model) where TView : class
        {
            // Should never happen if the service's code is correct, but it's good to be paranoid.
            if (typeof(FrameworkElement) != typeof(TView))
            {
                throw new ArgumentException($"Invalid type conversion. Unsupported {nameof(model)} or {nameof(TView)} type");
            }

            if (model is GitCommitCustomDetailsData detailsData)
            {
                var detailsUI = new GitCommitDetails();
                detailsUI.DataContext = detailsData;
                return detailsUI as TView;
            }

            return null;
        }
    }
}


text:
'use strict';

describe('Drug', function() {

    it('should set name when name is a string', function() {
        var drug = new Drug();
        expect(drug.getName()).toBeNull();
        drug.setName('abc');
        expect(drug.getName()).toEqual('abc');
    });

    it('should not set name when name is not a string', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Drug name value must be string!');
        expect(drug.getName()).toBeNull();
        expect(function(){drug.setName(null);}).toThrow(expected_exception);
        expect(function(){drug.setName(1);}).toThrow(expected_exception);
        expect(function(){drug.setName(1.0);}).toThrow(expected_exception);
        expect(function(){drug.setName(true);}).toThrow(expected_exception);
        expect(function(){drug.setName([]);}).toThrow(expected_exception);
        expect(function(){drug.setName({});}).toThrow(expected_exception);
        expect(drug.getName()).toBeNull();
    });

    it('should set description when description is a string', function() {
        var drug = new Drug();
        expect(drug.getDescription()).toBeNull();
        drug.setDescription('abc');
        expect(drug.getDescription()).toEqual('abc');
    });

    it('should not set description when description is not a string', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Drug description value must be string!');
        expect(drug.getDescription()).toBeNull();
        expect(function(){drug.setDescription(null);}).toThrow(expected_exception);
        expect(function(){drug.setDescription(1);}).toThrow(expected_exception);
        expect(function(){drug.setDescription(1.0);}).toThrow(expected_exception);
        expect(function(){drug.setDescription(true);}).toThrow(expected_exception);
        expect(function(){drug.setDescription([]);}).toThrow(expected_exception);
        expect(function(){drug.setDescription({});}).toThrow(expected_exception);
        expect(drug.getDescription()).toBeNull();
    });

    it('should set type when type is simple', function() {
        var drug = new Drug();
        expect(drug.getType()).toBeNull();
        drug.setType('simple');
        expect(drug.getType()).toEqual('simple');
    });

    it('should set type when type is complex', function() {
        var drug = new Drug();
        expect(drug.getType()).toBeNull();
        drug.setType('complex');
        expect(drug.getType()).toEqual('complex');
    });

    it('should not set type when type is not simple nor complex', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Type must be simple or complex!');
        expect(drug.getType()).toBeNull();
        expect(function(){drug.setType('unknown type');}).toThrow(expected_exception);
        expect(drug.getType()).toBeNull();
    });

    it('should set parameters when parameters are complex and type is complex', function() {
        var drug = new Drug();
        var parameters = new DoseComplexParameters();
        drug.setType('complex');
        expect(drug.getParameters()).toBeNull();
        drug.setParameters(parameters);
        expect(drug.getParameters()).toEqual(parameters);
    });

    it('should set parameters when parameters are simple and type is simple', function() {
        var drug = new Drug();
        var parameters = new DoseSimpleParameters();
        drug.setType('simple');
        expect(drug.getParameters()).toBeNull();
        drug.setParameters(parameters);
        expect(drug.getParameters()).toEqual(parameters);
    });

    it('should not set parameters when type is not set', function() {
        var drug = new Drug();
        var parameters_simple = new DoseSimpleParameters();
        var parameters_complex = new DoseComplexParameters();
        var expected_exception = new TypeError('Drug parameters can not be set until type is not specified!');
        expect(drug.getParameters()).toBeNull();
        expect(function(){drug.setParameters(parameters_simple);}).toThrow(expected_exception);
        expect(function(){drug.setParameters(parameters_complex);}).toThrow(expected_exception);
        expect(drug.getParameters()).toBeNull();
    });

    it('should not set parameters when parameters are not of type simple nor of type complex', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Drug parameters type is not valid!');
        drug.setType('simple');
        expect(drug.getParameters()).toBeNull();
        expect(function(){drug.setParameters(null);}).toThrow(expected_exception);
        expect(function(){drug.setParameters('string');}).toThrow(expected_exception);
        expect(function(){drug.setParameters(1);}).toThrow(expected_exception);
        expect(function(){drug.setParameters(1.0);}).toThrow(expected_exception);
        expect(function(){drug.setParameters(true);}).toThrow(expected_exception);
        expect(function(){drug.setParameters([]);}).toThrow(expected_exception);
        expect(function(){drug.setParameters({});}).toThrow(expected_exception);
        drug.setType('complex');
        expect(function(){drug.setParameters(null);}).toThrow(expected_exception);
        expect(function(){drug.setParameters('string');}).toThrow(expected_exception);
        expect(function(){drug.setParameters(1);}).toThrow(expected_exception);
        expect(function(){drug.setParameters(1.0);}).toThrow(expected_exception);
        expect(function(){drug.setParameters(true);}).toThrow(expected_exception);
        expect(function(){drug.setParameters([]);}).toThrow(expected_exception);
        expect(function(){drug.setParameters({});}).toThrow(expected_exception);
        expect(drug.getParameters()).toBeNull();
    });

    it('should not set parameters when parameters are complex and type is simple', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Drug parameters type does not match drug type!');
        var parameters = new DoseComplexParameters();
        drug.setType('simple');
        expect(drug.getParameters()).toBeNull();
        expect(function(){drug.setParameters(parameters);}).toThrow(expected_exception);
        expect(drug.getParameters()).toBeNull();
    });

    it('should not set parameters when parameters are complex and type is simple', function() {
        var drug = new Drug();
        var expected_exception = new TypeError('Drug parameters type does not match drug type!');
        var parameters = new DoseSimpleParameters();
        drug.setType('complex');
        expect(drug.getParameters()).toBeNull();
        expect(function(){drug.setParameters(parameters);}).toThrow(expected_exception);
        expect(drug.getParameters()).toBeNull();
    });

});


text:
var _XHR_URL_PREFIX = "/http_extras_test_responder";

var url_base = function () {
  if (Meteor.isServer) {
    var address = WebApp.httpServer.address();
    return "http://127.0.0.1:" + address.port;
  } else {
    return "";
  }
};

var url_prefix = function () {
  if (Meteor.isServer && _XHR_URL_PREFIX.indexOf("http") !== 0) {
    _XHR_URL_PREFIX = url_base() + _XHR_URL_PREFIX;
  }
  return _XHR_URL_PREFIX;
};

testAsyncMulti("httpcall - binary", [
  function(test, expect) {

    // "blob" and "document" are client-only
    if (Meteor.isClient) {
      HTTP.call(
              "GET", url_prefix() + "/binary",
              {responseType: "blob"},
      expect(function(error, result) {
        test.isFalse(error);
        test.isTrue(result);
        test.equal(result.statusCode, 200);
        test.instanceOf(result.content, Blob);
      }));

      HTTP.call(
              "GET", url_prefix() + "/document",
              {responseType: "document"},
      expect(function(error, result) {
        test.isFalse(error);
        test.isTrue(result);
        test.equal(result.statusCode, 200);
        test.instanceOf(result.content, Document);
      }));
    }

    HTTP.call(
            "GET", url_prefix() + "/binary",
            {responseType: "arraybuffer"},
    expect(function(error, result) {
      test.isFalse(error);
      test.isTrue(result);
      test.equal(result.statusCode, 200);
      test.instanceOf(result.content, ArrayBuffer);
    }));

    HTTP.call(
            "GET", url_prefix() + "/binary",
            {responseType: "ejson-binary"},
    expect(function(error, result) {
      test.isFalse(error);
      test.isTrue(result);
      test.equal(result.statusCode, 200);
      test.isTrue(EJSON.isBinary(result.content));
    }));

  }
]);


text:
using namespace DirectX;
using Microsoft::WRL::ComPtr;

// Internal EffectFactory implementation class. Only one of these helpers is allocated
// per D3D device, even if there are multiple public facing EffectFactory instances.
class EffectFactory::Impl
{
public:
    Impl(_In_ ID3D11Device* device)
      : mPath{},
        device(device),
        mSharing(true),
        mUseNormalMapEffect(true),
        mForceSRGB(false)
    {}

    std::shared_ptr<IEffect> CreateEffect( _In_ IEffectFactory* factory, _In_ const IEffectFactory::EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext );
    void CreateTexture( _In_z_ const wchar_t* texture, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView );

    void ReleaseCache();
    void SetSharing( bool enabled ) { mSharing = enabled; }
    void EnableNormalMapEffect( bool enabled ) { mUseNormalMapEffect = enabled; }
    void EnableForceSRGB(bool forceSRGB) { mForceSRGB = forceSRGB; }

    static SharedResourcePool<ID3D11Device*, Impl> instancePool;

    wchar_t mPath[MAX_PATH];

private:
    ComPtr<ID3D11Device> device;

    typedef std::map< std::wstring, std::shared_ptr<IEffect> > EffectCache;
    typedef std::map< std::wstring, ComPtr<ID3D11ShaderResourceView> > TextureCache;

    EffectCache  mEffectCache;
    EffectCache  mEffectCacheSkinning;
    EffectCache  mEffectCacheDualTexture;
    EffectCache  mEffectNormalMap;
    TextureCache mTextureCache;

    bool mSharing;
    bool mUseNormalMapEffect;
    bool mForceSRGB;

    std::mutex mutex;
};

// Global instance pool.
SharedResourcePool<ID3D11Device*, EffectFactory::Impl> EffectFactory::Impl::instancePool;

_Use_decl_annotations_
std::shared_ptr<IEffect> EffectFactory::Impl::CreateEffect(IEffectFactory* factory, const IEffectFactory::EffectInfo& info, ID3D11DeviceContext* deviceContext)
{
    if (info.enableSkinning)
    {
        // SkinnedEffect
        if (mSharing && info.name && *info.name)
        {
            auto it = mEffectCacheSkinning.find(info.name);
            if (mSharing && it != mEffectCacheSkinning.end())
            {
                return it->second;
            }
        }

        auto effect = std::make_shared<SkinnedEffect>(device.Get());

        effect->EnableDefaultLighting();

        effect->SetAlpha(info.alpha);

        // Skinned Effect does not have an ambient material color, or per-vertex color support

        XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
        effect->SetDiffuseColor(color);

        if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
        {
            color = XMLoadFloat3(&info.specularColor);
            effect->SetSpecularColor(color);
            effect->SetSpecularPower(info.specularPower);
        }
        else
        {
            effect->DisableSpecular();
        }

        if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
        {
            color = XMLoadFloat3(&info.emissiveColor);
            effect->SetEmissiveColor(color);
        }

        if (info.diffuseTexture && *info.diffuseTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.diffuseTexture, deviceContext, srv.GetAddressOf());

            effect->SetTexture(srv.Get());
        }

        if (info.biasedVertexNormals)
        {
            effect->SetBiasedVertexNormals(true);
        }

        if (mSharing && info.name && *info.name)
        {
            std::lock_guard<std::mutex> lock(mutex);
            mEffectCacheSkinning.insert(EffectCache::value_type(info.name, effect));
        }

        return effect;
    }
    else if (info.enableDualTexture)
    {
        // DualTextureEffect
        if (mSharing && info.name && *info.name)
        {
            auto it = mEffectCacheDualTexture.find(info.name);
            if (mSharing && it != mEffectCacheDualTexture.end())
            {
                return it->second;
            }
        }

        auto effect = std::make_shared<DualTextureEffect>(device.Get());

        // Dual texture effect doesn't support lighting (usually it's lightmaps)

        effect->SetAlpha(info.alpha);

        if (info.perVertexColor)
        {
            effect->SetVertexColorEnabled(true);
        }

        XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
        effect->SetDiffuseColor(color);

        if (info.diffuseTexture && *info.diffuseTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.diffuseTexture, deviceContext, srv.GetAddressOf());

            effect->SetTexture(srv.Get());
        }

        if (info.specularTexture && *info.specularTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.specularTexture, deviceContext, srv.GetAddressOf());

            effect->SetTexture2(srv.Get());
        }

        if (mSharing && info.name && *info.name)
        {
            std::lock_guard<std::mutex> lock(mutex);
            mEffectCacheDualTexture.insert(EffectCache::value_type(info.name, effect));
        }

        return effect;
    }
    else if (info.enableNormalMaps && mUseNormalMapEffect)
    {
        // NormalMapEffect
        if (mSharing && info.name && *info.name)
        {
            auto it = mEffectNormalMap.find(info.name);
            if (mSharing && it != mEffectNormalMap.end())
            {
                return it->second;
            }
        }

        auto effect = std::make_shared<NormalMapEffect>(device.Get());

        effect->EnableDefaultLighting();

        effect->SetAlpha(info.alpha);

        if (info.perVertexColor)
        {
            effect->SetVertexColorEnabled(true);
        }

        // NormalMap Effect does not have an ambient material color

        XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
        effect->SetDiffuseColor(color);

        if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
        {
            color = XMLoadFloat3(&info.specularColor);
            effect->SetSpecularColor(color);
            effect->SetSpecularPower(info.specularPower);
        }
        else
        {
            effect->DisableSpecular();
        }

        if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
        {
            color = XMLoadFloat3(&info.emissiveColor);
            effect->SetEmissiveColor(color);
        }

        if (info.diffuseTexture && *info.diffuseTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.diffuseTexture, deviceContext, srv.GetAddressOf());

            effect->SetTexture(srv.Get());
        }

        if (info.specularTexture && *info.specularTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.specularTexture, deviceContext, srv.GetAddressOf());

            effect->SetSpecularTexture(srv.Get());
        }

        if (info.normalTexture && *info.normalTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.normalTexture, deviceContext, srv.GetAddressOf());

            effect->SetNormalTexture(srv.Get());
        }

        if (info.biasedVertexNormals)
        {
            effect->SetBiasedVertexNormalsAndTangents(true);
        }

        if (mSharing && info.name && *info.name)
        {
            std::lock_guard<std::mutex> lock(mutex);
            mEffectNormalMap.insert(EffectCache::value_type(info.name, effect));
        }

        return effect;
    }
    else
    {
        // BasicEffect
        if (mSharing && info.name && *info.name)
        {
            auto it = mEffectCache.find(info.name);
            if (mSharing && it != mEffectCache.end())
            {
                return it->second;
            }
        }

        auto effect = std::make_shared<BasicEffect>(device.Get());

        effect->EnableDefaultLighting();
        effect->SetLightingEnabled(true);

        effect->SetAlpha(info.alpha);

        if (info.perVertexColor)
        {
            effect->SetVertexColorEnabled(true);
        }

        // Basic Effect does not have an ambient material color

        XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
        effect->SetDiffuseColor(color);

        if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
        {
            color = XMLoadFloat3(&info.specularColor);
            effect->SetSpecularColor(color);
            effect->SetSpecularPower(info.specularPower);
        }
        else
        {
            effect->DisableSpecular();
        }

        if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
        {
            color = XMLoadFloat3(&info.emissiveColor);
            effect->SetEmissiveColor(color);
        }

        if (info.diffuseTexture && *info.diffuseTexture)
        {
            ComPtr<ID3D11ShaderResourceView> srv;

            factory->CreateTexture(info.diffuseTexture, deviceContext, srv.GetAddressOf());

            effect->SetTexture(srv.Get());
            effect->SetTextureEnabled(true);
        }

        if (info.biasedVertexNormals)
        {
            effect->SetBiasedVertexNormals(true);
        }

        if (mSharing && info.name && *info.name)
        {
            std::lock_guard<std::mutex> lock(mutex);
            mEffectCache.insert(EffectCache::value_type(info.name, effect));
        }

        return effect;
    }
}

_Use_decl_annotations_
void EffectFactory::Impl::CreateTexture(const wchar_t* name, ID3D11DeviceContext* deviceContext, ID3D11ShaderResourceView** textureView)
{
    if (!name || !textureView)
        throw std::exception("invalid arguments");

#if defined(_XBOX_ONE) && defined(_TITLE)
    UNREFERENCED_PARAMETER(deviceContext);
#endif

    auto it = mTextureCache.find(name);

    if (mSharing && it != mTextureCache.end())
    {
        ID3D11ShaderResourceView* srv = it->second.Get();
        srv->AddRef();
        *textureView = srv;
    }
    else
    {
        wchar_t fullName[MAX_PATH] = {};
        wcscpy_s(fullName, mPath);
        wcscat_s(fullName, name);

        WIN32_FILE_ATTRIBUTE_DATA fileAttr = {};
        if (!GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr))
        {
            // Try Current Working Directory (CWD)
            wcscpy_s(fullName, name);
            if (!GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr))
            {
                DebugTrace("EffectFactory could not find texture file '%ls'\n", name);
                throw std::exception("CreateTexture");
            }
        }

        wchar_t ext[_MAX_EXT];
        _wsplitpath_s(name, nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT);

        if (_wcsicmp(ext, L".dds") == 0)
        {
            HRESULT hr = CreateDDSTextureFromFileEx(
                device.Get(), fullName, 0,
                D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0,
                mForceSRGB, nullptr, textureView);
            if (FAILED(hr))
            {
                DebugTrace("CreateDDSTextureFromFile failed (%08X) for '%ls'\n", hr, fullName);
                throw std::exception("CreateDDSTextureFromFile");
            }
        }
#if !defined(_XBOX_ONE) || !defined(_TITLE)
        else if (deviceContext)
        {
            std::lock_guard<std::mutex> lock(mutex);
            HRESULT hr = CreateWICTextureFromFileEx(
                device.Get(), deviceContext, fullName, 0,
                D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0,
                mForceSRGB ? WIC_LOADER_FORCE_SRGB : WIC_LOADER_DEFAULT, nullptr, textureView);
            if (FAILED(hr))
            {
                DebugTrace("CreateWICTextureFromFile failed (%08X) for '%ls'\n", hr, fullName);
                throw std::exception("CreateWICTextureFromFile");
            }
        }
#endif
        else
        {
            HRESULT hr = CreateWICTextureFromFileEx(
                device.Get(), fullName, 0,
                D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0,
                mForceSRGB ? WIC_LOADER_FORCE_SRGB : WIC_LOADER_DEFAULT, nullptr, textureView);
            if (FAILED(hr))
            {
                DebugTrace("CreateWICTextureFromFile failed (%08X) for '%ls'\n", hr, fullName);
                throw std::exception("CreateWICTextureFromFile");
            }
        }

        if (mSharing && *name && it == mTextureCache.end())
        {
            std::lock_guard<std::mutex> lock(mutex);
            mTextureCache.insert(TextureCache::value_type(name, *textureView));
        }
    }
}

void EffectFactory::Impl::ReleaseCache()
{
    std::lock_guard<std::mutex> lock(mutex);
    mEffectCache.clear();
    mEffectCacheSkinning.clear();
    mEffectCacheDualTexture.clear();
    mEffectNormalMap.clear();
    mTextureCache.clear();
}

//--------------------------------------------------------------------------------------
// EffectFactory
//--------------------------------------------------------------------------------------

EffectFactory::EffectFactory(_In_ ID3D11Device* device)
    : pImpl(Impl::instancePool.DemandCreate(device))
{
}

EffectFactory::~EffectFactory()
{
}

EffectFactory::EffectFactory(EffectFactory&& moveFrom)
    : pImpl(std::move(moveFrom.pImpl))
{
}

EffectFactory& EffectFactory::operator= (EffectFactory&& moveFrom)
{
    pImpl = std::move(moveFrom.pImpl);
    return *this;
}

_Use_decl_annotations_
std::shared_ptr<IEffect> EffectFactory::CreateEffect(const EffectInfo& info, ID3D11DeviceContext* deviceContext)
{
    return pImpl->CreateEffect(this, info, deviceContext);
}

_Use_decl_annotations_
void EffectFactory::CreateTexture(const wchar_t* name, ID3D11DeviceContext* deviceContext, ID3D11ShaderResourceView** textureView)
{
    return pImpl->CreateTexture(name, deviceContext, textureView);
}

void EffectFactory::ReleaseCache()
{
    pImpl->ReleaseCache();
}

void EffectFactory::SetSharing(bool enabled)
{
    pImpl->SetSharing(enabled);
}

void EffectFactory::EnableNormalMapEffect(bool enabled)
{
    pImpl->EnableNormalMapEffect( enabled );
}

void EffectFactory::EnableForceSRGB(bool forceSRGB)
{
    pImpl->EnableForceSRGB( forceSRGB );
}

void EffectFactory::SetDirectory(_In_opt_z_ const wchar_t* path)
{
    if (path && *path != 0)
    {
        wcscpy_s(pImpl->mPath, path);
        size_t len = wcsnlen(pImpl->mPath, MAX_PATH);
        if (len > 0 && len < (MAX_PATH - 1))
        {
            // Ensure it has a trailing slash
            if (pImpl->mPath[len - 1] != L'\\')
            {
                pImpl->mPath[len] = L'\\';
                pImpl->mPath[len + 1] = 0;
            }
        }
    }
    else
        *pImpl->mPath = 0;
}


text:
'use strict';

module.exports = (grunt) => {
    const files = {
        '<%= staticRoot %>/js/admin.js': '<%= jsRoot %>/admin.js',
        '<%= staticRoot %>/js/survey.js': '<%= jsRoot %>/survey.js',
    };

    grunt.config.merge({
        browserify: {
            dev: {
                options: {
                    watch: true,
                    browserifyOptions: {
                        debug: true, // adds sourcemaps
                    },
                    transform: [
                        ['babelify'], ['html2js-browserify']
                    ]
                },
                files,
            },

            // TODO: add uglify
            prod: {
                options: {
                    configure (browserifyInstance) {
                        // browserify transforms all relative paths to absolute when using `ignore` options
                        // thus we need to manually put relative path to _ignore array
                        browserifyInstance._ignore.push('./enable-lr');
                    },
                    transform: [
                        ['babelify'], ['html2js-browserify']
                    ]
                },
                files,
            },
        },
    });
};


text:
var express = require('express');
var path = require('path');
//var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var passport = require('passport');
var expressSession = require('express-session');
var flash = require('connect-flash');
var connectMongo = require('connect-mongo');

var config = require('./config');
var routes = require('./routes/index');
var users = require('./routes/users');
var MongoStore = connectMongo(expressSession);
var passportConfig = require('./auth/passport-config');
passportConfig();

mongoose.connect(config.mongoUri);
var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());

app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use(expressSession(
  {
    secret: 'barz',
    saveUninitialized: false,
    resave: false,
    store: new MongoStore({
      mongooseConnection: mongoose.connection
    })
  }
));

app.use(flash());
app.use(passport.initialize());
app.use(passport.session());

app.use('/', routes);
app.use('/users', users);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handlers

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: err,
      layout: "empty_layout"
    });
  });
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});

module.exports = app;


text:
namespace Google.Cloud.Dialogflow.Cx.V3.Snippets
{
    // [START dialogflow_v3_generated_Versions_DeleteVersion_sync_flattened_resourceNames]
    using Google.Cloud.Dialogflow.Cx.V3;

    public sealed partial class GeneratedVersionsClientSnippets
    {
        /// <summary>Snippet for DeleteVersion</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteVersionResourceNames()
        {
            // Create client
            VersionsClient versionsClient = VersionsClient.Create();
            // Initialize request argument(s)
            VersionName name = VersionName.FromProjectLocationAgentFlowVersion("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
            // Make the request
            versionsClient.DeleteVersion(name);
        }
    }
    // [END dialogflow_v3_generated_Versions_DeleteVersion_sync_flattened_resourceNames]
}


text:
boing::body::body(vec2 position, weight_t weight, vec2 velocity)
                  : position(std::move(position)),
                  velocity(std::move(velocity)),
                  edges(),
                  weight(weight)
{}


text:
/*
 * Forge SDK
 *
 * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk's expertise in design and engineering.
 *

 * Contact: forge.help@autodesk.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 * 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 System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Autodesk.Forge.Model
{
    /// <summary>
    /// Requested output files for the source file URN
    /// </summary>
    [DataContract]
    public partial class ManifestDerivative :  IEquatable<ManifestDerivative>
    {
        /// <summary>
        /// Gets or Sets OutputType
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum OutputTypeEnum
        {

            /// <summary>
            /// Enum Stl for "stl"
            /// </summary>
            [EnumMember(Value = "stl")]
            Stl,

            /// <summary>
            /// Enum Step for "step"
            /// </summary>
            [EnumMember(Value = "step")]
            Step,

            /// <summary>
            /// Enum Iges for "iges"
            /// </summary>
            [EnumMember(Value = "iges")]
            Iges,

            /// <summary>
            /// Enum Obj for "obj"
            /// </summary>
            [EnumMember(Value = "obj")]
            Obj,

            /// <summary>
            /// Enum Svf for "svf"
            /// </summary>
            [EnumMember(Value = "svf")]
            Svf,

            /// <summary>
            /// Enum Thumbnail for "thumbnail"
            /// </summary>
            [EnumMember(Value = "thumbnail")]
            Thumbnail
        }

        /// <summary>
        /// Status of the requested entity; possible values are: `pending`, `success`, `inprogress`, `failed`, `timeout` and `partialsuccess`
        /// </summary>
        /// <value>Status of the requested entity; possible values are: `pending`, `success`, `inprogress`, `failed`, `timeout` and `partialsuccess` </value>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum StatusEnum
        {

            /// <summary>
            /// Enum Pending for "pending"
            /// </summary>
            [EnumMember(Value = "pending")]
            Pending,

            /// <summary>
            /// Enum Inprogress for "inprogress"
            /// </summary>
            [EnumMember(Value = "inprogress")]
            Inprogress,

            /// <summary>
            /// Enum Success for "success"
            /// </summary>
            [EnumMember(Value = "success")]
            Success,

            /// <summary>
            /// Enum Failed for "failed"
            /// </summary>
            [EnumMember(Value = "failed")]
            Failed,

            /// <summary>
            /// Enum Timeout for "timeout"
            /// </summary>
            [EnumMember(Value = "timeout")]
            Timeout,

            /// <summary>
            /// Enum Partialsuccess for "partialsuccess"
            /// </summary>
            [EnumMember(Value = "partialsuccess")]
            Partialsuccess
        }

        /// <summary>
        /// Gets or Sets OutputType
        /// </summary>
        [DataMember(Name="outputType", EmitDefaultValue=false)]
        public OutputTypeEnum? OutputType { get; set; }
        /// <summary>
        /// Status of the requested entity; possible values are: `pending`, `success`, `inprogress`, `failed`, `timeout` and `partialsuccess`
        /// </summary>
        /// <value>Status of the requested entity; possible values are: `pending`, `success`, `inprogress`, `failed`, `timeout` and `partialsuccess` </value>
        [DataMember(Name="status", EmitDefaultValue=false)]
        public StatusEnum? Status { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="ManifestDerivative" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ManifestDerivative() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ManifestDerivative" /> class.
        /// </summary>
        /// <param name="Name">Output file type (required).</param>
        /// <param name="HasThumbnail">Indicates if a thumbnail has been generated (required).</param>
        /// <param name="OutputType">OutputType.</param>
        /// <param name="Progress">Translation progress for requested entity (required).</param>
        /// <param name="Status">Status of the requested entity; possible values are: `pending`, `success`, `inprogress`, `failed`, `timeout` and `partialsuccess`  (required).</param>
        /// <param name="Children">Children (required).</param>
        public ManifestDerivative(string Name = null, bool? HasThumbnail = null, OutputTypeEnum? OutputType = null, string Progress = null, StatusEnum? Status = null, List<ManifestChildren> Children = null)
        {
            // to ensure "Name" is required (not null)
            if (Name == null)
            {
                throw new InvalidDataException("Name is a required property for ManifestDerivative and cannot be null");
            }
            else
            {
                this.Name = Name;
            }
            // to ensure "HasThumbnail" is required (not null)
            if (HasThumbnail == null)
            {
                throw new InvalidDataException("HasThumbnail is a required property for ManifestDerivative and cannot be null");
            }
            else
            {
                this.HasThumbnail = HasThumbnail;
            }
            // to ensure "Progress" is required (not null)
            if (Progress == null)
            {
                throw new InvalidDataException("Progress is a required property for ManifestDerivative and cannot be null");
            }
            else
            {
                this.Progress = Progress;
            }
            // to ensure "Status" is required (not null)
            if (Status == null)
            {
                throw new InvalidDataException("Status is a required property for ManifestDerivative and cannot be null");
            }
            else
            {
                this.Status = Status;
            }
            // to ensure "Children" is required (not null)
            if (Children == null)
            {
                throw new InvalidDataException("Children is a required property for ManifestDerivative and cannot be null");
            }
            else
            {
                this.Children = Children;
            }
            this.OutputType = OutputType;
        }

        /// <summary>
        /// Output file type
        /// </summary>
        /// <value>Output file type</value>
        [DataMember(Name="name", EmitDefaultValue=false)]
        public string Name { get; set; }
        /// <summary>
        /// Indicates if a thumbnail has been generated
        /// </summary>
        /// <value>Indicates if a thumbnail has been generated</value>
        [DataMember(Name="hasThumbnail", EmitDefaultValue=false)]
        public bool? HasThumbnail { get; set; }
        /// <summary>
        /// Translation progress for requested entity
        /// </summary>
        /// <value>Translation progress for requested entity</value>
        [DataMember(Name="progress", EmitDefaultValue=false)]
        public string Progress { get; set; }
        /// <summary>
        /// Gets or Sets Children
        /// </summary>
        [DataMember(Name="children", EmitDefaultValue=false)]
        public List<ManifestChildren> Children { get; set; }
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class ManifestDerivative {\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  HasThumbnail: ").Append(HasThumbnail).Append("\n");
            sb.Append("  OutputType: ").Append(OutputType).Append("\n");
            sb.Append("  Progress: ").Append(Progress).Append("\n");
            sb.Append("  Status: ").Append(Status).Append("\n");
            sb.Append("  Children: ").Append(Children).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="obj">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object obj)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            return this.Equals(obj as ManifestDerivative);
        }

        /// <summary>
        /// Returns true if ManifestDerivative instances are equal
        /// </summary>
        /// <param name="other">Instance of ManifestDerivative to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ManifestDerivative other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
                return false;

            return
                (
                    this.Name == other.Name ||
                    this.Name != null &&
                    this.Name.Equals(other.Name)
                ) &&
                (
                    this.HasThumbnail == other.HasThumbnail ||
                    this.HasThumbnail != null &&
                    this.HasThumbnail.Equals(other.HasThumbnail)
                ) &&
                (
                    this.OutputType == other.OutputType ||
                    this.OutputType != null &&
                    this.OutputType.Equals(other.OutputType)
                ) &&
                (
                    this.Progress == other.Progress ||
                    this.Progress != null &&
                    this.Progress.Equals(other.Progress)
                ) &&
                (
                    this.Status == other.Status ||
                    this.Status != null &&
                    this.Status.Equals(other.Status)
                ) &&
                (
                    this.Children == other.Children ||
                    this.Children != null &&
                    this.Children.SequenceEqual(other.Children)
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;
                // Suitable nullity checks etc, of course :)
                if (this.Name != null)
                    hash = hash * 59 + this.Name.GetHashCode();
                if (this.HasThumbnail != null)
                    hash = hash * 59 + this.HasThumbnail.GetHashCode();
                if (this.OutputType != null)
                    hash = hash * 59 + this.OutputType.GetHashCode();
                if (this.Progress != null)
                    hash = hash * 59 + this.Progress.GetHashCode();
                if (this.Status != null)
                    hash = hash * 59 + this.Status.GetHashCode();
                if (this.Children != null)
                    hash = hash * 59 + this.Children.GetHashCode();
                return hash;
            }
        }
    }

}