text:
=head1 LICENSE

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

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

=head1 NAME

 Bio::EnsEMBL::Compara::PipeConfig::Synteny_conf

=head1 SYNOPSIS

    #1. Update ensembl-hive, ensembl and ensembl-compara GIT repositories before each new release

=head1 CONTACT

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

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

=cut

package Bio::EnsEMBL::Compara::PipeConfig::Synteny_conf;

use strict;
use warnings;
use base ('Bio::EnsEMBL::Compara::PipeConfig::ComparaGeneric_conf');  # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly

sub default_options {
    my ($self) = @_;
    return {
            %{$self->SUPER::default_options},   # inherit the generic ones

            'ensembl_cvs_root_dir' => $ENV{'ENSEMBL_CVS_ROOT_DIR'},

            'release'               => '74',
            'release_suffix'        => '',    # an empty string by default, a letter otherwise
            'rel_with_suffix'       => $self->o('release').$self->o('release_suffix'),

            'pipeline_name'         => 'SYNTENY_'.$self->o('mlss_id')."_".$self->o('rel_with_suffix'),   # name the pipeline to differentiate the submitted processes
            'dbname'               => $self->o('pipeline_name'), #pipeline database name

            'host'        => 'compara5',                        #host name
            'pipeline_db' => {                                  # connection parameters
                              -host   => $self->o('host'),
                              -port   => 3306,
                              -user   => 'ensadmin',
                              -pass   => $self->o('password'),
                              -dbname => $ENV{USER}.'_'.$self->o('dbname'),
                              -driver => 'mysql',
                             },

            'synteny_dir' => '/lustre/scratch110/ensembl/' . $ENV{USER} . '/synteny/' . 'release_' . $self->o('rel_with_suffix') . '/' . $self->o('mlss_id') . '/',

            'compara_url' => undef, #pairwise database to calculate the syntenies from
            'ref_species' => undef, #reference species
            'method_link_type' => 'LASTZ_NET', #pairwise alignment type
            'coord_system_name' => 'chromosome', #which seq_regions to run syntenies on

            #DumpGFFAlignmentsForSynteny parameters
            'force' => 0, #over-ride check for has_karyotype in DumpGFFAlignmentsForSynteny
            'level' => 1, #which GenomicAlignBlock level_id to use. Level=>1 will only use level 1 blocks, level=>2 will use level 1 and level 2 blocks. For human vs chimp, we would use level=>2

            #BuildSynteny parameters
            'maxDist1' => 100000,  #maximum gap allowed between alignments within a syntenic block
            'minSize1' => 100000,  #minimum length a syntenic block must have, shorter blocks are discarded
            'maxDist2' => undef,
            'minSize2' => undef,

            'orient' => 'false', # "false" is only needed for human/mouse, human/rat and mouse/rat NOT for elegans/briggsae (it can be ommitted).

            #executable locations
            'DumpGFFAlignmentsForSynteny_exe' => $self->o('ensembl_cvs_root_dir') . "/ensembl-compara/scripts/synteny/DumpGFFAlignmentsForSynteny.pl",
            'BuildSynteny_exe' => $self->o('ensembl_cvs_root_dir') . "/ensembl-compara/scripts/synteny/BuildSynteny.jar",

            #
            #Resource requirements
            #
            'memory_suffix' => "", #temporary fix to define the memory requirements in resource_classes
            'dbresource'    => 'my'.$self->o('host'), # will work for compara1..compara5, but will have to be set manually otherwise
            'synteny_capacity' => 1000,

           };
}

sub pipeline_create_commands {
    my ($self) = @_;
    print "pipeline_create_commands\n";

    return [
        @{$self->SUPER::pipeline_create_commands},  # inheriting database and hive tables' creation

        'mkdir -p '.$self->o('synteny_dir'), #Make dump_dir directory
    ];
}

sub pipeline_wide_parameters {  # these parameter values are visible to all analyses, can be overridden by parameters{} and input_id{}
    my ($self) = @_;

    return {
            %{$self->SUPER::pipeline_wide_parameters},          # here we inherit anything from the base class
	    'pipeline_name' => $self->o('pipeline_name'), #This must be defined for the beekeeper to work properly
           };
}

sub resource_classes {
    my ($self) = @_;

    my $host = $self->o('pipeline_db')->{host};
    return {
            %{$self->SUPER::resource_classes},  # inherit 'default' from the parent class
            '100Mb' => { 'LSF' => '-C0 -M100' . $self->o('memory_suffix') .' -R"select[mem>100] rusage[mem=100]"' },
            '1Gb'   => { 'LSF' => '-C0 -M1000' . $self->o('memory_suffix') .' -R"select[mem>1000] rusage[mem=1000]"' },
            '1.8Gb' => { 'LSF' => '-C0 -M1800' . $self->o('memory_suffix') .' -R"select[mem>1800 && '.$self->o('dbresource').'<'.$self->o('synteny_capacity').'] rusage[mem=1800,'.$self->o('dbresource').'=10:duration=3]"' },
            '3.6Gb' => { 'LSF' => '-C0 -M3600' . $self->o('memory_suffix') .' -R"select[mem>3600 && '.$self->o('dbresource').'<'.$self->o('synteny_capacity').'] rusage[mem=3600,'.$self->o('dbresource').'=10:duration=3]"' },
    };
}

sub pipeline_analyses {
    my ($self) = @_;

    return [
            #dump chr names
            {   -logic_name => 'chr_name_factory',
                -module     => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory',
                -parameters => {
                                'db_conn'    => $self->o('compara_url'),
                                'inputquery' => 'SELECT DISTINCT(dnafrag.name) AS seq_region FROM dnafrag LEFT JOIN genome_db USING (genome_db_id) WHERE genome_db.name = "' . $self->o('ref_species') . '" AND coord_system_name= "'. $self->o('coord_system_name') . '" AND is_reference = 1 ORDER BY seq_region',
                                'fan_branch_code'   => 2,
                               },
                -input_ids => [{}],
                -flow_into => {
                               '2->A' => [ 'dump_gff_alignments' ],
                               'A->1' => [ 'concat_files' ],
                              },

            },
            #Dump gff alignments
            { -logic_name => 'dump_gff_alignments',
              -module     => 'Bio::EnsEMBL::Hive::RunnableDB::SystemCmd',
              -parameters => {
                              'program'    => $self->o('DumpGFFAlignmentsForSynteny_exe'),
                              'compara_url' => $self->o('compara_url'),
                              'query_name' => $self->o('ref_species'),
                              'method_link_type' => $self->o('method_link_type'),
                              'mlss_id'    => $self->o('mlss_id'),
                              'level'      => $self->o('level'),
                              'force'      => $self->o('force'),
                              'output_dir' => $self->o('synteny_dir') . "/",
                              'cmd' => "#program# --dbname #compara_url# --qy #query_name# --method_link_species_set #mlss_id# --seq_region #seq_region# --force #force# --output_dir #output_dir#",
                              },
                -flow_into => {
                               '1' => [ 'build_synteny' ],
                              },
              -hive_capacity => 3, #database intensive
            },
            #Build synteny regions
            { -logic_name => 'build_synteny',
              -module => 'Bio::EnsEMBL::Compara::RunnableDB::Synteny::BuildSynteny',
              -parameters => {
                              'program' => 'java -Xmx2000M -classpath ' . $self->o('BuildSynteny_exe') . ' BuildSynteny',
                              'output_dir' => $self->o('synteny_dir') . "/",
                              'gff_file' => '#output_dir##seq_region#.syten.gff', #to agree with output of DumpGFFAlignmentsForSynteny.pl
                              'maxDist1' => $self->o('maxDist1'),
                              'minSize1' => $self->o('minSize1'),
                              'maxDist2' => $self->o('maxDist2'),
                              'minSize2' => $self->o('minSize2'),
                              'orient' => $self->o('orient'),
                              'output_file' => '#output_dir##seq_region#.#maxDist1#.#minSize1#.BuildSynteny.out',
                              },
              -rc_name => '1.8Gb',
            },
            #Concatenate into single file
            { -logic_name => 'concat_files',
              -module     => 'Bio::EnsEMBL::Hive::RunnableDB::SystemCmd',
              -parameters => {
                              'output_dir' => $self->o('synteny_dir') . "/",
                              'maxDist' => $self->o('maxDist1'),
                              'minSize' => $self->o('minSize1'),
                              'output_file' => '#output_dir#all.#maxDist#.#minSize#.BuildSynteny',
                              'cmd' => 'cat #output_dir#*.BuildSynteny.out | grep cluster > #output_file#',
                             },
            },
           ];
}

1;


text:
import { expect } from 'chai';
import * as fs from 'fs';
import * as jestTestSupport from 'jest-editor-support';
import { SinonStub, stub } from 'sinon';
import * as vscode from 'vscode';
import URI from 'vscode-uri';
import { lwcTestIndexer } from '../../../../src/testSupport/testIndexer';

import {
  TestFileInfo,
  TestInfoKind,
  TestResultStatus,
  TestType
} from '../../../../src/testSupport/types';

