text:
<?php

namespace Com\PaulDevelop\Library\Common;

/**
 * Base
 *
 * @package  Com\PaulDevelop\Library\Common
 * @category Common
 * @author   Rüdiger Scheumann <code@pauldevelop.com>
 * @license  http://opensource.org/licenses/MIT MIT
 */
abstract class Base
{
    /**
     * Magic get property.
     *
     * @param string $propertyName Property name
     *
     * @return mixed
     * @throws NonExistingPropertyException
     */
    public function __get($propertyName = '')
    {
        // init
        $result = null;

        // action
        $methodName = 'get'.ucfirst($propertyName);
        if (method_exists($this, $methodName)) {
            $result = $this->$methodName();
        } else {
            throw new NonExistingPropertyException("Property \"".$propertyName."\" does not exist.");
        }

        // return
        return $result;
    }

    /**
     * Magic set property.
     *
     * @param string $propertyName
     * @param mixed  $propertyValue
     *
     * @throws NonExistingPropertyException
     */
    public function __set($propertyName = '', $propertyValue = null)
    {
        // action
        $methodName = 'set'.ucfirst($propertyName);
        if (method_exists($this, $methodName)) {
            $this->$methodName($propertyValue);
        } else {
            throw new NonExistingPropertyException("Property \"".$propertyName."\" does not exist.");
        }
    }

    /**
     * @return \stdClass
     */
    public function getStdClass()
    {
        // init
        $result = new \stdClass();

        // action
        $rc = new \ReflectionClass(get_class($this));
        $methods = $rc->getMethods(\ReflectionMethod::IS_PROTECTED | \ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            if (preg_match('/^get(.*)$/', $method->name, $matches)) {
                if ($rc->hasProperty(lcfirst($matches[1]))) {
                    if (is_object($this->{$matches[1]})) {
                        $result->{lcfirst($matches[1])} = $this->{$matches[1]}->getStdClass();
                    } else {
                        $result->{lcfirst($matches[1])} = $this->{$matches[1]};
                    }
                }
            }
        }

        // return
        return $result;
    }
}


text:
package lib

import (
	"net/http"
)

// --------------------------------------------------
// Add TAXII Values to HTTP Header
// --------------------------------------------------

func buildTaxiiHeaderJson(r *http.Request) {

	r.Header.Add("User-Agent", `freetaxii.httpClient`)

	// Specifies which HTTP Media Types the requestor accepts in response.
	r.Header.Add("Accept", `application/json`)

	// Specifies the HTTP Media Type in which the entity body is formatted.
	r.Header.Add("Content-Type", `application/json`)

	// Specifies which TAXII Message Bindings the requestor accepts in response.
	r.Header.Add("X-Taxii-Accept", `urn:taxii.mitre.org:message:json:1.1`)

	// Specifies the TAXII Message Binding in which the entity body is formatted.
	r.Header.Add("X-Taxii-Content-Type", `urn:taxii.mitre.org:message:json:1.1`)

	// Specifies which TAXII Protocol Binding is used for this message.
	r.Header.Add("X-Taxii-Protocol", `urn:taxii.mitre.org:protocol:http:1.0`)

	// Specifies the version of the TAXII Services Specification to which this message conforms.
	r.Header.Add("X-Taxii-Services", `urn:taxii.mitre.org:services:1.1`)
}

redpajama_set_name: RedPajamaGithub


text:
import json
from flask import Flask
from flask import render_template
from flask import request
import votes
from track import track
app = Flask(__name__)

@app.route("/", methods=["GET"])
def vote_summary():
    address = request.args.get("address")
    if address:
        summary = votes.vote_summary(address)
        if summary:
            return render_template("hood.html", summary=summary)
        else:
            return render_template("not_found.html")
    else:
        track("Vote - Hit home page")
        return render_template("search.html")

if __name__ == "__main__":
    app.run(debug=False)


text:
/*
 * Dependencies
 */

var nodeCSS = require( "css" );
var observerService = require( "./../services/observer-service.js" );
var reporterService = require( "./../services/reporter-service.js" );
var argument = require( "./../utils/argument-assertion-util.js" );

/*
 * Public functions
 */

exports.init = function () {

	observerService.onCSSFileRead( exports.onCSSFileRead );

};

exports.onCSSFileRead = function ( reporters, file, fileContents, responseFunction ) {

	/*
	 * String
	 */

	argument.isArray( reporters, "Reporter is undefined." );
	argument.isString( file, "File is undefined." );
	argument.isString( fileContents, "File contents is undefined." );
	argument.isFunction( responseFunction, "Reponse function is undefined." );

	/*
	 * Logic
	 */

	reporterService.onVerbose( reporters, "Will parse CSS file \"" + file + "\"." );

	var css;

	try {
		css = nodeCSS.parse( fileContents );
	} catch ( error ) {
		console.log( "File=" + file );
		throw error;
	}

	for ( var i in css.stylesheet.rules ) {

		var rule = css.stylesheet.rules[i];

		if ( rule.type === "rule" ) {

			var selectors = rule.selectors;

			for ( var k in rule.declarations ) {

				var declaration = rule.declarations[k];

				if ( declaration.type === "declaration" ) {

					var value = declaration.value;

					if ( !value ) {
						var error = new Error( "The CSS value is undefined." );
						error.declaration = declaration;
						throw error;
					}

					observerService.CSSPropertyAndAttributeRead( file, selectors, declaration.property, declaration.value, responseFunction );

				} else if ( declaration.type !== "comment" ) {

					observerService.CSSCommentRead( file, declaration.comment, responseFunction );

				}

			}

		} else if ( rule.type === "comment" ) {
			observerService.CSSCommentRead( file, rule.comment, responseFunction );

		}

	}

};


text:
require 'spec_helper'

feature 'Authentication' do
  scenario 'New user signs up via email' do
    sign_up_with(
      'sbanskota08@gmail.com',
      'sarupbanskota',
      'secret12345',
      'secret12345'
    )
    expect(page.current_path).to eq('/dashboard')
  end

  scenario 'New user signs up via omniauth' do
    visit '/users/sign_in'
    click_button 'Facebook'
    expect(page.current_path).to eq('/dashboard')
  end

  scenario 'Existing user signs in via email' do
    @user = FactoryGirl.create(
      :user,
      password: 'secret12345',
      password_confirmation: 'secret12345'
    )
    sign_in_with(@user.email, 'secret12345')
    expect(page.current_path).to eq('/dashboard')
  end

  scenario 'Existing user signs up via omniauth' do
    @user = FactoryGirl.create(:user)
    visit '/users/sign_in'
    click_button 'Facebook'
    expect(page.current_path).to eq('/dashboard')
  end
end


text:
import React, { forwardRef, Ref } from 'react';
import Input, { TypedInputFieldProps } from './Input';

const Date = forwardRef((props: TypedInputFieldProps, ref: Ref<HTMLInputElement>) => {
	return <Input {...props} type="date" ref={ref} />;
});

Date.displayName = 'Date';

export default Date;


text:
Param ([string] $dnsName, [string] $certPassword, [string] $keyVault, [string] $keyName, [string] $resourceGroup, [string] $location, [string] $pfxPath)
$password = ConvertTo-SecureString -String $certPassword -AsPlainText –Force
New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName $dnsName -Provider 'Microsoft Enhanced Cryptographic Provider v1.0' | Export-PfxCertificate -File $pfxPath –Password $password
$vault=New-AzureRmKeyVault -VaultName $keyVault -ResourceGroupName $resourceGroup -Location $location -EnabledForDeployment
$key = Add-AzureKeyVaultKey -VaultName $keyVault -Name $keyName -KeyFilePath $pfxPath -KeyFilePassword $password
$bytes = [System.IO.File]::ReadAllBytes($pfxPath)
$base64 = [System.Convert]::ToBase64String($bytes)
$jsonBlob = @{
data = $base64
dataType = 'pfx'
password = $certPassword
} | ConvertTo-Json
$contentBytes = [System.Text.Encoding]::UTF8.GetBytes($jsonBlob)
$content = [System.Convert]::Tobase64String($contentBytes)
$secretValue = ConvertTo-SecureString -String $content -AsPlainText –Force
$result=Set-AzureKeyVaultSecret -VaultName $keyVault -Name $keyName -SecretValue $secretValue
$cert = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 $pfxPath, $password

write-host "Vault Resource Id: "  $vault.ResourceId
write-host "Secret Id: " + $result.Id
write-host "Cert Thumbprint: " $cert.Thumbprint


