text:
package org.compass.core.engine;

/**
 * @author kimchy
 */
public interface SearchEngineQueryFilter {
}

redpajama_set_name: RedPajamaGithub


text:
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper, GhPython
import System
import Rhino
import rhinoscriptsyntax as rs

class MyComponent(component):

    def RunScript(self, pts):
        """Provides a scripting component.
            Inputs:
                pts: list of point objects
            Output:
                nodes: list of wrapped node objects"""

        __author__ = "Zhuoju Huang"
        __version__ = "2022.07.12"

        import rhinoscriptsyntax as rs

        class Node():
            def __init__(self,name, pt):
                self.name=name
                self.point=pt

        nodes=[Node(str(i+1),pt) for i,pt in zip(range(len(pts)),pts)]

        # return outputs if you have them; here I try it for you:
        return nodes


text:
<?php
/**
 * IPara Purchase Request
 */
namespace Omnipay\IPara\Message;

use Omnipay\Common\Message\AbstractRequest;
use Omnipay\IPara\Gateway;
use Omnipay\IPara\Omnipay\Common\Address;
use Omnipay\IPara\Omnipay\Common\Item;

/**
 * Class PurchaseRequest
 * @package Omnipay\IPara\Message
 *
 * @author Sercan Virlan <sercanvirlan@gmail.com>
 */
class PurchaseRequest extends AbstractRequest
{

    public $threeDSecureUrl = "https://www.ipara.com/3dgate";
    /**
     * Get order id
     *
     * @return int
     */
    public function getOrderId()
    {
        return $this->getParameter('orderid');
    }

    /**
     * Set order id
     *
     * @param int $value
     * @return AbstractRequest
     */
    public function setOrderId($value)
    {
        return $this->setParameter('orderid', $value);
    }

    /**
     * Get order date
     *
     * @return string
     */
    public function getOrderDate()
    {
        return $this->getParameter('orderDate');
    }

    /**
     * Set order date
     *
     * @param string $value
     * @return AbstractRequest
     */
    public function setOrderDate($value)
    {
        return $this->setParameter('orderDate', $value);
    }

    /**
     * Get merchant id
     *
     * @return string
     */
    public function getMerchantId()
    {
        return $this->getParameter('merchantId');
    }

    /**
     * Set merchant id
     *
     * @param string $value
     * @return string
     */
    public function setMerchantId($value)
    {
        return $this->setParameter('merchantId', $value);
    }

    /**
     * Get threeD
     *
     * @return string
     */
    public function getThreeD()
    {
        return $this->getParameter('threeD');
    }

    /**
     * Set threeD
     *
     * @param string $value
     * @return string
     */
    public function setThreeD($value)
    {
        return $this->setParameter('threeD', $value);
    }

    /**
     * Get threeDSecureCode
     *
     * @return string
     */
    public function getThreeDSecureCode()
    {
        return $this->getParameter('threeDSecureCode');
    }

    /**
     * Set threeDSecureCode
     *
     * @param string $value
     * @return string
     */
    public function setThreeDSecureCode($value)
    {
        return $this->setParameter('threeDSecureCode', $value);
    }

    /**
     * Get secret key
     *
     * @return string
     */
    public function getSecretKey()
    {
        return $this->getParameter('secretKey');
    }

    /**
     * Set secret key
     *
     * @param string $value
     * @return mixed
     */
    public function setSecretKey($value)
    {
        return $this->setParameter('secretKey', $value);
    }

    /**
     * Get live url
     *
     * @return string
     */
    public function getLiveUrl()
    {
        return $this->getParameter('liveUrl');
    }

    /**
     * Set live url
     *
     * @param string $value
     * @return string
     */
    public function setLiveUrl($value)
    {
        return $this->setParameter('liveUrl', $value);
    }

    /**
     * Get sandbox url
     *
     * @return string
     */
    public function getSandboxUrl()
    {
        return $this->getParameter('sandboxUrl');
    }

    /**
     * Set sandbox url
     *
     * @param string $value
     * @return string
     */
    public function setSandboxUrl($value)
    {
        return $this->setParameter('sandboxUrl', $value);
    }

    /**
     * Get country
     *
     * @return string
     */
    public function getCountry()
    {
        return $this->getParameter('country');
    }

    /**
     * Set country
     *
     * @param string $value
     * @return $this
     */
    public function setCountry($value)
    {
        return $this->setParameter('country', $value);
    }

    /**
     * Get billing address
     *
     * @return object
     */
    public function getBillingAddress()
    {
        return $this->getParameter('billing_address');
    }

    /**
     * Set billing address
     *
     * @param object $value
     * @return $this
     */
    public function setBillingAddress($value)
    {
        return $this->setParameter('billing_address', $value);
    }

    /**
     * Get shipping address
     *
     * @return Address
     */
    public function getShippingAddress()
    {
        return $this->getParameter('shipping_address');
    }

    /**
     * Set shipping address
     *
     * @param Address $value
     * @return $this
     */
    public function setShippingAddress($value)
    {
        return $this->setParameter('shipping_address', $value);
    }

    /**
     * Get shipping amount
     *
     * @return float
     */
    public function getShippingAmount()
    {
        return $this->getParameter('shipping_amount');
    }

    /**
     * Set shipping amount
     *
     * @param float $value
     * @return $this
     */
    public function setShippingAmount($value)
    {
        return $this->setParameter('shipping_amount', $value);
    }

    /**
     * Get discount amount
     *
     * @return float
     */
    public function getDiscountAmount()
    {
        return $this->getParameter('discount_amount');
    }

    /**
     * Set discount amount
     *
     * @param float $value
     * @return $this
     */
    public function setDiscountAmount($value)
    {
        return $this->setParameter('discount_amount', $value);
    }

    /**
     * Get auto mode
     *
     * @return mixed
     */
    public function getAutoMode()
    {
        return $this->getParameter('autoMode');
    }

    /**
     * Set auto mode
     *  - redirect customers straight to the card details page (skipping the billing/delivery screens)
     *
     * @param bool $value
     * @return $this
     */
    public function setAutoMode($value)
    {
        return $this->setParameter('autoMode', $value);
    }

    /**
     * Get timeout
     *
     * @return string
     */
    public function getTimeout()
    {
        return $this->getParameter('timeout');
    }

    /**
     * Set timeout
     *
     * @param string $value
     * @return $this
     */
    public function setTimeout($value)
    {
        return $this->setParameter('timeout', $value);
    }

    /**
     * Get timeout url
     *
     * @return string
     */
    public function getTimeoutUrl()
    {
        return $this->getParameter('timeoutUrl');
    }

    /**
     * Set timeout url
     *
     * @param string $value
     * @return $this
     */
    public function setTimeoutUrl($value)
    {
        return $this->setParameter('timeoutUrl', $value);
    }

    /**
     * Get the installment count
     *
     * @return string
     */
    public function getInstallmentCount()
    {
        return $this->getParameter('installmentCount');
    }

    /**
     * Sets the request installment count
     *
     * @param string $value
     * @return $this
     */
    public function setInstallmentCount($value)
    {
        return $this->setParameter('installmentCount', $value);
    }

    /**
     * Get the request echo
     *
     * @return string
     */
    public function getEcho()
    {
        return $this->getParameter('echo');
    }

    /**
     * Sets the request echo
     *
     * @param string $value
     * @return $this
     */
    public function setEcho($value)
    {
        return $this->setParameter('echo', $value);
    }

    /**
     * Get the request success URL
     *
     * @return string
     */
    public function getSuccessUrl()
    {
        return $this->getParameter('successUrl');
    }

    /**
     * Sets the request success URL
     *
     * @param string $value
     * @return $this
     */
    public function setSuccessUrl($value)
    {
        return $this->setParameter('successUrl', $value);
    }

    /**
     * Get the request failure URL
     *
     * @return string
     */
    public function getFailureUrl()
    {
        return $this->getParameter('failureUrl');
    }

    /**
     * Sets the request failure URL
     *
     * @param string $value
     * @return $this
     */
    public function setFailureUrl($value)
    {
        return $this->setParameter('failureUrl', $value);
    }

    /**
     * Get the request return URL
     *
     * @return string
     */
    public function getReturnUrl()
    {
        return $this->getParameter('returnUrl');
    }

    /**
     * Sets the request return URL
     *
     * @param string $value
     * @return $this
     */
    public function setReturnUrl($value)
    {
        return $this->setParameter('returnUrl', $value);
    }

    /**
     * Get gateway url
     *
     * @return string
     */
    public function getGatewayUrl()
    {
        return $this->getTestMode() ? $this->getSandboxUrl() : $this->getLiveUrl();
    }

    /**
     * Get token
     *
     * @return string
     */
    public function getToken()
    {
        $card = $this->getCard();
        $hash_text =
            $this->getSecretKey() .
            $this->getOrderId() .
            number_format((float)$this->getAmount(), 2, '', '') .
            $this->getTestMode() .
            $card->getName() .
            $card->getNumber() .
            str_pad($card->getExpiryMonth(), 2, '0', STR_PAD_LEFT) .
            substr($card->getExpiryYear(), -2) .
            $card->getCvv() .
            $card->getFirstName() .
            $card->getLastName() .
            $card->getEmail() .
            $this->getOrderDate();

        $token = $this->getMerchantId() . ":" . base64_encode(sha1($hash_text, true));

        return $token;
    }

