text:
#include "xsmath.h"
#include <math.h>
#include <float.h>

/*! \namespace XsMath
	\brief Namespace for mathematical constants and operations.
*/
/*! \addtogroup cinterface C Interface
	@{
*/

//! \brief pi
#define XSMATH_PI 3.1415926535897932384626433832795

//! \brief The value e
const XsReal XsMath_e = 2.7182818284590452353602874713527;
//! \brief The value pi
const XsReal XsMath_pi = XSMATH_PI;
//! \brief A really small value
const XsReal XsMath_tinyValue = 1.0e-16;
//! \brief A convincingly large number
const XsReal XsMath_hugeValue = 1.0e+16;

//! \brief A value related to the precisson of floating point arithmetic (2.2204460492503131e-016)
const XsReal XsMath_epsilon = 2.2204460492503131e-016;
//! \brief Square root of XsMath_epsilon
const XsReal XsMath_sqrtEpsilon = 1.4901161193847656e-008;

#ifdef XSENS_SINGLE_PRECISION
	//! \brief Value that represents the subnormal number in floating point wizardry
	const XsReal XsMath_denormalized = 1e-37;
	//! \brief Square root of XsMath_denormalized
	const XsReal XsMath_sqrtDenormalized = 3.1622776601683793319988935444327e-19;
#else
	//! \brief Value that represents the subnormal number in floating point wizardry
	const XsReal XsMath_denormalized = 1e-307;
	//! \brief Square root of XsMath_denormalized
	const XsReal XsMath_sqrtDenormalized = 3.1622776601683793319988935444327e-154;
#endif

//! \brief Value to convert radians to degrees by multiplication
const XsReal XsMath_rad2degValue = 57.295779513082320876798154814105;	// (180.0/pi)
//! \brief Value to convert degrees to radians by multiplication
const XsReal XsMath_deg2radValue = 0.017453292519943295769236907684886;	// (pi/180.0)

//! \brief 0
const XsReal XsMath_zero = 0.0;
//! \brief 0.25
const XsReal XsMath_pt25 = 0.25;
//! \brief 0.5
const XsReal XsMath_pt5 = 0.5;
//! \brief -0.5
const XsReal XsMath_minusPt5 = -0.5;
//! \brief 1.0
const XsReal XsMath_one = 1.0;
//! \brief -1.0
const XsReal XsMath_minusOne = -1.0;
//! \brief 2
const XsReal XsMath_two = 2.0;
//! \brief 4
const XsReal XsMath_four = 4.0;
//! \brief -2
const XsReal XsMath_minusTwo = -2.0;

//! \brief -pi/2
const XsReal XsMath_minusHalfPi = -1.570796326794897;
//! \brief pi/2
const XsReal XsMath_halfPi = +1.570796326794897;
//! \brief 2*pi
const XsReal XsMath_twoPi = 2 * XSMATH_PI;
//! \brief sqrt(2)
const XsReal XsMath_sqrt2 = 1.4142135623730950488016887242097;

#ifdef XSENS_SINGLE_PRECISION
//! \brief infinity value
const XsReal XsMath_infinity = FLT_MAX;
#else
//! \brief infinity value
const XsReal XsMath_infinity = DBL_MAX;
#endif

/*! \brief Returns asin(\a x) for -1 < x < 1
*/
XsReal XsMath_asinClamped(XsReal x)
{
	if (x <= XsMath_minusOne)
		return XsMath_minusHalfPi;

	if (x >= XsMath_one)
		return XsMath_halfPi;

	return asin(x);
}

/*!	\brief Convert radians to degrees
*/
XsReal XsMath_rad2deg(XsReal radians)
{
	return XsMath_rad2degValue * radians;
}

/*!	\brief Convert degrees to radians
*/
XsReal XsMath_deg2rad(XsReal degrees)
{
	return XsMath_deg2radValue * degrees;
}

/*!	\brief Returns \a a to the power of 2
*/
XsReal XsMath_pow2(XsReal a)
{
	return a*a;
}

/*!	\brief Returns \a a to the power of 3
*/
XsReal XsMath_pow3(XsReal a)
{
	return a*a*a;
}

/*! \brief Returns non-zero if \a x is finite
*/
int XsMath_isFinite(XsReal x)
{
#ifdef _MSC_VER
	switch (_fpclass(x))
	{
	case _FPCLASS_SNAN:
	case _FPCLASS_QNAN:
	case _FPCLASS_NINF:
	case _FPCLASS_PINF:
		return 0;

	case _FPCLASS_NN:
	case _FPCLASS_ND:
	case _FPCLASS_NZ:
	case _FPCLASS_PZ:
	case _FPCLASS_PD:
	case _FPCLASS_PN:
		return 1;
	}
	return _finite(x);
#elif __GNUC__
	return isfinite(x);
#else
	return 1;
#endif
}

/*! \brief Returns \a d integer converted from a double precision floating point value
*/
int32_t XsMath_doubleToLong(double d)
{
	if (d >= 0)
		return (int32_t) floor(d+0.5);
	else
		return (int32_t) ceil(d-0.5);
}

/*! \brief Returns \a d integer converted from a double precision floating point value
*/
int64_t XsMath_doubleToInt64(double d)
{
	if (d >= 0)
		return (int64_t) floor(d+0.5);
	else
		return (int64_t) ceil(d-0.5);
}

/*! @} */


text:
package demo.java.v2c08javabean.PersistentFrameTest;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.io.*;
import javax.swing.*;

/**
 * This program demonstrates the use of an XML encoder and decoder to save and restore a frame.
 * @version 1.01 2007-10-03
 * @author Cay Horstmann
 */
public class PersistentFrameTest
{
   public static void main(String[] args)
   {
      chooser = new JFileChooser();
      chooser.setCurrentDirectory(new File("."));
      PersistentFrameTest test = new PersistentFrameTest();
      test.init();
   }

   public void init()
   {
      frame = new JFrame();
      frame.setLayout(new FlowLayout());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setTitle("PersistentFrameTest");
      frame.setSize(400, 200);

      JButton loadButton = new JButton("Load");
      frame.add(loadButton);
      loadButton.addActionListener(EventHandler.create(ActionListener.class, this, "load"));

      JButton saveButton = new JButton("Save");
      frame.add(saveButton);
      saveButton.addActionListener(EventHandler.create(ActionListener.class, this, "save"));

      frame.setVisible(true);
   }

   public void load()
   {
      // show file chooser dialog
      int r = chooser.showOpenDialog(null);

      // if file selected, open
      if(r == JFileChooser.APPROVE_OPTION)
      {
         try
         {
            File file = chooser.getSelectedFile();
            XMLDecoder decoder = new XMLDecoder(new FileInputStream(file));
            decoder.readObject();
            decoder.close();
         }
         catch (IOException e)
         {
            JOptionPane.showMessageDialog(null, e);
         }
      }
   }

   public void save()
   {
      if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION)
      {
         try
         {
            File file = chooser.getSelectedFile();
            XMLEncoder encoder = new XMLEncoder(new FileOutputStream(file));
            encoder.writeObject(frame);
            encoder.close();
         }
         catch (IOException e)
         {
            JOptionPane.showMessageDialog(null, e);
         }
      }
   }

   private static JFileChooser chooser;
   private JFrame frame;
}

redpajama_set_name: RedPajamaGithub


text:
// ReSharper disable CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
{
    using System;
    using CQRSlite.Events;
    using Evelyn.Core;
    using Microsoft.Extensions.DependencyInjection.Extensions;

    public static class InMemoryEventStore
    {
#pragma warning disable SA1614 // Element parameter documentation must have text
        /// <summary>
        /// We will use an in-memory event store.
        /// WARNING! Any events stored in here will be lost when the executing process exits, so you
        /// probably don't want to use this in production.
        /// </summary>
        /// <param name="parentOptions"></param>
        /// <param name="action">An Action<InMemoryEventStoreOptions> to configure the provided InMemoryEventStoreOptions</param>
        public static void InMemory(this EventStoreOptions parentOptions, Action<InMemoryEventStoreOptions> action)
#pragma warning restore SA1614 // Element parameter documentation must have text
        {
            parentOptions.Services.TryAddSingleton<Evelyn.Core.InMemoryEventStore>();
            parentOptions.Services.TryAddSingleton<IEventStore>(sp => sp.GetRequiredService<Evelyn.Core.InMemoryEventStore>());
            parentOptions.Services.TryAddSingleton<IInMemoryEventStore>(sp => sp.GetRequiredService<Evelyn.Core.InMemoryEventStore>());

            parentOptions.Services.AddHostedService<Evelyn.Core.ReadModel.EventStream.Subscribers.InMemoryEventStoreCatchUpSubscriber>(); // TODO: move this

            action.Invoke(new InMemoryEventStoreOptions(parentOptions.Services));
        }
    }
}


text:
<?php

namespace Blueprint\Router;

/**
 * Router class.
 *
 * Routes URLs to the correct controller class.
 *
 * @package blueprint
 * @author Christopher <chris@jooldesign.co.uk>
 */
class Router {

    /**
     * app
     *
     * (default value: null)
     *
     * @var mixed
     * @access protected
     */
    protected $app = null;

    /**
     * url
     *
     * (default value: '')
     *
     * @var string
     * @access protected
     */
    protected $url = '';

    /**
     * route_maps
     *
     * (default value: array())
     *
     * @var array
     * @access protected
     */
    protected $route_maps = array();

    /**
     * controller
     *
     * @var mixed
     * @access protected
     */
    protected $controller_name = 'Index';

    /**
     * action
     *
     * @var mixed
     * @access protected
     */
    protected $action_name = 'index';

    /**
     * contoller
     *
     * @var mixed
     * @access protected
     */
    protected $contoller;

    /**
     * params
     *
     * (default value: array())
     *
     * @var array
     * @access protected
     */
    protected $params = array();

    /**
     * __construct function.
     *
     * Loads dependencies, determines URL to use to match routes
     * routes the URL.
     *
     * @access public
     * @param mixed $app
     * @return void
     */
    public function __construct($app) {

        $this->app = $app;

        $cfg = $this->app->get('config');
        $request = $this->app->get('request');

        if (strpos($request->server('REQUEST_URI'), $cfg->base) === 0)
            $this->url = substr($request->server('REQUEST_URI'), strlen($cfg->base));

        $this->url = preg_replace('/\?.*$/', '', $this->url);

    }

    /**
     * registerRouteMap function.
     *
     * Registers a set of options to define what URL pattern matches
     * a route to a contoller/action pair
     *
     * @access public
     * @param mixed $namespace
     * @param array $routes (default: array())
     * @return void
     */
    public function registerRouteMap($namespace, $routes=array()) {

        $this->route_maps[] = array(
            'namespace'     => $namespace,
            'routes'        => $routes
        );

    }

    /**
     * explodeUrl function.
     *
     * Splits the URL by directory serparator.
     *
     * @access protected
     * @return void
     */
    protected function explodeUrl() {

        $this->parts = !empty($this->url) ? explode('/', $this->url) : array();

        return $this;

    }