text:
<?xml version="1.0" encoding="UTF-8"?>
<vcs-root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uuid="c42e6dc8-cbae-4bfb-b415-5695b3c33c42" type="jetbrains.git" xsi:noNamespaceSchemaLocation="http://www.jetbrains.com/teamcity/schemas/9.0/project-config.xsd">
  <name>https://github.com/Pavuucek/MBlog.git</name>
  <param name="agentCleanFilesPolicy" value="ALL_UNTRACKED" />
  <param name="agentCleanPolicy" value="ON_BRANCH_CHANGE" />
  <param name="authMethod" value="PASSWORD" />
  <param name="branch" value="master" />
  <param name="ignoreKnownHosts" value="true" />
  <param name="reportTagRevisions" value="true" />
  <param name="secure:password" value="zxx6e1e9802cd9b51b9775d03cbe80d301b" />
  <param name="submoduleCheckout" value="CHECKOUT" />
  <param name="teamcity:branchSpec"><![CDATA[-:refs/heads/gh-pages
+:refs/(pull/*)
+:refs/heads/(develop)
+:refs/heads/(feature/*)
+:refs/heads/(hotfix/*)
+:refs/heads/(master)
+:refs/heads/(release)
+:refs/heads/(support/*)
+:refs/heads/*]]></param>
  <param name="url" value="https://github.com/Pavuucek/MBlog.git" />
  <param name="userForTags" value="Michal Kuncl <michal.kuncl@gmail.com>" />
  <param name="username" value="michal.kuncl@gmail.com" />
  <param name="usernameStyle" value="FULL" />
</vcs-root>


text:
(function($){
    $.fn.dtimenu = function(options){
        var defaults = {
            sensitivity:    3,
            interval:       200,
            showSpeed:      200,
            hideSpeed:      300,
            overCallback:   function(subMenu, parentMenu){},
            outCallback:    function(subMenu, parentMenu){},
            timeout:        350
        };
        var options = $.extend(defaults, options);
        return this.each(function(){
            //this should take a div tag id or a ul id
            var obj = $(this);
            if(obj[0].tagName.toLowerCase() != "ul"){
                //find the ul
                obj = $('ul:eq(0)', obj);
                if(obj[0] === undefined){return false;}
            }
            $('a:eq(0)', obj).addClass('subfolderstyle');
            $('ul', obj).css('left', function(){
                return $($(this).parent('li'))[0].offsetWidth + 'px';
            });
            $('ul ul', obj).each(function(){
                $(this).css('left', function(){
                    return $($(this).parent('li'))[0].offsetWidth + 'px';
                });
            });
            $('li', obj).hoverIntent({
                sensitivity: options.sensitivity,
                interval: options.interval,
                over: function(){
                    $('ul', this).show(options.showSpeed);
                    options.overCallback($('ul', this), $(this));
                },
                out: function(){
                    $('ul', this).hide(options.hideSpeed);
                    options.outCallback($('ul', this), $(this));
                },
                timeout: options.timeout
            });
            $('ul', obj).hide();
        });
    };
})(jQuery);


text:
<screen format="linespecific"><prompt moreinfo="none">grunt> </prompt><userinput moreinfo="none">DESCRIBE records;</userinput>
records: {year: chararray,temperature: int,quality: int}</screen>


text:
from east import consts

def index(array, key, start=0):
    # NOTE(msdubov): No boundary check for optimization purposes.
    i = start
    while array[i] != key:
        i += 1
    return i

def match_strings(str1, str2):
    """
    Returns the largest index i such that str1[:i] == str2[:i]

    """
    i = 0
    min_len = len(str1) if len(str1) < len(str2) else len(str2)
    while i < min_len and str1[i] == str2[i]: i += 1
    return i

def make_unique_endings(strings_collection):
    """
    Make each string in the collection end with a unique character.
    Essential for correct builiding of a generalized annotated suffix tree.
    Returns the updated strings collection, encoded in Unicode.

    max strings_collection ~ 1.100.000

    """
    res = []
    for i in range(len(strings_collection)):
        # NOTE(msdubov): a trick to handle 'narrow' python installation issues.
        hex_code = hex(consts.String.UNICODE_SPECIAL_SYMBOLS_START+i)
        hex_code = r"\U" + "0" * (8 - len(hex_code) + 2) + hex_code[2:]
        res.append(strings_collection[i] + hex_code.decode("unicode-escape"))
    return res


text: A class library for lua, designed for usage with Love2D. Hopefully fast and efficient.


text:
<?php

namespace Ben\CircleOfTrustBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class HomeController extends Controller
{
    public function indexAction()
    {
        return $this->render('BenCircleOfTrustBundle:Home:index.html.twig');
    }
}


text:
package edu.emory.cci.aiw.cvrg.eureka.common.entity;

/**
 *
 * @author Andrew Post
 */
public interface PatientSetExtractionConfig {

	String getAliasFieldName();

	String getAliasFieldNameProperty();

	String getAliasPatientIdProperty();

	String getAliasPropositionId();

}


text:
cask 'a-better-finder-rename' do
  version '10.03'
  sha256 '3ea688fd6fbf6a75c719ad5a08caaad7191681ef252bc44c0df1b93e1f57a9e6'

  url "http://www.publicspace.net/download/ABFRX#{version.major}.dmg"
  appcast "http://www.publicspace.net/app/signed_abfr#{version.major}.xml",
          :checkpoint => '8f78fde8f251d8ea30daeb958969d0ababb0bb40ef033c43f8261bac29cda323'
  name 'A Better Finder Rename'
  homepage 'http://www.publicspace.net/ABetterFinderRename/'
  license :commercial

  app "A Better Finder Rename #{version.major}.app"
end


text:
/**
 */
package de.unidue.ecg.dialogScript.dialogScript.impl;

import de.unidue.ecg.dialogScript.dialogScript.ConditionalBody;
import de.unidue.ecg.dialogScript.dialogScript.DialogScriptPackage;
import de.unidue.ecg.dialogScript.dialogScript.Jump;
import de.unidue.ecg.dialogScript.dialogScript.Statement;
import de.unidue.ecg.dialogScript.dialogScript.SwitchOff;
import de.unidue.ecg.dialogScript.dialogScript.SwitchOn;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 *
 * An implementation of the model object 'Conditional Body'.
 *
 *

 * The following features are implemented:
 *

 *
{@link de.unidue.ecg.dialogScript.dialogScript.impl.ConditionalBodyImpl#getStatements Statements}

 *
{@link de.unidue.ecg.dialogScript.dialogScript.impl.ConditionalBodyImpl#getSwitchOn Switch On}

 *
{@link de.unidue.ecg.dialogScript.dialogScript.impl.ConditionalBodyImpl#getSwitchOff Switch Off}

 *
{@link de.unidue.ecg.dialogScript.dialogScript.impl.ConditionalBodyImpl#getJump Jump}

 *

 *

 *
 * @generated
 */
public class ConditionalBodyImpl extends MinimalEObjectImpl.Container implements ConditionalBody
{
  /**
   * The cached value of the '{@link #getStatements() Statements}' containment reference list.
   *
   *
   * @see #getStatements()
   * @generated
   * @ordered
   */
  protected EList<Statement> statements;

  /**
   * The cached value of the '{@link #getSwitchOn() Switch On}' containment reference.
   *
   *
   * @see #getSwitchOn()
   * @generated
   * @ordered
   */
  protected SwitchOn switchOn;

  /**
   * The cached value of the '{@link #getSwitchOff() Switch Off}' containment reference.
   *
   *
   * @see #getSwitchOff()
   * @generated
   * @ordered
   */
  protected SwitchOff switchOff;

  /**
   * The cached value of the '{@link #getJump() Jump}' containment reference.
   *
   *
   * @see #getJump()
   * @generated
   * @ordered
   */
  protected Jump jump;

  /**
   *
   *
   * @generated
   */
  protected ConditionalBodyImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return DialogScriptPackage.Literals.CONDITIONAL_BODY;
  }

  /**
   *
   *
   * @generated
   */
  public EList<Statement> getStatements()
  {
    if (statements == null)
    {
      statements = new EObjectContainmentEList<Statement>(Statement.class, this, DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS);
    }
    return statements;
  }

  /**
   *
   *
   * @generated
   */
  public SwitchOn getSwitchOn()
  {
    return switchOn;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetSwitchOn(SwitchOn newSwitchOn, NotificationChain msgs)
  {
    SwitchOn oldSwitchOn = switchOn;
    switchOn = newSwitchOn;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON, oldSwitchOn, newSwitchOn);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setSwitchOn(SwitchOn newSwitchOn)
  {
    if (newSwitchOn != switchOn)
    {
      NotificationChain msgs = null;
      if (switchOn != null)
        msgs = ((InternalEObject)switchOn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON, null, msgs);
      if (newSwitchOn != null)
        msgs = ((InternalEObject)newSwitchOn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON, null, msgs);
      msgs = basicSetSwitchOn(newSwitchOn, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON, newSwitchOn, newSwitchOn));
  }

  /**
   *
   *
   * @generated
   */
  public SwitchOff getSwitchOff()
  {
    return switchOff;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetSwitchOff(SwitchOff newSwitchOff, NotificationChain msgs)
  {
    SwitchOff oldSwitchOff = switchOff;
    switchOff = newSwitchOff;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF, oldSwitchOff, newSwitchOff);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setSwitchOff(SwitchOff newSwitchOff)
  {
    if (newSwitchOff != switchOff)
    {
      NotificationChain msgs = null;
      if (switchOff != null)
        msgs = ((InternalEObject)switchOff).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF, null, msgs);
      if (newSwitchOff != null)
        msgs = ((InternalEObject)newSwitchOff).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF, null, msgs);
      msgs = basicSetSwitchOff(newSwitchOff, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF, newSwitchOff, newSwitchOff));
  }

  /**
   *
   *
   * @generated
   */
  public Jump getJump()
  {
    return jump;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetJump(Jump newJump, NotificationChain msgs)
  {
    Jump oldJump = jump;
    jump = newJump;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__JUMP, oldJump, newJump);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setJump(Jump newJump)
  {
    if (newJump != jump)
    {
      NotificationChain msgs = null;
      if (jump != null)
        msgs = ((InternalEObject)jump).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__JUMP, null, msgs);
      if (newJump != null)
        msgs = ((InternalEObject)newJump).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DialogScriptPackage.CONDITIONAL_BODY__JUMP, null, msgs);
      msgs = basicSetJump(newJump, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DialogScriptPackage.CONDITIONAL_BODY__JUMP, newJump, newJump));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS:
        return ((InternalEList<?>)getStatements()).basicRemove(otherEnd, msgs);
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON:
        return basicSetSwitchOn(null, msgs);
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF:
        return basicSetSwitchOff(null, msgs);
      case DialogScriptPackage.CONDITIONAL_BODY__JUMP:
        return basicSetJump(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS:
        return getStatements();
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON:
        return getSwitchOn();
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF:
        return getSwitchOff();
      case DialogScriptPackage.CONDITIONAL_BODY__JUMP:
        return getJump();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS:
        getStatements().clear();
        getStatements().addAll((Collection<? extends Statement>)newValue);
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON:
        setSwitchOn((SwitchOn)newValue);
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF:
        setSwitchOff((SwitchOff)newValue);
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__JUMP:
        setJump((Jump)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS:
        getStatements().clear();
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON:
        setSwitchOn((SwitchOn)null);
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF:
        setSwitchOff((SwitchOff)null);
        return;
      case DialogScriptPackage.CONDITIONAL_BODY__JUMP:
        setJump((Jump)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case DialogScriptPackage.CONDITIONAL_BODY__STATEMENTS:
        return statements != null && !statements.isEmpty();
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_ON:
        return switchOn != null;
      case DialogScriptPackage.CONDITIONAL_BODY__SWITCH_OFF:
        return switchOff != null;
      case DialogScriptPackage.CONDITIONAL_BODY__JUMP:
        return jump != null;
    }
    return super.eIsSet(featureID);
  }

} //ConditionalBodyImpl


text:
/* FORM LOOK'N'FEEL AND TITLE STYLE */
.dmapp-simple {
    font-size: 16px;
}

.dmapp-simple span, .dmapp-simple p, .dmapp-simple li {
    /* XXX I'M GOING TO REMOVE THAT GLOBAL PROP! */
    line-height: normal;
}

.dmapp-simple div.leftContainer {
    text-align: right;
}

.dmapp-simple div.leftContainer span {
    padding: 10px 3px 10px 0;

}

.dmapp-simple div.leftContainer span.titlepart {
    display: block;
    font-size: 24px !important;
    border-bottom: 1px solid #464646; /* dmgray */
    clear: both;
}

.dmapp-simple div.leftContainer span.auxlink {
    float: right;
    padding-bottom: 0;
    font-size: 12px;
    color: #999;
    clear: both;
}

.dmapp-simple div.leftContainer a:hover span.auxlink {
    /* well... ie6 will support a:hover at least... */
    color: #333;
}

.dmapp-simple div.rightContainer form {
    padding: 10px 0 32px 16px;
}

.dmapp-simple div.rightContainer,
.dmapp-simple div.rightContainer legend,
.dmapp-simple div.rightContainer a {
    color: #fff;
}

.dmapp-simple div.rightContainer legend {
    float: left;
    clear: both;
    width: 100%;

    font-size: 24px !important;

    /*
     * add padding-bottom for better look w/ border-bottom
     * padding-top not needed here because the forms are now wrapped in div.mainpane
     * which already has done this
     */
    padding: 0 14px 10px 3px;
    margin: 0 0 20px -16px;
    border-bottom: 1px solid #fff;
}

/* PANE TITLE */
.dmapp-simple h2.panetitle {
    font-size: 24px;
    /* font-weight: bold; */
    border-bottom: 1px solid #fff;
    padding-bottom: 10px;
    margin: 0 -10px 10px;
}

/* FORM FIELDS */
.dmapp-simple form>fieldset>p {
    padding: 0 0 20px;
    clear: both;
}

.dmapp-simple form>fieldset>p>label {
    display: block;
    float: left;
    width: 20%;
    text-align: right;
    padding-right: 5%;
}

.dmapp-simple form>fieldset>p>input {
    width: 75%;
}

.dmapp-simple form>fieldset>p>input[type=text],
.dmapp-simple form>fieldset>p>input[type=password] {
    background: transparent;
    border: none;
    border-bottom: 1px solid #ccc;
    color: #fff;
}

.dmapp-simple form>fieldset>.button {
    /* no surrounding <p /> so padding must be re-defined */
    margin: 0 0 20px;
    padding: 3px;
    border: none;
    background-color: #333;
    color: #ccc;
    cursor: pointer;
}

.dmapp-simple form>fieldset>.button:hover {
    background-color: #ccc;
    color: #333;
}

.dmapp-simple form>fieldset>.submit {
    margin-right: 25%;
    padding: 4px 16px;
}

.dmapp-simple form .helptext {
    display: block;
    clear: both;
    font-size: 12px;
    /* for alignment */
    margin-left: 25%;
    padding-left: 16px;
}

/* FORM ERRORS */
.dmapp-simple form .errorlist {
    margin: 6px 0;
    padding-left: 25%;
    border-left: 2px solid #c00;
    color: #f99;
}

.dmapp-simple form .errorlist li {
    padding: 0 0 3px 3px;
}

/* CHECKBOX SPECIAL-CASE */
.dmapp-simple form .checkbox label {
    width: auto;
    margin-left: 25%;
    padding: 0;
}

.dmapp-simple form .checkbox input {
    margin: 0 16px 0 -16px; /* for alignment */
}

/* INSIDE PAGES: BOX NAVIGATION AND MAIN PANE */
.dmapp-simple .outer-box {
    float: left;
    width: 100%;
    overflow: hidden;
}

.dmapp-simple .nav-box {
    float: left;
    position: relative;
    right: 67%;
    width: 100%;
    background-color: #232323;
}

.dmapp-simple .nav {
    float: left;
    width: 33%;
    position: relative;
    left: 67%;
}

.dmapp-simple #box-nav>.first {
    /* for a continuous split line */
    border-bottom: 1px solid #464646; /* dmgray */
}

.dmapp-simple #box-nav>.selected {
    background-color: #000;
}

.dmapp-simple .mainpane-container {
    float: right;
    width: 67%;
    position: relative;
    left: 67%;
}

.dmapp-simple .mainpane {
    padding: 10px 10px 0; /* right and bottom same as the form's */
}

.dmapp-simple .mainpane form {
    padding: 0;
}

/* NAVBOX LINKS */
.dmapp-simple #box-nav>li {
    padding: 10px 8px 10px 8px;
    /* make only the first item bigger, thx @hanfeng */
    text-align: right;
}

.dmapp-simple #box-nav>.first {
    font-size: 24px;
}

.dmapp-simple #box-nav>li:hover {
    background-color: #ccc;
}

.dmapp-simple #box-nav>li:hover a {
    color: #464646; /* dmgray */
}

/* STANDALONE NOTICE -- USED IN LOGOUT PAGE AND SOME APP MESSAGES */
.dmapp-simple .standalone-notice {
    font-size: 24px !important;
    padding: 10px 0 10px 3px;
}

/* titled sections */
.dmapp-simple .titledsect {
    display: block;
    margin: 0 0 16px 31px;
    padding: 0 0 8px;
    border-left: 1px solid #666;
}

.dmapp-simple .titledsect:before {
    display: block;
    width: 100%;
    border-bottom: 1px solid #666;
    /* kludge to eliminate outstanding border-left from ul itself */
    border-left: 1px solid #464646;
    margin: 0 0 8px -1px; /* -1 to overlap the border w/ bkgnd color */
    padding: 0 1px 4px 0;
    color: #999;
    font-size: 16px;
}

/* action links */
.dmapp-simple .actions:before {
    content: "可进行的动作";
}

.dmapp-simple .actions>.action_item {
    display: block;
    margin: 0 0 4px 16px;
}

.dmapp-simple .actions>.action_item>.action_link {
    font-size: 20px;
    color: #ccc;
}

.dmapp-simple .actions>.action_item>.action_link:hover {
    color: #fff;
}

.dmapp-simple .actions>.action_item>.action_link:after {
    content: "»";
    color: #999;
    margin: 0 0 0 4px;
}

/* vim: set ai et ts=4 sw=4 sts=4 ff=unix fenc=utf-8: */


text:
PopupLayer::PopupLayer():
m__pMenu(NULL)
, m_contentPadding(0)
, m_contentPaddingTop(0)
, m_callbackListener(NULL)
, m_callback(NULL)
, m__sfBackGround(NULL)
, m__s9BackGround(NULL)
, m__ltContentText(NULL)
, m__ltTitle(NULL)
{

}

PopupLayer::~PopupLayer(){
    CC_SAFE_RELEASE(m__pMenu);
    CC_SAFE_RELEASE(m__sfBackGround);
    CC_SAFE_RELEASE(m__ltContentText);
    CC_SAFE_RELEASE(m__ltTitle);
    CC_SAFE_RELEASE(m__s9BackGround);
}

bool PopupLayer::init(){
    bool bRef = false;
    do{
        CC_BREAK_IF(!CCLayer::init());
        this->setContentSize(CCSizeZero);

        // 初始化需要的 Menu
        CCMenu* menu = CCMenu::create();
        menu->setPosition(CCPointZero);
        setMenuButton(menu);

        setTouchEnabled(true);

        bRef = true;
    }while(0);
    return bRef;
}

void PopupLayer::registerWithTouchDispatcher(){
    // 这里的触摸优先级设置为 -128 这保证了,屏蔽下方的触摸
    CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, -128, true);

}