    public function getData()
    {
        $xml_data_product_part = "";
        $billingAddress = $this->getBillingAddress();
        $shippingAddress = $this->getShippingAddress();

        $items = $this->getItems();
        if (!empty($items)) {
            foreach ($items as $key => $item) {
                $xml_data_product_part .= "<product>\n" .
                    "	<productCode>" . urlencode($item->getSku()) . "</productCode>\n" .
                    "	<productName>" . urlencode($item->getName()) . "</productName>\n" .
                    "	<quantity>" . $item->getQuantity() . "</quantity>\n" .
                    "	<price>" . number_format((float)sprintf('%.2F', $item->getPrice()), 2, '', '') . "</price>\n" .
                    "</product>\n";
            }
        }

        $three_d_secure_code_part = "";
        if ($this->getThreeD() == "true") {
            $three_d_secure_code_part = "    <threeDSecureCode>" . $this->getThreeDSecureCode() . "</threeDSecureCode>\n";
        }

        $card = $this->getCard();
        $xml_data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
            "<auth>\n" .
            "    <threeD>" . $this->getThreeD() . "</threeD>\n" .
            "    <orderId>" . $this->getOrderId() . "</orderId>\n" .
            "    <amount>" . number_format((float)$this->getAmount(), 2, '', '') . "</amount>\n" .
            "    <cardOwnerName>" . $card->getName() . "</cardOwnerName>\n" .
            "    <cardNumber>" . $card->getNumber() . "</cardNumber>\n" .
            "    <cardExpireMonth>" . str_pad($card->getExpiryMonth(), 2, '0', STR_PAD_LEFT) . "</cardExpireMonth>\n" .
            "    <cardExpireYear>" . substr($card->getExpiryYear(), -2) . "</cardExpireYear>\n" .
            "    <installment>" . $this->getInstallmentCount() . "</installment>\n" .
            "    <cardCvc>" . $card->getCvv() . "</cardCvc>\n" .
            "    <mode>" . $this->getTestMode() . "</mode>\n" .
            $three_d_secure_code_part .
            "    <vendorId>29</vendorId>\n" .
            "    <products>\n" .
            $xml_data_product_part .
            "    </products>\n" .
            "    <purchaser>\n" .
            "        <name>" . $card->getFirstName() . "</name>\n" .
            "        <surname>" . $card->getLastName() . "</surname>\n" .
            "        <birthDate></birthDate>\n" .
            "        <email>" . $card->getEmail() . "</email>\n" .
            "        <gsmNumber>" . urlencode(mb_strlen($billingAddress->getPhone()) ? $billingAddress->getPhone() : '-') . "</gsmNumber>\n" .
            "        <tcCertificate></tcCertificate>\n" .
            "        <clientIp>" . $this->getClientIp() . "</clientIp>\n" .
            "        <invoiceAddress>\n" .
            "            <name>" . ($billingAddress->getFirstName()) . "</name>\n" .
            "            <surname></surname>\n" .
            "            <address>" . urlencode($billingAddress->getAddress()) . "</address>\n" .
            "            <zipcode>" . urlencode($billingAddress->getZipCode()) . "</zipcode>\n" .
            "            <city>" . urlencode($billingAddress->getCity()) . "</city>\n" .
            "            <tcCertificate></tcCertificate>\n" .
            "            <country>" . urlencode($billingAddress->getCountryCode()) . "</country>\n" .
            "            <taxNumber></taxNumber>\n" .
            "            <taxOffice></taxOffice>\n" .
            "            <companyName>" . $billingAddress->getCompany() . "</companyName>\n" .
            "            <phoneNumber>" . urlencode(mb_strlen($billingAddress->getPhone()) ? $billingAddress->getPhone() : '-') . "</phoneNumber>\n" .
            "        </invoiceAddress>\n" .
            "        <shippingAddress>\n" .
            "            <name>" . ($shippingAddress->getFirstName()) . "</name>\n" .
            "            <surname></surname>\n" .
            "            <address>" . urlencode($shippingAddress->getAddress()) . "</address>\n" .
            "            <zipcode>" . urlencode($shippingAddress->getZipCode()) . "</zipcode>\n" .
            "            <city>" . urlencode($shippingAddress->getCity()) . "</city>\n" .
            "            <country>" . urlencode($shippingAddress->getCountryCode()) . "</country>\n" .
            "            <phoneNumber>" . urlencode(mb_strlen($shippingAddress->getPhone()) ? $shippingAddress->getPhone() : '-') . "</phoneNumber>\n" .
            "        </shippingAddress>\n" .
            "    </purchaser>\n" .
            "</auth>";

        return $xml_data;
    }

    public function getRedirectData()
    {
        $card = $this->getCard();
        $data = new \stdClass();
        $data->RETURN_CODE = '3DS_ENROLLED';
        $data->URL_3DS = $this->threeDSecureUrl;
        $data->orderId = $this->getOrderId();
        $data->amount = number_format((float)$this->getAmount(), 2, '', '');
        $data->cardOwnerName = $card->getName();
        $data->cardNumber = $card->getNumber();
        $data->cardExpireMonth = str_pad($card->getExpiryMonth(), 2, '0', STR_PAD_LEFT);
        $data->cardExpireYear = substr($card->getExpiryYear(), -2);
        $data->installment = $this->getInstallmentCount();
        $data->cardCvc = $card->getCvv();
        $data->mode = $this->getTestMode();
        $data->purchaserName = $card->getFirstName();
        $data->purchaserSurname = $card->getLastName();
        $data->purchaserEmail = $card->getEmail();
        $data->successUrl = $this->getSuccessUrl();
        $data->failureUrl = $this->getFailureUrl();
        $data->echo = $this->getEcho();
        $data->version = '1.0';
        $data->transactionDate = $this->getOrderDate();
        $data->token = $this->getToken();

        return $data;
    }

    /**
     * Send data
     *
     * @param mixed $data
     * @return PurchaseResponse
     */
    public function sendData($data)
    {
        if($this->getThreeD() && !$this->getThreeDSecureCode()) {
            $xml = $this->getRedirectData();
            return $this->response = new PurchaseResponse($this, $xml, $this->threeDSecureUrl);
        } else {
            $headers = [
                'Content-Type' => 'application/xml; charset=utf-8',
                'transactionDate' => $this->getOrderDate(),
                'version' => "1.0",
                'token' => $this->getToken()
            ];

            $httpResponse = $this->httpClient->post($this->getGatewayUrl(), $headers, $data)->send();
            $xml = simplexml_load_string($httpResponse->getBody()->__toString());
            return $this->response = new PurchaseResponse($this, $xml, $this->getGatewayUrl());
        }
    }
}


text:
#ifndef __IRR_C_OPENGL_SPECIALIZED_SHADER_H_INCLUDED__
#define __IRR_C_OPENGL_SPECIALIZED_SHADER_H_INCLUDED__

#include "irr/asset/ICPUSpecializedShader.h"
#include "irr/video/IGPUSpecializedShader.h"
#include "COpenGLExtensionHandler.h"

#ifdef _IRR_COMPILE_WITH_OPENGL_

namespace irr
{
namespace video
{

class COpenGLSpecializedShader : public IGPUSpecializedShader
{
public:
    COpenGLSpecializedShader(video::IVideoDriver* _driver, const asset::ICPUSpecializedShader* _cpushader);
    /*{
        // manipulate spir-v (specialize spec. constants)
        // down-compile to GLSL (SPIRV-Cross)
        // manipulation 2nd pass (on GLSL code)
        // feed to OpenGL and get GL name
    }*/

    GLuint getOpenGLName() const { return m_GLname; }

private:
    GLuint m_GLname;
};

}
}
#endif

#endif//__IRR_C_OPENGL_SPECIALIZED_SHADER_H_INCLUDED__


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

    <persistence-unit transaction-type="JTA" name="jpa/monitoring">

        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>MonitoringClientDS</jta-data-source>
        <non-jta-data-source>NoTxMonitoringClientDS</non-jta-data-source>
        <class>org.apache.geronimo.monitoring.console.data.Graph</class>
        <class>org.apache.geronimo.monitoring.console.data.View</class>
        <class>org.apache.geronimo.monitoring.console.data.Node</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
            <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
        </properties>
    </persistence-unit>
</persistence>


text:
package net.strongdesign.statesystem;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Queue;
import java.util.Set;

import net.strongdesign.stg.STG;
import net.strongdesign.stg.STGFile;
import net.strongdesign.stg.STGAdapterFactory.StateSystemAdapter;
import net.strongdesign.util.FileSupport;
import net.strongdesign.util.Pair;
import net.strongdesign.util.Pointer;

public abstract class StateSystems {

	private StateSystems() {}

	/**
	 *
	 * Used for @link StateSystems#inverseProjection(StateSystem, List, EventCondition)inverseprojection and
	 * @link StateSystems#inverseProjections(StateSystem, List, EventCondition) to define valid additional signals.
	 *
	 * @param <Event>
	 */
	public static interface EventCondition<Event> {
		public boolean fulfilled(Event event);
	}

	public static class BasicEventCondition<Event> implements EventCondition<Event> {
		private Set<Event> properEvents;

		public BasicEventCondition(Collection<Event> properEvents) {
			this.properEvents = new HashSet<Event>(properEvents);
		}