    /**
     * parseUrl function.
     *
     * Determines the contoller, action and paramaters from the URL parts.
     *
     * @access protected
     * @return void
     */
    protected function parseUrl() {

        $controller_name = $this->controller_name;
        $action_name = $this->action_name;

        $this->params = array();

        $p = $this->parts;
        if (!empty($p[0]) && $p[0][0] != '?')
            $controller_name = $p[0];

        if (!empty($p[1]) && $p[1][0] != '?')
            $action_name = $p[1];

        if (!empty($p[2]))
            $this->params = array_slice($p, 2);

        return array(
            $controller_name,
            $action_name
        );

    }

    /**
     * determineToControllerName function.
     *
     * Determines the class name from URL part.
     *
     * @access protected
     * @param mixed $controller_name
     * @return void
     */
    protected function determineToControllerName($controller_name) {

        return str_replace(
            " ",
            "",
            ucwords(str_replace("-", " ", $controller_name))
        );

    }

    /**
     * determineActionName function.
     *
     * Determines the action name from the URL part.
     *
     * @access protected
     * @param mixed $action_name
     * @return void
     */
    protected function determineActionName($action_name) {

        $action_name = str_replace(
            " ",
            "",
            ucwords(str_replace("-", " ", $action_name))
        );

        return preg_replace_callback(
            '/^([A-Z])/',
            function($matches) { return strtolower($matches[1]); },
            $action_name
        );

    }

    /**
     * routeByDefault function.
     *
     * The default method for routing a URL to a controller. The URL is split by
     * directory separator to determine the controller name, action name and
     * paramaters
     *
     * @access protected
     * @param mixed $map
     * @return void
     */
    protected function routeByDefault($map) {

        $_route = $this->explodeUrl()->parseUrl();

        $controller_name = $this->determineToControllerName($_route[0]);
        $controller_name = $map['namespace'] . '\\Controller\\' . $controller_name;

        if (!class_exists($controller_name))
            return false;

        $action_name = $this->determineActionName($_route[1]);
        $action_name = $action_name . 'Action';

        if (method_exists($controller_name, $action_name)) {

            $this->controller_name = $controller_name;
            $this->action_name = $action_name;

            return true;

        }

        return false;

    }

    /**
     * routeByRegex function.
     *
     * The alternative method to route a URL to a controller. The URL is matched
     * against regular expressions in order to determine the controller name, action
     * name and paramaters
     *
     * @access protected
     * @param mixed $map
     * @return void
     */
    protected function routeByRegex($map) {

        if (!empty($map['routes'])) {

            $routes = include $map['routes'];

            $_route = array();
            foreach ($routes as $k => $route) {

                if (preg_match('/'.$route[0].'/', $this->url, $matches)) {

                    $_route = $routes[$k];
                    array_shift($matches);
                    $this->params = $matches;
                    break;

                }

            }

            if (empty($_route))
                return false;

            $controller_name = $map['namespace'] . '\\Controller\\' . $_route[1];

            if (!class_exists($controller_name))
                return false;

            $action_name = $_route[2] . 'Action';

            if (method_exists($controller_name, $action_name)) {

                $this->controller_name = $controller_name;
                $this->action_name = $action_name;

                return true;

            }

        }

        return false;

    }

    /**
     * route function.
     *
     * Tests the registered route maps until one matches. Then instantiates the
     * controller, sets container and calls the action (with parameters).
     *
     * @access public
     * @return void
     */
    public function route() {

        if (!empty($this->route_maps)) {

            foreach ($this->route_maps as $map) {

                if ($this->routeByRegex($map))
                   break;

                if ($this->routeByDefault($map))
                    break;

            }

            if (method_exists($this->controller_name, $this->action_name)) {

                $this->controller = new $this->controller_name;
                $this->controller->setContainer($this->app);

                call_user_func_array(array($this->controller, $this->action_name), $this->params);

            } else {

                header('HTTP/1.0 404 Not Found');
                header('Status: 404 Not Found');
                echo '
404 Not Found
';

            }

        } else {

            throw new \Exception('No route maps have been registered');

        }

    }

}


text:
package org.eop.spring.restful.controller;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eop.spring.restful.result.RestResult;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lixinjie
 * @since 2017-09-13
 */
@RequestMapping(path = "/result", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@RestController
public class RestResultController {

	@GetMapping("/map")
	public RestResult<Map<String, Object>> mapResult() {
		Map<String, Object> map = new HashMap<>();
		map.put("name", "李新杰");
		map.put("age", 32);
		map.put("married", true);
		map.put("phones", Arrays.asList("136", "138"));

		Map<String, Object> scores = new HashMap<>();
		scores.put("chinese", 135);
		scores.put("math", 140);
		map.put("scores", scores);

		Map<String, Object> map1 = new HashMap<>();
		map1.put("2016", "1000");
		map1.put("2017", "1000");

		Map<String, Object> map2 = new HashMap<>();
		map2.put("2016", "1000");
		map2.put("2017", "1000");

		Map<String, Object> map3 = new HashMap<>();
		map3.put("2016", "1000");
		map3.put("2017", "1000");

		map.put("years", Arrays.asList(map1, map2, map3));

		return new RestResult<Map<String, Object>>(0, "success", map);
	}

	@GetMapping("/list")
	public RestResult<List<Map<String, Object>>> listResult() {
		List<Map<String, Object>> list = new ArrayList<>();
		Map<String, Object> map1 = new HashMap<>();
		map1.put("2016", "1000");
		map1.put("2017", "1000");
		list.add(map1);
		Map<String, Object> map2 = new HashMap<>();
		map2.put("2016", "1000");
		map2.put("2017", "1000");
		list.add(map2);
		Map<String, Object> map3 = new HashMap<>();
		map3.put("2016", "1000");
		map3.put("2017", "1000");
		list.add(map3);
		return new RestResult<List<Map<String, Object>>>(0, "success", list);
	}

	@PostMapping("/map")
	public RestResult<Map<String, Object>> mapParam(@RequestBody RestResult<Map<String, Object>> restResult) {
		return restResult;
	}

	@PostMapping("/list")
	public RestResult<List<Map<String, Object>>> listParam(@RequestBody RestResult<List<Map<String, Object>>> restResult) {
		return restResult;
	}
}


text:
import { AppMock } from "./app/app.mock";
import { NavigationStaticMock } from "./navigation/navigation.mock";
import { PageMock } from "./page/page.mock";
import { ProcessManagerMock } from "./processflow/processmanager/processmanager.mock";
import { UtilityMock } from "./utility/utility.mock";

export class XrmStaticMock implements Xrm.XrmStatic {
    public Device: Xrm.Device;
    public Encoding: Xrm.Encoding;
    public Mobile: Xrm.Mobile;
    public Navigation: NavigationStaticMock;
    public Page: PageMock;
    public Panel: Xrm.Panel;
    public Utility: UtilityMock;
    public WebApi: Xrm.WebApi;
    public App: AppMock;

    constructor(components: IXrmStaticComponents) {
        this.Device = components.device;
        this.Encoding = components.encoding;
        this.Mobile = components.mobile;
        this.Navigation = components.navigation;
        this.Page = components.page;
        this.Panel = components.panel;
        this.Utility = components.utility;
        this.WebApi = components.webApi;
        this.App = components.app;
    }
}

export interface IXrmStaticComponents {
    device?: Xrm.Device;
    encoding?: Xrm.Encoding;
    mobile?: Xrm.Mobile;
    navigation?: NavigationStaticMock;
    page?: PageMock;
    panel?: Xrm.Panel;
    utility?: UtilityMock;
    webApi?: Xrm.WebApi;
    app?: AppMock;
}


text:
{-# LANGUAGE OverloadedStrings #-}

module BLAKE2
       ( tests -- :: Int -> Tests
       ) where
import           Data.ByteString        (ByteString)
import qualified Data.ByteString        as S
import           Data.ByteString.Base16

import           Crypto.Hash.BLAKE2

import           Test.QuickCheck
import           Util

--------------------------------------------------------------------------------
-- Hashing

pure2s, length2s, pure2sp, length2sp, pure2b, length2b, pure2bp, length2bp
  :: ByteString -> Bool

pure2s   xs = blake2s xs == blake2s xs
length2s xs = S.length (blake2s xs) == 32

pure2sp   xs = blake2sp xs == blake2sp xs
length2sp xs = S.length (blake2sp xs) == 32

pure2b   xs = blake2b xs == blake2b xs
length2b xs = S.length (blake2b xs) == 64

pure2bp   xs = blake2bp xs == blake2bp xs
length2bp xs = S.length (blake2bp xs) == 64

vector2s, vector2sp, vector2b, vector2bp :: Bool

vector2s = blake2s plainText == expectation
  where
    plainText =
      "Yesterday I was clever, so I wanted to change the world. Today I am wise\
      \, so I am changing myself."
    expectation = (fst . decode)
      "f08b22a29eed644276bf25bc32de74d7fc4cb5d557666efae9b262ef566ac572"

vector2sp = blake2sp plainText == expectation
  where
    plainText =
      "Anarchism is the radical notion that other people are not your property."
    expectation = (fst . decode)
      "2d9942113a41aaa26befcc9906607869c06285a5112cf4803b1befa49c1cbdd9"

vector2b = blake2b plainText == expectation
  where
    plainText =
      "When buying and selling are controlled by legislation, the first things \
      \to be bought and sold are legislators."
    expectation = (fst . decode)
      "e75d0b0e5dfe97c7724bc052376d6bfba7ae77c0b06a988a0ab35934c86ee3bc\
      \eebb6dafc2dbb7a002b5284c2ebd71cc369176682aa2517ad1b5dfdaa0e4b62c"

vector2bp = blake2bp plainText == expectation
  where
    plainText =
      "There is nothing noble in being superior to your fellow man; true \
      \nobility is being superior to your former self."
    expectation = (fst . decode)
      "d072a4d03ef16c4fe067580f7c495f9e2432e110de1858bda44991558c7fff0e\
      \320efe983136ad3c157cfe83533509559f684684dac5aeb1456a7148ccc73753"

tests :: Int -> Tests
tests ntests =
  [ ("blake2s  purity", wrapArg pure2s)
  , ("blake2s  length", wrapArg length2s)
  , ("blake2s  vector", wrap    vector2s)
  , ("blake2sp purity", wrapArg pure2sp)
  , ("blake2sp length", wrapArg length2sp)
  , ("blake2sp vector", wrap    vector2sp)
  , ("blake2b  purity", wrapArg pure2b)
  , ("blake2b  length", wrapArg length2b)
  , ("blake2b  vector", wrap    vector2b)
  , ("blake2bp purity", wrapArg pure2bp)
  , ("blake2bp length", wrapArg length2bp)
  , ("blake2bp vector", wrap    vector2bp)
  ]
  where
    wrap, wrapArg :: Testable prop => prop -> IO (Bool, Int)
    wrap = mkTest
    wrapArg = mkArgTest ntests


text:
using System;
using System.Linq;
using SharpDX;

namespace factor10.VisionThing.CameraStuff
{
    public class MoveCamera : MoveCameraBase
    {
        private readonly Func<Vector3> _toLookAt;

        private readonly Vector3[] _path;

        public MoveCamera(Camera camera, MovementTime time, Vector3 toPosition, Func<Vector3> toLookAt)
            : base(camera)
        {
            _path = new[] {Camera.Position, toPosition};

            EndTime = !time.UnitsPerSecond
                ? time.Time
                : (0.1f + pathLength())/time.Time;

            _toLookAt = toLookAt;
        }

        private float pathLength()
        {
            var length = 0f;
            var v = _path.First();
            for (var i = 1; i < _path.Length; i++)
                length += Vector3.Distance(v, v = _path[i]);
            return length;
        }

        private Vector3 getPointOnPath(float x)
        {
            if (x < 0)
                return _path.First();
            if (x >= 1)
                return _path.Last();
            var step = 1f/(_path.Length - 1);
            var idx = (int) (x/step);
            var frac = (x - idx*step)/step;
            return Vector3.Lerp(_path[idx], _path[idx + 1], frac);
        }

        protected override bool MoveAround()
        {
            var timeFactor = Math.Min(1, ElapsedTime/EndTime);

            var posFactor = MathUtil.SmootherStep(timeFactor);
            var lookFactor = Math.Min(1, timeFactor*1.2f);  // zoom in on "look at" faster

            Camera.Update(
                getPointOnPath(posFactor),
                Vector3.Lerp(FromLookAt, _toLookAt(), lookFactor));

            return ElapsedTime < EndTime;
        }

    }

}


text:
require "blue_green_migrations/version"

module BlueGreenMigrations
  # Your code goes here...
end


text:
import { ImmutabilityHelper } from '../../src/index';

describe('ImmutabilityHelper', () => {
  describe('updateObjectPropertyInArray', () => {
    it('should update object property in the array', () => {
      const array = [
        { name: 'Bob', seeds: 'barely' },
        { name: 'Jimmy', seeds: 'wheat' },
        { name: 'Dude', seeds: 'corn' },
      ];
      const action = { index: 1, payload: { name: 'Jim' } };
      const newArray = ImmutabilityHelper.updateObjectPropertyInArray(array, action);
      expect(array).not.toBe(newArray);
      expect(array).not.toEqual(newArray);
      expect(newArray[1].name).toEqual('Jim');
      expect(newArray[1].seeds).toEqual('wheat');
    });
    it('should update object property in the array', () => {
      const array = [
        { name: 'Bob', seeds: 'barley' },
        { name: 'Jimmy', seeds: 'wheat' },
        { name: 'Dude', seeds: 'corn' },
      ];
      const action = { index: 1, payload: { name: 'Jimmy' } };
      const newArray = ImmutabilityHelper.updateObjectPropertyInArray(array, action);
      expect(array).not.toBe(newArray);
      expect(array).toEqual(newArray);
    });
  });
  describe('updateObjectPropertyInArrayById', () => {
    it('should update object property in the array through Id', () => {
      const array = [
        { name: 'Bob', seeds: 'barley', id: 1 },
        { name: 'Jimmy', seeds: 'wheat', id: 2 },
        { name: 'Dude', seeds: 'corn', id: 3 },
      ];
      const action = { id: 1, payload: { name: 'Robert' } };
      const newArray = ImmutabilityHelper.updateObjectPropertyInArrayById(array, action);
      expect(array).not.toBe(newArray);
      expect(array).not.toEqual(newArray);
      expect(newArray[0].name).toEqual('Robert');
      expect(newArray[0].seeds).toEqual('barley');
      expect(newArray[0].id).toEqual(1);
    });
  });
  describe('diffTwoObjects', () => {
    it('should return an object that displays the difference of object1 and object 2', () => {
      const obj1 = { name: 'Joe', seeds: 'corn' };
      const obj2 = { name: 'Bob', seeds: 'corn' };
      const diff = ImmutabilityHelper.diffTwoObjects(obj1, obj2);
      expect(diff.name).toEqual('Bob');
    });
    it('should return an object that displays the difference of object1 and object 2', () => {
      const obj1 = { name: 'Joe', seeds: 'corn' };
      const obj2 = { name: 'Joe', seeds: 'corn' };
      const diff = ImmutabilityHelper.diffTwoObjects(obj1, obj2);
      expect(diff).toEqual({});
    });
  });
  describe('insertItemIntoArray', () => {
    it('Should return an array that displays all items including new item', () => {
      const array = ['Bob', 'Dan'];
      const item = 'Dave';
      const newArray = ImmutabilityHelper.insertItemIntoArray(array, item);
      expect(newArray[2]).toEqual('Dave');
    });
  });
  describe('removeItemFromArrayByIndex', () => {
    it('Should return an array that displays all items not including removed', () => {
      const array = ['Bob', 'Dan', 'Barb', 'Dillion'];
      const idx = 1;
      const newArray = ImmutabilityHelper.removeItemFromArrayByIndex(array, idx);
      expect(newArray.length).toEqual(3);
      expect(newArray[1]).toEqual('Barb');
      expect(newArray[newArray.length - 1]).toEqual('Dillion');
      expect(newArray[0]).toEqual('Bob');
    });
    it('Should return a copy the array passed if invalid index', () => {
      const array = ['Bob', 'Dan', 'Barb', 'Dillion'];
      const idx = -1;
      const newArray = ImmutabilityHelper.removeItemFromArrayByIndex(array, idx);
      expect(array).not.toBe(newArray);
      expect(array).toEqual(newArray);
    });
  });
});


text:
.. _io_export_api:

*********
Exporters
*********

Exporters are still under development.

.. _io_csv_export_api:

Export to CSV
-------------

.. currentmodule:: polyglotdb.io.exporters

.. autosummary::
   :toctree: generated/
   :template: function.rst

   csv.export_corpus_csv
   csv.export_feature_matrix_csv


text:
package com.fanlehai.java.io;

import java.io.*;

public class BasicFileOutput {
	static String file = "BasicFileOutput.out";

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new StringReader(BufferedInputFile.read("src/main/java/com/fanlehai/java/io/BasicFileOutput.java")));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file)));
		int lineCount = 1;
		String s;
		while ((s = in.readLine()) != null)
			out.println(lineCount++ + ": " + s);
		out.close();
		// Show the stored file:
		System.out.println(BufferedInputFile.read(file));
	}
}


