text:
from copy import copy
from secrets import compare_digest
from tempfile import NamedTemporaryFile
from traceback import format_exc
from typing import Dict, Optional

import demistomock as demisto  # noqa: F401
import uvicorn
from CommonServerPython import *  # noqa: F401
from fastapi import Depends, FastAPI, Request, Response
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from fastapi.security.api_key import APIKey, APIKeyHeader
from uvicorn.logging import AccessFormatter

''' Globals '''
# Get Target API Parameters
API_CRED_TYPE = demisto.params().get('api_credential_type')
API_PATH = demisto.params().get('api_path')
API_CREDENTIALS = demisto.params().get('api_credentials')
API_CUSTOM_HEADER = demisto.params().get('custom_auth_header')
API_CUSTOM_HEADER_VALUE = demisto.params().get('custom_auth_header_value')
API_PERMISSIONS = json.loads(demisto.params().get('api_permissions'))

app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)

basic_auth = HTTPBasic(auto_error=False)
token_auth = APIKeyHeader(auto_error=False, name='Authorization')

def is_json(jstr):
    try:
        json.loads(jstr)
    except ValueError:
        return False
    return True

class SimpleAPIProxyAccessFormatter(AccessFormatter):
    def get_user_agent(self, scope: Dict) -> str:
        headers = scope.get('headers', [])
        user_agent_header = list(filter(lambda header: header[0].decode() == 'user-agent', headers))
        user_agent = ''
        if len(user_agent_header) == 1:
            user_agent = user_agent_header[0][1].decode()
        return user_agent

    def formatMessage(self, record):
        recordcopy = copy(record)
        scope = recordcopy.__dict__['scope']
        user_agent = self.get_user_agent(scope)
        recordcopy.__dict__.update({'user_agent': user_agent})
        return super().formatMessage(recordcopy)

def make_api_request(
        url: str, method: str, data: Optional[dict] = None, parameters: Optional[dict] = None
) -> Union[requests.Response, Response]:
    '''
        Make request to api endpoint

    Args:

        url (str): endpoint to make request
        method (str): GET, POST action to perform
        data (Optional[Dict]): Body to be sent to service
        parameters (Optional[Dict]): Query parameters to be sent to service

    Returns:
        requests.Response object (For returning raw API response object) or Response object
        (For handling errors in integration configuration)
    '''

    http_basic_creds_to_pass = None
    headers_to_pass = None

    if API_CRED_TYPE:
        if API_CRED_TYPE == 'Basic':
            http_basic_creds_to_pass = (API_CREDENTIALS.get('identifier'), API_CREDENTIALS.get('password'))

        elif API_CRED_TYPE == 'Bearer Token':
            headers_to_pass = {
                "Authorization": f"Bearer {API_CREDENTIALS.get('password')}"
            }

        elif API_CRED_TYPE == 'Custom Header':
            if not API_CUSTOM_HEADER:
                return Response(status_code=200, content="Custom Header is not set in integration configuration "
                                                         "and Credential Type is selected as 'Custom Header'")

            elif not API_CUSTOM_HEADER_VALUE:
                return Response(status_code=200, content="Custom Header value is not set in integration configuration "
                                                         "and Credential Type is selected as 'Custom Header'")

            headers_to_pass = {
                API_CUSTOM_HEADER: API_CUSTOM_HEADER_VALUE
            }

    # json stringify if dict
    isjson = False
    if isinstance(data, dict):
        isjson = True

    if isjson:
        response = requests.request(method.upper(), url, json=data, params=parameters, auth=http_basic_creds_to_pass,
                                    headers=headers_to_pass, verify=False)
    else:
        response = requests.request(method.upper(), url, data=data, params=parameters, auth=http_basic_creds_to_pass,
                                    headers=headers_to_pass, verify=False)

    demisto.debug(f'Requests Request Headers: {response.request.headers}')
    demisto.debug(f'Requests Response: {response.text}')
    return response

# Set to / as we will take ALL authenticated POST against the instance and evaluated
# if the request is allowed via the api_permissions definition

@app.post('/')
async def handle_post(
        request: Request,
        credentials: HTTPBasicCredentials = Depends(basic_auth),
        token: APIKey = Depends(token_auth),
) -> Response:
    '''
        Handles the requests to '/' endpoint of the exposed service

    Args:
        request (Request): Actual Request object from client's request
        credentials (HTTPBasicCredentials): Credentials for the API
        token (APIKey): Token to be used for API request

    '''
    credentials_param = demisto.params().get('credentials')
    if credentials_param and (username := credentials_param.get('identifier')):
        password = credentials_param.get('password', '')
        auth_failed = False
        header_name = None
        if username.startswith('_header'):
            header_name = username.split(':')[1]
            token_auth.model.name = header_name
            if not token or not compare_digest(token, password):
                auth_failed = True
        elif (not credentials) or (not (compare_digest(credentials.username, username)
                                        and compare_digest(credentials.password, password))):
            auth_failed = True
        if auth_failed:
            request_headers = dict(request.headers)
            secret_header = (header_name or 'Authorization').lower()
            if secret_header in request_headers:
                request_headers[secret_header] = '***'
            demisto.debug(f'Authorization failed - request headers {request_headers}')
            return Response(status_code=401, content='Authorization failed.')

    # Check if METHOD and TARGET from the POST body are allowed per the api_permissions defined as an integration input

    body_from_request = await request.json()
    target_found = False
    allowed_methods = []

    for item in API_PERMISSIONS.get('Permissions'):
        # Matches from beginning of the string, same as ^[Endpoint]*
        if re.match(item.get('target'), body_from_request.get('target')):
            target_found = True
            allowed_methods = item.get('allowed_methods')
            break

    if target_found:
        # added to get the method from the client posted body
        method = body_from_request.get('method')

        if method in allowed_methods:
            data_for_post = body_from_request.get('body')
            parameters_for_get = body_from_request.get('parameters')

            # Parsing string type parameters to dict: "?var1=val1&var2=val2" -> {'var1': 'val1', 'var2': 'val2'}
            if parameters_for_get:
                parameters_for_get = dict(subString.split('=') for subString in parameters_for_get[1:].split('&'))

            url = API_PATH + body_from_request.get('target')

            demisto.debug(f'Target URL: {url}')

            result = make_api_request(url, method, data_for_post, parameters_for_get)

            if isinstance(result, Response):
                return Response(status_code=400, content=str(result.body))

            elif isinstance(result, requests.Response):
                if is_json(result.text):
                    return Response(status_code=result.status_code, content=json.dumps(result.json()),
                                    media_type="application/json")
                else:
                    return Response(status_code=result.status_code, content=result.text)
        else:
            return Response(status_code=400, content="Method not allowed.")

    return Response(status_code=400, content="Target not found.")

def run_log_running(port: int, is_test: bool = False):
    while True:
        certificate = demisto.params().get('certificate', '')
        private_key = demisto.params().get('key', '')

        certificate_path = ''
        private_key_path = ''
        try:
            ssl_args = dict()

            if certificate and private_key:
                certificate_file = NamedTemporaryFile(delete=False)
                certificate_path = certificate_file.name
                certificate_file.write(bytes(certificate, 'utf-8'))
                certificate_file.close()
                ssl_args['ssl_certfile'] = certificate_path

                private_key_file = NamedTemporaryFile(delete=False)
                private_key_path = private_key_file.name
                private_key_file.write(bytes(private_key, 'utf-8'))
                private_key_file.close()
                ssl_args['ssl_keyfile'] = private_key_path

                demisto.debug('Starting HTTPS Server')
            else:
                demisto.debug('Starting HTTP Server')

            integration_logger = IntegrationLogger()
            integration_logger.buffering = False
            log_config = dict(uvicorn.config.LOGGING_CONFIG)
            log_config['handlers']['default']['stream'] = integration_logger
            log_config['handlers']['access']['stream'] = integration_logger
            log_config['formatters']['access'] = {
                '()': SimpleAPIProxyAccessFormatter,
                'fmt': '%(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s "%(user_agent)s"'
            }
            uvicorn.run(app, host='0.0.0.0', port=port, log_config=log_config, **ssl_args)
            if is_test:
                time.sleep(5)
                return 'ok'
        except Exception as e:
            demisto.error(f'An error occurred in the long running loop: {str(e)} - {format_exc()}')
            demisto.updateModuleHealth(f'An error occurred: {str(e)}')
        finally:
            if certificate_path:
                os.unlink(certificate_path)
            if private_key_path:
                os.unlink(private_key_path)
            time.sleep(5)

def main() -> None:
    try:
        try:
            port = int(demisto.params().get('longRunningPort'))
        except ValueError as e:
            raise ValueError(f'Invalid listen port - {e}')
        if demisto.command() == 'test-module':
            return_results(run_log_running(port=port, is_test=True))
        elif demisto.command() == 'long-running-execution':
            run_log_running(port=port)
    except Exception as e:
        demisto.error(format_exc())
        return_error(f'Failed to execute {demisto.command()} command. Error: {e}')

if __name__ in ('__main__', '__builtin__', 'builtins'):
    main()


text:
#import <UIKit/UIKit.h>
#import <EXSplashScreen/EXSplashScreenViewProvider.h>

NS_ASSUME_NONNULL_BEGIN

/**
 * Provides a view for SplashScreen to be presented based on given configuration from the manifest.
 * Additionally it can reconfigure the view if manifest is changed during the app lifecycle
 * (you can provide an optimistic manifest at first and the actual manifest later on (e.g. when it's fetched from the network)).
 */
@interface EXManagedAppSplashScreenViewProvider : NSObject<EXSplashScreenViewProvider>

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithManifest:(EXManifestsManifest *)manifest;

/**
 * Triggers the view reconfiguration.
 */
- (void)updateSplashScreenViewWithManifest:(EXManifestsManifest *)manifest;

@end

NS_ASSUME_NONNULL_END

redpajama_set_name: RedPajamaGithub


text:
package com.webull.notification.repository.converter;

import com.webull.notification.domain.Frequency;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class FrequencyWriterConverter implements Converter<Frequency, Integer> {

	@Override
	public Integer convert(Frequency frequency) {
		return frequency.getDays();
	}
}