		public boolean fulfilled(Event event) {
			return properEvents.contains(event);
		}
	}

	/**
	 * Calculates a single inverse projection of the given trace in the given system using only events for which
	 * condition is fulfilled.
	 *
	 *
An inverse projection of
	 * trace = a, d, e, f, e, a could be a, x, d, y, e, x, z, f, e, a

	 * An inverse projection always ends with the last event of trace.
	 *
	 *
	 * @param <State>
	 * @param <Event>
	 * @param system
	 * @param trace
	 * @param condition
	 * @return
	 * @throws StateSystemException
	 */
	@SuppressWarnings("rawtypes")
	public static <State,Event> List<Event> inverseProjection (
			StateSystem<State, Event> system,
			List<Event> trace,
			EventCondition<Event> condition)
	throws StateSystemException  {
		//the resulting projection
		List<Event> invProjection = new LinkedList<Event>();

		//current state of the system
		State currentState = system.getInitialState();

		//for every event of trace
		for (Event event : trace) { // no dummy event possible from an mpsat trace

			//if this event is possible add it to the trace update current state, i.e. perform it in system and proceed
			if (system.getEvents(currentState).contains(event)) {
				invProjection.add(event);
				currentState = system.getNextStates(currentState, event).iterator().next(); // it can be just one state for any deterministic system
			}

			//otherwise, find shortest sequence of events fulfilling condition which enables event
			else {
				//using BFS for finding shortest path
				//queue elements are states and the events by which they were reached
				//enhanced with backward pointers for restoring the path
				Queue<Pointer<Pair<State,Event>>> bfsQueue = new LinkedList<Pointer<Pair<State,Event>>>();
				bfsQueue.add(Pointer.getPointer(Pair.getPair(currentState, (Event) null), null));
				Set<State> seen = new HashSet<State>();
				//if we reach a state by event it is stored within finalState
				//finalState equaling null after the BFS loop indicates an error
				Pointer<Pair<State,Event>> finalState = null;

				//IMPLEMENT more efficiently
				bfs: while (! bfsQueue.isEmpty()) {

					//get the current state and activated events
					Pointer<Pair<State,Event>> curPointer = bfsQueue.poll();

					//if the current state was already encountered, it was on path which
					//is not longer than the current one, we can therefore drop this queue entry
					State curState = curPointer.value.a;
					if (seen.contains(curState)) {
						continue bfs;
					}

					seen.add(curState);

					Set<Event> events = system.getEvents(curState);

					//have we finished?

					//jupp, leave BFS
					if (events.contains(event)) {
						finalState = Pointer.getPointer(
										Pair.getPair(
												system.getNextStates(curState, event).iterator().next(),
												event),
										curPointer);
						break bfs;
					}

					//nope, proceed with BFS
					for (Event e : events) {
						if (condition.fulfilled(e)) {
							bfsQueue.add(	Pointer.getPointer(
												Pair.getPair(
													system.getNextStates(curState, e).iterator().next(),
													e),
												curPointer));
						}
					}
				}

				//no path found
				if (finalState == null) {
					STG stg = null;
					if (system instanceof StateSystemAdapter)
						stg = ((StateSystemAdapter)system).getSTG();
					System.out.println(condition);
//
//					try {
//						FileSupport.saveToDisk(STGFile.convertToG(stg, false), "/home/mark/stg.g");
//					} catch (IOException e) {
//						e.printStackTrace();
//					}
//
					throw new StateSystemException(
							"Could not generate inverse projection: could not activate event " + event +
							" of trace " + trace );
				}

				//add the events on the path to invProjection from backwards by following
				//the upward pointers

				currentState = finalState.value.a;
				ListIterator<Event> itInvProjection = invProjection.listIterator();
				while (itInvProjection.hasNext())
					itInvProjection.next();

				while (finalState.value.b != null) {
					itInvProjection.add(finalState.value.b);
					itInvProjection.previous();
					finalState = finalState.pointer;
				}
			}
		}

		return invProjection;
	}

	/**
	 * Not implemented yet. Calculates all minimal inverse projections of the given trace and returns them as @link StateSystem.
	 * For more details @see #inverseProjection(StateSystem, List, EventCondition).
	 * @param <State>
	 * @param <Event>
	 * @param system
	 * @param trace
	 * @param condition
	 * @return
	 * @throws StateSystemException
	 *
	 * @todo Implement this method.
	 * @see #inverseProjection(StateSystem, List)
	 */
	public static <State,Event> StateSystem<State,Event> inverseProjections (
			StateSystem<State, Event> system,
			List<Event> trace,
			EventCondition<Event> condition)
	throws StateSystemException  {
		return emptyStateSystem();
	}

	/**
	 * Returns an empty state system, whose initial state is null and next states and events are always the empty set.
	 * @param <State>
	 * @param <Event>
	 * @return
	 */
	public static <State,Event> StateSystem<State,Event> emptyStateSystem() {
		return new StateSystem<State,Event>() {

			public State getInitialState() {
				return null;
			}

			public Set<Event> getEvents(State state) {
				return Collections.emptySet();
			}

			public Set<State> getNextStates(State state, Event event) {
				return Collections.emptySet();
			}
		};
	}

}


text:
package org.onetwo.boot.core.web.async;

import org.onetwo.boot.core.web.async.DelegateTaskDecorator.AsyncTaskDecorator;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

/**
 * @author weishao zeng
 * <br/>
 */

public class WebContextAsyncTaskDecorator implements AsyncTaskDecorator {

	@Override
	public Runnable decorate(Runnable runnable) {
		RequestAttributes attrs = RequestContextHolder.getRequestAttributes();
		if (attrs==null) {
			return runnable;
		}
		return () -> {
			RequestContextHolder.setRequestAttributes(attrs);
			try {
				runnable.run();
			} finally {
				RequestContextHolder.resetRequestAttributes();
			}
		};
	}

}


text:
class AddIndexOnLevelUserLinks < ActiveRecord::Migration
  def change
    add_index :level_user_links, [:pushes, :moves, :created_at]
  end
end


text:
  /*------------------------ AJAX: PERIODICAL UPDATER ------------------------*/

  fuse.ajax.TimedUpdater = (function() {

    var Obj = fuse.Object,

    Request = fuse.ajax.Request,

    Klass   = function() { },

    TimedUpdater = function TimedUpdater(container, url, options) {
      var onDone,
       callbackName = 'on' + capitalize(Request.READY_STATES[4]),
       instance     = __instance || new Klass,
       options      = Obj.extend(Obj.clone(TimedUpdater.defaults), options);

      __instance = null;

      // this._super() equivalent
      fuse.ajax.Base.call(instance, url, options);
      options = instance.options;

      // dynamically set readyState eventName to allow for easy customization
      onDone = options[callbackName];

      instance.container = container;
      instance.frequency = options.frequency;
      instance.maxDecay  = options.maxDecay;

      options[callbackName] = function(request, json) {
        if (!request.aborted) {
          instance.updateDone(request);
          onDone && onDone(request, json);
        }
      };

      instance.onStop = options.onStop;
      instance.onTimerEvent = function() { instance.start(); };
      instance.start();
      return instance;
    },

    __instance,
    __apply = TimedUpdater.apply,
    __call = TimedUpdater.call;

    TimedUpdater.call = function(thisArg) {
      __instance = thisArg;
      return __call.apply(this, arguments);
    };

    TimedUpdater.apply = function(thisArg, argArray) {
      __instance = thisArg;
      return __apply.call(this, thisArg, argArray);
    };

    fuse.Class(fuse.ajax.Base, { 'constructor': TimedUpdater });
    Klass.prototype = TimedUpdater.plugin;
    return TimedUpdater;
  })();

  (function(plugin) {
    plugin.updateDone = function updateDone(request) {
      var options = this.options, decay = options.decay,
       responseText = request.responseText;

      if (decay) {
        this.decay = Math.min(responseText == String(this.lastText) ?
          (this.decay * decay) : 1, this.maxDecay);

        this.lastText = responseText;
      }

      this.timer = setTimeout(this.onTimerEvent,
        this.decay * this.frequency * this.timerMultiplier);
    };

    plugin.start = function start() {
      this.updater = new fuse.ajax.Updater(this.container, this.url, this.options);
    };

    plugin.stop = function stop() {
      window.clearTimeout(this.timer);
      this.lastText = null;
      this.updater.abort();
      this.onStop && this.onStop.apply(this, arguments);
    };

    // prevent JScript bug with named function expressions
    var updateDone = null, start = null, stop = null;
  })(fuse.ajax.TimedUpdater.plugin);

  fuse.ajax.TimedUpdater.defaults = {
    'decay':     1,
    'frequency': 2,
    'maxDecay':  Infinity
  };


text:
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/log2.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#define DRVNAME "i5k_amb"

#define I5K_REG_AMB_BASE_ADDR		0x48
#define I5K_REG_AMB_LEN_ADDR		0x50
#define I5K_REG_CHAN0_PRESENCE_ADDR	0x64
#define I5K_REG_CHAN1_PRESENCE_ADDR	0x66

#define AMB_REG_TEMP_MIN_ADDR		0x80
#define AMB_REG_TEMP_MID_ADDR		0x81
#define AMB_REG_TEMP_MAX_ADDR		0x82
#define AMB_REG_TEMP_STATUS_ADDR	0x84
#define AMB_REG_TEMP_ADDR		0x85

