text:
<?php

namespace Webmozart\Expression\Logic;

use Webmozart\Expression\Expr;
use Webmozart\Expression\Expression;

/**
 * A logical literal.
 *
 * In pure logics, a literal is any part of a formula that does not contain
 * "and" or "or" operators. In this package, the definition of a literal is
 * widened to any logical expression that is *not* a conjunction/disjunction.
 *
 * Examples:
 *
 *  * not endsWith(".css")
 *  * greaterThan(0)
 *  * not (greaterThan(0) and lessThan(120))
 *
 * The following examples are *not* literals:
 *
 *  * greaterThan(0) and lessThan(120)
 *  * in(["A", "B", "C]) or null()
 *
 * @since  1.0
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
abstract class Literal implements Expression
{
    public function andX(Expression $expr)
    {
        if ($expr instanceof AlwaysTrue) {
            return $this;
        } elseif ($expr instanceof AlwaysFalse) {
            return $expr;
        }

        if ($this->equivalentTo($expr)) {
            return $this;
        }

        return new Conjunction(array($this, $expr));
    }

    public function andNot(Expression $expr)
    {
        return $this->andX(Expr::not($expr));
    }

    public function andTrue()
    {
        return $this;
    }

    public function andFalse()
    {
        return Expr::false();
    }

    public function andKey($key, Expression $expr)
    {
        return $this->andX(Expr::key($key, $expr));
    }

    public function andAtLeast($count, Expression $expr)
    {
        return $this->andX(Expr::atLeast($count, $expr));
    }

    public function andAtMost($count, Expression $expr)
    {
        return $this->andX(Expr::atMost($count, $expr));
    }

    public function andExactly($count, Expression $expr)
    {
        return $this->andX(Expr::exactly($count, $expr));
    }

    public function andAll(Expression $expr)
    {
        return $this->andX(Expr::all($expr));
    }

    public function andCount(Expression $expr)
    {
        return $this->andX(Expr::count($expr));
    }

    public function andNull($key = null)
    {
        return $this->andX(Expr::null($key));
    }

    public function andNotNull($key = null)
    {
        return $this->andX(Expr::notNull($key));
    }

    public function andEmpty($key = null)
    {
        return $this->andX(Expr::isEmpty($key));
    }

    public function andNotEmpty($key = null)
    {
        return $this->andX(Expr::notEmpty($key));
    }

    public function andEquals($value, $key = null)
    {
        return $this->andX(Expr::equals($value, $key));
    }

    public function andNotEquals($value, $key = null)
    {
        return $this->andX(Expr::notEquals($value, $key));
    }

    public function andSame($value, $key = null)
    {
        return $this->andX(Expr::same($value, $key));
    }

    public function andNotSame($value, $key = null)
    {
        return $this->andX(Expr::notSame($value, $key));
    }

    public function andGreaterThan($value, $key = null)
    {
        return $this->andX(Expr::greaterThan($value, $key));
    }

    public function andGreaterThanEqual($value, $key = null)
    {
        return $this->andX(Expr::greaterThanEqual($value, $key));
    }

    public function andLessThan($value, $key = null)
    {
        return $this->andX(Expr::lessThan($value, $key));
    }

    public function andLessThanEqual($value, $key = null)
    {
        return $this->andX(Expr::lessThanEqual($value, $key));
    }

    public function andIn(array $values, $key = null)
    {
        return $this->andX(Expr::in($values, $key));
    }

    public function andMatches($regExp, $key = null)
    {
        return $this->andX(Expr::matches($regExp, $key));
    }

    public function andStartsWith($prefix, $key = null)
    {
        return $this->andX(Expr::startsWith($prefix, $key));
    }

    public function andEndsWith($suffix, $key = null)
    {
        return $this->andX(Expr::endsWith($suffix, $key));
    }

    public function andContains($string, $key = null)
    {
        return $this->andX(Expr::contains($string, $key));
    }

    public function andKeyExists($keyName, $key = null)
    {
        return $this->andX(Expr::keyExists($keyName, $key));
    }

    public function andKeyNotExists($keyName, $key = null)
    {
        return $this->andX(Expr::keyNotExists($keyName, $key));
    }

    public function orX(Expression $expr)
    {
        if ($expr instanceof AlwaysFalse) {
            return $this;
        } elseif ($expr instanceof AlwaysTrue) {
            return $expr;
        }

        if ($this->equivalentTo($expr)) {
            return $this;
        }

        return new Disjunction(array($this, $expr));
    }

    public function orNot(Expression $expr)
    {
        return $this->orX(Expr::not($expr));
    }

    public function orTrue()
    {
        return Expr::true();
    }

    public function orFalse()
    {
        return $this;
    }

    public function orKey($key, Expression $expr)
    {
        return $this->orX(Expr::key($key, $expr));
    }

    public function orAtLeast($count, Expression $expr)
    {
        return $this->orX(Expr::atLeast($count, $expr));
    }

    public function orAtMost($count, Expression $expr)
    {
        return $this->orX(Expr::atMost($count, $expr));
    }

    public function orExactly($count, Expression $expr)
    {
        return $this->orX(Expr::exactly($count, $expr));
    }

    public function orAll(Expression $expr)
    {
        return $this->orX(Expr::all($expr));
    }

    public function orCount(Expression $expr)
    {
        return $this->orX(Expr::count($expr));
    }

    public function orNull($key = null)
    {
        return $this->orX(Expr::null($key));
    }

    public function orNotNull($key = null)
    {
        return $this->orX(Expr::notNull($key));
    }

    public function orEmpty($key = null)
    {
        return $this->orX(Expr::isEmpty($key));
    }

    public function orNotEmpty($key = null)
    {
        return $this->orX(Expr::notEmpty($key));
    }

    public function orEquals($value, $key = null)
    {
        return $this->orX(Expr::equals($value, $key));
    }

    public function orNotEquals($value, $key = null)
    {
        return $this->orX(Expr::notEquals($value, $key));
    }

    public function orSame($value, $key = null)
    {
        return $this->orX(Expr::same($value, $key));
    }

    public function orNotSame($value, $key = null)
    {
        return $this->orX(Expr::notSame($value, $key));
    }

    public function orGreaterThan($value, $key = null)
    {
        return $this->orX(Expr::greaterThan($value, $key));
    }

    public function orGreaterThanEqual($value, $key = null)
    {
        return $this->orX(Expr::greaterThanEqual($value, $key));
    }

    public function orLessThan($value, $key = null)
    {
        return $this->orX(Expr::lessThan($value, $key));
    }

    public function orLessThanEqual($value, $key = null)
    {
        return $this->orX(Expr::lessThanEqual($value, $key));
    }

    public function orIn(array $values, $key = null)
    {
        return $this->orX(Expr::in($values, $key));
    }

    public function orMatches($regExp, $key = null)
    {
        return $this->orX(Expr::matches($regExp, $key));
    }

    public function orStartsWith($prefix, $key = null)
    {
        return $this->orX(Expr::startsWith($prefix, $key));
    }

    public function orEndsWith($suffix, $key = null)
    {
        return $this->orX(Expr::endsWith($suffix, $key));
    }

    public function orContains($string, $key = null)
    {
        return $this->orX(Expr::contains($string, $key));
    }

    public function orKeyExists($keyName, $key = null)
    {
        return $this->orX(Expr::keyExists($keyName, $key));
    }

    public function orKeyNotExists($keyName, $key = null)
    {
        return $this->orX(Expr::keyNotExists($keyName, $key));
    }

    public function __toString()
    {
        return $this->toString();
    }
}


text:
define(["require", "exports"], function (require, exports) {
    var VAlign = (function () {
        function VAlign() {
        }
        VAlign.BOTTOM = "bottom";
        VAlign.TOP = "top";
        VAlign.CENTER = "center";
        return VAlign;
    })();
    return VAlign;
});

redpajama_set_name: RedPajamaGithub


text:
module NetApp
  module Api

    def netapp_hash
      Hash.new{|h,k| h[k] = Hash.new(&h.default_proc)}
    end

    def connect
      if node['netapp']['url']
        @url = URI.parse(node['netapp']['url'])
        raise ArgumentError, "Invalid scheme #{@url.scheme}. Must be https/http" unless @url.scheme == 'https' || @url.scheme == 'http'
        raise ArgumentError, "no user specified" unless @url.user
        raise ArgumentError, "no password specified" unless @url.password

        @server = NaServer.new(@url.host, 1, 13)
        @server.set_application_name('Chef')
        @server.set_admin_user(@url.user, @url.password)
        @server.set_transport_type(@url.scheme.upcase)
        @server.set_port(@url.port)
        @server.set_timeout(node['netapp']['api']['timeout']) if node['netapp']['api']['timeout']

        if match = %r{/([^/]+)}.match(@url.path)
          @vfiler = match.captures[0]
          @server.set_vfiler(@vfiler) if @vfiler
        end

        redacted_url = "#{@url.scheme.downcase}://#{@url.host}:#{@url.port}/#{@vfiler if @vfiler}"

      else
        raise ArgumentError, "no user specified" unless node['netapp']['user']
        raise ArgumentError, "no password specified" unless node['netapp']['password']
        raise ArgumentError, "no host specified" unless node['netapp']['fqdn']

        @server = NaServer.new(node['netapp']['fqdn'], 1, 13)
        @server.set_application_name('Chef')
        @server.set_admin_user(node['netapp']['user'], node['netapp']['password'])
        @server.set_timeout(node['netapp']['api']['timeout']) if node['netapp']['api']['timeout']
        @server.set_vfiler(node['netapp']['vserver']) if node['netapp']['vserver']

        if node['netapp']['https'] == true
          @server.set_transport_type('HTTPS')
          @server.set_port(443)
        else
          @server.set_transport_type('HTTP')
          @server.set_port(8080)
        end

        redacted_url = "#{@server.get_transport_type().downcase}://#{node['netapp']['fqdn']}:#{@server.get_port()}/#{node['netapp']['vserver'] if node['netapp']['vserver']}"
      end

      if node['netapp']['asup'] == true
        send_asup(redacted_url)
      end

      @server
    end

    def invoke(api_hash)
      request = generate_request(api_hash[:api_name], api_hash[:api_attribute])
      if api_hash[:svm].empty?
        response = invoke_api(request)
      else
        response = invoke_api(request, api_hash[:svm])
      end
      check_errors!(response, api_hash[:resource], api_hash[:action])
    end

    def invoke_api(request, svm = nil)
      @server = connect

      # The vserver name is set as vfiler in case of a tunneled connection.
      @server.set_vfiler(svm) if svm
      @server.invoke_elem(request)
    end

    def check_errors!(result, resource, action)
      if result.results_errno == 0  # The Api ran successfully and returned no error.
        return true
      elsif [EONTAPI_EEXIST, EVDISK_ERROR_VDISK_EXISTS, EVSERVERNAMEEXISTS, 13130, EQTREEEXISTS, EAPIERROR, EVSERVERNOTFOUND, EOBJECTNOTFOUND, EVOLUMEDOESNOTEXIST, EVOLEXISTS].include? result.results_errno.to_i
        #If the resource already exists, then ignore the error and proceed with the next resource.
        #Do not update resource count.
        Chef::Log.debug "Ignoring NetApp API error: #{resource} #{action} failed.Error no- #{result.results_errno}. Reason- #{result.results_reason}."
        return false
      else
        raise "#{resource} #{action} failed.Error no- #{result.results_errno}. Reason- #{result.results_reason}."
      end
    end

    def generate_request(name, value)
      if value.nil?
        netapp_element = NaElement.new(name)
        return netapp_element

      elsif value.is_a? Hash
        netapp_request = NaElement.new(name)
        value.each do |netapp_input_name, input_value|
          netapp_element = generate_request(netapp_input_name, input_value)

          if netapp_element.is_a? Array
            netapp_element.each do |element|
              netapp_request.child_add(element)
            end
          else
            netapp_request.child_add(netapp_element)
          end
        end
        return netapp_request

      elsif value.is_a? Array
        netapp_elements = []
        value.each do |element_val|
          netapp_element = NaElement.new(name, element_val)
          netapp_elements << netapp_element
        end
        return netapp_elements

      else
        netapp_element = NaElement.new(name,value)
        return netapp_element
      end
    end

    def send_asup(redacted_url)

      netapp_asup_api = netapp_hash

      netapp_asup_api[:api_name] = "ems-autosupport-log"
      netapp_asup_api[:api_attribute]["computer-name"] = node['fqdn']
      netapp_asup_api[:api_attribute]["event-id"] = "0"
      netapp_asup_api[:api_attribute]["event-source"] = "Chef::NetApp"
      #TODO: would like to report version of cookbook if possible
      #netapp_asup_api[:api_attribute]["event-source"] = "Chef::NetApp[#{cookbook_version}"
      netapp_asup_api[:api_attribute]["app-version"] = Chef::VERSION
      netapp_asup_api[:api_attribute]["category"] = "provisioning"
      netapp_asup_api[:api_attribute]["event-description"] = "Chef::NetApp managed #{redacted_url}"
      netapp_asup_api[:api_attribute]["log-level"] = "6"
      netapp_asup_api[:api_attribute]["auto-support"] = "false"

      invoke(netapp_asup_api)
    end

  end
end


text:
/**
 * 描述HTTP请求参数对象的处理
 * <ul>
 * <li>{@link javax.servlet.http.HttpServletRequest} 请求参数获取
 * <li>{@link javax.servlet.http.HttpSession} session管理
 * <li>{@link javax.servlet.http.Cookie} cookie管理
 * </ul>
 *
 * @author zhouyang.zhou
 */