text:
using BizHawk.Client.EmuHawk;
using RTCV.CorruptCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RTCV.BizhawkVanguard
{
	public class VanguardRealTimeEvents : RTCV.CorruptCore.IRealTime
	{
		public bool SupportsRewind { get; set; } = true;
		public bool SupportsForwarding { get; set; } = true;
		public bool SupportsFastForwarding { get; set; } = true;

		public object GetDisplayForm { get
			{
				return GlobalWin.MainForm;
			}
		}

		public bool OverrideBackgroundInput { get; set; } = false;

		public event EventHandler<RealTimeEventArgs> StepHandler;
		public event EventHandler GameLoaded;
		public event EventHandler GameClosed;

		public void ON_STEP(bool _isForwarding, bool _isRewinding, bool _isFastForwarding)
		{
			StepHandler?.Invoke(this, new RealTimeEventArgs()
			{
				isForwarding = _isForwarding,
				isRewinding = _isRewinding,
				isFastForwarding = _isFastForwarding,
			});

		}

		public void LOAD_GAME() => GameLoaded?.Invoke(this, new EventArgs());
		public void GAME_CLOSED() => GameClosed?.Invoke(this, new EventArgs());
	}
}


text:
<?php

namespace Gaaarfild\LaravelNotifications;

use Illuminate\Support\Facades\Facade;

class NotificationsFacade extends Facade
{

    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor() { return 'Notifications'; }

}


text:
import re

class ActiveBranchMixin():

    def get_current_branch_name(self):
        """
        Return the name of the last checkout-out branch.
        """
        stdout = self.git("branch")
        try:
            correct_line = next(line for line in stdout.split("\n") if line.startswith("*"))
            return correct_line[2:]
        except StopIteration:
            return None

    def get_branch_status(self):
        """
        Return a string that gives:

          1) the name of the active branch
          2) the status of the active local branch
             compared to its remote counterpart.

        If no remote or tracking branch is defined, do not include remote-data.
        If HEAD is detached, provide that status instead.
        """
        stdout = self.git("status", "-b", "--porcelain").strip()

        if stdout == "## HEAD (no branch)":
            return "HEAD is in a detached state."

        first_line, *_ = stdout.split("\n", 1)
        if first_line.startswith("## Initial commit on "):
            return "Initial commit on `{}`.".format(first_line[21:])

        short_status_pattern = r"## ([A-Za-z0-9\-_\/]+)(\.\.\.([A-Za-z0-9\-_\/]+)( \[((ahead (\d+))(, )?)?(behind (\d+))?\])?)?"
        status_match = re.match(short_status_pattern, first_line)

        if not status_match:
            branch_name = first_line.split("\n", 2)[1]
            return "On branch `{}`.".format(branch_name)

        branch, _, remote, _, _, _, ahead, _, _, behind = status_match.groups()

        output = "On branch `{}`".format(branch)

        if remote:
            output += " tracking `{}`".format(remote)

        if ahead and behind:
            output += ". You're ahead by {} and behind by {}".format(ahead, behind)
        elif ahead:
            output += ". You're ahead by {}".format(ahead)
        elif behind:
            output += ". You're behind by {}".format(behind)

        output += "."

        return output

    def get_commit_hash_for_head(self):
        """
        Get the SHA1 commit hash for the commit at HEAD.
        """
        return self.git("rev-parse", "HEAD").strip()


text:
<Alloy>
	<View class="container" title="好友">
		<!-- <Widget src="com.hoyoji.titanium.widget.HoYoJiUIFrame"/> -->
		<Widget id="titleBar" src="com.hoyoji.titanium.widget.TitleBar" title="好友"  autoInit="false"
			 image="/images/mainWindow/friendAll"/>
		<View id="body" top="50" bottom="0" left="10" right="10" backgroundColor="#e1e1e1">
			<!-- <Widget src="com.hoyoji.titanium.widget.XTableView" id="friendCategoriesTable"
				autoInit="false"
				sortByField="name" bottom="0" top="0"/>  -->
			<Widget src="com.hoyoji.titanium.widget.XTableView" id="friendCategoriesTable"
			autoInit="false"
			groupByField="getFriendCategoryName()" sortByField="getDisplayName()" sortReverse="true" pageSize="rowHeight:84" bottom="0" top="0"/>
		</View>
		<Widget id="footerBar" src="com.hoyoji.titanium.widget.FooterBar" onSingletap="onFooterbarTap"
        	buttons="添加好友,新建好友" imagesFolder="/images/friend/friendAll"
        	ids="addFriend,createFriend"/>
	</View>
</Alloy>


text:
layout: page
title: "Oliver C.C Paine"
comments: true
description: "blanks"
keywords: "Oliver C.C Paine,CU,Boulder"
---
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script>
<!-- <script src="../assets/js/highcharts.js"></script> -->
<style type="text/css">@font-face {
	font-family: "Bebas Neue";
	src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype");
	}
	h1.Bebas {
		font-family: "Bebas Neue", Verdana, Tahoma;
	}
</style>
</head>

#### TEACHING INFORMATION

**College**: College of Arts and Sciences

**Classes taught**: ANTH 2030, ANTH 3010

#### ANTH 2030: Laboratory in Physical Anthropology 1

**Terms taught**: Fall 2010, Fall 2010, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013, Fall 2013

**Instructor rating**: 5.71

**Standard deviation in instructor rating**: 0.34

**Average grade** (4.0 scale): 3.26

**Standard deviation in grades** (4.0 scale): 0.24

**Average workload** (raw): 1.64

**Standard deviation in workload** (raw): 0.25

#### ANTH 3010: The Human Animal

**Terms taught**: Spring 2014

**Instructor rating**: 5.82

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 3.4

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 1.88

**Standard deviation in workload** (raw): 0.0


text:
package hello

import (
	"fmt"
	"net/http"
)

func HelloWorld(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "hello, world")
}


text:
import * as fs from 'fs';
import { cleanExistingLogFiles } from '../../src/utils/clean';

const mockBuildToolsInstallerPath = 'C:\\Users\\test\\.windows-build=tools\buildTools.exe';
const mockPythonInstallerPath = 'C:\\Users\\test\\.windows-build=tools\python.exe';

jest.mock('fs', () => ({
  existsSync: jest.fn(),
  unlinkSync: jest.fn()
}));

jest.mock('../../src/utils/get-build-tools-installer-path', () => ({
  getBuildToolsInstallerPath: jest.fn(() => ({
    logPath: mockBuildToolsInstallerPath
  }))
}));

jest.mock('../../src/utils/get-python-installer-path', () => ({
  getPythonInstallerPath: jest.fn(() => ({
    logPath: mockPythonInstallerPath
  }))
}));

describe('clean', () => {
  it('does not attempt to delete non-existing files', () => {
    cleanExistingLogFiles();

    expect(fs.existsSync).toHaveBeenCalledTimes(2);
    expect(fs.unlinkSync).toHaveBeenCalledTimes(0);
  });

  it('does attempt to delete existing files', () => {
    (fs.existsSync as any).mockReturnValue(true);

    cleanExistingLogFiles();

    expect(fs.existsSync).toHaveBeenCalledTimes(4);
    expect(fs.unlinkSync).toHaveBeenCalledTimes(2);
  });
});