#define AMB_CONFIG_SIZE			2048
#define AMB_FUNC_3_OFFSET		768

static unsigned long amb_reg_temp_status(unsigned int amb)
{
	return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_STATUS_ADDR +
	       AMB_CONFIG_SIZE * amb;
}

static unsigned long amb_reg_temp_min(unsigned int amb)
{
	return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MIN_ADDR +
	       AMB_CONFIG_SIZE * amb;
}

static unsigned long amb_reg_temp_mid(unsigned int amb)
{
	return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MID_ADDR +
	       AMB_CONFIG_SIZE * amb;
}

static unsigned long amb_reg_temp_max(unsigned int amb)
{
	return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MAX_ADDR +
	       AMB_CONFIG_SIZE * amb;
}

static unsigned long amb_reg_temp(unsigned int amb)
{
	return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_ADDR +
	       AMB_CONFIG_SIZE * amb;
}

#define MAX_MEM_CHANNELS		4
#define MAX_AMBS_PER_CHANNEL		16
#define MAX_AMBS			(MAX_MEM_CHANNELS * \
					 MAX_AMBS_PER_CHANNEL)
#define CHANNEL_SHIFT			4
#define DIMM_MASK			0xF
/*
 * Ugly hack: For some reason the highest bit is set if there
 * are _any_ DIMMs in the channel.  Attempting to read from
 * this "high-order" AMB results in a memory bus error, so
 * for now we'll just ignore that top bit, even though that
 * might prevent us from seeing the 16th DIMM in the channel.
 */
#define REAL_MAX_AMBS_PER_CHANNEL	15
#define KNOBS_PER_AMB			6

static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit)
{
	return byte_num * MAX_AMBS_PER_CHANNEL + bit;
}

#define AMB_SYSFS_NAME_LEN		16
struct i5k_device_attribute {
	struct sensor_device_attribute s_attr;
	char name[AMB_SYSFS_NAME_LEN];
};

struct i5k_amb_data {
	struct device *hwmon_dev;

	unsigned long amb_base;
	unsigned long amb_len;
	u16 amb_present[MAX_MEM_CHANNELS];
	void __iomem *amb_mmio;
	struct i5k_device_attribute *attrs;
	unsigned int num_attrs;
};

static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
			 char *buf)
{
	return sprintf(buf, "%s\n", DRVNAME);
}

static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);

static struct platform_device *amb_pdev;

static u8 amb_read_byte(struct i5k_amb_data *data, unsigned long offset)
{
	return ioread8(data->amb_mmio + offset);
}

static void amb_write_byte(struct i5k_amb_data *data, unsigned long offset,
			   u8 val)
{
	iowrite8(val, data->amb_mmio + offset);
}

static ssize_t show_amb_alarm(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);

	if (!(amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x20) &&
	     (amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x8))
		return sprintf(buf, "1\n");
	else
		return sprintf(buf, "0\n");
}

static ssize_t store_amb_min(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf,
			     size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	unsigned long temp;
	int ret = kstrtoul(buf, 10, &temp);
	if (ret < 0)
		return ret;

	temp = temp / 500;
	if (temp > 255)
		temp = 255;

	amb_write_byte(data, amb_reg_temp_min(attr->index), temp);
	return count;
}

static ssize_t store_amb_mid(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf,
			     size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	unsigned long temp;
	int ret = kstrtoul(buf, 10, &temp);
	if (ret < 0)
		return ret;

	temp = temp / 500;
	if (temp > 255)
		temp = 255;

	amb_write_byte(data, amb_reg_temp_mid(attr->index), temp);
	return count;
}

static ssize_t store_amb_max(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf,
			     size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	unsigned long temp;
	int ret = kstrtoul(buf, 10, &temp);
	if (ret < 0)
		return ret;

	temp = temp / 500;
	if (temp > 255)
		temp = 255;

	amb_write_byte(data, amb_reg_temp_max(attr->index), temp);
	return count;
}

static ssize_t show_amb_min(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	return sprintf(buf, "%d\n",
		500 * amb_read_byte(data, amb_reg_temp_min(attr->index)));
}

static ssize_t show_amb_mid(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	return sprintf(buf, "%d\n",
		500 * amb_read_byte(data, amb_reg_temp_mid(attr->index)));
}

static ssize_t show_amb_max(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	return sprintf(buf, "%d\n",
		500 * amb_read_byte(data, amb_reg_temp_max(attr->index)));
}

static ssize_t show_amb_temp(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	return sprintf(buf, "%d\n",
		500 * amb_read_byte(data, amb_reg_temp(attr->index)));
}

static ssize_t show_label(struct device *dev,
			  struct device_attribute *devattr,
			  char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);

	return sprintf(buf, "Ch. %d DIMM %d\n", attr->index >> CHANNEL_SHIFT,
		       attr->index & DIMM_MASK);
}

static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
{
	int i, j, k, d = 0;
	u16 c;
	int res = 0;
	int num_ambs = 0;
	struct i5k_amb_data *data = platform_get_drvdata(pdev);

	/* Count the number of AMBs found */
	/* ignore the high-order bit, see "Ugly hack" comment above */
	for (i = 0; i < MAX_MEM_CHANNELS; i++)
		num_ambs += hweight16(data->amb_present[i] & 0x7fff);

	/* Set up sysfs stuff */
	data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB,
				GFP_KERNEL);
	if (!data->attrs)
		return -ENOMEM;
	data->num_attrs = 0;

	for (i = 0; i < MAX_MEM_CHANNELS; i++) {
		c = data->amb_present[i];
		for (j = 0; j < REAL_MAX_AMBS_PER_CHANNEL; j++, c >>= 1) {
			struct i5k_device_attribute *iattr;

			k = amb_num_from_reg(i, j);
			if (!(c & 0x1))
				continue;
			d++;

			/* sysfs label */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_label", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
			iattr->s_attr.dev_attr.show = show_label;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;

			/* Temperature sysfs knob */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_input", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
			iattr->s_attr.dev_attr.show = show_amb_temp;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;

			/* Temperature min sysfs knob */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_min", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
			iattr->s_attr.dev_attr.show = show_amb_min;
			iattr->s_attr.dev_attr.store = store_amb_min;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;

			/* Temperature mid sysfs knob */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_mid", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
			iattr->s_attr.dev_attr.show = show_amb_mid;
			iattr->s_attr.dev_attr.store = store_amb_mid;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;

			/* Temperature max sysfs knob */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_max", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
			iattr->s_attr.dev_attr.show = show_amb_max;
			iattr->s_attr.dev_attr.store = store_amb_max;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;

			/* Temperature alarm sysfs knob */
			iattr = data->attrs + data->num_attrs;
			snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
				 "temp%d_alarm", d);
			iattr->s_attr.dev_attr.attr.name = iattr->name;
			iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
			iattr->s_attr.dev_attr.show = show_amb_alarm;
			iattr->s_attr.index = k;
			sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
			res = device_create_file(&pdev->dev,
						 &iattr->s_attr.dev_attr);
			if (res)
				goto exit_remove;
			data->num_attrs++;
		}
	}

	res = device_create_file(&pdev->dev, &dev_attr_name);
	if (res)
		goto exit_remove;

	data->hwmon_dev = hwmon_device_register(&pdev->dev);
	if (IS_ERR(data->hwmon_dev)) {
		res = PTR_ERR(data->hwmon_dev);
		goto exit_remove;
	}

	return res;

exit_remove:
	device_remove_file(&pdev->dev, &dev_attr_name);
	for (i = 0; i < data->num_attrs; i++)
		device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
	kfree(data->attrs);

	return res;
}

static int __devinit i5k_amb_add(void)
{
	int res = -ENODEV;

	/* only ever going to be one of these */
	amb_pdev = platform_device_alloc(DRVNAME, 0);
	if (!amb_pdev)
		return -ENOMEM;

	res = platform_device_add(amb_pdev);
	if (res)
		goto err;
	return 0;

err:
	platform_device_put(amb_pdev);
	return res;
}

static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
					    unsigned long devid)
{
	struct pci_dev *pcidev;
	u32 val32;
	int res = -ENODEV;

	/* Find AMB register memory space */
	pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
				devid,
				NULL);
	if (!pcidev)
		return -ENODEV;

	if (pci_read_config_dword(pcidev, I5K_REG_AMB_BASE_ADDR, &val32))
		goto out;
	data->amb_base = val32;

	if (pci_read_config_dword(pcidev, I5K_REG_AMB_LEN_ADDR, &val32))
		goto out;
	data->amb_len = val32;

	/* Is it big enough? */
	if (data->amb_len < AMB_CONFIG_SIZE * MAX_AMBS) {
		dev_err(&pcidev->dev, "AMB region too small!\n");
		goto out;
	}

	res = 0;
out:
	pci_dev_put(pcidev);
	return res;
}

static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
{
	struct pci_dev *pcidev;
	u16 val16;
	int res = -ENODEV;

	/* Copy the DIMM presence map for these two channels */
	pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
	if (!pcidev)
		return -ENODEV;

	if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16))
		goto out;
	amb_present[0] = val16;

	if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16))
		goto out;
	amb_present[1] = val16;

	res = 0;