bool PopupLayer::ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent){
    CCLog("PopupLayer touch");
    return true;
}

PopupLayer* PopupLayer::create(const char *backgroundImage){
    PopupLayer* ml = PopupLayer::create();
    ml->setSpriteBackGround(CCSprite::create(backgroundImage));
	ml->setSprite9BackGround(CCScale9Sprite::create(backgroundImage));
    return ml;
}

PopupLayer* PopupLayer::playAnimation(const char *backgroundImage, const CCPoint& pos, CCAction* action){
	PopupLayer* ml = PopupLayer::create();

	CCSprite *sprite = CCSprite::create(backgroundImage);
	sprite->setPosition(pos);
	ml->addChild(sprite);

	sprite->runAction(action);

	return ml;
}

void PopupLayer::setTitle(const char *title, int fontsize){
    CCLabelTTF* ltfTitle = CCLabelTTF::create(title, "", fontsize);
    setLabelTitle(ltfTitle);
}

void PopupLayer::setContentText(const char *text, int fontsize, int padding, int paddingTop){
    CCLabelTTF* ltf = CCLabelTTF::create(text, "", fontsize);
	ltf->setColor(ccc3(123,121,128));
    setLabelContentText(ltf);
    m_contentPadding = padding;
    m_contentPaddingTop = paddingTop;
}

void PopupLayer::setCallbackFunc(cocos2d::CCObject *target, SEL_CallFuncN callfun){
    m_callbackListener = target;
    m_callback = callfun;
}

bool PopupLayer::addButton(const char *normalImage, const char *selectedImage, const char *title, int tag){
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    CCPoint pCenter = ccp(winSize.width / 2, winSize.height / 2);

    // 创建图片菜单按钮
    CCMenuItemImage* menuImage = CCMenuItemImage::create(normalImage, selectedImage, this, menu_selector(PopupLayer::buttonCallback));
    menuImage->setTag(tag);
    menuImage->setPosition(pCenter);

    // 添加文字说明并设置位置
    CCSize imenu = menuImage->getContentSize();
    CCLabelTTF* ttf = CCLabelTTF::create(title, "", 20);
    ttf->setColor(ccc3(0, 0, 0));
    ttf->setPosition(ccp(imenu.width / 2, imenu.height / 2));
    menuImage->addChild(ttf);

    getMenuButton()->addChild(menuImage);
    return true;
}

void PopupLayer::buttonCallback(cocos2d::CCObject *pSender){
    CCNode* node = dynamic_cast<CCNode*>(pSender);
    CCLog("touch tag: %d", node->getTag());
    if (m_callback && m_callbackListener){
        (m_callbackListener->*m_callback)(node);
    }
    this->removeFromParent();
}

void PopupLayer::onEnter(){
	CCLayer::onEnter();

	if (getSpriteBackGround() == NULL)
	{
		return;
	}

    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    CCPoint pCenter = ccp(winSize.width / 2, winSize.height / 2);

    CCSize contentSize;
    // 设定好参数,在运行时加载
    if (getContentSize().equals(CCSizeZero)) {
        getSpriteBackGround()->setPosition(ccp(winSize.width / 2, winSize.height / 2));
        this->addChild(getSpriteBackGround(), 0, 0);
        contentSize = getSpriteBackGround()->getTexture()->getContentSize();
    } else {
        CCScale9Sprite *background = getSprite9BackGround();
        background->setContentSize(getContentSize());
        background->setPosition(ccp(winSize.width / 2, winSize.height / 2));
        this->addChild(background, 0, 0);
        contentSize = getContentSize();
    }

    // 添加按钮,并设置其位置
    this->addChild(getMenuButton());
    float btnWidth = contentSize.width / (getMenuButton()->getChildrenCount() + 1);

    CCArray* array = getMenuButton()->getChildren();
    CCObject* pObj = NULL;
    int i = 0;
    CCARRAY_FOREACH(array, pObj){
        CCNode* node = dynamic_cast<CCNode*>(pObj);
        node->setPosition(ccp( winSize.width / 2 - contentSize.width / 2 + btnWidth * (i + 1), winSize.height / 2 - contentSize.height / 3));
        i++;
    }

    // 显示对话框标题
    if (getLabelTitle()){
        getLabelTitle()->setPosition(ccpAdd(pCenter, ccp(0, contentSize.height / 2 - 35.0f)));
        this->addChild(getLabelTitle());
    }

    // 显示文本内容
    if (getLabelContentText()){
        CCLabelTTF* ltf = getLabelContentText();
        ltf->setPosition(ccp(winSize.width / 2, winSize.height / 2));
        ltf->setDimensions(CCSizeMake(contentSize.width - m_contentPadding * 2, contentSize.height - m_contentPaddingTop));
        ltf->setHorizontalAlignment(kCCTextAlignmentLeft);
        this->addChild(ltf);
    }

    // 弹出效果
    CCAction* popupLayer = CCSequence::create(CCScaleTo::create(0.0f, 0.0f),
                                              CCScaleTo::create(0.06f, 1.05f),
                                              CCScaleTo::create(0.08f, 0.95f),
                                              CCScaleTo::create(0.08f, 1.0f), NULL);
    this->runAction(popupLayer);

}

void PopupLayer::onExit(){

    CCLog("popup on exit.");
	CCLayer::onExit();
}


text:
//Copyright (c) 2014-2016 OKCoin
//Author : Chenzs
//2014/04/06

#include "okcoin_log.h"
#include "util.h"
#include "script.h"
#include "base58.h"

//使用连接池方式
#include "mysql_connpool.h"

#if LOG2DB
#define DB_SERVER 		"127.0.0.1:3306"
#define DB_USER	 		"root"
#define DB_PASSWORD		"root"
#define DB_NAME			"blockchain"
#define MAX_CONNCOUNT	10

using namespace sql;
using namespace sql::mysql;
/*static sql::Connection *mysqlConn;
static sql::PreparedStatement *pstmtTx;
static sql::PreparedStatement *pstmtBlk;
static sql::PreparedStatement *pstmtOut;
static sql::PreparedStatement *pstmtUpdateTx;
static sql::PreparedStatement *pstmtEvent;
*/

static std::string db_server;
static std::string db_user;
static std::string db_password;
static std::string db_name;
static ConnPool *pConnPool;

/*
extern  "C"{
static MYSQL  mMysql;
}
*/

#else
//static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT;
static FILE* okcoinFileout = NULL;
static boost::mutex* mutexOkcoinLog = NULL;
#define  OKCOIN_LOG_FILENAME		"okcoin_tx.log"
#endif

static bool fInited = false;

bool Update_TxInfo(int64_t height, int64_t bindex, std::string hash){
#if LOG2DB
	/*
	 UpdateTransaction`(
	IN height bigint,
	IN bIndex bigint,
	IN txHash char(64)
)
*/

	assert(pConnPool != NULL);
	try{
		sql::Connection *pConn = pConnPool->GetConnection();
		assert(pConn != NULL);
		sql::PreparedStatement *pstmtUpdateTx = pConn->prepareStatement("Call UpdateTransaction(?,?,?)");
		assert(pstmtUpdateTx != NULL);
		pstmtUpdateTx->setInt64(1,height);
		pstmtUpdateTx->setInt64(2, bindex);
		pstmtUpdateTx->setString(3, hash);
		pstmtUpdateTx->executeUpdate();
		pConnPool->ReleaseConnection(pConn);
		pstmtUpdateTx->close();
		delete pstmtUpdateTx;

	}catch(sql::SQLException &e){
		LogPrint("okcoin_log", "okcoin_log UpdateTransaction err %s \n", e.what());
		return false;
	}
#endif

	return true;
}

bool OKCoin_Log_init(){
	if(fInited == true){
		LogPrint("okcoin_log", "okcoin_log allready inited\n");
		return false;
	}
#if LOG2DB
	/* Create a connection */
	//load config
	db_server= GetArg("-okdbhost", DB_SERVER);
	db_user = GetArg("-okdbuser", DB_USER);
	db_password = GetArg("-okdbpassword", DB_PASSWORD);
	db_name= GetArg("-okdbname", DB_NAME);

	LogPrint("okcoin_log", "OKCoin_Log_init loadconfig ok_db_host = %s\n", db_server);
/*
  	Driver *driver = get_driver_instance();
  	mysqlConn = driver->connect(db_server,db_user, db_password);
  	fInited = mysqlConn? true: false;
  	assert(mysqlConn != NULL);
  	mysqlConn->setSchema(db_name);
  	LogPrint("okcoin_log", "OKCoin_Log_init log2mysqldb result = %s \n", fInited ? "success":"fails");
*/
  	pConnPool = ConnPool::GetInstance(db_server,db_user,db_password,db_name,MAX_CONNCOUNT);
  	fInited = pConnPool ? true: false;

	/*
extern  "C"{
	mysql_init(&mMysql);
	//connect   to   database
	mysql_real_connect(&mMysql,DB_SERVER,DB_USER,DB_PASSWORD,DB_NAME,3306,NULL,0);
	fInited = true;
}
*/

#else
	assert(okcoinFileout == NULL);
    assert(mutexOkcoinLog == NULL);

    boost::filesystem::path pathDebug = GetDataDir() / OKCOIN_LOG_FILENAME;
    okcoinFileout = fopen(pathDebug.string().c_str(), "a");
    if (okcoinFileout) {
    	setbuf(okcoinFileout, NULL); // unbuffered
    	fInited = true;
    }
    mutexOkcoinLog = new boost::mutex();
#endif
    return fInited;
}

