text:
#include <aery32/all.h>
#include "board.h"

#define LED AVR32_PIN_PC00

void isrhandler_rtc(void)
{
	gpio_toggle_pin(LED);
	rtc_clear_interrupt(); /* Remember to clear RTC interrupt */
}

using namespace aery;

int main(void)
{
	/*
	 * Put your application initialization sequence here. The default
	 * board initializer defines all pins as input and sets the CPU clock
	 * speed to 66 MHz.
	 */
	board::init();
	gpio_init_pin(LED, GPIO_OUTPUT|GPIO_HIGH);

	/* Init RTC to count from zero to 60*115000/2 */
	rtc_init(RTC_SOURCE_RC, 0, 0, 60*115000/2);

	/* Register ISR handler */
	intc_init();
	intc_register_isrhandler(&isrhandler_rtc, 1, 0);

	/* Enable interrupts globally */
	intc_enable_globally();

	/* Enable RTC as we are nor ready to handle the interrupts */
	rtc_enable(true);

	for(;;) {
		/* Put your application code here */

	}

	return 0;
}


text:
  Sounds Loader
  ]]

--Sounds loader

AddLink = Sound.load('./Contents/audio/sounds/addLinkBounce.wav',false)
Close = Sound.load('./Contents/audio/sounds/Close.wav',false)
Done = Sound.load('./Contents/audio/sounds/done.wav',false)
Login = Sound.load('./Contents/audio/sounds/login.wav',false)
ExecuteSoft = Sound.load('./Contents/audio/sounds/runsoftware.wav',false)
--TraceBeep = Sound.load('./Contents/audio/sounds/tracebleep.wav',true)

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>VO808X: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

VO808X

Main Page

Related Pages

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

vo Member List

This is the complete list of members for vo, including all inherited members.

checkfile_fun()	vo

checkRes()	vo

computeGoodMatches(std::vector< cv::DMatch > &good_matches, cv::Mat &descriptors_1, cv::Mat &descriptors_2)	vo

cur	vo

descriptors_1	vo

descriptors_2	vo

getdataobj_	vo

keypoints_1	vo

keypoints_2	vo

mdlFolder	vo

nxt	vo

R_f	vo

readLutToMat(cv::Mat &I, cv::String path, int matWidth, int matHeight)	vo

t_f	vo

vo()	vo

~vo()	vo

Generated by

     1.8.11


text:
package com.terahorse.zp.model.zp;

public class Playlist {

    private Long id;
    private String title;
    private String image;
    private String imageBig;
    private String musicClientType;
    private String description;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getMusicClientType() {
        return musicClientType;
    }

    public void setMusicClientType(String musicClientType) {
        this.musicClientType = musicClientType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImageBig() {
        return imageBig;
    }

    public void setImageBig(String imageBig) {
        this.imageBig = imageBig;
    }
}


text:
<?php

namespace Gedmo\Mapping;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Annotations\Reader;
use Gedmo\Mapping\ExtensionMetadataFactory;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\EventArgs;

/**
 * This is extension of event subscriber class and is
 * used specifically for handling the extension metadata
 * mapping for extensions.
 *
 * It dries up some reusable code which is common for
 * all extensions who mapps additional metadata through
 * extended drivers
 *
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 * @package Gedmo.Mapping
 * @subpackage MappedEventSubscriber
 * @link http://www.gediminasm.org
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
abstract class MappedEventSubscriber implements EventSubscriber
{
    /**
     * List of cached object configurations
     *
     * @var array
     */
    protected $configurations = array();

    /**
     * ExtensionMetadataFactory used to read the extension
     * metadata through the extension drivers
     *
     * @var Gedmo\Mapping\ExtensionMetadataFactory
     */
    private $extensionMetadataFactory = array();

    /**
     * List of event adapters used for this listener
     *
     * @var array
     */
    private $adapters = array();

    /**
     * Custom annotation reader
     *
     * @var object
     */
    private $annotationReader;

    /**
     * @var \Doctrine\Common\Annotations\AnnotationReader
     */
    private $defaultAnnotationReader;

    /**
     * Get an event adapter to handle event specific
     * methods
     *
     * @param EventArgs $args
     * @throws \Gedmo\Exception\InvalidArgumentException - if event is not recognized
     * @return \Gedmo\Mapping\Event\AdapterInterface
     */
    protected function getEventAdapter(EventArgs $args)
    {
        $class = get_class($args);
        if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], array('ODM', 'ORM'))) {
            if (!isset($this->adapters[$m[1]])) {
                $adapterClass = $this->getNamespace() . '\\Mapping\\Event\\Adapter\\' . $m[1];
                if (!class_exists($adapterClass)) {
                    $adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\'.$m[1];
                }
                $this->adapters[$m[1]] = new $adapterClass;
            }
            $this->adapters[$m[1]]->setEventArgs($args);
            return $this->adapters[$m[1]];
        } else {
            throw new \Gedmo\Exception\InvalidArgumentException('Event mapper does not support event arg class: '.$class);
        }
    }

    /**
     * Get the configuration for specific object class
     * if cache driver is present it scans it also
     *
     * @param ObjectManager $objectManager
     * @param string $class
     * @return array
     */
    public function getConfiguration(ObjectManager $objectManager, $class) {
        $config = array();
        if (isset($this->configurations[$class])) {
            $config = $this->configurations[$class];
        } else {
            $factory = $objectManager->getMetadataFactory();
            $cacheDriver = $factory->getCacheDriver();
            if ($cacheDriver) {
                $cacheId = ExtensionMetadataFactory::getCacheId($class, $this->getNamespace());
                if (($cached = $cacheDriver->fetch($cacheId)) !== false) {
                    $this->configurations[$class] = $cached;
                    $config = $cached;
                } else {
                    // re-generate metadata on cache miss
                    $this->loadMetadataForObjectClass($objectManager, $factory->getMetadataFor($class));
                    if (isset($this->configurations[$class])) {
                        $config = $this->configurations[$class];
                    }
                }
            }
        }
        return $config;
    }

    /**
     * Get extended metadata mapping reader
     *
     * @param ObjectManager $objectManager
     * @return Gedmo\Mapping\ExtensionMetadataFactory
     */
    public function getExtensionMetadataFactory(ObjectManager $objectManager)
    {
        $oid = spl_object_hash($objectManager);
        if (!isset($this->extensionMetadataFactory[$oid])) {
            if (is_null($this->annotationReader)) {
                // create default annotation reader for extensions
                $this->annotationReader = $this->getDefaultAnnotationReader();
            }
            $this->extensionMetadataFactory[$oid] = new ExtensionMetadataFactory(
                $objectManager,
                $this->getNamespace(),
                $this->annotationReader
            );
        }
        return $this->extensionMetadataFactory[$oid];
    }

    /**
     * Set annotation reader class
     * since older doctrine versions do not provide an interface
     * it must provide these methods:
     *     getClassAnnotations([reflectionClass])
     *     getClassAnnotation([reflectionClass], [name])
     *     getPropertyAnnotations([reflectionProperty])
     *     getPropertyAnnotation([reflectionProperty], [name])
     *
     * @param object $reader - annotation reader class
     */
    public function setAnnotationReader($reader)
    {
        $this->annotationReader = $reader;
    }

    /**
     * Scans the objects for extended annotations
     * event subscribers must subscribe to loadClassMetadata event
     *
     * @param ObjectManager $objectManager
     * @param ClassMetadata $metadata
     * @return void
     */
    public function loadMetadataForObjectClass(ObjectManager $objectManager, ClassMetadata $metadata)
    {
        $factory = $this->getExtensionMetadataFactory($objectManager);
        $config = $factory->getExtensionMetadata($metadata);
        if ($config) {
            $this->configurations[$metadata->name] = $config;
        }
    }

    /**
     * Get the namespace of extension event subscriber.
     * used for cache id of extensions also to know where
     * to find Mapping drivers and event adapters
     *
     * @return string
     */
    abstract protected function getNamespace();

    /**
     * Create default annotation reader for extensions
     *
     * @return \Doctrine\Common\Annotations\AnnotationReader
     */
    private function getDefaultAnnotationReader()
    {
        if (null === $this->defaultAnnotationReader) {
            if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0-DEV', '>=')) {
                $reader = new \Doctrine\Common\Annotations\AnnotationReader();
                \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
                    'Gedmo\\Mapping\\Annotation',
                    __DIR__ . '/../../'
                );
                $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
            } else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0RC4-DEV', '>=')) {
                $reader = new \Doctrine\Common\Annotations\AnnotationReader();
                \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
                    'Gedmo\\Mapping\\Annotation',
                    __DIR__ . '/../../'
                );
                $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
                $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
            } else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
                $reader = new \Doctrine\Common\Annotations\AnnotationReader();
                $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
                $reader->setIgnoreNotImportedAnnotations(true);
                $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo');
                $reader->setEnableParsePhpImports(false);
                $reader->setAutoloadAnnotations(true);
                /*\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
                    'Gedmo\\Mapping\\Annotation',
                    __DIR__ . '/../../'
                );*/
                $reader = new \Doctrine\Common\Annotations\CachedReader(
                    new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
                );
            } else {
                $reader = new \Doctrine\Common\Annotations\AnnotationReader();
                $reader->setAutoloadAnnotations(true);
                $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo');
                $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
            }
            $this->defaultAnnotationReader = $reader;
        }
        return $this->defaultAnnotationReader;
    }
}


text:
'use strict';

var stringify = require('json-stringify-safe');

module.exports = Record;

function Record(level, message, meta, time) {
    this.meta = (meta === null || meta === undefined) ? null : meta;
    this.data = new RecordData(level, message, time);
    this.serialized = null;
    this.hasBeenMerged = false;
}

Record.prototype.serialize = function serialize() {
    if (this.serialized !== null) {
        this.serialized = stringify(this.toJSON());
    }

    return this.serialized;
};

Record.prototype.toJSON = function toJSON() {
    var i;
    if (!this.hasBeenMerged) {
        for (i in this.meta) if (this.meta.hasOwnProperty(i)) {
            this.data[i] = this.meta[i];
        }

        this.hasBeenMerged = true;
    }

    return this.data;
};