out:
	pci_dev_put(pcidev);
	return res;
}

static struct {
	unsigned long err;
	unsigned long fbd0;
} chipset_ids[] __devinitdata  = {
	{ PCI_DEVICE_ID_INTEL_5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0 },
	{ PCI_DEVICE_ID_INTEL_5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0 },
	{ 0, 0 }
};

#ifdef MODULE
static struct pci_device_id i5k_amb_ids[] __devinitdata = {
	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
	{ 0, }
};
MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
#endif

static int __devinit i5k_amb_probe(struct platform_device *pdev)
{
	struct i5k_amb_data *data;
	struct resource *reso;
	int i, res;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	/* Figure out where the AMB registers live */
	i = 0;
	do {
		res = i5k_find_amb_registers(data, chipset_ids[i].err);
		if (res == 0)
			break;
		i++;
	} while (chipset_ids[i].err);

	if (res)
		goto err;

	/* Copy the DIMM presence map for the first two channels */
	res = i5k_channel_probe(&data->amb_present[0], chipset_ids[i].fbd0);
	if (res)
		goto err;

	/* Copy the DIMM presence map for the optional second two channels */
	i5k_channel_probe(&data->amb_present[2], chipset_ids[i].fbd0 + 1);

	/* Set up resource regions */
	reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
	if (!reso) {
		res = -EBUSY;
		goto err;
	}

	data->amb_mmio = ioremap_nocache(data->amb_base, data->amb_len);
	if (!data->amb_mmio) {
		res = -EBUSY;
		goto err_map_failed;
	}

	platform_set_drvdata(pdev, data);

	res = i5k_amb_hwmon_init(pdev);
	if (res)
		goto err_init_failed;

	return res;

err_init_failed:
	iounmap(data->amb_mmio);
	platform_set_drvdata(pdev, NULL);
err_map_failed:
	release_mem_region(data->amb_base, data->amb_len);
err:
	kfree(data);
	return res;
}

static int __devexit i5k_amb_remove(struct platform_device *pdev)
{
	int i;
	struct i5k_amb_data *data = platform_get_drvdata(pdev);

	hwmon_device_unregister(data->hwmon_dev);
	device_remove_file(&pdev->dev, &dev_attr_name);
	for (i = 0; i < data->num_attrs; i++)
		device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
	kfree(data->attrs);
	iounmap(data->amb_mmio);
	release_mem_region(data->amb_base, data->amb_len);
	platform_set_drvdata(pdev, NULL);
	kfree(data);
	return 0;
}

static struct platform_driver i5k_amb_driver = {
	.driver = {
		.owner = THIS_MODULE,
		.name = DRVNAME,
	},
	.probe = i5k_amb_probe,
	.remove = __devexit_p(i5k_amb_remove),
};

static int __init i5k_amb_init(void)
{
	int res;

	res = platform_driver_register(&i5k_amb_driver);
	if (res)
		return res;

	res = i5k_amb_add();
	if (res)
		platform_driver_unregister(&i5k_amb_driver);

	return res;
}

static void __exit i5k_amb_exit(void)
{
	platform_device_unregister(amb_pdev);
	platform_driver_unregister(&i5k_amb_driver);
}

MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_DESCRIPTION("Intel 5000 chipset FB-DIMM AMB temperature sensor");
MODULE_LICENSE("GPL");

module_init(i5k_amb_init);
module_exit(i5k_amb_exit);


text:
=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute

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.

=cut

=head1 CONTACT

  Please email comments or questions to the public Ensembl
  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

  Questions may also be sent to the Ensembl help desk at
  <http://www.ensembl.org/Help/Contact>.

=head1 NAME

Bio::EnsEMBL::Compara::RunnableDB::PairAligner::CreateAlignmentChainsJobs

=cut

=head1 SYNOPSIS

my $db      = Bio::EnsEMBL::Compara::DBAdaptor->new($locator);
my $runnableDB = Bio::EnsEMBL::Compara::RunnableDB::CreateAlignmentChainsJobs->new (
                                                    -input_id   => $input_id
                                                    -analysis   => $analysis );
$runnableDB->fetch_input(); #reads from DB
$runnableDB->run();
$runnableDB->write_output(); #writes to DB

=cut

=head1 DESCRIPTION

=cut

=head1 APPENDIX

The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _

=cut

package Bio::EnsEMBL::Compara::RunnableDB::PairAligner::CreateAlignmentChainsJobs;

use strict;

use Bio::EnsEMBL::Utils::Exception qw(throw warning);

use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');

#my $DEFAULT_DUMP_MIN_SIZE = 11500000;
my $DEFAULT_OUTPUT_METHOD_LINK = "LASTZ_CHAIN";

sub fetch_input {
  my $self = shift;

  # get DnaCollection of query
  throw("must specify 'query_collection_name' to identify DnaCollection of query")
    unless(defined($self->param('query_collection_name')));
  $self->param('query_collection', $self->compara_dba->get_DnaCollectionAdaptor->
                                fetch_by_set_description($self->param('query_collection_name')));
  throw("unable to find DnaCollection with name : ". $self->param('query_collection_name'))
    unless(defined($self->param('query_collection')));

  # get DnaCollection of target
  throw("must specify 'target_collection_name' to identify DnaCollection of query")
    unless(defined($self->param('target_collection_name')));
  $self->param('target_collection', $self->compara_dba->get_DnaCollectionAdaptor->
                                fetch_by_set_description($self->param('target_collection_name')));
  throw("unable to find DnaCollection with name : ". $self->param('target_collection_name'))
   unless(defined($self->param('target_collection')));

  # get MethodLinkSpeciesSet
  throw("Must specify 'mlss_id' to identify a MethodLinkSpeciesSet") unless (defined($self->param('input_mlss_id')));
  $self->param('method_link_species_set', $self->compara_dba->get_MethodLinkSpeciesSetAdaptor->fetch_by_dbID($self->param('input_mlss_id')));

  throw("unable to find method_link_species_set for mlss_id=",$self->param('input_mlss_id')) unless(defined($self->param('method_link_species_set')));

  $self->print_params;

  return 1;
}

sub run
{
  my $self = shift;
  return 1;
}

sub write_output
{
  my $self = shift;
  $self->createAlignmentChainsJobs();
  return 1;
}

##################################
#
# subroutines
#
##################################

sub print_params {
  my $self = shift;

  printf(" params:\n");
  printf("   method_link_species_set_id : %d\n", $self->param('method_link_species_set')->dbID);
  printf("   query_collection           : (%d) %s\n",
         $self->param('query_collection')->dbID, $self->param('query_collection')->description);
  printf("   target_collection          : (%d) %s\n",
         $self->param('target_collection')->dbID, $self->param('target_collection')->description);
}

sub createAlignmentChainsJobs
{
  my $self = shift;

  my (%qy_dna_hash, %tg_dna_hash);

  foreach my $dnafrag_chunk_set (@{$self->param('query_collection')->get_all_DnaFragChunkSets}) {
    my $dna_chunks = $dnafrag_chunk_set->get_all_DnaFragChunks();

    foreach my $chunk (@$dna_chunks) {
      my $dnafrag = $chunk->dnafrag;
      if (not exists $qy_dna_hash{$dnafrag->dbID}) {
        $qy_dna_hash{$dnafrag->dbID} = $dnafrag;
      }
    }
  }
  my %target_dna_hash;
  foreach my $dnafrag_chunk_set (@{$self->param('target_collection')->get_all_DnaFragChunkSets}) {
    my $dna_chunks = $dnafrag_chunk_set->get_all_DnaFragChunks();
    foreach my $chunk (@$dna_chunks) {
      my $dnafrag = $chunk->dnafrag;
      if (not exists $tg_dna_hash{$dnafrag->dbID}) {
        $tg_dna_hash{$chunk->dnafrag->dbID} = $dnafrag;
      }
    }
  }
  my $count=0;

  my $sql = "select g2.dnafrag_id from genomic_align g1, genomic_align g2 where g1.method_link_species_set_id = ? and g1.genomic_align_block_id=g2.genomic_align_block_id and g1.dnafrag_id = ? and g1.genomic_align_id != g2.genomic_align_id group by g2.dnafrag_id";
  my $sth = $self->compara_dba->dbc->prepare($sql);

  my $reverse_pairs; # used to avoid getting twice the same results for self-comparisons
  foreach my $qy_dnafrag_id (keys %qy_dna_hash) {
    $sth->execute($self->param('method_link_species_set')->dbID, $qy_dnafrag_id);

    my $tg_dnafrag_id;
    $sth->bind_columns(\$tg_dnafrag_id);
    while ($sth->fetch()) {

      next unless exists $tg_dna_hash{$tg_dnafrag_id};
      next if (defined($reverse_pairs->{$qy_dnafrag_id}->{$tg_dnafrag_id}));

      my $input_hash = {};

      $input_hash->{'qyDnaFragID'} = $qy_dnafrag_id;
      $input_hash->{'tgDnaFragID'} = $tg_dnafrag_id;

      $input_hash->{'input_mlss_id'} = $self->param('method_link_species_set')->dbID;
      $input_hash->{'output_mlss_id'} = $self->param('output_mlss_id');

      if ($self->param('query_collection')->dump_loc) {
        my $nib_file = $self->param('query_collection')->dump_loc
            . "/"
            . $qy_dna_hash{$qy_dnafrag_id}->name
            . ".nib";
        if (-e $nib_file) {
          $input_hash->{'query_nib_dir'} = $self->param('query_collection')->dump_loc;
        }
      }
      if ($self->param('target_collection')->dump_loc) {
        my $nib_file = $self->param('target_collection')->dump_loc
            . "/"
            . $tg_dna_hash{$tg_dnafrag_id}->name
            . ".nib";
        if (-e $nib_file) {
          $input_hash->{'target_nib_dir'} = $self->param('target_collection')->dump_loc;
        }
      }
      $reverse_pairs->{$tg_dnafrag_id}->{$qy_dnafrag_id} = 1;

      $self->dataflow_output_id($input_hash, 2);
      $count++;
    }
  }
  $sth->finish;

  if ($count == 0) {
      # No alignments have been found. Do not produce any alignment_chain jobs
      $self->input_job->autoflow(0);

    print "No jobs created\n";
  } else {
    printf("created %d jobs for AlignmentChains\n", $count);
  }

  #
  #Flow to 'update_max_alignment_length_after_chain' on branch 1
  #
  my $output_hash = {};
  %$output_hash = ('method_link_species_set_id' => $self->param('output_mlss_id'));
  $self->dataflow_output_id($output_hash,1);

}