text:
<metadata>
  <idinfo>
    <citation>
      <citeinfo>

        <origin>HALL, F.G.</origin>

        <origin>KNAPP, D.</origin>

        <origin>RAPALEE, G.</origin>

        <title>BOREAS FOLLOW-ON DSP-10 REGRIDDED NDVI MAPS FOR 1994</title>

     			<onlink>http://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=600</onlink>

        <onlink>http://daac.ornl.gov/mercury_harvest/600.xml</onlink>
         <alt_onlink>http://daac.ornl.gov/mercury_harvest/600.xml</alt_onlink>

        <onlink>http://daac.ornl.gov//BOREAS/FollowOn/guides/dsp10_ndvi_maps.html</onlink>

        <geoform>metadata</geoform>
      </citeinfo>
    </citation>
    <descript>
      <abstract>These images were produced by averaging the 1-km FASIR-NDVI maps by Jing Chen to a 10' (horizontal) by 5' (vertical) pixel size in a straight latitude/longitude grid.  Each pixel represents the average NDVI of the 1-km pixels that fall in each 10' by 5' pixel, where more than 50% of the 1-km pixels in the 10' by 5' area are not cloud and are not missing.  If more than 50% of the 1-km pixels are missing or cloudy, a value of 0 is assigned to the 10' by 5' pixel.</abstract>
      <supplinf />
    </descript>
    <timeperd>
      <timeinfo>
        <rngdates>
          <begdate>19940101</begdate>
          <enddate>19950101</enddate>
        </rngdates>
      </timeinfo>
    </timeperd>
    <status>
      <progress>Complete</progress>
      <update> As appropriate</update>
    </status>
    <spdom>
      <bounding>
        <westbc>-111</westbc>
        <eastbc>-90</eastbc>
        <northbc>60</northbc>
        <southbc>48</southbc>
      </bounding>
    </spdom>
    <keywords>
      <theme>
        <themekt>Parameter_Sensor_Source</themekt>

        <themekey>REFLECTANCE|AVHRR|NOAA-11</themekey>

      </theme>
      <theme>
        <themekt>Parameter</themekt>

        <themekey>REFLECTANCE</themekey>

      </theme>
      <theme>
        <themekt>Source</themekt>

        <themekey>NOAA-11</themekey>

      </theme>
      <theme>
        <themekt>Sensor</themekt>

        <themekey>AVHRR</themekey>

      </theme>

      <place>
        <placekt>Place Keywords</placekt>

        <placekey>BOREAL FORESTS/CANADA</placekey>

      </place>
    </keywords>

    <ptcontac>
      <cntinfo>
        <cntperp>
          <cntper>HALL, F.G.</cntper>
        </cntperp>
        <cntfax>6.1.10.8 Contact Electronic Mail: INTERNET &gt; </cntfax>
      </cntinfo>
    </ptcontac>
  </idinfo>
  <distinfo>
    <distrib>
      <cntinfo>
        <cntperp>
          <cntorg>The Oak Ridge National Laboratory (ORNL) Distributed Active Archive Center (DAAC)</cntorg>
          <cntper>ORNL DAAC User Services Office
        Oak Ridge National Laboratory
        Oak Ridge, Tennessee 37831 USA
        FAX: +1(865)574-4665</cntper>
        </cntperp>
        <cntvoice>+1(865)241-3952</cntvoice>
        <cntfax>6.1.10.8 Contact Electronic Mail: INTERNET &gt; </cntfax>
        <cntemail>ornldaac@ornl.gov</cntemail>
      </cntinfo>
    </distrib>
    <stdorder>
      <digform>
        <digtopt>
          <onlinopt>
            <computer>http://daac.ornl.gov/</computer>
            <accinstr>PUBLIC</accinstr>
          </onlinopt>
        </digtopt>
      </digform>
    </stdorder>
    <resdesc>Hall, F., G. Rapalee, and David Knapp. 2001. BOREAS Follow-On DSP-10 Regridded NDVI Maps for 1994. Data set. Available on-line [http://www.daac.ornl.gov] from Oak Ridge National Laboratory Distributed Active Archive Center, Oak Ridge, Tennessee, U.S.A. doi:10.3334/ORNLDAAC/600</resdesc>
  </distinfo>
  <metainfo>
    <metd>20011002</metd>
    <metc>
      <cntinfo>
        <cntorgp>
          <cntper>ORNL DAAC Staff</cntper>
        </cntorgp>
        <cntperp>
          <cntper>ORNL DAAC Staff</cntper>
        </cntperp>
        <cntvoice>+1(865)241-3952</cntvoice>
        <cntemail>ornldaac@ornl.gov</cntemail>
      </cntinfo>
    </metc>
    <metstdn>FGDC Content Standard for Digital Geospatial Metadata</metstdn>
  </metainfo>
  <Local-Control-Number>Created 2012 05 22 21 30 18 1331736618 by 160.91.11.44</Local-Control-Number>

  <mercury>
    <begdate>19940101</begdate>
    <enddate>19950101</enddate>

    <Site_Information>
      <Site>BOREAL FORESTS/CANADA</Site>
      <Westernmost_Longitude>-111</Westernmost_Longitude>
      <Easternmost_Longitude>-90</Easternmost_Longitude>
      <Northernmost_Latitude>60</Northernmost_Latitude>
      <Southernmost_Latitude>48</Southernmost_Latitude>
    </Site_Information>

    <Keywords>NDVI</Keywords>

    <Keywords>NOAA</Keywords>

    <Keywords>AVHRR-LAC</Keywords>

    <Keywords>REFLECTANCE</Keywords>

    <Parameter_Description>
      <Parameter>REFLECTANCE </Parameter>
      <Sensor>AVHRR </Sensor>
      <Source>NOAA-11 </Source>
      <Term>ATMOSPHERIC RADIATION </Term>
      <Topic>ATMOSPHERE </Topic>
    </Parameter_Description>

    <Project>BOREAS FOLLOW-ON</Project>

    <Navpath>NOAA-11|AVHRR|REFLECTANCE</Navpath>

    <Principal_Investigator>
      <Name>HALL, F.G.</Name>
      <Email />
    </Principal_Investigator>

    <Principal_Investigator>
      <Name>KNAPP, D.</Name>
      <Email />
    </Principal_Investigator>

    <Principal_Investigator>
      <Name>RAPALEE, G.</Name>
      <Email />
    </Principal_Investigator>

    <Data_Set_Link>
      <URL>http://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=600</URL>
      BOREAS FOLLOW-ON DSP-10 REGRIDDED NDVI MAPS FOR 1994
      <Link_Note />
    </Data_Set_Link>

    <Documentation_Link>
      <URL>http://daac.ornl.gov//BOREAS/FollowOn/guides/dsp10_ndvi_maps.html</URL>
      BOREAS FOLLOW-ON DSP-10 REGRIDDED NDVI MAPS FOR 1994
      <Text />
    </Documentation_Link>

    <OME_Software_Version>/home/web/mercury/write_mercury_xml.pl</OME_Software_Version>
    <OME_DTD_Version>mercury21.dtd</OME_DTD_Version>

    <Contact_Person>
      <Email>ornldaac@ornl.gov</Email>
      <Name>ORNL DAAC User Services Office
        Oak Ridge National Laboratory
        Oak Ridge, Tennessee 37831 USA
        FAX: +1(865)574-4665</Name>
      <Phone>+1(865)241-3952</Phone>
    </Contact_Person>

    <Temporal_Resolution />
    <enddate_blank />
    <File_ID>600</File_ID>
    <MD_Entry_id>dsp10_ndvi</MD_Entry_id>

    <Spatial_Extent>252</Spatial_Extent>

    <Search_Text_Link>
      <URL>http://daac.ornl.gov//BOREAS/FollowOn/guides/dsp10_ndvi_maps.html</URL>
      BOREAS FOLLOW-ON DSP-10 REGRIDDED NDVI MAPS FOR 1994
    </Search_Text_Link>

    <Granule_Details>

    </Granule_Details>
    <OGC_URL />
    <THREDDS_URL />

  </mercury>

</metadata>


text:
namespace Microsoft.Azure.Management.Storage.Models
{
    using Microsoft.Azure;
    using Microsoft.Azure.Management;
    using Microsoft.Azure.Management.Storage;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Identity for the resource.
    /// </summary>
    public partial class Identity
    {
        /// <summary>
        /// Initializes a new instance of the Identity class.
        /// </summary>
        public Identity()
        {
          CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the Identity class.
        /// </summary>
        /// <param name="principalId">The principal ID of resource
        /// identity.</param>
        /// <param name="tenantId">The tenant ID of resource.</param>
        public Identity(string principalId = default(string), string tenantId = default(string))
        {
            PrincipalId = principalId;
            TenantId = tenantId;
            CustomInit();
        }
        /// <summary>
        /// Static constructor for Identity class.
        /// </summary>
        static Identity()
        {
            Type = "SystemAssigned";
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets the principal ID of resource identity.
        /// </summary>
        [JsonProperty(PropertyName = "principalId")]
        public string PrincipalId { get; private set; }

        /// <summary>
        /// Gets the tenant ID of resource.
        /// </summary>
        [JsonProperty(PropertyName = "tenantId")]
        public string TenantId { get; private set; }

        /// <summary>
        /// The identity type.
        /// </summary>
        [JsonProperty(PropertyName = "type")]
        public static string Type { get; private set; }

    }
}


text:
package com.waylau.axon.cqrs.common.events;

import com.waylau.axon.cqrs.common.domain.AccountId;

/**
 * Create Account Event.
 *
 * @since 1.0.0 2020年1月21日
 * @author Way Lau
 */
public class CreateAccountEvent {
    private AccountId accountId;
    private String accountName;
    private long amount;

    public CreateAccountEvent(AccountId accountId,
    		String accountName, long amount) {
        this.accountId = accountId;
        this.accountName = accountName;
        this.amount = amount;
    }

    public AccountId getAccountId() {
        return accountId;
    }

    public String getAccountName() {
        return accountName;
    }

    public long getAmount() {
        return amount;
    }
}


text:
define(
    'cjs/deepDependency/level23',
    function ( require, exports, module ) {
        var level31 = require( 'cjs/deepDependency/level31' );
        module.exports = {
            name: 'cjs/deepDependency/level23',
            check: function () {
                var valid =
                    level31.name == 'cjs/deepDependency/level31';

                return valid;
            }
        };
    }
);


text:
package eu.binjr.core.data.indexes;

import com.github.benmanes.caffeine.cache.stats.CacheStats;
import eu.binjr.common.concurrent.ReadWriteLockHelper;
import eu.binjr.common.io.IOUtils;
import eu.binjr.common.javafx.controls.TimeRange;
import eu.binjr.common.logging.Logger;
import eu.binjr.common.logging.Profiler;
import eu.binjr.core.data.indexes.parser.EventFormat;
import eu.binjr.core.data.indexes.parser.ParsedEvent;
import eu.binjr.core.data.timeseries.FacetEntry;
import eu.binjr.core.preferences.UserPreferences;
import javafx.beans.property.LongProperty;
import javafx.beans.property.Property;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.facet.*;
import org.apache.lucene.facet.range.LongRange;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.*;
import org.apache.lucene.store.ByteBuffersDirectory;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.MMapDirectory;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;

public abstract class Index implements Indexable {
    public static final String TIMESTAMP = "timestamp";
    public static final String LINE_NUMBER = "lineNumber";
    public static final String FIELD_CONTENT = "content";
    public static final String PATH = "filePath";
    public static final String DOC_URI = "docUri";
    public static final float SEARCH_HIT_WEIGHT_FACTOR = 2.0f;
    private static final Logger logger = Logger.create(Index.class);
    protected final UserPreferences prefs = UserPreferences.getInstance();
    protected final Directory indexDirectory;
    protected final Directory taxonomyDirectory;
    protected final TaxonomyWriter taxonomyWriter;
    protected final IndexWriter indexWriter;
    protected final FacetsConfig facetsConfig;
    protected final Path indexDirectoryPath;
    protected final ExecutorService parsingThreadPool;
    protected final int parsingThreadsNumber;

    private final ReadWriteLockHelper indexLock = new ReadWriteLockHelper(new ReentrantReadWriteLock());
    protected DirectoryReader indexReader;
    protected IndexSearcher searcher;
    protected TaxonomyReader taxonomyReader;

    public Index() throws IOException {
        this.parsingThreadsNumber = prefs.parsingThreadNumber.get().intValue() < 1 ?
                Math.max(1, Runtime.getRuntime().availableProcessors() - 1) :
                Math.min(Runtime.getRuntime().availableProcessors(), prefs.parsingThreadNumber.get().intValue());

        AtomicInteger threadNum = new AtomicInteger(0);
        this.parsingThreadPool = Executors.newFixedThreadPool(parsingThreadsNumber, r -> {
            Thread thread = new Thread(r);
            thread.setName("parsing-thread-" + threadNum.incrementAndGet());
            return thread;
        });
        switch (prefs.indexLocation.get()) {
            case MEMORY:
                indexDirectory = new ByteBuffersDirectory();
                taxonomyDirectory = new ByteBuffersDirectory();
                logger.debug("Lucene index directory stored on the Java Heap");
                indexDirectoryPath = null;
                break;
            default:
            case FILES_SYSTEM:
                if (!MMapDirectory.UNMAP_SUPPORTED) {
                    logger.debug(MMapDirectory.UNMAP_NOT_SUPPORTED_REASON);
                }
                indexDirectoryPath = Files.createTempDirectory(prefs.temporaryFilesRoot.get(), "binjr-index_");
                indexDirectory = FSDirectory.open(indexDirectoryPath.resolve("index"));
                taxonomyDirectory = FSDirectory.open(indexDirectoryPath.resolve("taxonomy"));
                logger.debug("Lucene index directory stored at " + indexDirectoryPath);
                if (indexDirectory instanceof MMapDirectory mmapDir) {
                    logger.debug("Use unmap:" + mmapDir.getUseUnmap());
                }

        }
        logger.debug(() -> "New indexer initialized at " + indexDirectoryPath +
                " using " + parsingThreadsNumber + " parsing indexing threads");

        IndexWriterConfig iwc = new IndexWriterConfig(new StandardAnalyzer());
        iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
        this.indexWriter = new IndexWriter(indexDirectory, iwc);
        this.taxonomyWriter = new DirectoryTaxonomyWriter(taxonomyDirectory);
        indexReader = DirectoryReader.open(indexWriter);
        searcher = new IndexSearcher(indexReader);
        facetsConfig = initializeFacetsConfig(new FacetsConfig());
        logger.debug(() -> facetsConfig.getDimConfigs().entrySet().stream()
                .map(e -> "path= " + e.getKey() +
                        " field= " + e.getValue().indexFieldName +
                        " multivalued=" + e.getValue().multiValued +
                        " hierarchical=" + e.getValue().hierarchical +
                        " requireDimCount=" + e.getValue().requireDimCount)
                .collect(Collectors.joining("\n")));
        // initial commit
        commitIndexAndTaxonomy();
    }

    protected FacetsConfig initializeFacetsConfig(FacetsConfig facetsConfig) {
        facetsConfig.setRequireDimCount(PATH, true);
        facetsConfig.setDrillDownTermsIndexing(PATH, FacetsConfig.DrillDownTermsIndexing.ALL);
        return facetsConfig;
    }

    @Override
    public void add(String path,
                    InputStream ias,
                    EventFormat parser,
                    EnrichDocumentFunction enrichDocumentFunction,
                    LongProperty progress,
                    Property<IndexingStatus> indexingStatus) throws IOException {
        add(path, ias, true, parser, enrichDocumentFunction, progress, indexingStatus);
    }

    @Override
    public void add(String path,
                    InputStream ias,
                    boolean commit,
                    EventFormat parser,
                    EnrichDocumentFunction enrichDocumentFunction,
                    LongProperty progress,
                    Property<IndexingStatus> cancellationRequested) throws IOException {
        try (Profiler ignored = Profiler.start("Clear docs from " + path, logger::perf)) {
            indexWriter.deleteDocuments(new Term(DOC_URI, path));
        }
        try (Profiler ignored = Profiler.start("Indexing " + path, logger::perf)) {
            final AtomicLong nbLogEvents = new AtomicLong(0);
            try (Profiler p = Profiler.start(e -> logger.perf("Parsed and indexed " + nbLogEvents.get() + " events: " + e.toMilliString()))) {

                final AtomicBoolean taskDone = new AtomicBoolean(false);
                final AtomicBoolean taskAborted = new AtomicBoolean(false);
                final BlockingQueue<ParsedEvent> queue = new LinkedBlockingQueue<>(prefs.blockingQueueCapacity.get().intValue());
                final List<Future<Integer>> results = new ArrayList<>();

                for (int i = 0; i < parsingThreadsNumber; i++) {
                    results.add(parsingThreadPool.submit(() -> {
                        logger.trace(() -> "Starting parsing worker on thread " + Thread.currentThread().getName());
                        int nbEventProcessed = 0;
                        do {
                            List<ParsedEvent> todo = new ArrayList<>();
                            var drained = queue.drainTo(todo, prefs.parsingThreadDrainSize.get().intValue());
                            if (drained == 0 && queue.size() == 0) {
                                // Park the thread for a while before polling again
                                // as is it likely that producer is done.
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException e) {
                                    Thread.currentThread().interrupt();
                                }
                            }
                            try {
                                for (var logEvent : todo) {
                                    var doc = new Document();
                                    doc.add(new StringField(DOC_URI, path, Field.Store.NO));
                                    doc.add(new TextField(FIELD_CONTENT, logEvent.getText(), Field.Store.YES));
                                    doc.add(new SortedNumericDocValuesField(LINE_NUMBER, logEvent.getSequence()));
                                    var millis = logEvent.getTimestamp().toInstant().toEpochMilli();
                                    doc.add(new LongPoint(TIMESTAMP, millis));
                                    doc.add(new SortedNumericDocValuesField(TIMESTAMP, millis));
                                    doc.add(new StoredField(TIMESTAMP, millis));
                                    doc.add(new FacetField(PATH, path));
                                    doc.add(new StoredField(PATH, path));
                                    indexWriter.addDocument(facetsConfig.build(taxonomyWriter, enrichDocumentFunction.apply(doc, logEvent)));
                                    nbEventProcessed++;
                                }
                            } catch (Throwable t) {
                                // Signal that worker thread was aborted
                                taskAborted.set(true);
                                // Clears the blocking queue of all remaining tasks so that other workers finish ASAP
                                queue.clear();
                                throw t;
                            }
                        } while (!taskDone.get() && !Thread.currentThread().isInterrupted());
                        return nbEventProcessed;
                    }));
                }
                try (var aggregator = parser.parse(ias)) {
                    progress.bind(aggregator.progressIndicator());
                    for (var event : aggregator) {
                        if (taskAborted.get()) {
                            cancellationRequested.setValue(IndexingStatus.ABORTED);
                            break;
                        }
                        if (cancellationRequested.getValue() == IndexingStatus.CANCELED) {
                            break;
                        }
                        if (event == null) {
                            cancellationRequested.setValue(IndexingStatus.NO_RESULTS);
                            break;
                        }
                        queue.put(event);
                    }
                    while (!taskAborted.get() && queue.size() > 0) {
                        try {
                            Thread.sleep(200);
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                        }
                    }
                } catch (InterruptedException e) {
                    logger.error("Put to queue interrupted", e);
                    Thread.currentThread().interrupt();
                } finally {
                    taskDone.set(true);
                    progress.unbind();
                }
                for (Future<Integer> f : results) {
                    //signal exceptions that may have happened on thread pool
                    try {
                        logger.trace("Thread added " + f.get() + " log event to index");
                        nbLogEvents.addAndGet(f.get());
                    } catch (InterruptedException e) {
                        logger.error("Getting result from worker was interrupted", e);
                    } catch (Exception e) {
                        //rethrow execution exceptions
                        throw new IOException("Error parsing logEvent", e);
                    }
                }
            }
            if (commit) {
               commitIndexAndTaxonomy();
            }
        }

    }

    private void commitIndexAndTaxonomy() throws IOException {
        indexLock.write().lock(() -> {
            try (Profiler p = Profiler.start("Commit index", logger::perf)) {
                taxonomyWriter.commit();
                indexWriter.commit();
            }
            try (Profiler p = Profiler.start("Refresh index reader and searcher", logger::perf)) {
                var updatedReader = DirectoryReader.openIfChanged(indexReader);
                if (updatedReader != null) {
                    this.indexReader.close();
                    this.indexReader = updatedReader;
                    this.searcher = new IndexSearcher(indexReader);
                }
                if (taxonomyReader == null) {
                    taxonomyReader = new DirectoryTaxonomyReader(taxonomyDirectory);
                } else {
                    var updatedTaxoReader = DirectoryTaxonomyReader.openIfChanged(taxonomyReader);
                    if (updatedTaxoReader != null) {
                        this.taxonomyReader.close();
                        this.taxonomyReader = updatedTaxoReader;
                    }
                }
            }
        });
    }

    public ReadWriteLockHelper getIndexMonitor() {
        return indexLock;
    }

    @Override
    public TimeRange getTimeRangeBoundaries(List<String> files, ZoneId zoneId) throws IOException {
        return indexLock.read().lock(() -> {
            ZonedDateTime beginning = getTimeRangeBoundary(false, files, zoneId);
            ZonedDateTime end = getTimeRangeBoundary(true, files, zoneId);
            return (TimeRange.of(
                    beginning != null ? beginning : ZonedDateTime.now().minusHours(24),
                    end != null ? end : ZonedDateTime.now()));
        });
    }

    @Override
    public void close() throws IOException {
        IOUtils.close(taxonomyReader);
        IOUtils.close(indexReader);
        IOUtils.close(taxonomyWriter);
        IOUtils.close(indexWriter);
        IOUtils.close(indexDirectory);
        if (parsingThreadPool != null) {
            try {
                parsingThreadPool.shutdown();
                parsingThreadPool.awaitTermination(30, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                logger.error("Termination interrupted", e);
            }
        }
        if (indexDirectoryPath != null) {
            IOUtils.attemptDeleteTempPath(indexDirectoryPath);
        }
    }

    public static Map<String, FacetEntry> makeFacetResult(String facetName, Facets facets, Map<String, Collection<String>> params)
            throws IOException {
        var facetEntryMap = new TreeMap<String, FacetEntry>();
        var synthesis = facets.getTopChildren(100, facetName);
        var labels = new ArrayList<String>();
        if (synthesis != null) {
            for (var f : synthesis.labelValues) {
                facetEntryMap.put(f.label, new FacetEntry(facetName, f.label, f.value.intValue()));
                labels.add(f.label);
            }
            // Add facets labels used in query if not present in the result
            params.getOrDefault(facetName, List.of()).stream()
                    .filter(l -> !labels.contains(l))
                    .map(l -> new FacetEntry(facetName, l, 0))
                    .forEach(f -> facetEntryMap.put(f.getLabel(), f));
        }
        return facetEntryMap;
    }

    public static String printCacheStats(String title, CacheStats stats) {
        return String.format("%s: requestCount=%d hitCount=%d hitRate=%f missCount=%d evictionCount=%d evictionWeight=%d",
                title,
                stats.requestCount(),
                stats.hitCount(),
                stats.hitRate(),
                stats.missCount(),
                stats.evictionCount(),
                stats.evictionWeight()
        );
    }

    public static LongRange[] computeRanges(long start, long end, int numBuckets) {
        long durationMs = end - start;
        int nbBuckets = (int) Math.min(numBuckets, durationMs);
        double intervalLength = durationMs / (double) nbBuckets;
        LongRange[] ranges = new LongRange[nbBuckets];
        for (int i = 0; i < nbBuckets; i++) {
            long bucket_start = Math.round(start + i * intervalLength);
            long bucket_end = Math.round((start + i * intervalLength) + intervalLength);
            ranges[i] = new LongRange(String.format("%d;%d", bucket_start, bucket_end), bucket_start, false, bucket_end, true);
        }
        return ranges;
    }

    private ZonedDateTime getTimeRangeBoundary(boolean getMax, List<String> files, ZoneId zoneId) throws IOException {
        return indexLock.read().lock(() -> {
            var drill = new DrillSideways(searcher, facetsConfig, taxonomyReader);
            var dq = new DrillDownQuery(facetsConfig);
            for (var label : files) {
                dq.add(PATH, label);
            }
            var top = drill.search(dq,
                    null,
                    null,
                    1,
                    new Sort(new SortedNumericSortField(TIMESTAMP, SortField.Type.LONG, getMax)),
                    false);
            if (top.hits.scoreDocs.length > 0) {
                return ZonedDateTime.ofInstant(
                        Instant.ofEpochMilli(Long.parseLong(
                                searcher.doc(top.hits.scoreDocs[0].doc).get(TIMESTAMP))).plusMillis(getMax ? 1 : -1), zoneId);
            }
            return null;
        });
    }

}


text:
package org.hl7.fhir.dstu3.model.codesystems;

// Generated on Tue, Dec 6, 2016 09:42-0500 for FHIR v1.8.0

import org.hl7.fhir.exceptions.FHIRException;

public enum AddressType {

        /**
         * Mailing addresses - PO Boxes and care-of addresses.
         */
        POSTAL,
        /**
         * A physical address that can be visited.
         */
        PHYSICAL,
        /**
         * An address that is both physical and postal.
         */
        BOTH,
        /**
         * added to help the parsers
         */
        NULL;
        public static AddressType fromCode(String codeString) throws FHIRException {
            if (codeString == null || "".equals(codeString))
                return null;
        if ("postal".equals(codeString))
          return POSTAL;
        if ("physical".equals(codeString))
          return PHYSICAL;
        if ("both".equals(codeString))
          return BOTH;
        throw new FHIRException("Unknown AddressType code '"+codeString+"'");
        }
        public String toCode() {
          switch (this) {
            case POSTAL: return "postal";
            case PHYSICAL: return "physical";
            case BOTH: return "both";
            default: return "?";
          }
        }
        public String getSystem() {
          return "http://hl7.org/fhir/address-type";
        }
        public String getDefinition() {
          switch (this) {
            case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses.";
            case PHYSICAL: return "A physical address that can be visited.";
            case BOTH: return "An address that is both physical and postal.";
            default: return "?";
          }
        }
        public String getDisplay() {
          switch (this) {
            case POSTAL: return "Postal";
            case PHYSICAL: return "Physical";
            case BOTH: return "Postal & Physical";
            default: return "?";
          }
    }

}


text:
// Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved.
// This is part of Xively4J library, it is under the BSD 3-Clause license.
package com.xively.client.http.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import com.xively.client.http.DefaultRequestHandler;
import com.xively.client.http.DefaultRequestHandler.HttpMethod;
import com.xively.client.http.Response;
import com.xively.client.http.api.ApiKeyRequester;
import com.xively.client.http.exception.HttpException;
import com.xively.client.http.exception.RequestInvalidException;
import com.xively.client.http.util.exception.ParseToObjectException;
import com.xively.client.model.ApiKey;

/**
 * Class for making request for apikey from XIVELY API
 *
 * {@link https ://xively.com/docs/v2/keys/}
 *
 *
 * @author s0pau
 *
 */
public class ApiKeyRequesterImpl extends AbstractRequester<String, ApiKey> implements ApiKeyRequester
{
	private static final String RESOURCES_PATH = "keys";

	@Override
	public ApiKey update(ApiKey toUpdate) throws HttpException
	{
		throw new RequestInvalidException("This operation is currently unsupported.");
	}

	@Override
	public Collection<ApiKey> getByFeedId(int feedId) throws HttpException, ParseToObjectException
	{
		Map<String, Object> params = new HashMap<>();
		params.put("feed_id", feedId);

		Response<ApiKey> response = DefaultRequestHandler.getInstance().doRequest(HttpMethod.GET, getResourcesPath(), params);
		return response.getBodyAsObjects(ApiKey.class);
	}

	protected String getResourcePath(String apiKey)
	{
		StringBuilder sb = new StringBuilder();
		sb.append(RESOURCES_PATH).append("/").append(apiKey);
		return sb.toString();
	}

	protected String getResourcesPath()
	{
		return RESOURCES_PATH;
	}

	protected Class getObjectClass()
	{
		return ApiKey.class;
	}

	@Override
	protected String getCreatedId(Response<ApiKey> response)
	{
		return response.getIdFromResponse();
	}
}


text:
<?php
namespace Forum\Mapper;

use Forum\Model\RFollow;
use Zend\Db\Adapter\AdapterInterface;
use Zend\Db\Adapter\Driver\ResultInterface;
use Zend\Db\ResultSet\HydratingResultSet;
use Zend\Db\Sql\Sql;
use Zend\Debug\Debug;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\Sql\Insert;
use Application\Common\WHydrateResultset;

class RFollowMapper
{
    /**
     * @var \Zend\Db\Adapter\AdapterInterface
     */
    protected $dbAdapter;
    protected $hydrator;
    protected $rfollowPrototype;
    /**
     *@var \ArrayObject
     */
    protected $prototypeArr;
    public function __construct(AdapterInterface $dbAdapter, HydratorInterface $hydrator,
        RFollow $followPrototype,\ArrayObject $prototypeArr)
    {
        $this->dbAdapter = $dbAdapter;
        $this->hydrator       = $hydrator;
        $this->rfollowPrototype = $followPrototype;
        $this->prototypeArr=$prototypeArr;
    }
    public function save(RFollow $followObject){
        $postData = $this->hydrator->extract($followObject);
        //           Debug::dump($postData);
        /*
         * 下面这两行一定记得自己加上去
        */
        $postData['userID']=$followObject->getUser()->getUserID();
//         unset($postData['secname']);//等到更改成类的时候需要利用php的特性改变成员变量的类型,class变成id
        //           unset($postData['username']);//虽然还是比较麻烦,但是只要写一个类就够了,不需要再unset这么多了。
        $action = new Insert('rfollow');
        $action->values($postData);

        $sql    = new Sql($this->dbAdapter);
        $stmt   = $sql->prepareStatementForSqlObject($action);
        $result = $stmt->execute();
    }
    public function findAll($recruitID){
        $sql="select * from rfollow join user on rfollow.userID = user.userID where recruitID=$recruitID ";

        //         echo $sql;
        $statement=$this->dbAdapter->query($sql);
        $result=$statement->execute();
        //         foreach ($result as $row){
        //             Debug::dump($row);
        //         }
        if ($result instanceof ResultInterface && $result->isQueryResult()) {
            $resultSet = new WHydrateResultset($this->hydrator, $this->rfollowPrototype,$this->prototypeArr);
            $tmp=$resultSet->initialize($result);
            //              foreach ($resultSet as $row){
            //                  Debug::dump($row);
            //              }
            return $tmp;
        }

        return array();
    }
    public function getNewRFollowID(){
        $sql="select max(rfollowID) from rfollow";
        //         echo $sql;
        $statement=$this->dbAdapter->query($sql);
        $result=$statement->execute();
        return $result->current()['max(rfollowID)']+1;
    }
}


text:
package heart

import (
	"encoding/json"
	"net/http"
	"net/url"
	"strings"
	"time"

	"github.com/juju/errors"
)

// IntrospectionResponse is the response provided by a HEART compliant OAuth 2.0 token introspection
// endpoint as defined at: http://openid.bitbucket.org/HEART/openid-heart-oauth2.html#rfc.section.4.4
type IntrospectionResponse struct {
	Active   bool   `json:"active"`
	Scope    string `json:"scope"`
	EXP      int64  `json:"exp"`
	SUB      string `json:"sub"`
	ClientID string `json:"client_id"`
}

// ExpirationTime converts the EXP value from seconds since the epoch into
// a Time struct
func (ir IntrospectionResponse) ExpirationTime() time.Time {
	return time.Unix(ir.EXP, 0)
}

// SplitScope is a convenience function to split the scope value on spaces
// to get a list of scopes for the provided token
func (ir IntrospectionResponse) SplitScope() []string {
	return strings.Split(ir.Scope, " ")
}

// IntrospectToken provides a way to contact the introspection endpoint specified in the
// endpoint parameter. Token is the opaque token provided by a client attempting to access
// a resource. clientID is the identifier for the introspection client, not the if for the client
// attempting to access the resource. clientAssertion is the signed JWT that will be used to assert
// the identity of this introspection client.
func IntrospectToken(endpoint, token, clientID, clientAssertion string) (IntrospectionResponse, error) {
	values := url.Values{"client_assertion": {clientAssertion},
		"client_assertion_type": {"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"},
		"client_id":             {clientID}, "token": {token}}
	resp, err := http.PostForm(endpoint, values)
	if err != nil {
		return IntrospectionResponse{}, errors.Annotate(err, "Couldn't connect to the introspection endpoint")
	}
	defer resp.Body.Close()
	decoder := json.NewDecoder(resp.Body)
	ir := IntrospectionResponse{}
	err = decoder.Decode(&ir)
	if err != nil {
		return IntrospectionResponse{}, errors.Annotate(err, "Couldn't decode the introspection response")
	}
	return ir, nil
}


text:
<Type Name="GetPointervPName" FullName="MonoMac.OpenGL.GetPointervPName">
  <TypeSignature Language="C#" Value="public enum GetPointervPName" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed GetPointervPName extends System.Enum" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Enum</BaseTypeName>
  </Base>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName="ColorArrayPointer">
      <MemberSignature Language="C#" Value="ColorArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName ColorArrayPointer = int32(32912)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="EdgeFlagArrayPointer">
      <MemberSignature Language="C#" Value="EdgeFlagArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName EdgeFlagArrayPointer = int32(32915)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="FeedbackBufferPointer">
      <MemberSignature Language="C#" Value="FeedbackBufferPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName FeedbackBufferPointer = int32(3568)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="FogCoordArrayPointer">
      <MemberSignature Language="C#" Value="FogCoordArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName FogCoordArrayPointer = int32(33878)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="IndexArrayPointer">
      <MemberSignature Language="C#" Value="IndexArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName IndexArrayPointer = int32(32913)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="InstrumentBufferPointerSgix">
      <MemberSignature Language="C#" Value="InstrumentBufferPointerSgix" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName InstrumentBufferPointerSgix = int32(33152)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="NormalArrayPointer">
      <MemberSignature Language="C#" Value="NormalArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName NormalArrayPointer = int32(32911)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="SecondaryColorArrayPointer">
      <MemberSignature Language="C#" Value="SecondaryColorArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName SecondaryColorArrayPointer = int32(33885)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="SelectionBufferPointer">
      <MemberSignature Language="C#" Value="SelectionBufferPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName SelectionBufferPointer = int32(3571)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="TextureCoordArrayPointer">
      <MemberSignature Language="C#" Value="TextureCoordArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName TextureCoordArrayPointer = int32(32914)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="VertexArrayPointer">
      <MemberSignature Language="C#" Value="VertexArrayPointer" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.GetPointervPName VertexArrayPointer = int32(32910)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.GetPointervPName</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
  </Members>
</Type>


text:
package org.codehaus.griffon.runtime.core.configuration;

import griffon.annotations.core.Nonnull;
import griffon.converter.Converter;

import static griffon.util.StringUtils.requireNonBlank;

/**
 * @author Andres Almiray
 * @since 2.11.0
 */
public abstract class InjectionPoint {
    private final String configuration;
    private final String key;
    private final String format;
    private final Class<? extends Converter> converter;

    public InjectionPoint(@Nonnull String configuration, @Nonnull String key, @Nonnull String format, @Nonnull Class<? extends Converter> converter) {
        this.configuration = configuration;
        this.key = requireNonBlank(key, "Argument 'key' must not be blank");
        this.format = format;
        this.converter = converter;
    }

    @Nonnull
    public String getConfiguration() {
        return configuration;
    }

    @Nonnull
    public String getKey() {
        return key;
    }

    @Nonnull
    public String getFormat() {
        return format;
    }

    @Nonnull
    public Class<? extends Converter> getConverter() {
        return converter;
    }

    public abstract void setValue(@Nonnull Object instance, Object value);

    @Nonnull
    public abstract Class<?> getType();
}


text:
/* this ALWAYS GENERATED file contains the definitions for the interfaces */

 /* File created by MIDL compiler version 7.00.0499 */
/* Compiler settings for IVsSccOpenFromSourceControl.idl:
    Oicf, W1, Zp8, env=Win32 (32b run)
    protocol : dce , ms_ext, c_ext, robust
    error checks: allocation ref bounds_check enum stub_data
    VC __declspec() decoration level:
         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING(  )

#pragma warning( disable: 4049 )  /* more than 64k source lines */

/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__

#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/

#ifndef __IVsSccOpenFromSourceControl_h__
#define __IVsSccOpenFromSourceControl_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */

#ifndef __IVsSccOpenFromSourceControl_FWD_DEFINED__
#define __IVsSccOpenFromSourceControl_FWD_DEFINED__
typedef interface IVsSccOpenFromSourceControl IVsSccOpenFromSourceControl;
#endif 	/* __IVsSccOpenFromSourceControl_FWD_DEFINED__ */

/* header files for imported files */
#include "oaidl.h"
#include "vsshell.h"

#ifdef __cplusplus
extern "C"{
#endif

/* interface __MIDL_itf_IVsSccOpenFromSourceControl_0000_0000 */
/* [local] */

#pragma once

enum __VSOPENFROMSCCDLG
    {	VSOFSD_OPENSOLUTIONORPROJECT	= 1,
	VSOFSD_ADDEXISTINGITEM	= 2
    } ;
typedef LONG VSOPENFROMSCCDLG;

extern RPC_IF_HANDLE __MIDL_itf_IVsSccOpenFromSourceControl_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_IVsSccOpenFromSourceControl_0000_0000_v0_0_s_ifspec;

#ifndef __IVsSccOpenFromSourceControl_INTERFACE_DEFINED__
#define __IVsSccOpenFromSourceControl_INTERFACE_DEFINED__

/* interface IVsSccOpenFromSourceControl */
/* [object][uuid] */

EXTERN_C const IID IID_IVsSccOpenFromSourceControl;

#if defined(__cplusplus) && !defined(CINTERFACE)

    MIDL_INTERFACE("A341396A-1B4A-4164-8E6E-BDDC527C861C")
    IVsSccOpenFromSourceControl : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE OpenSolutionFromSourceControl(
            /* [in] */ __RPC__in LPCOLESTR pszSolutionStoreUrl) = 0;

        virtual HRESULT STDMETHODCALLTYPE AddProjectFromSourceControl(
            /* [in] */ __RPC__in LPCOLESTR pszProjectStoreUrl) = 0;

        virtual HRESULT STDMETHODCALLTYPE AddItemFromSourceControl(
            /* [in] */ __RPC__in_opt IVsProject *pProject,
            /* [in] */ VSITEMID itemidLoc,
            /* [in] */ ULONG cFilesToAdd,
            /* [size_is][in] */ __RPC__in_ecount_full(cFilesToAdd) LPCOLESTR rgpszFilesToAdd[  ],
            /* [in] */ __RPC__in HWND hwndDlgOwner,
            /* [in] */ VSSPECIFICEDITORFLAGS grfEditorFlags,
            /* [in] */ __RPC__in REFGUID rguidEditorType,
            /* [in] */ __RPC__in LPCOLESTR pszPhysicalView,
            /* [in] */ __RPC__in REFGUID rguidLogicalView,
            /* [retval][out] */ __RPC__out VSADDRESULT *pResult) = 0;

        virtual HRESULT STDMETHODCALLTYPE GetNamespaceExtensionInformation(
            /* [in] */ VSOPENFROMSCCDLG vsofsdDlg,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrNamespaceGUID,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrTrayDisplayName,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrProtocolPrefix) = 0;

    };

#else 	/* C style interface */

    typedef struct IVsSccOpenFromSourceControlVtbl
    {
        BEGIN_INTERFACE

        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
            IVsSccOpenFromSourceControl * This,
            /* [in] */ __RPC__in REFIID riid,
            /* [iid_is][out] */
            __RPC__deref_out  void **ppvObject);

        ULONG ( STDMETHODCALLTYPE *AddRef )(
            IVsSccOpenFromSourceControl * This);

        ULONG ( STDMETHODCALLTYPE *Release )(
            IVsSccOpenFromSourceControl * This);

        HRESULT ( STDMETHODCALLTYPE *OpenSolutionFromSourceControl )(
            IVsSccOpenFromSourceControl * This,
            /* [in] */ __RPC__in LPCOLESTR pszSolutionStoreUrl);

        HRESULT ( STDMETHODCALLTYPE *AddProjectFromSourceControl )(
            IVsSccOpenFromSourceControl * This,
            /* [in] */ __RPC__in LPCOLESTR pszProjectStoreUrl);

        HRESULT ( STDMETHODCALLTYPE *AddItemFromSourceControl )(
            IVsSccOpenFromSourceControl * This,
            /* [in] */ __RPC__in_opt IVsProject *pProject,
            /* [in] */ VSITEMID itemidLoc,
            /* [in] */ ULONG cFilesToAdd,
            /* [size_is][in] */ __RPC__in_ecount_full(cFilesToAdd) LPCOLESTR rgpszFilesToAdd[  ],
            /* [in] */ __RPC__in HWND hwndDlgOwner,
            /* [in] */ VSSPECIFICEDITORFLAGS grfEditorFlags,
            /* [in] */ __RPC__in REFGUID rguidEditorType,
            /* [in] */ __RPC__in LPCOLESTR pszPhysicalView,
            /* [in] */ __RPC__in REFGUID rguidLogicalView,
            /* [retval][out] */ __RPC__out VSADDRESULT *pResult);

        HRESULT ( STDMETHODCALLTYPE *GetNamespaceExtensionInformation )(
            IVsSccOpenFromSourceControl * This,
            /* [in] */ VSOPENFROMSCCDLG vsofsdDlg,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrNamespaceGUID,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrTrayDisplayName,
            /* [out] */ __RPC__deref_out_opt BSTR *pbstrProtocolPrefix);

        END_INTERFACE
    } IVsSccOpenFromSourceControlVtbl;

    interface IVsSccOpenFromSourceControl
    {
        CONST_VTBL struct IVsSccOpenFromSourceControlVtbl *lpVtbl;
    };

#ifdef COBJMACROS

#define IVsSccOpenFromSourceControl_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )

#define IVsSccOpenFromSourceControl_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) )

#define IVsSccOpenFromSourceControl_Release(This)	\
    ( (This)->lpVtbl -> Release(This) )

#define IVsSccOpenFromSourceControl_OpenSolutionFromSourceControl(This,pszSolutionStoreUrl)	\
    ( (This)->lpVtbl -> OpenSolutionFromSourceControl(This,pszSolutionStoreUrl) )

#define IVsSccOpenFromSourceControl_AddProjectFromSourceControl(This,pszProjectStoreUrl)	\
    ( (This)->lpVtbl -> AddProjectFromSourceControl(This,pszProjectStoreUrl) )

#define IVsSccOpenFromSourceControl_AddItemFromSourceControl(This,pProject,itemidLoc,cFilesToAdd,rgpszFilesToAdd,hwndDlgOwner,grfEditorFlags,rguidEditorType,pszPhysicalView,rguidLogicalView,pResult)	\
    ( (This)->lpVtbl -> AddItemFromSourceControl(This,pProject,itemidLoc,cFilesToAdd,rgpszFilesToAdd,hwndDlgOwner,grfEditorFlags,rguidEditorType,pszPhysicalView,rguidLogicalView,pResult) )

#define IVsSccOpenFromSourceControl_GetNamespaceExtensionInformation(This,vsofsdDlg,pbstrNamespaceGUID,pbstrTrayDisplayName,pbstrProtocolPrefix)	\
    ( (This)->lpVtbl -> GetNamespaceExtensionInformation(This,vsofsdDlg,pbstrNamespaceGUID,pbstrTrayDisplayName,pbstrProtocolPrefix) )

#endif /* COBJMACROS */

#endif 	/* C style interface */

#endif 	/* __IVsSccOpenFromSourceControl_INTERFACE_DEFINED__ */

/* Additional Prototypes for ALL interfaces */

unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * );
unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * );

