text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="CoreNLP-to-HTML.xsl" type="text/xsl"?>
<root>
  <document>
    <sentences>
      <sentence id="1">
        <tokens>
          <token id="1">
            <word>keep</word>
            <lemma>keep</lemma>
            <CharacterOffsetBegin>0</CharacterOffsetBegin>
            <CharacterOffsetEnd>4</CharacterOffsetEnd>
            <POS>VB</POS>
          </token>
          <token id="2">
            <word>one</word>
            <lemma>one</lemma>
            <CharacterOffsetBegin>5</CharacterOffsetBegin>
            <CharacterOffsetEnd>8</CharacterOffsetEnd>
            <POS>PRP</POS>
          </token>
          <token id="3">
            <word>'s</word>
            <lemma>'s</lemma>
            <CharacterOffsetBegin>8</CharacterOffsetBegin>
            <CharacterOffsetEnd>10</CharacterOffsetEnd>
            <POS>POS</POS>
          </token>
          <token id="4">
            <word>nose</word>
            <lemma>nose</lemma>
            <CharacterOffsetBegin>11</CharacterOffsetBegin>
            <CharacterOffsetEnd>15</CharacterOffsetEnd>
            <POS>NN</POS>
          </token>
          <token id="5">
            <word>to</word>
            <lemma>to</lemma>
            <CharacterOffsetBegin>16</CharacterOffsetBegin>
            <CharacterOffsetEnd>18</CharacterOffsetEnd>
            <POS>TO</POS>
          </token>
          <token id="6">
            <word>the</word>
            <lemma>the</lemma>
            <CharacterOffsetBegin>19</CharacterOffsetBegin>
            <CharacterOffsetEnd>22</CharacterOffsetEnd>
            <POS>DT</POS>
          </token>
          <token id="7">
            <word>grindstone</word>
            <lemma>grindstone</lemma>
            <CharacterOffsetBegin>23</CharacterOffsetBegin>
            <CharacterOffsetEnd>33</CharacterOffsetEnd>
            <POS>NN</POS>
          </token>
          <token id="8">
            <word>nine</word>
            <lemma>nine</lemma>
            <CharacterOffsetBegin>34</CharacterOffsetBegin>
            <CharacterOffsetEnd>38</CharacterOffsetEnd>
            <POS>CD</POS>
          </token>
        </tokens>
        <parse>(ROOT (S (VP (VB keep) (NP (NP (PRP one) (POS 's)) (NN nose)) (PP (TO to) (NP (DT the) (NN grindstone) (CD nine)))))) </parse>
        <dependencies type="basic-dependencies">
          <dep type="root">
            <governor idx="0">ROOT</governor>
            <dependent idx="1">keep</dependent>
          </dep>
          <dep type="poss">
            <governor idx="4">nose</governor>
            <dependent idx="2">one</dependent>
          </dep>
          <dep type="possessive">
            <governor idx="2">one</governor>
            <dependent idx="3">'s</dependent>
          </dep>
          <dep type="dobj">
            <governor idx="1">keep</governor>
            <dependent idx="4">nose</dependent>
          </dep>
          <dep type="prep">
            <governor idx="1">keep</governor>
            <dependent idx="5">to</dependent>
          </dep>
          <dep type="det">
            <governor idx="7">grindstone</governor>
            <dependent idx="6">the</dependent>
          </dep>
          <dep type="pobj">
            <governor idx="5">to</governor>
            <dependent idx="7">grindstone</dependent>
          </dep>
          <dep type="num">
            <governor idx="7">grindstone</governor>
            <dependent idx="8">nine</dependent>
          </dep>
        </dependencies>
        <dependencies type="collapsed-dependencies">
          <dep type="root">
            <governor idx="0">ROOT</governor>
            <dependent idx="1">keep</dependent>
          </dep>
          <dep type="poss">
            <governor idx="4">nose</governor>
            <dependent idx="2">one</dependent>
          </dep>
          <dep type="dobj">
            <governor idx="1">keep</governor>
            <dependent idx="4">nose</dependent>
          </dep>
          <dep type="det">
            <governor idx="7">grindstone</governor>
            <dependent idx="6">the</dependent>
          </dep>
          <dep type="prep_to">
            <governor idx="1">keep</governor>
            <dependent idx="7">grindstone</dependent>
          </dep>
          <dep type="num">
            <governor idx="7">grindstone</governor>
            <dependent idx="8">nine</dependent>
          </dep>
        </dependencies>
        <dependencies type="collapsed-ccprocessed-dependencies">
          <dep type="root">
            <governor idx="0">ROOT</governor>
            <dependent idx="1">keep</dependent>
          </dep>
          <dep type="poss">
            <governor idx="4">nose</governor>
            <dependent idx="2">one</dependent>
          </dep>
          <dep type="dobj">
            <governor idx="1">keep</governor>
            <dependent idx="4">nose</dependent>
          </dep>
          <dep type="det">
            <governor idx="7">grindstone</governor>
            <dependent idx="6">the</dependent>
          </dep>
          <dep type="prep_to">
            <governor idx="1">keep</governor>
            <dependent idx="7">grindstone</dependent>
          </dep>
          <dep type="num">
            <governor idx="7">grindstone</governor>
            <dependent idx="8">nine</dependent>
          </dep>
        </dependencies>
      </sentence>
    </sentences>
  </document>
</root>


text:
package co.cask.cdap.spark.metrics;

import co.cask.cdap.api.app.AbstractApplication;
import co.cask.cdap.api.metrics.Metrics;
import co.cask.cdap.api.spark.AbstractSpark;
import co.cask.cdap.api.spark.JavaSparkProgram;
import co.cask.cdap.api.spark.SparkContext;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.Function;

import java.util.Arrays;
import java.util.List;

/**
 * A dummy app to test Spark Metrics. This app just distribute a list so that there are some stages in Spark program.
 */
public class TestSparkMetricsIntegrationApp extends AbstractApplication {

  static final String APP_NAME = "TestSparkMetricsIntegrationApp";
  static final String APP_SPARK_NAME = "SparkMetricsProgram";

  @Override
  public void configure() {
    setName(APP_NAME);
    addSpark(new SparkMetricsProgramSpec());
  }

  public static class SparkMetricsProgramSpec extends AbstractSpark {
    @Override
    public void configure() {
      setName(APP_SPARK_NAME);
      setDescription("Test Spark Metrics");
      setMainClass(SparkMetricsProgram.class);
    }
  }

  public static class SparkMetricsProgram implements JavaSparkProgram {
    @Override
    public void run(SparkContext context) {
      List<Integer> data = Arrays.asList(1, 2, 3, 4, 5);
      final Metrics metrics = context.getMetrics();
      JavaRDD<Integer> distData = ((JavaSparkContext) context.getOriginalSparkContext()).parallelize(data);
      distData.count();
      JavaRDD<Integer> newData = distData.map(new Function<Integer, Integer>() {
        @Override
        public Integer call(Integer val) throws Exception {
          int newVal = val * 10;
          if (newVal > 30) {
            metrics.count("more.than.30", 1);
          }
          return newVal;
        }
      });
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_isoblue_can_CanSocket_CanFrame */

#ifndef _Included_org_isoblue_can_CanSocket_CanFrame
#define _Included_org_isoblue_can_CanSocket_CanFrame
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif


text:
/**
 * @module Jmx
 */
/// <reference path="./jmxPlugin.ts"/>
module Jmx {
  _module.controller("Jmx.ChartController", ["$scope", "$element", "$location", "workspace", "localStorage", "jolokiaUrl", "jolokiaParams", ($scope, $element, $location, workspace:Workspace, localStorage, jolokiaUrl, jolokiaParams) => {

    $scope.metrics = [];
    $scope.updateRate = 1000; //parseInt(localStorage['updateRate']);

    $scope.context = null;
    $scope.jolokia = null;
    $scope.charts = null;

    $scope.reset = () => {
      if ($scope.context) {
        $scope.context.stop();
        $scope.context = null;
      }
      if ($scope.jolokia) {
        $scope.jolokia.stop();
        $scope.jolokia = null;
      }
      if ($scope.charts) {
        $scope.charts.empty();
        $scope.charts = null;
      }
    };

    $scope.$on('$destroy', function () {
      try {
        $scope.deregRouteChange();
      } catch (error) {
        // ignore
      }
      try {
        $scope.dereg();
      } catch (error) {
        // ignore
      }
      $scope.reset();

    });

    $scope.errorMessage = () => {
      if ($scope.updateRate === 0) {
        return "updateRate";
      }

      if ($scope.metrics.length === 0) {
        return "metrics";
      }
    };

    var doRender:()=>any = Core.throttled(render, 200);

    $scope.deregRouteChange = $scope.$on("$routeChangeSuccess", function (event, current, previous) {
      // lets do this asynchronously to avoid Error: $digest already in progress
      doRender();
    });
    $scope.dereg = $scope.$watch('workspace.selection', function () {
      if (workspace.moveIfViewInvalid()) return;
      doRender();
    });

    doRender();

    function render() {

      var node = workspace.selection;
      if (node == null) {
        return;
      }

      if (!angular.isDefined(node) || !angular.isDefined($scope.updateRate) || $scope.updateRate === 0) {
        // Called render too early, let's retry
        setTimeout(doRender, 500);
        Core.$apply($scope);
        return;
      }
      var width = 594;
      var charts = $element.find('#charts');
      if (charts) {
        width = charts.width();
      } else {
        // Called render too early, let's retry
        setTimeout(doRender, 500);
        Core.$apply($scope);
        return;
      }

      // clear out any existing context
      $scope.reset();

      $scope.charts = charts;
      $scope.jolokia = new Jolokia(jolokiaParams);
      $scope.jolokia.start($scope.updateRate);

      var mbean = node.objectName;
      $scope.metrics = [];

      var context = cubism.context()
              .serverDelay($scope.updateRate)
              .clientDelay($scope.updateRate)
              .step($scope.updateRate)
              .size(width);

      $scope.context = context;
      $scope.jolokiaContext = context.jolokia($scope.jolokia);
      var search = $location.search();
      var attributeNames = toSearchArgumentArray(search["att"]);

      if (mbean) {
        // TODO make generic as we can cache them; they rarely ever change
        // lets get the attributes for this mbean

        // we need to escape the mbean path for list
        var listKey = encodeMBeanPath(mbean);
        //console.log("Looking up mbeankey: " + listKey);
        var meta = $scope.jolokia.list(listKey);
        if (meta) {
          var attributes = meta.attr;
          if (attributes) {
            var foundNames = [];
            for (var key in attributes) {
              var value = attributes[key];
              if (value) {
                var typeName = value['type'];
                if (isNumberTypeName(typeName)) {
                  foundNames.push(key);
                }
              }
            }

            // lets filter the attributes
            // if we find none then the att search attribute is invalid
            // so lets discard the filter - as it must be for some other mbean
            if (attributeNames.length) {
              var filtered = foundNames.filter((key) => attributeNames.indexOf(key) >= 0);
              if (filtered.length) {
                foundNames = filtered;
              }
            }

            // sort the names
            foundNames = foundNames.sort();

            angular.forEach(foundNames, (key) => {
              var metric = $scope.jolokiaContext.metric({
                type: 'read',
                mbean: mbean,
                attribute: key
              }, Core.humanizeValue(key));
              if (metric) {
                $scope.metrics.push(metric);
              }
            });
          }
        }
      } else {
        // lets try pull out the attributes and elements from the URI and use those to chart
        var elementNames = toSearchArgumentArray(search["el"]);
        if (attributeNames && attributeNames.length && elementNames && elementNames.length) {

          // first lets map the element names to mbean names to keep the URI small
          var mbeans = {};
          elementNames.forEach((elementName) => {
            var child = node.get(elementName);
            if (!child && node.children) {
              child = <any>node.children.find(n => elementName === n["title"]);
            }
            if (child) {
              var mbean = child.objectName;
              if (mbean) {
                mbeans[elementName] = mbean;
              }
            }
          });

          // sort the names
          attributeNames = attributeNames.sort();

          // lets create the metrics
          attributeNames.forEach((key) => {
            angular.forEach(mbeans, (mbean, name) => {
              var attributeTitle = Core.humanizeValue(key);
              // for now lets always be verbose
              var title = name + ": " + attributeTitle;

              var metric = $scope.jolokiaContext.metric({
                type: 'read',
                mbean: mbean,
                attribute: key
              }, title);
              if (metric) {
                $scope.metrics.push(metric);
              }
            });
          });
        }
        // if we've children and none of the query arguments matched any metrics
        // lets redirect back to the edit view
        if (node.children.length && !$scope.metrics.length) {
          // lets forward to the chart selection UI if we have some children; they may have
          // chartable attributes
          $location.path("jmx/chartEdit");
        }
      }

      if ($scope.metrics.length > 0) {

        var d3Selection = d3.select(charts.get(0));
        var axisEl = d3Selection.selectAll(".axis");

        var bail = false;

        axisEl.data(["top", "bottom"])
                .enter().append("div")
                .attr("class", function (d) {
                  return d + " axis";
                })
                .each(function (d) {
                  if (bail) {
                    return;
                  }
                  try {
                    d3.select(this).call(context.axis().ticks(12).orient(d));
                  } catch (error) {
                    // still rendering at not the right time...
                    // log.debug("error: ", error);
                    if (!bail) {
                      bail = true;
                    }
                  }
                });

        if (bail) {
          $scope.reset();
          setTimeout(doRender, 500);
          Core.$apply($scope);
          return;
        }

        d3Selection.append("div")
                .attr("class", "rule")
                .call(context.rule());

        context.on("focus", function (i) {
          try {
            d3Selection.selectAll(".value").style("right", i === null ? null : context.size() - i + "px");
          } catch (error) {
            log.info("error: ", error);
          }
        });

        $scope.metrics.forEach((metric) => {
          d3Selection.call(function (div) {
            div.append("div")
                    .data([metric])
                    .attr("class", "horizon")
                    .call(context.horizon());
          });
        });

      } else {
        $scope.reset();
      }

      Core.$apply($scope);

    };

  }]);
}


text:
import ChromeExtension from 'crx'
import fs from 'fs'
import commander from 'commander'
import chokidar from 'chokidar'
import debounce from 'debounce'
import { version } from '../package.json'

commander
  .version(version)
  .option('-e, --extension-lib [lib]', 'Extension library to watch, defaults to ./public', './public')
  .option('-o, --out-file [file]', 'crx output file path, defaults to ./extension.crx', './extension.crx')
  .option('-p, --private-key [key]', 'Private key to pack the crx (required)')
  .parse(process.argv)

if (!commander.privateKey) commander.help()

fs.readFile(commander.privateKey, (err, keyContents) => {
  if (err) throw new Error(err)
  let watcher = chokidar.watch(commander.extensionLib, {
    ignored: /[\/\\]\./,
    persistent: true
  });
  console.log("Watching:", commander.extensionLib)
  watcher.on("all", debounce(bundleCrx.bind(null, keyContents), 200))
})

function bundleCrx(key) {
  let crx = new ChromeExtension({
    rootDirectory: commander.extensionLib,
    privateKey: key
  })
  crx.load().then(() => {
    return crx.pack().then((crxBuffer) => {
      fs.writeFile(commander.outFile, crxBuffer, () => {
        console.log(`Wrote ${commander.outFile}`)
      })
    })
  }).catch((reason) => {
    console.error(`Failed to crxify: ${reason}`)
  })
}


text:
/**
 * Support for exporting actuator metrics to KairosDB.
 */
package org.springframework.boot.actuate.autoconfigure.metrics.export.kairos;


text:
#ifndef O3D_CORE_CROSS_CANVAS_UTILS_H_
#define O3D_CORE_CROSS_CANVAS_UTILS_H_

#include "core/cross/float_n.h"
#include "third_party/skia/include/core/SkColor.h"

// Helper function to convert from Float4 to an SkColor
static SkColor Float4ToSkColor(const o3d::Float4& color) {
  unsigned char red = static_cast<unsigned char>(color[0] * 255.0f);
  unsigned char green = static_cast<unsigned char>(color[1] * 255.0f);
  unsigned char blue = static_cast<unsigned char>(color[2] * 255.0f);
  unsigned char alpha = static_cast<unsigned char>(color[3] * 255.0f);
  return SkColorSetARGB(static_cast<U8CPU>(alpha),
                        static_cast<U8CPU>(red),
                        static_cast<U8CPU>(green),
                        static_cast<U8CPU>(blue));
}

#endif  // O3D_CORE_CROSS_CANVAS_UTILS_H_


text:
import SnowFallGeometry from "./snow-fall-geometry";
import SnowFallMaterial from "./snow-fall-material";

export default class SnowMesh  extends THREE.Points {
    constructor(){
        super(new SnowFallGeometry(), new SnowFallMaterial());

        this.material.transparent = true;
    }
    update(dt){
        this.geometry.update(dt);
    }
}


text:
<!DOCTYPE html>

    <title>krushn</title>
    <link type="text/css" rel="stylesheet" href="../css/materialize.css">
    <link type="text/css" rel="stylesheet" href="../css/preloader.css">
    <link type="text/css" rel="stylesheet" href="../css/main.css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

            Logo
            menu

Home

Settings

Share

About

#TODO:Header

Home

Settings

Share

About

Exit

Use location

                        <input type="checkbox">

                Units

                    <select name="units">
                        <option value="km" selected>Kilometers</option>
                        <option value="m">Miles</option>
                    </select>


text:
package jp.co.opentone.bsol.linkbinder.service.common.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import jp.co.opentone.bsol.framework.core.dao.KeyDuplicateException;
import jp.co.opentone.bsol.framework.core.dao.RecordNotFoundException;
import jp.co.opentone.bsol.framework.core.dao.StaleRecordException;
import jp.co.opentone.bsol.framework.core.service.ServiceAbortException;
import jp.co.opentone.bsol.framework.core.util.ArgumentValidator;
import jp.co.opentone.bsol.linkbinder.dao.FavoriteFilterDao;
import jp.co.opentone.bsol.linkbinder.dto.FavoriteFilter;
import jp.co.opentone.bsol.linkbinder.dto.User;
import jp.co.opentone.bsol.linkbinder.dto.condition.SearchFavoriteFilterCondition;
import jp.co.opentone.bsol.linkbinder.message.ApplicationMessageCode;
import jp.co.opentone.bsol.linkbinder.service.AbstractService;
import jp.co.opentone.bsol.linkbinder.service.common.FavoriteFilterService;

/**
 * FavoriteFilter のCRUDを提供する.
 * @author opentone
 */
@Service
@Transactional(rollbackFor = { ServiceAbortException.class })
public class FavoriteFilterServiceImpl extends AbstractService implements FavoriteFilterService {

    /**
     * logger.
     */
    private static Logger log = LoggerFactory.getLogger(FavoriteFilterServiceImpl.class);
    /**
     * 生成シリアルID.
     */
    private static final long serialVersionUID = -7433664602126389071L;

    /* (non-Javadoc)
     * @see jp.co.opentone.bsol.linkbinder.service.common.
     * FavoriteFilterService#search(jp.co.opentone.bsol.linkbinder.dto.condition.SearchFavoriteFilterCondition)
     */
    @Override
    @Transactional(readOnly = true)
    public List<FavoriteFilter> search(SearchFavoriteFilterCondition condition)
            throws ServiceAbortException {
        ArgumentValidator.validateNotNull(condition);

        FavoriteFilterDao dao = getDao(FavoriteFilterDao.class);
        return dao.find(condition);
    }

    /* (non-Javadoc)
     * @see jp.co.opentone.bsol.linkbinder.service.common.FavoriteFilterService#find(java.lang.Long)
     */
    @Override
    @Transactional(readOnly = true)
    public FavoriteFilter find(Long id) throws ServiceAbortException {
        ArgumentValidator.validateNotNull(id);

        FavoriteFilterDao dao = getDao(FavoriteFilterDao.class);
        FavoriteFilter result = null;
        try {
            result = dao.findById(id);

            // アクセス可能かどうかチェック
            validateAccess(result);

        } catch (RecordNotFoundException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(ApplicationMessageCode.NO_DATA_FOUND);
        }
        return result;
    }

    /**
     * @param result
     * @throws ServiceAbortException
     */
    private void validateAccess(FavoriteFilter result) throws ServiceAbortException {
        validateProjectId(result.getProjectId());
        // 自分で作成したFavoriteFilterかどうかチェック
        User curUser = getCurrentUser();
        User filterUser = result.getUser();
        ArgumentValidator.validateNotNull(curUser);
        ArgumentValidator.validateNotNull(filterUser);
        if (curUser.getEmpNo().equals(filterUser.getEmpNo())) {
            return;
        }
        throw new ServiceAbortException(
                ApplicationMessageCode.CANNOT_PERFORM_BECAUSE_ACCESS_LEVEL_INSUFFICIENT);
    }

    /* (non-Javadoc)
     * @see jp.co.opentone.bsol.linkbinder.service.common.FavoriteFilterService
     *      #save(jp.co.opentone.bsol.linkbinder.dto.FavoriteFilter)
     */
    @Override
    public void save(FavoriteFilter favoriteFilter) throws ServiceAbortException {
        ArgumentValidator.validateNotNull(favoriteFilter);

        User curUser = getCurrentUser();
        favoriteFilter.setUser(curUser);
        favoriteFilter.setUpdatedBy(curUser);
        if (favoriteFilter.isNew()) {
            favoriteFilter.setCreatedBy(curUser);
            create(favoriteFilter);
            return;
        }
        update(favoriteFilter);
    }

    private void create(FavoriteFilter favoriteFilter) throws ServiceAbortException {

        FavoriteFilterDao dao = getDao(FavoriteFilterDao.class);
        try {
            dao.create(favoriteFilter);
        } catch (KeyDuplicateException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(e);
        }
    }

    private void update(FavoriteFilter favoriteFilter) throws ServiceAbortException {

        FavoriteFilterDao dao = getDao(FavoriteFilterDao.class);
        try {
            dao.update(favoriteFilter);
        } catch (KeyDuplicateException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(e);
        } catch (StaleRecordException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(
                ApplicationMessageCode.CANNOT_PERFORM_BECAUSE_FAVORITE_FILTER_ALREADY_UPDATED);
        }
    }

    /*
     * (non-Javadoc)
     * @see jp.co.opentone.bsol.linkbinder.service.common.FavoriteFilterService
     *      #delete(jp.co.opentone.bsol.linkbinder.dto.FavoriteFilter)
     */
    @Override
    public void delete(FavoriteFilter favoriteFilter) throws ServiceAbortException {
        ArgumentValidator.validateNotNull(favoriteFilter);
        ArgumentValidator.validateNotNull(favoriteFilter.getId());

        FavoriteFilterDao dao = getDao(FavoriteFilterDao.class);
        favoriteFilter.setUpdatedBy(getCurrentUser());
        try {
            dao.delete(favoriteFilter);
        } catch (KeyDuplicateException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(e);
        } catch (StaleRecordException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            throw new ServiceAbortException(
                ApplicationMessageCode.CANNOT_PERFORM_BECAUSE_FAVORITE_FILTER_ALREADY_UPDATED);
        }
    }

}


text:
package com.twelvemonkeys.util;

import org.junit.Test;

import java.util.Iterator;

import static org.junit.Assert.*;

/**
 * StringTokenIteratorTestCase
 *

 * @author Harald Kuhr
 * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/util/StringTokenIteratorTestCase.java#1 $
 */
public class StringTokenIteratorTest extends TokenIteratorAbstractTest {

    protected TokenIterator createTokenIterator(String pString) {
        return new StringTokenIterator(pString);
    }

    protected TokenIterator createTokenIterator(String pString, String pDelimiters) {
        return new StringTokenIterator(pString, pDelimiters);
    }

    @Test
    public void testEmptyDelimiter() {
        Iterator iterator = createTokenIterator("", "");
        assertFalse("Empty string has elements", iterator.hasNext());
    }

    @Test
    public void testSingleToken() {
        Iterator iterator = createTokenIterator("A");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testSingleTokenEmptyDelimiter() {
        Iterator iterator = createTokenIterator("A", "");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testSingleTokenSingleDelimiter() {
        Iterator iterator = createTokenIterator("A", ",");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testSingleSeparatorDefaultDelimiter() {
        Iterator iterator = createTokenIterator("A B C D");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("B", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("C", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("D", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testSingleSeparator() {
        Iterator iterator = createTokenIterator("A,B,C", ",");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("B", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("C", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testMultipleSeparatorDefaultDelimiter() {
        Iterator iterator = createTokenIterator("A B   C\nD\t\t \nE");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("B", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("C", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("D", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("E", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }

    @Test
    public void testMultipleSeparator() {
        Iterator iterator = createTokenIterator("A,B,;,C...D, ., ,E", " ,.;:");
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("A", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("B", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("C", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("D", iterator.next());
        assertTrue("String has no elements", iterator.hasNext());
        assertEquals("E", iterator.next());
        assertFalse("String has more than one element", iterator.hasNext());
    }
}


text:
My Json Library

![Github Logo](/canonical_set.png)


text:
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using TTC2017.SmartGrids.SubstationStandard.Enumerations;

namespace TTC2017.SmartGrids.SubstationStandard.Dataclasses
{

    /// <summary>
    /// The public interface for APC
    /// </summary>
    [DefaultImplementationTypeAttribute(typeof(APC))]
    [XmlDefaultImplementationTypeAttribute(typeof(APC))]
    public interface IAPC : IModelElement
    {

        /// <summary>
        /// The d property
        /// </summary>
        string D
        {
            get;
            set;
        }

        /// <summary>
        /// The dU property
        /// </summary>
        string DU
        {
            get;
            set;
        }

        /// <summary>
        /// The setMag property
        /// </summary>
        IAnalogueValue SetMag
        {
            get;
            set;
        }

        /// <summary>
        /// The origin property
        /// </summary>
        IOriginator Origin
        {
            get;
            set;
        }

        /// <summary>
        /// The operTm property
        /// </summary>
        ITimeStamp OperTm
        {
            get;
            set;
        }

        /// <summary>
        /// The q property
        /// </summary>
        IQuality Q
        {
            get;
            set;
        }

        /// <summary>
        /// The t property
        /// </summary>
        ITimeStamp T
        {
            get;
            set;
        }

        /// <summary>
        /// The ctlModel property
        /// </summary>
        ICtlModels CtlModel
        {
            get;
            set;
        }

        /// <summary>
        /// The units property
        /// </summary>
        IUnits Units
        {
            get;
            set;
        }

        /// <summary>
        /// The sVC property
        /// </summary>
        IScaledValueConfig SVC
        {
            get;
            set;
        }

        /// <summary>
        /// The minVal property
        /// </summary>
        IAnalogueValue MinVal
        {
            get;
            set;
        }

        /// <summary>
        /// The maxVal property
        /// </summary>
        IAnalogueValue MaxVal
        {
            get;
            set;
        }

        /// <summary>
        /// The stepSize property
        /// </summary>
        IAnalogueValue StepSize
        {
            get;
            set;
        }

        /// <summary>
        /// Gets fired before the D property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> DChanging;

        /// <summary>
        /// Gets fired when the D property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> DChanged;

        /// <summary>
        /// Gets fired before the DU property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> DUChanging;

        /// <summary>
        /// Gets fired when the DU property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> DUChanged;

        /// <summary>
        /// Gets fired before the SetMag property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> SetMagChanging;

        /// <summary>
        /// Gets fired when the SetMag property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> SetMagChanged;

        /// <summary>
        /// Gets fired before the Origin property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> OriginChanging;

        /// <summary>
        /// Gets fired when the Origin property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> OriginChanged;

        /// <summary>
        /// Gets fired before the OperTm property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> OperTmChanging;

        /// <summary>
        /// Gets fired when the OperTm property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> OperTmChanged;

        /// <summary>
        /// Gets fired before the Q property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> QChanging;

        /// <summary>
        /// Gets fired when the Q property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> QChanged;

        /// <summary>
        /// Gets fired before the T property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> TChanging;

        /// <summary>
        /// Gets fired when the T property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> TChanged;

        /// <summary>
        /// Gets fired before the CtlModel property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> CtlModelChanging;

        /// <summary>
        /// Gets fired when the CtlModel property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> CtlModelChanged;

        /// <summary>
        /// Gets fired before the Units property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> UnitsChanging;

        /// <summary>
        /// Gets fired when the Units property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> UnitsChanged;

        /// <summary>
        /// Gets fired before the SVC property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> SVCChanging;

        /// <summary>
        /// Gets fired when the SVC property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> SVCChanged;

        /// <summary>
        /// Gets fired before the MinVal property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> MinValChanging;

        /// <summary>
        /// Gets fired when the MinVal property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> MinValChanged;

        /// <summary>
        /// Gets fired before the MaxVal property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> MaxValChanging;

        /// <summary>
        /// Gets fired when the MaxVal property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> MaxValChanged;

        /// <summary>
        /// Gets fired before the StepSize property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> StepSizeChanging;

        /// <summary>
        /// Gets fired when the StepSize property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> StepSizeChanged;
    }
}


text:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

global $sugar_version, $js_custom_version;

if(empty($_SESSION['setup_db_host_name'])){
    $_SESSION['setup_db_host_name'] = (isset($sugar_config['db_host_name']))  ? $sugar_config['db_host_name'] :  $_SERVER['SERVER_NAME'];
}

if( !isset( $install_script ) || !$install_script ){
    die($mod_strings['ERR_NO_DIRECT_SCRIPT']);
}

// DB split
$createDbCheckbox = '';
$createDb = (!empty($_SESSION['setup_db_create_database'])) ? 'checked="checked"' : '';
$dropCreate = (!empty($_SESSION['setup_db_drop_tables'])) ? 'checked="checked"' : '';
$instanceName = '';
if (isset($_SESSION['setup_db_host_instance']) && !empty($_SESSION['setup_db_host_instance'])){
    $instanceName = $_SESSION['setup_db_host_instance'];
}

$setupDbPortNum ='';
if (isset($_SESSION['setup_db_port_num']) && !empty($_SESSION['setup_db_port_num'])){
    $setupDbPortNum = $_SESSION['setup_db_port_num'];
}

$db = getInstallDbInstance();

///////////////////////////////////////////////////////////////////////////////
////	BEGIN PAGE OUTPUT

$langHeader = get_language_header();

$out =<<<EOQ
<!DOCTYPE HTML>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_DBCONF_TITLE']}</title>
    <link rel="stylesheet" href="install/install.css" type="text/css" />
    <link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css' />
    <link rel="stylesheet" href="themes/Suite7/css/fontello.css">
    <link rel="stylesheet" href="themes/Suite7/css/animation.css">
    <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">

EOQ;
$out .= '';

$out2 =<<<EOQ2

        <form action="install.php" method="post" name="setConfig" id="form">

{$mod_strings['LBL_STEP5']}

            <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''>
            <input type="hidden" id="hidden_goto" name="goto" value="{$mod_strings['LBL_BACK']}" />

{$mod_strings['LBL_DBCONF_TITLE']}

{$mod_strings['LBL_REQUIRED']}

{$mod_strings['LBL_DBCONF_TITLE_NAME']}

EOQ2;

$config_params = $db->installConfig();
$form = '';
foreach($config_params as $group => $gdata) {
    $form.= "
";
    $form .= "{$mod_strings[$group]}
\n";
    foreach($gdata as $name => $value) {

        if(!empty($value)) {
            if(!empty($value['required'])) {
                $form .= "*";
            }
             else {
            }
            if(!empty($_SESSION[$name])) {
                $sessval = $_SESSION[$name];
            } else {
                $sessval = '';
            }
            if(!empty($value["type"])) {
                $type = $value["type"];
            } else {
                $type = '';
            }

            $form .= <<<FORM

FORM;
            //if the type is password, set a hidden field to capture the value.  This is so that we can properly encode special characters, which is a limitation with password fields
            if($type=='password'){
                $form .= "<input type='$type' name='{$name}_entry' id='{$name}_entry' value='".urldecode($sessval)."'><input type='hidden' name='$name' id='$name' value='".urldecode($sessval)."'>";
            }else{
                $form .= "<input type='$type' name='$name' id='$name' value='$sessval'>";
            }

            $form .= <<<FORM
FORM;

        } else {
            $form .= "<input name=\"$name\" id=\"$name\" value=\"\" type=\"hidden\">\n";
        }
    }
    $form .= "
";
}

$out2 .= $form;

//if we are installing in custom mode, include the following html
if($db->supports("create_user")){
// create / set db user dropdown
    $auto_select = '';$provide_select ='';$create_select = '';$same_select = '';
    if(isset($_SESSION['dbUSRData'])){
//    if($_SESSION['dbUSRData']=='auto')    {$auto_select ='selected';}
        if($_SESSION['dbUSRData']=='provide') {$provide_select ='selected';}
        if(isset($_SESSION['install_type'])  && !empty($_SESSION['install_type'])  && strtolower($_SESSION['install_type'])=='custom'){
            if($_SESSION['dbUSRData']=='create')  {$create_select ='selected';}
        }
        if($_SESSION['dbUSRData']=='same')  {$same_select ='selected';}
    }else{
        $same_select ='selected';
    }
    $dbUSRDD   = "<select name='dbUSRData' id='dbUSRData' onchange='toggleDBUser();'>";
    $dbUSRDD  .= "<option value='provide' $provide_select>".$mod_strings['LBL_DBCONFIG_PROVIDE_DD']."</option>";
    $dbUSRDD  .= "<option value='create' $create_select>".$mod_strings['LBL_DBCONFIG_CREATE_DD']."</option>";
    $dbUSRDD  .= "<option value='same' $same_select>".$mod_strings['LBL_DBCONFIG_SAME_DD']."</option>";
    $dbUSRDD  .= "</select>
 ";

    $setup_db_sugarsales_password = urldecode($_SESSION['setup_db_sugarsales_password']);
    $setup_db_sugarsales_user = urldecode($_SESSION['setup_db_sugarsales_user']);
    $setup_db_sugarsales_password_retype = urldecode($_SESSION['setup_db_sugarsales_password_retype']);

    $out2 .=<<<EOQ2

{$mod_strings['LBL_DBCONFIG_SECURITY']}

{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}$dbUSRDD

        *
            {$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}
            <input type="text" name="setup_db_sugarsales_user" maxlength="16" value="{$_SESSION['setup_db_sugarsales_user']}" />
            {$mod_strings['LBL_DBCONF_DB_PASSWORD']}
            <input type="password" name="setup_db_sugarsales_password_entry" value="{$setup_db_sugarsales_password}" /><input type="hidden" name="setup_db_sugarsales_password" value="{$setup_db_sugarsales_password}" />
            <input type="hidden" name="setup_db_sugarsales_password" value="{$_SESSION['setup_db_sugarsales_password']}" />
            {$mod_strings['LBL_DBCONF_DB_PASSWORD2']}
            <input type="password" name="setup_db_sugarsales_password_retype_entry" value="{$setup_db_sugarsales_password_retype}"  /><input type="hidden" name="setup_db_sugarsales_password_retype" value="{$setup_db_sugarsales_password_retype}" />

EOQ2;
}

$demoDD = "<select name='demoData' id='demoData' class='select'><option value='no' >".$mod_strings['LBL_NO']."</option><option value='yes'>".$mod_strings['LBL_YES']."</option>";
$demoDD .= "</select>";

$out3 =<<<EOQ3

{$mod_strings['LBL_DBCONF_DEMO_DATA_TITLE']}

    {$mod_strings['LBL_DBCONF_DEMO_DATA']}
        {$demoDD}

EOQ3;

$out4 =<<<EOQ4

        <input type="hidden" name="current_step" value="{$next_step}">
        <input class="button" type="button" name="goto" value="{$mod_strings['LBL_BACK']}" id="button_back_dbConfig" onclick="document.getElementById('form').submit();" />
        <input class="button" type="button" name="goto" id="button_next2" value="{$mod_strings['LBL_NEXT']}" onClick="callDBCheck();"/>

</form>

{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}

{$mod_strings['LBL_DROP_DB_CONFIRM']}

                    <input id='accept_btn' type='button' class='button' onclick='confirm_drop_tables(true)' value="{$mod_strings['LBL_ACCEPT']}">
                    <input type='button' class='button' onclick='confirm_drop_tables(false)' id="button_cancel_dbConfig" value="{$mod_strings['LBL_CANCEL']}">

Visit suitecrm.com | Support Forums | Installation Guide | License

EOQ5;

////	END PAGE OUTPUT
///////////////////////////////////////////////////////////////////////////////

echo $out;
echo $out2;
echo $out3;
echo $out4;
echo $out_dd;
echo $out5;

?>


text:
package me.karthy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootPcfApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringBootPcfApplication.class, args);
	}
}


text:
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
  var
    $allModules    = $(this),
    $body          = $('body'),
    $head          = $('head'),

    moduleSelector = $allModules.selector || '',

    time           = new Date().getTime(),
    performance    = [],

    query          = arguments[0],
    methodInvoked  = (typeof query == 'string'),
    queryArguments = [].slice.call(arguments, 1),
    returnedValue
  ;

  $allModules
    .each(function() {
      var
        settings        = ( $.isPlainObject(parameters) )
          ? $.extend(true, {}, module.exports.settings, parameters)
          : $.extend({}, module.exports.settings),

        selector        = settings.selector,
        className       = settings.className,
        namespace       = settings.namespace,
        error           = settings.error,

        eventNamespace  = '.' + namespace,
        moduleNamespace = 'module-' + namespace,

        $module         = $(this),
        $style          = $('style[title=' + namespace + ']'),

        element         = this,
        instance        = $module.data(moduleNamespace),
        module
      ;

      module      = {

        initialize: function() {
          module.debug('Initializing sidebar', $module);
          module.instantiate();
        },

        instantiate: function() {
          module.verbose('Storing instance of module', module);
          instance = module;
          $module
            .data(moduleNamespace, module)
          ;
        },

        destroy: function() {
          module.verbose('Destroying previous module for', $module);
          $module
            .off(eventNamespace)
            .removeData(moduleNamespace)
          ;
        },

        refresh: function() {
          module.verbose('Refreshing selector cache');
          $style  = $('style[title=' + namespace + ']');
        },

        attachEvents: function(selector, event) {
          var
            $toggle = $(selector)
          ;
          event = $.isFunction(module[event])
            ? module[event]
            : module.toggle
          ;
          if($toggle.size() > 0) {
            module.debug('Attaching sidebar events to element', selector, event);
            $toggle
              .off(eventNamespace)
              .on('click' + eventNamespace, event)
            ;
          }
          else {
            module.error(error.notFound);
          }
        },

        show: function(callback) {
          callback = $.isFunction(callback)
            ? callback
            : function(){}
          ;
          module.debug('Showing sidebar', callback);
          if(module.is.closed()) {
            if(!settings.overlay) {
              if(settings.exclusive) {
                module.hideAll();
              }
              module.pushPage();
            }
            module.set.active();
            callback();
            $.proxy(settings.onChange, element)();
            $.proxy(settings.onShow, element)();
          }
          else {
            module.debug('Sidebar is already visible');
          }
        },

        hide: function(callback) {
          callback = $.isFunction(callback)
            ? callback
            : function(){}
          ;
          module.debug('Hiding sidebar', callback);
          if(module.is.open()) {
            if(!settings.overlay) {
              module.pullPage();
              module.remove.pushed();
            }
            module.remove.active();
            callback();
            $.proxy(settings.onChange, element)();
            $.proxy(settings.onHide, element)();
          }
        },

        hideAll: function() {
          $(selector.sidebar)
            .filter(':visible')
              .sidebar('hide')
          ;
        },

        toggle: function() {
          if(module.is.closed()) {
            module.show();
          }
          else {
            module.hide();
          }
        },

        pushPage: function() {
          var
            direction = module.get.direction(),
            distance  = (module.is.vertical())
              ? $module.outerHeight()
              : $module.outerWidth()
          ;
          if(settings.useCSS) {
            module.debug('Using CSS to animate body');
            module.add.bodyCSS(direction, distance);
            module.set.pushed();
          }
          else {
            module.animatePage(direction, distance, module.set.pushed);
          }
        },

        pullPage: function() {
          var
            direction = module.get.direction()
          ;
          if(settings.useCSS) {
            module.debug('Resetting body position css');
            module.remove.bodyCSS();
          }
          else {
            module.debug('Resetting body position using javascript');
            module.animatePage(direction, 0);
          }
          module.remove.pushed();
        },

        animatePage: function(direction, distance) {
          var
            animateSettings = {}
          ;
          animateSettings['padding-' + direction] = distance;
          module.debug('Using javascript to animate body', animateSettings);
          $body
            .animate(animateSettings, settings.duration, module.set.pushed)
          ;
        },

        add: {
          bodyCSS: function(direction, distance) {
            var
              style
            ;
            if(direction !== className.bottom) {
              style = ''
                + '<style title="' + namespace + '">'
                + 'body.pushed {'
                + '  margin-' + direction + ': ' + distance + 'px !important;'
                + '}'
                + '</style>'
              ;
            }
            $head.append(style);
            module.debug('Adding body css to head', $style);
          }
        },

        remove: {
          bodyCSS: function() {
            module.debug('Removing body css styles', $style);
            module.refresh();
            $style.remove();
          },
          active: function() {
            $module.removeClass(className.active);
          },
          pushed: function() {
            module.verbose('Removing body push state', module.get.direction());
            $body
              .removeClass(className[ module.get.direction() ])
              .removeClass(className.pushed)
            ;
          }
        },

        set: {
          active: function() {
            $module.addClass(className.active);
          },
          pushed: function() {
            module.verbose('Adding body push state', module.get.direction());
            $body
              .addClass(className[ module.get.direction() ])
              .addClass(className.pushed)
            ;
          }
        },

        get: {
          direction: function() {
            if($module.hasClass(className.top)) {
              return className.top;
            }
            else if($module.hasClass(className.right)) {
              return className.right;
            }
            else if($module.hasClass(className.bottom)) {
              return className.bottom;
            }
            else {
              return className.left;
            }
          },
          transitionEvent: function() {
            var
              element     = document.createElement('element'),
              transitions = {
                'transition'       :'transitionend',
                'OTransition'      :'oTransitionEnd',
                'MozTransition'    :'transitionend',
                'WebkitTransition' :'webkitTransitionEnd'
              },
              transition
            ;
            for(transition in transitions){
              if( element.style[transition] !== undefined ){
                return transitions[transition];
              }
            }
          }
        },

        is: {
          open: function() {
            return $module.is(':animated') || $module.hasClass(className.active);
          },
          closed: function() {
            return !module.is.open();
          },
          vertical: function() {
            return $module.hasClass(className.top);
          }
        },

        setting: function(name, value) {
          if( $.isPlainObject(name) ) {
            $.extend(true, settings, name);
          }
          else if(value !== undefined) {
            settings[name] = value;
          }
          else {
            return settings[name];
          }
        },
        internal: function(name, value) {
          if( $.isPlainObject(name) ) {
            $.extend(true, module, name);
          }
          else if(value !== undefined) {
            module[name] = value;
          }
          else {
            return module[name];
          }
        },
        debug: function() {
          if(settings.debug) {
            if(settings.performance) {
              module.performance.log(arguments);
            }
            else {
              module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
              module.debug.apply(console, arguments);
            }
          }
        },
        verbose: function() {
          if(settings.verbose && settings.debug) {
            if(settings.performance) {
              module.performance.log(arguments);
            }
            else {
              module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
              module.verbose.apply(console, arguments);
            }
          }
        },
        error: function() {
          module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
          module.error.apply(console, arguments);
        },
        performance: {
          log: function(message) {
            var
              currentTime,
              executionTime,
              previousTime
            ;
            if(settings.performance) {
              currentTime   = new Date().getTime();
              previousTime  = time || currentTime;
              executionTime = currentTime - previousTime;
              time          = currentTime;
              performance.push({
                'Element'        : element,
                'Name'           : message[0],
                'Arguments'      : [].slice.call(message, 1) || '',
                'Execution Time' : executionTime
              });
            }
            clearTimeout(module.performance.timer);
            module.performance.timer = setTimeout(module.performance.display, 100);
          },
          display: function() {
            var
              title = settings.name + ':',
              totalTime = 0
            ;
            time = false;
            clearTimeout(module.performance.timer);
            $.each(performance, function(index, data) {
              totalTime += data['Execution Time'];
            });
            title += ' ' + totalTime + 'ms';
            if(moduleSelector) {
              title += ' \'' + moduleSelector + '\'';
            }
            if($allModules.size() > 1) {
              title += ' ' + '(' + $allModules.size() + ')';
            }
            if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
              console.groupCollapsed(title);
              if(console.table) {
                console.table(performance);
              }
              else {
                $.each(performance, function(index, data) {
                  console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
                });
              }
              console.groupEnd();
            }
            performance = [];
          }
        },
        invoke: function(query, passedArguments, context) {
          var
            object = instance,
            maxDepth,
            found,
            response
          ;
          passedArguments = passedArguments || queryArguments;
          context         = element         || context;
          if(typeof query == 'string' && object !== undefined) {
            query    = query.split(/[\. ]/);
            maxDepth = query.length - 1;
            $.each(query, function(depth, value) {
              var camelCaseValue = (depth != maxDepth)
                ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
                : query
              ;
              if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
                object = object[camelCaseValue];
              }
              else if( object[camelCaseValue] !== undefined ) {
                found = object[camelCaseValue];
                return false;
              }
              else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
                object = object[value];
              }
              else if( object[value] !== undefined ) {
                found = object[value];
                return false;
              }
              else {
                return false;
              }
            });
          }
          if ( $.isFunction( found ) ) {
            response = found.apply(context, passedArguments);
          }
          else if(found !== undefined) {
            response = found;
          }
          if($.isArray(returnedValue)) {
            returnedValue.push(response);
          }
          else if(returnedValue !== undefined) {
            returnedValue = [returnedValue, response];
          }
          else if(response !== undefined) {
            returnedValue = response;
          }
          return found;
        }
      };
      if(methodInvoked) {
        if(instance === undefined) {
          module.initialize();
        }
        module.invoke(query);
      }
      else {
        if(instance !== undefined) {
          module.destroy();
        }
        module.initialize();
      }
    })
  ;

  return (returnedValue !== undefined)
    ? returnedValue
    : this
  ;
};

module.exports.settings = {

  name        : 'Sidebar',
  namespace   : 'sidebar',

  debug       : false,
  verbose     : true,
  performance : true,

  useCSS      : true,
  exclusive   : true,
  overlay     : false,
  duration    : 300,

  onChange     : function(){},
  onShow       : function(){},
  onHide       : function(){},

  className: {
    active : 'active',
    pushed : 'pushed',
    top    : 'top',
    left   : 'left',
    right  : 'right',
    bottom : 'bottom'
  },

  selector: {
    sidebar: '.ui.sidebar'
  },

  error   : {
    method   : 'The method you called is not defined.',
    notFound : 'There were no elements that matched the specified selector'
  }

};

})( require("jquery"), window , document );


text:
extern float result;
extern float error;

float mem;
char memIsFull = 0;

Calculator::Calculator(QObject *parent) : QObject(parent) {

}

void Calculator::evaluateSlot(const QString &arg) {
    QObject* resultDisplay = this->parent()->findChild<QObject*>("resultDisplay");
    QObject* memo = this->parent()->findChild<QObject*>("memo");

    error = 0;

    QByteArray ba = arg.toLatin1();
    const char *expression = ba.data();

    YY_BUFFER_STATE bufferState = yy_scan_string(expression);
    yyparse();

    QString strResult = QString::number(result);

    if(!error) {
        printf("Result %f\n", result);

        memo->setProperty("text", strResult);
        resultDisplay->setProperty("text", "");
    }
    else {
        fprintf(stderr, "Error\n");

        memo->setProperty("text", "Invalid");
    }

    yy_delete_buffer(bufferState);
}

void Calculator::saveMemSlot(const QString &arg) {
    QObject* memo = this->parent()->findChild<QObject*>("memo");
    mem = memo->property("text").toFloat();
    printf("Saved to mem %f\n", mem);
    memIsFull = 1;
}

void Calculator::readMemSlot() {
    QObject* resultDisplay = this->parent()->findChild<QObject*>("resultDisplay");
    QString strResult = QString::number(mem);
    resultDisplay->setProperty("text", strResult);
}

void Calculator::addMemSlot() {
    QObject* memo = this->parent()->findChild<QObject*>("memo");
    mem += memo->property("text").toFloat();
    printf("Added to mem. Now mem is %f\n", mem);
}


text:
import React from 'react';
import renderer from 'react-test-renderer';
import NavLink from '../';

// mock nested components
jest.mock('react-router-dom');

it('renders correctly', () => {
  const tree = renderer.create(<NavLink to="test" label="test" styles={{}} />).toJSON();
  expect(tree).toMatchSnapshot();
});


text:
/*
 * Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
*
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 *  * Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 *  * Neither the name of JSR-310 nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.teavm.classlib.java.time.chrono;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import java.time.DateTimeException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.time.ZoneOffset;
import java.time.chrono.ChronoLocalDate;
import java.time.chrono.ChronoLocalDateTime;
import java.time.chrono.ChronoZonedDateTime;
import java.time.chrono.Chronology;
import java.time.chrono.IsoChronology;
import java.time.chrono.MinguoChronology;
import java.time.chrono.MinguoEra;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

/**
 * Test.
 */
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestMinguoChronology {

    //-----------------------------------------------------------------------
    // Chrono.ofName("Minguo")  Lookup by name
    //-----------------------------------------------------------------------
    @Test
    public void test_chrono_byName() {
        Chronology c = MinguoChronology.INSTANCE;
        Chronology test = Chronology.of("Minguo");
        Assert.assertNotNull(test, "The Minguo calendar could not be found byName");
        Assert.assertEquals(test.getId(), "Minguo", "ID mismatch");
        Assert.assertEquals(test.getCalendarType(), "roc", "Type mismatch");
        Assert.assertEquals(test, c);
    }

    //-----------------------------------------------------------------------
    // creation, toLocalDate()
    //-----------------------------------------------------------------------
    @DataProvider(name = "samples")
    Object[][] data_samples() {
        return new Object[][] {
            {MinguoChronology.INSTANCE.date(1, 1, 1), LocalDate.of(1912, 1, 1)},
            {MinguoChronology.INSTANCE.date(1, 1, 2), LocalDate.of(1912, 1, 2)},
            {MinguoChronology.INSTANCE.date(1, 1, 3), LocalDate.of(1912, 1, 3)},

            {MinguoChronology.INSTANCE.date(2, 1, 1), LocalDate.of(1913, 1, 1)},
            {MinguoChronology.INSTANCE.date(3, 1, 1), LocalDate.of(1914, 1, 1)},
            {MinguoChronology.INSTANCE.date(3, 12, 6), LocalDate.of(1914, 12, 6)},
            {MinguoChronology.INSTANCE.date(4, 1, 1), LocalDate.of(1915, 1, 1)},
            {MinguoChronology.INSTANCE.date(4, 7, 3), LocalDate.of(1915, 7, 3)},
            {MinguoChronology.INSTANCE.date(4, 7, 4), LocalDate.of(1915, 7, 4)},
            {MinguoChronology.INSTANCE.date(5, 1, 1), LocalDate.of(1916, 1, 1)},
            {MinguoChronology.INSTANCE.date(100, 3, 3), LocalDate.of(2011, 3, 3)},
            {MinguoChronology.INSTANCE.date(101, 10, 28), LocalDate.of(2012, 10, 28)},
            {MinguoChronology.INSTANCE.date(101, 10, 29), LocalDate.of(2012, 10, 29)},
        };
    }

    @Test(dataProvider = "samples")
    public void test_toLocalDate(ChronoLocalDate minguo, LocalDate iso) {
        assertEquals(LocalDate.from(minguo), iso);
    }

    @Test(dataProvider = "samples")
    public void test_fromCalendrical(ChronoLocalDate minguo, LocalDate iso) {
        assertEquals(MinguoChronology.INSTANCE.date(iso), minguo);
    }

    @SuppressWarnings("unused")
    @Test(dataProvider = "samples")
    public void test_MinguoDate(ChronoLocalDate minguoDate, LocalDate iso) {
        ChronoLocalDate hd = minguoDate;
        ChronoLocalDateTime<?> hdt = hd.atTime(LocalTime.NOON);
        ZoneOffset zo = ZoneOffset.ofHours(1);
        ChronoZonedDateTime<?> hzdt = hdt.atZone(zo);
        hdt = hdt.plus(1, ChronoUnit.YEARS);
        hdt = hdt.plus(1, ChronoUnit.MONTHS);
        hdt = hdt.plus(1, ChronoUnit.DAYS);
        hdt = hdt.plus(1, ChronoUnit.HOURS);
        hdt = hdt.plus(1, ChronoUnit.MINUTES);
        hdt = hdt.plus(1, ChronoUnit.SECONDS);
        hdt = hdt.plus(1, ChronoUnit.NANOS);
        ChronoLocalDateTime<?> a2 = hzdt.toLocalDateTime();
        ChronoLocalDate a3 = a2.toLocalDate();
        ChronoLocalDate a5 = hzdt.toLocalDate();
        //System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
    }

    @Test
    public void test_MinguoChrono() {
        ChronoLocalDate h1 = MinguoChronology.INSTANCE.date(MinguoEra.ROC, 1, 2, 3);
        ChronoLocalDate h2 = h1;
        ChronoLocalDateTime<?> h3 = h2.atTime(LocalTime.NOON);
        @SuppressWarnings("unused")
        ChronoZonedDateTime<?> h4 = h3.atZone(ZoneOffset.UTC);
    }

    @DataProvider(name = "badDates")
    Object[][] data_badDates() {
        return new Object[][] {
            {1912, 0, 0},

            {1912, -1, 1},
            {1912, 0, 1},
            {1912, 14, 1},
            {1912, 15, 1},

            {1912, 1, -1},
            {1912, 1, 0},
            {1912, 1, 32},
            {1912, 2, 29},
            {1912, 2, 30},

            {1912, 12, -1},
            {1912, 12, 0},
            {1912, 12, 32},
            };
    }

    @Test(dataProvider = "badDates", expectedExceptions = DateTimeException.class)
    public void test_badDates(int year, int month, int dom) {
        MinguoChronology.INSTANCE.date(year, month, dom);
    }

    //-----------------------------------------------------------------------
    // with(DateTimeAdjuster)
    //-----------------------------------------------------------------------
    @Test
    public void test_adjust1() {
        ChronoLocalDate base = MinguoChronology.INSTANCE.date(2012, 10, 29);
        ChronoLocalDate test = base.with(TemporalAdjusters.lastDayOfMonth());
        assertEquals(test, MinguoChronology.INSTANCE.date(2012, 10, 31));
    }

    @Test
    public void test_adjust2() {
        ChronoLocalDate base = MinguoChronology.INSTANCE.date(1728, 12, 2);
        ChronoLocalDate test = base.with(TemporalAdjusters.lastDayOfMonth());
        assertEquals(test, MinguoChronology.INSTANCE.date(1728, 12, 31));
    }

    //-----------------------------------------------------------------------
    // MinguoDate.with(Local*)
    //-----------------------------------------------------------------------
    @Test
    public void test_adjust_toLocalDate() {
        ChronoLocalDate minguo = MinguoChronology.INSTANCE.date(99, 1, 4);
        ChronoLocalDate test = minguo.with(LocalDate.of(2012, 7, 6));
        assertEquals(test, MinguoChronology.INSTANCE.date(101, 7, 6));
    }

    @Test(expectedExceptions = DateTimeException.class)
    public void test_adjust_toMonth() {
        ChronoLocalDate minguo = MinguoChronology.INSTANCE.date(1726, 1, 4);
        minguo.with(Month.APRIL);
    }

    //-----------------------------------------------------------------------
    // LocalDate.with(MinguoDate)
    //-----------------------------------------------------------------------
    @Test
    public void test_LocalDate_adjustToMinguoDate() {
        ChronoLocalDate minguo = MinguoChronology.INSTANCE.date(101, 10, 29);
        LocalDate test = LocalDate.MIN.with(minguo);
        assertEquals(test, LocalDate.of(2012, 10, 29));
    }

    @Test
    public void test_LocalDateTime_adjustToMinguoDate() {
        ChronoLocalDate minguo = MinguoChronology.INSTANCE.date(101, 10, 29);
        LocalDateTime test = LocalDateTime.MIN.with(minguo);
        assertEquals(test, LocalDateTime.of(2012, 10, 29, 0, 0));
    }

    //-----------------------------------------------------------------------
    // toString()
    //-----------------------------------------------------------------------
    @DataProvider(name = "toString")
    Object[][] data_toString() {
        return new Object[][] {
            {MinguoChronology.INSTANCE.date(1, 1, 1), "Minguo ROC 1-01-01"},
            {MinguoChronology.INSTANCE.date(1728, 10, 28), "Minguo ROC 1728-10-28"},
            {MinguoChronology.INSTANCE.date(1728, 10, 29), "Minguo ROC 1728-10-29"},
            {MinguoChronology.INSTANCE.date(1727, 12, 5), "Minguo ROC 1727-12-05"},
            {MinguoChronology.INSTANCE.date(1727, 12, 6), "Minguo ROC 1727-12-06"},
        };
    }

    @Test(dataProvider = "toString")
    public void test_toString(ChronoLocalDate minguo, String expected) {
        assertEquals(minguo.toString(), expected);
    }

    //-----------------------------------------------------------------------
    // equals()
    //-----------------------------------------------------------------------
    @Test
    public void test_equals_true() {
        assertTrue(MinguoChronology.INSTANCE.equals(MinguoChronology.INSTANCE));
    }

    @Test
    public void test_equals_false() {
        assertFalse(MinguoChronology.INSTANCE.equals(IsoChronology.INSTANCE));
    }

}


text:
require 'spec_helper'

describe Projects::BackersController do
  render_views

  subject{ response }

  before do
    @user = create(:user)
    @user_backer = create(:user, :name => 'Lorem Ipsum')
    @project = create(:project)
    @backer = create(:backer, :value=> 10.00, :user => @user_backer, :confirmed => true, :project => @project)
  end

  describe "PUT checkout" do
    context "without user" do
      it "should be redirect" do
        put :checkout, { :locale => :pt, :project_id => @project.id, :id => @backer.id }
        response.should be_redirect
      end
    end

    it "when backer don't exist in current_user" do
      request.session[:user_id]=@user.id
      lambda {
        put :checkout, {:locale => :pt, :project_id => @project.id, :id => @backer.id}
      }.should raise_error(ActiveRecord::RecordNotFound)
    end

    context "with user" do
      context "credits" do
        it "when user don't have credits enough" do
          request.session[:user_id]=@user_backer.id
          @user_backer.update_attribute(:credits, 8)
          @backer.update_attributes({:value => 10, :credits => true, :confirmed => false})

          put :checkout, { :locale => :pt, :project_id => @project.id, :id => @backer.id }

          @user_backer.reload
          @backer.reload

          @user_backer.credits.to_i.should == 8
          @backer.confirmed.should be_false

          request.flash[:failure].should == I18n.t('projects.backers.checkout.no_credits')
          response.should be_redirect
        end

        it "when user have credits enough" do
          request.session[:user_id]=@user_backer.id
          @user_backer.update_attribute(:credits, 100)
          @backer.update_attributes({:value => 10, :credits => true, :confirmed => false})

          put :checkout, { :locale => :pt, :project_id => @project.id, :id => @backer.id }

          @user_backer.reload
          @backer.reload

          @user_backer.credits.to_i.should == 90
          @backer.confirmed.should be_true

          request.flash[:success].should == I18n.t('projects.backers.checkout.success')
          response.should be_redirect
        end
      end
    end
  end

  describe "POST review" do
    context "without user" do
      before do
        request.env['REQUEST_URI'] = "/test_path"
        post :review, {:locale => :pt, :project_id => @project.id}
      end
      it{ should redirect_to login_path }
      it{ session[:return_to].should == "/test_path" }
    end

    context "with user" do
      it "when correct data" do
        request.session[:user_id]=@user.id
        request.session[:thank_you_id].should be_nil
        post :review, {:locale => :pt, :project_id => @project.id, :backer => {
          :value => '20.00',
          :reward_id => '0',
          :anonymous => '0'
        }}
        request.session[:thank_you_id].should == @project.id
        response.body =~ /#{I18n.t('projects.backers.checkout.title')}/
        response.body =~ /#{@project.name}/
        response.body =~ /R\$ 20/
      end
    end
  end

  describe "GET new" do
    context "without user" do
      it "should redirect" do
        get :new, {:locale => :pt, :project_id => @project.id}
        response.should be_redirect
      end
    end

    context "with user" do
      context "when can't back project" do
        it "when project is not visible, should redirect" do
          request.session[:user_id]=@user.id
          @project.update_attribute :visible, false
          @project.reload
          get :new, {:locale => :pt, :project_id => @project.id}

          response.should be_redirect
        end

        it "when project expired, should redirect" do
          request.session[:user_id]=@user.id
          @project.update_attribute :expires_at, 1.day.ago
          @project.reload
          get :new, {:locale => :pt, :project_id => @project.id}

          response.should be_redirect
        end

        it "when project is rejected, should redirect" do
          request.session[:user_id]=@user.id
          @project.update_attribute :rejected, true
          @project.reload
          get :new, {:locale => :pt, :project_id => @project.id}

          response.should be_redirect
        end
      end

      context "when can back project" do
        it "should see infos about the project and rewards" do
          @project.update_attributes({:rejected => false, :expires_at => 10.days.from_now, :visible => true})
          @project.reload
          request.session[:user_id]=@user.id
          get :new, {:locale => :pt, :project_id => @project.id}

          response.body.should =~ /#{I18n.t('projects.backers.new.header.title')}/
          response.body.should =~ /#{I18n.t('projects.backers.new.submit')}/
          response.body.should =~ /#{I18n.t('projects.backers.new.no_reward')}/
          response.body.should =~ /#{@project.name}/
          response.should render_template("projects/backers/new")
        end
      end
    end
  end

  describe "GET index" do
    shared_examples_for  "admin / owner" do
      it "should see all info from backer" do
        request.session[:user_id]=@user.id
        get :index, {:locale => :pt, :project_id => @project.id}

        ActiveSupport::JSON.decode(response.body).to_s.should =~ /R\$ 10/
        ActiveSupport::JSON.decode(response.body).to_s.should =~ /Lorem Ipsum/
      end
    end

    shared_examples_for "normal / guest" do
      it "should see filtered info about backer" do
        request.session[:user_id]=@user.id
        get :index, {:locale => :pt, :project_id => @project.id}

        ActiveSupport::JSON.decode(response.body).to_s.should =~ /Lorem Ipsum/
      end
    end

    context "with admin user" do
      before do
        @user.update_attribute :admin, true
        @user.reload
      end

      it_should_behave_like "admin / owner"
    end

    context "with project owner user" do
      before do
        @project.update_attribute :user, @user
        @project.reload
      end

      it_should_behave_like "admin / owner"
    end

    context "with normal user" do
      it_should_behave_like "normal / guest"
    end

    context "guest user" do
      before do
        @user.id = nil
      end

      it_should_behave_like "normal / guest"
    end
  end
end