text:
set -x
DRIVER_DIR="/var/lib/irods/iRODS/server/bin/cmd"
DRIVER="univMSSInterface_generic.sh"
LOCAL_TEST_DIR="/tmp"
REMOTE_TEST_DIR="/pnfs/grid.sara.nl/data/irods/robert_test_dir"

# create test file
echo "this is a very small testfile" > $LOCAL_TEST_DIR/test.txt

# copy file to dCache via gridftp
${DRIVER_DIR}/${DRIVER} syncToArch $LOCAL_TEST_DIR/test.txt ${REMOTE_TEST_DIR}/test.txt
echo $?

# give status of file:
${DRIVER_DIR}/${DRIVER} stat ${REMOTE_TEST_DIR}/test.txt
echo $?

# retrieve file from dCache and check if it is the same
${DRIVER_DIR}/${DRIVER} stageToCache ${REMOTE_TEST_DIR}/test.txt $LOCAL_TEST_DIR/test1.txt
echo $?
diff $LOCAL_TEST_DIR/test.txt $LOCAL_TEST_DIR/test1.txt
echo $?

# create directory and remove it again
${DRIVER_DIR}/${DRIVER} mkdir ${REMOTE_TEST_DIR}/subdir1/subdir2
echo $?
${DRIVER_DIR}/${DRIVER} stat ${REMOTE_TEST_DIR}/subdir1/subdir2
echo $?
${DRIVER_DIR}/${DRIVER} rm ${REMOTE_TEST_DIR}/subdir1/subdir2
echo $?
${DRIVER_DIR}/${DRIVER} stat ${REMOTE_TEST_DIR}/subdir1/subdir2
echo $?
${DRIVER_DIR}/${DRIVER} rm ${REMOTE_TEST_DIR}/subdir1
echo $?
${DRIVER_DIR}/${DRIVER} stat ${REMOTE_TEST_DIR}/subdir1
echo $?

# move file in dCache
${DRIVER_DIR}/${DRIVER} mv ${REMOTE_TEST_DIR}/test.txt ${REMOTE_TEST_DIR}/test1.txt
echo $?

# remove file
${DRIVER_DIR}/${DRIVER} rm ${REMOTE_TEST_DIR}/test1.txt
echo $?

# remove file again. This should fail.
${DRIVER_DIR}/${DRIVER} rm ${REMOTE_TEST_DIR}/test1.txt
echo $?


text:
wget --quiet \
  --method POST \
  --header 'cookie: foo=bar; bar=baz' \
  --header 'accept: application/json' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --body-data foo=bar \
  --output-document \
  - 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'


text:
//
//  QBCOPermissionsResult.h
//  Quickblox
//
//  Created by Igor Khomenko on 7/5/13.
//  Copyright (c) 2013 QuickBlox. All rights reserved.
//

/** QBCOPermissionsResult class declaration. */
/** Overview */
/** This class is an instance, which will be returned to user after he made the request for get permissions for custom object. */

@interface QBCOPermissionsResult : Result

/** An instance of QBCOPermissions.*/
@property (nonatomic,readonly) QBCOPermissions *permissions;

@end