unsigned long             __RPC_USER  HWND_UserSize(     unsigned long *, unsigned long            , HWND * );
unsigned char * __RPC_USER  HWND_UserMarshal(  unsigned long *, unsigned char *, HWND * );
unsigned char * __RPC_USER  HWND_UserUnmarshal(unsigned long *, unsigned char *, HWND * );
void                      __RPC_USER  HWND_UserFree(     unsigned long *, HWND * );

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="languages">
        <item>LinearLayoutManagerForVertical</item>
        <item>GridLayoutManager</item>
        <item>LinearLayoutManagerForHorizontal</item>
    </string-array>
</resources>


text:
#include "ctpcm.h"
#include "cttimer.h"
#include <linux/slab.h>
#include <sound/pcm.h>

/* Hardware descriptions for playback */
static struct snd_pcm_hardware ct_pcm_playback_hw = {
	.info			= (SNDRV_PCM_INFO_MMAP |
				   SNDRV_PCM_INFO_INTERLEAVED |
				   SNDRV_PCM_INFO_BLOCK_TRANSFER |
				   SNDRV_PCM_INFO_MMAP_VALID |
				   SNDRV_PCM_INFO_PAUSE),
	.formats		= (SNDRV_PCM_FMTBIT_U8 |
				   SNDRV_PCM_FMTBIT_S16_LE |
				   SNDRV_PCM_FMTBIT_S24_3LE |
				   SNDRV_PCM_FMTBIT_S32_LE |
				   SNDRV_PCM_FMTBIT_FLOAT_LE),
	.rates			= (SNDRV_PCM_RATE_CONTINUOUS |
				   SNDRV_PCM_RATE_8000_192000),
	.rate_min		= 8000,
	.rate_max		= 192000,
	.channels_min		= 1,
	.channels_max		= 2,
	.buffer_bytes_max	= (128*1024),
	.period_bytes_min	= (64),
	.period_bytes_max	= (128*1024),
	.periods_min		= 2,
	.periods_max		= 1024,
	.fifo_size		= 0,
};

