text:
package opennlp.tools.ml.maxent.quasinewton;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import opennlp.tools.ml.AbstractEventTrainer;
import opennlp.tools.ml.maxent.quasinewton.QNMinimizer.Evaluator;
import opennlp.tools.ml.model.AbstractModel;
import opennlp.tools.ml.model.Context;
import opennlp.tools.ml.model.DataIndexer;
import opennlp.tools.util.TrainingParameters;

/**
 * Maxent model trainer using L-BFGS algorithm.
 */
public class QNTrainer extends AbstractEventTrainer {

  public static final String MAXENT_QN_VALUE = "MAXENT_QN";

  public static final String THREADS_PARAM = "Threads";
  public static final int THREADS_DEFAULT  = 1;

  public static final String L1COST_PARAM   = "L1Cost";
  public static final double L1COST_DEFAULT = 0.1;

  public static final String L2COST_PARAM   = "L2Cost";
  public static final double L2COST_DEFAULT = 0.1;

  // Number of Hessian updates to store
  public static final String M_PARAM = "NumOfUpdates";
  public static final int M_DEFAULT  = 15;

  // Maximum number of function evaluations
  public static final String MAX_FCT_EVAL_PARAM = "MaxFctEval";
  public static final int MAX_FCT_EVAL_DEFAULT  = 30000;

  // Number of threads
  private int threads;

  // L1-regularization cost
  private double l1Cost;

  // L2-regularization cost
  private double l2Cost;

  // Settings for QNMinimizer
  private int m;
  private int maxFctEval;

  public QNTrainer(TrainingParameters parameters) {
    super(parameters);
  }

  // Constructor -- to log. For testing purpose
  public QNTrainer(boolean printMessages) {
    this(M_DEFAULT, printMessages);
  }

  // Constructor -- m : number of hessian updates to store. For testing purpose
  public QNTrainer(int m) {
    this(m, true);
  }

  // Constructor -- to log, number of hessian updates to store. For testing purpose
  public QNTrainer(int m, boolean verbose) {
    this(m, MAX_FCT_EVAL_DEFAULT, verbose);
  }

  // For testing purpose
  public QNTrainer(int m, int maxFctEval, boolean printMessages) {
    this.printMessages    = printMessages;
    this.m          = m < 0 ? M_DEFAULT : m;
    this.maxFctEval = maxFctEval < 0 ? MAX_FCT_EVAL_DEFAULT : maxFctEval;
    this.threads    = THREADS_DEFAULT;
    this.l1Cost     = L1COST_DEFAULT;
    this.l2Cost     = L2COST_DEFAULT;
  }

  // >> Members related to AbstractEventTrainer
  public QNTrainer() {
  }

  @Override
  public void init(TrainingParameters trainingParameters, Map<String, String> reportMap) {
    super.init(trainingParameters,reportMap);
    this.m = trainingParameters.getIntParameter(M_PARAM, M_DEFAULT);
    this.maxFctEval = trainingParameters.getIntParameter(MAX_FCT_EVAL_PARAM, MAX_FCT_EVAL_DEFAULT);
    this.threads = trainingParameters.getIntParameter(THREADS_PARAM, THREADS_DEFAULT);
    this.l1Cost = trainingParameters.getDoubleParameter(L1COST_PARAM, L1COST_DEFAULT);
    this.l2Cost = trainingParameters.getDoubleParameter(L2COST_PARAM, L2COST_DEFAULT);
  }

  @Override
  @Deprecated
  public void init(Map<String, String> trainParams, Map<String, String> reportMap) {
    init(new TrainingParameters(trainParams),reportMap);
  }

  @Override
  public void validate() {
    super.validate();

    String algorithmName = getAlgorithm();
    if (algorithmName != null && !(MAXENT_QN_VALUE.equals(algorithmName))) {
      throw new IllegalArgumentException("algorithmName must be MAXENT_QN");
    }

    // Number of Hessian updates to remember
    if (m < 0) {
      throw new IllegalArgumentException(
          "Number of Hessian updates to remember must be >= 0");
    }

    // Maximum number of function evaluations
    if (maxFctEval < 0) {
      throw new IllegalArgumentException(
          "Maximum number of function evaluations must be >= 0");
    }

    // Number of threads must be >= 1
    if (threads < 1) {
      throw new IllegalArgumentException("Number of threads must be >= 1");
    }

    // Regularization costs must be >= 0
    if (l1Cost < 0) {
      throw new IllegalArgumentException("Regularization costs must be >= 0");
    }

    if (l2Cost < 0) {
      throw new IllegalArgumentException("Regularization costs must be >= 0");
    }
  }

  @Deprecated
  @Override
  public boolean isValid() {
    try {
      validate();
      return true;
    }
    catch (IllegalArgumentException e) {
      return false;
    }
  }

  public boolean isSortAndMerge() {
    return true;
  }

  public AbstractModel doTrain(DataIndexer indexer) throws IOException {
    int iterations = getIterations();
    return trainModel(iterations, indexer);
  }

  // << Members related to AbstractEventTrainer
  public QNModel trainModel(int iterations, DataIndexer indexer) {

    // Train model's parameters
    Function objectiveFunction;
    if (threads == 1) {
      System.out.println("Computing model parameters ...");
      objectiveFunction = new NegLogLikelihood(indexer);
    } else {
      System.out.println("Computing model parameters in " + threads + " threads ...");
      objectiveFunction = new ParallelNegLogLikelihood(indexer, threads);
    }

    QNMinimizer minimizer = new QNMinimizer(
        l1Cost, l2Cost, iterations, m, maxFctEval, printMessages);
    minimizer.setEvaluator(new ModelEvaluator(indexer));

    double[] parameters = minimizer.minimize(objectiveFunction);

    // Construct model with trained parameters
    String[] predLabels = indexer.getPredLabels();
    int nPredLabels = predLabels.length;

    String[] outcomeNames = indexer.getOutcomeLabels();
    int nOutcomes = outcomeNames.length;

    Context[] params = new Context[nPredLabels];
    for (int ci = 0; ci < params.length; ci++) {
      List<Integer> outcomePattern = new ArrayList<>(nOutcomes);
      List<Double> alpha = new ArrayList<>(nOutcomes);
      for (int oi = 0; oi < nOutcomes; oi++) {
        double val = parameters[oi * nPredLabels + ci];
        outcomePattern.add(oi);
        alpha.add(val);
      }
      params[ci] = new Context(ArrayMath.toIntArray(outcomePattern),
          ArrayMath.toDoubleArray(alpha));
    }

    return new QNModel(params, predLabels, outcomeNames);
  }

  /**
   * For measuring model's training accuracy
   */
  private class ModelEvaluator implements Evaluator {

    private DataIndexer indexer;

    public ModelEvaluator(DataIndexer indexer) {
      this.indexer = indexer;
    }

    /**
     * Evaluate the current model on training data set
     * @return model's training accuracy
     */
    @Override
    public double evaluate(double[] parameters) {
      int[][] contexts  = indexer.getContexts();
      float[][] values  = indexer.getValues();
      int[] nEventsSeen = indexer.getNumTimesEventsSeen();
      int[] outcomeList = indexer.getOutcomeList();
      int nOutcomes     = indexer.getOutcomeLabels().length;
      int nPredLabels   = indexer.getPredLabels().length;

      int nCorrect     = 0;
      int nTotalEvents = 0;

      for (int ei = 0; ei < contexts.length; ei++) {
        int[] context  = contexts[ei];
        float[] value  = values == null ? null : values[ei];

        double[] probs = new double[nOutcomes];
        QNModel.eval(context, value, probs, nOutcomes, nPredLabels, parameters);
        int outcome = ArrayMath.maxIdx(probs);
        if (outcome == outcomeList[ei]) {
          nCorrect += nEventsSeen[ei];
        }
        nTotalEvents += nEventsSeen[ei];
      }

      return (double) nCorrect / nTotalEvents;
    }
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Trend Track - Stay informed</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/stylish-portfolio.css" rel="stylesheet">

    <link href="font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

Trend Track

An open community aimed at tracking trends in the software development market

With Trend Track you can

                    Follow companies

Follow what technologies companies are using. You can also search which companies are using every programming language and framework.

                    Search and track job offers

Search for jobs with a search system based on tags. You can combine the tags you want in your searches. You can also follow new offers of jobs available with the tags of interest.

                    Find people

You can search and find people that have experience in every programming language. You can also see what are the people who are more active on github for each programming language.

                    And much more!

Contribute to the project in github. If you can't contribute in github so just follow us on social networks and stay informed about the project :D

Trend Track

redpajama_set_name: RedPajamaGithub


text:
/**
* Test to make sure we don't get stuck polling a dbus connection
* which has no data on the socket.  This was an issue where
* one pending call would read all the data off the bus
* and the second pending call would not check to see
* if its data had already been read before polling the connection
* and blocking.
**/

#include <config.h>
#include <dbus/dbus.h>
#include <dbus/dbus-sysdeps.h>
#include <stdio.h>
#include <stdlib.h>

static void
_run_iteration (DBusConnection *conn)
{
  DBusPendingCall *echo_pending;
  DBusPendingCall *dbus_pending;
  DBusMessage *method;
  DBusMessage *reply;
  char *echo = "echo";

  /* send the first message */
  method = dbus_message_new_method_call ("org.freedesktop.DBus.TestSuiteEchoService",
                                         "/org/freedesktop/TestSuite",
                                         "org.freedesktop.TestSuite",
                                         "Echo");

  dbus_message_append_args (method, DBUS_TYPE_STRING, &echo, NULL);
  dbus_connection_send_with_reply (conn, method, &echo_pending, -1);
  dbus_message_unref (method);

  /* send the second message */
  method = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
                                         DBUS_PATH_DBUS,
                                         "org.freedesktop.Introspectable",
                                         "Introspect");

  dbus_connection_send_with_reply (conn, method, &dbus_pending, -1);
  dbus_message_unref (method);

  /* block on the second message (should return immediately) */
  dbus_pending_call_block (dbus_pending);

  /* block on the first message */
  /* if it does not return immediately chances
     are we hit the block in poll bug */
  dbus_pending_call_block (echo_pending);

  /* check the reply only to make sure we
     are not getting errors unrelated
     to the block in poll bug */
  reply = dbus_pending_call_steal_reply (echo_pending);

  if (reply == NULL)
    {
      printf ("Failed: Reply is NULL ***\n");
      exit (1);
    }

  if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
    {
      printf ("Failed: Reply is error: %s ***\n", dbus_message_get_error_name (reply));
      exit (1);
    }