package org.glamey.scaffold.web.http;


text:
package simulator

import (
	"context"
	"testing"

	"github.com/vmware/govmomi"
	"github.com/vmware/govmomi/object"
	"github.com/vmware/govmomi/vim25/types"
)

func TestObjectCustomFields(t *testing.T) {
	ctx := context.Background()

	m := VPX()
	defer m.Remove()
	err := m.Create()
	if err != nil {
		t.Fatal(err)
	}

	s := m.Service.NewServer()
	defer s.Close()

	c, err := govmomi.NewClient(ctx, s.URL, true)
	if err != nil {
		t.Fatal(err)
	}

	cfm, err := object.GetCustomFieldsManager(c.Client)
	if err != nil {
		t.Fatal(err)
	}

	vm := Map.Any("VirtualMachine").(*VirtualMachine)
	vmm := object.NewVirtualMachine(c.Client, vm.Reference())

	fieldName := "testField"
	fieldValue := "12345"

	// Test that field is not created
	err = vmm.SetCustomValue(ctx, fieldName, fieldValue)
	if err == nil {
		t.Fatalf("expected error")
	}

	if len(vm.AvailableField) != 0 {
		t.Fatalf("vm.AvailableField length expected 0, got %d", len(vm.AvailableField))
	}

	// Create field
	field, err := cfm.Add(ctx, fieldName, vm.Reference().Type, nil, nil)
	if err != nil {
		t.Fatal(err)
	}

	if len(vm.AvailableField) != 1 {
		t.Fatalf("len(vm.AvailableField) expected 1, got %d", len(vm.AvailableField))
	}

	if vm.AvailableField[0].Key != field.Key {
		t.Fatalf("vm.AvailableField[0].Key expected %d, got %d", field.Key, vm.AvailableField[0].Key)
	}
	if vm.AvailableField[0].Name != field.Name {
		t.Fatalf("vm.AvailableField[0].Name expected %s, got %s", field.Name, vm.AvailableField[0].Name)
	}
	if vm.AvailableField[0].Type != field.Type {
		t.Fatalf("vm.AvailableField[0].Type expected %s, got %s", field.Type, vm.AvailableField[0].Type)
	}
	if vm.AvailableField[0].ManagedObjectType != field.ManagedObjectType {
		t.Fatalf("vm.AvailableField[0].ManagedObjectType expected %s, got %s",
			field.ManagedObjectType, vm.AvailableField[0].ManagedObjectType)
	}
	if vm.AvailableField[0].FieldDefPrivileges != field.FieldDefPrivileges {
		t.Fatalf("vm.AvailableField[0].FieldDefPrivileges expected %s, got %s",
			field.FieldDefPrivileges, vm.AvailableField[0].FieldDefPrivileges)
	}
	if vm.AvailableField[0].FieldInstancePrivileges != field.FieldInstancePrivileges {
		t.Fatalf("vm.AvailableField[0].FieldInstancePrivileges expected %s, got %s",
			field.FieldInstancePrivileges, vm.AvailableField[0].FieldInstancePrivileges)
	}

	// Test that field with duplicate name can't be created
	_, err = cfm.Add(ctx, fieldName, vm.Reference().Type, nil, nil)
	if err == nil {
		t.Fatalf("expected error")
	}

	// Create second field
	_, err = cfm.Add(ctx, fieldName+"2", vm.Reference().Type, nil, nil)
	if err != nil {
		t.Fatal(err)
	}

	if len(vm.AvailableField) != 2 {
		t.Fatalf("len(vm.AvailableField) expected 2, got %d", len(vm.AvailableField))
	}

	// Set field
	err = vmm.SetCustomValue(ctx, fieldName, fieldValue)
	if err != nil {
		t.Fatal(err)
	}

	if len(vm.CustomValue) != 1 {
		t.Fatalf("len(vm.CustomValue) expected 1, got %d", len(vm.CustomValue))
	}

	if len(vm.Value) != 1 {
		t.Fatalf("len(vm.Value) expected 1, got %d", len(vm.Value))
	}

	if vm.CustomValue[0].(*types.CustomFieldStringValue).Key != field.Key {
		t.Fatalf("vm.CustomValue[0].Key expected %d, got %d",
			field.Key, vm.CustomValue[0].(*types.CustomFieldStringValue).Key)
	}
	if vm.CustomValue[0].(*types.CustomFieldStringValue).Value != fieldValue {
		t.Fatalf("vm.CustomValue[0].Value expected %s, got %s",
			fieldValue, vm.CustomValue[0].(*types.CustomFieldStringValue).Value)
	}

	if vm.Value[0].(*types.CustomFieldStringValue).Key != field.Key {
		t.Fatalf("vm.Value[0].Key expected %d, got %d",
			field.Key, vm.Value[0].(*types.CustomFieldStringValue).Key)
	}
	if vm.Value[0].(*types.CustomFieldStringValue).Value != fieldValue {
		t.Fatalf("vm.Value[0].Value expected %s, got %s",
			fieldValue, vm.Value[0].(*types.CustomFieldStringValue).Value)
	}

	// Rename field
	newName := field.Name + "_renamed"
	err = cfm.Rename(ctx, field.Key, newName)
	if err != nil {
		t.Fatal(err)
	}

	if vm.AvailableField[0].Name != newName {
		t.Fatalf("vm.AvailableField[0].Name expected %s, got %s", newName, vm.AvailableField[0].Name)
	}

	// Remove field
	err = cfm.Remove(ctx, field.Key)
	if err != nil {
		t.Fatal(err)
	}

	if len(vm.AvailableField) != 1 {
		t.Fatalf("len(vm.AvailableField) expected 1, got %d", len(vm.AvailableField))
	}

	if len(vm.CustomValue) != 0 {
		t.Fatalf("len(vm.CustomValue) expected 0, got %d", len(vm.CustomValue))
	}

	if len(vm.Value) != 0 {
		t.Fatalf("len(vm.Value) expected 0, got %d", len(vm.Value))
	}

	// Test that remaining field key is different from removed field
	if vm.AvailableField[0].Key == field.Key {
		t.Fatalf("vm.AvailableField[0].Key expected to not be equal %d", field.Key)
	}

	// Remove remaining field
	err = cfm.Remove(ctx, vm.AvailableField[0].Key)
	if err != nil {
		t.Fatal(err)
	}

	if len(vm.AvailableField) != 0 {
		t.Fatalf("len(vm.AvailableField) expected 0, got %d", len(vm.AvailableField))
	}
}


text:
A basic process set that integrates data flowing through a rabbitMQ server combined with a NodeJS server that subsequently makes the data available via websockets (socket I/O)

## Getting started

(`$ ...` indicates entries to the command line)