text:
**Quick links:** [browse](http://code.google.com/p/v8/source/browse) | [browse bleeding edge](http://code.google.com/p/v8/source/browse/branches/bleeding_edge) | [changes](https://chromium.googlesource.com/v8/v8.git).

## Command-Line Access

### Git
See [UsingGit](using_git.md).

### Subversion (deprecated)

Use this command to anonymously check out the up-to-date stable version of the project source code:

> `svn checkout http://v8.googlecode.com/svn/trunk/ v8`

If you plan to contribute to V8 but are not a member, use this command to anonymously check out a read-only version of the development branch:

> `svn checkout http://v8.googlecode.com/svn/branches/bleeding_edge/ v8`

If you're a member of the project, use this command to check out a writable development branch as yourself using HTTPS:

> `svn checkout https://v8.googlecode.com/svn/branches/bleeding_edge/ v8 --username <your username>`

When prompted, enter your generated [googlecode.com](http://code.google.com/hosting/settings) password.

## Source Code Branches

There are several different branches of V8; if you're unsure of which version to get, you most likely want the up-to-date stable version in `trunk/`. Here's an overview of the different branches:

  * The bleeding edge, `branches/bleeding_edge/`, is where active development takes place. If you're considering contributing to V8 this is the branch to get.
  * Under `trunk/` is the "stable edge", which is updated a few times per week. It is a copy of the bleeding edge that has been successfully tested. Use this if you want to be almost up to date and don't want your code to break whenever we accidentally forget to add a file on the bleeding edge. Some of the trunk revisions are tagged with X.Y.Z.T version labels. When we decide which of X.Y.**.** is the "most stable", it becomes the X.Y branch in subversion.
  * If you want a well-tested version that doesn't change except for bugfixes, use one of the versioned branches (e.g. `branches/3.16/` at the time of this writing). Note that usually only the last two branches are actively maintained; any older branches could have unfixed security holes. You may want to follow the V8 version that Chrome is shipping on its stable (or beta) channels, see http://omahaproxy.appspot.com.

## V8 public API compatibility

V8 public API (basically the files under include/ directory) may change over time. New types/methods may be added without breaking existing functionality. When we decide that want to drop some existing class/methods, we first mark it with [V8\_DEPRECATED](https://code.google.com/p/chromium/codesearch#search/&q=V8_DEPRECATED&sq=package:chromium&type=cs) macro which will cause compile time warnings when the deprecated methods are called by the embedder. We keep deprecated method for one branch and then remove it. E.g. if `v8::CpuProfiler::FindCpuProfile` was plain non deprecated in _3.17_ branch, marked as `V8_DEPRECATED` in _3.18_, it may well be removed in _3.19_ branch.

## GUI and IDE Access

This project's Subversion repository may be accessed using many different client programs and plug-ins. See your client's documentation for more information.


text:
This is your Network Tab.  If you get lost, you can click this link to bring yourself back here.

This is a bit like the Newsfeed at Facebook or the Stream at Diaspora.  It's where all the posts from your contacts, groups, and feeds will appear.  If you're new, you won't see anything in this page, unless you posted your status in the last step.  If you've already added a few friends, you'll be able to see their posts.  Here, you can comment, like, or dislike posts, or click on somebody's name to visit their profile page where you can write on their wall.

Now we need to fill it up, the first step, is to  make some new friends.


text:
describe('NgTagsHelper Service', function () {
    'use strict';

    var NgTagsHelper;

    beforeEach(module('ngTagsInput'));

    beforeEach(inject(function (_NgTagsHelper_) {
        NgTagsHelper = _NgTagsHelper_;
    }));

    it('should be defined', function () {
        expect(NgTagsHelper).toBeDefined();
    });

    describe('isArray method', function () {
        it('should be defined', function () {
            expect(NgTagsHelper.isArray).toBeDefined();
        });

        it('should state wether or not the input is an Array', function () {
            expect(NgTagsHelper.isArray(3)).toBeFalsy();
            expect(NgTagsHelper.isArray({3: 4})).toBeFalsy();
            expect(NgTagsHelper.isArray('test')).toBeFalsy();
            expect(NgTagsHelper.isArray(null)).toBeFalsy();
            expect(NgTagsHelper.isArray(undefined)).toBeFalsy();

            expect(NgTagsHelper.isArray([])).toBeTruthy();
            expect(NgTagsHelper.isArray([3, 4])).toBeTruthy();
            expect(NgTagsHelper.isArray(new Array())).toBeTruthy();
        });
    });

});


text:
#ifndef VICE_UICBM5X0SETTINGS_H
#define VICE_UICBM5X0SETTINGS_H

extern void ui_cbm5x0_settings_dialog(void);

#endif


text:
<?php

defined('C5_EXECUTE') or die("Access Denied.");

use Concrete\Core\Entity\Attribute\Key\Key;
use Concrete\Core\Form\Service\Form;
use Concrete\Core\Form\Service\Widget\ExpressEntrySelector;
use Concrete\Core\Support\Facade\Application;
use Concrete\Core\Entity\Express\Entity;
use Concrete\Core\Entity\Express\Entry;

/** @var array $entities */
/** @var Key[] $expressAttributes */
/** @var Entry|null $entry */
/** @var Entity|null $entity */
/** @var string $exEntityID */
/** @var int $exSpecificEntryID */
/** @var string $exEntryAttributeKeyHandle */
/** @var string $exFormID */
/** @var string $entryMode */

$app = Application::getFacadeApplication();
/** @var Form $form */
$form = $app->make(Form::class);
/** @var ExpressEntrySelector $expressEntrySelector */
$expressEntrySelector = $app->make(ExpressEntrySelector::class);

$exForms = [];

if (is_object($entity)) {
    foreach ($entity->getForms() as $form) {
        $exForms[$form->getID()] = $form->getName();
    }
}
?>

        <?php echo $form->label('entryMode', t('Entry')) ?>
        <?php echo $form->select('entryMode', [
            'E' => t('Get entry from list block on another page'),
            'S' => t('Display specific entry'),
            'A' => t('Get entry from custom attribute on this page'),
        ], $entryMode);
        ?>

        <?php echo $form->label('exEntityID', t('Entity')) ?>
        <?php echo $form->select('exEntityID', $entities, $exEntityID, [
            'data-action' => $view->action('load_entity_data')
        ]); ?>

        <?php if (is_object($entity)) { ?>
            <?php print $expressEntrySelector->selectEntry($entity, 'exSpecificEntryID', $entry); ?>
        <?php } else { ?>

                <?php echo t('You must select an entity before you can choose a specific entry from it.') ?>

        <?php } ?>

        <?php echo $form->label('akID', t('Express Entry Attribute')) ?>

        <?php if (count($expressAttributes)) { ?>

            <select name="exEntryAttributeKeyHandle" class="form-control">
                <option value="">
                    <?php echo t('** Select Attribute') ?>
                </option>

                <?php foreach ($expressAttributes as $ak) { ?>
                    <?php $settings = $ak->getAttributeKeySettings(); ?>

                    <option data-entity-id="<?php echo $settings->getEntity()->getID() ?>"
                            <?php if ($ak->getAttributeKeyHandle() == $exEntryAttributeKeyHandle) { ?>selected="selected" <?php } ?>
                            value="<?php echo h($ak->getAttributeKeyHandle()) ?>">
                        <?php echo $ak->getAttributeKeyDisplayName() ?>
                    </option>
                <?php } ?>
            </select>
        <?php } else { ?>

<?php echo t('There are no express entity page attributes defined.') ?>

        <?php } ?>

        <?php echo $form->label('exFormID', t('Display Data in Entity Form')) ?>

            <?php if (is_object($entity)) { ?>
                <?php echo $form->select('exFormID', $exForms, $exFormID); ?>
            <?php } else { ?>
                <?php echo t('You must select an entity before you can choose its display form.') ?>
            <?php } ?>


text:
This is a demo about d3js.

Click [here](https://d3js.org/) to learn more about d3js.
Olso, click [here](https://github.com/mbostock/d3) to learn d3js from github.

This demo uses ES6, and start with webpack and express.
When `git clone` the code, `cd d3_demo` and `npm install`. finially, Use `npm run dev`

In browser, enter url `http://localhsot:8080`, you will see this demo on browser.


text:
/*! © 2012 Korx Limited */
/*

license:
  - MIT-style

authors:
  - Michael Bird <michael.bird@korx.com>

*/

(function(){

    var r = 100; // current rate value
    var _r = 100; // previous rate value
    var attached = false; // if we've attached to the elements yet

    // attach to all elements in the DOM tree
    var attach = function() {
        // only attach once
        if (!attached) {
            attached = true;
            // loop through all elements in the document body
            var elements = document.body.getElementsByTagName('*');
            for (var i = 0; i < elements.length; i++) {
                // listen to the element
                listen(elements[i]);
            }
            // also listed on the document body itself
            listen(document.body);
        }
    }

    // listen for element changes and apply timelapse appropriately
    var listen = function(element) {
        // check for new node inserted
        element.addEventListener('DOMNodeInserted', function(e){
            // listen to the new node
            listen(e.target);
        }, false);
        // apply timelapse
        timelapse(element);
    }

    // apply timelapse to all elements in the document body
    var apply = function() {
        // loop through all elements in the document body
        var elements = document.body.getElementsByTagName('*');
        for (var i = 0; i < elements.length; i++) {
            // timelapse the element
            timelapse(elements[i]);
        }
    }

    // apply percentage rate to duration and delay of CSS properties
    var timelapse = function(element) {
        // make sure the rate has changes
        if (r != _r) {
            // get the computed style of the element
            var styles = window.getComputedStyle(element, null);
            // if the original values haven't been saved, save them now
            if (typeof element.timelapse != 'object') {
                element.timelapse = {
                    webkitAnimationDelay: styles.webkitAnimationDelay,
                    webkitAnimationDuration: styles.webkitAnimationDuration,
                    webkitTransitionDelay: styles.webkitTransitionDelay,
                    webkitTransitionDuration: styles.webkitTransitionDuration
                };
            }
            // check each CSS property and apply calcualtion of current rate to the original value
            if (element.timelapse.webkitAnimationDelay != '' && element.timelapse.webkitAnimationDelay != '0' && element.timelapse.webkitAnimationDelay != '0s' && element.timelapse.webkitAnimationDelay != '0ms') {
                element.style['-webkit-animation-delay'] = calc(element.timelapse.webkitAnimationDelay);
            }
            if (element.timelapse.webkitAnimationDuration != '' && element.timelapse.webkitAnimationDuration != '0' && element.timelapse.webkitAnimationDuration != '0s' && element.timelapse.webkitAnimationDuration != '0ms') {
                element.style['-webkit-animation-duration'] = calc(element.timelapse.webkitAnimationDuration);
            }
            if (element.timelapse.webkitTransitionDelay != '' && element.timelapse.webkitTransitionDelay != '0' && element.timelapse.webkitTransitionDelay != '0s' && element.timelapse.webkitTransitionDelay != '0ms') {
                element.style['-webkit-transition-delay'] = calc(element.timelapse.webkitTransitionDelay);
            }
            if (element.timelapse.webkitTransitionDuration != '' && element.timelapse.webkitTransitionDuration != '0' && element.timelapse.webkitTransitionDuration != '0s' && element.timelapse.webkitTransitionDuration != '0ms') {
                element.style['-webkit-transition-duration'] = calc(element.timelapse.webkitTransitionDuration);
            }
        }
    }

    // calcualtes the new time based on the value and current rate
    var calc = function(value) {
        // get the value as a float
        var amount = parseFloat(value);
        var unit = '';
        // check if it's in milliseconds or seconds
        if (value.length >= 2 && value.slice(-2) == 'ms') {
            amount = parseFloat(value.slice(0, -2));
            unit = 'ms';
        } else if (value.length >= 1 && value.slice(-1) == 's') {
            amount = parseFloat(value.slice(0, -1));
            unit = 's';
        }
        // if the time is more than 0 seconds then apply the rate percentage
        if (amount > 0) {
            return ((amount / 100) * r) + unit;
        } else {
            return '0';
        }
    }

    // start up once the content has loaded
    document.addEventListener('DOMContentLoaded', function(){

        // listen for the rate setting
        safari.self.addEventListener('message', function(e){
            if (e.name == 'rate') {
                // update r values
                _r = r;
                r = e.message;
                if (r != _r) {
                    // attach or apply the new rate
                    if (!attached) {
                        attach();
                    } else {
                        apply();
                    }
                }
            }
        }, false);

        // get the current rate
        safari.self.tab.dispatchMessage('rate');

    });

})();


text:
require "guh/version"

require 'json'
require 'socket'

require "guh/base"
require "guh/action"
require "guh/device"
require "guh/device_class"
require "guh/event_type"
require "guh/event"
require "guh/plugin"
require "guh/rule_type"
require "guh/rule"
require "guh/state_type"
require "guh/state"

require "guh/vendor"

require "guh/type/state_operator"
require "guh/type/value_operator"

require "guh/em/connection"
require "guh/em/notifications"

module Guh
  # Your code goes here...

  class ConnectionError < Exception; end
  class ResponseError < Exception; end
  class ArgumentError < Exception; end
  class DeviceError < Exception; end
  class ActionError < Exception; end
  class DeviceClassNotFound < Exception; end

end


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mobemu.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * Helper class for some trace-specific parameters.
 *
 * @author Radu
 */
public class PerTraceParams {

    int commonInterests; // ONSIDE
    int interestedFriendsThreshold; // ONSIDE
    double encounteredInterestsThreshold; // ONSIDE
    double socialNetworkThreshold; // Interest Space
    double interestThreshold; // Interest Space
    int contactsThreshold; // Interest Spaces
    double aggregationW1; // Interest Spaces
    double aggregationW2; // Interest Spaces
    double aggregationW3; // Interest Spaces
    double aggregationW4; // Interest Spaces
    double cacheW1; // Interest Spaces
    double cacheW2; // Interest Spaces
    double cacheW3; // Interest Spaces
    long timeWindow; // Interest Spaces

    /**
     * Instantiates a {@code PerTraceParams} object.
     *
     * @param commonInterests number of common interests
     * @param interestedFriendsThreshold threshold for the number of interested
     * friends
     * @param encounteredInterestsThreshold threshold for percentage of
     * encountered interests
     * @param socialNetworkThreshold social network threshold
     * @param interestThreshold interest threshold
     * @param contactsThreshold contact threshold
     * @param aggregationW1 aggregation weight for the node similarity component
     * @param aggregationW2 aggregation weight for the node friendship component
     * @param aggregationW3 aggregation weight for the node connectivity
     * component
     * @param aggregationW4 aggregation weight for the node contacts component
     * @param cacheW1 cache weight for the interested nodes ratio component
     * @param cacheW2 cache weight for the interests encountered ratio component
     * @param cacheW3 cache weight for the interested friends ratio component
     * @param timeWindow time window for Interest Spaces
     */
    public PerTraceParams(int commonInterests, int interestedFriendsThreshold,
            double encounteredInterestsThreshold, double socialNetworkThreshold,
            double interestThreshold, int contactsThreshold, double aggregationW1,
            double aggregationW2, double aggregationW3, double aggregationW4,
            double cacheW1, double cacheW2, double cacheW3, long timeWindow) {
        this.commonInterests = commonInterests;
        this.interestedFriendsThreshold = interestedFriendsThreshold;
        this.encounteredInterestsThreshold = encounteredInterestsThreshold;
        this.socialNetworkThreshold = socialNetworkThreshold;
        this.interestThreshold = interestThreshold;
        this.contactsThreshold = contactsThreshold;
        this.aggregationW1 = aggregationW1;
        this.aggregationW2 = aggregationW2;
        this.aggregationW3 = aggregationW3;
        this.aggregationW4 = aggregationW4;
        this.cacheW1 = cacheW1;
        this.cacheW2 = cacheW2;
        this.cacheW3 = cacheW3;
        this.timeWindow = timeWindow;
    }

    /**
     * Gets the per-trace parameters for a given trace.
     *
     * @param trace name of the trace
     * @return parameters for the specified trace
     */
    public static PerTraceParams getPerTraceParams(String trace) {
        Map<String, PerTraceParams> perTraceParams = new HashMap<>();
        perTraceParams.put("Sigcomm", new PerTraceParams(1, 1, 1.0, 0.95, 0.98, 30, 0.25, 0.25, 0.25, 0.25, 0.2, 0.4, 0.4, 3600 * 1000));
        perTraceParams.put("UPB 2012", new PerTraceParams(1, 5, 0.2, 0.5, 0.1, 50, 0.25, 0.25, 0.25, 0.25, 0.2, 0.4, 0.4, 12 * 3600 * 1000));
        perTraceParams.put("Haggle Infocom 2006", new PerTraceParams(1, 0, 0.3, 1, 0.5, 0, 0.25, 0.25, 0.25, 0.25, 0.34, 0.66, 0.0, 360 * 1000));
        perTraceParams.put("SocialBlueConn", new PerTraceParams(1, 3, 0.32, 0.7, 0.2, 30, 0.25, 0.25, 0.25, 0.25, 0.2, 0.4, 0.4, 1800 * 1000));

        return perTraceParams.get(trace);
    }
}


text:
package org.gradle.api.internal.tasks.compile;

import org.gradle.api.tasks.compile.CompileOptions;

import java.io.File;

public class DefaultJavaCompileSpec extends DefaultJvmLanguageCompileSpec implements JavaCompileSpec {
    private CompileOptions compileOptions;
    private File dependencyCacheDir;

    @Override
    public CompileOptions getCompileOptions() {
        return compileOptions;
    }

    public void setCompileOptions(CompileOptions compileOptions) {
        this.compileOptions = compileOptions;
    }

    @Override
    public File getDependencyCacheDir() {
        return dependencyCacheDir;
    }

    @Override
    public void setDependencyCacheDir(File dependencyCacheDir) {
        this.dependencyCacheDir = dependencyCacheDir;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<component-configuration
        xmlns="http://tis.co.jp/nablarch/component-configuration"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://tis.co.jp/nablarch/component-configuration /component-configuration.xsd">

    <component name="etlConfigLoader" class="nablarch.etl.config.JsonConfigLoader">
        <property name="configBasePath" value="classpath:META-INF/etl-test-config" />
    </component>

</component-configuration>


text:
import sys

import unittest2
import mock
from st2auth_oauth2_backend.oauth2 import Oauth2AuthenticationBackend

def _mock_fetch_token(**kwargs):
    access_token = {"access_token": "asdfoiw37850234lkjsdfsdf"}

    if kwargs['username'] == 'good' and kwargs['password'] == 'password':
        return access_token

class Oauth2AuthenticationBackendTestCase(unittest2.TestCase):

    @mock.patch(
        'st2auth_oauth2_backend.oauth2.OAuth2Session.fetch_token',
        side_effect=_mock_fetch_token)
    def test_authenticate(self, mock_post):
        backend = Oauth2AuthenticationBackend(
            token_url="http://fakeidentityprovider.com:8080/token",
            client_id="demo",
            client_secret="1a9ada23-d527-46eb-9230-d068ac3bc161")

        # good users and wrong password
        self.assertEqual(backend.authenticate('good', 'badpassword'), False)
        # good users and correct password
        self.assertEqual(backend.authenticate('good', 'password'), True)
        # bad users
        self.assertEqual(backend.authenticate('bad', 'badpassword'), False)

if __name__ == '__main__':
    sys.exit(unittest2.main())


text:
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using System;
using System.Reactive;
using System.Reactive.Linq;
using Perspex.Controls;
using ReactiveUI;

namespace Perspex.Diagnostics.ViewModels
{
    internal class TreeNode : ReactiveObject
    {
        private string _classes;

        public TreeNode(Control control)
        {
            Control = control;
            Type = control.GetType().Name;

            control.Classes.Changed.Select(_ => Unit.Default)
                .StartWith(Unit.Default)
                .Subscribe(_ =>
                {
                    if (control.Classes.Count > 0)
                    {
                        Classes = "(" + string.Join(" ", control.Classes) + ")";
                    }
                    else
                    {
                        Classes = string.Empty;
                    }
                });
        }

        public IReadOnlyReactiveList<TreeNode> Children
        {
            get;
            protected set;
        }

        public string Classes
        {
            get { return _classes; }
            private set { this.RaiseAndSetIfChanged(ref _classes, value); }
        }

        public string Type
        {
            get;
            private set;
        }

        public Control Control
        {
            get;
            private set;
        }
    }
}


text:
package com.gtm.cpims.model.base;

import java.io.Serializable;

/**
 * This is an object that contains data related to the BS_WF1 table. Do not
 * modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class table="BS_WF1"
 */

public abstract class BaseBsWf5 implements Serializable {

	public static String REF = "BsWf5";
	public static String PROP_ID = "Id";
	public static String PROP_FLOWNO = "FlowNo";
	public static String PROP_FLOWSTATUS = "FlowStatus";
	public static String PROP_FLOWSTATUSOFCH = "FlowStatusOfCh";
	public static String PROP_NAME = "Name";
	public static String PROP_APPLYDATE = "ApplyDate";
	public static String PROP_APPLIER = "Applier";
	public static String PROP_CREATER = "Creater";
	public static String PROP_APPLYTELE = "ApplyTele";
	public static String PROP_APPLYSUMMARY = "ApplySummary";
	public static String PROP_APPLYORGNAME = "ApplyOrgName";
	public static String PROP_CHECKDATE = "CheckDate";
	public static String PROP_CHECKER = "Checker";
	public static String PROP_CHECKORGNO = "CheckOrgNo";
	public static String PROP_CHECKORGNAME = "CheckOrgName";
	public static String PROP_CHECKSUMMARY = "CheckSummary";
	public static String PROP_AUDITAPPLYDATE = "AuditApplyDate";
	public static String PROP_AUDITAPPLYER = "AuditApplyer";
	public static String PROP_AUDITAPPLYRESULT = "AuditApplyResult";
	public static String PROP_AUDITAPPLYORGNO = "AuditApplyOrgNo";
	public static String PROP_AUDITAPPLYORGNAME = "AuditApplyOrgName";
	public static String PROP_AUDITAPPLYSUMMARY = "AuditApplySummary";
	public static String PROP_STATUS = "Status";
	public static String PROP_FLAG = "Flag";
	public static String PROP_UPDATEDATE = "UpdateDate";
	public static String PROP_CREATEDATE = "CreateDate";
	public static String PROP_HASATTCH = "HasAttch";
	public static String PROP_AUAPPRETOTAL= "AuAppReTotal";

	// constructors
	public BaseBsWf5() {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseBsWf5(java.lang.String id) {
		this.setId(id);
		initialize();
	}

	protected void initialize() {
	}

	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.String id;

	// fields
	private java.lang.String flowNo;
	private java.lang.String flowStatus;
	private java.lang.String creater;
	private java.lang.String flowStatusOfCh;
	private java.lang.String name;
	private java.util.Date applyDate;
	private java.lang.String applier;
	private java.lang.String applyTele;
	private java.lang.String applySummary;
	private java.lang.String applyOrgName;
	private java.util.Date checkDate;
	private java.lang.String checker;
	private java.lang.String checkOrgNo;
	private java.lang.String checkOrgName;
	private java.lang.String checkSummary;
	private java.util.Date auditApplyDate;
	private java.lang.String auditApplyer;
	private java.lang.String auditApplyResult;
	private java.lang.String auditApplyOrgNo;
	private java.lang.String auditApplyOrgName;
	private java.lang.String auditApplySummary;
	private java.lang.String status;
	private java.lang.String flag;
	private java.util.Date createDate;
	private java.util.Date updateDate;
	private java.lang.String hasAttch;
	private java.lang.String auAppReTotal;

	/**
	 * Return the unique identifier of this class
	 *
	 * @hibernate.id generator-class="org.hibernate.id.UUIDHexGenerator"
	 *               column="ID"
	 */
	public java.lang.String getId() {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 *
	 * @param id
	 *            the new ID
	 */
	public void setId(java.lang.String id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public java.lang.String getFlowNo() {
		return flowNo;
	}

	public void setFlowNo(java.lang.String flowNo) {
		this.flowNo = flowNo;
	}

	public java.lang.String getCreater() {
		return creater;
	}

	public void setCreater(java.lang.String creater) {
		this.creater = creater;
	}

	public java.lang.String getFlowStatus() {
		return flowStatus;
	}

	public void setFlowStatus(java.lang.String flowStatus) {
		this.flowStatus = flowStatus;
	}

	public java.lang.String getFlowStatusOfCh() {
		return flowStatusOfCh;
	}

	public void setFlowStatusOfCh(java.lang.String flowStatusOfCh) {
		this.flowStatusOfCh = flowStatusOfCh;
	}

	public java.lang.String getName() {
		return name;
	}

	public void setName(java.lang.String name) {
		this.name = name;
	}

	public java.util.Date getApplyDate() {
		return applyDate;
	}

	public void setApplyDate(java.util.Date applyDate) {
		this.applyDate = applyDate;
	}

	public java.lang.String getApplier() {
		return applier;
	}

	public void setApplier(java.lang.String applier) {
		this.applier = applier;
	}

	public java.lang.String getApplyTele() {
		return applyTele;
	}

	public void setApplyTele(java.lang.String applyTele) {
		this.applyTele = applyTele;
	}

	public java.lang.String getApplySummary() {
		return applySummary;
	}

	public void setApplySummary(java.lang.String applySummary) {
		this.applySummary = applySummary;
	}

	public java.lang.String getApplyOrgName() {
		return applyOrgName;
	}

	public void setApplyOrgName(java.lang.String applyOrgName) {
		this.applyOrgName = applyOrgName;
	}

	public java.util.Date getAuditApplyDate() {
		return auditApplyDate;
	}

	public void setAuditApplyDate(java.util.Date auditApplyDate) {
		this.auditApplyDate = auditApplyDate;
	}

	public java.lang.String getAuditApplyer() {
		return auditApplyer;
	}

	public void setAuditApplyer(java.lang.String auditApplyer) {
		this.auditApplyer = auditApplyer;
	}

	public java.lang.String getAuditApplyResult() {
		return auditApplyResult;
	}

	public void setAuditApplyResult(java.lang.String auditApplyResult) {
		this.auditApplyResult = auditApplyResult;
	}

	public java.lang.String getAuditApplyOrgNo() {
		return auditApplyOrgNo;
	}

	public void setAuditApplyOrgNo(java.lang.String auditApplyOrgNo) {
		this.auditApplyOrgNo = auditApplyOrgNo;
	}

	public java.lang.String getAuditApplyOrgName() {
		return auditApplyOrgName;
	}

	public void setAuditApplyOrgName(java.lang.String auditApplyOrgName) {
		this.auditApplyOrgName = auditApplyOrgName;
	}

	public java.lang.String getAuditApplySummary() {
		return auditApplySummary;
	}

	public void setAuditApplySummary(java.lang.String auditApplySummary) {
		this.auditApplySummary = auditApplySummary;
	}

	public java.lang.String getStatus() {
		return status;
	}

	public void setStatus(java.lang.String status) {
		this.status = status;
	}

	public java.lang.String getFlag() {
		return flag;
	}

	public void setFlag(java.lang.String flag) {
		this.flag = flag;
	}

	public java.util.Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(java.util.Date createDate) {
		this.createDate = createDate;
	}

	public java.util.Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(java.util.Date updateDate) {
		this.updateDate = updateDate;
	}

	public java.lang.String getHasAttch() {
		return hasAttch;
	}

	public void setHasAttch(java.lang.String hasAttch) {
		this.hasAttch = hasAttch;
	}

	public java.util.Date getCheckDate() {
		return checkDate;
	}

	public void setCheckDate(java.util.Date checkDate) {
		this.checkDate = checkDate;
	}

	public java.lang.String getChecker() {
		return checker;
	}

	public void setChecker(java.lang.String checker) {
		this.checker = checker;
	}

	public java.lang.String getCheckOrgNo() {
		return checkOrgNo;
	}

	public void setCheckOrgNo(java.lang.String checkOrgNo) {
		this.checkOrgNo = checkOrgNo;
	}

	public java.lang.String getCheckOrgName() {
		return checkOrgName;
	}

	public void setCheckOrgName(java.lang.String checkOrgName) {
		this.checkOrgName = checkOrgName;
	}

	public java.lang.String getCheckSummary() {
		return checkSummary;
	}

	public void setCheckSummary(java.lang.String checkSummary) {
		this.checkSummary = checkSummary;
	}

	public java.lang.String getAuAppReTotal() {
		return auAppReTotal;
	}

	public void setAuAppReTotal(java.lang.String auAppReTotal) {
		this.auAppReTotal = auAppReTotal;
	}

	@Override
	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof com.gtm.cpims.model.BsWf2))
			return false;
		else {
			com.gtm.cpims.model.BsWf2 bsWf2 = (com.gtm.cpims.model.BsWf2) obj;
			if (null == this.getId() || null == bsWf2.getId())
				return false;
			else
				return (this.getId().equals(bsWf2.getId()));
		}
	}

	@Override
	public int hashCode() {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId())
				return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":"
						+ this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}

	@Override
	public String toString() {
		return super.toString();
	}

}


text:
package org.tolweb.tapestry.injections;

import org.apache.tapestry.annotations.InjectObject;
import org.tolweb.dao.EditHistoryDAO;
import org.tolweb.misc.CacheAccess;
import org.tolweb.misc.Configuration;
import org.tolweb.misc.RendererFactory;
import org.tolweb.misc.TextPreparer;
import org.tolweb.misc.URLBuilder;

public interface BaseInjectable {
    @InjectObject("spring:cacheAccess")
    public CacheAccess getCacheAccess();
    @InjectObject("spring:urlBuilder")
    public URLBuilder getUrlBuilder();
    @InjectObject("spring:textPreparer")
    public TextPreparer getTextPreparer();
    @InjectObject("spring:configuration")
    public Configuration getConfiguration();
    @InjectObject("spring:editHistoryDAO")
    public EditHistoryDAO getEditHistoryDAO();
    @InjectObject("spring:miscEditHistoryDAO")
    public EditHistoryDAO getMiscEditHistoryDAO();
    @InjectObject("spring:rendererFactory")
    public RendererFactory getRendererFactory();
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.Formatting
{
    internal interface IFormattingService : ILanguageService
    {
        /// <summary>
        /// Formats the whitespace in areas of a document corresponding to multiple non-overlapping spans.
        /// </summary>
        /// <param name="document">The document to format.</param>
        /// <param name="spans">The spans of the document's text to format. If null, the entire document should be formatted.</param>
        /// <param name="options">An optional set of formatting options. If these options are not supplied the current set of options from the document's workspace will be used.</param>
        /// <param name="cancellationToken">An optional cancellation token.</param>
        /// <returns>The formatted document.</returns>
        Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, OptionSet? options, CancellationToken cancellationToken);
    }
}


text:
package com.upplication.cordova.config;

import com.upplication.cordova.*;
import com.upplication.cordova.internal.AndroidProject;
import com.upplication.cordova.internal.XCodeProject;
import com.upplication.cordova.junit.Condition;
import com.upplication.cordova.junit.CordovaCLIRule;
import com.upplication.cordova.junit.OnlyMacOSX;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

import static java.lang.Thread.sleep;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;

public class IconIT {
    @Rule
    public CordovaCLIRule cordovaCLIRule = new CordovaCLIRule();
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    private CordovaProject cordova;

    @Before
    public void setUp() throws IOException {
        cordova = cordovaCLIRule.get().create(folder.newFolder("cordova-path"));
    }

    @Test
    public void set_icon_android() throws IOException {

        for (IconAndroid icon : IconAndroid.values()) {
            String srcIcon = "res/icon/android/" + icon.getName();
            Files.copy(Paths.get("src/test/resources/" + srcIcon),
                    cordova.getProject().toPath().resolve(srcIcon), StandardCopyOption.REPLACE_EXISTING);
            cordova.config().icon().add(Icon.create().src(srcIcon).density(icon.getDensity()));
        }

        // check config.xml is modified
        List<Icon> iconsConfig = cordova.config().icon().getAll();
        for (int i = 0; i < IconAndroid.values().length; i++) {
            IconAndroid iconAndroid = IconAndroid.values()[i];
            Icon iconConfig = iconsConfig.get(i);

            assertEquals("res/icon/android/" + iconAndroid.getName(), iconConfig.getSrc());
            assertEquals(iconAndroid.getDensity(), iconConfig.getDensity());
        }

        cordova.platform().add(Platform.Android);

        // check icons is copied in the correct location
        for (IconAndroid icon : IconAndroid.values()) {

            Path originalIcon = cordova.getProject().toPath()
                    .resolve("res/icon/android")
                    .resolve(icon.getName());
            Path pathIconCopied = new AndroidProject(cordova).getIcon(icon.getDensity());
            assertEquals("the icon: " + icon + " is not processed correctly",
                    new String(Files.readAllBytes(originalIcon)),
                    new String(Files.readAllBytes(pathIconCopied)));
        }
    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void set_icon_iphone() throws IOException {

        // see: https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/
        // see: https://developer.apple.com/library/content/qa/qa1686/_index.html

        for (IconIos icon : IconIos.values()) {
            String srcIcon = "res/icon/ios/" + icon.getValue();
            Files.copy(Paths.get("src/test/resources/" + srcIcon),
                    cordova.getProject().toPath().resolve(srcIcon), StandardCopyOption.REPLACE_EXISTING);
            cordova.config().icon().add(Icon.create().src(srcIcon).width(icon.getWidth()).height(icon.getHeight()));
        }

        // check config.xml is modified
        List<Icon> iconsConfig = cordova.config().icon().getAll();
        for (int i = 0; i < IconIos.values().length; i++) {
            IconIos iconIos = IconIos.values()[i];
            Icon iconConfig = iconsConfig.get(i);

            assertEquals("res/icon/ios/" + iconIos.getValue(), iconConfig.getSrc());
            assertEquals(iconIos.getWidth(), iconConfig.getWidth().intValue());
            assertEquals(iconIos.getHeight(), iconConfig.getHeight().intValue());
        }

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        // check icons is copied in the correct location
        for (IconIos icon : IconIos.values()) {

            Path originalIcon = cordova.getProject().toPath()
                    .resolve("res/icon/ios")
                    .resolve(icon.getValue());
            Path pathIconCopied = xCodeProject.getIcon(icon.getValue());
            assertEquals("the icon: " + icon + " is not processed correctly", new String(Files.readAllBytes(originalIcon)), new String(Files.readAllBytes(pathIconCopied)));
        }

        // check no other copied
        // but cordova create four icons more based in our images:
        // icon-20@2x.png, AppIcon29x29@2x.png, AppIcon29x29@3x.png, AppIcon40x40@2x.png

        Path iosIconPlatformDefaultCordova = xCodeProject.getIconsFolder();
        File[] iconsPlatformIos = iosIconPlatformDefaultCordova.toFile().listFiles();
        List<String> iconsPlatformIosName = getFileNames(iconsPlatformIos);
        assertEquals(IconIos.values().length + 4, iconsPlatformIosName.size());

        List<String> iconsGenerated = IconIos.getNames();
        iconsGenerated.add("icon-20@2x.png");
        iconsGenerated.add("AppIcon29x29@2x.png");
        iconsGenerated.add("AppIcon29x29@3x.png");
        iconsGenerated.add("AppIcon40x40@2x.png");
        assertTrue(iconsPlatformIosName.containsAll(iconsGenerated));

        // TODO: check file with the content for ios (generated by xcode)
        Path contentJson = xCodeProject.getIconsFolder().resolve("Contents.json");

    }

    // set all ok but the res wrong

    @Test
    @Condition(OnlyMacOSX.class)
    public void set_icon_wrong_resolution_in_configXml() throws IOException {
        String srcIcon = "res/icon/ios/" + IconIos.Icon40.getValue();
        Files.copy(Paths.get("src/test/resources/" + srcIcon),
                cordova.getProject().toPath().resolve(srcIcon), StandardCopyOption.REPLACE_EXISTING);
        // wrong width and height (must be 40)
        cordova.config().icon().add(Icon.create().src(srcIcon).width(35).height(35));

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        Path originalIcon = cordova.getProject().toPath()
                .resolve("res/icon/ios")
                .resolve(IconIos.Icon40.getValue());
        Path pathIconcopied = xCodeProject.getIcon(IconIos.Icon40.getValue());
        // is not the same image!
        assertNotEquals("the icon: " + IconIos.Icon40 + " is not processed correctly",
                new String(Files.readAllBytes(originalIcon)),
                new String(Files.readAllBytes(pathIconcopied)));
    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void set_icon_wrong_name_but_good_res_in_configXml() throws IOException {
        String srcIcon = "res/icon/ios/icon-asdadasd.png";
        Files.copy(Paths.get("src/test/resources/res/icon/ios/" + IconIos.Icon40.getValue()),
                cordova.getProject().toPath().resolve(srcIcon));
        // wrong width and height (must be 40)
        cordova.config().icon().add(Icon.create().src(srcIcon).width(IconIos.Icon40.getWidth()).height(IconIos.Icon40.getHeight()));

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        Path originalIcon = cordova.getProject().toPath().resolve(srcIcon);
        // changed with the correct name!
        Path pathIconCopied = xCodeProject.getIcon(IconIos.Icon40.getValue());

        assertEquals("the icon: " + IconIos.Icon40 + " is not processed correctly",
                new String(Files.readAllBytes(originalIcon)),
                new String(Files.readAllBytes(pathIconCopied)));
    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void set_icon_iphone_two_icons_with_same_resolution_the_first_take_preference() throws IOException {

        // we add first an invented name with the res: 40x40
        String srcIcon40invented = "res/icon/ios/icon-asdasdsad.png";
        Path originalIconInvented = Files.copy(Paths.get("src/test/resources/res/icon/ios/icon-40-different.png"),
                cordova.getProject().toPath().resolve(srcIcon40invented));
        cordova.config().icon().add(Icon.create().src(srcIcon40invented).width(40).height(40));

        // then we add another with res: 40x40 and the correct name
        String srcIcon40 = "res/icon/ios/" + IconIos.Icon40.getValue();
        Path originalIcon = Files.copy(Paths.get("src/test/resources/" + srcIcon40),
                cordova.getProject().toPath().resolve(srcIcon40));
        cordova.config().icon().add(Icon.create().src(srcIcon40).width(IconIos.Icon40.getWidth()).height(IconIos.Icon40.getHeight()));

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        // check image
        // the content of the first (name invented) is used
        Path pathIconCopied = xCodeProject.getIcon(IconIos.Icon40.getValue());
        assertEquals("the icon: " + IconIos.Icon40 + " is not processed correctly",
                new String(Files.readAllBytes(originalIconInvented)),
                new String(Files.readAllBytes(pathIconCopied)));

        // the second image is ignored and not used
        Path iosIconPlatformDefaultCordova = xCodeProject.getIconsFolder();
        File[] iconsPlatformIos = iosIconPlatformDefaultCordova.toFile().listFiles();
        for (File icon : iconsPlatformIos) {
            assertNotEquals(new String(Files.readAllBytes(originalIcon)), new String(Files.readAllBytes(icon.toPath())));
        }
    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void set_icon_iphone_custom_location() throws IOException {

        // this is a predefined icon for apple and cordova icon-72.png
        // we are going to save the file in the root project folder
        String srcIcon72 = IconIos.Icon72.getValue();
        // copy the file in the root project folder
        Path pathIcon72 = Files.copy(Paths.get("src/test/resources/res/icon/ios/" + IconIos.Icon72.getValue()),
                cordova.getProject().toPath().resolve(srcIcon72));
        cordova.config().icon().add(Icon.create().src(srcIcon72).width(72).height(72));

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        // check images is in the correct folder once the platform is added
        // the image exists and is the image we add.
        Path pathIcon72copied = xCodeProject.getIcon(IconIos.Icon72.getValue());
        assertTrue(Files.exists(pathIcon72copied));
        assertEquals(new String(Files.readAllBytes(pathIcon72)), new String(Files.readAllBytes(pathIcon72copied)));
    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void cordova_ios_by_default_add_some_icons() throws IOException {

        // this is a predefined icon for cordova.
        // but is not processed and is only example, some names doesnt match the real names...

        Path iosIconDefaultCordova = cordova.getProject().toPath().resolve("res/icon/ios/");
        File[] icons = iosIconDefaultCordova.toFile().listFiles();

        // same number of files and same names
        List<String> iconsName = getFileNames(icons);
        assertEquals(4, iconsName.size());
        assertTrue(iconsName.containsAll(Arrays.asList("icon-57-2x.png", "icon-57.png", "icon-72-2x.png", "icon-72.png")));

        // but is not the same than the one added when add ios platform
        // see: IconIosName too know the real files you must change

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        Path iosIconPlatformDefaultCordova = xCodeProject.getIconsFolder();
        File[] iconsPlatformIos = iosIconPlatformDefaultCordova.toFile().listFiles();
        List<String> iconsPlatformIosName = getFileNames(iconsPlatformIos);

        assertEquals(IconIos.values().length, iconsPlatformIosName.size());
        assertTrue(iconsPlatformIosName.containsAll(IconIos.getNames()));

    }

    @Test
    @Condition(OnlyMacOSX.class)
    public void change_cordova_default_icons_without_changing_configXml_doesnt_work() throws IOException {

        String srcIcon72 = "res/icon/ios/icon-72.png";
        Path pathIcon72 = Files.copy(Paths.get("src/test/resources/" + srcIcon72),
                cordova.getProject().toPath().resolve(srcIcon72), StandardCopyOption.REPLACE_EXISTING);

        cordova.platform().add(Platform.IOs);

        XCodeProject xCodeProject = new XCodeProject(cordova);

        Path pathIcon72Copied = xCodeProject.getIcon("icon-72.png");
        assertNotEquals(new String(Files.readAllBytes(pathIcon72)), new String(Files.readAllBytes(pathIcon72Copied)));
    }

    private List<String> getFileNames(File[] icons) {
        List<String> result = new ArrayList<>();
        for (File file : icons) {
            if (!file.getName().equals("Contents.json")) {
                result.add(file.getName());
            }
        }
        return result;
    }
}


text:
@interface RMEIdeasPullDownControl ()
@property (nonatomic, weak)id<RMEIdeasPullDownControlDataSource> dataSource;
@property (nonatomic, weak)id<RMEIdeasPullDownControlProtocol> delegate;
@property (nonatomic, weak)UIScrollView* clientScrollView;
@property (nonatomic) NSInteger numberOfButtons;
@property (nonatomic, strong) NSMutableArray *unselectedImagesArray;
@property (nonatomic, strong) NSMutableArray *selectedImagesArray;
@property (nonatomic, strong) NSMutableArray *selectedControlTextArray;
@property (nonatomic, strong) UILabel *selectedTextLabel;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic) BOOL selectionProcessingInProgress;
@property (nonatomic) NSInteger previousSelectedControlIndex;
@property (nonatomic) NSInteger currentSelectedControlIndex;
@property (nonatomic) CGFloat cutOffDelta;
@property (nonatomic, strong) NSMutableArray *allControls;

@end

@implementation RMEIdeasPullDownControl

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (id)initWithDataSource:(id<RMEIdeasPullDownControlDataSource>)dataSource
                delegate:(id<RMEIdeasPullDownControlProtocol>)delegate
        clientScrollView:(UIScrollView*)clientScrollView
{
    self = [super initWithFrame:CGRectMake(0.0, 0.0, clientScrollView.frame.size.width, 70.0)];
    if (self) {
        // Custom initialization
        self.delegate = delegate;
        self.dataSource = dataSource;
        self.clientScrollView = clientScrollView;

        [self setSelfUp];
    }
    return self;
}

#pragma mark - Setup

- (void) setSelfUp
{
    self.clipsToBounds = YES;
    [self.clientScrollView addObserver:self forKeyPath:@"contentOffset" options:0 context:NULL];

    self.backgroundColor = [UIColor clearColor];
    self.selectionProcessingInProgress = NO;
    self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0.0, -70.0, self.frame.size.width, 70.0)];
    self.containerView.backgroundColor = [UIColor colorWithRed:220.0/255.0 green:220.0/255.0 blue:220.0/255.0 alpha:1.0];

    self.unselectedImagesArray = [[NSMutableArray alloc] initWithCapacity:1];
    self.selectedImagesArray = [[NSMutableArray alloc] initWithCapacity:1];
    self.selectedControlTextArray = [[NSMutableArray alloc] initWithCapacity:1];

    self.numberOfButtons = [self.dataSource numberOfButtonsRequired:self];
    NSAssert(self.numberOfButtons>1, @"Number of controls must be at least 2");

    self.cutOffDelta = kOperationalRange/self.numberOfButtons;
    CGFloat requiredControlWidth = self.frame.size.width/self.numberOfButtons;
    CGFloat currentImageXcoordinate = 0.0;

    self.allControls =[[NSMutableArray alloc] initWithCapacity:1];
    for (int i = 0; i < self.numberOfButtons; i++)
    {
        UIImage *thisUnselectedImage = [self.dataSource rmeIdeasPullDownControl:self imageForControlAtIndex:i];
        UIImage *thisSelectedImage = [self.dataSource rmeIdeasPullDownControl:self selectedImageForControlAtIndex:i];
        NSString *thisSelectedControlText = [self.dataSource rmeIdeasPullDownControl:self titleForControlAtIndex:i];

        [self.unselectedImagesArray addObject:thisUnselectedImage];
        [self.selectedImagesArray addObject:thisSelectedImage];
        [self.selectedControlTextArray addObject:thisSelectedControlText];

        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(currentImageXcoordinate, 0.0, requiredControlWidth, 44.0)];
        imageView.tag = kControlStartIndexTag + i;
        [imageView setImage:thisSelectedImage];
        [self.containerView addSubview:imageView];

        [self.allControls addObject:imageView];

        currentImageXcoordinate = currentImageXcoordinate + requiredControlWidth;
    }
    self.selectedTextLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 50.0, 280.0, 15.0)];
    self.selectedTextLabel.textColor = [UIColor colorWithRed:155.0/255.0 green:155.0/255.0 blue:155.0/255.0 alpha:1.0];
    self.selectedTextLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0];
    self.selectedTextLabel.backgroundColor = [UIColor clearColor];
    self.selectedTextLabel.textAlignment = NSTextAlignmentCenter;
    [self.containerView addSubview:self.selectedTextLabel];

    UIImageView *separatingLine = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 44.0, self.frame.size.width, 2.0)];
    [separatingLine setImage:[UIImage imageNamed:@"pullDownSeparatingLine.png"]];
    [self.containerView addSubview:separatingLine];

    [self addSubview:self.containerView];
}

- (void) deselectAllControls
{

}

#pragma mark - KVO methods

- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if (object == self.clientScrollView)
    {
        if ([keyPath isEqualToString:@"contentOffset"])
        {
            [self psuedoScrollViewDidScroll];
        }
    }
}

- (void) dealloc
{
    [self.clientScrollView removeObserver:self forKeyPath:@"contentOffset"];
}

#pragma mark - CopyScrollView delegate methods
- (void) psuedoScrollViewDidScroll
{
    CGFloat yOffset = self.clientScrollView.contentOffset.y;
    if ((self.clientScrollView.dragging == NO) && (yOffset < 0))
    {
        self.selectionProcessingInProgress = YES;
    }
    else if (yOffset > -1.0)
    {
        self.selectionProcessingInProgress = NO;
        [self notifyDelegateOfSelection];

    }
    if ((yOffset < -kFuzzyThreshold) && (self.selectionProcessingInProgress == NO))
    {
        [self decodeButtonSelectionForOffset:(-1*self.clientScrollView.contentOffset.y)];
    }

    if (yOffset < 0)
    {
        if (yOffset > kShowInfoDownThreshold)
        {
            self.containerView.frame = CGRectMake(0.0, (kShowInfoDownThreshold - yOffset), 320.0, 70.0);

        }
        if (yOffset < kShowSelectionDownThershold)
        {
            self.selectedTextLabel.textColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:1.0];
             [self updateCurrentSelectionText];

        }
        else
        {
            self.selectedTextLabel.textColor = [UIColor colorWithRed:155.0/255.0 green:155.0/255.0 blue:155.0/255.0 alpha:1.0];
            self.selectedTextLabel.text = @"Keep dragging to change; Release to select";
        }
    }
}

