text:
'''
Created March, 2012

@author: Peter Heim

  r_shoulder.py - gateway to Arduino based arm controller
  Copyright (c) 2011 Peter Heim.  All right reserved.
  Borrowed heavily from Mike Feguson's ArbotiX base_controller.py code.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:
      * Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
      * Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
      * Neither the name of the Vanadium Labs LLC nor the names of its
        contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL VANADIUM LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''

import rospy
import tf
import math
from math import sin, cos, pi, radians, degrees
import sys
import time
from std_msgs.msg import String
from std_msgs.msg import Float64, Float32
from dynamixel_msgs.msg import MotorState
from dynamixel_msgs.msg import JointState
#from sensor_msgs.msg import JointState
from SerialDataGateway import SerialDataGateway

class R_shoulder(object):
        '''
        Helper class for communicating with an R_shoulder board over serial port
        '''

        def _HandleReceivedLine(self,  line):
                self._Counter = self._Counter + 1
                #rospy.logwarn(str(self._Counter) + " " + line)
                #if (self._Counter % 50 == 0):
                self._SerialPublisher.publish(String(str(self._Counter) + ", in:  " + line))

                if (len(line) > 0):
                        lineParts = line.split('\t')

                        if (lineParts[0] == 'p1'):
                                self._BroadcastJointStateinfo_P1(lineParts)
                                return
                        if (lineParts[0] == 'p2'):
                                self._BroadcastJointStateinfo_P2(lineParts)
                                return
                        if (lineParts[0] == 'p3'):
                                self._BroadcastJointStateinfo_P3(lineParts)
                                return
                        if (lineParts[0] == 'p4'):
                                self._BroadcastJointStateinfo_P4(lineParts)
                                return
                        if (lineParts[0] == 'p5'):
                                self._BroadcastJointStateinfo_P5(lineParts)
                                return

        def _BroadcastJointStateinfo_P1(self, lineParts):
                partsCount = len(lineParts)
                #rospy.logwarn(partsCount)
                if (partsCount  < 7):
                        pass
                try:
                        P1 = ((321-float(lineParts[1]))*0.008)-0.25
                        P2 = self.left_tilt
                        P3 = float(lineParts[3])# current
                        P4 = 0#float(lineParts[4])# speed
                        val = [P1, P2, P3, P4]
                        Motor_State = MotorState()
                        Motor_State.id = 11
                        Motor_State.goal = P2
                        Motor_State.position = P1
                        Motor_State.speed = P4
                        Motor_State.load = P3
                        Motor_State.moving = 0
                        Motor_State.timestamp = time.time()
                        self.P1_MotorPublisher.publish(Motor_State)
                        self._left_tilt_Publisher.publish(P1)
                        Joint_State = JointState()
                        Joint_State.name = "left_arm_tilt_joint"
                        Joint_State.goal_pos = P2
                        Joint_State.current_pos = P1
                        Joint_State.velocity = P4
                        Joint_State.load = P3
                        Joint_State.error = P1 - P2
                        Joint_State.is_moving = 0
                        Joint_State.header.stamp = rospy.Time.now()#.stamprospy.Time.from_sec(state.timestamp)
                        self._P1_JointPublisher.publish(Joint_State)
                        #rospy.logwarn(Joint_State)

                except:
                        rospy.logwarn("Unexpected error:left_arm_tilt_joint" + str(sys.exc_info()[0]))

        def _BroadcastJointStateinfo_P2(self, lineParts):
                partsCount = len(lineParts)
                #rospy.logwarn(partsCount)
                if (partsCount  < 4):
                        pass
                try:

                        P1 = ((321-float(lineParts[1]))*0.008)-0.12
                        P2 = self.right_tilt
                        P3 = 0#float(lineParts[3])# current
                        P4 = 0#float(lineParts[4])# speed
                        val = [P1, P2, P3, P4]
                        Motor_State = MotorState()
                        Motor_State.id = 11
                        Motor_State.goal = P2
                        Motor_State.position = P1
                        Motor_State.speed = P4
                        Motor_State.load = P3
                        Motor_State.moving = 0
                        Motor_State.timestamp = time.time()
                        self.P2_MotorPublisher.publish(Motor_State)
                        self._right_tilt_Publisher.publish(P1)
                        Joint_State = JointState()
                        Joint_State.name = "right_arm_tilt_joint"
                        Joint_State.goal_pos = P2
                        Joint_State.current_pos = P1
                        Joint_State.velocity = P4
                        Joint_State.load = P3
                        Joint_State.error = P1 - P2
                        Joint_State.is_moving = 0
                        Joint_State.header.stamp = rospy.Time.now()#.stamprospy.Time.from_sec(state.timestamp)
                        self._P2_JointPublisher.publish(Joint_State)
                        #rospy.logwarn(Joint_State)

                except:
                        rospy.logwarn("Unexpected error:right_arm_tilt_joint" + str(sys.exc_info()[0]))

        def _BroadcastJointStateinfo_P3(self, lineParts):
                partsCount = len(lineParts)
                #rospy.logwarn(partsCount)
                if (partsCount  < 7):
                        pass
                try:
                        #offset = Float(-1.57)
                        P1 = (float(lineParts[1])/1000)-0.6
                        P2 = self.right_lift #0-((float(lineParts[2])* 0.00174532925)-1.57)
                        P3 = 0#float(lineParts[3])
                        P4 = 0
                        val = [P1, P2, P3, P4]
                        Motor_State = MotorState()
                        Motor_State.id = 11
                        Motor_State.goal = P2
                        Motor_State.position = P1
                        Motor_State.speed = P4
                        Motor_State.load = P3
                        Motor_State.moving = 0
                        Motor_State.timestamp = time.time()
                        self.P3_MotorPublisher.publish(Motor_State)
                        #rospy.logwarn(Motor_State)
                        self._left_lift_Publisher.publish(P1)

                        Joint_State = JointState()
                        Joint_State.name = "left_arm_lift_joint"
                        Joint_State.goal_pos = P2
                        Joint_State.current_pos = P1
                        Joint_State.velocity = P4
                        Joint_State.load = P3
                        Joint_State.error = P1 - P2
                        Joint_State.is_moving = 0
                        Joint_State.header.stamp = rospy.Time.now()
                        self._P3_JointPublisher.publish(Joint_State)

                except:
                        rospy.logwarn("Unexpected error:left_arm_lift_joint" + str(sys.exc_info()[0]))

        def _BroadcastJointStateinfo_P4(self, lineParts):
                partsCount = len(lineParts)
                #rospy.logwarn(partsCount)
                if (partsCount  < 7):
                        pass
                try:
                        #off = 1570
                        P1 = float(lineParts[1])/1000
                        P2 = self.right_lift #0-((float(lineParts[2])* 0.00174532925)-1.57)
                        P3 = 0 #float(lineParts[3])
                        P4 = 0
                        val = [P1, P2, P3, P4]
                        Motor_State = MotorState()
                        Motor_State.id = 11
                        Motor_State.goal = P2
                        Motor_State.position = P1
                        Motor_State.speed = P4
                        Motor_State.load = P3
                        Motor_State.moving = 0
                        Motor_State.timestamp = time.time()
                        self.P4_MotorPublisher.publish(Motor_State)
                        #rospy.logwarn(Motor_State)
                        self._right_lift_Publisher.publish(P1)

                        Joint_State = JointState()
                        Joint_State.name = "right_arm_lift_joint"
                        Joint_State.goal_pos = P2
                        Joint_State.current_pos = P1
                        Joint_State.velocity = P4
                        Joint_State.load = P3
                        Joint_State.error = P1 - P2
                        Joint_State.is_moving = 0
                        Joint_State.header.stamp = rospy.Time.now()
                        self._P4_JointPublisher.publish(Joint_State)
                except:
                        rospy.logwarn("Unexpected error:right_arm_lift_joint" + str(sys.exc_info()[0]))

        def _BroadcastJointStateinfo_P5(self, lineParts):
                partsCount = len(lineParts)
                #rospy.logwarn(partsCount)
                if (partsCount  < 6):
                        pass
                try:

                        P1 = 0 - radians(float(lineParts[1])/10)
                        P2 = self.left_elbow
                        P3 = 0#float(lineParts[3])# current
                        P4 = 0#float(lineParts[4])# speed
                        val = [P1, P2, P3, P4]
                        Motor_State = MotorState()
                        Motor_State.id = 11
                        Motor_State.goal = P2
                        Motor_State.position = P1
                        Motor_State.speed = P4
                        Motor_State.load = P3
                        Motor_State.moving = 0
                        Motor_State.timestamp = time.time()
                        self.P5_MotorPublisher.publish(Motor_State)
                        self._left_elbow_Publisher.publish(P1)
                        Joint_State = JointState()
                        Joint_State.name = "left_arm_elbow_joint"
                        Joint_State.goal_pos = P2
                        Joint_State.current_pos = P1
                        Joint_State.velocity = P4
                        Joint_State.load = P3
                        Joint_State.error = P1 - P2
                        Joint_State.is_moving = 0
                        Joint_State.header.stamp = rospy.Time.now()#.stamprospy.Time.from_sec(state.timestamp)
                        self._P5_JointPublisher.publish(Joint_State)
                        #rospy.logwarn(Joint_State)

                except:
                        rospy.logwarn("Unexpected error:left_arm_elbow_joint" + str(sys.exc_info()[0]))

        def _WriteSerial(self, message):
                self._SerialPublisher.publish(String(str(self._Counter) + ", out: " + message))
                self._SerialDataGateway.Write(message)

        def __init__(self,):
                '''
                Initializes the receiver class.
                port: The serial port to listen to.
                baudrate: Baud rate for the serial communication
                '''

                #port = rospy.get_param("~port", "/dev/ttyACM0")
                #baud = int(rospy.get_param("~baud", "115200"))
                #self.name = name
                self.rate = rospy.get_param("~rate", 100.0)
                self.fake = rospy.get_param("~sim", False)
                self.cal_pan = rospy.get_param("~cal_pan", 0)
                self.cal_tilt = rospy.get_param("~cal_tilt", 0)
                self.cal_lift = rospy.get_param("~cal_lift", 0)
                self.cal_rotate = rospy.get_param("~cal_rotate", 0)
                self.cal_elbow = rospy.get_param("~cal_elbow", 0)
                self.right_tilt = 0
                self.left_tilt = 0
                self.right_lift = 1.57
                self.left_lift = 1.57
                self.left_elbow = 0

                #name = rospy.get_param("~name")
                self._Counter = 0

                rospy.init_node('r_shoulder')

                port = rospy.get_param("~port", "/dev/ttyACM0")
                baudRate = int(rospy.get_param("~baudRate", 115200))

                rospy.logwarn("Starting Right shoulder with serial port: " + port + ", baud rate: " + str(baudRate))

                # subscriptions

                rospy.Subscriber('left_arm_tilt_joint/command',Float64, self._HandleJoint_1_Command)
                rospy.Subscriber('right_arm_tilt_joint/command',Float64, self._HandleJoint_2_Command)
                rospy.Subscriber('left_arm_lift_joint/command',Float64, self._HandleJoint_3_Command)
                rospy.Subscriber('right_arm_lift_joint/command',Float64, self._HandleJoint_4_Command)
                rospy.Subscriber('left_arm_elbow_joint/command',Float64, self._HandleJoint_8_Command)

                self._SerialPublisher = rospy.Publisher('arm_upper', String, queue_size=5)

                self.P1_MotorPublisher = rospy.Publisher("/left_arm_tilt/motor_state", MotorState, queue_size=5)
                self.P2_MotorPublisher = rospy.Publisher("/right_arm_tilt/motor_state", MotorState, queue_size=5)
                self.P3_MotorPublisher = rospy.Publisher("/left_arm_lift/motor_state", MotorState, queue_size=5)
                self.P4_MotorPublisher = rospy.Publisher("/right_arm_lift/motor_state", MotorState, queue_size=5)
                self.P5_MotorPublisher = rospy.Publisher("/left_arm_elbow/motor_state", MotorState, queue_size=5)

                self._P1_JointPublisher = rospy.Publisher("/left_arm_tilt_joint/state", JointState, queue_size=5)
                self._P2_JointPublisher = rospy.Publisher("/right_arm_tilt_joint/state", JointState, queue_size=5)
                self._P3_JointPublisher = rospy.Publisher("/left_arm_lift_joint/state", JointState, queue_size=5)
                self._P4_JointPublisher = rospy.Publisher("/right_arm_lift_joint/state", JointState, queue_size=5)
                self._P5_JointPublisher = rospy.Publisher("/left_arm_elbow_joint/state", JointState, queue_size=5)

                self._right_lift_Publisher = rospy.Publisher("right_lift", Float32, queue_size=5)
                self._right_tilt_Publisher = rospy.Publisher("right_tilt", Float32, queue_size=5)
                self._left_lift_Publisher = rospy.Publisher("left_lift", Float32, queue_size=5)
                self._left_tilt_Publisher = rospy.Publisher("left_tilt", Float32, queue_size=5)
                self._left_elbow_Publisher = rospy.Publisher("left_elbow", Float32, queue_size=5)

                self._SerialDataGateway = SerialDataGateway(port, baudRate,  self._HandleReceivedLine)

        def Start(self):
                rospy.loginfo("Starting start function")
                self._SerialDataGateway.Start()
                message = 'r \r'
                self._WriteSerial(message)

        def Stop(self):
                rospy.loginfo("Stopping")
                message = 'r \r'
                self._WriteSerial(message)
                sleep(5)
                self._SerialDataGateway.Stop()

        def _HandleJoint_1_Command(self, Command):
                """ Handle movement requests.
                       left_arm_tilt_joint
                send message in degrees * 10

                """
                v = Command.data      # angel request in radians
                self.left_tilt = v
                v1 =int((90-degrees(v))/1.6)+27
                if v1 < 83: v1 = 83 #ticks
                if v1 > 160: v1 = 160 #ticks
                rospy.logwarn("Handling left tilt command: " + str(v))
                message = 'j6 %d \r' % (v1)#% self._GetBaseAndExponents((v1)
                rospy.logwarn("Sending left_arm_tilt_joint command: " + (message))
                self._WriteSerial(message)

        def _HandleJoint_2_Command(self, Command):#tilt
                """ Handle movement requests.
                       right_arm_tilt_joint
                send message in degrees * 10

                """
                v = Command.data      # angel request in radians
                self.right_tilt = v
                v1 =int((90-degrees(v))/1.6)+27
                if v1 < 83: v1 = 83 #ticks
                if v1 > 117: v1 = 117 #ticks
                #rospy.logwarn(v1)
                message = 'j2 %d \r' % (v1)#% self._GetBaseAndExponents((v1)
                rospy.logwarn("Sending right_arm_tilt_joint command: " + (message))
                self._WriteSerial(message)

        def _HandleJoint_3_Command(self, Command):
                """ Handle movement requests.
                             left_arm_lift_joint
                send message in degrees * 10

                """
                v = Command.data      # angel request in radians
                self.left_lift = v
                v1 =int(1023 -((v + 1.82) * 195.3786081396))#convert encoder value
                if v1 < 400: v1 = 400 #degrees * 10
                if v1 > 1000: v1 = 1000 #degrees * 10
                message = 'j5 %d \r' % (v1)#% self._GetBaseAndExponents((v1)
                rospy.logwarn("Sending left_arm_lift_joint command: " + (message))
                self._WriteSerial(message)
                #self._WriteSerial(message)

        def _HandleJoint_4_Command(self, Command):
                """ Handle movement requests.
                           right_arm_lift_joint
                send message in degrees * 10

                """
                v = Command.data      # angel request in radians
                self.right_lift = v
                #v1 =int(1023 -((v + 1.05) * 195.3786081396))#convert encoder value
                v1 = int((abs(v-1.57)/0.0042913)+511)
                if v1 < 520: v1 = 520 #degrees * 10
                if v1 > 1000: v1 = 1000 #degrees * 10
                rospy.logwarn("Handling lift command: " + str(v1) )

                #message = 's %.2f %.2f %.2f\r' % self._GetBaseAndExponents((v1))
                message = 'j1 %d \r' % (v1)#% self._GetBaseAndExponents((v1)
                rospy.logwarn("Sending new right_arm_lift_joint message: " + (message))
                self._WriteSerial(message)

        def _HandleJoint_8_Command(self, Command):
                """ Handle movement requests.
                             left_arm_elbow_joint
                send message in degrees * 10

                """
                v = Command.data      #
                self.left_elbow = v
                v1 =int((90-degrees(v))/0.98)-30
                if v1 < 61: v1 = 61 #ticks
                if v1 > 165: v1 = 167 #ticks
                message = 'j8 %d \r' % (v1)#% self._GetBaseAndExponents((v1)
                rospy.logwarn("Sending left_arm_elbow_joint command: " + (message))
                self._WriteSerial(message)

        def _GetBaseAndExponent(self, floatValue, resolution=4):
                '''
                Converts a float into a tuple holding two integers:
                The base, an integer with the number of digits equaling resolution.
                The exponent indicating what the base needs to multiplied with to get
                back the original float value with the specified resolution.
                '''

                if (floatValue == 0.0):
                        return (0, 0)
                else:
                        exponent = int(1.0 + math.log10(abs(floatValue)))
                        multiplier = math.pow(10, resolution - exponent)
                        base = int(floatValue * multiplier)

                        return(base, exponent - resolution)

        def _GetBaseAndExponents(self, floatValues, resolution=4):
                '''
                Converts a list or tuple of floats into a tuple holding two integers for each float:
                The base, an integer with the number of digits equaling resolution.
                The exponent indicating what the base needs to multiplied with to get
                back the original float value with the specified resolution.
                '''

                baseAndExponents = []
                for floatValue in floatValues:
                        baseAndExponent = self._GetBaseAndExponent(floatValue)
                        baseAndExponents.append(baseAndExponent[0])
                        baseAndExponents.append(baseAndExponent[1])

                return tuple(baseAndExponents)

if __name__ == '__main__':
        r_shoulder = R_shoulder()
        try:
                r_shoulder.Start()
                rospy.spin()

        except rospy.ROSInterruptException:
                r_shoulder.Stop()


text:
using System;
using System.Collections.Generic;

using Xamarin.Forms;

namespace XamarinExample
{
  public partial class AppShell : Xamarin.Forms.Shell
  {
    public AppShell()
    {
      InitializeComponent();
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
import pymongo
import sys

# Copyright 2013, 10gen, Inc.
# Author: Andrew Erlichson

# connnecto to the db on standard port
connection = pymongo.MongoClient("mongodb://localhost")

db = connection.m101                 # attach to db
collection = db.funnynumbers         # specify the colllection

magic = 0

try:
    iter = collection.find()
    for item in iter:
        if ((item['value'] % 3) == 0):
            magic = magic + item['value']

except Exception as e:
    print "Error trying to read collection:", type(e), e

print "The answer to Homework One, Problem 2 is " + str(int(magic))


text:
package hummingbird

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
)

type Anime struct {
	Id             int    `json:"id"`
	Slug           string `json:"slug"`
	Status         string `json:"status"`
	Url            string `json:"url"`
	Title          string `json:"title"`
	AlternateTitle string `json:"alternate_title"`
	EpisodeCount   int    `json:"episode_count"`
	CoverImage     string `json:"cover_image"`
	Synopsis       string `json:"synopsis"`
	ShowType       string `json:"show_type"`
	Genres         []struct {
		Name string `json:"name"`
	} `json:"genres"`

	FavRank int `json:"fav_rank"`
	FavId   int `json:"fav_id"`
}

func GetAnimeById(id int) (Anime, error) {
	return GetAnimeBySlug(fmt.Sprintf("%d", id))
}

func GetAnimeBySlug(slug string) (Anime, error) {
	var anime Anime
	var e apiError

	if req, err := http.NewRequest("GET", "http://hummingbird.me/api/v1/anime/"+slug, nil); err == nil {
		req.Header.Add("User-Agent", userAgent)
		if resp, err := defaultClient.Do(req); err == nil {
			decoder := json.NewDecoder(resp.Body)
			if resp.StatusCode == 200 {
				if err := decoder.Decode(&anime); err == nil {
					return anime, nil
				} else {
					return anime, err
				}
			} else {
				if err := decoder.Decode(&e); err == nil {
					return anime, e
				} else {
					return anime, fmt.Errorf("Failed to retrieve anime.")
				}
			}
		} else {
			return anime, err
		}
	} else {
		return anime, err
	}
}

func FindAnime(query string) ([]Anime, error) {
	var anime []Anime
	var e apiError
	v := url.Values{}
	v.Set("query", query)

	if req, err := http.NewRequest("GET", "http://hummingbird.me/api/v1/search/anime?"+v.Encode(), nil); err == nil {
		req.Header.Add("User-Agent", userAgent)
		if resp, err := defaultClient.Do(req); err == nil {
			decoder := json.NewDecoder(resp.Body)
			if resp.StatusCode == 200 {
				if err := decoder.Decode(&anime); err == nil {
					return anime, nil
				} else {
					return anime, err
				}
			} else {
				if err := decoder.Decode(&e); err == nil {
					return anime, e
				} else {
					return anime, fmt.Errorf("Failed to retrieve anime.")
				}
			}
		} else {
			return anime, err
		}
	} else {
		return anime, err
	}
}


text:
<?php

namespace PhilMareu\Laramanager\FieldTypes;

class TextFieldType extends FieldType
{

}


text:
package com.shsrobotics.library;

import edu.wpi.first.wpilibj.BuiltInAccelerometer;

public class CorrectedBuiltInAccelerometer extends BuiltInAccelerometer {

	public static final double BUILT_IN_2015_X_CORRECTION = -.0256351;
	public static final double BUILT_IN_2015_Y_CORRECTION = .012205527;

	private double xcorrection = 0;
	private double ycorrection = 0;

	public static BuiltInAccelerometer getCorrected2015() {
		CorrectedBuiltInAccelerometer cba = new CorrectedBuiltInAccelerometer();
		cba.setDriftCorrection(BUILT_IN_2015_X_CORRECTION, BUILT_IN_2015_Y_CORRECTION);
		return cba;
	}

	public void setDriftCorrection(double x, double y) {
		xcorrection = x;
		ycorrection = y;
	}

	@Override
	public double getX() {
		return super.getX() - xcorrection;
	}

	@Override
	public double getY() {
		return super.getY() - ycorrection;
	}

	public double getXFeet() {
		return getX() * 32.185;
	}

	public double getYFeet() {
		return getY() * 32.185;
	}
}


text:
package process.features;

public class Rectangle {
    private final int x;
    private final int y;
    private final int width;
    private final int height;

    public Rectangle(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

    public boolean conrains(int px, int py) {

        if (px >= x && px <= x + width && py >= y && py <= y + height)
            return true;
        else
            return false;

    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }
}


text:
package com.linkedin.thirdeye.anomalydetection.model.prediction;

import com.linkedin.thirdeye.anomalydetection.context.AnomalyDetectionContext;
import com.linkedin.thirdeye.anomalydetection.context.TimeSeries;
import java.util.List;

public class NoopPredictionModel extends AbstractPredictionModel {
  @Override public void train(List<TimeSeries> historicalTimeSeries,
      AnomalyDetectionContext anomalyDetectionContext) {

  }
}


text:
<?php
namespace Chamilo\Core\Metadata\Schema\Component;

use Chamilo\Core\Metadata\Schema\Manager;
use Chamilo\Core\Metadata\Schema\Table\Schema\SchemaTable;
use Chamilo\Core\Metadata\Storage\DataClass\Schema;
use Chamilo\Libraries\Architecture\Exceptions\NotAllowedException;
use Chamilo\Libraries\Format\Structure\ActionBar\Button;
use Chamilo\Libraries\Format\Structure\ActionBar\ButtonGroup;
use Chamilo\Libraries\Format\Structure\ActionBar\ButtonToolBar;
use Chamilo\Libraries\Format\Structure\ActionBar\Renderer\ButtonToolBarRenderer;
use Chamilo\Libraries\Format\Table\Interfaces\TableSupport;
use Chamilo\Libraries\Format\Theme;
use Chamilo\Libraries\Platform\Translation;
use Chamilo\Libraries\Storage\Query\Variable\PropertyConditionVariable;
use Chamilo\Libraries\Utilities\Utilities;

/**
 *
 * @package Chamilo\Core\Metadata\Schema\Component
 * @author Sven Vanpoucke - Hogeschool Gent
 * @author Hans De Bisschop <hans.de.bisschop@ehb.be>
 * @author Magali Gillard <magali.gillard@ehb.be>
 * @author Eduard Vossen <eduard.vossen@ehb.be>
 */
class BrowserComponent extends Manager implements TableSupport
{

    /**
     *
     * @var ButtonToolBarRenderer
     */
    private $buttonToolbarRenderer;

    /**
     * Executes this controller
     */
    public function run()
    {
        if (! $this->get_user()->is_platform_admin())
        {
            throw new NotAllowedException();
        }

        $html = array();

        $html[] = $this->render_header();
        $html[] = $this->as_html();
        $html[] = $this->render_footer();

        return implode(PHP_EOL, $html);
    }

    /**
     * Renders this components output as html
     */
    public function as_html()
    {
        $this->buttonToolbarRenderer = $this->getButtonToolbarRenderer();
        $html = array();

        $html[] = $this->buttonToolbarRenderer->render();

        $table = new SchemaTable($this);
        $html[] = $table->as_html();

        return implode(PHP_EOL, $html);
    }

    /**
     * Builds the action bar
     *
     * @return ButtonToolBarRenderer
     */
    protected function getButtonToolbarRenderer()
    {
        if (! isset($this->buttonToolbarRenderer))
        {
            $buttonToolbar = new ButtonToolBar($this->get_url());
            $commonActions = new ButtonGroup();

            $commonActions->addButton(
                new Button(
                    Translation::get('Create', null, Utilities::COMMON_LIBRARIES),
                    Theme::getInstance()->getCommonImagePath('Action/Create'),
                    $this->get_url(array(self::PARAM_ACTION => self::ACTION_CREATE))));

            $buttonToolbar->addButtonGroup($commonActions);
            $this->buttonToolbarRenderer = new ButtonToolBarRenderer($buttonToolbar);
        }

        return $this->buttonToolbarRenderer;
    }

    /**
     * Returns the condition
     *
     * @param string $table_class_name
     *
     * @return \libraries\storage\Condition
     */
    public function get_table_condition($table_class_name)
    {
        return $this->buttonToolbarRenderer->getConditions(
            array(new PropertyConditionVariable(Schema::class_name(), Schema::PROPERTY_NAME)));
    }
}


text:
package com.swandiggy.poe4j.data.rows.gen;

import java.util.List;
import com.swandiggy.poe4j.data.annotations.DatFile;
import com.swandiggy.poe4j.data.annotations.Order;
import com.swandiggy.poe4j.data.rows.BaseRow;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
@DatFile("RaceAreas")
public class RaceArea
    extends BaseRow
{

    @Order(0)
    private Races racesKey;
    @Order(1)
    private WorldAreas worldAreasKey;
    @Order(2)
    private List<Mods> modsKeys;
    @Order(3)
    private List<Long> keys0;

}


text:
package io.netty.testsuite.transport;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;

import io.netty.channel.ChannelHandler;
import io.netty.channel.IoHandlerFactory;
import io.netty.channel.MultithreadEventLoopGroup;
import org.junit.Test;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoop;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.ServerChannel;
import io.netty.channel.local.LocalAddress;
import io.netty.channel.local.LocalServerChannel;
import io.netty.util.concurrent.EventExecutor;
import io.netty.util.concurrent.Future;

public abstract class AbstractSingleThreadEventLoopTest {

    @Test
    @SuppressWarnings("deprecation")
    public void shutdownBeforeStart() throws Exception {
        EventLoopGroup group = new MultithreadEventLoopGroup(newIoHandlerFactory());
        assertFalse(group.awaitTermination(2, TimeUnit.MILLISECONDS));
        group.shutdown();
        assertTrue(group.awaitTermination(200, TimeUnit.MILLISECONDS));
    }

    @Test
    public void shutdownGracefullyZeroQuietBeforeStart() throws Exception {
        EventLoopGroup group =  new MultithreadEventLoopGroup(newIoHandlerFactory());
        assertTrue(group.shutdownGracefully(0L, 2L, TimeUnit.SECONDS).await(200L));
    }

    // Copied from AbstractEventLoopTest
    @Test(timeout = 5000)
    public void testShutdownGracefullyNoQuietPeriod() throws Exception {
        EventLoopGroup loop = new MultithreadEventLoopGroup(newIoHandlerFactory());
        ServerBootstrap b = new ServerBootstrap();
        b.group(loop)
                .channel(serverChannelClass())
                .childHandler(new ChannelHandler() { });

        // Not close the Channel to ensure the EventLoop is still shutdown in time.
        ChannelFuture cf = serverChannelClass() == LocalServerChannel.class
                ? b.bind(new LocalAddress("local")) : b.bind(0);
        cf.sync().channel();

        Future<?> f = loop.shutdownGracefully(0, 1, TimeUnit.MINUTES);
        assertTrue(loop.awaitTermination(600, TimeUnit.MILLISECONDS));
        assertTrue(f.syncUninterruptibly().isSuccess());
        assertTrue(loop.isShutdown());
        assertTrue(loop.isTerminated());
    }

    @Test
    public void shutdownGracefullyBeforeStart() throws Exception {
        EventLoopGroup group = new MultithreadEventLoopGroup(newIoHandlerFactory());
        assertTrue(group.shutdownGracefully(200L, 1000L, TimeUnit.MILLISECONDS).await(500L));
    }

    @Test
    public void gracefulShutdownAfterStart() throws Exception {
        EventLoop loop = new MultithreadEventLoopGroup(newIoHandlerFactory()).next();
        final CountDownLatch latch = new CountDownLatch(1);
        loop.execute(new Runnable() {
            @Override
            public void run() {
                latch.countDown();
            }
        });

        // Wait for the event loop thread to start.
        latch.await();

        // Request the event loop thread to stop.
        loop.shutdownGracefully(200L, 3000L, TimeUnit.MILLISECONDS);

        // Wait until the event loop is terminated.
        assertTrue(loop.awaitTermination(500L, TimeUnit.MILLISECONDS));

        assertRejection(loop);
    }

    private static final Runnable NOOP = new Runnable() {
        @Override
        public void run() { }
    };

    private static void assertRejection(EventExecutor loop) {
        try {
            loop.execute(NOOP);
            fail("A task must be rejected after shutdown() is called.");
        } catch (RejectedExecutionException e) {
            // Expected
        }
    }

    protected abstract IoHandlerFactory newIoHandlerFactory();
    protected abstract Class<? extends ServerChannel> serverChannelClass();
}


text:
<?php

namespace Minsal\PenutBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Departamento
 *
 * @ORM\Table(name="departamento", uniqueConstraints={@ORM\UniqueConstraint(name="idx_departamento_id", columns={"id"}), @ORM\UniqueConstraint(name="idx_departamento_codigo", columns={"codigo"})})
 * @ORM\Entity
 */
class Departamento
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @ORM\SequenceGenerator(sequenceName="departamento_id_seq", allocationSize=1, initialValue=1)
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="codigo", type="string", length=10, nullable=false)
     */
    private $codigo;

    /**
     * @var string
     *
     * @ORM\Column(name="nombre_departamento", type="string", length=30, nullable=false)
     */
    private $nombreDepartamento;

    /**
     * @var string
     *
     * @ORM\Column(name="director", type="string", length=30, nullable=true)
     */
    private $director;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set codigo
     *
     * @param string $codigo
     * @return Departamento
     */
    public function setCodigo($codigo)
    {
        $this->codigo = $codigo;

        return $this;
    }

    /**
     * Get codigo
     *
     * @return string
     */
    public function getCodigo()
    {
        return $this->codigo;
    }

    /**
     * Set nombreDepartamento
     *
     * @param string $nombreDepartamento
     * @return Departamento
     */
    public function setNombreDepartamento($nombreDepartamento)
    {
        $this->nombreDepartamento = $nombreDepartamento;

        return $this;
    }

    /**
     * Get nombreDepartamento
     *
     * @return string
     */
    public function getNombreDepartamento()
    {
        return $this->nombreDepartamento;
    }

    /**
     * Set director
     *
     * @param string $director
     * @return Departamento
     */
    public function setDirector($director)
    {
        $this->director = $director;

        return $this;
    }

    /**
     * Get director
     *
     * @return string
     */
    public function getDirector()
    {
        return $this->director;
    }

    public function __toString()
    {
        return $this->nombreDepartamento ? $this->nombreDepartamento : '';
    }
}


text:
@interface SMClsCallCell()

@property (nonatomic, strong) UILabel *nameLb;
@property (nonatomic, strong) UILabel *desLb;
@property (nonatomic, strong) UILabel *pathLb;

@end

@implementation SMClsCallCell

- (instancetype)init {
    if (self = [super init]) {
        [self buildUI];
    }
    return self;
}

- (void)buildUI {
    [self addSubview:self.nameLb];
    [self addSubview:self.desLb];
    [self addSubview:self.pathLb];
    [self.nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self).offset(10);
        make.right.equalTo(self).offset(-10);
    }];
    [self.desLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLb.mas_bottom).offset(10);
        make.left.equalTo(self.nameLb);
    }];
    [self.pathLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.desLb.mas_bottom).offset(10);
        make.left.equalTo(self.nameLb);
        make.right.equalTo(self).offset(-20);
    }];
}

- (void)updateWithModel:(SMCallTraceTimeCostModel *)model {
    self.nameLb.text = [NSString stringWithFormat:@"[%@ %@]",model.className,model.methodName];
    self.desLb.text = [NSString stringWithFormat:@"频次:%lu 耗时:%f",(unsigned long)model.frequency, model.timeCost * 1000];
    self.pathLb.text = model.path;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.pathLb.preferredMaxLayoutWidth = self.pathLb.frame.size.width;
}

- (UILabel *)nameLb {
    if (!_nameLb) {
        _nameLb = [[UILabel alloc] init];
        _nameLb.font = [UIFont boldSystemFontOfSize:16];
        _nameLb.textColor = [UIColor grayColor];
    }
    return _nameLb;
}
- (UILabel *)desLb {
    if (!_desLb) {
        _desLb = [[UILabel alloc] init];
        _desLb.font = [UIFont systemFontOfSize:12];
        _desLb.textColor = [UIColor grayColor];
    }
    return _desLb;
}
- (UILabel *)pathLb {
    if (!_pathLb) {
        _pathLb = [[UILabel alloc] init];
        _pathLb.numberOfLines = 0;
        _pathLb.font = [UIFont systemFontOfSize:12];
        _pathLb.textColor = [UIColor lightGrayColor];
    }
    return _pathLb;
}
@end


text:
Work with your clients for Zero Service Fee!

Hey {memberFname},

    Want to improve your rating, move up the ranks, and earn more money through PeoplePerHour? Here's how!

        Bring outside clients to PPH - you can do all your work in one place, build up your reputation and earn more work, all without any PPH fees! And your new clients will get a discount off their first job too - it's a win-win :)

        ✓Free use of escrow deposit and invoice system

        ✓All your clients invoices, statements and messaging in one place

        ✓Enhanced feedback and earnings to push you up the PPH ranks

        ✓Customer support to help with payment collection when needed

                    Invite Clients to PPH

                Kind Regards

                The PeoplePerHour Support Ninjas


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;

namespace Jasily.Reflection
{
    public static class TypeExtensions2
    {
        public static IEnumerable<TBase> GetImplementedObjects<TBase>([NotNull] this IEnumerable<Type> types, Predicate<Type> predicate = null)
            where TBase : class
        {
            if (types == null) throw new ArgumentNullException(nameof(types));
            var baseType = typeof(TBase).GetTypeInfo();
            return from type in types.Select(z => new { Type = z, TypeInfo = z.GetTypeInfo() })
                   where !type.TypeInfo.IsAbstract
                   where predicate?.Invoke(type.Type) ?? true
                   where baseType.IsAssignableFrom(type.TypeInfo)
                   select (TBase)JasilyActivator.CreateInstance(type.Type);
        }
    }
}


text:
        {{h.name}}
        {{h.name}}

        {{c[h.field]}}

        <md-button aria-label="More">
          <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
            <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
          </svg>
        </md-button>

  Rows count per page : 1, 10, 25, 50, 100 (current is {{count}})

   1">
    <md-button aria-label="Back" class="md-table-footer-item" ng-disabled="currentPage==0" ng-click="currentPage=currentPage-1">

    </md-button>

      <md-button aria-label="Next" class="md-primary md-table-footer-item" ng-click="goToPage($index)">
        {{$index+1}}
      </md-button>

    <md-button aria-label="Jump" class="md-table-footer-item" ng-disabled="currentPage==nbOfPages()-1" ng-click="currentPage=currentPage+1">

    </md-button>


text:
/*global describe, it, expect, require, jasmine */
'use strict';
var token = require('../../lib/skype/token'),
  https = require('https'),
  qs = require('querystring');

describe('Skype Token', () => {

  describe('getting the access token makes a request if the token is undefined', () => {
    it('includes the Skype AppId and Skype App Secret in the request body with the proper content length', done => {
      var credentialsData = qs.encode({
        grant_type: 'client_credentials',
        client_id: 'someSkypeAppId123',
        client_secret: 'someSkypePrivateKey123',
        scope: 'https://api.botframework.com/.default'
      });

      https.request.pipe(callOptions => {
        expect(callOptions).toEqual(jasmine.objectContaining({
          method: 'POST',
          hostname: 'login.microsoftonline.com',
          path: '/botframework.com/oauth2/v2.0/token',
          headers: {
            'cache-control': 'no-cache',
            'content-type': 'application/x-www-form-urlencoded',
            'content-length': Buffer.byteLength(credentialsData)
          },
          body: credentialsData
        }));

        done();
      });
      token.getToken('someSkypeAppId123', 'someSkypePrivateKey123');
    });

    it('does not resolve before the https endpoint responds', done => {
      https.request.pipe(done);
      token.getToken('someSkypeAppId123', 'someSkypePrivateKey123').then(done.fail, done.fail);
    });

    it('resolves when the https endpoint responds with 200', done => {
      https.request.pipe(() => {
        setTimeout(() => {
          https.request.calls[0].respond('200', 'OK', '{"access_token":"someAccessToken123"}');
        }, 10);
      });
      token.getToken('someSkypeAppId123', 'someSkypePrivateKey123').then(done, done.fail);
    });
  });

});


text:
package org.xlcloud.openstack.model.neutron;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;

/**
 * @author Krzysztof Szafrański, AMG.net
 */
public class Ports implements Serializable {

    private static final long serialVersionUID = -6717173964605831950L;

    @XmlElement( type = Port.class )
    private List<Port> ports;

    public List<Port> getPort() {
        if (ports == null) {
            ports = new ArrayList<>();
        }
        return ports;
    }

    /** {@inheritDoc} */
    @Override
    public String toString() {
        return "Ports [ports=" + ports + "]";
    }
}


text:
r'''
    Module for creating Roy Lichtenstein style images generator which creates
    images from a PIL Image.

    Each image is created using 3 different modules consisting of halftoning,
    edgeDetect and quantize. They are all used together to create the final
    product.

    Here is an example of how the code works:

        >>> f = 'lena.png'
        >>> try:
        ...     img = Image.open(f)
        ... except IOError:
        ...     img = Image.new('RGB', (512,512))
        ...     pix = img.load()
        ...     drw = pila.Draw(img)
        ...     colRatio = 255.0/img.size[0]
        ...     for x,y in pila.pixel_generator(*img.size, edgeW=15, edgeH=15):
        ...         pix[x,y] = (int(x*colRatio),0,int(y*colRatio))
        ...     drw.cp_circle((250,250), 100, (0,255,255))
        ...     img.show(command='display')
        ...
        >>> lichtenstein(img).show(command='display')
        >>> nCols = [(0,0,0),(255,255,255),(239,228,176),(128,0,128),(228,122,121)]
        >>> lichtenstein(img, nCols, qtNCols=6, edColour=(255,0,0), htBox=15).show(command='display')
        >>> nCols2 = [(83,31,72),(255,241,191),(38,22,184),(233,95,113),(190,159,163)]
        >>> htCol = (ht.AVERAGE_COLOUR, (80,50,90))
        >>> edCol = (12,163,243)
        >>> lichtenstein(img, nCols2, qtNCols=16, edColour=edCol, htColour=htCol).show(command='display')
        >>>

    To test/execute the examples in the module documentation make sure that
    you have imported the lichtenstein module and do the following:
    import doctest
    nfail, ntests = doctest.testmod(lichtenstein)