* [download and install RabbitMQ](http://www.rabbitmq.com/download.html)
* clone this repo `$ git clone https://github.com/openfin/openfinMQ.git`
* install dependencies `$ npm install`
* install bower dependencies:
	* cd into the client directory `$ cd client`
	* `bower install`
* start server `$ rabbitmq-server`
* start publisher (from root directory) `$ node server/publisher.js`
* start index (from root directory) `$ node server/server.js`

## Hooking up to OpenFin

To run the web client as an OpenFin application

*	Create an OpenFin app via our [generator](https://github.com/openfin/generator-openfin)
* In the OpenFin project's directory, edit the file `public/app.json` so the `url` key points to the node server (defaults to localhost:3000)
````js
{
    "startup_app": {
    		...
        "url": <Your Path Goes Here>,
				...
    },
    "runtime": {
        ...
    },
    "shortcut": {
        ...
    }
}

````

## Hooking up your own data

If you have your own data source you can hook it up to the Angular app. You would have to connect to your WebSocket and swap out the call to `socket.on(...)` in `client/scripts/controllers/main.js` to one that handles the socket you connected to.

The structure of the json the app expects is an object that contains a `demo` key which is an array of objects structured as follows:
````js
{
	demo: [{
		spread: "5YR/10YR",
		bps: 120,
		change: 2,
		dv01: 12,
		hedge: 3

	},
	{
		...
	}]
}
````

## Disclaimers
* This is an open source project and all are encouraged to contribute.
* Its possible that the repo is not actively maintained.

## Support
Please enter an issue in the repo for any questions or problems.
<br> Alternatively, please contact us at support@openfin.co


text:
describe('Without predefined events', function () {

    let test;

    class Test extends EventTargetExtendable {

    }

    beforeEach(function () {
        test = new Test();
    });

    afterEach(function () {
        test.removeAllListeners();
    });

    it('Instance should extends EventTargetExtendable', function () {
        expect(test instanceof EventTargetExtendable).toBe(true);
    });

    it('Listener should be added', function () {
        let added = test.addEventListener('test', function () {});
        expect(added).toBe(true);
    });

    it('Listener should be added and fired', function () {
        let fired = false,
            added = test.addEventListener('test', function () {
                fired = true;
            });
        test.dispatchEvent('test');
        expect(added).toBe(true);
        expect(fired).toBe(true);
    });

    it('Event argument should be passed', function () {
        let arg = null,
            data = 'test String';
        test.addEventListener('test', function (data) {
            arg = data;
        });
        test.dispatchEvent('test', data);
        expect(arg).toBe(data);
    });

    it('Few arguments should be passed', function () {
        let argsCount = 0;
        test.addEventListener('test', function (data) {
            argsCount = arguments.length;
        });
        test.dispatchEvent('test', 1, 2, 3);
        expect(argsCount).toBe(3);
    });

    it('Should not be able to add the same listener twice', function () {
        let listener = function () {},
            added1 = test.addEventListener('test', listener),
            added2 = test.addEventListener('test', listener);
        expect(added1).toBe(true);
        expect(added2).toBe(false);
    });

    it('Should execute more than 1 listener', function () {
        let res1, res2,
            listener1 = function () {res1 = true},
            listener2 = function () {res2 = true},
            added1 = test.addEventListener('test', listener1),
            added2 = test.addEventListener('test', listener2);
        test.dispatchEvent('test');
        expect(added1).toBe(true);
        expect(added2).toBe(true);
        expect(res1).toBe(true);
        expect(res2).toBe(true);
    });

    it('Should remove listener', function () {
        let res1 = 0,
            listener1 = function () {res1++};
        test.addEventListener('test', listener1);
        test.dispatchEvent('test');
        expect(res1).toBe(1);
        test.removeEventListener('test', listener1);
        test.dispatchEvent('test');
        expect(res1).toBe(1);
    });

    it('Should remove all listeners for specified type', function () {
        let results = [];
        test.addEventListener('test1', function () {
            results.push(1);
        });
        test.addEventListener('test1', function () {
            results.push(1);
        });
        test.addEventListener('test2', function () {
            results.push(1);
        });
        test.addEventListener('test2', function () {
            results.push(1);
        });
        test.dispatchEvent('test1');
        expect(results.length).toBe(2);
        test.dispatchEvent('test2');
        expect(results.length).toBe(4);
        test.removeAllListeners('test2');
        test.dispatchEvent('test1');
        expect(results.length).toBe(6);
        test.dispatchEvent('test2');
        expect(results.length).toBe(6);
    });

    it('Should remove all listeners', function () {
        let results = [];
        test.addEventListener('test1', function () {
            results.push(1);
        });
        test.addEventListener('test1', function () {
            results.push(1);
        });
        test.addEventListener('test2', function () {
            results.push(1);
        });
        test.addEventListener('test2', function () {
            results.push(1);
        });
        test.dispatchEvent('test1');
        expect(results.length).toBe(2);
        test.dispatchEvent('test2');
        expect(results.length).toBe(4);
        test.removeAllListeners();
        test.dispatchEvent('test1');
        expect(results.length).toBe(4);
        test.dispatchEvent('test2');
        expect(results.length).toBe(4);
    });

});


text:
package main

import (
	"fmt"

	"github.com/epshteyndv/nfo-creator/anidb"
	"github.com/epshteyndv/nfo-creator/trigramIndex"
)

func main() {
	db := anidb.ReadFromFile("anime-titles.xml")

	idx := trigramIndex.Create()

	for _, anime := range db.Animes {
		idx.AddItem(anime.MainTitle, anime)
	}

	for _, result := range idx.Find("Working") {
		anime := result.Item.(*anidb.Anime)
		fmt.Println(anime.MainTitle)
	}

	fmt.Println("--end--")
}


text:
package net.bitm.items;

import net.bitm.creativeTab;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemPickaxe;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class bemeraldpick extends ItemPickaxe {

	public bemeraldpick(ToolMaterial par2ToolMaterial){
		super(par2ToolMaterial);
		this.maxStackSize = 1;
		this.setCreativeTab(creativeTab.bonetabTools);
		this.setUnlocalizedName("bemeraldpick");

	}
	@Override
	@SideOnly(Side.CLIENT)
	public void registerIcons(IIconRegister register){
		itemIcon = register.registerIcon("bitm" + ":" + "bemeraldpick");
	}
}


text:
from django.contrib import admin
from trigger.models import Trigger, Event

# Register your models here.
admin.site.register(Trigger)
admin.site.register(Event)


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>


text:
#ifndef SkSurface_DEFINED
#define SkSurface_DEFINED

#include "SkRefCnt.h"
#include "SkImage.h"
#include "SkSurfaceProps.h"

class SkCanvas;
class SkPaint;
class GrContext;
class GrRenderTarget;

/**
 *  SkSurface represents the backend/results of drawing to a canvas. For raster
 *  drawing, the surface will be pixels, but (for example) when drawing into
 *  a PDF or Picture canvas, the surface stores the recorded commands.
 *
 *  To draw into a canvas, first create the appropriate type of Surface, and
 *  then request the canvas from the surface.
 *
 *  SkSurface always has non-zero dimensions. If there is a request for a new surface, and either
 *  of the requested dimensions are zero, then NULL will be returned.
 */
class SK_API SkSurface : public SkRefCnt {
public:
    SK_DECLARE_INST_COUNT(SkSurface)

    /**
     *  Indicates whether a new surface or image should count against a cache budget. Currently this
     *  is only used by the GPU backend (sw-raster surfaces and images are never counted against the
     *  resource cache budget.)
     */
    enum Budgeted {
        /** The surface or image does not count against the cache budget. */
        kNo_Budgeted,
        /** The surface or image counts against the cache budget. */
        kYes_Budgeted
    };

    /**
     *  Create a new surface, using the specified pixels/rowbytes as its
     *  backend.
     *
     *  If the requested surface cannot be created, or the request is not a
     *  supported configuration, NULL will be returned.
     */
    static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
                                      const SkSurfaceProps* = NULL);

    /**
     *  The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
     *  when the surface is deleted, and is passed the pixel memory and the specified context.
     */
    static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
                                                 void (*releaseProc)(void* pixels, void* context),
                                                 void* context, const SkSurfaceProps* = NULL);

    /**
     *  Return a new surface, with the memory for the pixels automatically
     *  allocated.
     *
     *  If the requested surface cannot be created, or the request is not a
     *  supported configuration, NULL will be returned.
     */
    static SkSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps* = NULL);

    /**
     *  Helper version of NewRaster. It creates a SkImageInfo with the
     *  specified width and height, and populates the rest of info to match
     *  pixels in SkPMColor format.
     */
#ifdef SK_SUPPORT_LEGACY_NewRasterPMColor
    static SkSurface* NewRasterPMColor(int width, int height, const SkSurfaceProps* props = NULL) {
        return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
    }
#endif
    static SkSurface* NewRasterN32Premul(int width, int height, const SkSurfaceProps* props = NULL) {
        return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
    }

    /**
     *  Return a new surface using the specified render target.
     */
    static SkSurface* NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*);

    static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
        return NewRenderTargetDirect(target, NULL);
    }

    /**
     *  Return a new surface whose contents will be drawn to an offscreen
     *  render target, allocated by the surface.
     */
    static SkSurface* NewRenderTarget(GrContext*, Budgeted, const SkImageInfo&, int sampleCount,
                                      const SkSurfaceProps* = NULL);

    static SkSurface* NewRenderTarget(GrContext* gr, Budgeted b, const SkImageInfo& info) {
        return NewRenderTarget(gr, b, info, 0, NULL);
    }

    int width() const { return fWidth; }
    int height() const { return fHeight; }

    /**
     *  Returns a unique non-zero, unique value identifying the content of this
     *  surface. Each time the content is changed changed, either by drawing
     *  into this surface, or explicitly calling notifyContentChanged()) this
     *  method will return a new value.
     *
     *  If this surface is empty (i.e. has a zero-dimention), this will return
     *  0.
     */
    uint32_t generationID();

    /**
     *  Modes that can be passed to notifyContentWillChange
     */
    enum ContentChangeMode {
        /**
         *  Use this mode if it is known that the upcoming content changes will
         *  clear or overwrite prior contents, thus making them discardable.
         */
        kDiscard_ContentChangeMode,
        /**
         *  Use this mode if prior surface contents need to be preserved or
         *  if in doubt.
         */
        kRetain_ContentChangeMode,
    };

    /**
     *  Call this if the contents are about to change. This will (lazily) force a new
     *  value to be returned from generationID() when it is called next.
     */
    void notifyContentWillChange(ContentChangeMode mode);

    /**
     *  Return a canvas that will draw into this surface. This will always
     *  return the same canvas for a given surface, and is manged/owned by the
     *  surface. It should not be used when its parent surface has gone out of
     *  scope.
     */
    SkCanvas* getCanvas();

    /**
     *  Return a new surface that is "compatible" with this one, in that it will
     *  efficiently be able to be drawn into this surface. Typical calling
     *  pattern:
     *
     *  SkSurface* A = SkSurface::New...();
     *  SkCanvas* canvasA = surfaceA->newCanvas();
     *  ...
     *  SkSurface* surfaceB = surfaceA->newSurface(...);
     *  SkCanvas* canvasB = surfaceB->newCanvas();
     *  ... // draw using canvasB
     *  canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
     */
    SkSurface* newSurface(const SkImageInfo&);

    /**
     *  Returns an image of the current state of the surface pixels up to this
     *  point. Subsequent changes to the surface (by drawing into its canvas)
     *  will not be reflected in this image. If a copy must be made the Budgeted
     *  parameter controls whether it counts against the resource budget
     *  (currently for the gpu backend only).
     */
    SkImage* newImageSnapshot(Budgeted = kYes_Budgeted);

    /**
     *  Though the caller could get a snapshot image explicitly, and draw that,
     *  it seems that directly drawing a surface into another canvas might be
     *  a common pattern, and that we could possibly be more efficient, since
     *  we'd know that the "snapshot" need only live until we've handed it off
     *  to the canvas.
     */
    void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);

    /**
     *  If the surface has direct access to its pixels (i.e. they are in local
     *  RAM) return the const-address of those pixels, and if not null, return
     *  the ImageInfo and rowBytes. The returned address is only valid while
     *  the surface object is in scope, and no API call is made on the surface
     *  or its canvas.
     *
     *  On failure, returns NULL and the info and rowBytes parameters are
     *  ignored.
     */
    const void* peekPixels(SkImageInfo* info, size_t* rowBytes);

    /**
     *  Copy the pixels from the surface into the specified buffer (pixels + rowBytes),
     *  converting them into the requested format (dstInfo). The surface pixels are read
     *  starting at the specified (srcX,srcY) location.
     *
     *  The specified ImageInfo and (srcX,srcY) offset specifies a source rectangle
     *
     *      srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height());
     *
     *  srcR is intersected with the bounds of the base-layer. If this intersection is not empty,
     *  then we have two sets of pixels (of equal size). Replace the dst pixels with the
     *  corresponding src pixels, performing any colortype/alphatype transformations needed
     *  (in the case where the src and dst have different colortypes or alphatypes).
     *
     *  This call can fail, returning false, for several reasons:
     *  - If srcR does not intersect the surface bounds.
     *  - If the requested colortype/alphatype cannot be converted from the surface's types.
     */
    bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
                    int srcX, int srcY);

    const SkSurfaceProps& props() const { return fProps; }