- (void) notifyDelegateOfSelection
{
    if (self.previousSelectedControlIndex != self.currentSelectedControlIndex)
    {
        //Notify the delegate
        [self.delegate rmeIdeasPullDownControl:self selectedControlAtIndex:self.currentSelectedControlIndex];
        self.previousSelectedControlIndex = self.currentSelectedControlIndex;
    }
}

#pragma mark - Control decoding methods
- (void) decodeButtonSelectionForOffset:(CGFloat)offset
{
    NSInteger buttonChangeNumber = (NSUInteger)floorf(offset - kFuzzyThreshold)/self.cutOffDelta;
    NSInteger tempNewButtonNumber = 0;

    //Important Note: buttonChangeNumber is with reference to initial button position.
    if (buttonChangeNumber > (self.numberOfButtons - 1))
    {
        buttonChangeNumber = (self.numberOfButtons - 1);
    }
    //else
    {
        tempNewButtonNumber = self.previousSelectedControlIndex+buttonChangeNumber;
        if (tempNewButtonNumber > (self.numberOfButtons - 1))
        {
            tempNewButtonNumber = tempNewButtonNumber%self.numberOfButtons;
        }
    }
    if (self.currentSelectedControlIndex != tempNewButtonNumber)
    {
        self.currentSelectedControlIndex = tempNewButtonNumber;
        [self updateSelectedButtonAt:self.currentSelectedControlIndex];
    }
}