  dbus_message_unref (reply);
  dbus_pending_call_unref (dbus_pending);
  dbus_pending_call_unref (echo_pending);

}

int
main (int argc, char *argv[])
{
  long start_tv_sec, start_tv_usec;
  long end_tv_sec, end_tv_usec;
  int i;
  DBusMessage *method;
  DBusConnection *conn;
  DBusError error;

  /* Time each iteration and make sure it doesn't take more than 5 seconds
     to complete.  Outside influences may cause connections to take longer
     but if it does and we are stuck in a poll call then we know the
     stuck in poll bug has come back to haunt us */

  printf ("*** Testing stuck in poll\n");

  dbus_error_init (&error);

  conn = dbus_bus_get (DBUS_BUS_SESSION, &error);

  /* run 100 times to make sure */
  for (i = 0; i < 100; i++)
    {
      long delta;

      _dbus_get_current_time (&start_tv_sec, &start_tv_usec);
      _run_iteration (conn);
      _dbus_get_current_time (&end_tv_sec, &end_tv_usec);

      /* we just care about seconds */
      delta = end_tv_sec - start_tv_sec;
      printf ("Iter %i: %lis\n", i, delta);
      if (delta >= 5)
        {
	  printf ("Failed: looks like we might have been be stuck in poll ***\n");
	  exit (1);
	}
    }

  method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService",
                                         "/org/freedesktop/TestSuite",
                                         "org.freedesktop.TestSuite",
                                         "Exit");
  dbus_connection_send (conn, method, NULL);
  dbus_message_unref (method);

  printf ("Success ***\n");
  exit (0);
}


text:
define(['../internals/baseValues', './keysIn'], function(baseValues, keysIn) {

  /**
   * Creates an array of the own and inherited enumerable property values
   * of `object`.
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {Object} object The object to inspect.
   * @returns {Array} Returns the array of property values.
   * @example
   *
   * function Shape(x, y) {
   *   this.x = x;
   *   this.y = y;
   * }
   *
   * Shape.prototype.z = 0;
   *
   * _.valuesIn(new Shape(2, 1));
   * // => [2, 1, 0] (property order is not guaranteed across environments)
   */
  function valuesIn(object) {
    return baseValues(object, keysIn);
  }

  return valuesIn;
});


text:
<!DOCTYPE html>
<html lang="en">

  <head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>ScriptedIn Inc.</title>

    <link rel="stylesheet" href="<?=base_url()?>vendor/codyhouse/horizontal-timeline/css/reset.css"> <!-- CSS reset -->
    <link rel="stylesheet" href="<?=base_url()?>vendor/codyhouse/horizontal-timeline/css/style.css"> <!-- Resource style -->
    <link rel="stylesheet" href="<?=base_url()?>vendor/lipis/bootstrap-social-gh-pages/bootstrap-social.css"> <!-- Resource style -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
    <link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.5.0/css/all.css' integrity='sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU' crossorigin='anonymous'>

    <link rel="stylesheet" href="https://nbviewer.jupyter.org/static/build/notebook.css">

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Permanent+Marker&effect=shadow-multiple">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abril">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Antic+Didone">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif">
    <!-- Bootstrap core CSS -->
    <link href="<?=base_url()?>assets/user/vendor/bootstrap/css/bootstrap.css" rel="stylesheet">

    <link href="<?=base_url()?>vendor/wenzhixin/bootstrap-table/src/bootstrap-table.css" rel="stylesheet">
    <!-- Custom fonts for this template -->

    <link href="<?=base_url()?>assets/user/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:100,200" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Lato:100,300,200italic,100italic" rel="stylesheet" type="text/css">

    <!-- Optionally, use a conventional reset like normalize -->
    <link rel="stylesheet" href="<?=base_url()?>vendor/nteract/notebook-preview-master/demo/vendor/normalize.css"/>
    <!-- Optionally, include the fonts nteract uses -->
    <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700,300,200,500,600,900' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,200italic,300,300italic,400italic,600,600italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Pathway+Gothic+One,' rel='stylesheet' type='text/css'>
    <style>
        .parallax {
            /* The image used */
            background-image: url("assets/user/img/background.jpg");
            margin-top: -25px;
            /* Set a specific height */
            height: 500px;
            /* Create the parallax scrolling effect */
            background-attachment: fixed;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }
    </style>
    <!-- Required: CodeMirror styling -->
    <link rel="stylesheet" href="<?=base_url()?>vendor/nteract/notebook-preview-master/demo/vendor/codemirror.css"/>

    <!-- Required: Style sheets for the notebook itself -->
    <link rel="stylesheet" href="<?=base_url()?>vendor/nteract/notebook-preview-master/styles/theme-light.css" />
    <link rel="stylesheet" href="<?=base_url()?>vendor/nteract/notebook-preview-master/styles/main.css" />

    <!-- Custom styles for this template -->
    <link href="<?=base_url()?>assets/user/css/freelancer.min.css" rel="stylesheet">
    <link href="<?=base_url()?>assets/user/css/custom.css" rel="stylesheet">
    <link href="<?=base_url()?>assets/user/fonts/magicschoolone/stylesheet.css" rel="stylesheet">
    <link href="<?=base_url()?>assets/user/fonts/patuaone/stylesheet.css" rel="stylesheet">
    <link href="<?=base_url()?>assets/user/css/bootstrap.css" rel="stylesheet">

    <link rel="stylesheet" href="https://www.scriptedin.com/vendor/components/highlightjs/styles/default.css">

    <link href="https://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" rel="Stylesheet"></link>

  </head>

  <body id="page-top">


text:
using Bookmarks.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using System.Xml;

public static class ImportBookmarks
{
    public static void Main()
    {
        using (TransactionScope tran = new TransactionScope(
            TransactionScopeOption.Required,
            new TransactionOptions()
            {
                IsolationLevel = IsolationLevel.RepeatableRead
            }))
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load("../../bookmarks.xml");
            string xPathQuery = "/bookmarks/bookmark";

            XmlNodeList bookmarksList = xmlDoc.SelectNodes(xPathQuery);
            foreach (XmlNode bookmark in bookmarksList)
            {
                string username = bookmark.InnerTextOrNull("username");
                string title = bookmark.InnerTextOrNull("title");
                string URL = bookmark.InnerTextOrNull("url");
                List<string> tags = new List<string>();
                string notes = bookmark.InnerTextOrNull("notes");

                if (bookmark.InnerTextOrNull("tags") != null)
                {
                    tags = bookmark.InnerTextOrNull("tags").Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
                }

                BookmarksDAL.ImportBookmarks(username, title, URL, tags, notes);
            }
            tran.Complete();
        }
    }

    public static string InnerTextOrNull(this XmlNode node, string name)
    {
        XmlNode searchedNode = node.SelectSingleNode(name);
        if (searchedNode != null)
        {
            return searchedNode.InnerText;
        }
        else
        {
            return null;
        }
    }
}


text:
package org.hawkular.inventory.api;

import org.hawkular.inventory.api.model.ResourceType;

/**
 * This is a wrapper class to hold various interfaces defining available functionality on resource types.
 *
 * @author Lukas Krejci
 * @since 1.0
 */
public final class ResourceTypes {

    private ResourceTypes() {

    }

    private interface BrowserBase<Resources, MetricTypes> {
        /**
         * @return access to resources defined by the resource type(s)
         */
        Resources resources();

        /**
         * @return access to metrics owned by the resource type(s)
         */
        MetricTypes metricTypes();
    }

    /**
     * Interface for accessing a single resource type in a writable manner.
     */
    public interface Single extends ResolvableToSingleWithRelationships<ResourceType>,
            BrowserBase<Resources.Read, MetricTypes.ReadAssociate> {}

    /**
     * Interface for traversing over a set of resource types.
     *
     * <p>Note that traversing over a set of entities enables only read-only access. If you need to use any of the
     * modification methods, you first need to resolve the traversal to a single entity (using the
     * {@link ReadInterface#get(String)} method).
     */
    public interface Multiple extends ResolvableToManyWithRelationships<ResourceType>,
            BrowserBase<Resources.Read, MetricTypes.Read> {}

    /**
     * Provides read-only access to resource types.
     */
    public interface Read extends ReadInterface<Single, Multiple> {}

    /**
     * Provides read-write access to resource types.
     */
    public interface ReadWrite
            extends ReadWriteInterface<ResourceType.Update, ResourceType.Blueprint, Single, Multiple> {}
}


text:
@interface LEBinApiClient : NSObject

@property NSString *binApiGateway;

-(id) initWithAttributes: (NSString *) aGateway
                  region: (NSString *) aRegion;

-(id) initWithAttributes: (NSString *) aGateway;

-(void) getBinServiceTokenWithSuccess:(void(^)(LEServiceToken*))aSuccess
                                 andFailure:(void(^)(NSError*))aFailure;

-(void) postFilesWithFilesData:(LEFilesData *) aFilesData
                                withToken:(NSString *) token
                              withSuccess:(void(^)(BOOL))aSuccess
                               andFailure:(void(^)(NSError*))aFailure;

-(void) postCompleteWithUploadToken:(NSString *) aUploadToken
                     withToken:(NSString *) token
                   withSuccess:(void(^)(BOOL))aSuccess
                    andFailure:(void(^)(NSError*))aFailure;
@end


text:
Configuration Manager
===

Simple service to store and fetch grouped properties


text:
edited by erwin_h
edit lagi ah


text:
package com.networknt.oauth.key.handler;

import com.networknt.client.Http2Client;
import com.networknt.exception.ClientException;
import com.networknt.openapi.OpenApiHandler;
import com.networknt.openapi.ResponseValidator;
import com.networknt.openapi.SchemaValidator;
import com.networknt.schema.SchemaValidatorsConfig;
import com.networknt.status.Status;
import io.undertow.UndertowOptions;
import io.undertow.client.ClientConnection;
import io.undertow.client.ClientRequest;
import io.undertow.client.ClientResponse;
import io.undertow.util.HeaderValues;
import io.undertow.util.HttpString;
import io.undertow.util.Headers;
import io.undertow.util.Methods;
import org.junit.ClassRule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xnio.OptionMap;
import java.net.URI;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;

import static org.junit.Assert.assertNotNull;

public class Oauth2KeysGetHandlerTest {

    @ClassRule
    public static TestServer server = TestServer.getInstance();

    static final Logger logger = LoggerFactory.getLogger(Oauth2KeysGetHandlerTest.class);
    static final String url = "https://localhost:6886";
    static final String JSON_MEDIA_TYPE = "application/json";

    @Test
    public void testOauth2KeysGetHandlerTest() throws ClientException {

        final Http2Client client = Http2Client.getInstance();
        final CountDownLatch latch = new CountDownLatch(1);
        final ClientConnection connection;
        try {
            connection = client.borrowConnection(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)).get();
        } catch (Exception e) {
            throw new ClientException(e);
        }
        final AtomicReference<ClientResponse> reference = new AtomicReference<>();
        String requestUri = "/oauth2/keys";
        String httpMethod = "get";
        try {
            ClientRequest request = new ClientRequest().setPath(requestUri).setMethod(Methods.GET);

            //customized header parameters
            request.getRequestHeaders().put(new HttpString("host"), "localhost");
            connection.sendRequest(request, client.createClientCallback(reference, latch));

            latch.await();
        } catch (Exception e) {
            logger.error("Exception: ", e);
            throw new ClientException(e);
        } finally {
            client.returnConnection(connection);
        }
        String body = reference.get().getAttachment(Http2Client.RESPONSE_BODY);
        Optional<HeaderValues> contentTypeName = Optional.ofNullable(reference.get().getResponseHeaders().get(Headers.CONTENT_TYPE));
        SchemaValidator schemaValidator = new SchemaValidator(OpenApiHandler.helper.openApi3);
        ResponseValidator responseValidator = new ResponseValidator(schemaValidator);
        int statusCode = reference.get().getResponseCode();
        Status status;
        if(contentTypeName.isPresent()) {
            status = responseValidator.validateResponseContent(body, requestUri, httpMethod, String.valueOf(statusCode), contentTypeName.get().getFirst());
        } else {
            status = responseValidator.validateResponseContent(body, requestUri, httpMethod, String.valueOf(statusCode), JSON_MEDIA_TYPE);
        }
        assertNotNull(status);
    }

}