protected:
    SkSurface(int width, int height, const SkSurfaceProps*);
    SkSurface(const SkImageInfo&, const SkSurfaceProps*);

    // called by subclass if their contents have changed
    void dirtyGenerationID() {
        fGenerationID = 0;
    }

private:
    const SkSurfaceProps fProps;
    const int            fWidth;
    const int            fHeight;
    uint32_t             fGenerationID;

    typedef SkRefCnt INHERITED;
};

#endif


text:
define([
    'jquery',
    'underscore',
    'backbone',
    'text!templates/SchemaView.html'
], function($, _, Backbone, SchemaViewTemplate) {

    var SchemaView = Backbone.View.extend({

        initialize: function(params) {
            //this.dataset = params.dataset;
            //this.id = params.id;
            //this.collectionName = params.collectionName;

            this.container = $('#content');
            this.render();

            if (params && params.dataset) {
                this.dataset = params.dataset;
                if (params.schemaId) {
                    this.schemaId = params.schemaId;
                    this.getJson();
                }

            }

        },

        events: {
            //'click .viewjson': 'viewJson',
            //'click .viewtable': 'viewTable'
            'click #btnSchemaId': 'getSchemaById',
            'change #dataset': 'changeDataset',
            'click a.accordion-toggle': 'showCollapsedTarget',
            'click a.pointer-to-class': 'showClassFromPointer'
        },

        setDatasets: function() {
            var self = this;
            var deferredObject = $.Deferred();
            $.getJSON('/dataset', function(datasets) {
                var html = '';

                datasets.forEach(function(dataset) {

                    if (dataset.schema) {
                        if (self.dataset && self.dataset === dataset.name) {
                            html += '<option class="datasetOption" selected="true" value="' + dataset.name + '">' + dataset.name + '</option>';
                        } else {
                            html += '<option class="datasetOption" value="' + dataset.name + '">' + dataset.name + '</option>';
                        }
                    }

                });
                self.$el.find('#dataset').html(html);

                deferredObject.resolve();
            });

            return deferredObject.promise();
        },

        changeDataset: function() {
            this.dataset = this.$el.find('#dataset').val();
            this.setIds();
        },

        setIds: function() {
            this.dataset = this.$el.find('#dataset').val();
            var self = this;
            $.getJSON('/schema_ids?dataset=' + self.dataset, function(schemaIds) {
                var html = '';
                schemaIds.forEach(function(schemaId) {

                    if  (self.schemaId && self.schemaId === schemaId.id) {
                        html += '<option class="schemaIdOption" selected="true" value="' + schemaId.id + '">' + schemaId.label + '</option>';
                    } else {
                        html += '<option class="schemaIdOption" value="' + schemaId.id + '">' + schemaId.label + '</option>';

                    }

                });
                self.$el.find('#schema-id').html(html);
            });
        },

        getSchemaById: function() {
            this.schemaId = this.$el.find('#schema-id').val();
            this.dataset = this.$el.find('#dataset').val();

            //this.$el.find('#pgrafContent').html(patientId + ' ' + domain);
            this.getJson();

        },

        showClassFromPointer: function(element) {
            this.schemaId = element.target.attributes.getNamedItem('data-schema-id').value;
            $('option.datasetOption[value="' + this.dataset +'"]').attr('selected', 'true');
            $('option.schemaIdOption[value="' + this.schemaId +'"]').attr('selected', 'true');

            $('body').scrollTop(0);
            this.getJson();
        },

        getJson: function() {
            var self = this;
            //show loading..
            this.$el.find('#schemaByIdContent').html('
 loading data...please wait.');

            var url = '/schema?dataset=' + this.dataset + '&id=' + this.schemaId;
            $.getJSON(url, function(data) {
                var html = '';

                html = '
Raw schema data:

' + JSON.stringify(data, undefined, 2) + '

';
                self.$el.find('#schemaByIdContent').html(html);

                if (data.properties) {
                    var filemanNo = data.id;
                    if (data.fmDD && data.fmDD.length > 0) {
                        filemanNo = data.fmDD.substring(5);
                    }
                    var descriptionHtml = '
' + data.label + ' (' + filemanNo + ') Schema Properties:

';

                    if (data.description && data.description.length > 0) {
                        var descriptionString = '' + data.description;
                        descriptionString = descriptionString.trim().replace(/\r/g, '
');
                        descriptionHtml += descriptionString + '

';
                    }

                    var descriptionsTable = self.buildEmbeddedClassSubtableRow(self, data);

                    descriptionHtml += descriptionsTable;
                    if (data.clinicalClass && data.clinicalClass.id) {
                        self.$el.find('#schemaType').html('
 CLINICAL (' + data.clinicalClass.id + ')
');
                        Backbone.history.navigate('clinical/' + self.dataset + '/' + self.schemaId, {trigger: "true"});
                    } else {
                        Backbone.history.navigate('schema/' + self.dataset + '/' + self.schemaId, {trigger: "true"});
                    }

                    self.$el.find('#schemaDescription').html(descriptionHtml);
                }
            });
        },

        buildEnumerationSubtableRow: function(range, target) {
            var html = '';
            var divOpenTagCollapse = '
';
            var divCloseTag = '
';
            var enumerationsTable = '

';

            if (range && range.length > 0) {

                var enumerationsListAsString = '';

                for (var i = 0; i < range.length; i++){
                    if (enumerationsListAsString) {
                        enumerationsListAsString += "; ";
                    }
                    enumerationsListAsString += range[i];
                }
                enumerationsTable += '
 	';
                enumerationsTable += enumerationsListAsString;
                enumerationsTable += '

'

                html += '
' + divOpenTagCollapse
                    + enumerationsTable
                    + divCloseTag + '
';
            }
            return html;
        },

        buildEmbeddedClassSubtableRow: function(self, embeddedClass, target, propertyNum) {
            var html = '';
            var divOpenTagCollapse = '
';
            } else {
                divOpenTagCollapse += '>';
            }

            var divCloseTag = '
';
            var embeddedClassTable = '

';

            if (propertyNum) {
                var filemanNo = embeddedClass.id;
                if (embeddedClass.fmDD && embeddedClass.fmDD.length > 0) {
                    filemanNo = embeddedClass.fmDD.substring(5);
                }
                embeddedClassTable += '
Subclass: ' + embeddedClass.label + ' (' + filemanNo + ')

';
            }

            embeddedClassTable += '
Order	Label	Type	Description

';

            if (embeddedClass && embeddedClass.properties && embeddedClass.properties.length > 0) {
                for (var i = 1; i <= embeddedClass.properties.length; i++) {
                    var currentProperty = embeddedClass.properties[i-1];
                    var currentRow = '';
                    var toggleTargetName;
                    var orderNum = '';
                    if (propertyNum) {
                        orderNum = propertyNum + "." + i;
                    } else {
                        orderNum = i;
                    }
                    toggleTargetName = ('property' + orderNum).replace('.', '-');

                    //currentRow += '
'
                    //    + orderNum + '	'
                    //    + currentProperty.label + '	';

                    currentRow += '
' + orderNum +'	'
                        + currentProperty.label + ' (' + currentProperty.id + ') 	';

                    if (currentProperty.datatype === '[OBJECT]'
                        || currentProperty.datatype === 'ENUMERATION') {
                        currentRow += ''
                            + currentProperty.datatype + ' 	';

                    } else if (currentProperty.datatype === 'POINTER') {
                        if (currentProperty.range && currentProperty.range.id) {
                            currentRow += ''
                                + currentProperty.datatype + ' (' + currentProperty.range.id + ')	';
                        } else {
                            currentRow += currentProperty.datatype + '	';
                        }

                    } else {
                        currentRow += currentProperty.datatype + '	';

                    }

                    if (!currentProperty.description) {
                        currentProperty["description"] = "";
                    }
                    currentRow += currentProperty.description.trim().replace(/\r/g, '
')
                        + '
';

                    //descriptionsString += data.properties[i].description + "\n";

                    if (currentProperty.datatype === '[OBJECT]') {
                        currentRow += self.buildEmbeddedClassSubtableRow(self, currentProperty.range, toggleTargetName, orderNum);

                    } else if (currentProperty.datatype === 'ENUMERATION' ) {
                        // add in the toggle to the property row

                        // add the hidden table
                        currentRow += self.buildEnumerationSubtableRow(currentProperty.range, toggleTargetName);
                    }

                    embeddedClassTable += currentRow;
                }

                embeddedClassTable += '

';
                //descriptionHtml += descriptionsTable;

                if (target) {
                    html += '
	' + divOpenTagCollapse
                        + embeddedClassTable
                        + divCloseTag + '
';
                } else {
                    html += embeddedClassTable;
                }
            }
            return html;
        },

        showCollapsedTarget: function(element) {
            console.log(element);

            console.log(element.target.attributes.getNamedItem('href').value);
            $('div.collapse'+element.target.attributes.getNamedItem('href').value).collapse('toggle');

            if (element.target.children) {
                $('a[href="' + element.target.attributes.getNamedItem('href').value + '"]').find('i').toggleClass('icon-chevron-down icon-chevron-up')
            }

        },

        template: _.template(SchemaViewTemplate),

        render: function() {
            var self = this;
            $(this.el).html(self.template());
            //this.setDatasets();

            var promise = this.setDatasets();
            promise.done(function () {
                self.setIds();
            });

            //this.currentDataset = "chcs-AB";
            //this.setIds();

            this.container.html(self.el);

            return this;
        }

    });

    return SchemaView;
});


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

<TITLE>
SectionTable (POI API Documentation)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.hwpf.model

Class SectionTable

java.lang.Object
  org.apache.poi.hwpf.model.SectionTable

Direct Known Subclasses:
OldSectionTable

@Internal
public class SectionTable
extends java.lang.Object

Author:

Ryan Ackley

Field Summary

protected  java.util.List<SEPX>
_sections

protected  java.util.List<TextPiece>
_text

Constructor Summary

SectionTable()

          So we can know if things are unicode or not

SectionTable(byte[] documentStream,
             byte[] tableStream,
             int offset,
             int size,
             int fcMin,
             TextPieceTable tpt,
             int mainLength)

Method Summary

 void
adjustForInsert(int listIndex,
                int length)

 java.util.List<SEPX>
getSections()

 void
writeTo(HWPFFileSystem sys,
        int fcMin)

          Deprecated.

 void
writeTo(HWPFOutputStream wordDocumentStream,
        HWPFOutputStream tableStream)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

_sections

protected java.util.List<SEPX> _sections

_text

protected java.util.List<TextPiece> _text

Constructor Detail

SectionTable

public SectionTable()

So we can know if things are unicode or not

SectionTable

public SectionTable(byte[] documentStream,
                    byte[] tableStream,
                    int offset,
                    int size,
                    int fcMin,
                    TextPieceTable tpt,
                    int mainLength)

Method Detail

adjustForInsert

public void adjustForInsert(int listIndex,
                            int length)

getSections

public java.util.List<SEPX> getSections()

writeTo

@Deprecated
public void writeTo(HWPFFileSystem sys,
                               int fcMin)
             throws java.io.IOException

Deprecated.

Throws:

java.io.IOException

writeTo

public void writeTo(HWPFOutputStream wordDocumentStream,
                    HWPFOutputStream tableStream)
             throws java.io.IOException

Throws:

java.io.IOException

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2016 The Apache Software Foundation or
        its licensors, as applicable.


text:
package io.truthencode.ddo.model.compendium.types

import io.truthencode.ddo.model.compendium.types.MonsterType.FireOutsider

/**
 * Created by adarr on 3/25/2017.
 */
trait FireOutsiders extends MainType {
  override val mainTypes = Some(FireOutsider)
}


text:
import math
import optparse
import os
import re
import shutil
import subprocess
import sys
import tarfile
import tempfile
import time

progname = os.path.split(sys.argv[0])[1]
myversion = 'V001.1 March 2014'
verbose = False
debug = False
toolFactoryURL = 'https://bitbucket.org/fubar/galaxytoolfactory'

def timenow():
    """return current time as a string
    """
    return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))

html_escape_table = {
    "&": "&",
    ">": ">",
    "<": "<",
    "$": "\$"}

def html_escape(text):
    """Produce entities within text."""
    return "".join(html_escape_table.get(c, c) for c in text)

def cmd_exists(cmd):
    return subprocess.call("type " + cmd, shell=True,
                           stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0

class ScriptRunner:
    """class is a wrapper for an arbitrary script
    """

    def __init__(self, opts=None, treatbashSpecial=True):
        """
        cleanup inputs, setup some outputs
        """
        self.useGM = cmd_exists('gm')
        self.useIM = cmd_exists('convert')
        self.useGS = cmd_exists('gs')
        self.temp_warned = False  # we want only one warning if $TMP not set
        self.treatbashSpecial = treatbashSpecial
        if opts.output_dir:  # simplify for the tool tarball
            os.chdir(opts.output_dir)
        self.thumbformat = 'png'
        self.opts = opts
        self.toolname = re.sub('[^a-zA-Z0-9_]+', '', opts.tool_name)  # a sanitizer now does this but..
        self.toolid = self.toolname
        self.myname = sys.argv[0]  # get our name because we write ourselves out as a tool later
        self.pyfile = self.myname  # crude but efficient - the cruft won't hurt much
        self.xmlfile = '%s.xml' % self.toolname
        s = open(self.opts.script_path, 'r').readlines()
        s = [x.rstrip() for x in s]  # remove pesky dos line endings if needed
        self.script = '\n'.join(s)
        fhandle, self.sfile = tempfile.mkstemp(prefix=self.toolname, suffix=".%s" % (opts.interpreter))
        tscript = open(self.sfile, 'w')  # use self.sfile as script source for Popen
        tscript.write(self.script)
        tscript.close()
        self.indentedScript = '\n'.join([' %s' % x for x in s])  # for restructured text in help
        self.escapedScript = '\n'.join([html_escape(x) for x in s])
        self.elog = os.path.join(self.opts.output_dir, "%s_error.log" % self.toolname)
        if opts.output_dir:  # may not want these complexities
            self.tlog = os.path.join(self.opts.output_dir, "%s_runner.log" % self.toolname)
            art = '%s.%s' % (self.toolname, opts.interpreter)
            artpath = os.path.join(self.opts.output_dir, art)  # need full path
            artifact = open(artpath, 'w')  # use self.sfile as script source for Popen
            artifact.write(self.script)
            artifact.close()
        self.cl = []
        self.html = []
        a = self.cl.append
        a(opts.interpreter)
        if self.treatbashSpecial and opts.interpreter in ['bash', 'sh']:
            a(self.sfile)
        else:
            a('-')  # stdin
        a(opts.input_tab)
        a(opts.output_tab)
        self.outFormats = 'tabular'  # TODO make this an option at tool generation time
        self.inputFormats = 'tabular'  # TODO make this an option at tool generation time
        self.test1Input = '%s_test1_input.xls' % self.toolname
        self.test1Output = '%s_test1_output.xls' % self.toolname
        self.test1HTML = '%s_test1_output.html' % self.toolname

    def makeXML(self):
        """
        Create a Galaxy xml tool wrapper for the new script as a string to write out
        fixme - use templating or something less fugly than this example of what we produce

        <tool id="reverse" name="reverse" version="0.01">
            <description>a tabular file</description>
            <command interpreter="python">
            reverse.py --script_path "$runMe" --interpreter "python"
            --tool_name "reverse" --input_tab "$input1" --output_tab "$tab_file"
            </command>
            <inputs>
            <param name="input1"  type="data" format="tabular" label="Select a suitable input file from your history"/><param name="job_name" type="text" label="Supply a name for the outputs to remind you what they contain" value="reverse"/>

            </inputs>
            <outputs>
            <data format="tabular" name="tab_file" label="${job_name}"/>

            </outputs>
            <help>
**What it Does**

Reverse the columns in a tabular file

            </help>
            <configfiles>
            <configfile name="runMe">
# reverse order of columns in a tabular file
import sys
inp = sys.argv[1]
outp = sys.argv[2]
i = open(inp,'r')
o = open(outp,'w')
for row in i:
     rs = row.rstrip().split('\t')
     rs.reverse()
     o.write('\t'.join(rs))
     o.write('\n')
i.close()
o.close()
            </configfile>
            </configfiles>
            </tool>
        """
        newXML = """<tool id="%(toolid)s" name="%(toolname)s" version="%(tool_version)s">
            %(tooldesc)s
            %(command)s
            <inputs>
            %(inputs)s
            </inputs>
            <outputs>
            %(outputs)s
            </outputs>
            <configfiles>
            <configfile name="runMe">
            %(script)s
            </configfile>
            </configfiles>
            %(tooltests)s
            <help>
            %(help)s
            </help>
            </tool>"""  # needs a dict with toolname, toolid, interpreter, scriptname, command, inputs as a multi line string ready to write, outputs ditto, help ditto

        newCommand = """<command interpreter="python">
            %(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s"
            --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s
            </command>"""  # may NOT be an input or htmlout
        tooltestsTabOnly = """<tests><test>
        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
        <param name="job_name" value="test1"/>
        <param name="runMe" value="$runMe"/>
        <output name="tab_file" file="%(test1Output)s" ftype="tabular"/>
        </test></tests>"""
        tooltestsHTMLOnly = """<tests><test>
        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
        <param name="job_name" value="test1"/>
        <param name="runMe" value="$runMe"/>
        <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="5"/>
        </test></tests>"""
        tooltestsBoth = """<tests><test>
        <param name="input1" value="%(test1Input)s" ftype="tabular"/>
        <param name="job_name" value="test1"/>
        <param name="runMe" value="$runMe"/>
        <output name="tab_file" file="%(test1Output)s" ftype="tabular" />
        <output name="html_file" file="%(test1HTML)s" ftype="html" lines_diff="10"/>
        </test></tests>"""
        xdict = {}
        xdict['tool_version'] = self.opts.tool_version
        xdict['test1Input'] = self.test1Input
        xdict['test1HTML'] = self.test1HTML
        xdict['test1Output'] = self.test1Output
        if self.opts.make_HTML and self.opts.output_tab != 'None':
            xdict['tooltests'] = tooltestsBoth % xdict
        elif self.opts.make_HTML:
            xdict['tooltests'] = tooltestsHTMLOnly % xdict
        else:
            xdict['tooltests'] = tooltestsTabOnly % xdict
        xdict['script'] = self.escapedScript
        # configfile is least painful way to embed script to avoid external dependencies
        # but requires escaping of <, > and $ to avoid Mako parsing
        if self.opts.help_text:
            xdict['help'] = open(self.opts.help_text, 'r').read()
        else:
            xdict['help'] = 'Please ask the tool author for help as none was supplied at tool generation'
        coda = ['**Script**', 'Pressing execute will run the following code over your input file and generate some outputs in your history::']
        coda.append(self.indentedScript)
        coda.append('**Attribution** This Galaxy tool was created by %s at %s\nusing the Galaxy Tool Factory.' % (self.opts.user_email, timenow()))
        coda.append('See %s for details of that project' % (toolFactoryURL))
        coda.append('Please cite: Creating re-usable tools from scripts: The Galaxy Tool Factory. Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team. ')
        coda.append('Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573')
        xdict['help'] = '%s\n%s' % (xdict['help'], '\n'.join(coda))
        if self.opts.tool_desc:
            xdict['tooldesc'] = '<description>%s</description>' % self.opts.tool_desc
        else:
            xdict['tooldesc'] = ''
        xdict['command_outputs'] = ''
        xdict['outputs'] = ''
        if self.opts.input_tab != 'None':
            xdict['command_inputs'] = '--input_tab "$input1" '  # the space may matter a lot if we append something
            xdict['inputs'] = '<param name="input1"  type="data" format="%s" label="Select a suitable input file from your history"/> \n' % self.inputFormats
        else:
            xdict['command_inputs'] = ''  # assume no input - eg a random data generator
            xdict['inputs'] = ''
        xdict['inputs'] += '<param name="job_name" type="text" label="Supply a name for the outputs to remind you what they contain" value="%s"/> \n' % self.toolname
        xdict['toolname'] = self.toolname
        xdict['toolid'] = self.toolid
        xdict['interpreter'] = self.opts.interpreter
        xdict['scriptname'] = self.sfile
        if self.opts.make_HTML:
            xdict['command_outputs'] += ' --output_dir "$html_file.files_path" --output_html "$html_file" --make_HTML "yes" '
            xdict['outputs'] += ' <data format="html" name="html_file" label="${job_name}.html"/>\n'
        if self.opts.output_tab != 'None':
            xdict['command_outputs'] += ' --output_tab "$tab_file"'
            xdict['outputs'] += ' <data format="%s" name="tab_file" label="${job_name}"/>\n' % self.outFormats
        xdict['command'] = newCommand % xdict
        xmls = newXML % xdict
        xf = open(self.xmlfile, 'w')
        xf.write(xmls)
        xf.write('\n')
        xf.close()
        # ready for the tarball

    def makeTooltar(self):
        """
        a tool is a gz tarball with eg
        /toolname/tool.xml /toolname/tool.py /toolname/test-data/test1_in.foo ...
        """
        retval = self.run()
        if retval:
            print >> sys.stderr, '## Run failed. Cannot build yet. Please fix and retry'
            sys.exit(1)
        self.makeXML()
        tdir = self.toolname
        os.mkdir(tdir)
        if self.opts.input_tab != 'None':  # no reproducible test otherwise? TODO: maybe..
            testdir = os.path.join(tdir, 'test-data')
            os.mkdir(testdir)  # make tests directory
            shutil.copyfile(self.opts.input_tab, os.path.join(testdir, self.test1Input))
            if self.opts.output_tab != 'None':
                shutil.copyfile(self.opts.output_tab, os.path.join(testdir, self.test1Output))
            if self.opts.make_HTML:
                shutil.copyfile(self.opts.output_html, os.path.join(testdir, self.test1HTML))
            if self.opts.output_dir:
                shutil.copyfile(self.tlog, os.path.join(testdir, 'test1_out.log'))
        op = '%s.py' % self.toolname  # new name
        outpiname = os.path.join(tdir, op)  # path for the tool tarball
        pyin = os.path.basename(self.pyfile)  # our name - we rewrite ourselves (TM)
        notes = ['# %s - a self annotated version of %s generated by running %s\n' % (op, pyin, pyin), ]
        notes.append('# to make a new Galaxy tool called %s\n' % self.toolname)
        notes.append('# User %s at %s\n' % (self.opts.user_email, timenow()))
        pi = open(self.pyfile, 'r').readlines()  # our code becomes new tool wrapper (!) - first Galaxy worm
        notes += pi
        outpi = open(outpiname, 'w')
        outpi.write(''.join(notes))
        outpi.write('\n')
        outpi.close()
        stname = os.path.join(tdir, self.sfile)
        if not os.path.exists(stname):
            shutil.copyfile(self.sfile, stname)
        xtname = os.path.join(tdir, self.xmlfile)
        if not os.path.exists(xtname):
            shutil.copyfile(self.xmlfile, xtname)
        tarpath = "%s.gz" % self.toolname
        tar = tarfile.open(tarpath, "w:gz")
        tar.add(tdir, arcname=self.toolname)
        tar.close()
        shutil.copyfile(tarpath, self.opts.new_tool)
        shutil.rmtree(tdir)
        # TODO: replace with optional direct upload to local toolshed?
        return retval

    def compressPDF(self, inpdf=None, thumbformat='png'):
        """need absolute path to pdf
           note that GS gets confoozled if no $TMP or $TEMP
           so we set it
        """
        assert os.path.isfile(inpdf), "## Input %s supplied to %s compressPDF not found" % (inpdf, self.myName)
        hlog = os.path.join(self.opts.output_dir, "compress_%s.txt" % os.path.basename(inpdf))
        sto = open(hlog, 'a')
        our_env = os.environ.copy()
        our_tmp = our_env.get('TMP', None)
        if not our_tmp:
            our_tmp = our_env.get('TEMP', None)
        if not (our_tmp and os.path.exists(our_tmp)):
            newtmp = os.path.join(self.opts.output_dir, 'tmp')
            try:
                os.mkdir(newtmp)
            except:
                sto.write('## WARNING - cannot make %s - it may exist or permissions need fixing\n' % newtmp)
            our_env['TEMP'] = newtmp
            if not self.temp_warned:
                sto.write('## WARNING - no $TMP or $TEMP!!! Please fix - using %s temporarily\n' % newtmp)
                self.temp_warned = True
        outpdf = '%s_compressed' % inpdf
        cl = ["gs", "-sDEVICE=pdfwrite", "-dNOPAUSE", "-dUseCIEColor", "-dBATCH", "-dPDFSETTINGS=/printer", "-sOutputFile=%s" % outpdf, inpdf]
        x = subprocess.Popen(cl, stdout=sto, stderr=sto, cwd=self.opts.output_dir, env=our_env)
        retval1 = x.wait()
        sto.close()
        if retval1 == 0:
            os.unlink(inpdf)
            shutil.move(outpdf, inpdf)
            os.unlink(hlog)
        hlog = os.path.join(self.opts.output_dir, "thumbnail_%s.txt" % os.path.basename(inpdf))
        sto = open(hlog, 'w')
        outpng = '%s.%s' % (os.path.splitext(inpdf)[0], thumbformat)
        if self.useGM:
            cl2 = ['gm', 'convert', inpdf, outpng]
        else:  # assume imagemagick
            cl2 = ['convert', inpdf, outpng]
        x = subprocess.Popen(cl2, stdout=sto, stderr=sto, cwd=self.opts.output_dir, env=our_env)
        retval2 = x.wait()
        sto.close()
        if retval2 == 0:
            os.unlink(hlog)
        retval = retval1 or retval2
        return retval

    def getfSize(self, fpath, outpath):
        """
        format a nice file size string
        """
        size = ''
        fp = os.path.join(outpath, fpath)
        if os.path.isfile(fp):
            size = '0 B'
            n = float(os.path.getsize(fp))
            if n > 2**20:
                size = '%1.1f MB' % (n / 2**20)
            elif n > 2**10:
                size = '%1.1f KB' % (n / 2**10)
            elif n > 0:
                size = '%d B' % (int(n))
        return size

    def makeHtml(self):
        """ Create an HTML file content to list all the artifacts found in the output_dir
        """

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

         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="generator" content="Galaxy %s tool output - see http://getgalaxy.org/" />
        <title></title>
        <link rel="stylesheet" href="/static/style/base.css" type="text/css" />

        """
        galhtmlpostfix = """
\n"""

        flist = os.listdir(self.opts.output_dir)
        flist = [x for x in flist if x != 'Rplots.pdf']
        flist.sort()
        html = []
        html.append(galhtmlprefix % progname)
        html.append('
Galaxy Tool "%s" run at %s

' % (self.toolname, timenow()))
        fhtml = []
        if len(flist) > 0:
            logfiles = [x for x in flist if x.lower().endswith('.log')]  # log file names determine sections
            logfiles.sort()
            logfiles = [x for x in logfiles if os.path.abspath(x) != os.path.abspath(self.tlog)]
            logfiles.append(os.path.abspath(self.tlog))  # make it the last one
            pdflist = []
            npdf = len([x for x in flist if os.path.splitext(x)[-1].lower() == '.pdf'])
            for rownum, fname in enumerate(flist):
                dname, e = os.path.splitext(fname)
                sfsize = self.getfSize(fname, self.opts.output_dir)
                if e.lower() == '.pdf':  # compress and make a thumbnail
                    thumb = '%s.%s' % (dname, self.thumbformat)
                    pdff = os.path.join(self.opts.output_dir, fname)
                    retval = self.compressPDF(inpdf=pdff, thumbformat=self.thumbformat)
                    if retval == 0:
                        pdflist.append((fname, thumb))
                    else:
                        pdflist.append((fname, fname))
                if (rownum + 1) % 2 == 0:
                    fhtml.append('
%s	%s
' % (fname, fname, sfsize))
                else:
                    fhtml.append('
%s	%s
' % (fname, fname, sfsize))
            for logfname in logfiles:  # expect at least tlog - if more
                if os.path.abspath(logfname) == os.path.abspath(self.tlog):  # handled later
                    sectionname = 'All tool run'
                    if (len(logfiles) > 1):
                        sectionname = 'Other'
                    ourpdfs = pdflist
                else:
                    realname = os.path.basename(logfname)
                    sectionname = os.path.splitext(realname)[0].split('_')[0]  # break in case _ added to log
                    ourpdfs = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] == sectionname]
                    pdflist = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] != sectionname]  # remove
                nacross = 1
                npdf = len(ourpdfs)

                if npdf > 0:
                    nacross = math.sqrt(npdf)  # int(round(math.log(npdf,2)))
                    if int(nacross)**2 != npdf:
                        nacross += 1
                    nacross = int(nacross)
                    width = min(400, int(1200 / nacross))
                    html.append('
%s images and outputs
' % sectionname)
                    html.append('(Click on a thumbnail image to download the corresponding original PDF image)
')
                    ntogo = nacross  # counter for table row padding with empty cells
                    html.append('

\n
')
                    for i, paths in enumerate(ourpdfs):
                        fname, thumb = paths
                        s = """	\n""" % (fname, thumb, fname, width, fname)
                        if (i + 1) % nacross == 0:
                            s += '
\n'
                            ntogo = 0
                            if i < (npdf - 1):  # more to come
                                s += '
'
                                ntogo = nacross
                        else:
                            ntogo -= 1
                        html.append(s)
                    if html[-1].strip().endswith('
'):
                        html.append('

\n')
                    else:
                        if ntogo > 0:  # pad
                            html.append(' 	' * ntogo)
                        html.append('

\n')
                logt = open(logfname, 'r').readlines()
                logtext = [x for x in logt if x.strip() > '']
                html.append('
%s log output
' % sectionname)
                if len(logtext) > 1:
                    html.append('\n
\n')
                    html += logtext
                    html.append('\n
\n')
                else:
                    html.append('%s is empty
' % logfname)
        if len(fhtml) > 0:
            fhtml.insert(0, '

Output File Name (click to view)	Size
\n')
            fhtml.append('

')
            html.append('
All output files available for downloading
\n')
            html += fhtml  # add all non-pdf files to the end of the display
        else:
            html.append('
### Error - %s returned no files - please confirm that parameters are sane
' % self.opts.interpreter)
        html.append(galhtmlpostfix)
        htmlf = file(self.opts.output_html, 'w')
        htmlf.write('\n'.join(html))
        htmlf.write('\n')
        htmlf.close()
        self.html = html

    def run(self):
        """
        scripts must be small enough not to fill the pipe!
        """
        if self.treatbashSpecial and self.opts.interpreter in ['bash', 'sh']:
            retval = self.runBash()
        else:
            if self.opts.output_dir:
                ste = open(self.elog, 'w')
                sto = open(self.tlog, 'w')
                sto.write('## Toolfactory generated command line = %s\n' % ' '.join(self.cl))
                sto.flush()
                p = subprocess.Popen(self.cl, shell=False, stdout=sto, stderr=ste, stdin=subprocess.PIPE, cwd=self.opts.output_dir)
            else:
                p = subprocess.Popen(self.cl, shell=False, stdin=subprocess.PIPE)
            p.stdin.write(self.script)
            p.stdin.close()
            retval = p.wait()
            if self.opts.output_dir:
                sto.close()
                ste.close()
                err = open(self.elog, 'r').read()
                if retval != 0 and err:  # problem
                    print >> sys.stderr, err
            if self.opts.make_HTML:
                self.makeHtml()
        return retval

    def runBash(self):
        """
        cannot use - for bash so use self.sfile
        """
        if self.opts.output_dir:
            s = '## Toolfactory generated command line = %s\n' % ' '.join(self.cl)
            sto = open(self.tlog, 'w')
            sto.write(s)
            sto.flush()
            p = subprocess.Popen(self.cl, shell=False, stdout=sto, stderr=sto, cwd=self.opts.output_dir)
        else:
            p = subprocess.Popen(self.cl, shell=False)
        retval = p.wait()
        if self.opts.output_dir:
            sto.close()
        if self.opts.make_HTML:
            self.makeHtml()
        return retval

def main():
    """
    This is a Galaxy wrapper. It expects to be called by a special purpose tool.xml as:
    <command interpreter="python">rgToolFactory.py --script_path "$scriptPath" --tool_name "foo" --interpreter "Rscript"
    </command>
    """
    op = optparse.OptionParser()
    a = op.add_option
    a('--script_path', default=None)
    a('--tool_name', default=None)
    a('--interpreter', default=None)
    a('--output_dir', default=None)
    a('--output_html', default=None)
    a('--input_tab', default="None")
    a('--output_tab', default="None")
    a('--user_email', default='Unknown')
    a('--bad_user', default=None)
    a('--make_Tool', default=None)
    a('--make_HTML', default=None)
    a('--help_text', default=None)
    a('--tool_desc', default=None)
    a('--new_tool', default=None)
    a('--tool_version', default=None)
    opts, args = op.parse_args()
    assert not opts.bad_user, 'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to admin_users in universe_wsgi.ini' % (opts.bad_user, opts.bad_user)
    assert opts.tool_name, '## Tool Factory expects a tool name - eg --tool_name=DESeq'
    assert opts.interpreter, '## Tool Factory wrapper expects an interpreter - eg --interpreter=Rscript'
    assert os.path.isfile(opts.script_path), '## Tool Factory wrapper expects a script path - eg --script_path=foo.R'
    if opts.output_dir:
        try:
            os.makedirs(opts.output_dir)
        except:
            pass
    r = ScriptRunner(opts)
    if opts.make_Tool:
        retcode = r.makeTooltar()
    else:
        retcode = r.run()
    os.unlink(r.sfile)
    if retcode:
        sys.exit(retcode)  # indicate failure to job runner

if __name__ == "__main__":
    main()


text:
#ifndef TENSORFLOW_STREAM_EXECUTOR_ROCM_HIPSPARSE_WRAPPER_H_
#define TENSORFLOW_STREAM_EXECUTOR_ROCM_HIPSPARSE_WRAPPER_H_

#include "tensorflow/compiler/xla/stream_executor/rocm/hipsparse_wrapper.h"

#endif  // TENSORFLOW_STREAM_EXECUTOR_ROCM_HIPSPARSE_WRAPPER_H_


text:
function R = applyBank(A, energies, FFTLength, filterbank)
% R = applyBank(A, energies, FFTLength, filterbank)
%
% Applies a filter bank to A

% Overlapping whatever
FFTstep = FFTLength/2;
ind = ones(FFTLength, 1) * (0:FFTstep:length(A)-FFTLength);
ind = ind + (1:FFTLength)' * ones(1, size(ind, 2));
frames = A(ind);

% apply FFT
fftFrames = fft(frames);

% calculate the window
win = bartlett(FFTLength); % triangular window

for k = 1:size(fftFrames, 2)
  % create the modifier that is used to change the fft.
  modifier = sum(repmat(energies(k, :), 2048, 1) .* filterbank, 2);
  fftFrames(:, k) = fftFrames(:, k) .* modifier;
  % and do ifft:
  fftFrames(:, k) = real(ifft(fftFrames(:, k)));
  % apply window
  fftFrames(:, k) = fftFrames(:, k) .* win;
end

% calculate result
R = zeros(size(A));
for k = 0:size(fftFrames, 2)-1
  R(k*FFTstep+1:k*FFTstep+FFTLength) = R(k*FFTstep+1:k*FFTstep+FFTLength) + ...
                                       fftFrames(:, k+1);
end


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Parametrizacion\Service;

use Parametrizacion\Entities;
/**
 *
 * @author MIGUEL
 */
interface IParametrizacionService {

    public function addCategoria(Entities\Categoria $categoria);

    public function updateCategoria(Entities\Categoria $categoria);

    public function getCategoriaById($id);

    public function listCategoria($filter = null);

    public function listCategoriasActivate($filter = null);

    public function addMarca(Entities\Marca $marca);

    public function updateMarca(Entities\Marca $marca);

    public function getMarcaById($id);

    public function listMarca($filter = null);

    public function listMarcasActivate($filter = null);

    public function addEstadoActivo(Entities\EstadoActivo $estadoactivo);

    public function updateEstadoActivo(Entities\EstadoActivo $estadoactivo);

    public function getEstadoActivoById($id);

    public function listEstadoActivo($filter = null);

    public function listEstadoActivosActivate($filter = null);

    public function addLugar(Entities\Lugar $lugar);

    public function updateLugar(Entities\Lugar $lugar);

    public function getLugarById($id);

    public function listLugares($filter = null);

    public function listLugaresActivate($filter = null);

}


text:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>where_tuto_popup_motion</title>

<script src="http://code.createjs.com/easeljs-0.8.1.min.js"></script>
<script src="http://code.createjs.com/tweenjs-0.6.1.min.js"></script>
<script src="http://code.createjs.com/movieclip-0.8.1.min.js"></script>
<script src="where_tuto_popup_motion.js"></script>

<script>
var canvas, stage, exportRoot;

function init() {
	canvas = document.getElementById("canvas");
	exportRoot = new lib.where_tuto_popup_motion();

	stage = new createjs.Stage(canvas);
	stage.addChild(exportRoot);
	stage.update();

	createjs.Ticker.setFPS(lib.properties.fps);
	createjs.Ticker.addEventListener("tick", stage);
}
</script>
</head>

<body onload="init();" style="background-color:#D4D4D4">
	<canvas id="canvas" width="400" height="200" style="background-color:#008274"></canvas>
</body>
</html>


text:
<?php

defined('_JEXEC') or die;

$item_heading = $params->get('item_heading', 'h4');
?>
<?php if ($params->get('item_title')) : ?>

	<<?php echo $item_heading; ?> class="newsflash-title<?php echo $params->get('moduleclass_sfx'); ?>">
	<?php if ($params->get('link_titles') && $item->link != '') : ?>
		<a href="<?php echo $item->link; ?>">
			<?php echo $item->title; ?>

	<?php else : ?>
		<?php echo $item->title; ?>
	<?php endif; ?>
	</<?php echo $item_heading; ?>>

<?php endif; ?>

<?php if (!$params->get('intro_only')) : ?>
	<?php echo $item->afterDisplayTitle; ?>
<?php endif; ?>

<?php echo $item->beforeDisplayContent; ?>

<?php echo $item->introtext; ?>

<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) : ?>
	<?php echo 'link . '">' . $item->linkText . ''; ?>
<?php endif; ?>


text:
<?php

namespace Tests\Dummy\Rules;

class NoOptionsRule extends \DMS\Filter\Rules\Rule
{
    public function applyFilter($value)
    {
        return $value;
    }

}


text:
hl(1) -- Highlight text in an output stream or file
===================================================

## SYNOPSIS

`hl [options] PATTERN [FILE...]`

`hl [options] -p PATTERN [FILE...]`

## INSTALL

    $ gem install hl

## DESCRIPTION

**hl** higlights (using ANSI escape sequences) instances of _PATTERN_ in the named input _FILEs_ or standard in if none are specified. **hl**'s goal is to assist visually scanning such output, but without trimming that output as `grep(1)` would.  The most common use-case is when trying to scan the output of a `grep` invocation that has complex data or long lines.  In this case, you don't want to further grep the output for the term you're looking for, bit instead simply need a visual cue as to where the secondary search term is in the output.

_PATTERN_ can be a plain string, or a regular expression.

## OPTIONS

  * `-c COLOR`, `--color=COLOR`:
    Color to use for highlighting.  Available colors are red, green, yellow, blue, magenta, cyan, or white,
    with yellow being the default.

  * `-n`, `--[no-]inverse`:
    Inverse highlight.  Shows the highlighting in inverse, with the background of the highlight being the selected color and the foreground being the color of your terminal's background.  This is off by default

  * `-i`, `--[no-]ignore-case`:
    Ignore case when matching.  This is off by default.

  * `-u`, `--[no-]underline`:
    Underline highlight.  This is off by default.

  * `-b`, `--[no-]bright`:
    Use bright colors.  Shows the highlighting using the bright version of the color.  This is off by default.

  * `-p PATTERN`, `--regexp=PATTERN`:
    Search term as explicit option.  This is useful for searching for patterns that start with a dash.

  * `-h`, `--help`, `--version`:
    Show the version and help information

## ENVIRONMENT

Default options can be specified in the `HL_OPTS` environment variable, exactly as they would appear on the command line.  You
can override these switches with the `-no-` form of the options

## EXAMPLES

Highlight the output of grep

    grep '2012-01-02' some_log_file.txt | hl 'user_id'

Highlight the word "user_id" in bright cyan in several files

    hl --color=cyan -b user_id some_file some_other_file yet_a_third_file

## BUGS

  * Does not allow for highlighting multiple terms at once

## AUTHOR

David Copeland, davec (at) naildrivin5.com

## COPYRIGHT

hl is copyright(c) 2012 by David Copeland, released under the Apache license.

## SEE ALSO

  * Source on github: https://github.com/davetron5000/hl

[SYNOPSIS]: #SYNOPSIS "SYNOPSIS"
[INSTALL]: #INSTALL "INSTALL"
[DESCRIPTION]: #DESCRIPTION "DESCRIPTION"
[OPTIONS]: #OPTIONS "OPTIONS"
[ENVIRONMENT]: #ENVIRONMENT "ENVIRONMENT"
[EXAMPLES]: #EXAMPLES "EXAMPLES"
[BUGS]: #BUGS "BUGS"
[AUTHOR]: #AUTHOR "AUTHOR"
[COPYRIGHT]: #COPYRIGHT "COPYRIGHT"
[SEE ALSO]: #SEE-ALSO "SEE ALSO"

[hl(1)]: hl.1.html


text:
Order.transaction do
	(1..100).each do |i|
		Order.create(name: "Customer #{i}", address: "#{i} Main Street",
			         phone: "12345678", email: "customer-#{i}@example.com", pay_type: "Check")
	end
end


text:
package at.ac.tuwien.big.xmlintelledit.intelledit.change.basic;

import java.util.Collections;
import java.util.List;

import org.eclipse.emf.ecore.resource.Resource;

import at.ac.tuwien.big.xmlintelledit.intelledit.change.Change;
import at.ac.tuwien.big.xmlintelledit.intelledit.change.Change.EmptyChange;
import at.ac.tuwien.big.xmlintelledit.intelledit.change.ChangeType;
import at.ac.tuwien.big.xmlintelledit.intelledit.change.Parameter;
import at.ac.tuwien.big.xmlintelledit.intelledit.transfer.EcoreTransferFunction;

public class EmptyChangeType implements ChangeType<EmptyChangeType, EmptyChange> {
	private Resource res;

	public EmptyChangeType(Resource res) {
		this.res = res;
	}

	@Override
	public EmptyChangeType clone() {
		return new EmptyChangeType(res);
	}

	@Override
	public EmptyChange compile() {
		return new Change.EmptyChange(res);
	}

	@Override
	public Resource getResource() {
		return res;
	}

	@Override
	public List<Parameter<? super EmptyChangeType, ?>> getParameter() {
		return Collections.emptyList();
	}

	@Override
	public <T> void bind(Parameter<? super EmptyChangeType, T> par, T value) {

	}

	@Override
	public <T> void fakebind(Parameter<? super EmptyChangeType, T> par, T value) {

	}

	@Override
	public <T> T get(Parameter<? super EmptyChangeType, T> par) {
		return null;
	}

	@Override
	public void unbind(Parameter<? super EmptyChangeType, ?> par) {

	}

	@Override
	public boolean isBound(Parameter<? super EmptyChangeType, ?> par) {
		return false;
	}

	@Override
	public void transfer(EcoreTransferFunction transferFunc) {
		res = transferFunc.other(res);
	}

}


text:
schedules
=========

Generates schedules. Just because human beings are unable.

`TODO`


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:cwf="http://www.carewebframework.org/schema/spring"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
		 http://www.springframework.org/schema/beans/spring-beans.xsd
		 http://www.carewebframework.org/schema/spring
		 http://www.carewebframework.org/schema/spring/spring-extensions.xsd">

	<beans profile="root">

		<bean id="cwfEPSService" init-method="init" destroy-method="destroy"
			class="org.hspconsortium.cwfdemo.api.eps.EPSService">
			<constructor-arg ref="fhirContext" />
			<constructor-arg value="${org.socraticgrid.hl7.eps.endpoint}" />
		</bean>

	</beans>

	<beans profile="desktop">

	</beans>
</beans>


text:
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {PackageInfo} from './client/stackdriver/debug';
import {StatusMessage} from './client/stackdriver/status-message';

export declare type CanaryMode =
  | 'CANARY_MODE_UNSPECIFIED'
  | 'CANARY_MODE_ALWAYS_ENABLED'
  | 'CANARY_MODE_ALWAYS_DISABLED'
  | 'CANARY_MODE_DEFAULT_ENABLED'
  | 'CANARY_MODE_DEFAULT_DISABLED';

// TODO: Determine how to get this interface to satisfy both the code and the
// docs
//       In particular, the comments below state some of the properties are
//       required but the default properties in the code is {}
export interface DebuggeeProperties {
  project?: string;
  uniquifier?: string;
  description?: string;
  agentVersion: string;
  labels?: {
    [key: string]: string;
  };
  sourceContexts?: Array<{[key: string]: {}}>;
  statusMessage?: StatusMessage;
  packageInfo?: PackageInfo;
  canaryMode?: CanaryMode;
}

export class Debuggee {
  uniquifier?: string;
  description?: string;
  agentVersion?: string;
  sourceContexts?: Array<{[key: string]: {}}>;

  // Public to allow for testing
  project?: string;
  labels?: {
    [key: string]: string;
  };
  statusMessage?: StatusMessage;
  id!: string;
  // TODO: This doesn't seem to ever be set but is referenced in the
  //       debuglet.ts file.
  isDisabled?: boolean;
  isInactive?: boolean;
  canaryMode?: CanaryMode;

  /**
   * Creates a Debuggee service object.
   * @ref https://cloud.google.com/debugger/api/reference/rest/v2/Debuggee
   *
   * @param {object} properties - an object with properties to use for Debuggee
   *     initialization.
   * @param {object} properties.project - Google Cloud Project ID
   * @param {string} properties.uniquifier - Debuggee uniquifier within the
   *     project. Any string that identifies the application within the project
   *     can be used. Including environment and version or build IDs is
   *     recommended.
   * @param {string} properties.description - A user specified string identifying
   *     this debuggable instance.
   * @param {?string} properties.agentVersion - version ID of the agent. (default:
   *     the version of this module)
   * @param {?object} labels - a set of custom properties about the debuggee that
   *     are reported to the service.
   * @param {?array<object>} properties.sourceContexts
   * @param {?StatusMessage} properties.statusMessage - A error string to register
   *     this as an erroring debuggable instance. This is useful if we have a
   *     problem starting the debugger support, and want to report to the API so
   *     that the user has a way of noticing.
   *     TODO(ofrobots): has this been renamed to `status` in the API?
   */
  constructor(properties: DebuggeeProperties) {
    if (!(this instanceof Debuggee)) {
      return new Debuggee(properties);
    }

    properties = properties || {};

    if (typeof properties.project !== 'string') {
      throw new Error('properties.project must be a string');
    }
    if (typeof properties.uniquifier !== 'string') {
      throw new Error('properties.uniquifier must be a string');
    }
    if (typeof properties.description !== 'string') {
      throw new Error('properties.description must be a string');
    }

    this.project = properties.project;
    this.uniquifier = properties.uniquifier;
    this.description = properties.description;
    this.agentVersion = properties.agentVersion;
    this.canaryMode = properties.canaryMode;
    if (properties.labels) {
      this.labels = properties.labels;
    }
    if (properties.sourceContexts) {
      this.sourceContexts = properties.sourceContexts;
    }
    if (properties.statusMessage) {
      this.statusMessage = properties.statusMessage;
    }
  }
}


text:
"use strict";

/* global describe,it */
var assert = require("assert");
var nooocl = require("../");
var CLHost = nooocl.CLHost;
var _ = require("lodash");
var CLBuffer = nooocl.CLBuffer;
var CLCommandQueue = nooocl.CLCommandQueue;
var ref = require("ref");
var ArrayType = require("ref-array");
var NDRange = nooocl.NDRange;
var testHelpers = require("./testHelpers");
var float = ref.types.float;
var FloatArray = new ArrayType("float");

var copyMemKernel =
    "kernel void copy(global float* src, global float* dst, uint begin)" +
    "{" +
    "uint idx = get_global_id(0);" +
    "dst[idx - 1] = src[idx + begin];" +
    "}";

describe("CLKernel", function () {
    it("should enqueue NDRange kernels", function (done) {
        testHelpers.doTest(function (env) {
            var host = env.host;
            var context = env.context;
            var device = env.device;
            var i;
            var srcArray = new FloatArray(5);
            var dstArray = new FloatArray(4);
            for (i = 0; i < srcArray.length; i++) {
                srcArray[i] = (i + 1) * 1.1;
            }
            for (i = 0; i < dstArray.length; i++) {
                dstArray[i] = 0.0;
            }
            var src = CLBuffer.wrapReadOnly(context, srcArray);
            var dst = CLBuffer.wrap(context, ref.reinterpret(dstArray.buffer, 3 * float.size, 0));
            assert.equal(srcArray.length * float.size, src.size);
            assert.equal((dstArray.length - 1) * float.size, dst.size);
            var queue = new CLCommandQueue(context, device);
            var program = context.createProgram(copyMemKernel);
            return program.build().then(function () {
                var buildStatus = program.getBuildStatus(device);
                if (buildStatus < 0) {
                    assert.fail("Build failed.\n" + program.getBuildLog(device));
                }
                var kernel = program.createKernel("copy");
                assert(kernel ? true : false);
                assert(kernel.handle ? true : false);
                assert.equal("copy", kernel.name);
                var kernels = program.createAllKernels();
                assert(_.isArray(kernels));
                assert.equal(kernels.length, 1);
                assert.equal(kernel.name, kernels[0].name);

                var assertValues = function () {
                    var out = {};
                    return queue.waitable().enqueueMapBuffer(dst, host.cl.defs.CL_MAP_READ | host.cl.defs.CL_MAP_WRITE, 0, dst.size, out).promise
                        .then(function () {
                            var buffer = ref.reinterpret(out.ptr, dst.size + float.size, 0);
                            var v1 = float.get(buffer, 0).toFixed(2);
                            var v2 = dstArray[0].toFixed(2);
                            assert.equal(v1, v2);
                            assert.equal(v1, srcArray[2].toFixed(2));
                            float.set(buffer, 0, 0.0);

                            v1 = float.get(buffer, 1 * float.size).toFixed(2);
                            v2 = dstArray[1].toFixed(2);
                            assert.equal(v1, v2);
                            assert.equal(v1, srcArray[3].toFixed(2));
                            float.set(buffer, 1 * float.size, 0.0);

                            v1 = float.get(buffer, 2 * float.size).toFixed(2);
                            v2 = dstArray[2].toFixed(2);
                            assert.equal(v1, v2);
                            assert.equal(v1, srcArray[4].toFixed(2));
                            float.set(buffer, 2 * float.size, 0.0);

                            v1 = float.get(buffer, 3 * float.size).toFixed(2);
                            v2 = dstArray[3].toFixed(2);
                            assert.equal(v1, v2);
                            assert.equal(v1, 0.0);

                            return queue.waitable().enqueueUnmapMemory(dst, out.ptr).promise;
                        });
                };

                // Test bind:
                var func = kernel.bind(queue, new NDRange(3), null, new NDRange(1));
                func(src, dst, { "uint": 1 });

                return assertValues()
                    .then(function () {
                        // Test direct call:
                        kernels[0].setArg(0, src);
                        kernels[0].setArg(1, dst);
                        kernels[0].setArg(2, 1, "uint");
                        queue.enqueueNDRangeKernel(kernels[0], new NDRange(3), null, new NDRange(1));

                        return assertValues();
                    });
            });
        }).nodeify(done);
    });
});


text:
package com.sunan.van.core.cache;

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

public class ClientCache {

	private static final Map<String, List<String>> pubClientCache = new HashMap<String, List<String>>();

	private static final Map<String, List<String>> subClientCache = new HashMap<String, List<String>>();

	private static final Map<String, List<String>> dataIdPubCache = new HashMap<String, List<String>>();

	private static final Map<String, List<String>> dataIdSubCache = new HashMap<String, List<String>>();

//	public static void initClient(String client){
//		List<String> pubList = pubClientCache.get(client);
//	}

	public static void pub(String client, String dataId){
		addClientCache(client, dataId, pubClientCache);
		addDataIdCache(client, dataId, dataIdPubCache);

	}

	public static void sub(String client, String dataId){
		addClientCache(client, dataId, subClientCache);
		addDataIdCache(client, dataId, dataIdSubCache);
	}

	public static void removeClient(String client){
		unpub(client);
		unsub(client);
	}

	public static void unpub(String client){
		removeClient(client, pubClientCache, dataIdPubCache);

	}

	public static void unsub(String client){
		removeClient(client, subClientCache, dataIdSubCache);
	}

	public static Map<String, List<String>> getPubclientcache() {
		return pubClientCache;
	}

	public static Map<String, List<String>> getSubclientcache() {
		return subClientCache;
	}

	public static Map<String, List<String>> getDataidpubcache() {
		return dataIdPubCache;
	}

	public static Map<String, List<String>> getDataidsubcache() {
		return dataIdSubCache;
	}

	private static void removeClient(String client, Map<String, List<String>> clientCache, Map<String, List<String>> dataIdCache){
		List<String> dataIdList = clientCache.get(client);
		for(String dataId: dataIdList){
			removeDataIdCache(client, dataId, dataIdCache);
		}
		clientCache.remove(client);
	}

	private static void addClientCache(String client, String dataId, Map<String, List<String>> cache){
		List<String> pubList = cache.get(client);
		if(pubList == null){
			pubList = new ArrayList<String>();
		}
		if(!pubList.contains(dataId)){
			pubList.add(dataId);
		}
		cache.put(client, pubList);
	}

	private static void addDataIdCache(String client, String dataId, Map<String, List<String>> cache){
		List<String> dataIdList = cache.get(dataId);
		if(dataIdList == null){
			dataIdList = new ArrayList<String>();
		}

		if(!dataIdList.contains(client)){
			dataIdList.add(client);
		}

		cache.put(dataId, dataIdList);
	}

	private static void removeDataIdCache(String client, String dataId, Map<String, List<String>> cache){
		List<String> dataIdList = cache.get(dataId);
		if(dataIdList != null){
			dataIdList.remove(client);
		}
	}
}


text:
// Copyright (c) 2015 RAMBLER&Co
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>

/**
 @author Artem Karpushin

 Class is designed to cast a date to a string with specific format
 */
@interface DateFormatter : NSObject

/**
 @author Egor Tolstoy

 Method is used to obtain string from date with format "d MMMM yyyy в HH:mm"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithDayMonthYearTimeFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "d MMMM в HH:mm"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithDayMonthTimeFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "d MMMM yyyy"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithDayMonthYearFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "d MMMM"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithDayMonthFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "MMMM"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithMonthFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "d"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithDayFormat:(NSDate *)date;

/**
 @author Artem Karpushin

 Method is used to obtain string from date with format "HH:mm"

 @param date NSDate object

 @return NSString object
 */
- (NSString *)obtainDateWithTimeFormat:(NSDate *)date;

@end