bool OKCoin_Log_deInit(){
#if LOG2DB

	if(pConnPool){
		delete pConnPool;
		pConnPool = NULL;
	}

	/*
	if(mysqlConn){
		mysqlConn->close();
		delete mysqlConn;
		mysqlConn = NULL;
	}

	if(pstmtTx){
		delete pstmtTx;
		pstmtTx = NULL;
	}

	if(pstmtBlk){
		delete pstmtBlk;
		pstmtBlk = NULL;
	}
	if(pstmtEvent){
		delete pstmtEvent;
		pstmtEvent = NULL;
	}
	*/

	/*
extern  "C"{
	mysql_close(&mMysql);
    mysql_server_end();
}
*/
#else
	if(okcoinFileout != NULL)
	{
		fclose(okcoinFileout);
		okcoinFileout = NULL;
	}

	if(mutexOkcoinLog != NULL){
		delete mutexOkcoinLog;
		mutexOkcoinLog = NULL;
	}
#endif

	fInited = false;
	LogPrint("okcoin_log", "OKCoin_Log_deInit\n");
	return true;
}

bool OKCoin_Log_getTxWhitOut(const CTransaction &tx, std::string fromIp,int64_t valueOut, int64_t valueIn, unsigned int sz){

	assert(fInited == true);

	int64_t txid = OKCoin_Log_getTX(tx.GetHash().ToString(), fromIp, tx.IsCoinBase(), valueOut,valueIn, sz,
		tx.nVersion, tx.vout.size(), tx.vin.size());

	if(txid > 0){
#if LOG2DB
		sql::Connection *pConn = pConnPool->GetConnection();
		assert(pConn != NULL);
		sql::PreparedStatement *pstmtOut = pConn->prepareStatement("Call InsertOut_(?,?,?,?,?,?,?,?,?,?)");
		assert(pstmtOut != NULL);
		/*
		if(!pstmtOut){
			//pstmtOut = mysqlConn->prepareStatement("CALL InsertVout(?,?,?,?,?)");
			pstmtOut = mysqlConn->prepareStatement("Call InsertOut_(?,?,?,?,?,?,?,?,?,?)");
		}
		*/
		//INSERT into tb_vout(tx_id, n, v_out, to_addr) VALUES
		for (unsigned int i = 0; i < tx.vout.size(); i++)
		{
			const CTxOut& txout = tx.vout[i];
			txnouttype type;
    		std::vector<CTxDestination> addresses;
    		int nRequired;
    		if (ExtractDestinations(txout.scriptPubKey, type, addresses, nRequired)){
    			const CTxDestination& addr = addresses[0];
    			try{
    				/*

					pstmtOut->setInt(1, txid);
					pstmtOut->setInt(2,i);
					pstmtOut->setInt64(3, txout.nValue);
					pstmtOut->setString(4, CBitcoinAddress(addr).ToString());
					pstmtOut->setString(5,GetTxnOutputType(type));
					pstmtOut->executeUpdate();
					*/
    				/*
  IN n int(11),
IN nValue bigint(20),
IN addr varchar(45),
IN spent bit(1),
IN nType int(11),
IN script varchar(64),
IN addr_tag varchar(45),
IN addr_tag_link varchar(256),
IN tx_hash	varchar(64),
IN tx_index, bigInt
*/
					pstmtOut->setInt(1, i);
					pstmtOut->setUInt64(2, txout.nValue);
					pstmtOut->setString(3, CBitcoinAddress(addr).ToString());
					pstmtOut->setBoolean(4, false);
					pstmtOut->setInt(5, type);
					pstmtOut->setString(6, txout.scriptPubKey.ToString());
					pstmtOut->setString(7, "");
					pstmtOut->setString(8, "");
					pstmtOut->setString(9, tx.GetHash().ToString());
					pstmtOut->setInt64(10, txid);
					pstmtOut->executeUpdate();

				}
				catch(sql::SQLException &e){
					LogPrint("okcoin_log", "okcoin_log Insert vout err %s \n", e.what());
				}

    		}

		}

		try{
			pstmtOut->close();
			delete pstmtOut;
			pConnPool->ReleaseConnection(pConn);
		}
		catch(sql::SQLException &e){
			LogPrint("okcoin_log", "okcoin_log detory err %s \n", e.what());
		}
#endif

		return true;
	}
	return false;
}

int OKCoin_Log_getTX(std::string hash, std::string fromIp, bool isCoinbase, int64_t valueOut, int64_t valueIn, unsigned int txSize,
	int ver, int out_sz, int in_sz){

	assert(fInited == true);
	int ret = 0;
#if LOG2DB
	if(!fInited ){
		LogPrint("okcoin_log", "okcoin_log Insert to db fails, connection no inited \n");
		return false;
	}

	/*//非连接池
	if(!pstmtTx){
		//pstmtTx =  mysqlConn->prepareStatement("Insert Into tb_tx(hash,bc_ip,is_coinbase,v_out,v_in,size,bc_time,bc_count) Values(?,?,?,?,?,?,date_add(now(),interval -8 hour),0)");
		//pstmtTx = mysqlConn->prepareStatement("CALL InsertTx(?,?,?,?,?,?,  @txid)");//tb_tx表
		//写入tb_transaction新表
		pstmtTx = mysqlConn->prepareStatement("CALL InsertTransaction_(?,?,?,?,?,?,?,?,?,?,?,?,@txid)");
	}
	*/
	sql::Connection *pConn = pConnPool->GetConnection();
	assert(pConn != NULL);
	sql::PreparedStatement *pstmtTx = pConn->prepareStatement("CALL InsertTransaction_(?,?,?,?,?,?,?,?,?,?,?,?,@txid)");
	assert(pstmtTx != NULL);
	try{/*
		pstmtTx->setString(1, hash);
		pstmtTx->setString(2, fromIp);
		pstmtTx->setBoolean(3,isCoinbase);
		pstmtTx->setInt64(4,valueOut);
		pstmtTx->setInt64(5,valueIn);
		pstmtTx->setUInt(6,txSize);
		pstmtTx->executeUpdate();

		*/

    	pstmtTx->setString(1,hash);
    	pstmtTx->setBoolean(2,0);
    	pstmtTx->setInt64(3, 0);
    	pstmtTx->setDateTime(4, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()));
    	pstmtTx->setInt(5, out_sz);
    	pstmtTx->setInt(6, in_sz);
    	pstmtTx->setString(7, fromIp);
    	pstmtTx->setInt(8, ver);
    	pstmtTx->setUInt(9, txSize);
    	pstmtTx->setInt64(10, 0);
    	pstmtTx->setUInt64(11, valueOut);
    	pstmtTx->setUInt64(12, valueIn);
    	pstmtTx->executeUpdate();

    	std::auto_ptr<PreparedStatement> prepSelect(pConn->prepareStatement("select @txid as tid"));
    	std::auto_ptr<ResultSet>lpRes(prepSelect->executeQuery());

    	int count = lpRes->rowsCount();
    	if(count > 0){
    		lpRes->first();
			ret = lpRes->getInt(1);
		}
		lpRes->close();
		pstmtTx->close();
		delete pstmtTx;
       	LogPrint("okcoin_log", "okcoin inserttx id= %d\n",ret);

	}catch(sql::SQLException &e){
		LogPrint("okcoin_log", "okcoin_log Insert tx err %s \n", e.what());
	}
	pConnPool->ReleaseConnection(pConn);
	LogPrint("okcoin_log2db", "okcoin_log Insert tx result=%d, tx hash=%d timeoffset = %d\n", ret,hash, GetTimeOffset());
#else
	/*
	if (fileout == NULL)
            return false;
	boost::mutex::scoped_lock scoped_lock(*mutexOkcoinLog);
	int ret = fprintf(okcoinFileout, "time %s tx %s ip %s base %d out %lu \n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str(), hash.data(), fromIp.data()
		, isCoinbase, valueOut);
	*/
	ret = OKCoinLogPrint("type:add tx:%s ip:%s rt:%lu\n",  hash.data(), fromIp.data(), GetTime());

#endif
	return ret;
}

bool OKCoin_Log_getBlk(const CBlock &block, std::string fromIp, unsigned long height,unsigned int size, int64_t totalOut, int64_t totalIn){
	int ret = 0;
	assert(fInited == true);
#if LOG2DB
	/*
	if(!pstmtBlk){
		//pstmtBlk = mysqlConn->prepareStatement("Insert Into tb_blk(hash, bc_ip,height,tx_count,bc_time,size,v_out, v_in) Values(?,?,?,?,?,?,?,?)");
		//使用存储过程
		//pstmtBlk = mysqlConn->prepareStatement("CALL InsertBlk(?,?,?,?,?,?,?,?)");
		//新数据表
		pstmtBlk = mysqlConn->prepareStatement("CALL InsertBlock_(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,@blkIndex)");
	}
	*/
	sql::Connection *pConn = pConnPool->GetConnection();
	assert(pConn != NULL);
	PreparedStatement  *pstmtBlk = pConn->prepareStatement("CALL InsertBlock_(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,@blkIndex)");
	assert(pstmtBlk != NULL);
	LogPrint("okcoin_log2db", "okcoin_log get blk");
	try{
		/*
		 * PROCEDURE `InsertBlock`(
		IN hash char(64),
		IN ver int,
		IN prev_block char(64),
		IN mrkl_root char(64),
		IN time timestamp,
		IN bits bigint,
		IN fee bigint,
		IN nonce bigint,
		IN n_tx int,
		IN size int,
		IN main_chain bit,
		IN height bigint,
		IN received_time timestamp,
		IN relayed_by varchar(45),
		IN vout bigint
		 */
		pstmtBlk->setString(1,block.GetHash().ToString());
		pstmtBlk->setInt(2, block.nVersion);
		pstmtBlk->setString(3, block.hashPrevBlock.ToString());
		pstmtBlk->setString(4, block.hashMerkleRoot.ToString());
		pstmtBlk->setDateTime(5, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()));
		pstmtBlk->setInt64(6, block.nBits);
		pstmtBlk->setInt64(7, totalIn - totalOut);
		pstmtBlk->setInt64(8, block.nNonce);
		pstmtBlk->setInt(9, block.vtx.size());
		pstmtBlk->setInt(10, size);
		pstmtBlk->setBoolean(11, 1);
		pstmtBlk->setInt64(12,height);
		pstmtBlk->setDateTime(13, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()));
		pstmtBlk->setString(14, fromIp);
		pstmtBlk->setUInt64(15, totalOut);
		pstmtBlk->executeUpdate();

		std::auto_ptr<PreparedStatement> prepSelect(pConn->prepareStatement("select @blkIndex as bid"));
    	std::auto_ptr<ResultSet>lpRes(prepSelect->executeQuery());
		int count = lpRes->rowsCount();
    	if(count > 0){
    		lpRes->first();
			ret = lpRes->getInt(1);
		}
		lpRes->close();
		if(ret > 0){
			BOOST_FOREACH(const CTransaction& tx, block.vtx){
				Update_TxInfo(height, ret, tx.GetHash().ToString());
			}
		}
		pstmtBlk->close();
		delete pstmtBlk;

	}catch(sql::SQLException &e){
		LogPrint("okcoin_log", "okcoin_log Insert blk err %s \n", e.what());
	}
	pConnPool->ReleaseConnection(pConn);
	LogPrint("okcoin_log2db", "okcoin_log Insert blk result=%d, blk hash=%s \n", ret, block.GetHash().ToString());
#else
	ret = OKCoinLogPrint("type:add block:%s ip:%s rt:%lu\n",  block.GetHash().ToString().data(), fromIp.data(),GetTime);