1;


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>units example code: artist_tests.py — Matplotlib 1.3.1 documentation</title>
    <link rel="stylesheet" href="../../_static/pythonista.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Matplotlib 1.3.1 documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="top" title="Matplotlib 1.3.1 documentation" href="../../index.html" />
    <link rel="shortcut icon" type="image/png" href="../../_static/py.png" />
    <link rel="stylesheet" href="../_static/pythonista.css" type="text/css" />
    <meta name = "viewport" content = "width=device-width,initial-scale=1.0,user-scalable=no;">

Navigation

          index

          modules |

Matplotlib 1.3.1 documentation »

units example code: artist_tests.py¶

(Source code, png)

"""
Test unit support with each of the matplotlib primitive artist types

The axes handles unit conversions and the artists keep a pointer to
their axes parent, so you must init the artists with the axes instance
if you want to initialize them with unit data, or else they will not
know how to convert the units to scalars
"""
import random
import matplotlib.lines as lines
import matplotlib.patches as patches
import matplotlib.text as text
import matplotlib.collections as collections

from basic_units import cm, inch
import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.xaxis.set_units(cm)
ax.yaxis.set_units(cm)

if 0:
    # test a line collection
    # Not supported at present.
    verts = []
    for i in range(10):
        # a random line segment in inches
        verts.append(zip(*inch*10*np.random.rand(2, random.randint(2,15))))
    lc = collections.LineCollection(verts, axes=ax)
    ax.add_collection(lc)

# test a plain-ol-line
line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm], lw=2, color='black', axes=ax)
ax.add_line(line)

if 0:
    # test a patch
    # Not supported at present.
    rect = patches.Rectangle( (1*cm, 1*cm), width=5*cm, height=2*cm, alpha=0.2, axes=ax)
    ax.add_patch(rect)

t = text.Text(3*cm, 2.5*cm, 'text label', ha='left', va='bottom', axes=ax)
ax.add_artist(t)

ax.set_xlim(-1*cm, 10*cm)
ax.set_ylim(-1*cm, 10*cm)
#ax.xaxis.set_units(inch)
ax.grid(True)
ax.set_title("Artists with units")
plt.show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

    © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team; 2012 - 2013 The matplotlib development team.

    The Python Software Foundation is a non-profit corporation.
    Please donate.

    Last updated on May 03, 2016.
    Found a bug?

    Created using Sphinx 1.2.1.


text:
.class public final Landroid/os/BatteryStats$HistoryEventTracker;
.super Ljava/lang/Object;
.source "BatteryStats.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/os/BatteryStats;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "HistoryEventTracker"
.end annotation

# instance fields
.field private final mActiveEvents:[Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "[",
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Landroid/util/SparseIntArray;",
            ">;"
        }
    .end annotation
.end field

# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 949
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 950
    const/16 v0, 0x9

    new-array v0, v0, [Ljava/util/HashMap;

    check-cast v0, [Ljava/util/HashMap;

    iput-object v0, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    return-void
.end method

# virtual methods
.method public getStateForEvent(I)Ljava/util/HashMap;
    .locals 1
    .param p1, "code"    # I
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I)",
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Landroid/util/SparseIntArray;",
            ">;"
        }
    .end annotation

    .prologue
    .line 1002
    iget-object v0, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    aget-object v0, v0, p1

    return-object v0
.end method

.method public removeEvents(I)V
    .locals 3
    .param p1, "code"    # I

    .prologue
    .line 997
    const v1, -0xc001

    and-int v0, p1, v1

    .line 998
    .local v0, "idx":I
    iget-object v1, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    const/4 v2, 0x0

    aput-object v2, v1, v0

    .line 999
    return-void
.end method