- (void) updateSelectedButtonAt:(NSInteger)index
{
    for (int i = 0; i < self.numberOfButtons; i++)
    {
        UIImageView *thisControl = self.allControls[i];

        if (i == index)
        {
            [thisControl setImage:self.selectedImagesArray[i]];
        }
        else
        {
            [thisControl setImage:self.unselectedImagesArray[i]];
        }
    }
}
- (void)updateCurrentSelectionText
{
    if ([self.selectedControlTextArray count] > self.currentSelectedControlIndex)
    {
        self.selectedTextLabel.text = self.selectedControlTextArray[self.currentSelectedControlIndex];
    }
}

#pragma mark - Public methods
- (void) selectControlAtIndex:(NSInteger)controlIndex
{
    self.currentSelectedControlIndex = controlIndex;
    self.previousSelectedControlIndex = 9999;//Always trigger notification to delegate
    [self updateSelectedButtonAt:self.currentSelectedControlIndex];
    [self notifyDelegateOfSelection];

}

@end


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.pkrete.xrd4j.common.member.AbstractMember (XRd4J :: Common 0.0.8 API)</title>
<meta name="date" content="2015-09-13">
<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

Next

Frames

No Frames

All Classes

Uses of Class
com.pkrete.xrd4j.common.member.AbstractMember