text:
package io.codearcs.candlestack;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.codearcs.candlestack.aws.GlobalAWSProperties;
import io.codearcs.candlestack.aws.ec2.EC2HostMonitorLookup;
import io.codearcs.candlestack.aws.ec2.EC2MetricsFetcher;
import io.codearcs.candlestack.aws.elasticbeanstalk.EBHostMonitorLookup;
import io.codearcs.candlestack.aws.elasticbeanstalk.EBMetricsFetcher;
import io.codearcs.candlestack.aws.lambda.LambdaHostMonitorLookup;
import io.codearcs.candlestack.aws.lambda.LambdaMetricsFetcher;
import io.codearcs.candlestack.aws.rds.RDSHostMonitorLookup;
import io.codearcs.candlestack.aws.rds.RDSMetricsFetcher;
import io.codearcs.candlestack.aws.s3.S3HostMonitorLookup;
import io.codearcs.candlestack.aws.s3.S3MetricsFetcher;
import io.codearcs.candlestack.aws.sqs.SQSHostMonitorLookup;
import io.codearcs.candlestack.aws.sqs.SQSMetricsFetcher;
import io.codearcs.candlestack.nagios.GlobalNagiosProperties;
import io.codearcs.candlestack.nagios.HostMonitorLookup;
import io.codearcs.candlestack.nagios.NagiosUpdater;

/**
 * The main Candlestack process responsible for running
 * the various pieces that make up Candlestack
 */
public class Candlestack {

	private static final Logger LOGGER = LoggerFactory.getLogger( Candlestack.class );

	private Set<String> contactGroups;

	private List<MetricsFetcher> metricsFetchers;

	private List<HostMonitorLookup> hostMonitorLookups;

	private NagiosUpdater nagiosUpdater;

	public Candlestack( Properties props ) throws CandlestackException {

		contactGroups = GlobalNagiosProperties.getAllContactGroups().stream().map( group -> group.getName() ).collect( Collectors.toSet() );

		metricsFetchers = new ArrayList<>();
		hostMonitorLookups = new ArrayList<>();

		if ( GlobalAWSProperties.isEBEnabled() ) {
			LOGGER.info( "Candlestack will monitor Elastic Beanstalk" );
			metricsFetchers.add( new EBMetricsFetcher() );
			hostMonitorLookups.add( new EBHostMonitorLookup( contactGroups ) );
		}

		if ( GlobalAWSProperties.isEC2Enabled() ) {
			LOGGER.info( "Candlestack will monitor EC2" );
			metricsFetchers.add( new EC2MetricsFetcher() );
			hostMonitorLookups.add( new EC2HostMonitorLookup( contactGroups ) );
		}

		if ( GlobalAWSProperties.isRDSEnabled() ) {
			LOGGER.info( "Candlestack will monitor RDS" );
			metricsFetchers.add( new RDSMetricsFetcher() );
			hostMonitorLookups.add( new RDSHostMonitorLookup( contactGroups ) );
		}

		if ( GlobalAWSProperties.isSQSEnabled() ) {
			LOGGER.info( "Candlestack will monitor SQS" );
			metricsFetchers.add( new SQSMetricsFetcher() );
			hostMonitorLookups.add( new SQSHostMonitorLookup( contactGroups ) );
		}

		if ( GlobalAWSProperties.isS3Enabled() ) {
			LOGGER.info( "Candlestack will monitor S3" );
			metricsFetchers.add( new S3MetricsFetcher() );
			hostMonitorLookups.add( new S3HostMonitorLookup( contactGroups ) );
		}

		if ( GlobalAWSProperties.isLambdaEnabled() ) {
			LOGGER.info( "Candlestack will monitor Lambda" );
			metricsFetchers.add( new LambdaMetricsFetcher() );
			hostMonitorLookups.add( new LambdaHostMonitorLookup( contactGroups ) );
		}

		nagiosUpdater = new NagiosUpdater( hostMonitorLookups );

	}

	public void shutdown() {

		for ( MetricsFetcher metricsFetcher : metricsFetchers ) {
			metricsFetcher.shutdown();
			try {
				metricsFetcher.join();
			} catch ( InterruptedException e ) {
				LOGGER.error( "Candlestack got interrupted while waiting for MetricsFetcher [" + metricsFetcher.getName() + "] to join" );
			}
		}

		nagiosUpdater.shutdown();
		try {
			nagiosUpdater.join();
		} catch ( InterruptedException e ) {
			LOGGER.error( "Candlestack got interrupted while waiting for NagiosUpdater to join" );
		}

		MetricsReaderWriter.destroy();

	}

	public void start() {

		// Start the various metrics fetchers
		for ( MetricsFetcher metricsFetcher : metricsFetchers ) {
			metricsFetcher.start();
		}

		// Start the Nagios updater process
		nagiosUpdater.start();

	}

	private static class ShutdownThread extends Thread {

		private Candlestack instance;

		public ShutdownThread( Candlestack instance ) {
			this.instance = instance;
		}

		@Override
		public void run() {
			instance.shutdown();
		}
	}

	/**
	 * Starts the Candlestack process
	 *
	 * @param args
	 *          must provide the location of the ini file for Candlestack to use
	 */
	public static void main( String[] args ) {

		if ( args.length < 1 ) {
			System.out.println( "Must provide location of ini configuration file" );
			LOGGER.error( "Must provide location of ini configuration file" );
			System.exit( -1 );
		}

		File propsFile = new File( args[0] );
		if ( !propsFile.exists() ) {
			System.out.println( "Provided ini file location doesn't exist [" + args[0] + "]" );
			LOGGER.error( "Provided ini file location doesn't exist [" + args[0] + "]" );
			System.exit( -1 );
		}

		Properties props = new Properties();
		try {
			props.load( new FileInputStream( propsFile ) );
		} catch ( IOException e ) {
			System.out.println( "Encountered an error attempting to load properties file [" + propsFile.getAbsolutePath() + "]" );
			e.printStackTrace();
			LOGGER.error( "Encountered an error attempting to load properties file [" + propsFile.getAbsolutePath() + "]", e );
			System.exit( -1 );
		}

		try {

			// Initialize the global properties
			GlobalCandlestackProperties.init( props );

			// Create and start the Candlestack service
			Candlestack candlestack = new Candlestack( props );
			Runtime.getRuntime().addShutdownHook( new ShutdownThread( candlestack ) );
			candlestack.start();

		} catch ( CandlestackException e ) {
			System.out.println( "Encountered an error trying to start up Candlestack processes" );
			e.printStackTrace();
			LOGGER.error( "Encountered an error trying to start up Candlestack processes", e );
		} catch ( Throwable t ) {
			System.out.println( "Encountered an unexpected error trying to start up Candlestack processes" );
			t.printStackTrace();
			LOGGER.error( "Encountered an unexpected error trying to start up Candlestack processes", t );
		}

	}

}


text:
package org.onedatashare.server.model.error;

public class ODSAccessDeniedException extends ODSError{
    public ODSAccessDeniedException(int err) {
        super("Access Denied to this File or Folder");
        type = "AccessDenied";
        error = "Access Denied to this File or Folder.";
    }
}


text:
Creates a new integration

**Parameters**

-   `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** integration details

Returns **IntegrationModel** created integration

# get

Returns the users configured integrations

**Parameters**

-   `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | Conversation~ConversationObect)**
    -   `options.id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
    -   `options.roomId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)**

# list

Returns users all integrations

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)**

# remove

Delete an integration

**Parameters**