describe('LWC Test Indexer', () => {
  let lwcTests: URI[];
  let existingTestFileCount: number;

  before(async () => {
    lwcTests = await vscode.workspace.findFiles(
      new vscode.RelativePattern(
        vscode.workspace.workspaceFolders![0],
        '**/lwc/**/*.test.js'
      )
    );

    existingTestFileCount = lwcTests.length;
  });

  describe('Test Indexer File Watcher', () => {
    let onDidCreateEventEmitter: vscode.EventEmitter<vscode.Uri>;
    let onDidChangeEventEmitter: vscode.EventEmitter<vscode.Uri>;
    let onDidDeleteEventEmitter: vscode.EventEmitter<vscode.Uri>;
    let readFileStub: SinonStub;
    let mockFileSystemWatcher;

    let createFileSystemWatcherStub: SinonStub<
      [
        vscode.GlobPattern,
        (boolean | undefined)?,
        (boolean | undefined)?,
        (boolean | undefined)?
      ],
      vscode.FileSystemWatcher
    >;
    let parseStub: SinonStub<
      [string, (string | undefined)?, (boolean | undefined)?],
      jestTestSupport.IParseResults
    >;
    beforeEach(async () => {
      createFileSystemWatcherStub = stub(
        vscode.workspace,
        'createFileSystemWatcher'
      );
      onDidCreateEventEmitter = new vscode.EventEmitter<vscode.Uri>();
      onDidChangeEventEmitter = new vscode.EventEmitter<vscode.Uri>();
      onDidDeleteEventEmitter = new vscode.EventEmitter<vscode.Uri>();
      mockFileSystemWatcher = {
        onDidCreate: onDidCreateEventEmitter.event,
        onDidChange: onDidChangeEventEmitter.event,
        onDidDelete: onDidDeleteEventEmitter.event
      };
      createFileSystemWatcherStub.returns(
        mockFileSystemWatcher as vscode.FileSystemWatcher
      );

      const mockFile = `it('mockTestCase1', () => {})\nit('mockTestCase2', () => {})\n`;
      readFileStub = stub(fs, 'readFileSync');
      readFileStub.callsFake(fileName => {
        return mockFile;
      });

      await lwcTestIndexer.configureAndIndex();
      lwcTestIndexer.resetIndex();
    });
    afterEach(() => {
      onDidCreateEventEmitter.dispose();
      onDidChangeEventEmitter.dispose();
      onDidDeleteEventEmitter.dispose();
      createFileSystemWatcherStub.restore();
      readFileStub.restore();
    });

    function assertTestCasesMatch(
      actualTestFileInfo: TestFileInfo | undefined,
      expectedFilePath: string
    ) {
      const expectedTestCases = [
        {
          testFsPath: expectedFilePath,
          testName: 'mockTestCase1'
        },
        {
          testFsPath: expectedFilePath,
          testName: 'mockTestCase2'
        }
      ];
      expect(
        actualTestFileInfo!.testCasesInfo!.map(testCaseInfo => {
          const { testName, testUri } = testCaseInfo;
          return {
            testFsPath: testUri.fsPath,
            testName
          };
        })
      ).to.eql(expectedTestCases);
    }

    it('should update index on test file create', async () => {
      let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
      expect(allTestFileInfo.length).to.equal(existingTestFileCount);

      const mockFilePath = /^win32/.test(process.platform)
        ? 'C:\\Users\\tester\\mockNewFile.test.js'
        : '/Users/tester/mockNewFile.test.js';
      const mockFileUri = URI.file(mockFilePath);
      return new Promise(resolve => {
        const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex(
          async () => {
            allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
            expect(allTestFileInfo.length).to.equal(existingTestFileCount + 1);

            const createdTestFileInfo = allTestFileInfo.find(
              (testFileInfo: TestFileInfo) => {
                return testFileInfo.testUri.fsPath === mockFileUri.fsPath;
              }
            );
            expect(createdTestFileInfo!.kind).to.equal(TestInfoKind.TEST_FILE);
            expect(createdTestFileInfo!.testType).to.equal(TestType.LWC);
            expect(createdTestFileInfo!.testLocation!.uri.fsPath).to.equal(
              mockFileUri.fsPath
            );
            expect(
              createdTestFileInfo!.testLocation!.range.start.line
            ).to.equal(0);
            expect(
              createdTestFileInfo!.testLocation!.range.start.character
            ).to.equal(0);
            expect(createdTestFileInfo!.testLocation!.range.end.line).to.equal(
              0
            );
            expect(
              createdTestFileInfo!.testLocation!.range.end.character
            ).to.equal(0);

            assertTestCasesMatch(createdTestFileInfo, mockFileUri.fsPath);
            handleDidUpdateTestIndex.dispose();
            resolve();
          }
        );
        onDidCreateEventEmitter.fire(mockFileUri);
      });
    });

    it('should update index on test file change', async () => {
      const testFileUriToChange = lwcTests[0];
      let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
      expect(allTestFileInfo.length).to.equal(existingTestFileCount);
      return new Promise(resolve => {
        const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex(
          async () => {
            allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
            const changedTestFileInfo = allTestFileInfo.find(
              (testFileInfo: TestFileInfo) => {
                return (
                  testFileInfo.testUri.fsPath === testFileUriToChange.fsPath
                );
              }
            );
            assertTestCasesMatch(
              changedTestFileInfo,
              testFileUriToChange.fsPath
            );
            handleDidUpdateTestIndex.dispose();
            resolve();
          }
        );
        onDidChangeEventEmitter.fire(testFileUriToChange);
      });
    });

    it('should update index on test file change when parsing has an error', async () => {
      // Mock parsing error
      readFileStub.callsFake(fileName => {
        throw new Error();
      });
      const testFileUriToChange = lwcTests[0];
      let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
      expect(allTestFileInfo.length).to.equal(existingTestFileCount);
      return new Promise(resolve => {
        const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex(
          async () => {
            allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
            const changedTestFileInfo = allTestFileInfo.find(
              (testFileInfo: TestFileInfo) => {
                return (
                  testFileInfo.testUri.fsPath === testFileUriToChange.fsPath
                );
              }
            );
            // If there's a parsing error, expect empty test cases info
            expect(changedTestFileInfo!.testCasesInfo).to.eql([]);
            handleDidUpdateTestIndex.dispose();
            resolve();
          }
        );
        onDidChangeEventEmitter.fire(testFileUriToChange);
      });
    });

    it('should update index on test file change and merge existing test results if possible', async () => {
      const testFileUriToChange = lwcTests[0];
      let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
      expect(allTestFileInfo.length).to.equal(existingTestFileCount);

      // Mock raw test results on test file info
      // This could be test results generated from previous runs,
      // we are making sure that it will get merged in test cases info when test file changes.
      const testFileInfoToChange = allTestFileInfo.find(
        (testFileInfo: TestFileInfo) => {
          return testFileInfo.testUri.fsPath === testFileUriToChange.fsPath;
        }
      );
      testFileInfoToChange!.rawTestResults = [
        {
          title: 'mockTestCase1',
          ancestorTitles: [],
          status: TestResultStatus.PASSED
        },
        {
          title: 'mockTestCase2',
          ancestorTitles: [],
          status: TestResultStatus.FAILED
        }
      ];

      return new Promise(resolve => {
        // Set up test file change handler
        const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex(
          async () => {
            allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
            const changedTestFileInfo = allTestFileInfo.find(
              (testFileInfo: TestFileInfo) => {
                return (
                  testFileInfo.testUri.fsPath === testFileUriToChange.fsPath
                );
              }
            );

            // Assert that raw test results status is merged into test cases info
            const expectedTestCases = [
              {
                testFsPath: testFileUriToChange.fsPath,
                testName: 'mockTestCase1',
                testResult: {
                  status: TestResultStatus.PASSED
                }
              },
              {
                testFsPath: testFileUriToChange.fsPath,
                testName: 'mockTestCase2',
                testResult: {
                  status: TestResultStatus.FAILED
                }
              }
            ];
            expect(
              changedTestFileInfo!.testCasesInfo!.map(testCaseInfo => {
                const { testName, testResult, testUri } = testCaseInfo;
                return {
                  testFsPath: testUri.fsPath,
                  testName,
                  testResult
                };
              })
            ).to.eql(expectedTestCases);

            // Restore
            handleDidUpdateTestIndex.dispose();
            testFileInfoToChange!.rawTestResults = undefined;
            resolve();
          }
        );
        // Changing the file
        onDidChangeEventEmitter.fire(testFileUriToChange);
      });
    });

    it('should update index on test file delete', async () => {
      let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
      expect(allTestFileInfo.length).to.equal(existingTestFileCount);
      const testFileUriToDelete = lwcTests[0];
      return new Promise(resolve => {
        const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex(
          async () => {
            allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo();
            expect(allTestFileInfo.length).to.equal(existingTestFileCount - 1);

            const deletedTestFileInfo = allTestFileInfo.find(
              (testFileInfo: TestFileInfo) => {
                return (
                  testFileInfo.testUri.fsPath === testFileUriToDelete.fsPath
                );
              }
            );
            expect(deletedTestFileInfo).to.be.an('undefined');
            handleDidUpdateTestIndex.dispose();
            resolve();
          }
        );
        onDidDeleteEventEmitter.fire(testFileUriToDelete);
      });
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
package com.alibaba.json.test.a;

import com.alibaba.fastjson.JSON;
import junit.framework.TestCase;

import java.io.*;

/**
 * Created by wenshao on 04/02/2017.
 */
public class CompilerTest extends TestCase {
    public void test_for_compiler() throws Exception {
        byte[] bytes;
        {
            Model model = new Model();
            model.id = 123;

            bytes = toBytes(model);
        }

        perf(bytes);
        for (int i = 0; i < 10; ++i) {
            long start = System.currentTimeMillis();
            perf(bytes);
            long millis = System.currentTimeMillis() - start;
            System.out.println("millis : " + millis);
        }
    }

    private void perf(byte[] bytes) throws IOException, ClassNotFoundException {
        for (int i = 0; i < 1000; ++i) {
            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
            Model model = (Model) in.readObject();
            assertEquals(123, model.id);
        }
    }

    private byte[] toBytes(Model model) throws IOException {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteOut);

        out.writeObject(model);
        out.flush();
        byte[] bytes = byteOut.toByteArray();
        out.close();
        return bytes;
    }

    public static class Model implements Serializable {
        public int id;
    }
}


text:
module GitBrowser::Backend::Grit

   class Tree

      def initialize(tree)
         @tree = tree
      end

      def tree?
         true
      end

      def blob?
         false
      end

      def basename
         @tree.basename
      end

      def size
         0
      end

      def trees
         @tree.trees.map { |tree| Tree.new(tree) }
      end

      def blobs
         @tree.blobs.map { |blob| Blob.new(blob) }
      end
   end
end


text:
namespace clover {
namespace nodes {

CompositionNodeLogic* RealExpReleaseNodeInstance::compNode()
{
	auto n= new CompositionNodeLogic{};
	n->addInputSlot("accumSignal", SignalType::Real, 0.0);
	n->addInputSlot("target", SignalType::Real, 0.0);
	n->addInputSlot("halfValueTime", SignalType::Real, 1.0);
	n->addInputSlot("upperLimit", SignalType::Real, 9999.0);
	n->addOutputSlot("value", SignalType::Real);
	return n;
}

void RealExpReleaseNodeInstance::create()
{
	halfValueTime= addInputSlot<SignalType::Real>("halfValueTime");
	accumIn= addInputSlot<SignalType::Real>("accumSignal");
	targetIn= addInputSlot<SignalType::Real>("target");
	realLimitIn= addInputSlot<SignalType::Real>("upperLimit");
	valueOut= addOutputSlot<SignalType::Real>("value");

	accumIn->setOnReceiveCallback(+[] (RealExpReleaseNodeInstance* self)
	{
		self->value += self->accumIn->get()*global::g_env.worldMgr->getDeltaTime();
		self->setUpdateNeeded(true);
	});

	value= 0.0;
}

void RealExpReleaseNodeInstance::update()
{
	real64 dt= global::g_env.worldMgr->getDeltaTime();
	value= std::min(value, realLimitIn->get());

	real64 target_value= targetIn->get();

	if (abs(value - target_value) < util::epsilon)
		setUpdateNeeded(false);

	real64 mul= std::pow(2, -dt/halfValueTime->get());
	value= (value - target_value)* mul + target_value;

	valueOut->send(value);
}

} // nodes
} // clover


text:
版本要求:Java1.8+

使用之前:本SDK非腾讯官方SDK,部分接口并未做测试,欢迎贡献issues

### 1、Spring配置:

```java
<bean name="qcloudClient" class="com.wakeup.qcloud.DefaultQCloudClient" >
	<constructor-arg name="imConfig" ref="imConfig"/>
	<constructor-arg name="liveConfig" ref="liveConfig"/>
</bean>

<bean id="imConfig" class="com.wakeup.qcloud.domain.IMConfigDO">
	<property name="sdkAppId" value="${qcloud.im.sdkAppId}"/>
	<property name="identifier" value="${qcloud.im.adminIdentifier}"/>
	<property name="privateKey" >
		<value><![CDATA[${qcloud.im.privateKey}]]></value>
	</property>
	<property name="publicKey" >
		<value><![CDATA[${qcloud.im.publicKey}]]></value>
	</property>
</bean>

<bean id="liveConfig" class="com.wakeup.qcloud.domain.LiveConfigDO">
	<property name="sdkAppId" value="${qcloud.live.sdkAppId}"/>
	<property name="key" value="${qcloud.live.key}"/>
</bean>
```

注意点:

公钥和私钥写在配置文件中,不是读文件方式,所以换行需要\n替换之,同时注意spring配置文件中CDATA前后不留空格。

### 2、接口请求示例:

- 示例1:获取sig
```java
String sig = qcloudClient.getUserSig(userId+"", SIG_EXPIRE);
```

- 示例2:创建一个聊天室
```java
CreateGroupRequest request = new CreateGroupRequest();
request.setGroupId("1000000");
request.setName("聊天室-测试");
request.setType(GroupType.AV_CHAT_ROOM);
request.setApplyJoinOption(ApplyJoinOption.FreeAccess);
CreateGroupResponse response = qcloudClient.execute(request);
System.out.println(response);
```

- 示例3:接受回调消息
```java
@RequestMapping(value = { "/im_callback" },produces="application/json;charset=utf-8")
public @ResponseBody String im_callback(HttpServletRequest request) {
	try {
		Map<String,Object>  urlParams = getUrlParams(request);
		String msgBody = IOUtils.toString(request.getInputStream(),Charset.forName("utf-8"));
		QCloudMsgResponse response = qcloudClient.doMsgProcess(qcloudImMsgListener, msgBody, urlParams);
		return response.toString();
	} catch (Exception e) {
		log.error("",e);
	}
	return "{}";
}
```

### 3、done!!!

#### 下面广告长期有效:

杭州享贞信息科技有限公司,长期招聘如下技术岗位:

**Java开发工程师,前端开发工程师,Android开发过程,iOS开发工程师**

坐标:杭州市余杭区欧美金融城美国中心

我们期望打造一个学习的入口,如果你感兴趣,欢迎简历发送至:jingxiang@91zhiyin.com

### License

wakup-qcloud-sdk is released under the [Apache 2.0 license](https://github.com/51wakeup/wakeup-qcloud-sdk/blob/master/LICENSE).

```
Copyright 2017 HangZhou XiangZhen Information & Technology Co.,Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```


text:
namespace js6
{
	void find_solution(int arr[], int arrG[], int x, int y);
}


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

<title>H-Index</title>
<meta name="date" content="2015-08-11">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A C E F G H I M N O P R S T U V

H

hashCode() - Method in class rogel.io.fopl.formulas.Formula

Returns a hash code for this Formula.

hashCode() - Method in class rogel.io.fopl.formulas.Predicate

Returns a hash code for this Predicate.

hashCode() - Method in class rogel.io.fopl.Substitution

Returns a hash code for this Substitution.

hashCode() - Method in class rogel.io.fopl.Symbol

Returns a hash code for this Symbol.

hashCode() - Method in class rogel.io.fopl.terms.Function

Returns a hash code for this Function.

hashCode() - Method in class rogel.io.fopl.terms.Term

Returns a hash code for this Term.

hashCode() - Method in class rogel.io.fopl.terms.Variable

Returns a hash code for this Variable.

HornClause - Class in rogel.io.fopl.proof

A HornClause is a clause with at most one positive (i.e.

HornClause(Predicate) - Constructor for class rogel.io.fopl.proof.HornClause

Constructs a HornClause with just one positive literal.

HornClause(Predicate, Formula) - Constructor for class rogel.io.fopl.proof.HornClause

Constructor for a HornClause with one positive literal and a goal clause (which represents
 implicitly disjunctive negated literals).

A C E F G H I M N O P R S T U V

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
.class public interface abstract Lo/IF;
.super Ljava/lang/Object;
.source ""

# virtual methods
.method public abstract ˊ(I)Landroid/view/View;
.end method


text:
package se.kotlinski.imagesort.feedback;

import se.kotlinski.imagesort.data.RelativeMediaFolderOutput;
import se.kotlinski.imagesort.data.SortSettings;

import java.io.File;
import java.util.List;
import java.util.Map;

public interface PreMoveFeedbackInterface {

  void preMovePhaseInitiated();

  void calculatedDestinationForEachFile(final Map<RelativeMediaFolderOutput, List<File>> mediaFileDestinations);

  void groupingFilesByContentProgress(final int total, final int progress);

  void conflictFound(RelativeMediaFolderOutput outputDirectory);

  void preMovePhaseComplete(Map<List<File>, RelativeMediaFolderOutput> filesGroupedByContent,
                            final SortSettings sortSettings);
}


text:
@implementation Committee

- (id)initWithName:(NSString *)name withIndex:(NSUInteger)index {

    self = [super init];
    if (nil != self) {
        self.committeeName = [NSString stringWithFormat:@"%@", name];
        self.personIndex = index;
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder;
{
    [coder encodeObject:self.committeeName forKey:@"name"];
    [coder encodeInteger:self.personIndex forKey:@"index"];
    [coder encodeBool:self.chair forKey:@"chair"];
}

- (id)initWithCoder:(NSCoder *)coder;
{
    self = [super init];
    if (self != nil)
    {
        self.committeeName = [coder decodeObjectForKey:@"name"];
        self.personIndex = [coder decodeIntegerForKey:@"index"];
        self.chair = [coder decodeBoolForKey:@"chair"];

    }
    return self;
}

@end


text:
require 'f5/icontrol/common/enum_item'

module F5
  module Icontrol
    module LocalLB
      # https://devcentral.f5.com/wiki/iControl.LocalLB__EnabledStatus.ashx
      # A list of possible values for enabled status.
      module EnabledStatus
        # Error scenario.
        ENABLED_STATUS_NONE = EnumItem.new('ENABLED_STATUS_NONE', '0')

        # The object is active when in Green availability status. It may or may not be active when in Blue availability status.
        ENABLED_STATUS_ENABLED = EnumItem.new('ENABLED_STATUS_ENABLED', '1')

        # The object is inactive regardless of availability status.
        ENABLED_STATUS_DISABLED = EnumItem.new('ENABLED_STATUS_DISABLED', '2')

        # The object is inactive regardless of availability status because its parent has been disabled, but the object itself is still enabled.
        ENABLED_STATUS_DISABLED_BY_PARENT = EnumItem.new('ENABLED_STATUS_DISABLED_BY_PARENT', '3')
      end
    end
  end
end


text:
Human-friendly media queries for Sass.

> **IMPORTANT NOTICE**: this project is deprecated and unmaintained.
> I no longer think that this simplifies working with media queries
> since it only adds an unnecessary abstraction layer.

## Overview

A set of mixins that attempts to make working with media queries a bit easier
by using memorable names to define them.

## Installation

Install it using [npm](https://npmjs.com):

```sh
npm install friendly-queries
```

## Usage

1. Basic usage:

  ```scss
  selector {
    property: value;

    @include viewport-above(small) {
      property: value;
    }
  }
  ```

  *Output:*

  ```css
  selector {
    property: value;
  }

  @media (min-width: 48em) {
    selector {
      property: value;
    }
  }
  ```

2. Modify the direction:

  ```scss
  selector {
    property: value;

    @include device-below(large, vertical) {
      property: value;
    }
  }
  ```

  *Output:*

  ```css
  selector {
    property: value;
  }

  @media (min-device-height: 64em) {
    selector {
      property: value;
    }
  }
  ```

3. Nesting:

  ```scss
  selector {
    property: value;

    @include viewport-above(small) {
      property: value;

      @include orientation(portrait) {
        property: value;
      }
    }
  }
  ```

  *Output:*

  ```css
  selector {
    property: value;
  }

  @media (min-width: 48em) {
    selector {
      property: value;
    }
  }

  @media (min-width: 48em) and (orientation: portrait) {
    selector {
      property: value;
    }
  }
  ```

*You can see it in action on the
[test page](https://battaglr.github.io/friendly-queries/test/test.html).*

## Available mixins

- `density-above()`
- `density-below()`
- `density-between()`
- `device-above()`
- `device-below()`
- `device-between()`
- `orientation()`
- `print()`
- `viewport-above()`
- `viewport-below()`
- `viewport-between()`

## Conditions

Define the different conditions for the media queries inside the
`$friendly-queries` map.

## Contributing

Contributions are welcome! Please, read the
[contribution guidelines](contributing.md) first.

## License

Released under the [MIT license](license.txt).


text:
A simple repo to set up my Raspberry Pi to use
[duckdns](https://www.duckdns.org).

## Dependencies

- Raspbian Jessie
- Python >= 3.4 (for `pyvenv`)
    - May need to `sudo apt-get install python3-venv` on some systems

## Installation

1. `git clone`
1. Edit `Makefile`:
    - Change `PYTHON_VERSION` as needed if using [pyenv](https://github.com/yyuu/pyenv)
    - If not using `pyenv`, either change `PYTHON` or set it when calling
      `make`
1. `make` (or `PYTHON=/usr/bin/python3 make` if needed)
1. Edit `config.ini` with your duckdns info
1. `sudo make install`
1. Confirm the service file works: `sudo systemctl start duckdns.service && sudo
   journalctl -fx -b -u duckdns.service`
1. Confirm the timer works: `sudo journalctl -fx -b -u duckdns.timer`
    - Should run every hour by default


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

<title>com.badlogic.gdx.graphics Class Hierarchy (libgdx API)</title>
<meta name="date" content="2013-11-03">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

				libgdx API

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package com.badlogic.gdx.graphics

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

com.badlogic.gdx.graphics.Camera

com.badlogic.gdx.graphics.OrthographicCamera

com.badlogic.gdx.graphics.PerspectiveCamera

com.badlogic.gdx.graphics.Color

com.badlogic.gdx.graphics.FPSLogger

com.badlogic.gdx.graphics.GLTexture (implements com.badlogic.gdx.utils.Disposable)

com.badlogic.gdx.graphics.Cubemap

com.badlogic.gdx.graphics.Texture

com.badlogic.gdx.graphics.Mesh (implements com.badlogic.gdx.utils.Disposable)

com.badlogic.gdx.graphics.Pixmap (implements com.badlogic.gdx.utils.Disposable)

com.badlogic.gdx.graphics.PixmapIO

com.badlogic.gdx.graphics.VertexAttribute

com.badlogic.gdx.graphics.VertexAttributes

com.badlogic.gdx.graphics.VertexAttributes.Usage

Interface Hierarchy

com.badlogic.gdx.graphics.GLCommon

com.badlogic.gdx.graphics.GL10

com.badlogic.gdx.graphics.GL11

com.badlogic.gdx.graphics.GL20

com.badlogic.gdx.graphics.TextureData

Enum Hierarchy

java.lang.Object

java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)

com.badlogic.gdx.graphics.Texture.TextureWrap

com.badlogic.gdx.graphics.Mesh.VertexDataType

com.badlogic.gdx.graphics.Cubemap.CubemapSide

com.badlogic.gdx.graphics.Pixmap.Filter

com.badlogic.gdx.graphics.Texture.TextureFilter

com.badlogic.gdx.graphics.TextureData.TextureDataType

com.badlogic.gdx.graphics.Pixmap.Format

com.badlogic.gdx.graphics.Pixmap.Blending

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

libgdx API

Prev

Next

Frames

No Frames

All Classes

				Copyright © 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)


text:
from flask import Flask
from flask import render_template

app = Flask(__name__, template_folder="./", static_folder='./', static_url_path='')

@app.route('/')
def index():
  return render_template('index.html')

if __name__ == '__main__':
  app.debug=True
  app.run(host='0.0.0.0')


text:
.. Performance inside containers

Performance
===========

In short, running FEniCS in Docker may actually be faster than using a
native build since our Docker images have been tuned for performance,
even when running Docker using virtualisation technologies on Mac and
Windows.

A range of FEniCS performance tests using containers can be found in
<http://arxiv.org/abs/1608.07573>.

Linux
-----

On modern Linux systems there is no performance penalty when running
FEniCS in Docker, compared to running natively on the host system.  In
practice, the containers are usually faster than user installations
because they have been tuned for performance.

Docker for Mac
---------------

On macOS, Docker runs inside an extremely lightweight hypervisor
provided by Apple's Hypervisor framework.

Docker for Windows
------------------

On Windows, Docker runs inside Microsoft's Hyper-V, a native and
lightweight hypervisor technology.

Docker Toolbox
--------------

On Mac or Windows, Docker runs inside a Virtualbox-based virtual
machine.


text:
#ifndef GHULBUS_LIBRARY_INCLUDE_GUARD_VULKAN_SPIRV_CODE_HPP
#define GHULBUS_LIBRARY_INCLUDE_GUARD_VULKAN_SPIRV_CODE_HPP

/** @file
*
* @brief SPIR-V loader and code representation.
* @author Andreas Weis (der_ghulbus@ghulbus-inc.de)
*/

#include <gbVk/config.hpp>

#include <vulkan/vulkan.h>
#include <vulkan/vulkan.hpp>

#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <filesystem>
#include <memory>

namespace GHULBUS_VULKAN_NAMESPACE
{

class SpirvCode {
    friend SpirvCode load(std::byte const*, uint32_t);
public:
    struct SpirvVersion {
        uint8_t major;
        uint8_t minor;
    };
private:
    std::unique_ptr<uint32_t[]> m_data;
    uint32_t m_size;
public:
    SpirvCode() = default;
    ~SpirvCode() = default;
    SpirvCode(SpirvCode const&) = delete;
    SpirvCode& operator=(SpirvCode const&) = delete;
    SpirvCode(SpirvCode&&) = default;
    SpirvCode& operator=(SpirvCode&&) = default;

    size_t getSize() const;
    uint32_t const* getCode() const;
    std::vector<uint32_t> getCodeAsStdVector() const;
    SpirvVersion getSpirvVersion() const;
    uint32_t getBound() const;

    static SpirvCode load(std::filesystem::path const& spirv_file);
    static SpirvCode load(std::istream& is);
    static SpirvCode load(std::byte const* data, uint32_t data_size);
};

}
#endif


text:
<?php

namespace FDevs\Photatoes\Tests;

use FDevs\Photatoes\Adapter\AdapterInterface;
use FDevs\Photatoes\Gallery;
use FDevs\Photatoes\Image;
use FDevs\Photatoes\Manager;
use FDevs\Photatoes\Meta;

abstract class TestCase extends \PHPUnit_Framework_TestCase
{
    /**
     * @return Manager
     * @param  AdapterInterface $adapter
     */
    protected function getManger(AdapterInterface $adapter = null)
    {
        if (!$adapter) {
            $adapter = $this->getMockAdapter();
        }

        return new Manager($adapter);
    }

    /**
     * @param  string $href
     * @param  int    $width
     * @param  int    $height
     * @return Meta
     */
    protected function getMeta($href = '', $width = 0, $height = 0)
    {
        return new Meta($href, $width, $height);
    }

    /**
     *
     * @param  string $data
     * @return Image
     */
    protected function getImage($data = 'testId')
    {
        return new Image($data);
    }

    /**
     * get Gallery
     *
     * @param  string  $data id album
     * @return Gallery
     */
    protected function getGallery($data = 'testId')
    {
        return new Gallery($data);
    }

    /**
     * @return \FDevs\Photatoes\Adapter\AdapterInterface
     */
    protected function getMockAdapter()
    {
        $image = $this->getImage();
        $meta = $this->getMeta('image', 50, 50);
        $testGallery = $this->getGallery();
        $testGallery->setCount(1);
        $testGallery->setImages(array($image));
        $testGallery->setName('test album');
        $testGallery->setUpdatedAt(new \DateTime());

        $adapter = $this->getMock('FDevs\Photatoes\Adapter\AdapterInterface');

        $adapter->expects($this->any())
            ->method('getListGallery')
            ->will($this->returnValue(array($testGallery)));

        $adapter->expects($this->any())
            ->method('saveImage')
            ->will($this->returnValue(true));

        $adapter->expects($this->any())
            ->method('saveGallery')
            ->will($this->returnValue(true));

        $adapter->expects($this->any())
            ->method('getTagList')
            ->will($this->returnValue(array('testTag')));

        $adapter->expects($this->any())
            ->method('getImagesByTag')
            ->will($this->returnValue(array($image)));

        $adapter->expects($this->any())
            ->method('getGallery')
            ->with($this->isInstanceOf('FDevs\Photatoes\Gallery'))
            ->will($this->returnCallback(function ($val) use ($testGallery) {
                $val->setCount($testGallery->getCount());
                $val->setImages($testGallery->getImages());
                $val->setName($testGallery->getName());
                $val->setUpdatedAt($testGallery->getUpdatedAt());
            }));

        $adapter->expects($this->any())
            ->method('getCover')
            ->with($this->isInstanceOf('FDevs\Photatoes\Gallery'))
            ->will($this->returnCallback(function ($val) use ($meta) {
                $val->addCover($meta);
            }));

        $adapter->expects($this->any())
            ->method('getImagesGallery')
            ->with($this->isInstanceOf('FDevs\Photatoes\Gallery'))
            ->will($this->returnCallback(function ($val) {
                $val->addImage(new Image('test2Id'));
            }));

        return $adapter;
    }

}


text:
package api

import (
	"errors"
	"encoding/json"
	"net/url"
	"net/http"
	"io/ioutil"

	"github.com/zenazn/goji/web"
	"github.com/samuel/go-zookeeper/zk"

	conf "github.com/QubitProducts/bamboo/configuration"
	service "github.com/QubitProducts/bamboo/services/service"
)

type ServiceAPI struct {
	Config    *conf.Configuration
	Zookeeper *zk.Conn
}

func (d *ServiceAPI) All(w http.ResponseWriter, r *http.Request) {
	services, err := service.All(d.Zookeeper, d.Config.Bamboo.Zookeeper)

	if err != nil {
		responseError(w, err.Error())
		return
	}

	responseJSON(w, services)
}

func (d *ServiceAPI) Create(w http.ResponseWriter, r *http.Request) {
	serviceModel, err := extractServiceModel(r)

	if err != nil {
		responseError(w, err.Error())
		return
	}

	_, err2 := service.Create(d.Zookeeper, d.Config.Bamboo.Zookeeper, serviceModel.Id, serviceModel.Acl)
	if err2 != nil {
		responseError(w, "Marathon ID might already exist")
		return
	}

	responseJSON(w, serviceModel)
}

func (d *ServiceAPI) Put(c web.C, w http.ResponseWriter, r *http.Request) {
	identifier, _ := url.QueryUnescape(c.URLParams["id"])
	serviceModel, err := extractServiceModel(r)
	if err != nil {
		responseError(w, err.Error())
		return
	}

	_, err1 := service.Put(d.Zookeeper, d.Config.Bamboo.Zookeeper, identifier, serviceModel.Acl)
	if err1 != nil {
		responseError(w, err1.Error())
		return
	}

	responseJSON(w, serviceModel)
}

func (d *ServiceAPI) Delete(c web.C, w http.ResponseWriter, r *http.Request) {
	identifier, _ := url.QueryUnescape(c.URLParams["id"])
	err := service.Delete(d.Zookeeper, d.Config.Bamboo.Zookeeper, identifier)
	if err != nil {
		responseError(w, err.Error())
		return
	}

	responseJSON(w, new(map[string]string))
}

func extractServiceModel(r *http.Request) (service.Service, error) {
	var serviceModel service.Service
	payload, _ := ioutil.ReadAll(r.Body)

	err := json.Unmarshal(payload, &serviceModel)
	if err != nil {
		return serviceModel, errors.New("Unable to decode JSON request")
	}

	return serviceModel, nil
}

func responseError(w http.ResponseWriter, message string) {
	http.Error(w, message, http.StatusBadRequest)
}

func responseJSON(w http.ResponseWriter, data interface {}) {
	w.Header().Set("Content-Type", "application/json")
	bites, _ := json.Marshal(data)
	w.Write(bites)
}


text:
<!DOCTYPE html>

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

    <title>Fingers — Leap Motion C++ SDK v3.1 documentation</title>

    <link rel="stylesheet" href="../../cpp/_static/bootstrap-3.0.0/css/documentation-bundle.1471552333.css" type="text/css" />

    <link rel="top" title="Leap Motion C++ SDK v3.1 documentation" href="../index.html" />
    <link rel="up" title="Using the Tracking API" href="Leap_Guides2.html" />
    <link rel="next" title="Coordinate Systems" href="Leap_Coordinate_Mapping.html" />
    <link rel="prev" title="Hands" href="Leap_Hand.html" />

<link rel="stylesheet" href="/assets/standalone-header.css?r9" type="text/css" />

<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

            Developer Portal

      <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">

      </button>

What's new

Getting Started

Documentation

 Examples

 Blog

 Community

      JavaScript

      Unity

      C#

      C++

      Java

      Python

      Objective-C

      Unreal

<form class="navbar-form" action="../search.html" method="get" onsubmit="storeThisPage()">

  <input type="search" results="5" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

Fingers¶

Fingers are represented by <tt class="docutils literal">Pointable</tt> objects. In addition, a separate <tt class="docutils literal">Finger</tt> class specializes the <tt class="docutils literal">Pointable</tt> class to provide specific finger information.

Getting Pointable Objects¶

You can get the fingers associated with a particular hand from the <tt class="docutils literal">Hand</tt> object. You can also get all detected pointables (fingers) from a <tt class="docutils literal">Frame</tt> object.

Pointable Object Characteristics¶

<tt class="docutils literal">Pointable</tt> objects have many attributes describing the characteristics of the represented finger.

<tt class="docutils literal">Finger</tt> <tt class="docutils literal">tipPosition</tt> and <tt class="docutils literal">direction</tt> vectors provide the positions of the finger tips and the directions in which the fingers are pointing.

Tip position — the instantaneous position in mm from the Leap Motion origin.

Tip velocity — the instantaneous velocity in mm/s.

Stabilized tip position — the position filtered and stabilized using velocity and past positions.

Direction — the current pointing direction vector.

Length — the apparent length of the finger.

Width — the average width.

Touch distance — the normalized distance from the virtual touch plane. See <tt class="xref doc docutils literal">Leap_Touch_Emulation</tt>.

Touch zone — the pointable’s current relation to the virtual touch plane.

The following example illustrates how to get a pointable object from a frame and access its basic characteristics:

Leap::Pointable pointable = frame.pointables().frontmost();
Leap::Vector direction = pointable.direction();
float length = pointable.length();
float width = pointable.width();
Leap::Vector stabilizedPosition = pointable.stabilizedTipPosition();
Leap::Vector position = pointable.tipPosition();
Leap::Vector speed = pointable.tipVelocity();
float touchDistance = pointable.touchDistance();
Leap::Pointable::Zone zone = pointable.touchZone();

Converting a Pointable Instance to a Finger Instance¶

To convert a <tt class="docutils literal">Pointable</tt> object to its <tt class="docutils literal">Finger</tt> subclass, use the <tt class="docutils literal">Finger</tt> constructor
(one of the few times that you should use the constructor for a Leap class).

if (pointable.isTool()) {
    Leap::Tool tool = Leap::Tool(pointable);
} else {
    Leap::Finger finger = Leap::Finger(pointable);
}

Fingers¶

<tt class="docutils literal">Finger</tt> objects extend <tt class="docutils literal">Pointable</tt> to represent physical fingers. A finger has a type, a direction and a set of bones.

As of version 2.0 of the Leap Motion SDK, all five fingers are are always present in the list of fingers for a hand. The Leap Motion software estimates positions for fingers and bones that it cannot track clearly. Thus subtle movements of fingers against or behind the hand (as seen from the Leap Motion sensor’s point of view) may not be reflected in the data.

Fingers can be identified by type, e.g. the index, thumb, pinky. Finger IDs are assigned based on the hand ID. If a hand has an ID of “5”, then its fingers are assigned IDs 50 to 55, ordered from thumb to pinky.

Pointable and Finger Lists¶

The <tt class="docutils literal">PointableList</tt> and <tt class="docutils literal">FingerList</tt> classes all have a similar structure. They are designed to act like vector-style arrays and support iterators. You cannot remove or alter the member objects of lists received from the Leap API, but you can combine lists of the same object type.

To use an iterator with one of these lists:

for(HandList::const_iterator hl = handList.begin(); hl != handList.end(); hl++)
    std::cout << *hl << std::endl;

The <tt class="docutils literal">PointableList</tt> and <tt class="docutils literal">FingerList</tt> classes define additional functions for getting members of the list based on their relative position within the Leap coordinate system. These functions include leftmost(), rightmost(), and frontmost(). The following snippet illustrates a few ways to use these functions:

Leap::Finger farLeft = frame.fingers().leftmost();
Leap::Finger mostForwardOnHand = frame.hands()[0].fingers().frontmost();
Leap::Tool rightTool = frame.tools().rightmost();

C++ Docs (v3.1)

API Overview

Guidelines

Application Development

Using the Tracking API

Connecting to the Controller

Tracking Model

Frames

Hands

Fingers

Getting Pointable Objects

Pointable Object Characteristics

Converting a Pointable Instance to a Finger Instance

Fingers

Pointable and Finger Lists

Coordinate Systems

Camera Images

Serializing Tracking Data

API Reference

Appendices


text: __import__('pkg_resources').declare_namespace('starter.templates')


text:
/*global profile:true*/
profile = {
    resourceTags: {
        test: function() {
            return false;
        },
        copyOnly: function(filename, mid) {
            return (/^app\/resources\//.test(mid) && !/\.css$/.test(filename));
        },
        amd: function(filename, mid) {
            return !this.copyOnly(filename, mid) && /\.js$/.test(filename);
        },
        miniExclude: function(filename, mid) {
            return mid in {
                'app/package': 1,
                'app/tests/jasmineTestBootstrap': 1
            };
        }
    }
};


text:
package com.planet_ink.coffee_mud.Abilities.Prayers;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("rawtypes")
public class Prayer_MassHarm extends Prayer
{
	@Override public String ID() { return "Prayer_MassHarm"; }
	private final static String localizedName = CMLib.lang()._("Mass Harm");
	@Override public String name() { return localizedName; }
	@Override public int classificationCode(){return Ability.ACODE_PRAYER|Ability.DOMAIN_VEXING;}
	@Override public int abstractQuality(){ return Ability.QUALITY_MALICIOUS;}
	@Override public long flags(){return Ability.FLAG_UNHOLY;}

	@Override
	public int castingQuality(MOB mob, Physical target)
	{
		if(mob!=null)
		{
			if(target instanceof MOB)
			{
				if(((MOB)target).charStats().getMyRace().racialCategory().equals("Undead"))
					return super.castingQuality(mob, target,Ability.QUALITY_BENEFICIAL_OTHERS);
			}
		}
		return super.castingQuality(mob,target);
	}

	@Override
	public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel)
	{
		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		final Set<MOB> h=properTargets(mob,givenTarget,auto);
		if(h==null) return false;

		final boolean success=proficiencyCheck(mob,0,auto);
		final int numEnemies=h.size();
		for (final Object element : h)
		{
			final MOB target=(MOB)element;
			if(target!=mob)
			{
				if(success)
				{
					// it worked, so build a copy of this ability,
					// and add it to the affects list of the
					// affected MOB.  Then tell everyone else
					// what happened.
					final Room R=target.location();
					final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto)|CMMsg.MASK_MALICIOUS,auto?_("<T-NAME> become(s) surrounded by a dark cloud."):_("^S<S-NAME> sweep(s) <S-HIS-HER> hands over <T-NAMESELF>, @x1.^?",prayingWord(mob)));
					final CMMsg msg2=CMClass.getMsg(mob,target,this,CMMsg.MSK_CAST_MALICIOUS_VERBAL|CMMsg.TYP_UNDEAD|(auto?CMMsg.MASK_ALWAYS:0),null);
					if((R.okMessage(mob,msg))&&((R.okMessage(mob,msg2))))
					{
						R.send(mob,msg);
						R.send(mob,msg2);
						if((msg.value()<=0)&&(msg2.value()<=0))
						{
							final int harming=CMLib.dice().roll(1,(adjustedLevel(mob,asLevel)+ 24) / numEnemies,8);
							CMLib.combat().postDamage(mob,target,this,harming,CMMsg.MASK_ALWAYS|CMMsg.TYP_UNDEAD,Weapon.TYPE_BURSTING,"The unholy spell <DAMAGE> <T-NAME>!");
						}
					}
				}
				else
					maliciousFizzle(mob,target,_("<S-NAME> sweep(s) <S-HIS-HER> hands over <T-NAMESELF>, @x1, but @x2 does not heed.",prayingWord(mob),hisHerDiety(mob)));
			}
		}

		// return whether it worked
		return success;
	}
}


text:
#define TRACE(s, args...)	pr_debug("SQUASHFS: "s, ## args)

#define ERROR(s, args...)	pr_err("SQUASHFS error: "s, ## args)

#define WARNING(s, args...)	pr_warning("SQUASHFS: "s, ## args)

static inline struct squashfs_inode_info *squashfs_i(struct inode *inode)
{
	return list_entry(inode, struct squashfs_inode_info, vfs_inode);
}

/* block.c */
extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *,
				int, int);

/* cache.c */
extern struct squashfs_cache *squashfs_cache_init(char *, int, int);
extern void squashfs_cache_delete(struct squashfs_cache *);
extern struct squashfs_cache_entry *squashfs_cache_get(struct super_block *,
				struct squashfs_cache *, u64, int);
extern void squashfs_cache_put(struct squashfs_cache_entry *);
extern int squashfs_copy_data(void *, struct squashfs_cache_entry *, int, int);
extern int squashfs_read_metadata(struct super_block *, void *, u64 *,
				int *, int);
extern struct squashfs_cache_entry *squashfs_get_fragment(struct super_block *,
				u64, int);
extern struct squashfs_cache_entry *squashfs_get_datablock(struct super_block *,
				u64, int);
extern int squashfs_read_table(struct super_block *, void *, u64, int);

/* export.c */
extern __le64 *squashfs_read_inode_lookup_table(struct super_block *, u64,
				unsigned int);

/* fragment.c */
extern int squashfs_frag_lookup(struct super_block *, unsigned int, u64 *);
extern __le64 *squashfs_read_fragment_index_table(struct super_block *,
				u64, unsigned int);

/* id.c */
extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *);
extern __le64 *squashfs_read_id_index_table(struct super_block *, u64,
				unsigned short);

/* inode.c */
extern struct inode *squashfs_iget(struct super_block *, long long,
				unsigned int);
extern int squashfs_read_inode(struct inode *, long long);

/*
 * Inodes and files operations
 */

/* dir.c */
extern const struct file_operations squashfs_dir_ops;

/* export.c */
extern const struct export_operations squashfs_export_ops;

/* file.c */
extern const struct address_space_operations squashfs_aops;

/* namei.c */
extern const struct inode_operations squashfs_dir_inode_ops;

/* symlink.c */
extern const struct address_space_operations squashfs_symlink_aops;


text:
using System;
using Custom.Algebra.QrCode.Encoding.DataEncodation.InputRecognition;
using Custom.Algebra.QrCode.Encoding.Versions;
using Custom.Algebra.QrCode.Encoding.Terminate;

namespace Custom.Algebra.QrCode.Encoding.DataEncodation
{
	/// <remarks>ISO/IEC 18004:2000 Chapter 8.1 Page 14
	/// DataEncode is combination of Data analysis and Data encodation step.
	/// Which uses sub functions under several different namespaces</remarks>
	internal static class DataEncode
	{
		internal static EncodationStruct Encode(string content, ErrorCorrectionLevel ecLevel)
		{
			RecognitionStruct recognitionResult = InputRecognise.Recognise(content);
			EncoderBase encoderBase = CreateEncoder(recognitionResult.Mode, recognitionResult.EncodingName);

			BitList encodeContent = encoderBase.GetDataBits(content);

			int encodeContentLength = encodeContent.Count;

			VersionControlStruct vcStruct =
				VersionControl.InitialSetup(encodeContentLength, recognitionResult.Mode, ecLevel, recognitionResult.EncodingName);

			BitList dataCodewords = new BitList();
			//Eci header
			if(vcStruct.isContainECI && vcStruct.ECIHeader != null)
				dataCodewords.Add(vcStruct.ECIHeader);
			//Header
			dataCodewords.Add(encoderBase.GetModeIndicator());
			int numLetter = recognitionResult.Mode == Mode.EightBitByte ? encodeContentLength >> 3 : content.Length;
			dataCodewords.Add(encoderBase.GetCharCountIndicator(numLetter, vcStruct.VersionDetail.Version));
			//Data
			dataCodewords.Add(encodeContent);
			//Terminator Padding
			dataCodewords.TerminateBites(dataCodewords.Count, vcStruct.VersionDetail.NumDataBytes);

			int dataCodewordsCount = dataCodewords.Count;
			if((dataCodewordsCount & 0x7) != 0)
				throw new ArgumentException("data codewords is not byte sized.");
			else if(dataCodewordsCount >> 3 != vcStruct.VersionDetail.NumDataBytes)
			{
				throw new ArgumentException("datacodewords num of bytes not equal to NumDataBytes for current version");
			}

			EncodationStruct encStruct = new EncodationStruct(vcStruct);
			encStruct.Mode = recognitionResult.Mode;
			encStruct.DataCodewords = dataCodewords;
			return encStruct;
		}

		private static EncoderBase CreateEncoder(Mode mode, string encodingName)
		{
			switch(mode)
			{
				case Mode.Numeric:
					return new NumericEncoder();
				case Mode.Alphanumeric:
					return new AlphanumericEncoder();
				case Mode.EightBitByte:
					return new EightBitByteEncoder(encodingName);
				case Mode.Kanji:
					return new KanjiEncoder();
				default:
					throw new ArgumentOutOfRangeException("mode", mode, string.Format("Doesn't contain encoder for {0}", mode));
			}
		}
	}
}


text:
namespace language {
namespace prefs {

extern const char kAcceptLanguages[];

extern const char kSelectedLanguages[];

extern const char kForcedLanguages[];

#if BUILDFLAG(IS_CHROMEOS_ASH)
extern const char kPreferredLanguages[];
extern const char kPreferredLanguagesSyncable[];
#endif

// The application locale.
// DO NOT USE this locale directly: use language::ConvertToActualUILocale()
// after reading it to get the system locale. This pref stores the locale that
// the user selected, if applicable.
extern const char kApplicationLocale[];

#if defined(OS_ANDROID)
extern const char kAppLanguagePromptShown[];
#endif

}  // namespace prefs
}  // namespace language

#endif  // COMPONENTS_LANGUAGE_CORE_BROWSER_PREF_NAMES_H_


text:
package cc.maumau.core.rcp.screen;

import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

/**
 *
 * @author Christian Kuka <christian@kuka.cc>
 *
 */
public class Screen {

	public static BufferedImage capture(int delay) throws AWTException {
		Robot robot = new Robot();
		robot.delay(delay);
		return robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:onClick="add"
        android:text="add" />

    <LinearLayout
        android:id="@+id/ll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/button1"
        android:orientation="vertical" >
    </LinearLayout>

</RelativeLayout>


text:
#pragma once
//------------------------------------------------------------------------------
/**
    @class Oryol::_priv::inputMgr
    @ingroup _priv
    @brief frontend inputMgr class
*/
#if ORYOL_UWP
#include "Input/uwp/uwpInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public uwpInputMgr { };
} }
#elif (ORYOL_D3D11 || ORYOL_D3D12)
#include "Input/win/winInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public winInputMgr { };
} }
#elif ORYOL_MACOS && ORYOL_METAL
#include "Input/osx/osxInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public osxInputMgr { };
} }
#elif ORYOL_RASPBERRYPI
#include "Input/raspi/raspiInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public raspiInputMgr { };
} }
#elif (ORYOL_WINDOWS || ORYOL_MACOS || ORYOL_LINUX)
#include "Input/glfw/glfwInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public glfwInputMgr { };
} }
#elif ORYOL_EMSCRIPTEN
#include "Input/emsc/emscInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public emscInputMgr { };
} }
#elif ORYOL_PNACL
#include "Input/pnacl/pnaclInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public pnaclInputMgr { };
} }
#elif ORYOL_ANDROID
#include "Input/android/androidInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public androidInputMgr { };
} }
#elif ORYOL_IOS
#include "Input/ios/iosInputMgr.h"
namespace Oryol {
namespace _priv {
class inputMgr : public iosInputMgr { };
} }
#else
#include "Input/base/inputMgrBase.h"
namespace Oryol {
namespace _priv {
class inputMgr : public inputMgrBase { };
} }
#endif