Packages that use AbstractMember

Package
Description

com.pkrete.xrd4j.common.member

Uses of AbstractMember in com.pkrete.xrd4j.common.member

Subclasses of AbstractMember in com.pkrete.xrd4j.common.member

Modifier and Type
Class and Description

class
ConsumerMember

This class represents X-Road consumer member that acts as a client that
 initiates service call by sending a ServiceRequest.

class
ProducerMember

This class represent X-Road producer member that produces services to
 X-Road.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014-2015. All Rights Reserved.


text:
layout: single
title: "Houston Startup Weekend"
tagline: Nov. 9 - Nov. 11
description: "What is Houston Startup Weekend"
category: Startups
blog: true
comments: true
redirect_from: /blog/2012/11/07/houston-startup-weekend/
---

This weekend I'm planning to attend [Startup Weekend Houston](http://houston.startupweekend.org).  It will be my first and I'm quite excited about it.

I don't have any idea that I'd like to pitch but I'm looking forward to hearing the ideas and working on making one of them happen!

##What I'm Bringing

* Laptop
* Notebook
* Pencil
* Business Cards

##What is StartupWeekend?

StartupWeekend brings togetherdevelopers, marketers, and other startup enthusiasts together to create a new startup in 54 hours (Friday evening through Sunday evening).