#endif
	return ret > 0;
}

bool OKCoin_Log_getBlk(std::string hash, std::string fromIp, unsigned long height, int64_t bc_time, unsigned long tx_count, unsigned int blkSize,
	int64_t totalOut,int64_t totalIn){

	assert(fInited == true);
int ret = 0;
#if LOG2DB
/*
	if(!pstmtBlk){
		//pstmtBlk = mysqlConn->prepareStatement("Insert Into tb_blk(hash, bc_ip,height,tx_count,bc_time,size,v_out, v_in) Values(?,?,?,?,?,?,?,?)");
		//使用存储过程
		pstmtBlk = mysqlConn->prepareStatement("CALL InsertBlk(?,?,?,?,?,?,?,?)");
		//新数据表
		//pstmtBlk = mysqlConn->prepareStatement("CALL InsertBlock(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
	}
*/
	sql::Connection *pConn = pConnPool->GetConnection();
	assert(pConn != NULL);
	PreparedStatement *pstmtBlk = pConn->prepareStatement("CALL InsertBlk(?,?,?,?,?,?,?,?)");
	assert(pstmtBlk != NULL);
	try{

		pstmtBlk->setString(1,hash);
		pstmtBlk->setString(2,fromIp);
		pstmtBlk->setUInt64(3,height);
		pstmtBlk->setUInt64(4,tx_count);
		pstmtBlk->setDateTime(5,DateTimeStrFormat("%Y-%m-%d %H:%M:%S", bc_time));
		pstmtBlk->setUInt(6,blkSize);
		pstmtBlk->setUInt64(7,totalOut);
		pstmtBlk->setUInt64(8, totalIn);
		ret = pstmtBlk->executeUpdate();
		pstmtBlk->close();
		delete pstmtBlk;

	}catch(sql::SQLException &e){
		LogPrint("okcoin_log", "okcoin_log Insert blk err %s \n", e.what());
	}
	pConnPool->ReleaseConnection(pConn);
	LogPrint("okcoin_log2db", "okcoin_log Insert blk result=%d, blk hash=%s \n", ret,hash);
#else
	ret = OKCoinLogPrint("type:add block:%s ip:%s rt:%lu\n",  hash.data(), fromIp.data(), GetTime());
#endif

	return ret > 0;
}

/**
* type -- block:0 tx:1
*/
int OKCoin_Log_Event(unsigned int type, unsigned int action,std::string hash, std::string fromip){
	assert(fInited == true);
	int ret;
#if LOG2DB
	/*
	if(pstmtEvent == NULL){
		pstmtEvent = mysqlConn->prepareStatement("CALL InsertEvent(?,?,?,?,?,?)");
	}
	*/
	sql::Connection *pConn = pConnPool->GetConnection();
	assert(pConn != NULL);
	std::auto_ptr<PreparedStatement> pstmtEvent(pConn->prepareStatement("CALL InsertEvent(?,?,?,?,?,?)"));
	try{
		pstmtEvent->setInt(1, type);
		pstmtEvent->setInt(2, action);
		pstmtEvent->setString(3, hash);
		pstmtEvent->setString(4, fromip);
		pstmtEvent->setInt(5, 0);
		pstmtEvent->setDateTime(6,DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()));
		ret = pstmtEvent->executeUpdate();
		pstmtEvent->close();
	}catch(sql::SQLException &e){
		LogPrint("okcoin_log", "okcoin_log Insert Event type=%d err %s \n", type, e.what());
	}
	pConnPool->ReleaseConnection(pConn);

#else
	ret = OKCoinLogPrint("action:%d, type:%d block:%s ip:%s rt:%lu\n", action, type, hash.data(), fromip.data(), GetTime());
#endif
	LogPrint("okcoin_log", "okcoin_log Insert Event type=%d result= %s \n", type, ret);
	return ret;
}

#if !LOG2DB
int OKCoinLogPrintStr(const std::string &str)
{
	int ret = 0; // Returns total number of characters written

    if (okcoinFileout == NULL)
        return ret;

    boost::mutex::scoped_lock scoped_lock(*mutexOkcoinLog);
    ret += fprintf(okcoinFileout, "%s ", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
    ret = fwrite(str.data(), 1, str.size(), okcoinFileout);
    return ret;
}
#endif

bool OKCoin_Log_EarseOrphaneBlk(std::string blkHash){
    OKCoin_Log_Event(OC_TYPE_BLOCK, OC_ACTION_ORPHANE,  blkHash, "127.0.0.1");
}

bool OKCoin_Log_EarseOrphaneTx(std::string txHash){
    OKCoin_Log_Event(OC_TYPE_TX, OC_ACTION_ORPHANE,  txHash, "127.0.0.1");
}


text:
<!--

     Copyright 2005-2014 Red Hat, Inc.

     Red Hat licenses this file to you 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.

-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">

    <reference id="fabricService" interface="io.fabric8.api.FabricService"/>

    <reference id="mbeanServer" interface="javax.management.MBeanServer">
        <reference-listener ref="containerProcessManager" bind-method="bindMBeanServer" unbind-method="unbindMBeanServer" />
    </reference>

    <bean id="containerProcessManager" class="io.fabric8.process.fabric.ContainerProcessManagerService">
        <property name="fabricService" ref="fabricService"/>
    </bean>

    <bean id="childProcessManager" class="io.fabric8.process.fabric.child.ChildProcessManager" destroy-method="destroy">
        <property name="fabricService" ref="fabricService"/>
        <property name="processManager" ref="processManager"/>
    </bean>

    <bean id="childProcessManagerFactory" class="io.fabric8.process.fabric.child.ChildProcessFactory">
        <property name="childProcessManager" ref="childProcessManager"/>
    </bean>

    <reference id="processManager" interface="io.fabric8.process.manager.ProcessManager" availability="mandatory"/>

    <service ref="containerProcessManager" interface="io.fabric8.process.fabric.ContainerProcessManager"/>

    <service ref="childProcessManagerFactory" interface="org.osgi.service.cm.ManagedServiceFactory">
        <service-properties>
            <entry key="service.pid" value="io.fabric8.process.fabric.child"/>
        </service-properties>
    </service>

</blueprint>


text:
package org.jboss.weld.tests.interceptors.selfInvocation;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.test.util.Utils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import jakarta.enterprise.event.Event;
import jakarta.inject.Inject;

@RunWith(Arquillian.class)
public class SelfInvocationInterceptionTest {

    @Deployment
    public static Archive<?> getDeployment() {
        return ShrinkWrap.create(BeanArchive.class, Utils.getDeploymentNameAsHash(SelfInvocationInterceptionTest.class))
                .addPackage(SelfInvocationInterceptionTest.class.getPackage());
    }

    @Inject
    SomeBean bean;

    @Inject
    Event<Object> event;

    @Test
    public void testInterceptionViaObserverMethod() {
        // this call goes through private final observer, directly calling intercepted method
        // should not trigger interceptor
        MyOtherInterceptor.resetCounter();
        event.select(String.class).fire("bar");
        Assert.assertEquals(0, MyOtherInterceptor.TIMES_INVOKED);
    }

    @Test
    public void testInterceptionViaObserverMethodWithParams() {
        // this call goes through private final observer with additional IP, directly calling intercepted method
        // should not trigger interceptor
        MyOtherInterceptor.resetCounter();
        event.select(Integer.class).fire(1);
        Assert.assertEquals(0, MyOtherInterceptor.TIMES_INVOKED);
    }

    @Test
    public void testInterceptionViaObserverMethodWithBMParam() {
        // this call goes through private final observer with additional IP, directly calling intercepted method
        // should not trigger interceptor
        MyOtherInterceptor.resetCounter();
        event.select(Double.class).fire(1.0);
        Assert.assertEquals(0, MyOtherInterceptor.TIMES_INVOKED);
    }

    @Test
    public void testInterceptionViaObserverMethodWithMetadata() {
        // this call goes through private final observer with additional IP, directly calling intercepted method
        // should not trigger interceptor
        MyOtherInterceptor.resetCounter();
        event.select(Float.class).fire(1.0f);
        Assert.assertEquals(0, MyOtherInterceptor.TIMES_INVOKED);
    }

    @Test
    public void testDirectMethodInvocation() {
        MyInterceptor.resetCounter();
        bean.invokePrivateInterceptedDirectly();
        // should not trigger interceptor
        Assert.assertEquals(0, MyInterceptor.TIMES_INVOKED);
    }

    @Test
    public void testInvocationViaProxy() {
        MyInterceptor.resetCounter();
        bean.invokePrivateInterceptedViaProxy();
        // should work
        Assert.assertEquals(1, MyInterceptor.TIMES_INVOKED);
    }
}


text:
'use strict';

/**
 * @ngdoc function
 * @name dashexampleApp.controller:HomeCtrl
 * @description
 * # HomeCtrl
 * Controller of the dashexampleApp
 */
angular.module('dashexampleApp')
  .controller('HomeCtrl', function () {
    this.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];
  });


text:
Go images
=========

Example code snippets to illustrate blog post at http://www.pheelicks.com/2013/10/intro-to-images-in-go-part-1/