text:
<?php
/**
* Template Name: About template
*/
use Experiensa\Modules\QueryBuilder;
$design_settings = get_option('experiensa_design_settings');
$page_object = get_queried_object();
$page_id     = get_queried_object_id();
?>

    <?php while (have_posts()) : the_post(); ?>
        <?php get_template_part('templates/page', 'header'); ?>
        <?php get_template_part('templates/content', 'page'); ?>
    <?php endwhile; ?>

    <?php get_template_part('templates/about/about'); ?>

    <?php get_template_part('templates/about/map'); ?>

<?php
$section_obj = new Experiensa\Component\Section($page_id,$design_settings,'about_section');
if($section_obj->checkExistSections()):
    $sections = $section_obj->getSections();
    foreach($sections as $section):
//        echo "
";
//        print_r($section);
//        echo "
";
        $section_obj->showSection($section);
    endforeach;
endif;


text:
package com.luv2code.springdemo.mvc;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/hello")
public class HelloWorldController {

	// need a controller method to show the initial HTML form

	@RequestMapping("/showForm")
	public String showForm() {
		return "helloworld-form";
	}

	// need a controller method to process the HTML form

	@RequestMapping("/processForm")
	public String processForm() {
		return "helloworld";
	}

	// new a controller method to read form data and
	// add data to the model