static struct snd_pcm_hardware ct_spdif_passthru_playback_hw = {
	.info			= (SNDRV_PCM_INFO_MMAP |
				   SNDRV_PCM_INFO_INTERLEAVED |
				   SNDRV_PCM_INFO_BLOCK_TRANSFER |
				   SNDRV_PCM_INFO_MMAP_VALID |
				   SNDRV_PCM_INFO_PAUSE),
	.formats		= SNDRV_PCM_FMTBIT_S16_LE,
	.rates			= (SNDRV_PCM_RATE_48000 |
				   SNDRV_PCM_RATE_44100 |
				   SNDRV_PCM_RATE_32000),
	.rate_min		= 32000,
	.rate_max		= 48000,
	.channels_min		= 2,
	.channels_max		= 2,
	.buffer_bytes_max	= (128*1024),
	.period_bytes_min	= (64),
	.period_bytes_max	= (128*1024),
	.periods_min		= 2,
	.periods_max		= 1024,
	.fifo_size		= 0,
};

/* Hardware descriptions for capture */
static struct snd_pcm_hardware ct_pcm_capture_hw = {
	.info			= (SNDRV_PCM_INFO_MMAP |
				   SNDRV_PCM_INFO_INTERLEAVED |
				   SNDRV_PCM_INFO_BLOCK_TRANSFER |
				   SNDRV_PCM_INFO_PAUSE |
				   SNDRV_PCM_INFO_MMAP_VALID),
	.formats		= (SNDRV_PCM_FMTBIT_U8 |
				   SNDRV_PCM_FMTBIT_S16_LE |
				   SNDRV_PCM_FMTBIT_S24_3LE |
				   SNDRV_PCM_FMTBIT_S32_LE |
				   SNDRV_PCM_FMTBIT_FLOAT_LE),
	.rates			= (SNDRV_PCM_RATE_CONTINUOUS |
				   SNDRV_PCM_RATE_8000_96000),
	.rate_min		= 8000,
	.rate_max		= 96000,
	.channels_min		= 1,
	.channels_max		= 2,
	.buffer_bytes_max	= (128*1024),
	.period_bytes_min	= (384),
	.period_bytes_max	= (64*1024),
	.periods_min		= 2,
	.periods_max		= 1024,
	.fifo_size		= 0,
};