.method public updateState(ILjava/lang/String;II)Z
    .locals 6
    .param p1, "code"    # I
    .param p2, "name"    # Ljava/lang/String;
    .param p3, "uid"    # I
    .param p4, "poolIdx"    # I

    .prologue
    const v5, -0xc001

    const/4 v3, 0x0

    .line 954
    const v4, 0x8000

    and-int/2addr v4, p1

    if-eqz v4, :cond_5

    .line 955
    and-int v1, p1, v5

    .line 956
    .local v1, "idx":I
    iget-object v4, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    aget-object v0, v4, v1

    .line 957
    .local v0, "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    if-nez v0, :cond_0

    .line 958
    new-instance v0, Ljava/util/HashMap;

    .end local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    .line 959
    .restart local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    iget-object v4, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    aput-object v0, v4, v1

    .line 961
    :cond_0
    invoke-virtual {v0, p2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/util/SparseIntArray;

    .line 962
    .local v2, "uids":Landroid/util/SparseIntArray;
    if-nez v2, :cond_1

    .line 963
    new-instance v2, Landroid/util/SparseIntArray;

    .end local v2    # "uids":Landroid/util/SparseIntArray;
    invoke-direct {v2}, Landroid/util/SparseIntArray;-><init>()V

    .line 964
    .restart local v2    # "uids":Landroid/util/SparseIntArray;
    invoke-virtual {v0, p2, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 966
    :cond_1
    invoke-virtual {v2, p3}, Landroid/util/SparseIntArray;->indexOfKey(I)I

    move-result v4

    if-ltz v4, :cond_3

    .line 993
    .end local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    .end local v1    # "idx":I
    .end local v2    # "uids":Landroid/util/SparseIntArray;
    :cond_2
    :goto_0
    return v3

    .line 970
    .restart local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    .restart local v1    # "idx":I
    .restart local v2    # "uids":Landroid/util/SparseIntArray;
    :cond_3
    invoke-virtual {v2, p3, p4}, Landroid/util/SparseIntArray;->put(II)V

    .line 993
    .end local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    .end local v1    # "idx":I
    .end local v2    # "uids":Landroid/util/SparseIntArray;
    :cond_4
    :goto_1
    const/4 v3, 0x1

    goto :goto_0

    .line 971
    :cond_5
    and-int/lit16 v4, p1, 0x4000

    if-eqz v4, :cond_4

    .line 972
    and-int v1, p1, v5

    .line 973
    .restart local v1    # "idx":I
    iget-object v4, p0, Landroid/os/BatteryStats$HistoryEventTracker;->mActiveEvents:[Ljava/util/HashMap;

    aget-object v0, v4, v1

    .line 974
    .restart local v0    # "active":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Landroid/util/SparseIntArray;>;"
    if-eqz v0, :cond_2

    .line 978
    invoke-virtual {v0, p2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/util/SparseIntArray;

    .line 979
    .restart local v2    # "uids":Landroid/util/SparseIntArray;
    if-eqz v2, :cond_2

    .line 983
    invoke-virtual {v2, p3}, Landroid/util/SparseIntArray;->indexOfKey(I)I

    move-result v1

    .line 984
    if-ltz v1, :cond_2

    .line 988
    invoke-virtual {v2, v1}, Landroid/util/SparseIntArray;->removeAt(I)V

    .line 989
    invoke-virtual {v2}, Landroid/util/SparseIntArray;->size()I

    move-result v3

    if-gtz v3, :cond_4

    .line 990
    invoke-virtual {v0, p2}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_1
.end method


text:
@media (min-width: 320px) and (max-width: 768px) {
.nav-tabs > li > a{font-size: 12px;}
}

@media (max-width:1920px) {
.content-main{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width:1280px) {
/*Content*/
.content-main{width:100%;}
}

/* Landscape */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1024px)
  and (orientation: landscape)
  and (-webkit-min-device-pixel-ratio: 2) {

}

@media (max-width:1024px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width:980px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width:900px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width:800px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width:768px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

/*Only for iPhone6+ landscape*/
@media (max-width: 736px) {

.profile-right{width:100%;}
.content-main{width:100%;}

.q-box{margin:0 20px 25px 0;}

}

/*Only for iPhone 6 landscape*/
@media (max-width: 667px) {

.profile-right{width:100%;}
.content-main{width:100%;}

.q-box{margin:0 20px 25px 0;}
}

@media (max-width: 640px) {

.head-left{width:27%;}
.profile-right{width:100%;}
.content-main{width:100%;}

.q-box{margin:0 20px 25px 0;}

}

@media (max-width: 600px) {

.profile-right{width:100%;}

/*Content*/
.content-main{width:100%;}
}

@media (max-width: 568px) {

/*Popups*/
.modal-dialog{margin-top:113px;}
.modal-body ul.form-login{width:80%;}

/*Header*/
.header{padding:5px 0;}
.head-left, .head-right{width:auto; margin:50px 5px 10px 5px; float:left;}
.head-left{float:left;}
.head-center{width:100%; float:left; text-align: center; margin-top:5px; position: absolute;}
.head-center a img{width:auto;}
.head-right{float:right;}

/*Header Dropdown*/
.arrow-top::after, .arrow-top::before{left:17%;}
.drop-ask{left:-32px;}
.askQ{left:0;}
.arrow-top.askQ::after, .arrow-top.askQ::before{left:4%;}

/*Content*/
.content-main{width:100%;}

.q-box{margin:0 20px 25px 0;}
.nav-tabs{margin:0px 0 0;}
.q-box:nth-child(odd){margin-right:0px;}

/*Profile Login*/
.tab-content .edit-profile .profile-right{width:100%;}
.tab-content .edit-profile .profile-right ul li label{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li label{width:100%;}

/*Profile User*/
.profile-right{width:100%;}
.profile-right ul li{width:100%; margin:0 0px 0 0;}
}

@media (max-width: 480px) {

/*Popups*/
.modal-dialog{margin-top:113px;}
.modal-body ul.form-login{width:80%;}

/*Header*/
.header{padding:5px 0;}
.head-left, .head-right{width:auto; margin:50px 5px 10px 5px; float:left;}
.head-left{float:left;}
.head-center{width:100%; float:left; text-align: center; margin-top:5px; position: absolute;}
.head-center a img{width:auto;}
.head-right{float:right;}

/*Header Dropdown*/
.arrow-top::after, .arrow-top::before{left:17%;}
.drop-ask{left:-32px;}
.askQ{left:0;}
.arrow-top.askQ::after, .arrow-top.askQ::before{left:4%;}

/*Content*/
.content-main{width:100%;}

.q-box{margin:0 95px 25px 95px;}
.nav-tabs{margin:45px 0 0 83px;}

/*Profile Login*/
.tab-content .edit-profile .profile-right{width:100%;}
.tab-content .edit-profile .profile-right ul li label{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li label{width:100%;}

/*Profile User*/
.profile-right{width:100%;}
.profile-right ul li{width:100%; margin:0 0px 0 0;}
}

/*Only for iPhone 6+ Portrait*/
@media (max-width: 414px) {

.content-main {width:100%;}
.nav-tabs {margin:45px 0 0 0;}

.q-box {margin:0 15px 25px;}
}

/*Only for iPhone6 Portrait*/
@media (max-width: 375px) {

.content-main {width:100%;}
.nav-tabs {margin:45px 0 0 0;}

.q-box {margin:0 15px 25px;}
}

@media (max-width: 360px) {

.content-main {width:100%;}
.nav-tabs {margin:45px 0 0 0;}

.q-box {margin:0 15px 25px;}

/*Popups*/
.modal-dialog{margin-top:113px;}
.modal-body ul.form-login{width:80%;}

/*Header*/
.header{padding:5px 0;}
.head-left, .head-right{width:auto; margin:50px 5px 10px 5px; float:left;}
.head-left{float:left;}
.head-center{width:100%; float:left; text-align: center; margin-top:5px; position: absolute;}
.head-center a img{width:auto;}
.head-right{float:right;}

/*Header Dropdown*/
.arrow-top::after, .arrow-top::before{left:17%;}
.drop-ask{left:-32px;}
.askQ{left:0;}
.arrow-top.askQ::after, .arrow-top.askQ::before{left:4%;}

/*Profile Login*/
.tab-content .edit-profile .profile-right{width:100%;}
.tab-content .edit-profile .profile-right ul li label{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li label{width:100%;}

/*Profile User*/
.profile-right{width:100%;}
.profile-right ul li{width:100%; margin:0 0px 0 0;}
}

@media (max-width: 320px) {

/*Popups*/
.modal-dialog{margin-top:113px;}
.modal-body ul.form-login{width:80%;}

/*Header*/
.header{padding:5px 0;}
.head-left, .head-right{width:auto; margin:50px 5px 10px 5px; float:left;}
.head-left{float:left;}
.head-center{width:100%; float:left; text-align: center; margin-top:5px; position: absolute;}
.head-center a img{width:auto;}
.head-right{float:right;}

/*Header Dropdown*/
.arrow-top::after, .arrow-top::before{left:17%;}
.drop-ask{left:-32px;}
.askQ{left:0;}
.arrow-top.askQ::after, .arrow-top.askQ::before{left:4%;}

/*Content*/
.content-main{width:100%;}

.q-box{margin:0 15px 25px 15px;}
.nav-tabs{margin:45px 0 0;}

/*Profile Login*/
.tab-content .edit-profile .profile-right{width:100%;}
.tab-content .edit-profile .profile-right ul li label{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li{width:100%;}
.tab-content .edit-profile .profile-right .row1 .proficiency li label{width:100%;}

/*Profile User*/
.profile-right{width:100%;}
.profile-right ul li{width:100%; margin:0 0px 0 0;}
}


text:
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import createLogger from 'redux-logger'
import rootReducer from '../reducers'

export default function configureStore() {
    const logger = createLogger()
    const store = createStore(
        rootReducer,
        applyMiddleware(thunk, logger)
    )

    if (module.hot) {
        // Enable Webpack hot module replacement for reducers
        module.hot.accept('../reducers', () => {
            const nextReducer = require('../reducers').default
            store.replaceReducer(nextReducer)
        })
    }

    return store
}


text:
package com.coffee.modules.sys.utils;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.coffee.common.utils.CacheUtils;
import com.coffee.common.utils.SpringContextHolder;
import com.coffee.modules.sys.dao.DictDao;
import com.coffee.modules.sys.entity.Dict;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * 字典工具类
 * @author coffee
 * @version 2013-5-29
 */
public class DictUtils {

	private static DictDao dictDao = SpringContextHolder.getBean(DictDao.class);

	public static final String CACHE_DICT_MAP = "dictMap";

	public static String getDictLabel(String value, String type, String defaultValue){
		if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(value)){
			for (Dict dict : getDictList(type)){
				if (type.equals(dict.getType()) && value.equals(dict.getValue())){
					return dict.getLabel();
				}
			}
		}
		return defaultValue;
	}

	public static String getDictLabels(String values, String type, String defaultValue){
		if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(values)){
			List<String> valueList = Lists.newArrayList();
			for (String value : StringUtils.split(values, ",")){
				valueList.add(getDictLabel(value, type, defaultValue));
			}
			return StringUtils.join(valueList, ",");
		}
		return defaultValue;
	}

	public static String getDictValue(String label, String type, String defaultLabel){
		if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(label)){
			for (Dict dict : getDictList(type)){
				if (type.equals(dict.getType()) && label.equals(dict.getLabel())){
					return dict.getValue();
				}
			}
		}
		return defaultLabel;
	}

	public static List<Dict> getDictList(String type){
		@SuppressWarnings("unchecked")
		Map<String, List<Dict>> dictMap = (Map<String, List<Dict>>)CacheUtils.get(CACHE_DICT_MAP);
		if (dictMap==null){
			dictMap = Maps.newHashMap();
			for (Dict dict : dictDao.findAllList(new Dict())){
				List<Dict> dictList = dictMap.get(dict.getType());
				if (dictList != null){
					dictList.add(dict);
				}else{
					dictMap.put(dict.getType(), Lists.newArrayList(dict));
				}
			}
			CacheUtils.put(CACHE_DICT_MAP, dictMap);
		}
		List<Dict> dictList = dictMap.get(type);
		if (dictList == null){
			dictList = Lists.newArrayList();
		}
		return dictList;
	}

	/*
	 * 反射根据对象和属性名获取属性值
	 */
	public static Object getValue(Object obj, String filed) {
		try {
			Class clazz = obj.getClass();
			PropertyDescriptor pd = new PropertyDescriptor(filed, clazz);
			Method getMethod = pd.getReadMethod();//获得get方法

			if (pd != null) {

				Object o = getMethod.invoke(obj);//执行get方法返回一个Object
				return o;

			}
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IntrospectionException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}

		return null;
	}
}


text:
import { Parse } from 'parse/node';
import PromiseRouter from '../PromiseRouter';
import rest from '../rest';

const Promise = Parse.Promise;
const INFO = 'info';
const ERROR = 'error';
const MILLISECONDS_IN_A_DAY = 24 * 60 * 60 * 1000;

// only allow request with master key
let enforceSecurity = (auth) => {
  if (!auth || !auth.isMaster) {
    throw new Parse.Error(
      Parse.Error.OPERATION_FORBIDDEN,
      'Clients aren\'t allowed to perform the ' +
      'get' + ' operation on logs.'
    );
  }
}

// check that date input is valid
let isValidDateTime = (date) => {
  if (!date || isNaN(Number(date))) {
    return false;
  }
}

export class LoggerController {

  constructor(loggerAdapter) {
    this._loggerAdapter = loggerAdapter;
  }

  // Returns a promise for a {response} object.
  // query params:
  // level (optional) Level of logging you want to query for (info || error)
  // from (optional) Start time for the search. Defaults to 1 week ago.
  // until (optional) End time for the search. Defaults to current time.
  // order (optional) Direction of results returned, either "asc" or "desc". Defaults to "desc".
  // size (optional) Number of rows returned by search. Defaults to 10
  handleGET(req) {
    if (!this._loggerAdapter) {
      throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
        'Logger adapter is not availabe');
    }

    let promise = new Parse.Promise();
    let from = (isValidDateTime(req.query.from) && new Date(req.query.from)) ||
      new Date(Date.now() - 7 * MILLISECONDS_IN_A_DAY);
    let until = (isValidDateTime(req.query.until) && new Date(req.query.until)) || new Date();
    let size = Number(req.query.size) || 10;
    let order = req.query.order || 'desc';
    let level = req.query.level || INFO;
    enforceSecurity(req.auth);
    this._loggerAdapter.query({
      from,
      until,
      size,
      order,
      level,
    }, (result) => {
      promise.resolve({
        response: result
      });
    });
    return promise;
  }

  getExpressRouter() {
    let router = new PromiseRouter();
    router.route('GET','/logs', (req) => {
      return this.handleGET(req);
    });
    return router;
  }
}

export default LoggerController;


text:
<BroadcastMonitor>
  <updated>2015-08-11T11:45:40</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-11T11:43:06</startTime>
    <itemId>1000080626:1244176</itemId>
    <titleId>216038588</titleId>
    <itemCode>FJ1344</itemCode>
    <itemReference></itemReference>
    <titleName>Dollar Green</titleName>
    <artistName>Lou Rawls</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>191</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-11T11:46:18</startTime>
    <itemId>1000080626:1245816</itemId>
    <titleId>216139206</titleId>
    <itemCode></itemCode>
    <itemReference></itemReference>
    <titleName>Silly Games</titleName>
    <artistName>Lindy Layton</artistName>
    <albumName></albumName>
    <CategoryCode>751</CategoryCode>
    <CategoryName>INVOER</CategoryName>
    <itemDuration>253</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


text:
using System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Objects;

namespace osu.Game.Screens.Edit
{
    public class EditorBeatmap<T> : IEditorBeatmap<T>
        where T : HitObject
    {
        /// <summary>
        /// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        public event Action<HitObject> HitObjectAdded;

        /// <summary>
        /// Invoked when a <see cref="HitObject"/> is removed from this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        public event Action<HitObject> HitObjectRemoved;

        /// <summary>
        /// Invoked when the start time of a <see cref="HitObject"/> in this <see cref="EditorBeatmap{T}"/> was changed.
        /// </summary>
        public event Action<HitObject> StartTimeChanged;

        private readonly Dictionary<T, Bindable<double>> startTimeBindables = new Dictionary<T, Bindable<double>>();
        private readonly Beatmap<T> beatmap;

        public EditorBeatmap(Beatmap<T> beatmap)
        {
            this.beatmap = beatmap;

            foreach (var obj in HitObjects)
                trackStartTime(obj);
        }

        public BeatmapInfo BeatmapInfo
        {
            get => beatmap.BeatmapInfo;
            set => beatmap.BeatmapInfo = value;
        }

        public BeatmapMetadata Metadata => beatmap.Metadata;

        public ControlPointInfo ControlPointInfo => beatmap.ControlPointInfo;

        public List<BreakPeriod> Breaks => beatmap.Breaks;

        public double TotalBreakTime => beatmap.TotalBreakTime;

        public IReadOnlyList<T> HitObjects => beatmap.HitObjects;

        IReadOnlyList<HitObject> IBeatmap.HitObjects => beatmap.HitObjects;

        public IEnumerable<BeatmapStatistic> GetStatistics() => beatmap.GetStatistics();

        public IBeatmap Clone() => (EditorBeatmap<T>)MemberwiseClone();

        /// <summary>
        /// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        /// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
        public void Add(T hitObject)
        {
            trackStartTime(hitObject);

            // Preserve existing sorting order in the beatmap
            var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime);
            beatmap.HitObjects.Insert(insertionIndex + 1, hitObject);

            HitObjectAdded?.Invoke(hitObject);
        }

        /// <summary>
        /// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        /// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
        public void Remove(T hitObject)
        {
            if (beatmap.HitObjects.Remove(hitObject))
            {
                var bindable = startTimeBindables[hitObject];
                bindable.UnbindAll();

                startTimeBindables.Remove(hitObject);
                HitObjectRemoved?.Invoke(hitObject);
            }
        }

        private void trackStartTime(T hitObject)
        {
            startTimeBindables[hitObject] = hitObject.StartTimeBindable.GetBoundCopy();
            startTimeBindables[hitObject].ValueChanged += _ =>
            {
                // For now we'll remove and re-add the hitobject. This is not optimal and can be improved if required.
                beatmap.HitObjects.Remove(hitObject);

                var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime);
                beatmap.HitObjects.Insert(insertionIndex + 1, hitObject);

                StartTimeChanged?.Invoke(hitObject);
            };
        }

        /// <summary>
        /// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        /// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
        public void Add(HitObject hitObject) => Add((T)hitObject);

        /// <summary>
        /// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap{T}"/>.
        /// </summary>
        /// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
        public void Remove(HitObject hitObject) => Remove((T)hitObject);
    }
}


text:
package classpath

import (
	"os"
	"path/filepath"
	"strings"
)

type AsteriskClassPathEntry struct {
	compoundEntry CompoundClassPathEntry
}

func newAsteriskClassPathEntry(path string) *AsteriskClassPathEntry {
	compoundEntry := CompoundClassPathEntry{}
	walkFn := func(path string, info os.FileInfo, err error) error {
		if strings.HasSuffix(path, ".jar") || strings.HasSuffix(path, ".JAR") {
			jarEntry := newJarClassPathEntry(path)
			compoundEntry.addEntry(jarEntry)
		}

		return nil
	}

	dir := path[:len(path)-1]
	filepath.Walk(dir, walkFn)

	return &AsteriskClassPathEntry{compoundEntry}
}

func (self *AsteriskClassPathEntry) readClassData(className string) (ClassPathEntry, []byte, error) {
	return self.compoundEntry.readClassData(className)
}

func (self *AsteriskClassPathEntry) String() string {
	return self.compoundEntry.String()
}


text:
import os

os.mkdir(''/Users/Filmon/Desktop/New Folder'')


text:
package org.apache.maven.rtinfo.internal;

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

import org.apache.maven.rtinfo.RuntimeInformation;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.util.version.GenericVersionScheme;
import org.sonatype.aether.version.InvalidVersionSpecificationException;
import org.sonatype.aether.version.Version;
import org.sonatype.aether.version.VersionConstraint;
import org.sonatype.aether.version.VersionScheme;

/**
 * Provides information about the current Maven runtime.
 */
@Component( role = RuntimeInformation.class )
public class DefaultRuntimeInformation
    implements RuntimeInformation
{

    @Requirement
    private Logger logger;

    private String mavenVersion;

    public String getMavenVersion()
    {
        if ( mavenVersion == null )
        {
            Properties props = new Properties();

            String resource = "META-INF/maven/org.apache.maven/maven-core/pom.properties";

            InputStream is = DefaultRuntimeInformation.class.getResourceAsStream( "/" + resource );
            if ( is != null )
            {
                try
                {
                    props.load( is );
                }
                catch ( IOException e )
                {
                    String msg = "Could not parse " + resource + ", Maven runtime information not available";
                    if ( logger.isDebugEnabled() )
                    {
                        logger.warn( msg, e );
                    }
                    else
                    {
                        logger.warn( msg );
                    }
                }
                finally
                {
                    IOUtil.close( is );
                }
            }
            else
            {
                logger.warn( "Could not locate " + resource + " on classpath, Maven runtime information not available" );
            }

            String version = props.getProperty( "version", "" ).trim();

            if ( !version.startsWith( "${" ) )
            {
                mavenVersion = version;
            }
            else
            {
                mavenVersion = "";
            }
        }

        return mavenVersion;
    }

    public boolean isMavenVersion( String versionRange )
    {
        VersionScheme versionScheme = new GenericVersionScheme();

        if ( versionRange == null )
        {
            throw new IllegalArgumentException( "Version range must not be null" );
        }
        if ( StringUtils.isBlank( versionRange ) )
        {
            throw new IllegalArgumentException( "Version range must not be empty" );
        }

        VersionConstraint constraint;
        try
        {
            constraint = versionScheme.parseVersionConstraint( versionRange );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new IllegalArgumentException( e.getMessage(), e );
        }

        Version current;
        try
        {
            String mavenVersion = getMavenVersion();
            if ( mavenVersion.length() <= 0 )
            {
                throw new IllegalStateException( "Could not determine current Maven version" );
            }

            current = versionScheme.parseVersion( mavenVersion );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new IllegalStateException( "Could not parse current Maven version: " + e.getMessage(), e );
        }

        if ( constraint.getRanges().isEmpty() )
        {
            return constraint.getVersion().compareTo( current ) <= 0;
        }
        return constraint.containsVersion( current );
    }

}