	@RequestMapping("/processFormVersionTwo")
	public String letsShoutDude(HttpServletRequest request, Model model) {

		// read the request parameter from the HTML form
		String theName = request.getParameter("studentName");

		// convert the data to all caps
		theName = theName.toUpperCase();

		// create the message
		String result = "Yo! " + theName;

		// add message to the model
		model.addAttribute("message", result);

		return "helloworld";
	}

	@RequestMapping("/processFormVersionThree")
	public String processFormVersionThree(
			@RequestParam("studentName") String theName,
			Model model) {

		// convert the data to all caps
		theName = theName.toUpperCase();

		// create the message
		String result = "Hey My Friend from v3! " + theName;

		// add message to the model
		model.addAttribute("message", result);

		return "helloworld";
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="description.xsl"?>
<Overview version="1.0">
  <SampleName>JsonSAP Template</SampleName>
  <SampleVersion>1.0</SampleVersion>
  <Preview>screenshot.png</Preview>
  <Description>
    A template for writing Linked-Master/Integrated Samsung Accessory Protocol applications using json to send data back and forth with a host device.
  </Description>
</Overview>


text:
<?php

/*
 * This file is part of the PHP CS utility.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\CS\Tests\Fixer\Contrib;

use Symfony\CS\Tests\Fixer\AbstractFixerTestBase;

class OrderedUseFixerTest extends AbstractFixerTestBase
{
    public function testFix()
    {
        $expected = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Foo\Bar;
use Foo\Bar\Foo as Fooo, Foo\Bar\FooBar as FooBaz;
 use Foo\Bir as FBB;
use Foo\Zar\Baz;
use SomeClass;
   use Symfony\Annotation\Template, Symfony\Doctrine\Entities\Entity;
use Zoo\Bar;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Zoo\Tar;

class AnnotatedClass
{
    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $input = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Foo\Bar\FooBar as FooBaz;
use Zoo\Bar, Zoo\Tar;
 use Foo\Bar;
use Foo\Zar\Baz;
use Symfony\Annotation\Template;
   use Foo\Bar\Foo as Fooo, Foo\Bir as FBB;
use SomeClass;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Symfony\Doctrine\Entities\Entity;

class AnnotatedClass
{
    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $this->makeTest($expected, $input);
    }

    public function testFixWithMultipleNamespace()
    {
        $expected = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

namespace FooRoo {

    use Foo\Bar;
    use Foo\Bar\Foo as Fooo, Foo\Bar\FooBar as FooBaz;
     use Foo\Bir as FBB;
    use Foo\Zar\Baz;
    use SomeClass;
       use Symfony\Annotation\Template, Zoo\Bar;
    use Zoo\Tar;

    $a = new Bar();
    $a = new FooBaz();
    $a = new someclass();

    use Zoo\Tar;

    class AnnotatedClass
    {
        /**
         * @Template(foobar=21)
         * @param Entity $foo
         */
        public function doSomething($foo)
        {
            $bar = $foo->toArray();
            /** @var ArrayInterface $bar */

            return function () use ($bar, $foo) {};
        }
    }
}