static void ct_atc_pcm_interrupt(struct ct_atc_pcm *atc_pcm)
{
	struct ct_atc_pcm *apcm = atc_pcm;

	if (!apcm->substream)
		return;

	snd_pcm_period_elapsed(apcm->substream);
}

static void ct_atc_pcm_free_substream(struct snd_pcm_runtime *runtime)
{
	struct ct_atc_pcm *apcm = runtime->private_data;
	struct ct_atc *atc = snd_pcm_substream_chip(apcm->substream);

	atc->pcm_release_resources(atc, apcm);
	ct_timer_instance_free(apcm->timer);
	kfree(apcm);
	runtime->private_data = NULL;
}

/* pcm playback operations */
static int ct_pcm_playback_open(struct snd_pcm_substream *substream)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm;
	int err;

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

	apcm->substream = substream;
	apcm->interrupt = ct_atc_pcm_interrupt;
	if (IEC958 == substream->pcm->device) {
		runtime->hw = ct_spdif_passthru_playback_hw;
		atc->spdif_out_passthru(atc, 1);
	} else {
		runtime->hw = ct_pcm_playback_hw;
		if (FRONT == substream->pcm->device)
			runtime->hw.channels_max = 8;
	}

	err = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (err < 0) {
		kfree(apcm);
		return err;
	}
	err = snd_pcm_hw_constraint_minmax(runtime,
					   SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
					   1024, UINT_MAX);
	if (err < 0) {
		kfree(apcm);
		return err;
	}

	apcm->timer = ct_timer_instance_new(atc->timer, apcm);
	if (!apcm->timer) {
		kfree(apcm);
		return -ENOMEM;
	}
	runtime->private_data = apcm;
	runtime->private_free = ct_atc_pcm_free_substream;

	return 0;
}