-   `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** integration details

Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**

# config

!

Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.


text:
<!DOCTYPE html>

  <meta charset='utf-8'/>
  <link href='../dist/fullcalendar.css' rel='stylesheet'/>
  <link href='../dist/fullcalendar.print.css' rel='stylesheet' media='print'/>

  <link rel="stylesheet/less" type="text/css" href="resource-fixed-views.less" />

  <link rel="stylesheet" type="text/css" href="vendor/perfect-scrollbar.min.css" />

<form>Select the resources you wanna filter:

  <input name="resource1" type="checkbox" checked /> Resource 1
  <input name="resource2" type="checkbox" checked /> Resource 2
  <input name="resource3" type="checkbox" checked /> Resource 3
  <input name="resource4" type="checkbox" checked /> Resource 4
  <input name="resource5" type="checkbox" checked /> Resource 5
  <input name="resource6" type="checkbox" /> Resource 6
  <input name="resource7" type="checkbox" /> Resource 7
  <input name="resource8" type="checkbox" /> Resource 8
  <input name="resource9" type="checkbox" checked /> Resource 9
</form>


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>C++ exceptions</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" />
    <link rel="up" href="upgrade_4_1_toc.html" title="Chapter 17. Upgrading Berkeley DB 4.0 applications to Berkeley DB 4.1" />
    <link rel="prev" href="upgrade_4_1_java.html" title="Java exceptions" />
    <link rel="next" href="upgrade_4_1_app_dispatch.html" title="Application-specific logging and recovery" />

          C++ exceptions

          Prev
          Chapter 17. Upgrading Berkeley DB 4.0 applications to Berkeley DB 4.1
           Next

C++ exceptions

With default flags, the C++ DbEnv and Db classes
can throw exceptions from their constructors.  For example, this can
happen if invalid parameters are passed in or the underlying C
structures could not be created.  If the objects are created in an
environment that is not configured for exceptions (that is, the
DB_CXX_NO_EXCEPTIONS flag is specified), errors from the
constructor will be returned when the handle's open method is called.

In addition, the behavior of the DbEnv and Db
destructors has changed to simplify exception handling in applications.
The destructors will now close the handle if the handle's close method
was not called prior to the object being destroyed.  The return value
of the call is discarded, and no exceptions will be thrown.
Applications should call the close method in normal situations so any
errors while closing can be handled by the application.

This change allows applications to be structured as follows:

try {
	DbEnv env(0);
	env.open(/* ... */);
	Db db(&env, 0);
	db.open(/* ... */);
	/* ... */
	db.close(0);
	env.close(0);
} catch (DbException &dbe) {
	// Handle the exception, the handles have already been closed.
}

          Prev

            Up

           Next

          Java exceptions

            Home

           Application-specific logging and recovery


text:
from toee import *
from utilities import *
from combat_standard_routines import *

def san_dialog( attachee, triggerer ):
	st = attachee.obj_get_int( obj_f_npc_pad_i_5 )
	attachee.turn_towards(triggerer)
	if (attachee.map == 5013):
		attachee.float_line( 23000, triggerer )
	elif (game.global_vars[915] == 32):
		triggerer.begin_dialog( attachee, 570 )			## have attacked 3 or more farm animals with ronald in party
	elif (game.leader.reputation_has(32) == 1 or game.leader.reputation_has(30) == 1 or game.leader.reputation_has(29) == 1):
		attachee.float_line(11004,triggerer)
	elif (attachee.has_met( triggerer )):
		if game.global_vars[692] == 2 and game.global_vars[693] == 3 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			attachee.float_line(600,triggerer)		## not in party, Gruumsh
			return SKIP_DEFAULT
		elif game.global_vars[692] == 1 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,260)		## not in party, Lareth
			return SKIP_DEFAULT
		elif game.global_vars[692] == 3 and (game.global_vars[693] == 1 or game.global_vars[692] == 2) and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,90)		## not in party, orcs present after issues
			return SKIP_DEFAULT
		elif game.global_vars[692] == 3 and game.global_vars[693] == 0 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,355)		## not in party, orcs gone after issues
			return SKIP_DEFAULT
		elif (game.global_vars[692] >= 5 and game.global_vars[692] <= 7) and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,100)		## return with money
			return SKIP_DEFAULT
		elif game.global_vars[692] == 0 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,200)		## return with no grudges
			return SKIP_DEFAULT
		elif game.global_vars[692] == 2 and game.global_vars[693] == 0 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,355)		## not in party, returning after Gruumsh, Gruumsh gone
			return SKIP_DEFAULT
		elif game.global_vars[692] == 8 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee,900)		## not in party, left because party didn't pay for resurrection - not done yet!!!!
			return SKIP_DEFAULT
		elif game.global_vars[692] == 9 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			attachee.float_line(600,triggerer)		## left because hates party's guts, won't talk
			return SKIP_DEFAULT
		elif game.global_vars[692] == 10 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee, 2150)		## done, left to talk to Dad
			return SKIP_DEFAULT
		elif game.global_vars[692] == 11 and (attachee.leader_get() == OBJ_HANDLE_NULL):
			triggerer.begin_dialog(attachee, 2200)		## chatted with Dad, ready to go
			return SKIP_DEFAULT
		elif (attachee.leader_get() != OBJ_HANDLE_NULL and st == 1):
			triggerer.begin_dialog(attachee,2060)		## in party, wanting to resurrect
			return SKIP_DEFAULT
		elif (attachee.leader_get() != OBJ_HANDLE_NULL and st == 0):
			triggerer.begin_dialog(attachee,120)		## in party, not resurrecting yet
			return SKIP_DEFAULT
		elif (attachee.leader_get() != OBJ_HANDLE_NULL and st == 2):
			triggerer.begin_dialog(attachee,2250)		## back in party, post parents
			return SKIP_DEFAULT
		else:
			attachee.float_line(600,triggerer)		## anything else he just won't talk
			return SKIP_DEFAULT
	else:
		if (game.global_vars[5] > 7) and triggerer.reputation_has( 2 ) == 0:
			attachee.float_line(600,triggerer)
		else:
			triggerer.begin_dialog( attachee, 1 )		## none of the above
	return SKIP_DEFAULT

def san_first_heartbeat( attachee, triggerer ):
	if (game.global_flags[500] == 0):
		attachee.object_flag_set(OF_OFF)
	else:
		if (attachee.leader_get() == OBJ_HANDLE_NULL):
			if (attachee.map == 5011):
				if (game.global_vars[501] == 4 or game.global_vars[501] == 5 or game.global_vars[501] == 6 or game.global_vars[510] == 2):
					attachee.object_flag_set(OF_OFF)
				else:
					attachee.object_flag_unset(OF_OFF)
			elif (attachee.map == 5013):
				if (game.global_vars[510] != 2):
					if (game.global_vars[501] == 4 or game.global_vars[501] == 5 or game.global_vars[501] == 6):
						attachee.object_flag_unset(OF_OFF)
				else:
					attachee.object_flag_set(OF_OFF)
		finale = attachee.obj_get_int( obj_f_npc_pad_i_5 )
		if ((anyone( game.party[0].group_list(), "has_follower", 8025 )) or (anyone( game.party[0].group_list(), "has_follower", 8026 ))):    # Tuelk and Pintark
			game.global_vars[693] = 2
		half_orc = 0
		Grummshite = 0
		for pc in game.party:
			if pc.stat_level_get(stat_race) == race_halforc:
				half_orc = 1
			if (pc.stat_level_get( stat_deity ) == 7 and pc.stat_level_get(stat_level_cleric) >= 1):
				Grummshite = 1
		if half_orc == 1:
			game.global_vars[693] = 1
		if Grummshite == 1:
			game.global_vars[693] = 3
	return RUN_DEFAULT

def san_dying( attachee, triggerer ):
	if should_modify_CR( attachee ):
		modify_CR( attachee, get_av_level() )
	attachee.float_line(12014,triggerer)
	if (game.global_flags[237] == 0):
		game.global_vars[23] = game.global_vars[23] + 1
		if game.global_vars[23] >= 2:
			game.party[0].reputation_add( 92 )
	else:
		game.global_vars[29] = game.global_vars[29] + 1
	return RUN_DEFAULT

def san_enter_combat( attachee, triggerer ):
	ProtectTheInnocent(attachee, triggerer)
	attachee.float_line(12057,triggerer)
	return RUN_DEFAULT

def san_heartbeat( attachee, triggerer ):
	if (not game.combat_is_active()):
		if (game.global_vars[915] >= 3):
			if (attachee != OBJ_HANDLE_NULL):
				leader = attachee.leader_get()
				if (leader != OBJ_HANDLE_NULL):
					leader.follower_remove(attachee)
					attachee.float_line(22000,triggerer)
	return RUN_DEFAULT

def san_taking_damage( attachee, triggerer ):
	attachee.float_line(12054,triggerer)
	return RUN_DEFAULT

def san_join( attachee, triggerer ):
	game.global_flags[237] = 1
	itemD = attachee.item_find(4068)
	if (itemD != OBJ_HANDLE_NULL):
		itemD.item_flag_set(OIF_NO_TRANSFER)
	itemE = attachee.item_find(4087)
	if (itemE != OBJ_HANDLE_NULL):
		itemE.item_flag_set(OIF_NO_TRANSFER)
	itemA = attachee.item_find(6056)
	if (itemA != OBJ_HANDLE_NULL):
		itemA.item_flag_set(OIF_NO_TRANSFER)
	itemB = attachee.item_find(6070)
	if (itemB != OBJ_HANDLE_NULL):
		itemB.item_flag_set(OIF_NO_TRANSFER)
	return RUN_DEFAULT

def san_disband( attachee, triggerer ):
	game.global_flags[237] = 0
	for pc in game.party:
		attachee.ai_shitlist_remove( pc )
		attachee.reaction_set( pc, 50 )
	return RUN_DEFAULT

def san_new_map( attachee, triggerer ):		# after moathouse, sets to 283
	if (attachee.map == 5004):
		attachee.float_line(650,triggerer)
		game.new_sid = 283
	return RUN_DEFAULT

def san_spell_cast( attachee, triggerer, spell ):
	if ( spell.spell == spell_cats_grace or spell.spell == spell_invisibility ):
		attachee.float_line(630,triggerer)
	elif ( spell.spell == spell_haste or spell.spell == spell_good_hope ):
		attachee.float_line(630,triggerer)
	elif ( spell.spell == spell_stoneskin or spell.spell == spell_barkskin ):
		attachee.float_line(630,triggerer)
	elif ( spell.spell == spell_blur or spell.spell == spell_foxs_cunning ):
		attachee.float_line(630,triggerer)
	elif ( spell.spell == spell_heroism or spell.spell == spell_mage_armor ):
		attachee.float_line(630,triggerer)
	elif ( spell.spell == spell_mirror_image or spell.spell == spell_protection_from_arrows ):
		attachee.float_line(630,triggerer)
	return RUN_DEFAULT

def run_off( attachee, triggerer ):
	for pc in game.party:
		attachee.ai_shitlist_remove( pc )
	attachee.runoff(attachee.location-3)
	return RUN_DEFAULT

def argue_lareth( attachee, triggerer, line):
	npc = find_npc_near(attachee,8002)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc,line)
		npc.turn_towards(triggerer)
		triggerer.turn_towards(npc)
	else:
		triggerer.begin_dialog(attachee,270)
	return SKIP_DEFAULT

def war( attachee, triggerer ):
	hedrack = find_npc_near(attachee,8032)
	iuz = find_npc_near(attachee,8042)
	if (hedrack != OBJ_HANDLE_NULL):
		hedrack.attack( triggerer )
	elif (iuz != OBJ_HANDLE_NULL):
		iuz.attack( triggerer )
	return SKIP_DEFAULT

def switch_to_cuthbert( attachee, triggerer, line ):
	cuthbert = find_npc_near(attachee,8043)
	if (cuthbert != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(cuthbert,line)
	else:
		cuthbert.object_flag_set(OF_OFF)
	return SKIP_DEFAULT

def argue_tuelk( attachee, triggerer, line):
	npc = find_npc_near(attachee,8026)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc,line)
		npc.turn_towards(triggerer)
		triggerer.turn_towards(npc)
	else:
		triggerer.begin_dialog(attachee,175)
	return SKIP_DEFAULT

def reset_st(attachee, triggerer):
	attachee.obj_set_int( obj_f_npc_pad_i_5, 1 )
	return SKIP_DEFAULT

def summon_parents( attachee, triggerer ):
	willi = game.obj_create(14676, attachee.location-3)
	game.particles( 'sp-Raise Dead', willi)
	willi.turn_towards(attachee)
	ivy = game.obj_create(14675, attachee.location-3)
	game.particles( 'sp-Raise Dead', ivy)
	ivy.turn_towards(attachee)
	attachee.turn_towards(willi)
	return SKIP_DEFAULT

def argue_willi( attachee, triggerer, line):
	willi = find_npc_near(attachee,14676)
	if (willi != OBJ_HANDLE_NULL):
		attachee.turn_towards(triggerer)
		triggerer.begin_dialog(willi,line)
		willi.turn_towards(triggerer)
		triggerer.turn_towards(npc)
	else:
		triggerer.begin_dialog(attachee,175)
	return SKIP_DEFAULT

def done(attachee, triggerer):
	game.global_vars[692] = 10
	attachee.obj_set_int( obj_f_npc_pad_i_5, 2 )
	return SKIP_DEFAULT

def reunion( attachee, triggerer):
	willi = find_npc_near(attachee,14676)
	willi.critter_flag_set( OCF_MUTE )
	game.timevent_add( rejoin, (attachee, triggerer), 88000000 )
	attachee.critter_flag_set( OCF_MUTE )
	return SKIP_DEFAULT

def rejoin(attachee, triggerer):
	attachee.critter_flag_unset( OCF_MUTE )
	willi = find_npc_near(attachee,14676)
	willi.runoff(attachee.location-3)
	ivy = find_npc_near(attachee,14675)
	ivy.runoff(attachee.location-3)
	game.global_vars[692] = 11
	return SKIP_DEFAULT

def equip_all( attachee, triggerer ):
	create_item_in_inventory( 7002, attachee )
	create_item_in_inventory( 7001, attachee )
	create_item_in_inventory( 7001, attachee )
	itemB = attachee.item_find(6070)
	if (itemB != OBJ_HANDLE_NULL):
		itemB.destroy()
		create_item_in_inventory( 6070, triggerer )
	itemD = attachee.item_find(4068)
	if (itemD != OBJ_HANDLE_NULL):
		itemD.destroy()
		create_item_in_inventory( 4068, triggerer )
	itemE = attachee.item_find(4087)
	if (itemE != OBJ_HANDLE_NULL):
		itemE.destroy()
		create_item_in_inventory( 4087, triggerer )
	itemA = attachee.item_find(6056)
	if (itemA != OBJ_HANDLE_NULL):
		itemA.destroy()
		create_item_in_inventory( 6056, triggerer )
	return RUN_DEFAULT

def equip_leather( attachee, triggerer ):
	itemC = attachee.item_find(6056)
	if (itemC != OBJ_HANDLE_NULL):
		itemC.destroy()
		create_item_in_inventory( 6056, triggerer )
	create_item_in_inventory( 7001, attachee )
	create_item_in_inventory( 7001, attachee )
	create_item_in_inventory( 7001, attachee )
	return RUN_DEFAULT

def equip_rest( attachee, triggerer ):
	create_item_in_inventory( 7002, attachee )
	create_item_in_inventory( 7001, attachee )
	create_item_in_inventory( 7001, attachee )
	itemB = attachee.item_find(6070)
	if (itemB != OBJ_HANDLE_NULL):
		itemB.destroy()
		create_item_in_inventory( 6070, triggerer )
	itemD = attachee.item_find(4068)
	if (itemD != OBJ_HANDLE_NULL):
		itemD.destroy()
		create_item_in_inventory( 4068, triggerer )
	itemE = attachee.item_find(4087)
	if (itemE != OBJ_HANDLE_NULL):
		itemE.destroy()
		create_item_in_inventory( 4087, triggerer )
	return RUN_DEFAULT


text:
    <button class="btn btn-primary" type="button" ng-click="removeItem(task.id)">Save</button>
    <button class="btn btn-primary" type="button" ng-click="removeItem(task.id)">Submit!</button>
    <button class="btn btn-primary" type="button" ng-click="removeItem(task.id)">Cancel</button>

                Timesheet Period:
                {{timesheet.startDate | date:'dd-MM-yyyy'}} to {{timesheet.endDate |
                    date:'dd-MM-yyyy'}}

                Timesheet Status:
                {{timesheet.status}}

                Total hours declared:
                {{timesheet.totalTimeSheetHours}}

    <tabset>
        <tab active="timeOffActive">
            <tab-heading>

Time Off

            </tab-heading>

                <tasks></tasks>

        </tab>
        <tab ng-repeat="prj in timesheet.timesheetProjects" active=prj.active>
            <tab-heading>

{{prj.name}}

            </tab-heading>

                <projecttimesheet></projecttimesheet>

        </tab>
        <tab disabled="viewMode" select="addProject()">
            <tab-heading>

 Add Project

            </tab-heading>
        </tab>
    </tabset>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>UserType (Hibernate JavaDocs)</title>
<meta name="date" content="2014-03-03">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.hibernate.usertype

Interface UserType

All Known Subinterfaces:

EnhancedUserType, UserVersionType

All Known Implementing Classes:

EnumType, RevisionTypeType, StringClobType

public interface UserType

This interface should be implemented by user-defined "types".
A "type" class is <em>not</em> the actual property type - it
is a class that knows how to serialize instances of another
class to and from JDBC.<br>
<br>
This interface
<ul>
<li>abstracts user code from future changes to the <tt>Type</tt>
interface,</li>
<li>simplifies the implementation of custom types and</li>
<li>hides certain "internal" interfaces from user code.</li>
</ul>
<br>
Implementors must be immutable and must declare a public
default constructor.<br>
<br>
The actual class mapped by a <tt>UserType</tt> may be just
about anything.<br>
<br>
<tt>CompositeUserType</tt> provides an extended version of
this interface that is useful for more complex cases.<br>
<br>
Alternatively, custom types could implement <tt>Type</tt>
directly or extend one of the abstract classes in
<tt>org.hibernate.type</tt>. This approach risks future
incompatible changes to classes or interfaces in that
package.

See Also:

for more complex cases,
Type

Method Summary

Methods

Modifier and Type
Method and Description

Object
assemble(Serializable cached,
        Object owner)

Object
deepCopy(Object value)

Serializable
disassemble(Object value)

boolean
equals(Object x,
      Object y)

int
hashCode(Object x)

boolean
isMutable()

Object
nullSafeGet(ResultSet rs,
           String[] names,
           SessionImplementor session,
           Object owner)

void
nullSafeSet(PreparedStatement st,
           Object value,
           int index,
           SessionImplementor session)

Object
replace(Object original,
       Object target,
       Object owner)

Class
returnedClass()

int[]
sqlTypes()

Method Detail

sqlTypes

int[] sqlTypes()

Return the SQL type codes for the columns mapped by this type. The
codes are defined on <tt>java.sql.Types</tt>.

Returns:

int[] the typecodes

See Also:

Types

returnedClass

Class returnedClass()

The class returned by <tt>nullSafeGet()</tt>.

Returns:

Class

equals

boolean equals(Object x,
             Object y)
               throws HibernateException

Compare two instances of the class mapped by this type for persistence "equality".
Equality of the persistent state.

Parameters:

x -

y -

Returns:

boolean

Throws:

HibernateException

hashCode

int hashCode(Object x)
             throws HibernateException

Get a hashcode for the instance, consistent with persistence "equality"

Throws:

HibernateException

nullSafeGet

Object nullSafeGet(ResultSet rs,
                 String[] names,
                 SessionImplementor session,
                 Object owner)
                   throws HibernateException,
                          SQLException

Retrieve an instance of the mapped class from a JDBC resultset. Implementors
should handle possibility of null values.

Parameters:

rs - a JDBC result set

names - the column names

session -

owner - the containing entity  @return Object

Throws:

HibernateException

SQLException

nullSafeSet

void nullSafeSet(PreparedStatement st,
               Object value,
               int index,
               SessionImplementor session)
                 throws HibernateException,
                        SQLException

Write an instance of the mapped class to a prepared statement. Implementors
should handle possibility of null values. A multi-column type should be written
to parameters starting from <tt>index</tt>.

Parameters:

st - a JDBC prepared statement

value - the object to write

index - statement parameter index

session -

Throws:

HibernateException

SQLException

deepCopy

Object deepCopy(Object value)
                throws HibernateException

Return a deep copy of the persistent state, stopping at entities and at
collections. It is not necessary to copy immutable objects, or null
values, in which case it is safe to simply return the argument.

Parameters:

value - the object to be cloned, which may be null

Returns:

Object a copy

Throws:

HibernateException

isMutable

boolean isMutable()

Are objects of this type mutable?

Returns:

boolean

disassemble

Serializable disassemble(Object value)
                         throws HibernateException

Transform the object into its cacheable representation. At the very least this
method should perform a deep copy if the type is mutable. That may not be enough
for some implementations, however; for example, associations must be cached as
identifier values. (optional operation)

Parameters:

value - the object to be cached

Returns:

a cachable representation of the object

Throws:

HibernateException

assemble

Object assemble(Serializable cached,
              Object owner)
                throws HibernateException

Reconstruct an object from the cacheable representation. At the very least this
method should perform a deep copy if the type is mutable. (optional operation)

Parameters:

cached - the object to be cached

owner - the owner of the cached object

Returns:

a reconstructed object from the cachable representation

Throws:

HibernateException

replace

Object replace(Object original,
             Object target,
             Object owner)
               throws HibernateException

During merge, replace the existing (target) value in the entity we are merging to
with a new (original) value from the detached entity we are merging. For immutable
objects, or null values, it is safe to simply return the first parameter. For
mutable objects, it is safe to return a copy of the first parameter. For objects
with component values, it might make sense to recursively replace component values.

Parameters:

original - the value from the detached entity being merged

target - the value in the managed entity

Returns:

the value to be merged

Throws:

HibernateException

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2001-2014 Red Hat, Inc.  All Rights Reserved.


text:
<?php

class Pages extends MY_Controller {
	public function view($page = 'home')
	{
		if ( ! file_exists('application/views/pages/'.$page.'.php'))
		{
			// Whoops, we don't have a page for that!
			show_404();
		}

		$this->view_data['nav'] = $page;
		$this->view_data['title'] = ucfirst($page); // Capitalize the first letter

		$this->load->helper('url');
		$this->load->view('templates/header', $this->view_data);
		$this->load->view('pages/'.$page, $this->view_data);
		$this->load->view('templates/footer', $this->view_data);
	}
}


text:
const webrtc = require('wrtc')

global.window = {
  RTCPeerConnection: webrtc.RTCPeerConnection,
  RTCSessionDescription: webrtc.RTCSessionDescription,
  RTCIceCandidate: webrtc.RTCIceCandidate,
}
global.location = {
  protocol: 'http',
}

global.WebSocket = require('websocket').w3cwebsocket
global.Blob = Uint8Array
global.FileReader = FR

function FR() {}

FR.prototype.readAsBinaryString = function(data) {
  console.log('readAsBinaryString', data)

  this.onload({
    target: {
      result: 'data',
    },
  })
}
FR.prototype.readAsArrayBuffer = function(data) {
  console.log('readAsArrayBuffer', data)
  this.onload({
    target: {
      result: data,
    },
  })
}

module.exports = {
  connect,
}

function connect(username) {
  const Peer = require('../ui/services/peerjs/peer')

  const peer = new Peer(username, {
    host: '0.0.0.0',
    port: 9001,
    path: '/chat',
    serialization: 'json',
    debug: 3,
  })
  peer.on('open', () => {
    console.log('open')
  })
  peer.on('connection', conn => {
    _registerPeer(conn.peer, conn)
  })

  function _registerPeer(username, conn) {
    console.log('Registering', username)
    conn.on('data', msg => {
      console.log('Messaga received', msg)
      console.log({ content: msg, author: username })
      conn.send(msg + ' your self')
    })
  }

  return peer
}


text:
HeapSnapshotModel.HeapSnapshotProgressEvent = {
  Update: 'ProgressUpdate',
  BrokenSnapshot: 'BrokenSnapshot'
};

HeapSnapshotModel.baseSystemDistance = 100000000;

/**
 * @unrestricted
 */
HeapSnapshotModel.AllocationNodeCallers = class {
  /**
   * @param {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} nodesWithSingleCaller
   * @param {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} branchingCallers
   */
  constructor(nodesWithSingleCaller, branchingCallers) {
    /** @type {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} */
    this.nodesWithSingleCaller = nodesWithSingleCaller;
    /** @type {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} */
    this.branchingCallers = branchingCallers;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.SerializedAllocationNode = class {
  /**
   * @param {number} nodeId
   * @param {string} functionName
   * @param {string} scriptName
   * @param {number} scriptId
   * @param {number} line
   * @param {number} column
   * @param {number} count
   * @param {number} size
   * @param {number} liveCount
   * @param {number} liveSize
   * @param {boolean} hasChildren
   */
  constructor(nodeId, functionName, scriptName, scriptId, line, column, count, size, liveCount, liveSize, hasChildren) {
    /** @type {number} */
    this.id = nodeId;
    /** @type {string} */
    this.name = functionName;
    /** @type {string} */
    this.scriptName = scriptName;
    /** @type {number} */
    this.scriptId = scriptId;
    /** @type {number} */
    this.line = line;
    /** @type {number} */
    this.column = column;
    /** @type {number} */
    this.count = count;
    /** @type {number} */
    this.size = size;
    /** @type {number} */
    this.liveCount = liveCount;
    /** @type {number} */
    this.liveSize = liveSize;
    /** @type {boolean} */
    this.hasChildren = hasChildren;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.AllocationStackFrame = class {
  /**
   * @param {string} functionName
   * @param {string} scriptName
   * @param {number} scriptId
   * @param {number} line
   * @param {number} column
   */
  constructor(functionName, scriptName, scriptId, line, column) {
    /** @type {string} */
    this.functionName = functionName;
    /** @type {string} */
    this.scriptName = scriptName;
    /** @type {number} */
    this.scriptId = scriptId;
    /** @type {number} */
    this.line = line;
    /** @type {number} */
    this.column = column;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Node = class {
  /**
   * @param {number} id
   * @param {string} name
   * @param {number} distance
   * @param {number} nodeIndex
   * @param {number} retainedSize
   * @param {number} selfSize
   * @param {string} type
   */
  constructor(id, name, distance, nodeIndex, retainedSize, selfSize, type) {
    this.id = id;
    this.name = name;
    this.distance = distance;
    this.nodeIndex = nodeIndex;
    this.retainedSize = retainedSize;
    this.selfSize = selfSize;
    this.type = type;

    this.canBeQueried = false;
    this.detachedDOMTreeNode = false;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Edge = class {
  /**
   * @param {string} name
   * @param {!HeapSnapshotModel.Node} node
   * @param {string} type
   * @param {number} edgeIndex
   */
  constructor(name, node, type, edgeIndex) {
    this.name = name;
    this.node = node;
    this.type = type;
    this.edgeIndex = edgeIndex;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Aggregate = class {
  constructor() {
    /** @type {number} */
    this.count;
    /** @type {number} */
    this.distance;
    /** @type {number} */
    this.self;
    /** @type {number} */
    this.maxRet;
    /** @type {number} */
    this.type;
    /** @type {string} */
    this.name;
    /** @type {!Array.<number>} */
    this.idxs;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.AggregateForDiff = class {
  constructor() {
    /** @type {!Array.<number>} */
    this.indexes = [];
    /** @type {!Array.<string>} */
    this.ids = [];
    /** @type {!Array.<number>} */
    this.selfSizes = [];
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Diff = class {
  constructor() {
    /** @type {number} */
    this.addedCount = 0;
    /** @type {number} */
    this.removedCount = 0;
    /** @type {number} */
    this.addedSize = 0;
    /** @type {number} */
    this.removedSize = 0;
    /** @type {!Array.<number>} */
    this.deletedIndexes = [];
    /** @type {!Array.<number>} */
    this.addedIndexes = [];
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.DiffForClass = class {
  constructor() {
    /** @type {number} */
    this.addedCount;
    /** @type {number} */
    this.removedCount;
    /** @type {number} */
    this.addedSize;
    /** @type {number} */
    this.removedSize;
    /** @type {!Array.<number>} */
    this.deletedIndexes;
    /** @type {!Array.<number>} */
    this.addedIndexes;

    /** @type {number} */
    this.countDelta;
    /** @type {number} */
    this.sizeDelta;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.ComparatorConfig = class {
  constructor() {
    /** @type {string} */
    this.fieldName1;
    /** @type {boolean} */
    this.ascending1;
    /** @type {string} */
    this.fieldName2;
    /** @type {boolean} */
    this.ascending2;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.WorkerCommand = class {
  constructor() {
    /** @type {number} */
    this.callId;
    /** @type {string} */
    this.disposition;
    /** @type {number} */
    this.objectId;
    /** @type {number} */
    this.newObjectId;
    /** @type {string} */
    this.methodName;
    /** @type {!Array.<*>} */
    this.methodArguments;
    /** @type {string} */
    this.source;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.ItemsRange = class {
  /**
   * @param {number} startPosition
   * @param {number} endPosition
   * @param {number} totalLength
   * @param {!Array.<*>} items
   */
  constructor(startPosition, endPosition, totalLength, items) {
    /** @type {number} */
    this.startPosition = startPosition;
    /** @type {number} */
    this.endPosition = endPosition;
    /** @type {number} */
    this.totalLength = totalLength;
    /** @type {!Array.<*>} */
    this.items = items;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.StaticData = class {
  /**
   * @param {number} nodeCount
   * @param {number} rootNodeIndex
   * @param {number} totalSize
   * @param {number} maxJSObjectId
   */
  constructor(nodeCount, rootNodeIndex, totalSize, maxJSObjectId) {
    /** @type {number} */
    this.nodeCount = nodeCount;
    /** @type {number} */
    this.rootNodeIndex = rootNodeIndex;
    /** @type {number} */
    this.totalSize = totalSize;
    /** @type {number} */
    this.maxJSObjectId = maxJSObjectId;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Statistics = class {
  constructor() {
    /** @type {number} */
    this.total;
    /** @type {number} */
    this.v8heap;
    /** @type {number} */
    this.native;
    /** @type {number} */
    this.code;
    /** @type {number} */
    this.jsArrays;
    /** @type {number} */
    this.strings;
    /** @type {number} */
    this.system;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.NodeFilter = class {
  /**
   * @param {number=} minNodeId
   * @param {number=} maxNodeId
   */
  constructor(minNodeId, maxNodeId) {
    /** @type {number|undefined} */
    this.minNodeId = minNodeId;
    /** @type {number|undefined} */
    this.maxNodeId = maxNodeId;
    /** @type {number|undefined} */
    this.allocationNodeId;
  }

  /**
   * @param {!HeapSnapshotModel.NodeFilter} o
   * @return {boolean}
   */
  equals(o) {
    return this.minNodeId === o.minNodeId && this.maxNodeId === o.maxNodeId &&
        this.allocationNodeId === o.allocationNodeId;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.SearchConfig = class {
  /**
   * @param {string} query
   * @param {boolean} caseSensitive
   * @param {boolean} isRegex
   * @param {boolean} shouldJump
   * @param {boolean} jumpBackward
   */
  constructor(query, caseSensitive, isRegex, shouldJump, jumpBackward) {
    this.query = query;
    this.caseSensitive = caseSensitive;
    this.isRegex = isRegex;
    this.shouldJump = shouldJump;
    this.jumpBackward = jumpBackward;
  }
};

/**
 * @unrestricted
 */
HeapSnapshotModel.Samples = class {
  /**
   * @param {!Array.<number>} timestamps
   * @param {!Array.<number>} lastAssignedIds
   * @param {!Array.<number>} sizes
   */
  constructor(timestamps, lastAssignedIds, sizes) {
    this.timestamps = timestamps;
    this.lastAssignedIds = lastAssignedIds;
    this.sizes = sizes;
  }
};


text:
package org.zalando.catwatch.backend.repo.util;

import static org.zalando.catwatch.backend.repo.builder.BuilderUtil.freshId;
import static org.zalando.catwatch.backend.repo.builder.BuilderUtil.random;
import static org.zalando.catwatch.backend.repo.builder.BuilderUtil.randomLanguage;
import static org.zalando.catwatch.backend.repo.builder.BuilderUtil.randomProjectName;
import static org.zalando.catwatch.backend.repo.util.DatabasePing.isDatabaseAvailable;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import org.zalando.catwatch.backend.repo.ContributorRepository;
import org.zalando.catwatch.backend.repo.ProjectRepository;
import org.zalando.catwatch.backend.repo.StatisticsRepository;
import org.zalando.catwatch.backend.repo.builder.BuilderUtil;
import org.zalando.catwatch.backend.repo.builder.ContributorBuilder;
import org.zalando.catwatch.backend.repo.builder.ProjectBuilder;
import org.zalando.catwatch.backend.repo.builder.StatisticsBuilder;

@Component
public class DatabasePopulator {

    @Autowired
    private StatisticsRepository statisticsRepository;

    @Autowired
    private ProjectRepository projectRepository;

    @Autowired
    private ContributorRepository contributorRepository;

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void populateTestData() {

        if (!isDatabaseAvailable(jdbcTemplate)) {
            return;                             // return so that the application context can start at least
        }

        // create statistics for two companies (latest)
        new StatisticsBuilder(statisticsRepository) //
            .organizationName("galanto") //
            .publicProjectCount(34) //
            .allStarsCount(54) //
            .allForksCount(110) //
            .days(1)
            .save();

        new StatisticsBuilder(statisticsRepository) //
            .organizationName("galanto-italic") //
            .publicProjectCount(56) //
            .allStarsCount(93) //
            .allForksCount(249) //
            .days(1)
            .save();

        // create projects for galanto
        List<Date> snapshots = Stream
            .generate(BuilderUtil::randomDate)
            .limit(100)
            .collect(Collectors.toList());

        for (int i = 0; i < 10; i++) {
            Long gitHubProjectId = freshId();
            String name = randomProjectName();
            String language = randomLanguage();

            for (Date snapshot : snapshots) {
                new ProjectBuilder(projectRepository)
                    .organizationName("galanto")
                    .name(name)
                    .gitHubProjectId(gitHubProjectId)
                    .primaryLanguage(language)
                    .snapshotDate(snapshot)
                    .forksCount(random(1, 4))
                    .starsCount(random(1, 10))
                    .commitsCount(random(1, 1000))
                    .contributorsCount(random(1, 1000))
                    .score(random(1, 100))
                    .save();
            }
        }

        // create contributors for galanto
        for (int i = 0; i < 2; i++) {
            new ContributorBuilder(contributorRepository)
                .organizationName("galanto")
                .save();
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace Doctrine\Annotations\Exception;

/**
 * Annotations Not found Exception
 *
 * @author Fabio B. Silva <fabio.bat.silva@hotmail.com>
 */
class ClassNotFoundException extends AnnotationException
{
    /**
     * @param string $className
     * @param string $context
     *
     * @return ClassNotFoundException
     */
    public static function annotationNotFound($className, $context) : self
    {
        return new self(sprintf(
            'The annotation "@%s" in %s does not exist, or could not be auto-loaded.',
            $className,
            $context
        ));
    }

    /**
     * @param string $className
     * @param string $context
     *
     * @return RuntimeException
     */
    public static function annotationNotImported($className, $context) : self
    {
        return new self(sprintf(
            'The annotation "@%s" in %s was never imported. ' .
            'Did you maybe forget to add a "use" statement for this annotation ?',
            $className,
            $context
        ));
    }
}


text:
package org.springframework.jdbc.datasource;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;

import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;

/**
 * Proxy for a target JDBC {@link javax.sql.DataSource}, adding awareness of
 * Spring-managed transactions. Similar to a transactional JNDI DataSource
 * as provided by a J2EE server.
 *
 *
Data access code that should remain unaware of Spring's data access support
 * can work with this proxy to seamlessly participate in Spring-managed transactions.
 * Note that the transaction manager, for example {@link DataSourceTransactionManager},
 * still needs to work with the underlying DataSource, not with this proxy.
 *
 *
Make sure that TransactionAwareDataSourceProxy is the outermost DataSource
 * of a chain of DataSource proxies/adapters. TransactionAwareDataSourceProxy
 * can delegate either directly to the target connection pool or to some
 * intermediary proxy/adapter like {@link LazyConnectionDataSourceProxy} or
 * {@link UserCredentialsDataSourceAdapter}.
 *
 *
Delegates to {@link DataSourceUtils} for automatically participating in
 * thread-bound transactions, for example managed by {@link DataSourceTransactionManager}.
 * {@code getConnection} calls and {@code close} calls on returned Connections
 * will behave properly within a transaction, i.e. always operate on the transactional
 * Connection. If not within a transaction, normal DataSource behavior applies.
 *
 *
This proxy allows data access code to work with the plain JDBC API and still
 * participate in Spring-managed transactions, similar to JDBC code in a J2EE/JTA
 * environment. However, if possible, use Spring's DataSourceUtils, JdbcTemplate or
 * JDBC operation objects to get transaction participation even without a proxy for
 * the target DataSource, avoiding the need to define such a proxy in the first place.
 *
 *
As a further effect, using a transaction-aware DataSource will apply remaining
 * transaction timeouts to all created JDBC (Prepared/Callable)Statement. This means
 * that all operations performed through standard JDBC will automatically participate
 * in Spring-managed transaction timeouts.
 *
 *
NOTE: This DataSource proxy needs to return wrapped Connections
 * (which implement the {@link ConnectionProxy} interface) in order to handle
 * close calls properly. Therefore, the returned Connections cannot be cast
 * to a native JDBC Connection type such as OracleConnection or to a connection
 * pool implementation type. Use a corresponding
 * {@link org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor}
 * or JDBC 4's {@link Connection#unwrap} to retrieve the native JDBC Connection.
 *
 * @author Juergen Hoeller
 * @since 1.1
 * @see javax.sql.DataSource#getConnection()
 * @see java.sql.Connection#close()
 * @see DataSourceUtils#doGetConnection
 * @see DataSourceUtils#applyTransactionTimeout
 * @see DataSourceUtils#doReleaseConnection
 */
public class TransactionAwareDataSourceProxy extends DelegatingDataSource {

	private boolean reobtainTransactionalConnections = false;

	/**
	 * Create a new TransactionAwareDataSourceProxy.
	 * @see #setTargetDataSource
	 */
	public TransactionAwareDataSourceProxy() {
	}

	/**
	 * Create a new TransactionAwareDataSourceProxy.
	 * @param targetDataSource the target DataSource
	 */
	public TransactionAwareDataSourceProxy(DataSource targetDataSource) {
		super(targetDataSource);
	}

	/**
	 * Specify whether to reobtain the target Connection for each operation
	 * performed within a transaction.
	 *
The default is "false". Specify "true" to reobtain transactional
	 * Connections for every call on the Connection proxy; this is advisable
	 * on JBoss if you hold on to a Connection handle across transaction boundaries.
	 *
The effect of this setting is similar to the
	 * "hibernate.connection.release_mode" value "after_statement".
	 */
	public void setReobtainTransactionalConnections(boolean reobtainTransactionalConnections) {
		this.reobtainTransactionalConnections = reobtainTransactionalConnections;
	}

	/**
	 * Delegates to DataSourceUtils for automatically participating in Spring-managed
	 * transactions. Throws the original SQLException, if any.
	 *
The returned Connection handle implements the ConnectionProxy interface,
	 * allowing to retrieve the underlying target Connection.
	 * @return a transactional Connection if any, a new one else
	 * @see DataSourceUtils#doGetConnection
	 * @see ConnectionProxy#getTargetConnection
	 */
	@Override
	public Connection getConnection() throws SQLException {
		DataSource ds = getTargetDataSource();
		Assert.state(ds != null, "'targetDataSource' is required");
		return getTransactionAwareConnectionProxy(ds);
	}

	/**
	 * Wraps the given Connection with a proxy that delegates every method call to it
	 * but delegates {@code close()} calls to DataSourceUtils.
	 * @param targetDataSource DataSource that the Connection came from
	 * @return the wrapped Connection
	 * @see java.sql.Connection#close()
	 * @see DataSourceUtils#doReleaseConnection
	 */
	protected Connection getTransactionAwareConnectionProxy(DataSource targetDataSource) {
		return (Connection) Proxy.newProxyInstance(
				ConnectionProxy.class.getClassLoader(),
				new Class<?>[] {ConnectionProxy.class},
				new TransactionAwareInvocationHandler(targetDataSource));
	}

	/**
	 * Determine whether to obtain a fixed target Connection for the proxy
	 * or to reobtain the target Connection for each operation.
	 *
The default implementation returns {@code true} for all
	 * standard cases. This can be overridden through the
	 * {@link #setReobtainTransactionalConnections "reobtainTransactionalConnections"}
	 * flag, which enforces a non-fixed target Connection within an active transaction.
	 * Note that non-transactional access will always use a fixed Connection.
	 * @param targetDataSource the target DataSource
	 */
	protected boolean shouldObtainFixedConnection(DataSource targetDataSource) {
		return (!TransactionSynchronizationManager.isSynchronizationActive() ||
				!this.reobtainTransactionalConnections);
	}

	/**
	 * Invocation handler that delegates close calls on JDBC Connections
	 * to DataSourceUtils for being aware of thread-bound transactions.
	 */
	private class TransactionAwareInvocationHandler implements InvocationHandler {

		private final DataSource targetDataSource;

		private Connection target;

		private boolean closed = false;

		public TransactionAwareInvocationHandler(DataSource targetDataSource) {
			this.targetDataSource = targetDataSource;
		}

		@Override
		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
			// Invocation on ConnectionProxy interface coming in...

			if (method.getName().equals("equals")) {
				// Only considered as equal when proxies are identical.
				return (proxy == args[0]);
			}
			else if (method.getName().equals("hashCode")) {
				// Use hashCode of Connection proxy.
				return System.identityHashCode(proxy);
			}
			else if (method.getName().equals("toString")) {
				// Allow for differentiating between the proxy and the raw Connection.
				StringBuilder sb = new StringBuilder("Transaction-aware proxy for target Connection ");
				if (this.target != null) {
					sb.append("[").append(this.target.toString()).append("]");
				}
				else {
					sb.append(" from DataSource [").append(this.targetDataSource).append("]");
				}
				return sb.toString();
			}
			else if (method.getName().equals("unwrap")) {
				if (((Class<?>) args[0]).isInstance(proxy)) {
					return proxy;
				}
			}
			else if (method.getName().equals("isWrapperFor")) {
				if (((Class<?>) args[0]).isInstance(proxy)) {
					return true;
				}
			}
			else if (method.getName().equals("close")) {
				// Handle close method: only close if not within a transaction.
				DataSourceUtils.doReleaseConnection(this.target, this.targetDataSource);
				this.closed = true;
				return null;
			}
			else if (method.getName().equals("isClosed")) {
				return this.closed;
			}

			if (this.target == null) {
				if (this.closed) {
					throw new SQLException("Connection handle already closed");
				}
				if (shouldObtainFixedConnection(this.targetDataSource)) {
					this.target = DataSourceUtils.doGetConnection(this.targetDataSource);
				}
			}
			Connection actualTarget = this.target;
			if (actualTarget == null) {
				actualTarget = DataSourceUtils.doGetConnection(this.targetDataSource);
			}

			if (method.getName().equals("getTargetConnection")) {
				// Handle getTargetConnection method: return underlying Connection.
				return actualTarget;
			}

			// Invoke method on target Connection.
			try {
				Object retVal = method.invoke(actualTarget, args);

				// If return value is a Statement, apply transaction timeout.
				// Applies to createStatement, prepareStatement, prepareCall.
				if (retVal instanceof Statement) {
					DataSourceUtils.applyTransactionTimeout((Statement) retVal, this.targetDataSource);
				}

				return retVal;
			}
			catch (InvocationTargetException ex) {
				throw ex.getTargetException();
			}
			finally {
				if (actualTarget != this.target) {
					DataSourceUtils.doReleaseConnection(actualTarget, this.targetDataSource);
				}
			}
		}
	}

}


text:
// #define DEV
using UnityEngine;
using System.Collections;

public class CompetitionCutScene : CutScene
{

    [SerializeField]
    private GameObject _npc;
    [SerializeField]
    private Camera _cutSceneCam;
    [SerializeField]
    private GameObject _wayPoint1;
    [SerializeField]
    private GameObject _wayPoint2;
    [SerializeField]
    private GameObject _wayPointNPCEnd;
    [SerializeField]
    private GameObject _wayPointNPC1;
    [SerializeField]
    private GameObject _wayPointNPC2;
    [SerializeField]
    private float _offset = 20f;
    [SerializeField]
    private Transform _camPosition;
    [SerializeField]
    private int _iterationPlayer = 0;

    // Use this for initialization
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
#if DEV
        if (Input.GetKeyDown(KeyCode.Alpha0))
        {
            _iterationPlayer++;
            start();
        }
#endif
    }

    public override void startCutScene()
    {
        if (_iterationPlayer == 1)
        {
            _iterationPlayer++;
            _cutSceneCam.transform.position = BoundCamera.instance.transform.position;
            _cutSceneCam.transform.rotation = BoundCamera.instance.transform.rotation;
            BoundCamera.instance.target = _npc.gameObject.transform;
            BoundCamera.instance.offset = new Vector3(BoundCamera.instance.offset.x, BoundCamera.instance.offset.y + _offset, BoundCamera.instance.offset.z);
            _wayPoint1.transform.position = _cutSceneCam.transform.position;
            _wayPoint2.transform.position = new Vector3(_npc.transform.position.x, _cutSceneCam.transform.position.y + _offset, _npc.transform.position.z);
            BoundCamera.instance.gameObject.SetActive(false);
            _cutSceneCam.gameObject.SetActive(true);
            StartCoroutine(waitForSecondPart());
        }
    }

    public override void endCutScene()
    {
    }

    public override void initialize()
    {

    }

    void OnTriggerEnter(Collider col)
    {
        if (col.tag == Character.playerTag || col.tag == Character.playerTag)
        {
            if (_iterationPlayer == 0)
            {
                _iterationPlayer++;
                start();
            }
        }

        if (col.tag == CutSceneElements.doorTag)
        {
            BoundCamera.instance.target = _cellControl.gameObject.transform;
            BoundCamera.instance.offset = new Vector3(BoundCamera.instance.offset.x, BoundCamera.instance.offset.y, BoundCamera.instance.offset.z);
            _cutSceneCam.transform.position = BoundCamera.instance.transform.position;
            _cutSceneCam.transform.rotation = BoundCamera.instance.transform.rotation;
            _wayPoint1.transform.position = _cutSceneCam.transform.position;
            _wayPoint2.transform.position = new Vector3(_cellControl.transform.position.x, _cutSceneCam.transform.position.y - BoundCamera.instance.offset.y, _cellControl.transform.position.z);
            BoundCamera.instance.gameObject.SetActive(false);
            _cutSceneCam.gameObject.SetActive(true);
            _cutSceneCam.GetComponent<PlatformMvt>().restart();
            StartCoroutine(waitForCamReset());
        }

        if (col.tag == "CutSceneElement")
        {
            start();
            _cutSceneCam.transform.position = BoundCamera.instance.transform.position;
            _cutSceneCam.transform.rotation = BoundCamera.instance.transform.rotation;
            BoundCamera.instance.target = _npc.gameObject.transform;
            BoundCamera.instance.offset = new Vector3(BoundCamera.instance.offset.x, _offset, BoundCamera.instance.offset.z);
            _wayPoint1.transform.position = _cutSceneCam.transform.position;
            _wayPoint2.transform.position = new Vector3(_npc.transform.position.x, _cutSceneCam.transform.position.y - _offset, _npc.transform.position.z);
            BoundCamera.instance.gameObject.SetActive(false);
            _cutSceneCam.gameObject.SetActive(true);
            _cutSceneCam.GetComponent<PlatformMvt>().restart();
            StartCoroutine(waitForWinNPC());
        }
    }

    IEnumerator waitForSecondPart()
    {
        // Debug.Log(this.GetType() + " 1");
        while (Vector3.Distance(_cutSceneCam.transform.position, new Vector3(_npc.transform.position.x, _cutSceneCam.transform.position.y, _npc.transform.position.z)) >= 0.05f)
        {
            yield return null;
        }
        launchCutSceneSecondPart();
        yield return null;
    }

    void launchCutSceneSecondPart()
    {
        _npc.GetComponent<PlatformMvt>().enabled = true;
        BoundCamera.instance.gameObject.SetActive(true);
        _cutSceneCam.gameObject.SetActive(false);
        StartCoroutine(waitForThirdPart());
    }

    IEnumerator waitForThirdPart()
    {
        // Debug.Log(this.GetType() + " 2");
        while (Vector3.Distance(_npc.transform.position, _wayPointNPC2.transform.position) >= 0.05f)
        {
            yield return null;
        }
        launchCutSceneThirdPart();
        yield return null;
    }

    void launchCutSceneThirdPart()
    {
        _cutSceneCam.transform.position = BoundCamera.instance.transform.position;
        _cutSceneCam.transform.rotation = BoundCamera.instance.transform.rotation;
        _wayPoint1.transform.position = _cutSceneCam.transform.position;
        _wayPoint2.transform.position = new Vector3(_camPosition.position.x, _camPosition.position.y + BoundCamera.instance.offset.y, _camPosition.transform.position.z);
        BoundCamera.instance.target = _camPosition;
        BoundCamera.instance.offset = new Vector3(BoundCamera.instance.offset.x, BoundCamera.instance.offset.y - (BoundCamera.instance.offset.y / 2), BoundCamera.instance.offset.z);
        BoundCamera.instance.gameObject.SetActive(false);
        _cutSceneCam.gameObject.SetActive(true);
        StartCoroutine(waitForEnd());
    }

    IEnumerator waitForEnd()
    {
        // Debug.Log(this.GetType() + " 3");
        yield return new WaitForSeconds(3f);
        BoundCamera.instance.gameObject.SetActive(true);
        _cutSceneCam.gameObject.SetActive(false);
        //_camPosition.GetComponent<PlatformMvt> ().enabled = true;
        yield return new WaitForSeconds(2f);
        end();
        yield return null;
    }

    IEnumerator waitForCamReset()
    {
        // Debug.Log(this.GetType() + " 4");
        while (Vector3.Distance(_cutSceneCam.transform.position, _wayPoint2.transform.position) >= 0.05f)
        {
            yield return null;
        }
        end();
        BoundCamera.instance.gameObject.SetActive(true);
        _cutSceneCam.gameObject.SetActive(false);
        StartCoroutine(waitForEndNPC());
        yield return null;
    }

    IEnumerator waitForWinNPC()
    {
        // Debug.Log(this.GetType() + " 5");
        while (Vector3.Distance(_cutSceneCam.transform.position, _wayPoint2.transform.position) >= 0.05f)
        {
            yield return null;
        }
        BoundCamera.instance.gameObject.SetActive(true);
        _cutSceneCam.gameObject.SetActive(false);
        while (Vector3.Distance(_npc.transform.position, _wayPointNPCEnd.transform.position) >= 0.05f)
        {
            yield return null;
        }
        _cutSceneCam.transform.position = BoundCamera.instance.transform.position;
        _cutSceneCam.transform.rotation = BoundCamera.instance.transform.rotation;
        BoundCamera.instance.target = _cellControl.gameObject.transform;
        BoundCamera.instance.offset = new Vector3(BoundCamera.instance.offset.x, BoundCamera.instance.offset.y, BoundCamera.instance.offset.z);
        _wayPoint1.transform.position = _cutSceneCam.transform.position;
        _wayPoint2.transform.position = new Vector3(_cellControl.transform.position.x, _cutSceneCam.transform.position.y, _cellControl.transform.position.z);
        BoundCamera.instance.gameObject.SetActive(false);
        _cutSceneCam.gameObject.SetActive(true);
        _cutSceneCam.GetComponent<PlatformMvt>().restart();
        StartCoroutine(waitForCamReset());
        yield return null;
    }

    IEnumerator waitForEndNPC()
    {
        // Debug.Log(this.GetType() + " 6");
        yield return new WaitForSeconds(3f);
        this.enabled = false;
        yield return null;
    }
}


text:
using FlubuCore.BuildServers;
using FlubuCore.BuildServers.Configurations.Models.Jenkins;
using FlubuCore.Context;
using FlubuCore.Context.Attributes;
using FlubuCore.Context.FluentInterface.Interfaces;
using FlubuCore.Scripting;
using Microsoft.Extensions.Logging;

namespace FlubuCore.ConsoleTestApp
{
    public class DefaultTestScript : DefaultBuildScript
    {
        public string Output => RootDirectory.CombineWith("output222");

        protected override void ConfigureTargets(ITaskContext context)
        {
            var clean = context.CreateTarget("Clean").AddCoreTask(x => x.Clean());

            context.CreateTarget("Build")
                .SetAsDefault()
                .AddCoreTask(x => x.Build())
                .DependsOn(clean);
        }

        public override void Configure(IFlubuConfigurationBuilder configurationBuilder, ILoggerFactory loggerFactory)
        {
            configurationBuilder.ConfigureAzurePipelines(
                config =>
                {
                    config.SetWorkingDirectory("Abc");
                    config.AddCustomScriptStepBeforeTargets(script =>
                    {
                        script.DisplayName = "Custom script step example before target execution";
                        script.Script = "echo before target";
                    });

                    config.AddCustomScriptStepAfterTargets(script =>
                    {
                        script.DisplayName = "Custom script step example after target execution";
                        script.Script = "echo after target";
                    });
                });

            configurationBuilder.ConfigureAppVeyor(app => { app.AddSkipCommits("test.jpg"); });

            configurationBuilder.ConfigureGitHubActions(actions =>
            {
                actions.OnPush().AddBranchesOnPush("Test");
                actions.AddCustomStepBeforeTargets(x =>
                {
                    x.Run = "Abcv";
                    x.Name = "Custom step before";
                });

                actions.AddCustomStepAfterTargets(x =>
                {
                    x.Run = "Lamoid";
                    x.Name = "Custom step before";
                });

                actions.AddEnvironmentVariableToSpecificVmImageJob("Test", "TestValue", GitHubActionsImage.AllLatest);
            });

            configurationBuilder.ConfigureJenkins(x =>
            {
                x.ConfigureOptions(o => o.Retry = 10);
                x.ConfigurePostSteps(o => o.AddSendEmailPostStep(JenkinsPostConditions.Changed, "projectName", "markoz@comtrade.com"));
                x.AddCustomStageBeforeTargets(o =>
                {
                    o.Name = "Before";
                    o.AddStep("Kekec").AddStep("Lamoid");

                });
                x.AddCustomStageAfterTargets(o =>
                {
                    o.Name = "After";
                    o.AddStep("Kekec").AddStep("Lamoid");

                });
            });
        }
    }
}


text:
#ifndef PARAGRAPH_BRIDGING_HLO_HLO_COMPUTE_COST_ANALYSIS_H_
#define PARAGRAPH_BRIDGING_HLO_HLO_COMPUTE_COST_ANALYSIS_H_

#include <memory>
#include <string>
#include <unordered_map>

#include "absl/container/flat_hash_map.h"
#include "tensorflow/compiler/xla/service/hlo_cost_analysis.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"

int64_t ShapeSize(const xla::Shape& shape);

class ComputeCostAnalysis : public xla::HloCostAnalysis {
 public:
  static constexpr const char kOperandBytesAccessedKey[] =
      "operand_bytes_accessed";
  static constexpr const char kOutputBytesAccessedKey[] =
      "output_bytes_accessed";
  explicit ComputeCostAnalysis(const ShapeSizeFunction& shape_size);

  ComputeCostAnalysis(const ShapeSizeFunction& shape_size,
                      const Properties& per_second_rates);

  // All-Reduce originally considers bytes from operands, not bytes coming from
  // the network, which also come through the memory. We need to double operand
  // bytes to get cost estimate right.
  xla::Status HandleAllReduce(const xla::HloInstruction* crs) override;

  xla::Status Postprocess(const xla::HloInstruction* hlo) override;

  // Need to update new properties after HloCostAnalysis is finished to access
  // data from nested computations. Additional metrics can't be placed in
  // HloCostAnalysis::hlo_properties_ as it's protected, nor can they be
  // propagated by overloading HloCostAnalysis::ProcessSubcomputation.
  xla::Status UpdateInstructionProperties();

  float GetPropertyForHlo(const xla::HloInstruction& hlo,
                          const std::string& key,
                          float default_value = 0.0) const;

 protected:
  // As in HloCostAnalysis
  typedef std::unordered_map<const xla::HloInstruction*, Properties>
      HloToProperties;
  HloToProperties instruction_properties_;

  std::unique_ptr<xla::HloCostAnalysis> CreateNestedCostAnalysis(
    const ShapeSizeFunction& shape_size,
    const Properties& per_second_rates) override;
};

#endif  // PARAGRAPH_BRIDGING_HLO_HLO_COMPUTE_COST_ANALYSIS_H_


text:
/*eslint no-console:0 */
const commandLineArgs = require('command-line-args');
const monk = require('monk');
const path = require('path');

const CardImport = require('./fetchdata/CardImport.js');
const CardgameDbImageSource = require('./fetchdata/CardgameDbImageSource.js');
const JsonCardSource = require('./fetchdata/JsonCardSource.js');
const NoImageSource = require('./fetchdata/NoImageSource.js');

const optionsDefinition = [
    { name: 'card-source', type: String, defaultValue: 'json' },
    { name: 'card-dir', type: String, defaultValue: path.join(__dirname, '..', '..', 'throneteki-json-data') },
    { name: 'image-source', type: String, defaultValue: 'cardgamedb' },
    { name: 'image-dir', type: String, defaultValue: path.join(__dirname, '..', '..', 'public', 'img', 'cards') },
    { name: 'no-images', type: Boolean, defaultValue: false }
];

function createDataSource(options) {
    switch(options['card-source']) {
        case 'json':
            return new JsonCardSource(options['card-dir']);
    }

    throw new Error(`Unknown card source '${options['card-source']}'`);
}

function createImageSource(options) {
    if(options['no-images']) {
        return new NoImageSource();
    }

    switch(options['image-source']) {
        case 'none':
            return new NoImageSource();
        case 'cardgamedb':
            return new CardgameDbImageSource();
    }

    throw new Error(`Unknown image source '${options['image-source']}'`);
}

let options = commandLineArgs(optionsDefinition);

let db = monk('mongodb://127.0.0.1:27017/throneteki');
let dataSource = createDataSource(options);
let imageSource = createImageSource(options);
let cardImport = new CardImport(db, dataSource, imageSource, options['image-dir']);

cardImport.import();