namespace BlaRoo {

    use Foo\Zar\Baz;
  use SomeClass;
    use Symfony\Annotation\Template;
  use Symfony\Doctrine\Entities\Entity, Zoo\Bar;

    class AnnotatedClass
    {
        /**
         * @Template(foobar=21)
         * @param Entity $foo
         */
        public function doSomething($foo)
        {
            $bar = $foo->toArray();
            /** @var ArrayInterface $bar */

            return function () use ($bar, $foo) {};
        }
    }
}
EOF;

        $input = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

namespace FooRoo {

    use Foo\Bar\FooBar as FooBaz;
    use Zoo\Bar, Zoo\Tar;
     use Foo\Bar;
    use Foo\Zar\Baz;
    use Symfony\Annotation\Template;
       use Foo\Bar\Foo as Fooo, Foo\Bir as FBB;
    use SomeClass;

    $a = new Bar();
    $a = new FooBaz();
    $a = new someclass();

    use Zoo\Tar;

    class AnnotatedClass
    {
        /**
         * @Template(foobar=21)
         * @param Entity $foo
         */
        public function doSomething($foo)
        {
            $bar = $foo->toArray();
            /** @var ArrayInterface $bar */

            return function () use ($bar, $foo) {};
        }
    }
}

namespace BlaRoo {