static int ct_pcm_playback_close(struct snd_pcm_substream *substream)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);

	/* TODO: Notify mixer inactive. */
	if (IEC958 == substream->pcm->device)
		atc->spdif_out_passthru(atc, 0);

	/* The ct_atc_pcm object will be freed by runtime->private_free */

	return 0;
}

static int ct_pcm_hw_params(struct snd_pcm_substream *substream,
				     struct snd_pcm_hw_params *hw_params)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct ct_atc_pcm *apcm = substream->runtime->private_data;
	int err;

	err = snd_pcm_lib_malloc_pages(substream,
					params_buffer_bytes(hw_params));
	if (err < 0)
		return err;
	/* clear previous resources */
	atc->pcm_release_resources(atc, apcm);
	return err;
}

static int ct_pcm_hw_free(struct snd_pcm_substream *substream)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct ct_atc_pcm *apcm = substream->runtime->private_data;

	/* clear previous resources */
	atc->pcm_release_resources(atc, apcm);
	/* Free snd-allocated pages */
	return snd_pcm_lib_free_pages(substream);
}

static int ct_pcm_playback_prepare(struct snd_pcm_substream *substream)
{
	int err;
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	if (IEC958 == substream->pcm->device)
		err = atc->spdif_passthru_playback_prepare(atc, apcm);
	else
		err = atc->pcm_playback_prepare(atc, apcm);

	if (err < 0) {
		printk(KERN_ERR "ctxfi: Preparing pcm playback failed!!!\n");
		return err;
	}

	return 0;
}

static int
ct_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
	case SNDRV_PCM_TRIGGER_RESUME:
	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
		atc->pcm_playback_start(atc, apcm);
		break;
	case SNDRV_PCM_TRIGGER_STOP:
	case SNDRV_PCM_TRIGGER_SUSPEND:
	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
		atc->pcm_playback_stop(atc, apcm);
		break;
	default:
		break;
	}

	return 0;
}

static snd_pcm_uframes_t
ct_pcm_playback_pointer(struct snd_pcm_substream *substream)
{
	unsigned long position;
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	/* Read out playback position */
	position = atc->pcm_playback_position(atc, apcm);
	position = bytes_to_frames(runtime, position);
	if (position >= runtime->buffer_size)
		position = 0;
	return position;
}

/* pcm capture operations */
static int ct_pcm_capture_open(struct snd_pcm_substream *substream)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm;
	int err;

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

	apcm->started = 0;
	apcm->substream = substream;
	apcm->interrupt = ct_atc_pcm_interrupt;
	runtime->hw = ct_pcm_capture_hw;
	runtime->hw.rate_max = atc->rsr * atc->msr;

	err = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (err < 0) {
		kfree(apcm);
		return err;
	}
	err = snd_pcm_hw_constraint_minmax(runtime,
					   SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
					   1024, UINT_MAX);
	if (err < 0) {
		kfree(apcm);
		return err;
	}

	apcm->timer = ct_timer_instance_new(atc->timer, apcm);
	if (!apcm->timer) {
		kfree(apcm);
		return -ENOMEM;
	}
	runtime->private_data = apcm;
	runtime->private_free = ct_atc_pcm_free_substream;

	return 0;
}