function RecordData(level, message, time) {
    this.level = level;
    this.message = message;
    this.time = time || new Date().toISOString();
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="ExDoc v0.18.1">
    <title>Bandwidth.Resources.Calls.DTMF – bandwidth v1.2.2</title>
    <link rel="stylesheet" href="dist/app-c922dbe7ef.css" />

<button class="sidebar-toggle">

  Toggle Sidebar
</button>

        bandwidth

        v1.2.2

  <form class="sidebar-search" action="search.html">
    <button type="submit" class="search-button">

    </button>
    <input name="q" type="text" id="search-list" class="search-input" placeholder="search" aria-label="Search" autocomplete="off" />
  </form>

Pages

Modules

        bandwidth v1.2.2
        Bandwidth.Resources.Calls.DTMF

Perform DTMF-related actions for a specific call.

              Link to this section

            Summary

      Functions

    send(client, call_id, dtmf \\ %{})

Send DTMF (phone keypad digit presses)

              Link to this section

            Functions

      Link to this function

    send(client, call_id, dtmf \\ %{})

send(Client.t(), binary(), Map.t()) :: Client.response()

Send DTMF (phone keypad digit presses).

  Example:

case Bandwidth.Resources.Calls.DTMF.send(client, "some-call-id", %{ dtmfOut: "1234" }) do
  {:ok, {200, _, _}} -> IO.puts "DTMF sent"
  {:error, reason}   -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

            Built using
            ExDoc (v0.18.1),

            designed by
            Friedel Ziegelmayer.

        <button class="night-mode-toggle">Switch theme</button>


text: Robot to grab BotGuy and two cows.


text:
package eu.digitisation.output;

import eu.digitisation.distance.EdOp;
import eu.digitisation.distance.StringEditDistance;
import eu.digitisation.math.BiCounter;
import eu.digitisation.utils.xml.DocumentBuilder;
import org.w3c.dom.Element;

/**
 * Provide statistics of the differences between two texts
 *
 * @author R.C.C.
 */
public class CharStatTable extends BiCounter<Character, EdOp> {
    private static final long serialVersionUID = 1L;

    /**
     * Create empty CharStatTable
     */
    public CharStatTable() {
        super();
    }

    /**
     * Separate statistics of errors for every character
     *
     * @param s1 the reference text
     * @param s2 the fuzzy text
     */
    public CharStatTable(String s1, String s2) {
        super();
        add(StringEditDistance.operations(s1, s2));
    }

    /**
     * Separate statistics of errors for every character
     * form a collection of texts
     *
     * @param array1 an array of reference texts
     * @param array2 an array of fuzzy texts
     */
    public CharStatTable(String[] array1, String[] array2) {
        if (array1.length == array2.length) {
            for (int n = 0; n < array1.length; ++n) {
                add(StringEditDistance.operations(array1[n], array2[n]));
            }
        } else {
            throw new java.lang.IllegalArgumentException("Arrays of different length");
        }
    }

    /**
     * Add statistic for a pair of strings
     * @param s1 the reference text
     * @param s2 the fuzzy text
     */
    public void add(String s1, String s2) {
        add(StringEditDistance.operations(s1, s2));
    }

    /**
     * Separate statistics of errors for every character
     *
     * @return an element containing table with the statistics: one character
     * per row and one edit operation per column.
     */
    public Element asTable() {
        DocumentBuilder builder = new DocumentBuilder("table");
        Element table = builder.root();
        Element row = builder.addElement("tr");

        // features
        table.setAttribute("border", "1");
        // header
        builder.addTextElement(row, "td", "Character");
        builder.addTextElement(row, "td", "Hex code");
        builder.addTextElement(row, "td", "Total");
        builder.addTextElement(row, "td", "Spurious");
        builder.addTextElement(row, "td", "Confused");
        builder.addTextElement(row, "td", "Lost");
        builder.addTextElement(row, "td", "Error rate");

        // content
        for (Character c : leftKeySet()) {
            int spu = value(c, EdOp.INSERT);
            int sub = value(c, EdOp.SUBSTITUTE);
            int add = value(c, EdOp.DELETE);
            int tot = value(c, EdOp.KEEP) + sub + add;
            double rate = (spu + sub + add) / (double) tot * 100;
            row = builder.addElement("tr");
            builder.addTextElement(row, "td", c.toString());
            builder.addTextElement(row, "td", Integer.toHexString(c));
            builder.addTextElement(row, "td", "" + tot);
            builder.addTextElement(row, "td", "" + spu);
            builder.addTextElement(row, "td", "" + sub);
            builder.addTextElement(row, "td", "" + add);
            builder.addTextElement(row, "td", String.format("%.2f", rate));
        }
        return builder.document().getDocumentElement();
    }

    /**
     * Prints separate statistics of errors for every character
     *
     * @param recordSeparator text between data records
     * @param fieldSeparator text between data fields
     * @return text with the statistics: every character separated by a record
     * separator and every type of edit operation separated by field separator.
     *
     */
    public StringBuilder asCSV(String recordSeparator, String fieldSeparator) {
        StringBuilder builder = new StringBuilder();

        builder.append("Character")
                .append(fieldSeparator).append("Total")
                .append(fieldSeparator).append("Spurious")
                .append(fieldSeparator).append("Confused")
                .append(fieldSeparator).append("Lost")
                .append(fieldSeparator).append("Error rate");

        for (Character c : leftKeySet()) {
            int spu = value(c, EdOp.INSERT);
            int sub = value(c, EdOp.SUBSTITUTE);
            int add = value(c, EdOp.DELETE);
            int tot = value(c, EdOp.KEEP) + sub + add;
            double rate = (spu + sub + add) / (double) tot * 100;
            builder.append(recordSeparator);
            builder.append(c)
                    .append("[")
                    .append(Integer.toHexString(c))
                    .append("]")
                    .append(fieldSeparator).append(tot)
                    .append(fieldSeparator).append(spu)
                    .append(fieldSeparator).append(sub)
                    .append(fieldSeparator).append(add)
                    .append(fieldSeparator).append(String.format("%.2f", rate));
        }
        return builder;
    }

/**
 * Extract CER from character statistics
 * @return the global CER
 */
    public double cer() {
        int spu = 0;
        int sub = 0;
        int add = 0;
        int tot = 0;

        for (Character c : leftKeySet()) {
            spu += value(c, EdOp.INSERT);
            sub += value(c, EdOp.SUBSTITUTE);
            add += value(c, EdOp.DELETE);
            tot += value(c, EdOp.KEEP)
                    + value(c, EdOp.SUBSTITUTE)
                    + value(c, EdOp.DELETE);
        }

        return (spu + sub + add) / (double) tot;
    }
}


text:
pyfarm.master.user_interface.statistics.task_events module
==========================================================

.. automodule:: pyfarm.master.user_interface.statistics.task_events
    :members:
    :undoc-members:
    :show-inheritance:


text:
using System.Windows.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Microsoft.Xaml.Interactivity;

namespace ModernMoleculeViewer.Behaviors
{
    public class ItemClickCommand : DependencyObject, IBehavior
    {
        private ListViewBase _control;

        public DependencyObject AssociatedObject => _control;

        public static readonly DependencyProperty CommandProperty =
            DependencyProperty.Register("Command", typeof(ICommand),
            typeof(ItemClickCommand), new PropertyMetadata(null));

        public ICommand Command
        {
            get { return (ICommand)GetValue(CommandProperty); }
            set { SetValue(CommandProperty, value); }
        }

        public void Attach(DependencyObject associatedObject)
        {
            _control = associatedObject as ListViewBase;
            if (_control != null)
            {
                _control.IsItemClickEnabled = true;
                _control.ItemClick += OnItemClick;
            }
        }

        public void Detach()
        {
            if (_control != null)
            {
                _control.ItemClick -= OnItemClick;
                _control = null;
            }
        }

        private void OnItemClick(object sender, ItemClickEventArgs e)
        {
            if (Command != null && Command.CanExecute(e.ClickedItem))
                Command.Execute(e.ClickedItem);
        }
    }
}


text:
/**
 * @author Sergey Chernov
 *         See LICENSE file in the root of the project
 */
package sockjs;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sockjs.netty.StandaloneServer;
import sockjs.transports.Protocol;

public class TestStandaloneServer {

    private static final Logger log = LoggerFactory.getLogger(TestStandaloneServer.class);

    public static void main(String[] args) {
        log.info("Starting standalone server ");

        SockJs sockJs = new SockJs();
        sockJs.setMaxStreamSize(4096);
        EndpointInfo chatEndpointInfo = new EndpointInfo();
        chatEndpointInfo.setWebSocketEnabled(false);
        sockJs.setEndpointInfo("/chat", chatEndpointInfo);

        EndpointInfo disabledWebSocketEcho = new EndpointInfo();
        disabledWebSocketEcho.setWebSocketEnabled(false);
        sockJs.setEndpointInfo("/disabled_websocket_echo", disabledWebSocketEcho);

        EndpointInfo cookieNeededEcho = new EndpointInfo();
        cookieNeededEcho.setCookiesNeeded(true);
        sockJs.setEndpointInfo("/cookie_needed_echo", cookieNeededEcho);

        ConnectionListener connectionListener = new EchoListener();
        sockJs.addListener("/chat", connectionListener);
        sockJs.addListener("/echo", connectionListener);
        sockJs.addListener("/disabled_websocket_echo", connectionListener);
        sockJs.addListener("/cookie_needed_echo", connectionListener);
        sockJs.addListener("/close", new CloseListener());
        StandaloneServer server = new StandaloneServer(sockJs, 3002);
        server.start();
    }

    private static class EchoListener implements ConnectionListener {
        @Override
        public void onOpen(Connection connection) {
            log.info("new connection: " + connection.getId());
        }

        @Override
        public void onClose(Connection connection) {
            log.info("connection closed: " + connection.getId());
        }

        @Override
        public void onMessage(Connection connection, String message) {
            log.info("message from connection: " + connection.getId() + " {" + message + "}");
            connection.sendToChannel(message);
        }
    }

    private static class CloseListener implements  ConnectionListener {
        @Override
        public void onOpen(Connection connection) {
            connection.setCloseReason(Protocol.CloseReason.NORMAL);
        }

        @Override
        public void onClose(Connection connection) {

        }

        @Override
        public void onMessage(Connection connection, String message) {

        }
    }
}


text:
package org.openehealth.ipf.platform.camel.ihe.fhir.pcc44;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.support.ExpressionAdapter;
import org.hl7.fhir.r4.model.Bundle;
import org.openehealth.ipf.platform.camel.ihe.fhir.test.FhirTestContainer;

import java.io.InputStreamReader;
import java.util.stream.Collectors;

/**
 *
 */
public class Pcc44TestRouteBuilder extends RouteBuilder {

    private final boolean returnError;

    public Pcc44TestRouteBuilder(boolean returnError) {
        this.returnError = returnError;
    }

    @Override
    public void configure() {

        from("direct:input")
                .toF("qedm-pcc44:localhost:%d", FhirTestContainer.DEMO_APP_PORT);

        from("qedm-pcc44:translation?audit=true&iheOptions=OBSERVATIONS")
                .errorHandler(noErrorHandler())
                .transform(new Pcc44Responder());
    }

    private class Pcc44Responder extends ExpressionAdapter {

        @Override
        public Object evaluate(Exchange exchange) {
            if (!returnError) {
                var resource = FhirContext.forR4().newXmlParser()
                        .parseResource(Bundle.class, new InputStreamReader(getClass().getResourceAsStream("/ObservationResponse.xml")));
                // The endpoint expects a list of resources rather than a bundle
                return resource.getEntry().stream()
                        .map(Bundle.BundleEntryComponent::getResource)
                        .collect(Collectors.toList());
            } else {
                throw new InternalErrorException("Something went wrong");
            }
        }
    }

}


text:
package util

import (
	"fmt"
	"sort"

	"k8s.io/api/core/v1"
	"k8s.io/apiserver/pkg/util/feature"
	"k8s.io/kubernetes/pkg/apis/scheduling"
	"k8s.io/kubernetes/pkg/features"
)

const DefaultBindAllHostIP = "0.0.0.0"

// GetUsedPorts returns the used host ports of Pods: if 'port' was used, a 'port:true' pair
// will be in the result; but it does not resolve port conflict.
func GetUsedPorts(pods ...*v1.Pod) map[string]bool {
	ports := make(map[string]bool)
	for _, pod := range pods {
		for j := range pod.Spec.Containers {
			container := &pod.Spec.Containers[j]
			for k := range container.Ports {
				podPort := &container.Ports[k]
				// "0" is explicitly ignored in PodFitsHostPorts,
				// which is the only function that uses this value.
				if podPort.HostPort != 0 {
					// user does not explicitly set protocol, default is tcp
					portProtocol := podPort.Protocol
					if podPort.Protocol == "" {
						portProtocol = v1.ProtocolTCP
					}

					// user does not explicitly set hostIP, default is 0.0.0.0
					portHostIP := podPort.HostIP
					if podPort.HostIP == "" {
						portHostIP = "0.0.0.0"
					}

					str := fmt.Sprintf("%s/%s/%d", portProtocol, portHostIP, podPort.HostPort)
					ports[str] = true
				}
			}
		}
	}
	return ports
}

// PodPriorityEnabled indicates whether pod priority feature is enabled.
func PodPriorityEnabled() bool {
	return feature.DefaultFeatureGate.Enabled(features.PodPriority)
}

// GetPodFullName returns a name that uniquely identifies a pod.
func GetPodFullName(pod *v1.Pod) string {
	// Use underscore as the delimiter because it is not allowed in pod name
	// (DNS subdomain format).
	return pod.Name + "_" + pod.Namespace
}

// GetPodPriority return priority of the given pod.
func GetPodPriority(pod *v1.Pod) int32 {
	if pod.Spec.Priority != nil {
		return *pod.Spec.Priority
	}
	// When priority of a running pod is nil, it means it was created at a time
	// that there was no global default priority class and the priority class
	// name of the pod was empty. So, we resolve to the static default priority.
	return scheduling.DefaultPriorityWhenNoDefaultClassExists
}

// SortableList is a list that implements sort.Interface.
type SortableList struct {
	Items    []interface{}
	CompFunc LessFunc
}

// LessFunc is a function that receives two items and returns true if the first
// item should be placed before the second one when the list is sorted.
type LessFunc func(item1, item2 interface{}) bool

var _ = sort.Interface(&SortableList{})

func (l *SortableList) Len() int { return len(l.Items) }

func (l *SortableList) Less(i, j int) bool {
	return l.CompFunc(l.Items[i], l.Items[j])
}

func (l *SortableList) Swap(i, j int) {
	l.Items[i], l.Items[j] = l.Items[j], l.Items[i]
}

// Sort sorts the items in the list using the given CompFunc. Item1 is placed
// before Item2 when CompFunc(Item1, Item2) returns true.
func (l *SortableList) Sort() {
	sort.Sort(l)
}

// HigherPriorityPod return true when priority of the first pod is higher than
// the second one. It takes arguments of the type "interface{}" to be used with
// SortableList, but expects those arguments to be *v1.Pod.
func HigherPriorityPod(pod1, pod2 interface{}) bool {
	return GetPodPriority(pod1.(*v1.Pod)) > GetPodPriority(pod2.(*v1.Pod))
}


text:
namespace PrintumCommerce.Migrations.Model1
{
    using System.CodeDom.Compiler;
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.Infrastructure;
    using System.Resources;

    [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
    public sealed partial class Initial17 : IMigrationMetadata
    {
        private readonly ResourceManager Resources = new ResourceManager(typeof(Initial17));

        string IMigrationMetadata.Id
        {
            get { return "201611161459510_Initial17"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        string IMigrationMetadata.Target
        {
            get { return Resources.GetString("Target"); }
        }
    }
}


text:
import { Component, ChangeDetectorRef} from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { Events } from 'ionic-angular';
import { ModalController } from 'ionic-angular';
import {EditProfilePage} from "../edit-profile/edit-profile";
import {UserService} from "../../providers/session/UserService";
import {Profile} from "../../model/profile";
import {Movie} from "../../model/movie";

@Component({
    selector: 'page-profile',
    templateUrl: 'profile.html',
    providers: [UserService]
})
export class ProfilePage {

    uid:string;

    constructor(public navCtrl:NavController,
                public navParams:NavParams,
                public userService:UserService,
                public events:Events,
                public modalCtrl:ModalController,
                cd:ChangeDetectorRef) {
        this.uid = this.userService.currentUser().uid;
    }

    ionViewDidLoad() {
        console.log('ionViewDidLoad ProfilePage');
    }

}


text:
CREATE_TEST(ERROR_THROW, int) {
	throw 9;
}

CREATE_TEST(ERROR_THROW, std_ptr) {
	throw new std::exception("Dummy Error");
}

CREATE_TEST(ERROR_THROW, std_ref) {
	throw std::exception("Dummy Error");
}


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/fapi2/plat_i2c_access.C $                             */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2018,2020                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 * @file plat_i2c_access.C
 *
 * @brief Implements FAPI i2c functions at the platform layer.
 */

#include <stdint.h>
#include <errl/errlentry.H>
#include <devicefw/userif.H>
#include <return_code.H>
#include <target.H>
#include <target_types.H>
#include <plat_utils.H>
#include <attribute_service.H>
#include <hwpf_fapi2_reasoncodes.H>
#include <fapi2/plat_i2c_access.H>

namespace fapi2
{

//------------------------------------------------------------------------------
// HW Communication Functions to be implemented at the platform layer.
//------------------------------------------------------------------------------

/// @brief Platform-level implementation called by FAPI getI2c()
ReturnCode platGetI2c( const Target<TARGET_TYPE_ALL>& i_target,
                       const size_t i_get_size,
                       const std::vector<uint8_t>& i_cfgData,
                       std::vector<uint8_t>& o_data )
{
    ReturnCode l_rc;
    errlHndl_t l_err = nullptr;

    FAPI_DBG(ENTER_MRK "platGetI2c");
    // Note: Trace is placed here in plat code because PPE doesn't support
    //       trace in common fapi2_i2c_access.H
    bool l_traceit = platIsScanTraceEnabled();

    // Grab the name of the target
    TARGETING::ATTR_FAPI_NAME_type l_targName = {0};
    fapi2::toString(i_target, l_targName, sizeof(l_targName));

    size_t l_get_size = i_get_size;  // need non-const

    // create a temporary buffer for read data
    uint8_t * l_data_read = new uint8_t[ l_get_size ];

    do
    {
        // Extract the component pointer
        TARGETING::Target * l_target = nullptr;
        l_err = fapi2::platAttrSvc::getTargetingTarget(i_target, l_target);
        if ( l_err )
        {
            FAPI_ERR( "platGetI2c: Error from getTargetingTarget on %s",
                      l_targName );
            break; //return with error
        }

        // Perform i2c read
        uint64_t l_traceCfgData = 0;

        if ( i_cfgData.empty() )
        {
            l_err = deviceRead(
                                l_target,
                                l_data_read,
                                l_get_size,
                                DEVICE_FAPI_I2C_ADDRESS()
                              );
        }
        else
        {
            // deviceRead() requires data pointer
            // copy data from const vector to data ptr
            uint8_t * l_configDataPtr = new uint8_t[ i_cfgData.size() ];
            std::copy(i_cfgData.begin(), i_cfgData.end(), l_configDataPtr);

            // if trace is enabled,
            // save the config data into l_traceCfgData variable
            if (l_traceit)
            {
              // copy the first 8 bytes of config data into trace variable
              if (i_cfgData.size() >= sizeof(l_traceCfgData))
              {
                // only copy what fits into l_traceCfgData variable
                memcpy(&l_traceCfgData, l_configDataPtr,sizeof(l_traceCfgData));
              }
              else
              {
                // all the config data bytes fit into l_traceCfgData variable
                memcpy(&l_traceCfgData, l_configDataPtr, i_cfgData.size());
              }
            }

            l_err = deviceRead(
                              l_target,
                              l_data_read,
                              l_get_size,
                              DEVICE_FAPI_I2C_ADDRESS_WCONFIG(i_cfgData.size(),
                                                              l_configDataPtr)
                              );

            delete [] l_configDataPtr;
        }

        if (l_err)
        {
            FAPI_ERR("platGetI2c: error from FAPI_I2C deviceRead() of target %s"
              , l_targName );
        }

        if (l_traceit)
        {
            // Only trace the first 8 bytes of data read
            // (don't want to overflow trace buffer)
            uint64_t l_traceDataRead = 0;
            if (l_get_size >= sizeof(l_traceDataRead))
            {
              memcpy(&l_traceDataRead, l_data_read, sizeof(l_traceDataRead));
            }
            else if (l_get_size > 0)
            {
              memcpy(&l_traceDataRead, l_data_read, l_get_size);
            }
            if ( i_cfgData.empty() )
            {
                FAPI_SCAN("TRACE : GETI2C  :  %s : %d %.16llX",
                          l_targName,
                          l_get_size,
                          l_traceDataRead);
            }
            else
            {
                FAPI_SCAN("TRACE : GETI2C w/config %.16llX :  %s : %d %.16llX",
                          l_traceCfgData,
                          l_targName,
                          l_get_size,
                          l_traceDataRead);
            }
        }

    } while(0);

    if (l_err)
    {
        // Add the error log pointer as data to the ReturnCode
        addErrlPtrToReturnCode(l_rc, l_err);
    }
    else
    {
        // read was successful so copy data into o_data
        o_data.clear();
        o_data.insert( o_data.end(),
                       &l_data_read[0],
                       &l_data_read[l_get_size] );
    }

    // cleanup allocated memory
    delete [] l_data_read;

    FAPI_DBG(EXIT_MRK "platGetI2c");
    return l_rc;
}

/// @brief Platform-level implementation called by FAPI putI2c()
ReturnCode platPutI2c(const Target<TARGET_TYPE_ALL>& i_target,
                      const std::vector<uint8_t>& i_data)
{
    ReturnCode l_rc;
    errlHndl_t l_err = nullptr;

    FAPI_DBG(ENTER_MRK "platPutI2c");
    // Note: Trace is placed here in plat code because PPE doesn't support
    //       trace in common fapi2_i2c_access.H
    bool l_traceit = platIsScanTraceEnabled();

    // Grab the name of the target
    TARGETING::ATTR_FAPI_NAME_type l_targName = {0};
    fapi2::toString(i_target, l_targName, sizeof(l_targName));

    do {
        // Extract the component pointer
        TARGETING::Target * l_target = nullptr;
        l_err = fapi2::platAttrSvc::getTargetingTarget(i_target, l_target);
        if (l_err)
        {
            FAPI_ERR( "platPutI2c: Error from getTargetingTarget on %s",
                      l_targName );
            break; //return with error
        }

        //copy data from const vector to data ptr
        uint8_t * l_dataPtr = new uint8_t[ i_data.size() ];
        std::copy(i_data.begin(), i_data.end(), l_dataPtr);
        size_t l_dataSize = i_data.size();

        l_err = deviceWrite( l_target,
                             l_dataPtr,
                             l_dataSize,
                             DEVICE_FAPI_I2C_ADDRESS() );
        if (l_traceit)
        {
            // trace the first 8 bytes of written data
            // (avoid trace buffer overflow)
            uint64_t traceWriteData = 0;
            if (l_dataSize > sizeof(traceWriteData))
            {
                // copy what will fit into traceWriteData variable
                memcpy(&traceWriteData, l_dataPtr, sizeof(traceWriteData));
            }
            else
            {
                memcpy(&traceWriteData, l_dataPtr, l_dataSize);
            }
            FAPI_SCAN( "TRACE : PUTI2C    :  %s : %d %.16llX",
                       l_targName,
                       l_dataSize,
                       traceWriteData );
        }

        delete [] l_dataPtr;

    } while (0);

    if (l_err)
    {
        // Add the error log pointer as data to the ReturnCode
        addErrlPtrToReturnCode(l_rc, l_err);
    }

    FAPI_DBG(EXIT_MRK "platPutI2c");
    return l_rc;
}

} // End namespace


text:
/**************************************************************************//**
 * @file     nu_wdt.h
 * @version  V3.00
 * $Revision: 6 $
 * $Date: 18/06/08 11:34a $
 * @brief    M031 series Watchdog Timer(WDT) driver header file
 *
 * @note
 * SPDX-License-Identifier: Apache-2.0
 * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
 *****************************************************************************/
#ifndef __NU_WDT_H__
#define __NU_WDT_H__

#ifdef __cplusplus
extern "C"
{
#endif

/** @addtogroup Standard_Driver Standard Driver
  @{
*/

/** @addtogroup WDT_Driver WDT Driver
  @{
*/

/** @addtogroup WDT_EXPORTED_CONSTANTS WDT Exported Constants
  @{
*/
/*---------------------------------------------------------------------------------------------------------*/
/*  WDT Time-out Interval Period Constant Definitions                                                      */
/*---------------------------------------------------------------------------------------------------------*/
#define WDT_TIMEOUT_2POW4           (0UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^4 * WDT clocks   \hideinitializer */
#define WDT_TIMEOUT_2POW6           (1UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^6 * WDT clocks   \hideinitializer */
#define WDT_TIMEOUT_2POW8           (2UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^8 * WDT clocks   \hideinitializer */
#define WDT_TIMEOUT_2POW10          (3UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^10 * WDT clocks  \hideinitializer */
#define WDT_TIMEOUT_2POW12          (4UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^12 * WDT clocks  \hideinitializer */
#define WDT_TIMEOUT_2POW14          (5UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^14 * WDT clocks  \hideinitializer */
#define WDT_TIMEOUT_2POW16          (6UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^16 * WDT clocks  \hideinitializer */
#define WDT_TIMEOUT_2POW18          (7UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^18 * WDT clocks  \hideinitializer */
#define WDT_TIMEOUT_2POW20          (8UL << WDT_CTL_TOUTSEL_Pos) /*!< Setting WDT time-out interval to 2^20 * WDT clocks  \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/*  WDT  Reset Delay Period Constant Definitions                                                           */
/*---------------------------------------------------------------------------------------------------------*/
#define WDT_RESET_DELAY_1026CLK     (0UL << WDT_ALTCTL_RSTDSEL_Pos) /*!< Setting WDT reset delay period to 1026 * WDT clocks  \hideinitializer */
#define WDT_RESET_DELAY_130CLK      (1UL << WDT_ALTCTL_RSTDSEL_Pos) /*!< Setting WDT reset delay period to 130 * WDT clocks   \hideinitializer */
#define WDT_RESET_DELAY_18CLK       (2UL << WDT_ALTCTL_RSTDSEL_Pos) /*!< Setting WDT reset delay period to 18 * WDT clocks    \hideinitializer */
#define WDT_RESET_DELAY_3CLK        (3UL << WDT_ALTCTL_RSTDSEL_Pos) /*!< Setting WDT reset delay period to 3 * WDT clocks     \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/*  WDT Free Reset Counter Keyword Constant Definitions                                                    */
/*---------------------------------------------------------------------------------------------------------*/
#define WDT_RESET_COUNTER_KEYWORD   (0x00005AA5UL)    /*!< Fill this value to WDT_RSTCNT register to free reset WDT counter \hideinitializer */

/*@}*/ /* end of group WDT_EXPORTED_CONSTANTS */

/** @addtogroup WDT_EXPORTED_FUNCTIONS WDT Exported Functions
  @{
*/

/**
  * @brief      Clear WDT Reset System Flag
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This macro clears WDT time-out reset system flag.
  * \hideinitializer
  */
#define WDT_CLEAR_RESET_FLAG()          (WDT->CTL = (WDT->CTL & ~(WDT_CTL_IF_Msk | WDT_CTL_WKF_Msk)) | WDT_CTL_RSTF_Msk)

/**
  * @brief      Clear WDT Time-out Interrupt Flag
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This macro clears WDT time-out interrupt flag.
  * \hideinitializer
  */
#define WDT_CLEAR_TIMEOUT_INT_FLAG()    (WDT->CTL = (WDT->CTL & ~(WDT_CTL_RSTF_Msk | WDT_CTL_WKF_Msk)) | WDT_CTL_IF_Msk)

/**
  * @brief      Clear WDT Wake-up Flag
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This macro clears WDT time-out wake-up system flag.
  * \hideinitializer
  */
#define WDT_CLEAR_TIMEOUT_WAKEUP_FLAG() (WDT->CTL = (WDT->CTL & ~(WDT_CTL_RSTF_Msk | WDT_CTL_IF_Msk)) | WDT_CTL_WKF_Msk)

/**
  * @brief      Get WDT Time-out Reset Flag
  *
  * @param      None
  *
  * @retval     0   WDT time-out reset system did not occur
  * @retval     1   WDT time-out reset system occurred
  *
  * @details    This macro indicates system has been reset by WDT time-out reset or not.
  * \hideinitializer
  */
#define WDT_GET_RESET_FLAG()            ((WDT->CTL & WDT_CTL_RSTF_Msk)? 1UL : 0UL)

/**
  * @brief      Get WDT Time-out Interrupt Flag
  *
  * @param      None
  *
  * @retval     0   WDT time-out interrupt did not occur
  * @retval     1   WDT time-out interrupt occurred
  *
  * @details    This macro indicates WDT time-out interrupt occurred or not.
  * \hideinitializer
  */
#define WDT_GET_TIMEOUT_INT_FLAG()      ((WDT->CTL & WDT_CTL_IF_Msk)? 1UL : 0UL)

/**
  * @brief      Get WDT Time-out Wake-up Flag
  *
  * @param      None
  *
  * @retval     0   WDT time-out interrupt does not cause CPU wake-up
  * @retval     1   WDT time-out interrupt event cause CPU wake-up
  *
  * @details    This macro indicates WDT time-out interrupt event has waked up system or not.
  * \hideinitializer
  */
#define WDT_GET_TIMEOUT_WAKEUP_FLAG()   ((WDT->CTL & WDT_CTL_WKF_Msk)? 1UL : 0UL)

/**
  * @brief      Reset WDT Counter
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This macro is used to reset the internal 18-bit WDT up counter value.
  * @note       If WDT is activated and time-out reset system function is enabled also, user should \n
  *             reset the 18-bit WDT up counter value to avoid generate WDT time-out reset signal to \n
  *             reset system before the WDT time-out reset delay period expires.
  * \hideinitializer
  */
#define WDT_RESET_COUNTER()             (WDT->RSTCNT = WDT_RESET_COUNTER_KEYWORD)

__STATIC_INLINE void WDT_Close(void);
__STATIC_INLINE void WDT_EnableInt(void);
__STATIC_INLINE void WDT_DisableInt(void);
/**
  * @brief      Stop WDT Counting
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This function will stop WDT counting and disable WDT module.
  */
__STATIC_INLINE void WDT_Close(void)
{
    WDT->CTL = 0UL;
    while(WDT->CTL & WDT_CTL_SYNC_Msk); // Wait disable WDTEN bit completed, it needs 2 * WDT_CLK.
    return;
}

/**
  * @brief      Enable WDT Time-out Interrupt
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This function will enable the WDT time-out interrupt function.
  */
__STATIC_INLINE void WDT_EnableInt(void)
{
    WDT->CTL |= WDT_CTL_INTEN_Msk;
    while(WDT->CTL & WDT_CTL_SYNC_Msk); // Wait enable WDTEN bit completed, it needs 2 * WDT_CLK.
    return;
}

/**
  * @brief      Disable WDT Time-out Interrupt
  *
  * @param      None
  *
  * @return     None
  *
  * @details    This function will disable the WDT time-out interrupt function.
  */
__STATIC_INLINE void WDT_DisableInt(void)
{
    /* Do not touch another write 1 clear bits */
    WDT->CTL &= ~(WDT_CTL_INTEN_Msk | WDT_CTL_RSTF_Msk | WDT_CTL_IF_Msk | WDT_CTL_WKF_Msk);
    return;
}

void WDT_Open(uint32_t u32TimeoutInterval, uint32_t u32ResetDelay, uint32_t u32EnableReset, uint32_t u32EnableWakeup);

/*@}*/ /* end of group WDT_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group WDT_Driver */

/*@}*/ /* end of group Standard_Driver */

#ifdef __cplusplus
}
#endif

#endif //__NU_WDT_H__

/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/


text:
package org.jconverter.converter.catalog.string;

import java.text.NumberFormat;
import java.text.ParseException;

import org.jconverter.JConverter;
import org.jconverter.converter.Converter;
import org.jconverter.converter.TypeDomain;
import org.jconverter.converter.catalog.number.NumberToNumberConverter;

public class StringToNumberConverter<T extends Number> implements Converter<String, T> {

	@Override
	public T apply(String source, TypeDomain target, JConverter context) {
		Class<?> numberClass = target.getRawClass();
		Number number;
		try {
			NumberFormat nf = context.instantiate(NumberFormat.class);
			number = nf.parse(source);
		} catch (ParseException e) {
			throw new RuntimeException(e);
		}
		return (T) NumberToNumberConverter.numberToNumber(number, numberClass);
	}
}


text:
var driverPath = './DBDriver/'
,	defaultDriver = 'EasyTingo'
,	util = require('util')
,	Collection = require('./lib/Collection.js')
,	Parser = require('./lib/Parser.js')
,	defaultLimit = 30;

/*
	this.DB
	this.params = {
		driverPath,
		driver
	}

	var test = {a: 1, b: { "b1": 2 }}
 */

 /*

var edb = require('ecdb'); // var edb = require('./index.js');
var db = new edb();
db.connect();
db.listData('users', 'where authtime > "2012-10-10"', function(e, d) {console.log(d);});
db.listTable(function(e, d) {console.log(d);});
db.putData('tmp', 5, {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.postTable('testuser', {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.postData('user', {name: 'A', birth: '1982-04-01', age: 2}, function(e, d) {console.log(d);});
db.postData('testuser', {name: 'B', birth: '1988-09-18', age: 3}, function(e, d) {console.log(d);});
db.postData('user', {name: 'B', birth: '1995-08-23', age: 4}, function(e, d) {console.log(d);});
db.listData('user', "birth < '1990-01-01' and birth > '1984-01-01'", function(e, d) {console.log(d);});
db.postData('user', [{name: 'D', birth: '1982-05-01'}], function(e, d) {console.log(d);});
db.postData('user', [{name: 'D', birth: '1982-05-01'}, {name: 'E', birth: '1982-06-01'}, {name: 'F', birth: '1982-07-01'}], function(e, d) {console.log(d);});
db.sql("select * from user where birth > '1982-05-01'", function(e, d) {console.log(d);});
db.sql("select * from user inner join info on user.x = info.x", function(e, d) {console.log(d);});

db.dataFind(
[{name: 'A', birth: '1982-04-01', age: 10},{name: 'B', birth: '1983-04-01', age: 5},{name: 'C', birth: '1984-04-01', age: 20}],
"select * from table where birth > '1983-01-01'",
function(e, d) {console.log(d);}
);

db.putData('tmp2', 5, {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.sql("update Yo set a = 1, b = 'b', c = '1999-01-01'");
db.sql("delete from user where _id > 3");

 */

var Schema = function(table) {
		return { "name": table, "max_serial_num": 0, "columns": {} };
	}
,	dataSize = function(data) {
		var size = 0;
		for(var key in data) { if(key.indexOf('_') != 0) size++; }
		return size;
	}
,	checkTable = function(table, toObj) {
		!table && (table = '');
		var result = table;
		var tablename = table.name || table;

		tablename = tablename.trim();
		if(tablename.length == 0) { return false; }

		while(tablename.substr(0, 1) == '_') { tablename = tablename.substr(1); }
		result.name = tablename;

		return toObj? result: tablename;
	}
,	checkSQL = function(sql) {
	if(!sql || typeof sql != 'string') { return ''; }

	var tmp = sql.toLowerCase();

	if(
		tmp.indexOf("select") != 0 &&
		tmp.indexOf("update") != 0 &&
		tmp.indexOf("insert") != 0 &&
		tmp.indexOf("delete") != 0 &&
		tmp.indexOf("limit") != 0 &&
		tmp.indexOf("where") != 0
	) {
		sql = "WHERE " + sql;
	}

	return sql;
}
,	dataType = function(type) {
	// default type: String;
	var rtType = "String";
	if(typeof type == "object") { return 'JSON'; }
	else if(typeof type != 'string') { return rtType; }

	var typeList = ['String', 'Number', 'Date', 'Boolean', 'JSON', 'Binary'];
	var searchList = [];
	for(var key in typeList) { searchList[key] = typeList[key].toLowerCase(); }
	si = searchList.indexOf(type.toLowerCase());

	if(si > -1) {
		rtType = typeList[si];
	}

	return rtType;
}
,	valueType = function(value) {
	var rs;
	if(typeof value == "object") { rs = "JSON"; }
	else if( /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i.test(value) ) { rs = dataType("Number"); }
	else if( !isNaN(Date.parse(value)) ) { rs = dataType("Date"); }
	else { rs = dataType(typeof value); }
	return rs;
}
,	getValueSchema = function(data) {
	var schema = {};
	if(!data || typeof data != 'object') { data = {}; }
	else if(util.isArray(data)) { return getValueSchema(data[0]); }

	for(var key in data) {
		schema[key] = valueType(data[key]);
	}

	return schema;
}
,	dataTransfer = function(value, type) {
	if(typeof type != "string") { return checkValue(value); }
	var rs = value;
	if(value === null) { return null; }

	switch(type) {
		case "String":
			if(!value) {
				rs = "";
			}
			else {
				rs = value.toString();
			}
			break;

		case "Number":
			rs = isNaN(parseFloat(value))? null: parseFloat(value);
			break;

		case "Date":
			rs = isNaN(new Date(value))? null: new Date(value);
			break;

		case "Boolean":
			if(typeof value == 'string') { value = value.toLowerCase(); }
			switch(value) {
				case true:
				case "true":
				case "t":
				case 1:
				case "1":
					rs = true;
					break;

				case false:
				case "false":
				case "f":
				case 0:
				case "0":
					rs = false;
					break;

				default:
					rs = null;
					break;
			}

			break;

		case "JSON":
			rs = typeof value == 'object'? value: {};
			break;

		case "Binary":
			break;
	}

	return rs;
}
,	parseData = function(data) {
	var type = typeof(data),
		rs = {};

	if(type != 'object') {
		key = '_' + type;
		rs[key] = data;
	}
	else {
		rs = data;
	}

	return rs;
}
,	checkValue = function(value) {
	var rs;

	if( /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i.test(value) ) { rs = parseFloat(value); }
	else if( !isNaN(Date.parse(value)) ) { rs = new Date(value); }
	else { rs = value; }

	return rs;
}
,	parseValue = function(value, type) {
	var rs;

	value = value.trim();
	if(value.indexOf("'") == 0 || value.indexOf('"') == 0) {
		rs = value.substr(1, value.length - 2);
		if(type) { rs = dataTransfer(rs, type); }
	}
	else {
		if(type) {
			rs = dataTransfer(value, type);
		}
		if(typeof(value) == 'object') {
			rs = value;
		}
		else if(value == 'true') {
			rs = true;
		}
		else if(value == 'false') {
			rs = false;
		}
		else {
			rs = parseFloat(value);
		}
	}

	return rs;
}
var preCondiction = function(ast, schema) {
	!ast && (ast = {});
	!schema && (schema = { "columns": {} });

	if(ast.operator) {
		ast.right = parseValue(ast.right, schema.columns[ast.left]);
	}
	else if(ast.logic) {
		for(var key in ast.terms) {
			ast.terms[key] = preCondiction(ast.terms[key], schema);
		}
	}

	return ast;
}
,	parseSet = function(set) {
	var rs = {};
	for(var key in set) {
		var tmp = set[key].expression,
			pos = tmp.indexOf("=");

		if(pos == -1) { continue; }

		var column = tmp.slice(0, pos).trim(),
			value = parseValue(tmp.slice(pos + 1));

		rs[column] = value;
	}

	return rs;
}
,	compareSchema = function(data, schema) {
	var rs = {};
	!schema && (schema = { "columns": {} });
	if(typeof schema != 'object' || schema.strick === false) {
		for(var key in data) {
			rs[key] = dataTransfer(data[key]);
		}
	}
	else {
		for(var key in data) {
			if(schema.columns[key]) {
				rs[key] = dataTransfer(data[key], schema.columns[key]);
			}
		}
	}

	return rs;
};

var ecDB = function(conf, logger) {
	this.init(conf, logger);
};

ecDB.prototype.init = function(conf, logger) {
	!conf && (conf = {});
	this.config(conf);
	this.setDriverPath(conf.driverPath);
	this.setDriver(conf.driver);
	this.Parser = Parser;
	return this;
};
ecDB.prototype.setDriver = function(driver) {
	!!driver && (this.params.driver = driver);
	var Driver = require(this.params.driverPath + this.params.driver);
	this.DB = new Driver();
};
ecDB.prototype.setDriverPath = function(path) {
	!!path && (this.driverPath = path);
};
ecDB.prototype.config = function(config) {
	this.params = {
		driverPath: config.driverPath? config.driverPath: driverPath,
		driver: config.driver? config.driver: defaultDriver
	};
};
ecDB.prototype.connect = function(option, callback) {
	this.DB.connect(option, function(err) {
		rs = !err;
		if(typeof(callback) == 'function') {
			callback(err, true);
		}
		else {
			console.log('DB connect');
		}
	});

	return true;
};
ecDB.prototype.disconnect = function() {
	this.DB.disconnect();
};
ecDB.prototype.sql = function(sql, callback) {
	var self = this;
	var query = Parser.sql2ast(sql)
	,	operate;

	query.hasOwnProperty("SELECT") && (operate = "SELECT");
	query.hasOwnProperty("UPDATE") && (operate = "UPDATE");
	query.hasOwnProperty("INSERT INTO") && (operate = "INSERT");
	query.hasOwnProperty("DELETE FROM") && (operate = "DELETE");

	switch(operate) {
		case "SELECT":
			var table = query.FROM[0].table;
			this.listData(table, sql, callback);
			break;
		case "UPDATE":
			var table = query.UPDATE[0].table;
			this.getSchema(table, function(err, schema) {
				var cond = preCondiction(query.WHERE, schema),
					rowData = compareSchema( parseSet(query.SET), schema );

				self.updateData(table, query, rowData, function(err, data) {
					if(typeof(callback) == 'function') {
						callback(err, data);
					}
					else {
						console.log('execute SQL update');
						console.log(err || data);
					}
				});
			});
			break;
		case "INSERT":
			break;
		case "DELETE":
			var table = query['DELETE FROM'][0].table,
				cond = preCondiction(query.WHERE),
				limit = query.LIMIT;

			this.deleteData(table, query, function(err, data) {
				if(typeof(callback) == 'function') {
					callback(err, data);
				}
				else {
					console.log('execute SQL delete');
					console.log(err || data);
				}

			});
			break;
	}
};

ecDB.prototype.getID = function(table, n, callback) {
	var self = this;
	var rs, check;
	table = checkTable(table);

	if(!table) { return false; }

	this.DB.tableExist(table, function(err, data) {
		check = err? false: data;

		if(!check) {
			self.postTable(table, {}, function() {
				self.execGetID(table, n, callback);
			});
		}
		else {
			self.execGetID(table, n, callback);
		}
	});
};

ecDB.prototype.execGetID = function(table, n, callback) {
	if(n > 0) {
		this.DB.getIDs(table, n, function(err, data) {
			if(typeof(callback) == 'function') {
				callback(err, data);
			}
			else {
				console.log('get ID');
				console.log(err || data);
			}
		});
	}
	else {
		this.DB.getID(table, function(err, data) {
			if(typeof(callback) == 'function') {
				callback(err, data);
			}
			else {
				console.log('get ID');
				console.log(err || data);
			}
		});
	}
};

ecDB.prototype.getSchema = function(table, callback) {
	var rs;
	table = checkTable(table);

	if(!table) { return false; }

	this.DB.getSchema(table, function(err, data) {
		rs = err? false: data;
		if(rs) { rs.columns._id = 'Number'; }

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('get Schema');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.setSchema = function(table, schema, callback) {
	var self = this;
	table = checkTable(table, true);
	if(!table) { return false; }

	var rs;

	for(var key in schema) {
		if(key.indexOf('_', 0) == 0) { continue; }
		schema[key] = dataType(schema[key]);
	}

	this.getSchema(table, function(err, _schema) {
		if(_schema) {
			self.DB.setSchema(table, schema, function(_err, _data) {
				if(typeof(callback) == 'function') {
					callback(_err, true);
				}
				else {
					console.log('set Schema');
					console.log(_err || true);
				}
			});
		}
		else {
			self.DB.newSchema(table, schema, function(_err, _data) {
				if(typeof(callback) == 'function') {
					callback(_err, true);
				}
				else {
					console.log('set Schema');
					console.log(_err || true);
				}
			});
		}
	});
};
ecDB.prototype.setSchemaByValue = function(table, value, callback) {
	table = checkTable(table, true);
	if(!table) { return false; }

	var rs
	,	tableSchema = new Schema(table);

	for(var key in value) {
		if(key.indexOf('_', 0) == 0) { continue; }
		tableSchema.columns[key] = valueType(value[key]);
	}

	this.DB.setSchema(table, tableSchema, function(err) {
		rs = !err;
		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('set Schema by value');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.listTable = function(callback) {
	var rs;

	this.DB.listTable(function(err, data) {
		rs = err? false: data;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('list Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.getTable = function(table, callback) {
	table = checkTable(table);
	if(!table) { return false; }

	var rs;

	this.DB.getTable(table, function(err, data) {
		rs = err? false: data;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('get Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.postTable = function(table, schema, callback) {
	table = checkTable(table);
	if(!table) { return false; }

	var rs;

	this.DB.postTable(table, schema, function(err, data) {
		rs = err? false: true;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('post Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.putTable = function(table, schema, callback) {
	table = checkTable(table);
	if(!table) { return false; }

	var rs;

	this.DB.putTable(table, schema, function(err, data) {
		rs = err? false: data;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('put Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.cleanTable = function(table, callback) {
	table = checkTable(table);
	if(!table) { return false; }

	var rs;

	this.DB.deleteData(table, {}, function(err, data) {
		rs = err? false: true;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('clean Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.deleteTable = function(table, callback) {
	table = checkTable(table);
	if(!table) { return false; }

	var rs;

	this.DB.deleteTable(table, function(err, data) {
		rs = err? false: true;

		if(typeof(callback) == 'function') {
			callback(err, rs);
		}
		else {
			console.log('delete Table');
			console.log(err || rs);
		}
	});
};
ecDB.prototype.listData = function(table, query, callback) {
	var self = this;
	table = checkTable(table);
	if(!table) { return false; }

	if(!query) { query = '' }
	else {
		query = checkSQL(query);
	}

	var rs
	,	cond = Parser.sql2ast(query);

	this.getSchema(table, function(err, schema) {
		cond.WHERE = preCondiction( cond.WHERE, schema );

		self.DB.listData(table, cond, function(_err, data) {
			rs = _err? false: data;
			if(_err) { rs = false; }
			else {
				var collection = new Collection();
				for(var key in data) {
					collection.add( compareSchema(data[key], schema) );
				}
				rs = collection.toJSON();

				if(typeof(callback) == 'function') {
					callback(_err, rs);
				}
				else {
					console.log('list Data');
					console.log(_err || rs);
				}
			}
		});
	});
};
ecDB.prototype.flowData = function(table, query, callback) {
	var self = this;
	table = checkTable(table);
	if(!table) { return false; }

	if(!query) { query = '' }
	else {
		query = checkSQL(query);
	}

	var rs
	,	cond = Parser.sql2ast(query);

	this.getSchema(table, function(err, schema) {
		cond.WHERE = preCondiction( cond.WHERE, schema );

		if(!cond.LIMIT) {
			cond.LIMIT = {
				"nb": defaultLimit
			};
		}
		else if(!cond.LIMIT.nb) {
			cond.LIMIT.nb = defaultLimit
		}

		self.DB.flowData(table, cond, function(_err, data) {
			rs = _err? false: data;
			if(_err) { rs = false; }
			else {
				var collection = new Collection();
				for(var key in data) {
					collection.add( compareSchema(data[key], schema) );
				}
				rs = collection.toJSON();

				if(typeof(callback) == 'function') {
					callback(_err, rs);
				}
				else {
					console.log('flow Data');
					console.log(_err || rs);
				}
			}
		});
	});
};
ecDB.prototype.pageData = function(table, query, callback) {
	var self = this;
	table = checkTable(table);

	if(!table) { return false; }

	if(!query) { query = '' }
	else {
		query = checkSQL(query);
	}

	var rs
	,	cond = Parser.sql2ast(query);

	this.getSchema(table, function(err, schema) {
		cond.WHERE = preCondiction( cond.WHERE, schema );

		if(!cond.LIMIT) {
			cond.LIMIT = {"nb": defaultLimit};
		}
		else if(!cond.LIMIT.nb) {
			cond.LIMIT.nb = defaultLimit;
		}

		self.DB.pageData(table, cond, function(_err, data) {
			rs = _err? false: data;
			if(_err) { callback(_err); }
			else {
				var collection = new Collection();
				for(var key in data) {
					collection.add( compareSchema(data[key], schema) );
				}
				rs = collection.toJSON();

				if(typeof(callback) == 'function') {
					callback(_err, rs);
				}
				else {
					console.log('page Data');
					console.log(_err || data);
				}
			}
		});
	});
};
ecDB.prototype.getData = function(table, id, callback) {
	var self = this;
	table = checkTable(table);
	if(!table) { return false; }

	var rs
	,	cond = Parser.sql2ast("WHERE _id = " + id);

	this.getSchema(table, function(err, schema) {
		cond.WHERE = preCondiction(cond.WHERE, schema);

		self.DB.getData(table, cond, function(_err, data) {
			rs = err? false: compareSchema(data, schema);

			if(typeof(callback) == 'function') {
				callback(_err, rs);
			}
			else {
				console.log('get Data');
				console.log(_err || rs);
			}
		});
	});
};
ecDB.prototype.find = function(table, query, filter, callback) {
	var self = this;
	if(arguments.length == 3) {
		if (typeof(arguments)[2] == 'function') {
			callback = arguments[2];
			filter = '';
		}
	}
	filter = checkSQL(filter);
	filter = Parser.sql2ast(filter);

	table = checkTable(table);
	if(!table) {
		if(typeof(callback) == 'function') {
			callback(err, false);
		}
		else {
			callback(true);
		}

		return false;
	}

	var rs;
	this.getSchema(table, function(err, schema) {
		self.DB.find(table, query, filter, function(_err, _data) {
			if(err) { rs = false; }
			else {
				rs = [];
				for(var key in _data) {
					rs.push(compareSchema(_data[key], schema));
				}
			}

			if(typeof(callback) == 'function') {
				callback(_err, rs);
			}
			else {
				console.log('find');
				console.log(_err || rs);
			}
		});
	});
};

ecDB.prototype.importData = function(data, callback) {
	var rs;
	var table = "_" + Math.random().toString(36).substring(7);
	var jobs = 0;

	this.postData(table, data, function(err, _data) {
		callback(err, table);
	});
};

ecDB.prototype.dataFind = function(data, sql, callback) {
	var self = this;
	this.importData(data, function(err, table) {
		self.listData(table, sql, function(_err, _data) {
			self.deleteTable(table, function() {});

			if(typeof(callback) == 'function') {
				callback(_err, _data);
			}
			else {
				console.log('data find');
				console.log(_err || _data);
			}
		});
	});
};
ecDB.prototype.postData = function(table, data, callback) {
	var self = this;
	var check, rs, schema, id = [];
	var label = !!table? table.label: '';
	table = checkTable(table);
	if(!table) { return false; }

	this.getSchema(table, function(err, schema) {
		if(dataSize(schema.columns) == 0) {
			var valueSchema = getValueSchema(data);
			if(label) {
				var tableOBJ = {"name": table, "label": label};
				self.setSchema(tableOBJ, valueSchema, function() {});
			}
			else {
				self.setSchema(table, valueSchema, function() {});
			}

			schema = {columns: valueSchema};
		}
		schema.strict = !!schema.strict;

		var dl = util.isArray(data)? data.length: 1;
		self.getID(table, dl, function(_err, ID) {
			if(util.isArray(data)) {
				for(var key in data) {
					data[key] = compareSchema(data[key], schema);
					data[key]._id = ID + parseInt(key);
					id.push(data[key]._id);
				}
			}
			else {
				data = compareSchema(data, schema);
				data._id = ID;
				id.push(data._id);
			}

			self.DB.postData(table, data, function(__err, _data) {
				rs = err? false: id.join(', ');

				if(typeof(callback) == 'function') {
					callback(__err, rs);
				}
				else {
					console.log('post Data');
					console.log(_err || _data);
				}
			});
		});
	});
};
ecDB.prototype.updateData = function(table, q, data, callback) {
	var self = this;
	var rs;

	this.getSchema(table, function(err, schema) {
		var	query = Parser.sql2ast( checkSQL(q) ),
			cond = preCondiction(query.WHERE, schema),
			rowData = compareSchema( data, schema );

		self.DB.updateData(table, cond, {$set: rowData}, function(_err, _data) {
			rs = _err? false: _data;

			if(typeof(callback) == 'function') {
				callback(_err, rs);
			}
			else {
				console.log('update Data');
				console.log(_err || _data);
			}
		});
	});
};
ecDB.prototype.replaceData = function(table, id, data, callback) {
	var self = this;
	table = checkTable(table);
	if(!table) { callback(false, false); return false; }

	var rs, check

	this.getSchema(table, function(err, schema) {
		var	query = Parser.sql2ast("WHERE _id = " + id);
		query.WHERE = preCondiction( query.WHERE, schema );
		data = compareSchema(data, schema);

		self.DB.checkID(table, id, function(_err) {
			data._id = id;
			self.DB.replaceData(table, query, data, function(__err) {
				rs = __err? false: true;

				if(typeof(callback) == 'function') {
					callback(__err, rs);
				}
				else {
					console.log('replace Data');
					console.log(__err || rs);
				}
			});
		});
	});
};
ecDB.prototype.putData = function(table, id, data, callback) {
	var self = this;
	var label = table.label;
	table = checkTable(table);
	if(!table) { callback(false, false); return false; }
	var rs, check, query = Parser.sql2ast("WHERE _id = " + id);

	this.getSchema(table, function(err, schema) {
		if(dataSize(schema.columns) == 0) {
			var valueSchema = getValueSchema(data);
			if(label) {
				var tableOBJ = {"name": table, "label": label};
				self.setSchema(tableOBJ, valueSchema, function() {});
			}
			else {
				self.setSchema(table, valueSchema, function() {});
			}

			schema = {columns: valueSchema};
		}
		schema.strict = !!schema.strict;

		query.WHERE = preCondiction( query.WHERE, schema );
		data = compareSchema(data, schema);

		self.DB.checkID(table, id, function(_err, _data) {
			check = _err? false: _data;
		});

		newData = {$set: data};
		self.DB.putData(table, query, newData, function(_err, _data) {
			rs = _err? false: true;

			if(typeof(callback) == 'function') {
				callback(_err, rs);
			}
			else {
				console.log('put Data');
				console.log(_err || rs);
			}
		});
	});
};
ecDB.prototype.deleteData = function(table, query, callback) {
	var self = this;
	table = checkTable(table);
	if(!table) { return false; }

	var rs,	cond;
	this.getSchema(table, function(err, schema) {
		if(!!query.WHERE) {
			cond = query;
		}
		else if(new RegExp('^[0-9]*$').test(query)) {
			cond = Parser.sql2ast("WHERE _id = " + query);
			cond.WHERE = preCondiction( cond.WHERE, schema );
		}
		else {
			query = checkSQL(query);

			cond = Parser.sql2ast(query);
			cond.WHERE = preCondiction( cond.WHERE, schema );
		}

		var x = 0;
		for(var key in cond) {
			x++;
		}
		if(x == 0) { return false; }

		self.DB.deleteData(table, cond, function(_err, data) {
			rs = _err? false: true;

			if(typeof(callback) == 'function') {
				callback(_err, rs);
			}
			else {
				console.log('put Data');
				console.log(_err || rs);
			}
		});
	});
};

module.exports = ecDB;


text:
package com.greenpepper.server.runner.confluence5;

import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.io.IOException;
import java.util.Properties;

import org.apache.commons.io.FileUtils;
import org.easymock.Capture;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.unitils.UnitilsJUnit4TestClassRunner;
import org.unitils.easymock.annotation.Mock;
import org.unitils.inject.annotation.TestedObject;

import com.greenpepper.GreenPepperCore;
import com.greenpepper.confluence.Plugin;
import com.greenpepper.server.GreenPepperServerException;
import com.greenpepper.server.domain.EnvironmentType;
import com.greenpepper.server.domain.Runner;
import com.greenpepper.server.domain.dao.SystemUnderTestDao;

@RunWith(UnitilsJUnit4TestClassRunner.class)
public class ConfluenceDefaultRunnerBuilderTest {

    private static final String clientJarFileName = "greenpepper-client-" + GreenPepperCore.VERSION + "-complete.jar";
    private static final String demoJarFileName = "greenpepper-confluence-demo-" + Plugin.VERSION + "-fixtures.jar";

    @TestedObject
    private ConfluenceDefaultRunnerBuilder builder;

    @Mock
    private SystemUnderTestDao systemUnderTestDao;

    private Properties properties = new Properties();

    @Before
    public void setUp() throws Exception {
        String home = FileUtils.toFile(getClass().getResource("/")).getCanonicalPath();
        properties.setProperty("confluence.home", home);
        File testclassesDir = FileUtils.toFile(getClass().getResource("/"));
        File testFakeJarfile = new File(testclassesDir, clientJarFileName);
        FileUtils.writeStringToFile(testFakeJarfile, "dummy content", "UTF-8");
        File testFakeDemoJarfile = new File(testclassesDir, demoJarFileName);
        FileUtils.writeStringToFile(testFakeDemoJarfile, "dummy demo content", "UTF-8");
    }

    @After
    public void cleanup() {
        FileUtils.deleteQuietly(new File(properties.getProperty("confluence.home") + "/plugins-data"));
        File testclassesDir = FileUtils.toFile(getClass().getResource("/"));
        FileUtils.deleteQuietly(new File(testclassesDir, clientJarFileName));
        FileUtils.deleteQuietly(new File(testclassesDir, demoJarFileName));
        properties.clear();
    }

    @Test
    public void getRunnerNameShouldNotBeNull() {
        assertNotNull(builder.getRunnerName());
    }

    @Test
    public void shouldNotBuildRunnerIfConfluenceHomeNotSet() {
        properties.clear();
        builder.buildAndRegisterRunner(systemUnderTestDao, properties);
    }

    @Test
    public void shouldCreateAndRegisterRunner() throws GreenPepperServerException, IOException {

        expect(systemUnderTestDao.getEnvironmentTypeByName("JAVA")).andReturn(new EnvironmentType());
        Capture<Runner> runnerCapture = new Capture<Runner>();

        expect(systemUnderTestDao.create(capture(runnerCapture))).andReturn(new Runner());

        replay(systemUnderTestDao);
        builder.buildAndRegisterRunner(systemUnderTestDao, properties);

        verify(systemUnderTestDao);

        Runner value = runnerCapture.getValue();
        assertNotNull(value);
        assertNotNull(value.getCmdLineTemplate());
        assertNotNull(value.getMainClass());
        assertEquals(2, value.getClasspaths().size());
    }
}


text:
<? $this->load->view('_head'); ?>
<? $this->load->view(active_module().'/_navbar'); ?>

				AIR - MANFAAT

		<?
		echo msg_block();
		if(validation_errors()){
			echo '
Harap melengkapi data berikut :';
			echo validation_errors('','');
			echo '
';
		}
		?>

		<?php echo form_open($faction, array('id'=>'myform','class'=>'form-horizontal'));?>

			<input type="hidden" name="id" value="<?=$dt['id']?>"/>

				Uraian

					<input class="form-control" type="text" name="nama" id="nama" value="<?=$dt['nama']?>" required />

			<button type="submit" class="btn btn-primary">Simpan</button>
			<button type="button" class="btn" id="btn_cancel">Batal / Kembali</button>
		<?php echo form_close();?>

<? $this->load->view('_foot'); ?>


text:
from learn_assoc import LearningAssocMem
from spa_learn_assoc import SPALearningAssocMem


text:
_("Make sure Collection can correctly incrementally parse GET requests");
Cu.import("resource://services-sync/record.js");

function run_test() {
  let base = "http://fake/";
  let coll = new Collection("http://fake/uri/", WBORecord);
  let stream = { _data: "" };
  let called, recCount, sum;

  _("Not-JSON, string payloads are strings");
  called = false;
  stream._data = '{"id":"hello","payload":"world"}\n';
  coll.recordHandler = function(rec) {
    called = true;
    _("Got record:", JSON.stringify(rec));
    rec.collection = "uri";           // This would be done by an engine, so do it here.
    do_check_eq(rec.collection, "uri");
    do_check_eq(rec.id, "hello");
    do_check_eq(rec.uri(base).spec, "http://fake/uri/hello");
    do_check_eq(rec.payload, "world");
  };
  coll._onProgress.call(stream);
  do_check_eq(stream._data, '');
  do_check_true(called);
  _("\n");

  _("Parse record with payload");
  called = false;
  stream._data = '{"payload":"{\\"value\\":123}"}\n';
  coll.recordHandler = function(rec) {
    called = true;
    _("Got record:", JSON.stringify(rec));
    do_check_eq(rec.payload.value, 123);
  };
  coll._onProgress.call(stream);
  do_check_eq(stream._data, '');
  do_check_true(called);
  _("\n");

  _("Parse multiple records in one go");
  called = false;
  recCount = 0;
  sum = 0;
  stream._data = '{"id":"hundred","payload":"{\\"value\\":100}"}\n{"id":"ten","payload":"{\\"value\\":10}"}\n{"id":"one","payload":"{\\"value\\":1}"}\n';
  coll.recordHandler = function(rec) {
    called = true;
    _("Got record:", JSON.stringify(rec));
    recCount++;
    sum += rec.payload.value;
    _("Incremental status: count", recCount, "sum", sum);
    rec.collection = "uri";
    switch (recCount) {
      case 1:
        do_check_eq(rec.id, "hundred");
        do_check_eq(rec.uri(base).spec, "http://fake/uri/hundred");
        do_check_eq(rec.payload.value, 100);
        do_check_eq(sum, 100);
        break;
      case 2:
        do_check_eq(rec.id, "ten");
        do_check_eq(rec.uri(base).spec, "http://fake/uri/ten");
        do_check_eq(rec.payload.value, 10);
        do_check_eq(sum, 110);
        break;
      case 3:
        do_check_eq(rec.id, "one");
        do_check_eq(rec.uri(base).spec, "http://fake/uri/one");
        do_check_eq(rec.payload.value, 1);
        do_check_eq(sum, 111);
        break;
      default:
        do_throw("unexpected number of record counts", recCount);
        break;
    }
  };
  coll._onProgress.call(stream);
  do_check_eq(recCount, 3);
  do_check_eq(sum, 111);
  do_check_eq(stream._data, '');
  do_check_true(called);
  _("\n");

  _("Handle incremental data incoming");
  called = false;
  recCount = 0;
  sum = 0;
  stream._data = '{"payl';
  coll.recordHandler = function(rec) {
    called = true;
    do_throw("shouldn't have gotten a record..");
  };
  coll._onProgress.call(stream);
  _("shouldn't have gotten anything yet");
  do_check_eq(recCount, 0);
  do_check_eq(sum, 0);
  _("leading array bracket should have been trimmed");
  do_check_eq(stream._data, '{"payl');
  do_check_false(called);
  _();

  _("adding more data enough for one record..");
  called = false;
  stream._data += 'oad":"{\\"value\\":100}"}\n';
  coll.recordHandler = function(rec) {
    called = true;
    _("Got record:", JSON.stringify(rec));
    recCount++;
    sum += rec.payload.value;
  };
  coll._onProgress.call(stream);
  _("should have 1 record with sum 100");
  do_check_eq(recCount, 1);
  do_check_eq(sum, 100);
  _("all data should have been consumed including trailing comma");
  do_check_eq(stream._data, '');
  do_check_true(called);
  _();

  _("adding more data..");
  called = false;
  stream._data += '{"payload":"{\\"value\\":10}"';
  coll.recordHandler = function(rec) {
    called = true;
    do_throw("shouldn't have gotten a record..");
  };
  coll._onProgress.call(stream);
  _("should still have 1 record with sum 100");
  do_check_eq(recCount, 1);
  do_check_eq(sum, 100);
  _("should almost have a record");
  do_check_eq(stream._data, '{"payload":"{\\"value\\":10}"');
  do_check_false(called);
  _();

  _("add data for two records..");
  called = false;
  stream._data += '}\n{"payload":"{\\"value\\":1}"}\n';
  coll.recordHandler = function(rec) {
    called = true;
    _("Got record:", JSON.stringify(rec));
    recCount++;
    sum += rec.payload.value;
    switch (recCount) {
      case 2:
        do_check_eq(rec.payload.value, 10);
        do_check_eq(sum, 110);
        break;
      case 3:
        do_check_eq(rec.payload.value, 1);
        do_check_eq(sum, 111);
        break;
      default:
        do_throw("unexpected number of record counts", recCount);
        break;
    }
  };
  coll._onProgress.call(stream);
  _("should have gotten all 3 records with sum 111");
  do_check_eq(recCount, 3);
  do_check_eq(sum, 111);
  _("should have consumed all data");
  do_check_eq(stream._data, '');
  do_check_true(called);
  _();

  _("add no extra data");
  called = false;
  stream._data += '';
  coll.recordHandler = function(rec) {
    called = true;
    do_throw("shouldn't have gotten a record..");
  };
  coll._onProgress.call(stream);
  _("should still have 3 records with sum 111");
  do_check_eq(recCount, 3);
  do_check_eq(sum, 111);
  _("should have consumed nothing but still have nothing");
  do_check_eq(stream._data, "");
  do_check_false(called);
  _("\n");
}


text:
echo off
SETLOCAL enabledelayedexpansion
cd ..
call setEnv.cmd

echo on
"%JAVA_HOME%\bin\java" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.block.CreateBlock %*

ENDLOCAL


text:
/**
 *
 */
package eu.codesketch.adam.rest.domain.model.statistics;

/**
 * @author quirino
 *
 */
public class CpuStatistics {

    private CpuUsage cpuUsage;
    private Long systemCpuUsage;
    private Throttling throttling;

    public CpuStatistics(CpuUsage cpuUsage, Throttling throttling, Long systemCpuUsage) {
        this.cpuUsage = cpuUsage;
        this.throttling = throttling;
        this.systemCpuUsage = systemCpuUsage;
    }

    public CpuUsage getCpuUsage() {
        return cpuUsage;
    }

    public Throttling getThrottling() {
        return throttling;
    }

    public Long getSystemCpuUsage() {
        return systemCpuUsage;
    }
}


text:
import java.io.*;
import java.util.ArrayList;
import util.*;

public class HepGraphGenerator {

    int numOfNodes = 15233;

    //Adjacent lists
    ArrayList<Node> nodeList = new ArrayList<Node>();

	public void run(){
	    try
	    {
	        FileInputStream fstream = new FileInputStream("data/hep.txt");

	        DataInputStream in = new DataInputStream(fstream);
	        BufferedReader br = new BufferedReader(new InputStreamReader(in));
	        String strLine;

	        PrintWriter writer = new PrintWriter("data/hepGraph.txt", "UTF-8");

	        while ((strLine = br.readLine()) != null)
		    {

	        	String[] str = strLine.split(" ");
	        	int[] values = new int[str.length];
	        	for(int i=0;i<str.length;i++){
	        		values[i] = Integer.valueOf(str[i]);
	        	}

	        	//first line show how many nodes there are
	        	if(values[0]==15233&&values[1]==58891){
	        		writer.write(strLine + "\n");
	        	}
	        	else{
	        		double probability = trivalencyModel();
	        		double delay = randomDelayModel();
	        		writer.write(strLine + " " + probability + " " + delay + "\n");
	        	}

		    }

	        in.close();
	        writer.close();
	    }
	    catch(Exception e)
	    {
	        System.err.println("Error: " + e.getMessage());
	    }
	  }

	//return a random value from 0.1, 0.01, 0.001.
	public double trivalencyModel(){
		//double p = 1 + (int)(Math.random()*3);
		//System.out.println(1/(Math.pow(10, p)));

		//double p = Math.random();

		//TRIVALENCY model
		//return 1/(Math.pow(10, p));

		//TRIVALENCY model 2
//		int p = (int)(Math.random()*3);
//		double[] choice = {0.2,0.1,0.05};
		int p = (int)(Math.random()*6);
		double[] choice = {0.3,0.25, 0.2, 0.15,0.1,0.05};
		return choice[p];

		//uniform IC model
		//return (double)1/100;
	}

	//delay model
	public double randomDelayModel(){
		double delay = 0+ (int)(Math.random()*10);
		return delay;
	}

	public static void main(String args[]){
		HepGraphGenerator hepG = new HepGraphGenerator();
		hepG.run();

	}

}


text:
package cn.com.sunjiesh.wechat.model.request.message;

/**
 * 微信接收消息-语音消息
 * @author tomsun
 *
 */
public class WechatNormalVoiceMessageRequest extends WechatNormalMessageBaseRequest{

	/**
	 *
	 */
	private static final long serialVersionUID = -5012601776104910516L;

	/**
	 *  语音消息媒体id,可以调用多媒体文件下载接口拉取数据。
	 */
	private String mediaId;

	/**
	 *  语音格式,如amr,speex等
	 */
	private String format;

	/**
	 * 腾讯微信团队
	 */
	private String recongnition;

	public String getMediaId() {
		return mediaId;
	}

	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getRecongnition() {
		return recongnition;
	}

	public void setRecongnition(String recongnition) {
		this.recongnition = recongnition;
	}

}


text:
<?php

namespace PSR2R\Sniffs\Classes;

use PHP_CodeSniffer_File;
use PSR2R\Tools\AbstractSniff;

/**
 * Squiz_Sniffs_Classes_ClassFileNameSniff.
 *
 * Tests that the file name and the name of the class contained within the file
 * match.
 *
 * @author Greg Sherwood <gsherwood@squiz.net>
 * @author Marc McIntyre <mmcintyre@squiz.net>
 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 * @version Release: @package_version@
 * @link http://pear.php.net/package/PHP_CodeSniffer
 */
class ClassFileNameSniff extends AbstractSniff {

	/**
	 * @inheritDoc
	 */
	public function register() {
		return [
			T_CLASS,
			T_INTERFACE,
		];
	}

	/**
	 * @inheritDoc
	 */
	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
		$fullPath = basename($phpcsFile->getFilename());
		$fileName = substr($fullPath, 0, strrpos($fullPath, '.'));
		if ($fileName === '') {
			// No filename probably means STDIN, so we can't do this check.
			return;
		}

		$tokens = $phpcsFile->getTokens();

		$previous = $phpcsFile->findPrevious([T_CLASS, T_INTERFACE], $stackPtr - 1);
		if ($previous) {
			// Probably more than a single declaration per file, we only check first one then.
			return;
		}

		$decName = $phpcsFile->findNext(T_STRING, $stackPtr);

		if ($tokens[$decName]['content'] !== $fileName) {
			$error = '%s name doesn\'t match filename; expected "%s %s"';
			$data = [
				ucfirst($tokens[$stackPtr]['content']),
				$tokens[$stackPtr]['content'],
				$fileName,
			];
			$phpcsFile->addError($error, $stackPtr, 'NoMatch', $data);
		}
	}

}


text:
namespace matcher.Migrations
{
    using System.CodeDom.Compiler;
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.Infrastructure;
    using System.Resources;

    [GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
    public sealed partial class deploy : IMigrationMetadata
    {
        private readonly ResourceManager Resources = new ResourceManager(typeof(deploy));

        string IMigrationMetadata.Id
        {
            get { return "201412162206586_deploy"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        string IMigrationMetadata.Target
        {
            get { return Resources.GetString("Target"); }
        }
    }
}


text:
import unittest
import randopt as ro

import os #for various directory functions
import shutil #for shutil.rmtree
import json #for json.load()
import time #for time.sleep

#TODO: Test Experiment.save_state, amd Experiment.set_state

class TestExperiment(unittest.TestCase):
    def setUp(self):
        self.expName = 'test_experiment_unit_tests'
        self.exp = ro.Experiment(self.expName, {
            'param1'  : ro.Uniform(low=0.0, high=100.0, dtype='int'),
            'param2'  : ro.Normal(mean=100, std=10, dtype='int'),
        })

    def tearDown(self):
        # remove the experiment result folder
        cwd = os.getcwd()
        randopt_folder = os.path.join(cwd, 'randopt_results')
        experiment_path = os.path.join(randopt_folder, self.expName)
        shutil.rmtree(experiment_path)

    def test_folder_creation(self):
        cwd = os.getcwd()
        randopt_folder = os.path.join(cwd, 'randopt_results')
        experiment_path = os.path.join(randopt_folder, self.expName)

        self.assertTrue(os.path.exists(experiment_path))

    def test_seeding_experiment(self):
        self.exp.seed(100)
        sampledParam = self.exp.sample('param1')

        #if properly seeded, the sampling should return 14
        expectedResult = 14

        self.assertEquals(sampledParam, expectedResult)

    def test_setting_param(self):
        desiredParam = 100
        self.exp.set('param1', desiredParam)

        self.assertEquals(self.exp.param1, desiredParam)

    def test_current(self):
        expectedParam1 = 10
        expectedParam2 = 15
        self.exp.set('param1', expectedParam1)
        self.exp.set('param2', expectedParam2)

        currentExp = self.exp.current
        self.assertEquals(currentExp['param1'], expectedParam1)
        self.assertEquals(currentExp['param2'], expectedParam2)

    def test_sample_all_params(self):
        #if properly seeded, the sampling should return 14 and 106
        self.exp.seed(100)
        expectedParam1 = 14
        expectedParam2 = 106
        currentExp = self.exp.sample_all_params()

        self.assertEquals(currentExp['param1'], expectedParam1)
        self.assertEquals(currentExp['param2'], expectedParam2)

    def test_maximum(self):
        self.exp.seed(100)
        expectedMaximum = { 'param1' : 14, 'param2' : 106}

        #Create two results
        self.exp.sample_all_params()
        self.exp.add_result(1000)
        self.exp.sample_all_params()
        self.exp.add_result(1)

        maxResult = self.exp.maximum()
        self.assertEquals(maxResult.result, 1000)
        self.assertEquals(int(maxResult.params['param1']), int(expectedMaximum['param1']))
        self.assertEquals(int(maxResult.params['param2']), int(expectedMaximum['param2']))

    def test_minimum(self):
        self.exp.seed(100)
        expectedMinimum = { 'param1' : 14, 'param2' : 106}

        #Create two results
        self.exp.sample_all_params()
        self.exp.add_result(1)
        self.exp.sample_all_params()
        self.exp.add_result(1000)

        minResult = self.exp.minimum()
        self.assertEquals(minResult.result, 1)
        self.assertEquals(int(minResult.params['param1']), int(expectedMinimum['param1']))
        self.assertEquals(int(minResult.params['param2']), int(expectedMinimum['param2']))

    def test_top_not_enough_results(self):
        self.exp.seed(100)
        #Create 5 results, and ask for the top 10 results
        #Expect to get 5 results back

        #Create 5 results
        nResults = 5
        self.exp.set('param1', 1)
        self.exp.set('param2', 1)
        self.exp.add_result(1)
        self.exp.set('param1', 2)
        self.exp.set('param2', 2)
        self.exp.add_result(2)
        self.exp.set('param1', 3)
        self.exp.set('param2', 3)
        self.exp.add_result(3)
        self.exp.set('param1', 4)
        self.exp.set('param2', 4)
        self.exp.add_result(4)
        self.exp.set('param1', 5)
        self.exp.set('param2', 5)
        self.exp.add_result(5)

        topN = self.exp.top(10)
        self.assertEquals(len(topN), nResults)

    def test_top_n(self):
        self.exp.seed(100)
        #Create 5 results
        nResults = 5
        self.exp.set('param1', 1)
        self.exp.set('param2', 1)
        self.exp.add_result(1)
        self.exp.set('param1', 2)
        self.exp.set('param2', 2)
        self.exp.add_result(2)
        self.exp.set('param1', 3)
        self.exp.set('param2', 3)
        self.exp.add_result(3)
        self.exp.set('param1', 4)
        self.exp.set('param2', 4)
        self.exp.add_result(4)
        self.exp.set('param1', 5)
        self.exp.set('param2', 5)
        self.exp.add_result(5)

        nRequested= 3
        topN = self.exp.top(nRequested)
        self.assertEquals(len(topN), nRequested)
        #the following are the expected values with the given seed
        self.assertEquals(int(topN[0]['param1']), 1)
        self.assertEquals(int(topN[0]['param2']), 1)
        self.assertEquals(int(topN[1]['param1']), 2)
        self.assertEquals(int(topN[1]['param2']), 2)
        self.assertEquals(int(topN[2]['param1']), 3)
        self.assertEquals(int(topN[2]['param2']), 3)

    def test_raise_with_param_named_result(self):
        with self.assertRaises(ValueError):
            ro.Experiment('invalid experiment', {
                    'result' : ro.Uniform(low=0.0, high=100.0, dtype='int'),
                })

    def test_add_result(self):
        self.exp.set('param1', 10)
        self.exp.set('param2', 20)
        self.exp.add_result(50)

        #grab the file in the experiment path
        cwd = os.getcwd()
        randopt_folder = os.path.join(cwd, 'randopt_results')
        experiment_path = os.path.join(randopt_folder, self.expName)
        files = os.listdir(experiment_path)

        #confirm that only 1 file was written
        self.assertEquals(len(files), 1)

        #confirm that the file was written properly
        file_path = os.path.join(experiment_path, files[0])
        with open(file_path, 'r') as f:
            writtenData = json.load(f)
            self.assertEquals(int(writtenData['param1']), 10)
            self.assertEquals(int(writtenData['param2']), 20)
            self.assertEquals(int(writtenData['result']), 50)

    def test_iter_all_results(self):
        nResults = 5
        exp_seen = []
        for i in range(nResults):
            self.exp.set('param1', i)
            self.exp.set('param2', i)
            self.exp.add_result(i)
            exp_seen.append(0)
        count = 0
        for res in self.exp.all_results():
            count += 1
            exp_seen[int(res.result)] += 1
            self.assertEquals(res.params['param1'], res.result)
            self.assertEquals(exp_seen[int(res.result)], 1)
        self.assertEquals(count, nResults)
        self.assertEquals(sum(exp_seen), nResults)