    use Foo\Zar\Baz;
  use Zoo\Bar;
    use SomeClass;
  use Symfony\Annotation\Template, Symfony\Doctrine\Entities\Entity;

    class AnnotatedClass
    {
        /**
         * @Template(foobar=21)
         * @param Entity $foo
         */
        public function doSomething($foo)
        {
            $bar = $foo->toArray();
            /** @var ArrayInterface $bar */

            return function () use ($bar, $foo) {};
        }
    }
}
EOF;

        $this->makeTest($expected, $input);
    }

    public function testFixWithComment()
    {
        $expected = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Foo\Bar;
use Foo\Bar\Foo as Fooo, Foo\Bar\FooBar /* He there */ as FooBaz;
 use Foo\Bir as FBB;
use Foo\Zar\Baz;
use SomeClass;
   use /* FIXME */Symfony\Annotation\Template, Symfony\Doctrine\Entities\Entity;
use Zoo\Bar;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Zoo\Tar;

class AnnotatedClass
{
    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $input = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Foo\Bar\FooBar /* He there */ as FooBaz;
use Zoo\Bar, Zoo\Tar;
 use Foo\Bar;
use Foo\Zar\Baz;
use /* FIXME */Symfony\Annotation\Template;
   use Foo\Bar\Foo as Fooo, Foo\Bir as FBB;
use SomeClass;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Symfony\Doctrine\Entities\Entity;

class AnnotatedClass
{
    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $this->makeTest($expected, $input);
    }

    /**
     * @requires PHP 5.4
     */
    public function test54()
    {
        $expected = <<<'EOF'
<?php

use Foo\Bar;
use Foo\Bar\Foo as Fooo, Foo\Bar\FooBar as FooBaz;
 use Foo\Bir as FBB;
use Foo\Zar\Baz;
use SomeClass;
   use Symfony\Annotation\Template, Symfony\Doctrine\Entities\Entity;
use Zoo\Bar;

use Zoo\Tar;

trait Foo {}

trait Bar {}

class AnnotatedClass
{
    use Foo, Bar;

    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $input = <<<'EOF'
<?php

use Foo\Bar\FooBar as FooBaz;
use Zoo\Bar, Zoo\Tar;
 use Foo\Bar;
use Foo\Zar\Baz;
use Symfony\Annotation\Template;
   use Foo\Bar\Foo as Fooo, Foo\Bir as FBB;
use SomeClass;

use Symfony\Doctrine\Entities\Entity;

trait Foo {}

trait Bar {}

class AnnotatedClass
{
    use Foo, Bar;

    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $foo) {};
    }
}
EOF;

        $this->makeTest($expected, $input);
    }

    /**
     * @requires PHP 5.4
     */
    public function testFixWithTraitImports()
    {
        $expected = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Acme\MyReusableTrait;
use Foo\Bar, Foo\Bar\Foo as Fooo;
 use Foo\Bar\FooBar as FooBaz;
use Foo\Bir as FBB;
use Foo\Zar\Baz;
use SomeClass;
   use Symfony\Annotation\Template, Symfony\Doctrine\Entities\Entity;
use Zoo\Bar;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Zoo\Tar;

class AnnotatedClass
{
    use MyReusableTrait;

    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $baz) {};
    }
}
EOF;

        $input = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use Foo\Bar;