static int ct_pcm_capture_close(struct snd_pcm_substream *substream)
{
	/* The ct_atc_pcm object will be freed by runtime->private_free */
	/* TODO: Notify mixer inactive. */
	return 0;
}

static int ct_pcm_capture_prepare(struct snd_pcm_substream *substream)
{
	int err;
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	err = atc->pcm_capture_prepare(atc, apcm);
	if (err < 0) {
		printk(KERN_ERR "ctxfi: Preparing pcm capture failed!!!\n");
		return err;
	}

	return 0;
}

static int
ct_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd)
{
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
		atc->pcm_capture_start(atc, apcm);
		break;
	case SNDRV_PCM_TRIGGER_STOP:
		atc->pcm_capture_stop(atc, apcm);
		break;
	default:
		atc->pcm_capture_stop(atc, apcm);
		break;
	}

	return 0;
}

static snd_pcm_uframes_t
ct_pcm_capture_pointer(struct snd_pcm_substream *substream)
{
	unsigned long position;
	struct ct_atc *atc = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct ct_atc_pcm *apcm = runtime->private_data;

	/* Read out playback position */
	position = atc->pcm_capture_position(atc, apcm);
	position = bytes_to_frames(runtime, position);
	if (position >= runtime->buffer_size)
		position = 0;
	return position;
}

/* PCM operators for playback */
static struct snd_pcm_ops ct_pcm_playback_ops = {
	.open	 	= ct_pcm_playback_open,
	.close		= ct_pcm_playback_close,
	.ioctl		= snd_pcm_lib_ioctl,
	.hw_params	= ct_pcm_hw_params,
	.hw_free	= ct_pcm_hw_free,
	.prepare	= ct_pcm_playback_prepare,
	.trigger	= ct_pcm_playback_trigger,
	.pointer	= ct_pcm_playback_pointer,
	.page		= snd_pcm_sgbuf_ops_page,
};

/* PCM operators for capture */
static struct snd_pcm_ops ct_pcm_capture_ops = {
	.open	 	= ct_pcm_capture_open,
	.close		= ct_pcm_capture_close,
	.ioctl		= snd_pcm_lib_ioctl,
	.hw_params	= ct_pcm_hw_params,
	.hw_free	= ct_pcm_hw_free,
	.prepare	= ct_pcm_capture_prepare,
	.trigger	= ct_pcm_capture_trigger,
	.pointer	= ct_pcm_capture_pointer,
	.page		= snd_pcm_sgbuf_ops_page,
};

/* Create ALSA pcm device */
int ct_alsa_pcm_create(struct ct_atc *atc,
		       enum CTALSADEVS device,
		       const char *device_name)
{
	struct snd_pcm *pcm;
	int err;
	int playback_count, capture_count;

	playback_count = (IEC958 == device) ? 1 : 256;
	capture_count = (FRONT == device) ? 1 : 0;
	err = snd_pcm_new(atc->card, "ctxfi", device,
			  playback_count, capture_count, &pcm);
	if (err < 0) {
		printk(KERN_ERR "ctxfi: snd_pcm_new failed!! Err=%d\n", err);
		return err;
	}

	pcm->private_data = atc;
	pcm->info_flags = 0;
	pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
	strlcpy(pcm->name, device_name, sizeof(pcm->name));

	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &ct_pcm_playback_ops);

	if (FRONT == device)
		snd_pcm_set_ops(pcm,
				SNDRV_PCM_STREAM_CAPTURE, &ct_pcm_capture_ops);

	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
			snd_dma_pci_data(atc->pci), 128*1024, 128*1024);

#ifdef CONFIG_PM
	atc->pcms[device] = pcm;
#endif

	return 0;
}


text:
<?php

namespace Jasny\TypeCast\Handler;

use Jasny\TypeCast\Handler;

/**
 * Type cast to mixed (no casting)
 */
class MixedHandler extends Handler
{
    /**
     * Get the type what the handler is casting to.
     *
     * @return string
     */
    protected function getType(): string
    {
        return 'mixed';
    }

    /**
     * Leave value as is
     *
     * @return mixed
     */
    public function cast($value)
    {
        return $value;
    }
}


text:
use strict;
use warnings;

use CondorTest;

package DagmanTest;

my $abnormal = sub {
    die "Want to see only submit, execute and successful completion\n";
};

my $aborted = sub {
    die "Abort event NOT expected\n";
};

my $held = sub {
    die "Held event NOT expected\n";
};

my $executed = sub {
    my %info = @_;
    CondorTest::debug("Dag is running.  Cluster: $info{cluster}\n",1);
};

my $submitted = sub {
    CondorTest::debug("submitted: This test will see submit, executing and successful completion\n",1);
};

sub register_event_handlers {
    my ($testname) = @_;
    CondorTest::RegisterExecute($testname, $executed);
    CondorTest::RegisterExitedAbnormal( $testname, $abnormal );
    CondorTest::RegisterAbort( $testname, $aborted );
    CondorTest::RegisterHold( $testname, $held );
    CondorTest::RegisterSubmit( $testname, $submitted );
}


text:
package com.wemote.scorpio.modules.utils;

import org.junit.Test;

import java.lang.reflect.InvocationTargetException;

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

public class ReflectionsTest {

	@Test
	public void getAndSetFieldValue() {
		TestBean bean = new TestBean();
		// 无需getter函数, 直接读取privateField
		assertThat(Reflections.getFieldValue(bean, "privateField")).isEqualTo(1);
		// 绕过将publicField+1的getter函数,直接读取publicField的原始值
		assertThat(Reflections.getFieldValue(bean, "publicField")).isEqualTo(1);

		bean = new TestBean();
		// 无需setter函数, 直接设置privateField
		Reflections.setFieldValue(bean, "privateField", 2);
		assertThat(bean.inspectPrivateField()).isEqualTo(2);

		// 绕过将publicField+1的setter函数,直接设置publicField的原始值
		Reflections.setFieldValue(bean, "publicField", 2);
		assertThat(bean.inspectPublicField()).isEqualTo(2);

		try {
			Reflections.getFieldValue(bean, "notExist");
			failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
		} catch (IllegalArgumentException e) {

		}

		try {
			Reflections.setFieldValue(bean, "notExist", 2);
			failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
		} catch (IllegalArgumentException e) {

		}

	}

	@Test
	public void invokeGetterAndSetter() {
		TestBean bean = new TestBean();
		assertThat(Reflections.invokeGetter(bean, "publicField")).isEqualTo(bean.inspectPublicField() + 1);

		bean = new TestBean();
		// 通过setter的函数将+1
		Reflections.invokeSetter(bean, "publicField", 10);
		assertThat(bean.inspectPublicField()).isEqualTo(10 + 1);
	}

	@Test
	public void invokeMethod() {
		TestBean bean = new TestBean();
		// 使用函数名+参数类型的匹配
		assertThat(
				Reflections
						.invokeMethod(bean, "privateMethod", new Class[] { String.class }, new Object[] { "calvin" }))
				.isEqualTo("hello calvin");

		// 仅匹配函数名
		assertThat(Reflections.invokeMethodByName(bean, "privateMethod", new Object[] { "calvin" })).isEqualTo(
				"hello calvin");

		// 函数名错
		try {
			Reflections.invokeMethod(bean, "notExistMethod", new Class[] { String.class }, new Object[] { "calvin" });
			failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
		} catch (IllegalArgumentException e) {

		}

		// 参数类型错
		try {
			Reflections.invokeMethod(bean, "privateMethod", new Class[] { Integer.class }, new Object[] { "calvin" });
			failBecauseExceptionWasNotThrown(RuntimeException.class);
		} catch (RuntimeException e) {

		}

		// 函数名错
		try {
			Reflections.invokeMethodByName(bean, "notExistMethod", new Object[] { "calvin" });
			failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
		} catch (IllegalArgumentException e) {

		}

	}

	@Test
	public void getSuperClassGenricType() {
		// 获取第1,2个泛型类型
		assertThat(Reflections.getClassGenricType(TestBean.class)).isEqualTo(String.class);
		assertThat(Reflections.getClassGenricType(TestBean.class, 1)).isEqualTo(Long.class);

		// 定义父类时无泛型定义
		assertThat(Reflections.getClassGenricType(TestBean2.class)).isEqualTo(Object.class);

		// 无父类定义
		assertThat(Reflections.getClassGenricType(TestBean3.class)).isEqualTo(Object.class);
	}

	@Test
	public void convertReflectionExceptionToUnchecked() {
		IllegalArgumentException iae = new IllegalArgumentException();
		// ReflectionException,normal
		RuntimeException e = Reflections.convertReflectionExceptionToUnchecked(iae);
		assertThat(e.getCause()).isEqualTo(iae);

		// InvocationTargetException,extract it's target exception.
		Exception ex = new Exception();
		e = Reflections.convertReflectionExceptionToUnchecked(new InvocationTargetException(ex));
		assertThat(e.getCause()).isEqualTo(ex);

		// UncheckedException, ignore it.
		RuntimeException re = new RuntimeException("abc");
		e = Reflections.convertReflectionExceptionToUnchecked(re);
		assertThat(e).hasMessage("abc");

		// Unexcepted Checked exception.
		e = Reflections.convertReflectionExceptionToUnchecked(ex);
		assertThat(e).hasMessage("Unexpected Checked Exception.");
	}

	public static class ParentBean<T, ID> {
	}

	public static class TestBean extends ParentBean<String, Long> {
		/** 没有getter/setter的field */
		private int privateField = 1;
		/** 有getter/setter的field */
		private int publicField = 1;

		// 通過getter函數會比屬性值+1
		public int getPublicField() {
			return publicField + 1;
		}

		// 通過setter函數會被比輸入值加1
		public void setPublicField(int publicField) {
			this.publicField = publicField + 1;
		}

		public int inspectPrivateField() {
			return privateField;
		}

		public int inspectPublicField() {
			return publicField;
		}

		private String privateMethod(String text) {
			return "hello " + text;
		}
	}

	public static class TestBean2 extends ParentBean {
	}

	public static class TestBean3 {

		private int id;

		public int getId() {
			return id;
		}

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


text:
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <library name="com.sonyericsson.android.socialphonebook.api"
        file="/system/framework/com.sonyericsson.android.socialphonebook.jar"/>
</permissions>