'''
from PIL import Image
import PILAddons as pila
import PIL.ImageOps as ImageOps
import halftoning as ht
import edgeDetect as ed
import quantize as qt

DEFAULT_COLOURS = ((0,0,0), (255,255,255), (190,0,0), (0,16,115), (248,196,0))

def lichtenstein(img, qtNewCols=DEFAULT_COLOURS, qtSigma=4, qtNCols=8,
                edSigma=1.4, edThresH=0.2, edThresL=0.1, edColour=(0,0,0),
                htBox=8, htColour=ht.AVERAGE_COLOUR_ON_WHITE, htCRatio=1,
                aalias=2):
    '''Generates a Roy Lichtenstein RGB PIL image from a PIL image.

    Parameters:
        img [PIL Image]   : a PIL Image object. Best results are created from
                            RGB images.
        qtNewCols [tuple] : a tuple of 3-tuple RGB values which will be the
                            new colours for the quantize process
        qtSigma [float]   : the magnitude for the gaussian blur used to reduce
                            the noise for the quantize process
        qtNCols [int]     : the number of colours used to reduce the image to
                            for the quantize process
        edSigma [float]   : the magnitude for the gaussain blur used to recduce
                            the noise for the edge detect process
        edThresH [float]  : the higher threshold boundry used for edge linking
                            and normalisation for the edge detect process
        edThresL [float]  : the lower threshold boundry used for edge linking
                            and normalisation for the edge detect process
        edColour [tuple]  : the RGB colour for the edges created by the edge
                            detect process
        htBox [int]       : the halftoning box width and height used for the
                            area of pixels a sample of luminosity values
        htColour [tuple]  : a 2-tuple containing the foreground colour and
                            background colour for the halftoning circles. Must
                            be RGB values or 'ht.AVERAGE_COLOUR'
        htCRatio [float]  : the circle ratio used for drawing the circles in
                            the halftoning process so that they can be overall
                            bigger or smaller in scale
        aalias [int]      : The anti-alias amount for the edges of all the
                            processes

        On Exit:
            Generates a Roy Lichtenstein image and returns an RGB PIL image.

        '''
    img = img.convert('RGB')
    quantImg = qt.quantize(img, qtNewCols, qtNCols, qtSigma, aalias)
    halfImg = ht.halftoning(quantImg, htBox, htCRatio, aalias, htColour)
    edgeImg = ed.canny_edge_detection(img, edSigma, edThresH, edThresL, edColour)

    edgeMask = ImageOps.invert(pila.convert_rgba_to_mask(edgeImg))

    halfMask = Image.new('1', img.size)

    halfMaskPix = halfMask.load()
    quantPix = quantImg.load()

    # Create a mask for the halftoning, making it visible where the colours
    # are still the orignal adaptive colours and not the new ones.
    for x,y in pila.pixel_generator(*img.size):
        if quantPix[x,y] in qtNewCols:
            halfMaskPix[x,y] = 1
        else:
            halfMaskPix[x,y] = 0

    compQuHt = Image.composite(quantImg, halfImg, halfMask) # Combine quant and half
    finalImg = Image.composite(compQuHt, edgeImg, edgeMask) # Combine compQuHt and edge
    return finalImg.convert('RGB')

if __name__ == "__main__":
    f = 'lena.png'
    try:
        img = Image.open(f)
    except IOError:
        img = Image.new('RGB', (512,512))
        pix = img.load()
        drw = pila.Draw(img)
        colRatio = 255.0/img.size[0]
        for x,y in pila.pixel_generator(*img.size, edgeW=15, edgeH=15):
            pix[x,y] = (int(x*colRatio),0,int(y*colRatio))
        drw.cp_circle((250,250), 100, (0,255,255), (0,0,0))
        img.show(command='display')

    lichtenstein(img).save('lichtenstein.jpg')

    nCols = [(0,0,0),(255,255,255),(239,228,176),(128,0,128),(228,122,121)]
    lichtenstein(img, nCols, qtNCols=6, edColour=(255,0,0), htBox=15).show(command='display')

    nCols2 = [(83,31,72),(255,241,191),(38,22,184),(233,95,113),(190,159,163)]
    htCol = (ht.AVERAGE_COLOUR, (80,50,90))
    edCol = (12,163,243)
    lichtenstein(img, nCols2, qtNCols=16, edColour=edCol, htColour=htCol).show(command='display')


text:
<!DOCTYPE html>

	<title>LOGIN</title>
	<link rel="stylesheet" type="text/css" href="formulario.css">

Usuario:

<input type="text" value="">

Contrasena:

<input type="text" value="">

<input type="submit" value="Iniciar sesion" >


text:
package org.robolectric.shadows;

import android.media.audiofx.AudioEffect;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;

import java.util.LinkedList;
import java.util.List;

@Implements(AudioEffect.class)
public class ShadowAudioEffect {

  private static List<AudioEffect.Descriptor> DESCRIPTORS = new LinkedList<>();

  public static void addEffect(AudioEffect.Descriptor descriptor) {
    DESCRIPTORS.add(descriptor);
  }

  @Implementation
  public static AudioEffect.Descriptor[] queryEffects() {
    return DESCRIPTORS.toArray(new AudioEffect.Descriptor[DESCRIPTORS.size()]);
  }

  @Resetter
  public static void reset() {
    DESCRIPTORS.clear();
  }
}


text:
package rusk.david.algorithms.graphs;

import org.hamcrest.Description;
import org.junit.internal.matchers.TypeSafeMatcher;

public class EdgeMatcher extends TypeSafeMatcher<Edge> {

	private String sourceNodeId;

	private String targetNodeId;

	private boolean directed;

	private int weight;

	public EdgeMatcher(String sourceNodeId, String targetNodeId,
			boolean directed, int weight) {
		this.sourceNodeId = sourceNodeId;
		this.targetNodeId = targetNodeId;
		this.directed = directed;
		this.weight = weight;
	}

	@Override
	public void describeTo(Description description) {
		description.appendText("edge from ").appendValue(sourceNodeId)
				.appendText(" to ").appendValue(targetNodeId)
				.appendText(" (directed=").appendValue(directed)
				.appendText(") ").appendText(" with weight ")
				.appendValue(weight);
	}

	@Override
	public boolean matchesSafely(Edge actualEdge) {
		return actualEdge.getSourceNode().getId().equals(sourceNodeId)
				&& actualEdge.getTargetNode().getId().equals(targetNodeId)
				&& actualEdge.isDirected() == directed
				&& actualEdge.getWeight() == weight;
	}

}


text:
CREATE TABLE Assets (
  ID VARCHAR(36) NOT NULL,
  Type SMALLINT DEFAULT NULL,
  Name VARCHAR(64) DEFAULT NULL,
  Description VARCHAR(64) DEFAULT NULL,
  Local BIT DEFAULT NULL,
  Temporary BIT DEFAULT NULL,
  Data BLOB,
  PRIMARY KEY (ID)
);


text:
const request = require('request-promise-native')
const post = require('./post')

commandResponse = (message) => {
  var command = message.text
  var slug = command.trim()
  var index = slug.indexOf('picatic.com/')
  if (index != -1) {
    var slug = slug.split("picatic.com/")[1]
  }
  getEvent(message, slug)
}

getEvent = (message, slug) => new Promise((resolve, reject) => {
  var req = request({
    url: 'https://api.picatic.com/v2/event/' + slug,
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    resolveWithFullResponse: true
  })

  req
    .then((response) => {
      var event = JSON.parse(response.body).data
      getTickets(event, message)
    })
    .catch((err) => {
      resolve()
      var body = errormessage(err)
      post(body, message.response_url)
    })
})

getTickets = (event, message) => new Promise((resolve, reject) => {
  var req = request({
    url: 'https://api.picatic.com/v2/ticket_price?filter[event_id]=' + event.id + '&page[limit]=50&page[offset]=0',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    resolveWithFullResponse: true
  })

  req
    .then((response) => {
      var tickets = JSON.parse(response.body).data
      sendMessage(event, tickets, message)
    })
    .catch((err) => {
      resolve()
      var body = errormessage(err)
      post(body, message.response_url)
    })
})

sendMessage = (event, tickets, message) => {
  var eventdata = event.attributes
  var link = eventdata.cover_image_uri
  var index = link.indexOf('https://s3.amazonaws.com/files.picatic.com/')
  if (index != -1) {
    var imgurl = link.substr(link.indexOf("https://s3.amazonaws.com/files.picatic.com/") + 43, link.length)
    var link = 'https://picatic.global.ssl.fastly.net/' + imgurl
  }
  let actions = []
  for (let i = 0; i < tickets.length; i++) {
    if (tickets[i].attributes.price === "0.00") {
      actions.push({
        "name": "ticket",
        "text": tickets[i].attributes.name,
        "style": "primary",
        "type": "button",
        "value": event.id + "-" + tickets[i].id,
        "confirm": {
          "title": "Are you sure to register?",
          "text": "1 x " + tickets[i].attributes.name + " for " + eventdata.title + " on " + eventdata.start_date + " " + eventdata.start_time,
          "ok_text": "Yes",
          "dismiss_text": "No"
        }
      }
      )
    }
  }
  var actionsection = {
    "title": "Get your free ticket!",
    "fallback": "You are unable to regsiter for a ticket",
    "callback_id": "chosen_ticket",
    "color": "#3AA3E3",
    "attachment_type": "default",
    "actions": actions
  }
  if (actions.length === 0) {
    var actionsection = {
      "title": "<" + "https://www.picatic.com/" + eventdata.slug + "|Get your tickets here!>",
      "color": "#3AA3E3",
    }
  }
  var body = {
    "response_type": "in_channel",
    "text": "@" + message.user_name + " shared an event!",
    "attachments": [
      {
        "title": eventdata.title + " (" + "https://www.picatic.com/" + eventdata.slug + ")",
        "image_url": link + "?height=168&width=456&type=crop",
      },
      {
        "text": "Event Summary: " + eventdata.summary,
        "fields": [
          {
            "title": "When",
            "value": eventdata.start_date + " " + eventdata.start_time,
            "short": true
          },
          {
            "title": "Where",
            "value": eventdata.venue_name + ", " + eventdata.venue_street + ", " + eventdata.venue_locality,
            "short": true
          }
        ]
      },
      actionsection
    ]
  }
  post(body, message.response_url)
}

errormessage = (err) => {
  var error = JSON.parse(err.response.body).errors[0].title
  var errorstatus = JSON.parse(err.response.body).errors[0].status
  var message = {
    "text": '',
    "attachments": [{
      "color": 'danger',
      "text": `*Error* ` + errorstatus + ": " + error,
      "mrkdwn_in": ['text']
    }]
  }
  return message
}

module.exports = commandResponse


text:
'use strict';
module.exports = function ($scope, TaskService, ProcessService) {

/*
    function loadProcessDefinitions() {
        ProcessService.all().then(function (result) {
          $scope.processDefinitions = result.data;
          console.log('Retrieved process definitions ', $scope.processDefinitions);
        });
    }
*/
    function loadTasks() {
        TaskService.all().then(function (result) {
            $scope.tasks = result.data;
            console.log('Retrieved tasks ', $scope.tasks);
        });
    }

    function completeTask(task) {
        TaskService.complete(task).then(function () {
            loadTasks();
            $scope.currentTask = null;
        });
    }

    function setCurrentTask(task) {
        $scope.currentTask = task;
    }

    function isCurrentTask(task) {
        return $scope.currentTask !== null && $scope.currentTask.taskId === task.taskId && $scope.currentTask.formKey === task.formKey;
    }

/*
    function createProcessInstance(processDefinition) {
        ProcessService.createProcessInstance(processDefinition).then(function () {
            loadTasks();
        });
    }
*/
    // export
    $scope.processDefinitions = [];
    $scope.currentTask = null;

    $scope.isCurrentTask = isCurrentTask;
    $scope.setCurrentTask = setCurrentTask;
    $scope.completeTask = completeTask;

    // pre-load
    loadTasks();

};


text:
package com.agileapes.powerpack.reflection.beans.impl;

import com.agileapes.powerpack.reflection.beans.BeanAccessor;
import com.agileapes.powerpack.reflection.beans.BeanAccessorFactory;

/**
 * This factory will produce instance of {@link GetterBeanAccessor}
 *
 * @author Mohammad Milad Naseri (m.m.naseri@gmail.com)
 * @since 1.0 (2012/11/16, 18:36)
 */
public class GetterBeanAccessorFactory implements BeanAccessorFactory {

    @Override
    public <B> BeanAccessor<B> getBeanAccessor(B object) {
        return new GetterBeanAccessor<B>(object);
    }

}


text:
//
//  BCBaseReq.h
//  BCPaySDK
//
//  Created by Ewenlong03 on 15/7/27.
//  Copyright (c) 2015年 BeeCloud. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BCPayConstant.h"

#pragma mark BCBaseReq
/**
 *  所有请求事件的基类,具体请参考BCRequest目录
 */
@interface BCBaseReq : NSObject
/**
 *  请求事件类型
 */
@property (nonatomic, assign) BCObjsType type;//100

@end