use Foo\Zar\Baz;

<?php

use Foo\Bar\FooBar as FooBaz;
use Zoo\Bar, Zoo\Tar;
 use Foo\Bar;
use Foo\Zar\Baz;
use Acme\MyReusableTrait;
use Symfony\Annotation\Template;
   use Foo\Bar\Foo as Fooo, Foo\Bir as FBB;
use SomeClass;

$a = new Bar();
$a = new FooBaz();
$a = new someclass();

use Symfony\Doctrine\Entities\Entity;

class AnnotatedClass
{
    use MyReusableTrait;

    /**
     * @Template(foobar=21)
     * @param Entity $foo
     */
    public function doSomething($foo)
    {
        $bar = $foo->toArray();
        /** @var ArrayInterface $bar */

        return function () use ($bar, $baz) {};
    }
}
EOF;

        $this->makeTest($expected, $input);
    }

    public function testFixWithDifferentCases()
    {
        $expected = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use abc\Bar;

<?php

use abc\Bar;
use Zoo\Bar;

class Test
{
}
EOF;

        $input = <<<'EOF'
The normal
use of this fixer
should not change this sentence nor those statements below
use Zoo\Bar;
use abc\Bar;

<?php

use Zoo\Bar;
use abc\Bar;

class Test
{
}
EOF;

        $this->makeTest($expected, $input);
    }

    public function testWithoutUses()
    {
        $expected = <<<'EOF'
<?php

$c = 1;
EOF
        ;

        $this->makeTest($expected);
    }

    public function testOrderWithTrailingDigit()
    {
        $expected = <<<'EOF'
<?php

use abc\Bar;
use abc2\Bar;
use xyz\abc\Bar;
use xyz\abc2\Bar;
use xyz\xyz\Bar;
use xyz\xyz\Bar2;

class Test
{
}
EOF;

        $input = <<<'EOF'
<?php

use abc2\Bar;
use abc\Bar;
use xyz\abc2\Bar;
use xyz\abc\Bar;
use xyz\xyz\Bar2;
use xyz\xyz\Bar;

class Test
{
}
EOF;

        $this->makeTest($expected, $input);
    }
}


text:
<?php

namespace MAteDon\Admin\Form\Field;

use MAteDon\Admin\Form\Field;

class Divide extends Field
{
    public function render()
    {
        return '<hr>';
    }
}


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

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

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:osgi="http://www.springframework.org/schema/osgi"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
  http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

    <!-- Allows us to use system properties as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="${name}" dataDirectory="${karaf.data}/activemq/${name}" useShutdownHook="false" startAsync="true">

        <!--
            For better performances use VM cursor and small memory limit.
            For more information, see:

            http://activemq.apache.org/message-cursors.html

            Also, if your producer is "hanging", it's probably due to producer flow control.
            For more information, see:
            http://activemq.apache.org/producer-flow-control.html
        -->

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
                  <!-- Use VM cursor for better latency
                       For more information, see:

                       http://activemq.apache.org/message-cursors.html

                  <pendingQueuePolicy>
                    <vmQueueCursor/>
                  </pendingQueuePolicy>
                  -->
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <!--
            Configure message persistence for the broker. The default persistence
            mechanism is the KahaDB store (identified by the kahaDB tag).
            For more information, see:

            http://activemq.apache.org/persistence.html
        -->
        <persistenceAdapter>
            <kahaDB directory="${karaf.data}/activemq/${name}/kahadb"/>
        </persistenceAdapter>

       <!--
            The systemUsage controls the maximum amount of space the broker will
            use before slowing down producers. For more information, see:

            http://activemq.apache.org/producer-flow-control.html

        <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="20 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="1 gb" name="foo"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="100 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>
        -->

        <shutdownHooks>
           <bean xmlns="http://www.springframework.org/schema/beans" id="hook" class="org.apache.activemq.hooks.osgi.SpringOsgiContextHook" />
        </shutdownHooks>

        <!-- The transport connectors ActiveMQ will listen to -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
        </transportConnectors>

    </broker>

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://0.0.0.0:61616" />
    </bean>

    <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="maxConnections" value="8" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
    </bean>

    <bean id="resourceManager" class="org.apache.activemq.jms.pool.GenericResourceManager" init-method="recoverResource">
          <property name="transactionManager" ref="transactionManager" />
          <property name="connectionFactory" ref="activemqConnectionFactory" />
          <property name="resourceName" value="activemq.${name}" />
    </bean>

    <osgi:reference id="transactionManager" interface="javax.transaction.TransactionManager" />

    <osgi:service ref="pooledConnectionFactory">

        <osgi:interfaces>
            <value>javax.jms.ConnectionFactory</value>
        </osgi:interfaces>
        <osgi:service-properties>
            <entry key="name" value="${name}"/>
        </osgi:service-properties>
    </osgi:service>