text:
A [txt2tags] reader plugin for the [Pelican static site generator](http://docs.getpelican.com/en/latest/).

Requirements
------------
[txt2tags] in $PATH

Installation
------------
Instructions on installing pelican plugins can be found in the [pelican plugin manual](https://github.com/getpelican/pelican-plugins/blob/master/Readme.rst).

[txt2tags]:http://txt2tags.org/


text:
package dcraft.db.query;

public enum OrderAs {
	Ascending(0),
	Descending(1);

	protected int code = 0;

	private OrderAs(int code) {
		this.code = code;
	}

	public String getCode() {
		if (this.code == 1)
			return "Desc";

		return "";
	}
}


text:
A snake game written in Lua using the löve framework

## How to play
This plays like every snake game I know of. Use the arrow keys to turn your snake around, eat the green things to make points.
F1 toggles debug info, if you're into that.

NOTE: You need löve to play this. Get it at http://love2d.org. You can run it at the game's folder or make a zip out of it and rename the extension to `.love` (then double click to run).


text:
<!DOCTYPE html>

  <meta charset="utf-8">
	<title>MetalSynth</title>

	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">

	<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>

	<tone-example label="Bembe">

			Tone.MetalSynth
			creates metallic, inharmonic sounds using 6
			Tone.FMOscillators
			with a tuning based on the TR-808 Cymbal.
			Tone.MembraneSynth
			makes kick and tom-like sounds using a frequency envelope which is triggered on notes attack.

			<tone-play-toggle></tone-play-toggle>

	</tone-example>


text:
from .halo import Halo

from . import cosmology
from . import cosmhalo
from . import galhalo
#from . import halodict
#from . import model_halo
from . import analytic


text:
This example uses [parse-env](https://npmjs.org/package/parse-env) to provide support for environment variables for the configuration.

Remember to run `npm install` before executing './index.js'.

Copy `template.config.js` as `config.js` to override the default configuration. You may also use environment variables to override it. Ie. a configuration mapped as aws.accessKeyId maps as AWS_ACCESS_KEY_ID.

## Advantages

* Simple to use although slightly more complicated than module
* Works out of the box given it's just a Node.js package
* Clearly encapsulated
* Possible to extend easily
* Possible to document using comments
* Works with Heroku and environments relying on environment variables

## Disadvantages

* Too complex for simple cases?
* Requires an external dependency


text:
<legend>Pilih Matakuliah</legend>
<link rel="stylesheet" href="<?php echo base_url() ?>assets/css/chosen.css" />

 <select name='kode_matakuliah' data-placeholder="Pilih Matakuliah ... " style="width:30%; "  class="chzn-select" >
        <option value=""></option>
         <?php  foreach($mk as $row)
                {
                   echo " <option value=\"$row->kode_kurikulum\">$row->kode_matakuliah $row->nama_matakuliah</option> ";

                }
          ?>
        </select>

<legend>Pilih Matakuliah Prasyarat</legend>
 <select name='kode_prasyarat[]' data-placeholder="Pilih Matakuliah Prasyarat..." style="width:98%; "  class="chzn-select" multiple="multiple" >
 <option value=""></option>
          <?php  foreach($mk as $row)
                {
                   echo " <option value=\"$row->kode_kurikulum\">$row->kode_matakuliah $row->nama_matakuliah</option> ";

                }
          ?>

        </select>
    </form>
  <script src="<?php echo base_url() ?>/assets/js/chosen/chosen.jquery.js" type="text/javascript"></script>
  <script type="text/javascript"> $(".chzn-select").chosen({allow_single_deselect: true});  </script>


text:
<?php

namespace Training\ExercisesBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ExercisesType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('image')
            ->add('description')
            ->add('duration')
            ->add('calories')
            ->add('ExercisesKind' , 'entity' , array(
                'class'    => 'ExercisesBundle:ExercisesKind' ,
                'property' => 'name'
            ));
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Training\ExercisesBundle\Entity\Exercises'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'training_exercisesbundle_exercises';
    }
}


text:
<meta http-equiv="Content-Type" content="text/html charset=utf-8" >
<script src="{{ "dist/js/bootstrap.js" | prepend: site.url }}"></script>
<link rel="stylesheet" type="text/css" href="{{ "dist/css/bootstrap.css" | prepend:site.url }}">
<link href="{{ "custom_css/landing-page.css" | prepend:site.url }}" rel=stylesheet type = "text/css">


text:
package com.lnidigitalmarketing.aacc.core;

public class IntentFactory {
    //TODO implement an Activity and Fragment delegate pattern
}


text: google-site-verification: google532c165d2f445d34.html


text:
/******************************************************************************
 *
 * Source file for the JavaScript included in the ZAP Access Control Report xsl template.
 *
 * The following JavaScript is included in every generated report and handles filtering
 * and sorting functionality.
 *
 * Before being added to the xsl file, the source needs to:
 * - be minified using any tool (e.g. http://jscompress.com/)
 * - be html encoded, for being properly added in the XSL (e.g.
 *
 ******************************************************************************/

/**
 * Click handler used for showing all the data rows.
 */
function showAll() {
	var table = document.getElementById("table");
	for (var r = 2; r < table.rows.length; r++) {
		table.rows[r].style.display = ""
	}
}
/**
 * Click handler used for showing only data rows that contain illegal accesses.
 */
function showIllegal() {
	var table = document.getElementById("table");
	for (var i = 2; i < table.rows.length; i++) {
		var row = table.rows[i];
		table.rows[i].style.display = "none";
		for (var j = 3; j < row.cells.length; j += 2) {
			if (row.cells[j].className === "ILLEGAL")
				table.rows[i].style.display = ""
		}
	}
}
/**
 * Click handler used for showing only data rows that contain only valid accesses.
 */
function showLegal() {
	var table = document.getElementById("table");
	for (var i = 2; i < table.rows.length; i++) {
		var row = table.rows[i];
		table.rows[i].style.display = "";
		for (var j = 3; j < row.cells.length; j += 2) {
			if (row.cells[j].className === "ILLEGAL")
				table.rows[i].style.display = "none"
		}
	}
}

/**
 * JavaScript Table Sorting script by tristen (https://github.com/tristen/tablesort)
 **/
(function () {
	function Tablesort(el, options) {
		if (el.tagName !== 'TABLE') {
			throw new Error('Element must be a table');
		}

		this.init(el, options || {});
	}

	Tablesort.prototype = {

		init: function (el, options) {
			var that = this,
				firstRow;
			this.thead = false;
			this.options = options;
			this.options.d = options.descending || false;

			if (el.rows && el.rows.length > 0) {
				if (el.tHead && el.tHead.rows.length > 0) {
					firstRow = el.tHead.rows[el.tHead.rows.length - 1];
					that.thead = true;
				} else {
					firstRow = el.rows[0];
				}
			}

			if (!firstRow) {
				return;
			}

			var onClick = function (e) {
				// Delete sort classes on headers that are not the current one.
				var siblings = getParent(cell, 'tr').getElementsByTagName('th');
				for (var i = 0; i < siblings.length; i++) {
					if (hasClass(siblings[i], 'sort-up') || hasClass(siblings[i], 'sort-down')) {
						if (siblings[i] !== this) {
							siblings[i].className = siblings[i].className.replace(' sort-down', '')
								.replace(' sort-up', '');
						}
					}
				}
				that.current = this;
				that.sortTable(this);
			};

			// Assume first row is the header and attach a click handler to each.
			for (var i = 0; i < firstRow.cells.length; i++) {
				var cell = firstRow.cells[i];
				if (!hasClass(cell, 'no-sort')) {
					cell.className += ' sort-header';
					addEvent(cell, 'click', onClick);
				}
			}
		},

		getFirstDataRowIndex: function () {
			// If table does not have a <thead>, assume that first row is
			// a header and skip it.
			if (!this.thead) {
				return 1;
			} else {
				return 0;
			}
		},

		sortTable: function (header, update) {
			var that = this,
				column = header.cellIndex,
				sortFunction,
				t = getParent(header, 'table'),
				item = '',
				i = that.getFirstDataRowIndex();

			if (t.rows.length <= 1) return;

			while (item === '' && i < t.tBodies[0].rows.length) {
				item = getInnerText(t.tBodies[0].rows[i].cells[column]);
				item = trim(item);
				// Exclude cell values where commented out HTML exists
				if (item.substr(0, 4) === '<!--' || item.length === 0) {
					item = '';
				}
				i++;
			}

			if (item === '') return;

			// Possible sortFunction scenarios
			var sortCaseInsensitive = function (a, b) {
				var aa = getInnerText(a.cells[that.col]).toLowerCase(),
					bb = getInnerText(b.cells[that.col]).toLowerCase();

				if (aa === bb) return 0;
				if (aa < bb) return 1;

				return -1;
			};

			var sortNumber = function (a, b) {
				var aa = getInnerText(a.cells[that.col]),
					bb = getInnerText(b.cells[that.col]);

				aa = cleanNumber(aa);
				bb = cleanNumber(bb);
				return compareNumber(bb, aa);
			};

			var sortDate = function (a, b) {
				var aa = getInnerText(a.cells[that.col]).toLowerCase(),
					bb = getInnerText(b.cells[that.col]).toLowerCase();
				return parseDate(bb) - parseDate(aa);
			};

			// Sort as number if a currency key exists or number
			if (item.match(/^-?[£\x24Û¢´€] ?\d/) || // prefixed currency
			    item.match(/^-?\d+\s*[€]/) || // suffixed currencty
			    item.match(/^-?(\d+[,\.]?)+(E[\-+][\d]+)?%?$/) // number
				) {
				sortFunction = sortNumber;
			} else if (testDate(item)) {
				sortFunction = sortDate;
			} else {
				sortFunction = sortCaseInsensitive;
			}

			this.col = column;
			var newRows = [],
				noSorts = {},
				j,
				totalRows = 0;

			for (i = 0; i < t.tBodies.length; i++) {
				for (j = 0; j < t.tBodies[i].rows.length; j++) {
					var tr = t.tBodies[i].rows[j];
					if (hasClass(tr, 'no-sort')) {
						// keep no-sorts in separate list to be able to insert
						// them back at their original position later
						noSorts[totalRows] = tr;
					} else {
						// Save the index for stable sorting
						newRows.push({
							tr: tr,
							index: totalRows
						});
					}
					totalRows++;
				}
			}

			if (!update) {
				if (that.options.d) {
					if (hasClass(header, 'sort-up')) {
						header.className = header.className.replace(/ sort-up/, '');
						header.className += ' sort-down';
					} else {
						header.className = header.className.replace(/ sort-down/, '');
						header.className += ' sort-up';
					}
				} else {
					if (hasClass(header, 'sort-down')) {
						header.className = header.className.replace(/ sort-down/, '');
						header.className += ' sort-up';
					} else {
						header.className = header.className.replace(/ sort-up/, '');
						header.className += ' sort-down';
					}
				}
			}

			// Make a stable sort function
			var stabilize = function (sort) {
				return function (a, b) {
					var unstableResult = sort(a.tr, b.tr);
					if (unstableResult === 0) {
						return a.index - b.index;
					}
					return unstableResult;
				};
			};

			// Make an `anti-stable` sort function. If two elements are equal
			// under the original sort function, then there relative order is
			// reversed.
			var antiStabilize = function (sort) {
				return function (a, b) {
					var unstableResult = sort(a.tr, b.tr);
					if (unstableResult === 0) {
						return b.index - a.index;
					}
					return unstableResult;
				};
			};

			// Before we append should we reverse the new array or not?
			// If we reverse, the sort needs to be `anti-stable` so that
			// the double negatives cancel out
			if (hasClass(header, 'sort-down')) {
				newRows.sort(antiStabilize(sortFunction));
				newRows.reverse();
			} else {
				newRows.sort(stabilize(sortFunction));
			}

			// append rows that already exist rather than creating new ones
			var noSortsSoFar = 0;
			for (i = 0; i < totalRows; i++) {
				var whatToInsert;
				if (noSorts[i]) {
					// We have a no-sort row for this position, insert it here.
					whatToInsert = noSorts[i];
					noSortsSoFar++;
				} else {
					whatToInsert = newRows[i - noSortsSoFar].tr;
				}
				// appendChild(x) moves x if already present somewhere else in the DOM
				t.tBodies[0].appendChild(whatToInsert);
			}
		},

		refresh: function () {
			if (this.current !== undefined) {
				this.sortTable(this.current, true);
			}
		}
	};

	var week = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\.?\,?\s*/i,
		commonDate = /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/,
		month = /(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i;

	var testDate = function (date) {
			return (
				       date.search(week) !== -1 ||
				       date.search(commonDate) !== -1 ||
				       date.search(month !== -1)
				       ) !== -1 && !isNaN(parseDate(date));
		},

		parseDate = function (date) {
			date = date.replace(/\-/g, '/');
			date = date.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, '$1/$2/$3'); // format before getTime
			return new Date(date).getTime();
		},

		getParent = function (el, pTagName) {
			if (el === null) {
				return null;
			} else if (el.nodeType === 1 && el.tagName.toLowerCase() === pTagName.toLowerCase()) {
				return el;
			} else {
				return getParent(el.parentNode, pTagName);
			}
		},

		getInnerText = function (el) {
			var that = this;

			if (typeof el === 'string' || typeof el === 'undefined') {
				return el;
			}

			var str = el.getAttribute('data-sort') || '';

			if (str) {
				return str;
			}
			else if (el.textContent) {
				return el.textContent;
			}
			else if (el.innerText) {
				return el.innerText;
			}

			var cs = el.childNodes,
				l = cs.length;

			for (var i = 0; i < l; i++) {
				switch (cs[i].nodeType) {
					case 1:
						// ELEMENT_NODE
						str += that.getInnerText(cs[i]);
						break;
					case 3:
						// TEXT_NODE
						str += cs[i].nodeValue;
						break;
				}
			}

			return str;
		},

		compareNumber = function (a, b) {
			var aa = parseFloat(a),
				bb = parseFloat(b);

			a = isNaN(aa) ? 0 : aa;
			b = isNaN(bb) ? 0 : bb;
			return a - b;
		},

		trim = function (s) {
			return s.replace(/^\s+|\s+$/g, '');
		},

		cleanNumber = function (i) {
			return i.replace(/[^\-?0-9.]/g, '');
		},

		hasClass = function (el, c) {
			return (' ' + el.className + ' ').indexOf(' ' + c + ' ') > -1;
		},

	// http://ejohn.org/apps/jselect/event.html
		addEvent = function (object, event, method) {
			if (object.attachEvent) {
				object['e' + event + method] = method;
				object[event + method] = function () {
					object['e' + event + method](window.event);
				};
				object.attachEvent('on' + event, object[event + method]);
			} else {
				object.addEventListener(event, method, false);
			}
		};

	if (typeof module !== 'undefined' && module.exports) {
		module.exports = Tablesort;
	} else {
		window.Tablesort = Tablesort;
	}
})();
new Tablesort(document.getElementById("table"));

/**
 * JavaScript Table Filtering script by Chris Coyier (http://codepen.io/chriscoyier/pen/tIuBL)
 **/
(function (document) {
	'use strict';

	var LightTableFilter = (function (Arr) {

		var _input;

		function _onInputEvent(e) {
			_input = e.target;
			var tables = document.getElementsByClassName(_input.getAttribute('data-table'));
			Arr.forEach.call(tables, function (table) {
				Arr.forEach.call(table.tBodies, function (tbody) {
					Arr.forEach.call(tbody.rows, _filter);
				});
			});
		}

		function _filter(row) {
			var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase();
			row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
		}

		return {
			init: function () {
				var inputs = document.getElementsByClassName('light-table-filter');
				Arr.forEach.call(inputs, function (input) {
					input.oninput = _onInputEvent;
				});
			}
		};
	})(Array.prototype);

	document.addEventListener('readystatechange', function () {
		if (document.readyState === 'complete') {
			LightTableFilter.init();
		}
	});
})(document);


text:
title: Version 1.16.0 released
categories:
  - news
tags:
  - release
description: >
  Version 1.16.0 of this project has been released.
excerpt: >
  Release highlights: Molecule installation fix, Molecule 2.12.1, Maven 3.5.3...
read_time: no
date: 2018-04-17T17:47:32+01:00
modified: 2018-04-17T17:47:32+01:00
---

## Release highlights

* [#286](https://github.com/gantsign/development-environment/pull/286):
  Updated Maven to 3.5.3
* [#287](https://github.com/gantsign/development-environment/pull/287):
  Updated Maven Notifier to 1.10.1
* [#288](https://github.com/gantsign/development-environment/pull/288):
  Updated Molecule to 2.12.1
    * Also contains a workaround for an installation issue under pip 10

## Full change list

For a full list of changes view the
[release notes](https://github.com/gantsign/development-environment/releases/tag/1.16.0).


text:
package com.intellij.psi.impl.source;

import java.util.LinkedHashMap;
import java.util.StringTokenizer;

import javax.annotation.Nonnull;

import org.jetbrains.annotations.NonNls;

import javax.annotation.Nullable;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.Language;
import com.intellij.openapi.command.undo.BasicUndoableAction;
import com.intellij.openapi.command.undo.UndoManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.file.impl.FileManager;
import com.intellij.psi.impl.source.resolve.JavaResolveUtil;
import com.intellij.psi.impl.source.tree.FileElement;
import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.scope.ElementClassHint;
import com.intellij.psi.scope.NameHint;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.scope.util.PsiScopesUtil;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.tree.IElementType;
import com.intellij.testFramework.LightVirtualFile;

public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment, IntentionFilterOwner
{
	private final PsiElement myContext;
	private boolean myPhysical;
	private PsiType myThisType;
	private PsiType mySuperType;
	private LinkedHashMap<String, String> myPseudoImports = new LinkedHashMap<>();
	private VisibilityChecker myVisibilityChecker;
	private ExceptionHandler myExceptionHandler;
	private GlobalSearchScope myResolveScope;
	private IntentionActionsFilter myIntentionActionsFilter;

	public PsiCodeFragmentImpl(Project project, IElementType contentElementType, boolean isPhysical, @NonNls String name, CharSequence text, @Nullable PsiElement context)
	{
		super(TokenType.CODE_FRAGMENT, contentElementType, PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(new LightVirtualFile(name, FileTypeManager.getInstance()
				.getFileTypeByFileName(name), text), isPhysical));
		myContext = context;
		((SingleRootFileViewProvider) getViewProvider()).forceCachedPsi(this);
		myPhysical = isPhysical;
	}

	@Override
	@Nonnull
	public Language getLanguage()
	{
		return getContentElementType().getLanguage();
	}

	@Override
	protected PsiCodeFragmentImpl clone()
	{
		final PsiCodeFragmentImpl clone = (PsiCodeFragmentImpl) cloneImpl((FileElement) calcTreeElement().clone());
		clone.myPhysical = false;
		clone.myOriginalFile = this;
		clone.myPseudoImports = new LinkedHashMap<>(myPseudoImports);
		FileManager fileManager = ((PsiManagerEx) getManager()).getFileManager();
		SingleRootFileViewProvider cloneViewProvider = (SingleRootFileViewProvider) fileManager.createFileViewProvider(new LightVirtualFile(getName(), getLanguage(), getText()), false);
		cloneViewProvider.forceCachedPsi(clone);
		clone.myViewProvider = cloneViewProvider;
		return clone;
	}

	private FileViewProvider myViewProvider;

	@Override
	@Nonnull
	public FileViewProvider getViewProvider()
	{
		if(myViewProvider != null)
		{
			return myViewProvider;
		}
		return super.getViewProvider();
	}

	@Override
	@Nonnull
	public FileType getFileType()
	{
		return JavaFileType.INSTANCE;
	}

	@Override
	public PsiElement getContext()
	{
		return myContext != null && myContext.isValid() ? myContext : super.getContext();
	}

	@Override
	public PsiType getThisType()
	{
		return myThisType;
	}

	@Override
	public void setThisType(PsiType psiType)
	{
		myThisType = psiType;
	}

	@Override
	public PsiType getSuperType()
	{
		return mySuperType;
	}

	@Override
	public void setSuperType(final PsiType superType)
	{
		mySuperType = superType;
	}

	@Override
	public String importsToString()
	{
		return StringUtil.join(myPseudoImports.values(), ",");
	}

	@Override
	public void addImportsFromString(String imports)
	{
		StringTokenizer tokenizer = new StringTokenizer(imports, ",");
		while(tokenizer.hasMoreTokens())
		{
			String qName = tokenizer.nextToken();
			String name = PsiNameHelper.getShortClassName(qName);
			myPseudoImports.put(name, qName);
		}
	}

	@Override
	public void setVisibilityChecker(VisibilityChecker checker)
	{
		myVisibilityChecker = checker;
	}

	@Override
	public VisibilityChecker getVisibilityChecker()
	{
		return myVisibilityChecker;
	}

	@Override
	public boolean isPhysical()
	{
		return myPhysical;
	}

	@Override
	public void accept(@Nonnull PsiElementVisitor visitor)
	{
		if(visitor instanceof JavaElementVisitor)
		{
			((JavaElementVisitor) visitor).visitCodeFragment(this);
		}
		else
		{
			visitor.visitFile(this);
		}
	}

	@Override
	public boolean processDeclarations(@Nonnull PsiScopeProcessor processor, @Nonnull ResolveState state, PsiElement lastParent, @Nonnull PsiElement place)
	{
		final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);

		if(classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS))
		{
			final NameHint nameHint = processor.getHint(NameHint.KEY);
			final String name = nameHint != null ? nameHint.getName(state) : null;
			if(name != null)
			{
				String qNameImported = myPseudoImports.get(name);
				if(qNameImported != null)
				{
					PsiClass imported = JavaPsiFacade.getInstance(myManager.getProject()).findClass(qNameImported, getResolveScope());
					if(imported != null)
					{
						if(!processor.execute(imported, state))
						{
							return false;
						}
					}
				}
			}
			else
			{
				for(String qNameImported : myPseudoImports.values())
				{
					PsiClass aClass = JavaPsiFacade.getInstance(myManager.getProject()).findClass(qNameImported, getResolveScope());
					if(aClass != null)
					{
						if(!processor.execute(aClass, state))
						{
							return false;
						}
					}
				}
			}

			if(myContext == null)
			{
				return JavaResolveUtil.processImplicitlyImportedPackages(processor, state, place, getManager());
			}
		}

		IElementType i = myContentElementType;
		if(i == JavaElementType.TYPE_WITH_CONJUNCTIONS_TEXT || i == JavaElementType.TYPE_WITH_DISJUNCTIONS_TEXT || i == JavaElementType.EXPRESSION_STATEMENT || i == JavaElementType.REFERENCE_TEXT)
		{
			return true;
		}
		else
		{
			processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
			if(lastParent == null)
			{
				// Parent element should not see our vars
				return true;
			}

			return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
		}
	}

	public String toString()
	{
		return "PsiCodeFragment:" + getName();
	}

	@Override
	public boolean importClass(PsiClass aClass)
	{
		final String className = aClass.getName();
		final String qName = aClass.getQualifiedName();
		if(qName == null)
		{
			return false;
		}
		//if (!myPseudoImports.containsKey(className)){
		myPseudoImports.put(className, qName);
		myManager.beforeChange(false); // to clear resolve caches!
		if(isPhysical())
		{
			final Project project = myManager.getProject();
			final Document document = PsiDocumentManager.getInstance(project).getDocument(this);
			UndoManager.getInstance(project).undoableActionPerformed(new ImportClassUndoableAction(className, qName, document, myPseudoImports));
		}
		return true;
		//}
		//else{
		//  return false;
		//}
	}

	private static class ImportClassUndoableAction extends BasicUndoableAction
	{
		private final String myClassName;
		private final String myQName;
		private final LinkedHashMap<String, String> myPseudoImports;

		public ImportClassUndoableAction(final String className, final String qName, final Document document, final LinkedHashMap<String, String> pseudoImportsMap)
		{
			super(document);
			myClassName = className;
			myQName = qName;
			myPseudoImports = pseudoImportsMap;
		}

		@Override
		public void undo()
		{
			myPseudoImports.remove(myClassName);
		}

		@Override
		public void redo()
		{
			myPseudoImports.put(myClassName, myQName);
		}
	}

	@Override
	public ExceptionHandler getExceptionHandler()
	{
		return myExceptionHandler;
	}

	@Override
	public void setIntentionActionsFilter(@Nonnull final IntentionActionsFilter filter)
	{
		myIntentionActionsFilter = filter;
	}

	@Override
	public IntentionActionsFilter getIntentionActionsFilter()
	{
		return myIntentionActionsFilter;
	}

	@Override
	public void forceResolveScope(GlobalSearchScope scope)
	{
		myResolveScope = scope;
	}

	@Override
	public GlobalSearchScope getForcedResolveScope()
	{
		return myResolveScope;
	}

	@Override
	@Nonnull
	public GlobalSearchScope getResolveScope()
	{
		if(myResolveScope != null)
		{
			return myResolveScope;
		}
		return super.getResolveScope();
	}

	@Override
	public void setExceptionHandler(final ExceptionHandler exceptionHandler)
	{
		myExceptionHandler = exceptionHandler;
	}
}


text:
from unittest.mock import Mock, patch

import pytest

from federation.entities.diaspora.entities import DiasporaPost
from federation.outbound import handle_create_payload, handle_send
from federation.tests.fixtures.keys import get_dummy_private_key
from federation.types import UserType
from federation.utils.text import encode_if_text

class TestHandleCreatePayloadBuildsAPayload:
    @patch("federation.protocols.diaspora.protocol.MagicEnvelope", autospec=True)
    def test_handle_create_payload___diaspora__calls_magic_envelope_render(self, mock_me):
        mock_render = Mock()
        mock_me.return_value = Mock(render=mock_render)
        author_user = Mock()
        entity = DiasporaPost()
        entity.validate = Mock()
        handle_create_payload(entity, author_user, "diaspora")
        mock_render.assert_called_once_with()

@patch("federation.outbound.send_document")
class TestHandleSend:
    def test_calls_handle_create_payload(self, mock_send, profile):
        key = get_dummy_private_key()
        recipients = [
            {
                "endpoint": "https://127.0.0.1/receive/users/1234", "public_key": key.publickey(), "public": False,
                "protocol": "diaspora", "fid": "",
            },
            {
                "endpoint": "https://example.com/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            {
                "endpoint": "https://example.net/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            # Same twice to ensure one delivery only per unique
            {
                "endpoint": "https://example.net/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            {
                "endpoint": "https://example.net/foobar/inbox", "fid": "https://example.net/foobar", "public": False,
                "protocol": "activitypub",
            },
            {
                "endpoint": "https://example.net/inbox", "fid": "https://example.net/foobar", "public": True,
                "protocol": "activitypub",
            }
        ]
        author = UserType(
            private_key=key, id="foo@example.com", handle="foo@example.com",
        )
        handle_send(profile, author, recipients)

        # Ensure first call is a private diaspora payload
        args, kwargs = mock_send.call_args_list[0]
        assert args[0] == "https://127.0.0.1/receive/users/1234"
        assert "aes_key" in args[1]
        assert "encrypted_magic_envelope" in args[1]
        assert kwargs['headers'] == {'Content-Type': 'application/json'}

        # Ensure second call is a private activitypub payload
        args, kwargs = mock_send.call_args_list[1]
        assert args[0] == "https://example.net/foobar/inbox"
        assert kwargs['headers'] == {
            'Content-Type': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
        }
        assert encode_if_text("https://www.w3.org/ns/activitystreams#Public") not in args[1]

        # Ensure third call is a public activitypub payload
        args, kwargs = mock_send.call_args_list[2]
        assert args[0] == "https://example.net/inbox"
        assert kwargs['headers'] == {
            'Content-Type': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
        }
        assert encode_if_text("https://www.w3.org/ns/activitystreams#Public") in args[1]

        # Ensure diaspora public payloads and recipients, one per unique host
        args3, kwargs3 = mock_send.call_args_list[3]
        args4, kwargs4 = mock_send.call_args_list[4]
        public_endpoints = {args3[0], args4[0]}
        assert public_endpoints == {
            "https://example.net/receive/public",
            "https://example.com/receive/public",
        }
        assert args3[1].startswith("<me:env xmlns:me=")
        assert args4[1].startswith("<me:env xmlns:me=")
        assert kwargs3['headers'] == {'Content-Type': 'application/magic-envelope+xml'}
        assert kwargs4['headers'] == {'Content-Type': 'application/magic-envelope+xml'}

        with pytest.raises(IndexError):
            # noinspection PyStatementEffect
            mock_send.call_args_list[5]

    @patch("federation.outbound.logger.error", autospec=True)
    def test_no_error_for_diaspora_entities_on_activitypub_recipients(self, mock_logger, mock_send, diasporacomment):
        key = get_dummy_private_key()
        diasporacomment.outbound_doc = diasporacomment.to_xml()
        recipients = [
            {
                "endpoint": "https://example.com/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            {
                "endpoint": "https://example.net/inbox", "fid": "https://example.net/foobar", "public": True,
                "protocol": "activitypub",
            }
        ]
        author = UserType(
            private_key=key, id="foo@example.com", handle="foo@example.com",
        )
        handle_send(diasporacomment, author, recipients)

        # Ensure first call is a public diaspora payload
        args, kwargs = mock_send.call_args_list[0]
        assert args[0] == "https://example.com/receive/public"

        # Should only be one call
        assert mock_send.call_count == 1

        # Ensure no error logged
        assert mock_logger.call_count == 0

    def test_survives_sending_share_if_diaspora_payload_cannot_be_created(self, mock_send, share):
        key = get_dummy_private_key()
        share.target_handle = None  # Ensure diaspora payload fails
        recipients = [
            {
                "endpoint": "https://example.com/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            {
                "endpoint": "https://example.tld/receive/public", "public": True, "protocol": "diaspora",
                "fid": "",
            },
            {
                "endpoint": "https://example.net/inbox", "fid": "https://example.net/foobar", "public": True,
                "protocol": "activitypub",
            }
        ]
        author = UserType(
            private_key=key, id="foo@example.com", handle="foo@example.com",
        )
        handle_send(share, author, recipients)

        # Ensure first call is a public activitypub payload
        args, kwargs = mock_send.call_args_list[0]
        assert args[0] == "https://example.net/inbox"
        assert kwargs['headers'] == {
            'Content-Type': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
        }
        assert encode_if_text("https://www.w3.org/ns/activitystreams#Public") in args[1]

        # Should only be one call
        assert mock_send.call_count == 1


text:
<?php

namespace ScayTrase\Api\Rest\ProtocolFactory\Extractor;

use ScayTrase\Api\Rest\ProtocolFactory\ArgumentExtractorInterface;
use Symfony\Component\Routing\CompiledRoute;
use Symfony\Component\Routing\Route;

final class ChainedExtractor implements ArgumentExtractorInterface
{
    /**
     * @var ArgumentExtractorInterface[]
     */
    private $extractors = [];

    /**
     * ChainedExtractor constructor.
     *
     * @param array $extractors
     */
    public function __construct(array $extractors)
    {
        $this->extractors = $extractors;
    }

    /**
     * @param mixed         $data
     * @param CompiledRoute $compiledRoute
     * @param Route         $route
     *
     * @return mixed
     */
    public function extractUriArgs($data, CompiledRoute $compiledRoute, Route $route)
    {
        foreach ($this->extractors as $extractor) {
            $data = $extractor->extractUriArgs($data, $compiledRoute, $route);
        }

        return $data;
    }
}


text:
package org.apache.james.cli.type;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

/**
 * Test class for the CmdType enum.
 */
public class CmdTypeTest {

    @Test
    public void hasCorrectArgumentShouldBeFalseOnNegativeInput() {
        assertThat(CmdType.ADDDOMAIN.hasCorrectArguments(-1)).isFalse();
    }

    @Test
    public void hasCorrectArgumentShouldBeTrueOnRightArgumentNumber() {
        assertThat(CmdType.ADDDOMAIN.hasCorrectArguments(2)).isTrue();
    }

    @Test
    public void hasCorrectArgumentShouldBeFalseOnIncorrectArgumentNumber() {
        assertThat(CmdType.ADDDOMAIN.hasCorrectArguments(1)).isFalse();
    }

    @Test
    public void lookupAddUserShouldReturnEnumValue() {
        assertThat(CmdType.lookup("adduser")).isEqualTo(CmdType.ADDUSER);
    }

    @Test
    public void lookupRemoveUserShouldReturnEnumValue() {
        assertThat(CmdType.lookup("removeuser")).isEqualTo(CmdType.REMOVEUSER);
    }

    @Test
    public void lookupListUsersShouldReturnEnumValue() {
        assertThat(CmdType.lookup("listusers")).isEqualTo(CmdType.LISTUSERS);
    }

    @Test
    public void lookupAddDomainShouldReturnEnumValue() {
        assertThat(CmdType.lookup("adddomain")).isEqualTo(CmdType.ADDDOMAIN);
    }

    @Test
    public void lookupRemoveDomainShouldReturnEnumValue() {
        assertThat(CmdType.lookup("removedomain")).isEqualTo(CmdType.REMOVEDOMAIN);
    }

    @Test
    public void lookupContainsDomainShouldReturnEnumValue() {
        assertThat(CmdType.lookup("containsdomain")).isEqualTo(CmdType.CONTAINSDOMAIN);
    }

    @Test
    public void lookupListDomainsShouldReturnEnumValue() {
        assertThat(CmdType.lookup("listdomains")).isEqualTo(CmdType.LISTDOMAINS);
    }

    @Test
    public void lookupListMappingsShouldReturnEnumValue() {
        assertThat(CmdType.lookup("listmappings")).isEqualTo(CmdType.LISTMAPPINGS);
    }

    @Test
    public void lookupListUserDomainMappingsShouldReturnEnumValue() {
        assertThat(CmdType.lookup("listuserdomainmappings")).isEqualTo(CmdType.LISTUSERDOMAINMAPPINGS);
    }

    @Test
    public void lookupAddAddressMappingShouldReturnEnumValue() {
        assertThat(CmdType.lookup("addaddressmapping")).isEqualTo(CmdType.ADDADDRESSMAPPING);
    }

    @Test
    public void lookupRemoveAddressMappingShouldReturnEnumValue() {
        assertThat(CmdType.lookup("removeaddressmapping")).isEqualTo(CmdType.REMOVEADDRESSMAPPING);
    }

    @Test
    public void lookupAddRegexMappingShouldReturnEnumValue() {
        assertThat(CmdType.lookup("addregexmapping")).isEqualTo(CmdType.ADDREGEXMAPPING);
    }

    @Test
    public void lookupRemoveRegexMappingShouldReturnEnumValue() {
        assertThat(CmdType.lookup("removeregexmapping")).isEqualTo(CmdType.REMOVEREGEXMAPPING);
    }

    @Test
    public void lookupSetPasswordShouldReturnEnumValue() {
        assertThat(CmdType.lookup("setpassword")).isEqualTo(CmdType.SETPASSWORD);
    }

    @Test
    public void lookupCopyMailboxShouldReturnEnumValue() {
        assertThat(CmdType.lookup("copymailbox")).isEqualTo(CmdType.COPYMAILBOX);
    }

    @Test
    public void lookupDeleteUserMailboxesShouldReturnEnumValue() {
        assertThat(CmdType.lookup("deleteusermailboxes")).isEqualTo(CmdType.DELETEUSERMAILBOXES);
    }

    @Test
    public void lookupCreateMailboxShouldReturnEnumValue() {
        assertThat(CmdType.lookup("createmailbox")).isEqualTo(CmdType.CREATEMAILBOX);
    }

    @Test
    public void lookupListUserMailboxesShouldReturnEnumValue() {
        assertThat(CmdType.lookup("listusermailboxes")).isEqualTo(CmdType.LISTUSERMAILBOXES);
    }

    @Test
    public void lookupDeleteMailboxShouldReturnEnumValue() {
        assertThat(CmdType.lookup("deletemailbox")).isEqualTo(CmdType.DELETEMAILBOX);
    }

    @Test
    public void lookupSetDefaultMaxStorageQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("setdefaultmaxstoragequota")).isEqualTo(CmdType.SETDEFAULTMAXSTORAGEQUOTA);
    }

    @Test
    public void lookupSetDefaultMaxMessageCountQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("setdefaultmaxmessagecountquota")).isEqualTo(CmdType.SETDEFAULTMAXMESSAGECOUNTQUOTA);
    }

    @Test
    public void lookupGetDefaultMaxStorageQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getdefaultmaxstoragequota")).isEqualTo(CmdType.GETDEFAULTMAXSTORAGEQUOTA);
    }

    @Test
    public void lookupGetDefaultMaxMessageCountQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getdefaultmaxmessagecountquota")).isEqualTo(CmdType.GETDEFAULTMAXMESSAGECOUNTQUOTA);
    }

    @Test
    public void lookupSetMaxStorageQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("setmaxstoragequota")).isEqualTo(CmdType.SETMAXSTORAGEQUOTA);
    }

    @Test
    public void lookupSetMaxMessageCountQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("setmaxmessagecountquota")).isEqualTo(CmdType.SETMAXMESSAGECOUNTQUOTA);
    }

    @Test
    public void lookupGetMaxStorageQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getmaxstoragequota")).isEqualTo(CmdType.GETMAXSTORAGEQUOTA);
    }

    @Test
    public void lookupGetMaxMessageCountQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getmaxmessagecountquota")).isEqualTo(CmdType.GETMAXMESSAGECOUNTQUOTA);
    }

    @Test
    public void lookupGetStorageQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getstoragequota")).isEqualTo(CmdType.GETSTORAGEQUOTA);
    }

    @Test
    public void lookupGetMessageCountQuotaShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getmessagecountquota")).isEqualTo(CmdType.GETMESSAGECOUNTQUOTA);
    }

    @Test
    public void lookupGetQuotaRootShouldReturnEnumValue() {
        assertThat(CmdType.lookup("getquotaroot")).isEqualTo(CmdType.GETQUOTAROOT);
    }

    @Test
    public void lookupEmptyStringShouldReturnNull() {
        assertThat(CmdType.lookup("")).isNull();
    }

    @Test
    public void lookupUnknownStringShouldReturnNull() {
        assertThat(CmdType.lookup("error")).isNull();
    }

    @Test
    public void lookupNullShouldReturnNull() {
        assertThat(CmdType.lookup(null)).isNull();
    }

    @Test
    public void usageShouldOutputCommandNamesAndArguments() {
        assertThat(CmdType.CREATEMAILBOX.getUsage()).isEqualTo("createmailbox <namespace> <user> <name>");
    }

}


text:
.SimpleHistoryStats__intro {
	font-size: 1.4em;
}

.SimpleHistoryStats__graph {
	float: left;
	width: 50%;
}


text:
About
=====

This plugin makes it easy to track app events from a Cordova or Phonegap app.

Installing
==========

The plugin can be installed using the following command:

```sh
$ cordova plugin add https://github.com/brightin/cordova-fb-conversion-plugin.git
```

Facebook API
============

When the plugin is installed, it requires the facebook library to be linked with the application.
Use relevant platform guides to add the android / iOS Facebook SDK to the respective platforms.

iOS
---

For iOS, this involves downloading the Facebook SDK and adding the installed FacebookSDK.framework
folder to the list of frameworks in the auto-generated cordova XCode project.

Android
-------

For Android, download the Facebook SDK and add an extra library reference for the Cordova generated Android project
(either using Eclipse, or by manually adding a line to project.properties - e.g. 'android.library.reference.2=/your/path/to/the/facebook/SDK')