text:
// This file is automatically generated.

package adila.db;

/*
 * Motorola Moto G (1st Gen)
 *
 * DEVICE: falcon_umts
 * MODEL: XT939G
 */
final class falcon5fumts_xt939g {
    public static final String DATA = "Motorola|Moto G (1st Gen)|";
}


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

namespace AoC2019.Puzzle20
{
    public class Solution : IPuzzle
    {
        public Solution(IEnumerable<string> input)
        {
            _input = input.ToArray();
        }

        private readonly string[] _input;

        public static int Solve1(string[] input)
        {
            var m = Map.Parse(input);
            return m.ShortestPath();
        }

        public Task<string> Solve1Async() =>
            Task.Run(() => Solve1(_input).ToString());

        public Task<string> Solve2Async() =>
            throw new NotImplementedException();
    }
}


text:
package com.yiji.falcon.agent.plugins.plugin.zk;

import com.yiji.falcon.agent.util.CommandUtilForUnix;
import com.yiji.falcon.agent.util.StringUtils;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

/*
 * 修订记录:
 * guqiu@yiji.com 2016-06-22 17:48 创建
 */

/**
 * @author guqiu@yiji.com
 */
@Slf4j
public class ZKConfig {

    private static ConcurrentHashMap<String,Map<String,Object>> cache = new ConcurrentHashMap<>();

    /**
     * 根据进程id获取zookeeper的配置文件配置
     * @param pid
     * zookeeper服务的进程id
     * @return
     * @throws IOException
     */
    private static Map<String,Object> getConfig(int pid) throws IOException {
        String key = String.valueOf(pid).intern();

        //读取缓存
        Map<String,Object> result = cache.get(key);
        if(result != null){
            return result;
        }else{
            result = new HashMap<>();
        }

        String cmd = "ls -al /proc/" + pid + "/fd/" + " | grep zookeeper";
        CommandUtilForUnix.ExecuteResult executeResult = CommandUtilForUnix.execWithReadTimeLimit(cmd,false,7);

        if(executeResult.isSuccess){
            String path = "";
            String msg = executeResult.msg;
            String[] ss = msg.split("\\s");
            for (String s : ss) {
                if(s.contains("zookeeper") &&
                        s.contains("jar") &&
                        s.substring(s.lastIndexOf("zookeeper"),s.lastIndexOf("jar")+3).
                                matches("zookeeper-[\\w*.]*\\.jar")){
                    path = s;
                    break;
                }
            }
            if(!"".equals(path)){
                path = path.substring(0,path.lastIndexOf(File.separator));
                path += File.separator + "conf" + File.separator + "zoo.cfg";

                Properties pps = new Properties();
                try (FileInputStream in = new FileInputStream(path)){
                    pps.load(in);
                    Enumeration en = pps.propertyNames(); //得到配置文件的名字
                    while(en.hasMoreElements()) {
                        String strKey = (String) en.nextElement();
                        String strValue = pps.getProperty(strKey);
                        result.put(strKey,strValue);
                    }
                    cache.put(key,result);
                } catch (IOException e) {
                    log.error("zookeeper配置文件查找失败,请检查是否路径存在空格",e);
                }

            }
        }else{
            log.error("命令 {} 执行失败,错误信息:\r\n{}",cmd,executeResult.msg);
        }
        return result;
    }

    /**
     * 获取ZK的clientPort端口号
     * @param pid
     * es的进程id
     * @return
     * @throws IOException
     */
    public static String getClientPort(int pid) throws IOException {
        String port = String.valueOf(getConfig(pid).get("clientPort"));
        if(StringUtils.isEmpty(port)){
            //未配置,返回默认配置值
            return "2182";
        }
        return port;
    }

}