</beans>


text:
<?php

/**
 * Mage_Cms_IndexControllerTest
 *
 * @package    Mage_Cms
 * @subpackage Mage_Cms_Test
 *
 *
 * @uses PHPUnit_Framework_Magento_TestCase
 */
class Mage_Cms_IndexControllerTest extends MageTest_PHPUnit_Framework_ControllerTestCase {

    /**
     * noRouteShouldSet404Header
     * @author Alistair Stead
     * @test
     */
    public function noRouteShouldSet404Header()
    {
        $this->dispatch('/cms/defaultNoRoute');

        $this->assertRoute('cms', "The expected cms route has not been matched");
        $this->assertController('index', "The expected controller is not been used");
        // $this->assertAction('defaultNoRoute', "The login form should be presented");

        // TODO review the response header functionality and redirects
        // $this->assertResponseCode('404', 'A 404 has not been returned for a non existent page');
    } // noRouteShouldSet404Header

}


text:
=begin
  parser/jinja2.rb - parser for Jinja2 templates
  Based upon gettext-2.2.1/lib/gettext/tools/parser/glade.rb by Masao Mutoh

  Copyright (C) 2014 Daniel Cruz Horts

  You may redistribute under MIT license terms.
=end

module GetText
  module Jinja2Parser
    extend GetText
    extend self

    bindtextdomain('rgettext')

    def parse(file, targets = []) # :nodoc:
      lines = IO.readlines(file)
      parse_lines(file, lines, targets)
    end

    #from ary of lines.
    def parse_lines(file, lines, targets) # :nodoc:
      line_no = 0

      loop do
        line = lines.shift
        break unless line

        line_no += 1
        if matches = line.scan(/{% trans %}(.*?){% endtrans %}/)
          matches.each do |match|
            add_target(match.first, file, line_no, targets)
          end
        end
      end
      targets
    end

    def target?(file) # :nodoc:
      true
    end

    def add_target(val, file, line_no, targets) # :nodoc:
      return unless val.size > 0
      assoc_data = targets.assoc(val)
      val = CGI.unescapeHTML(val)
      if assoc_data
        targets[targets.index(assoc_data)] = assoc_data << "#{file}:#{line_no}"
      else
        targets << [val, "#{file}:#{line_no}"]
      end
      targets
    end
  end
end

if __FILE__ == $0
  # ex) ruby jinja2.rb file1.html file2.html
  ARGV.each do |file|
    p GetText::Jinja2Parser.parse(file)
  end
end


text:
package v1beta1

import (
	"k8s.io/apimachinery/pkg/util/sets"
	utilfeature "k8s.io/apiserver/pkg/util/feature"
	"k8s.io/klog/v2"
	"k8s.io/kube-scheduler/config/v1beta1"
	"k8s.io/kubernetes/pkg/features"
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
	"k8s.io/utils/pointer"
)

// getDefaultPlugins returns the default set of plugins.
func getDefaultPlugins() *v1beta1.Plugins {
	plugins := &v1beta1.Plugins{
		QueueSort: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.PrioritySort},
			},
		},
		PreFilter: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.NodeResourcesFit},
				{Name: names.NodePorts},
				{Name: names.PodTopologySpread},
				{Name: names.InterPodAffinity},
				{Name: names.VolumeBinding},
				{Name: names.NodeAffinity},
			},
		},
		Filter: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.NodeUnschedulable},
				{Name: names.NodeName},
				{Name: names.TaintToleration},
				{Name: names.NodeAffinity},
				{Name: names.NodePorts},
				{Name: names.NodeResourcesFit},
				{Name: names.VolumeRestrictions},
				{Name: names.EBSLimits},
				{Name: names.GCEPDLimits},
				{Name: names.NodeVolumeLimits},
				{Name: names.AzureDiskLimits},
				{Name: names.VolumeBinding},
				{Name: names.VolumeZone},
				{Name: names.PodTopologySpread},
				{Name: names.InterPodAffinity},
			},
		},
		PostFilter: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.DefaultPreemption},
			},
		},
		PreScore: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.InterPodAffinity},
				{Name: names.PodTopologySpread},
				{Name: names.TaintToleration},
				{Name: names.NodeAffinity},
			},
		},
		Score: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32Ptr(1)},
				{Name: names.ImageLocality, Weight: pointer.Int32Ptr(1)},
				{Name: names.InterPodAffinity, Weight: pointer.Int32Ptr(1)},
				{Name: names.NodeResourcesLeastAllocated, Weight: pointer.Int32Ptr(1)},
				{Name: names.NodeAffinity, Weight: pointer.Int32Ptr(1)},
				{Name: names.NodePreferAvoidPods, Weight: pointer.Int32Ptr(10000)},
				// Weight is doubled because:
				// - This is a score coming from user preference.
				// - It makes its signal comparable to NodeResourcesLeastAllocated.
				{Name: names.PodTopologySpread, Weight: pointer.Int32Ptr(2)},
				{Name: names.TaintToleration, Weight: pointer.Int32Ptr(1)},
			},
		},
		Reserve: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.VolumeBinding},
			},
		},
		PreBind: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.VolumeBinding},
			},
		},
		Bind: &v1beta1.PluginSet{
			Enabled: []v1beta1.Plugin{
				{Name: names.DefaultBinder},
			},
		},
	}
	applyFeatureGates(plugins)

	return plugins
}

func applyFeatureGates(config *v1beta1.Plugins) {
	if utilfeature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
		config.Score.Enabled = append(config.Score.Enabled, v1beta1.Plugin{Name: names.VolumeBinding, Weight: pointer.Int32Ptr(1)})
	}

	if !utilfeature.DefaultFeatureGate.Enabled(features.DefaultPodTopologySpread) {
		// When feature is enabled, the default spreading is done by
		// PodTopologySpread plugin, which is enabled by default.
		klog.InfoS("Registering SelectorSpread plugin")
		s := v1beta1.Plugin{Name: names.SelectorSpread}
		config.PreScore.Enabled = append(config.PreScore.Enabled, s)
		s.Weight = pointer.Int32Ptr(1)
		config.Score.Enabled = append(config.Score.Enabled, s)
	}
}

// mergePlugins merges the custom set into the given default one, handling disabled sets.
func mergePlugins(defaultPlugins, customPlugins *v1beta1.Plugins) *v1beta1.Plugins {
	if customPlugins == nil {
		return defaultPlugins
	}

	defaultPlugins.QueueSort = mergePluginSet(defaultPlugins.QueueSort, customPlugins.QueueSort)
	defaultPlugins.PreFilter = mergePluginSet(defaultPlugins.PreFilter, customPlugins.PreFilter)
	defaultPlugins.Filter = mergePluginSet(defaultPlugins.Filter, customPlugins.Filter)
	defaultPlugins.PostFilter = mergePluginSet(defaultPlugins.PostFilter, customPlugins.PostFilter)
	defaultPlugins.PreScore = mergePluginSet(defaultPlugins.PreScore, customPlugins.PreScore)
	defaultPlugins.Score = mergePluginSet(defaultPlugins.Score, customPlugins.Score)
	defaultPlugins.Reserve = mergePluginSet(defaultPlugins.Reserve, customPlugins.Reserve)
	defaultPlugins.Permit = mergePluginSet(defaultPlugins.Permit, customPlugins.Permit)
	defaultPlugins.PreBind = mergePluginSet(defaultPlugins.PreBind, customPlugins.PreBind)
	defaultPlugins.Bind = mergePluginSet(defaultPlugins.Bind, customPlugins.Bind)
	defaultPlugins.PostBind = mergePluginSet(defaultPlugins.PostBind, customPlugins.PostBind)
	return defaultPlugins
}

func mergePluginSet(defaultPluginSet, customPluginSet *v1beta1.PluginSet) *v1beta1.PluginSet {
	disabledPlugins := sets.NewString()
	if customPluginSet != nil {
		for _, disabledPlugin := range customPluginSet.Disabled {
			disabledPlugins.Insert(disabledPlugin.Name)
		}
	}

	var enabledPlugins []v1beta1.Plugin
	if defaultPluginSet != nil && !disabledPlugins.Has("*") {
		for _, defaultEnabledPlugin := range defaultPluginSet.Enabled {
			if disabledPlugins.Has(defaultEnabledPlugin.Name) {
				continue
			}

			enabledPlugins = append(enabledPlugins, defaultEnabledPlugin)
		}
	}

	if customPluginSet != nil {
		enabledPlugins = append(enabledPlugins, customPluginSet.Enabled...)
	}

	if len(enabledPlugins) == 0 {
		return nil
	}

	return &v1beta1.PluginSet{Enabled: enabledPlugins}
}


text:
package org.mifos.application.customer.exceptions;

import org.mifos.framework.exceptions.ApplicationException;

/**
 * This is general exception for the customer(group/client/center)
 */
public class CustomerException extends ApplicationException {

    public CustomerException(String key) {
        super(key);
    }

    public CustomerException(String key, Object[] values) {
        super(key, values);
    }

    public CustomerException(Throwable cause) {
        super(cause);
    }

    public CustomerException(String key, Throwable cause) {
        super(key, cause);
    }

}