text:
AliAnalysisH3MC *AddHighMultH3MCTask(TString name = "name", ULong64_t triggerMask = AliVEvent::kHighMultV0)
{
	// get the manager via the static access member. since it's static, you don't need
	// to create an instance of the class here to call the function
	AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
	if (!mgr)
	{
		return 0x0;
	}
	// get the input event handler, again via a static method.
	// this handler is part of the managing system and feeds events
	// to your task
	if (!mgr->GetInputEventHandler())
	{
		return 0x0;
	}
	// by default, a file is open for writing. here, we get the filename
	TString fileName = AliAnalysisManager::GetCommonFileName();
	fileName += ":AntiH3HM"; // create a subfolder in the file
	// now we create an instance of your task
	AliAnalysisH3MC *task = new AliAnalysisH3MC(name.Data());
	if (!task)
		return 0x0;
	//Add task settings here
	//task->SelectCollisionCandidates(AliVEvent::kHighMultV0);
	task->SetFilterBit(16);
	task->SetLowPCut(0.1);
	task->SetHighPCut(1e30);
	task->SetEtaCut(0.8);
	task->SetMinNITSCl(1);
	task->SetMaxDCAxyPreCut(1.5);
	task->SetMaxDCAxyFinal(1.5);
	task->SetMaxDCAz(1.5);
	//set PID cuts #### Legacy code not used in analysis anymore ###
	task->SetMaxTPCnSigma(3.0);
	task->SetUseTOFPidCut(kFALSE); //kTRUE or kFALSE for use of TOF
	task->SetMaxTOFnSigma(3.0);
	// momentum p from which a hit/cut in TOF is required
	task->SetMomForTOFanaProt(0.7);
	task->SetMomForTOFanaDeut(1.4);

	AliESDtrackCuts *trackCuts = new AliESDtrackCuts();
	trackCuts->SetPtRange(0.15, 1e30);
	trackCuts->SetEtaRange(-0.8, 0.8);
	//TPC
	trackCuts->SetRequireTPCRefit(kTRUE);
	trackCuts->SetMinNCrossedRowsTPC(110);
	trackCuts->SetMaxChi2PerClusterTPC(3.0);
	trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
	trackCuts->SetMaxFractionSharedTPCClusters(0.1);
	trackCuts->SetMaxChi2TPCConstrainedGlobal(25.);
	//ITS
	trackCuts->SetRequireITSRefit(kTRUE);
	trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
	trackCuts->SetMinNClustersITS(3); //This seems very high?

	//primary selection
	trackCuts->SetAcceptKinkDaughters(kFALSE);
	trackCuts->SetDCAToVertex2D(kFALSE);
	trackCuts->SetRequireSigmaToVertex(kFALSE);
	trackCuts->SetMaxDCAToVertexZ(10.0);
	trackCuts->SetMaxDCAToVertexXY(10.0);

	task->SetTrackCuts(trackCuts);

	AliMCEventHandler *mcHandler = new AliMCEventHandler();
	// Set reading track references
	mcHandler->SetReadTR(kTRUE); // kTRUE by default
	mgr->SetMCtruthEventHandler(mcHandler);

	// add your task to the manager
	mgr->AddTask(task);
	// your task needs input: here we connect the manager to your task
	mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
	// same for the output
	mgr->ConnectOutput(task, 1, mgr->CreateContainer("MyOutputContainerHighMult", TList::Class(), AliAnalysisManager::kOutputContainer, fileName.Data()));
	// in the end, this macro returns a pointer to your task. this will be convenient later on
	// when you will run your analysis in an analysis train on grid
	return task;
}


text:
@interface Shape : NSObject

@property(nonatomic, getter = isClosed) BOOL closed;

- (void)draw;
- (void)addPoint:(CGPoint)p;
- (BOOL)removePoint;

@end

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * wallee SDK
 *
 * This library allows to interact with the wallee payment service.
 *
 * 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.
 */

namespace Wallee\Sdk\Model;
use \Wallee\Sdk\ObjectSerializer;

/**
 * ManualTaskState model
 *
 * @category    Class
 * @description
 * @package     Wallee\Sdk
 * @author      customweb GmbH
 * @license     http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
 */
class ManualTaskState
{
    /**
     * Possible values of this enum
     */
    const OPEN = 'OPEN';
    const DONE = 'DONE';
    const EXPIRED = 'EXPIRED';

    /**
     * Gets allowable values of the enum
     * @return string[]
     */
    public static function getAllowableEnumValues()
    {
        return [
            self::OPEN,
            self::DONE,
            self::EXPIRED,
        ];
    }
}


text:
package org.springframework.beans.factory.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Autowired {
    boolean required() default true;
}


text:
<!--
Copyright (C) 2015 The Android Open Source Project
   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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="48dp"
    android:height="48dp"
    android:viewportWidth="48.0"
    android:viewportHeight="48.0">
    <path
        android:pathData="M0.0,48.0l24.0,-36.0l24.0,36.0z"
        android:fillColor="#4DB6AC"/>
    <path
        android:pathData="M24.0,12.0l-13.2,36.0l37.2,0.0z"
        android:fillColor="#00897B"/>
</vector>


text:
<?php

class TimeLogItemTable extends Doctrine_Table
{

    public static function getInstance()
    {
        return Doctrine_Core::getTable('TimeLogItem');
    }

    public function getLastTimeItems($user_id, $amount)
    {
        return Doctrine_Query::create()
                            ->from('TimeLogItem i')
                            ->where('i.user_id=?', array($user_id))
                            ->orderBy('itemdate DESC')
                            ->limit($amount)
                            ->execute();
    }

    public function updateMissedBookingsForWeek($week_number, $year, $user)
    {
        for($day=1; $day<=7; $day++) {
            $timestamp = strtotime($year."W".$week_number.$day);

            if ($timestamp <= time()) {
                $this->updateMissedBookings($timestamp, $user);
            }
        }
    }

    public function getFilterQuery($filter, $user_id = null, $account_id)
    {
        $query = Doctrine_Query::create()
                    ->from('TimeLogItem e')
                    ->innerJoin('e.User u')
                    ->orderBy('e.itemdate DESC');

        if (array_key_exists('user', $filter)) {
            if ($filter['user'] != -1) {
                $query->andWhere('e.user_id=?', array($filter['user']));
            }
        }
        else {
            if ($user_id != null) {
                $query->andWhere('e.user_id=?', array($user_id));
            }
        }

        if (array_key_exists('project', $filter)) {
            if ($filter['project'] != -1) {
                $query->andWhere('e.project_id=?', array($filter['project']));
            }
        }

        if (array_key_exists('dateFrom', $filter)) {
            $query->andWhere('e.itemdate>=?', array($filter['dateFrom']));
        }
        if (array_key_exists('dateTo', $filter)) {
            $query->andWhere('e.itemdate<=?', array($filter['dateTo']));
        }

        $query->andWhere('u.account_id = ?', $account_id);

        return $query;
    }

    public function prepareTotalReport($filter, Doctrine_Collection $projects, $user, $account_id)
    {
        $result = array();

        $query = Doctrine_Query::create()
                        ->select('p.*, u.*, ti.*, ty.*, SUM(ti.value) as sum')
                        ->from('Project p')
                        ->innerJoin('p.TimeLogItems ti')
                        ->innerJoin('ti.User u')
                        ->innerJoin('ti.TimeItemType ty');

        if (array_key_exists('dateFrom', $filter)) {
            $query->andWhere('ti.itemdate>=?', array($filter['dateFrom']));
        }
        if (array_key_exists('dateTo', $filter)) {
            $query->andWhere('ti.itemdate<=?', array($filter['dateTo']));
        }
        if (array_key_exists('project', $filter)) {
            if ($filter['project'] != -1) {
                $query->andWhere('p.id=?', array($filter['project']));
            }
        }

        if (array_key_exists('user', $filter)) {
            if ($filter['user'] != -1) {
                $query->andWhere('ti.user_id=?', array($filter['user']));
            }
            else if (($user != null) && ($filter['user'] != -1)) {
                $query->andWhere('ti.user_id=?', array($user->id));
            }
        }
        else {
            if ($user != null) {
                $query->andWhere('ti.user_id=?', array($user->id));
            }
        }

        $query->andWhere('p.deactivated = ? AND p.deleted_at IS NULL', array(false));
        $query->andWhere('p.account_id=?', array($account_id));

        $result = $query->orderBy('p.name ASC')
                                    ->groupBy('ti.type_id, ti.user_id, p.id')
                                    ->execute();

        $project_totals = array();
	    foreach ($result as $project) {
            $project_totals[$project->id]['project'] = $project;
            foreach ($project->TimeLogItems as $time_item) {
                $project_totals[$project->id]['items'][$time_item->user_id]['user'] = $time_item->User;
                $project_totals[$project->id]['items'][$time_item->user_id]['time'][$time_item->type_id] = $time_item;
            }
        }

        return $project_totals;
    }

    public function updateMissedBookings($day, $user)
    {
        $entry = Doctrine_Query::create()
                    ->from('MissingTimeItemEntry e')
                    ->where('e.day = ?', array(date('Y-m-d', $day)))
                    ->andWhere('e.user_id = ?', array($user->id))
                    ->fetchOne();

        $item_count = count($user->getTimeEntriesByDay($day));
        if ($item_count == 0) {
            if (!$entry) {
                $entry = new MissingTimeItemEntry();
                $entry->day = date('Y-m-d', $day);
                $entry->user_id = $user->id;
                $entry->save();
            }
            return false;
        }
        else {
            if ($entry) {
                Doctrine_Query::create()
                    ->delete()
                    ->from('MissingTimeItemEntry e')
                    ->where('e.day = ?', array(date('Y-m-d', $day)))
                    ->andWhere('e.user_id = ?', array($user->id))
                    ->execute();
            }
        }

        return true;
    }
}


text:
#ifndef SNMPTRAPD_HANDLERS_H
#define SNMPTRAPD_HANDLERS_H
char           *snmptrapd_get_traphandler(oid *, size_t);
void            snmptrapd_traphandle(const char *, char *);

#endif                          /* SNMPTRAPD_HANDLERS_H */


text:
from django.test import TestCase

from djangomaster.core import is_widget, is_view, autodiscover
from djangomaster.sites import MasterSite
from djangomaster.views import MasterView
from djangomaster.widgets import MasterWidget

class TestIsWidget(TestCase):
    master_class = MasterWidget
    method = lambda self, cls: is_widget(cls)

    def test_with_empty_class(self):
        class Nada(object):
            pass

        self.assertFalse(self.method(Nada))

    def test_with_correct_class(self):
        class Yeah(self.master_class):
            pass

        self.assertTrue(self.method(Yeah))

    def test_with_subclasses(self):
        class NopeWidget(self.master_class):
            pass

        class NopeNopeWidget(NopeWidget):
            pass

        class NopeNopeNopeWidget(NopeNopeWidget):
            pass

        self.assertTrue(self.method(NopeWidget))
        self.assertTrue(self.method(NopeNopeWidget))
        self.assertTrue(self.method(NopeNopeNopeWidget))

class TestIsPage(TestIsWidget):
    master_class = MasterView
    method = lambda self, cls: is_view(cls)

class TestAutodiscover(TestCase):

    def setUp(self):
        self.site = MasterSite()

    def test_simple(self):
        autodiscover(site=self.site)


text:
OUTPUT=day13b.jar
MAINCLASS=Day13b

kotlinc -verbose -include-runtime -d $OUTPUT src_kotlin/*.kt
if [ $? -ne 0 ] ; then
  echo "ERROR: $?"
  exit 1
fi

#kotlin -classpath $OUTPUT $MAINCLASS
#java -jar $OUTPUT
java -cp $OUTPUT $MAINCLASS


text:
enyo.kind({
  name: "Help",
  kind: "FittableRows",
  components: [
    {name: "headerToolbar", kind: "onyx.Toolbar", style: "text-align:center;", components: [
      {name: "title", classes: "title", content: $L("Help"), allowHtml: true},
      {kind: "Image", src: Helper.iconPath()+"icon48.png", classes: "prefsimage"},
      {name: "prefsButton", kind: "onyx.IconButton", src: Helper.iconPath()+"prefs.png", style: "float: right", ontap: "showMenu"},
      {name: "fontButton", kind: "onyx.IconButton", src: Helper.iconPath()+"font.png", style: "float: right", ontap: "showFontDialog"}
    ]},
    {name: "viewScroller", kind: "enyo.Scroller", classes: "michote-scroller", horizontal: "hidden", touch: true, fit: 1,
      components: [
      {name: "helpContent", kind: "FittableRows", classes:  Helper.phone() ? "lyric lyricmar-phone" : "lyric lyricmar", components: [
        {allowHtml: true, content: "
" + $L("Welcome to ") + Helper.app},
        {allowHtml: true, content: $L("Display, manage and edit your songs on your device.") + "
"
          + 'OpenLyrics XML Standard' + "
" +
          $L(" TODO") +  "

",},
        {allowHtml: true, content: "
" + $L("Icon Guide") + "
"},

        {allowHtml: true, content: "
" + $L("Main View") + "
"},
        {tag: 'ul', classes: "help", components: [
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"flag-help.png", fit: false},
            {tag: 'p', content: $L("toggles language if present")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"minus-help.png"},
            {kind: "Image", src: Helper.iconPath()+"plus-help.png"},
            {tag: 'p', content: $L("Transposer")}
          ]},
          //~ {tag: 'il', components: [
            //~ {kind: "Image", src: Helper.iconPath()+"lock-open-help.png"},
            //~ {tag: 'p', content: $L("prevents the screen from dimming or turning off")}
          //~ ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"font-help.png", fit: false},
            {tag: 'p', content: $L("change fontsize and linespacing")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"back-help.png"},
            {tag: 'p', content: $L("scrolls lyrics back depending on verseorder")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"forth-help.png"},
            {tag: 'p', content: $L("scrolls lyrics forth depending on verseorder")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"play-help.png"},
            {tag: 'p', content: $L("start autoscroll")}
          ]},
          //~ {tag: 'il', components: [
            //~ {kind: "Image", src: Helper.iconPath()+"edit-help.png"},
            //~ {tag: 'p', content: $L("edit current song")}
          //~ ]},
          //~ {tag: 'il', components: [
            //~ {kind: "Image", src: Helper.iconPath()+"print-help.png"},
            //~ {tag: 'p', content: $L("print current song as displayed")}
          //~ ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"info-help.png"},
            {tag: 'p', content: $L("shows songinfo")}
          ]},
        ]},

        {allowHtml: true, content: "
" + $L("List Pane") + "
"},
        {tag: 'ul', classes: "help", components: [
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"search-help.png"},
            {tag: 'p', content: $L("opens and closes searchwindow")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"open-help.png"},
            {tag: 'p', content: $L("opens listpicker")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"library-help.png"},
            {tag: 'p', content: $L("toogles library")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"list-help.png"},
            {tag: 'p', content: $L("toogles custom list")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"add-help.png"},
            {tag: 'p', content: $L("adds song to active list or creates a new custom list")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"remove-help.png"},
            {tag: 'p', content: $L("removes song from list or removes the custom list")}
          ]},
        ]},

        {allowHtml: true, content: "
" + $L("Search") + "
"},
        {tag: 'ul', classes: "help", components: [
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"title-help.png"},
            {tag: 'p', content: $L("searches in titles")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"author-help.png"},
            {tag: 'p', content: $L("searches in authors")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"lyrics-help.png"},
            {tag: 'p', content: $L("searches in lyrics")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"key-help.png"},
            {tag: 'p', content: $L("searches in comments and themes")}
          ]},
        ]},
        {allowHtml: true, content: "
" + $L("Editing") + "
"},
        {tag: 'p', content: $L("Note: Everything you edit will only be stored temporarily until you hit 'done' and actually write the changes to XML or 'discard' to discard all changes you made.")},
        {tag: 'ul', classes: "help", components: [
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"title-help.png"},
            {tag: 'p', content: $L("opens metadata editing page")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"lyrics-help.png"},
            {tag: 'p', content: $L("opens lyrics editing page")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"add-help.png"},
            {tag: 'p', content: $L("adds a new metadata or lyric element")}
          ]},
          {tag: 'il', components: [
            {kind: "Image", src: Helper.iconPath()+"edit-help.png"},
            {tag: 'p', content: $L("edits a lyric element (rename, language, parts and delete)")}
          ]},
        ]},

        {allowHtml: true, content: "
" + $L("Gesture Guide") + "
"},
        {allowHtml: true, content: "
" + $L("Main View") + "
"},
        {allowHtml: true, content:
          '
 \

' + $L("Swipe to the right to open next song in list") + '
 \

' + $L("Swipe to the left to open previous song in list") + '
 \

' + $L("Doubletab maximizes mainview") + '
 \

' + $L("Swipe the sidepane to the right to close it") + '
 \

' + $L("Swipe an librarylist item to add it to the current custom list") + '
 \

' + $L("Swipe an custom list item to remove it from this list") + '
 \

' + $L("Swipe a list to remove it") + '
 \

'},
        {tag: 'br'},

        //~ {allowHtml: true, content: "
" + $L("List Pane") + "
"},
        //~ {allowHtml: true, content:
          //~ '
 \
            //~
' + $L("Swipe an librarylist item to add it to the current custom list") + '
 \
            //~
' + $L("Swipe an custom list item to remove it from this list") + '
 \
            //~
' + $L("Swipe a list to remove it") + '
 \
          //~
'},
        //~ {allowHtml: true, content: "
"},
        {allowHtml: true, content: '
'
          + 'Online Documentation
'},
        {allowHtml: true, content: "
"},
        {allowHtml: true, content: "
" + $L("Contact") + "
"},
        {tag: 'ul', allowHtml: true, content:
          '
Micha Reischuck
 \

@michote_
 \

\
          webOS Nation forum thread
'},
        {allowHtml: true, content: "
"},
        {allowHtml: true, content: "
" + $L("Open Source") + "
"},
        {allowHtml: true, content: Helper.app +
          ' is available under the terms of the \
          MIT license.
 The source can be found on \
          github.'},
        {allowHtml: true, content: "
"},
        {allowHtml: true, content: "
" + $L("Changelog") + "
"},
        {allowHtml: true, content: "Version 0.5"},
        {tag: 'ul', allowHtml: true, content:
            '
Rewrite in Enyo2
'
          },
        {allowHtml: true, content: "
"},
        //~ {allowHtml: true, content: "
" + $L("Special Thanks") + "
"},
        //~ {allowHtml: true, content:
          //~ '
 \
            //~
johncc @webosnation for the Autoscroll feature
 \
            //~
ajguns @webosnation for the spanish translation
 \
            //~
@svzi for giving me an understanding of enyo ;)
 \
            //~
phoque @developer.palm.com for sharing his "Simple FileIO Service"
 \
          //~
', onLinkClick: "linkClicked"},
        //~ {allowHtml: true, content: "
"}
      ]}
    ]},
    {name: "footerToolbar", kind: "onyx.Toolbar", components: [
      {kind: "my.Grabber", ontap:"grabber"},
    ]}
  ],

  grabber: function() {
    this.owner.owner.$.mainPanels.setIndex(this.owner.owner.$.mainPanels.index ? 0 : 1);
  },

  showFontDialog: function() {
    this.owner.owner.$.infoPanels.setIndex(2);
    this.owner.owner.$.sidePane.showFont();
  },

  showMenu: function() {
    this.owner.owner.$.infoPanels.setIndex(1);
    this.owner.owner.$.sidePane.showMenu();
  }
});


text:
import urllib
import os

from subprocess import Popen

directory = 'C:\\Temp\\cygwindownload'
if not os.path.isdir(directory):
   os.makedirs(directory)
urllib.urlretrieve("https://cygwin.com/setup-x86.exe", directory + '\\setup.exe')

p = Popen("cygwin-install.bat")
stdout, stderr = p.communicate()


text:
package com.sixthsolution.lpisyncadapter.resource;

import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.database.Cursor;
import android.os.Build;
import android.os.RemoteException;
import android.provider.CalendarContract;
import android.support.annotation.NonNull;

import com.sixthsolution.lpisyncadapter.App;

import at.bitfire.ical4android.AndroidCalendar;
import at.bitfire.ical4android.AndroidEvent;
import at.bitfire.ical4android.AndroidEventFactory;
import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.Event;
import lombok.Cleanup;

/**
 * @author mehdok (mehdok@gmail.com) on 4/8/2017.
 */

public class LocalEvent extends AndroidEvent implements LocalResource {
    static final String COLUMN_ETAG = CalendarContract.Events.SYNC_DATA1,
            COLUMN_UID = Build.VERSION.SDK_INT >= 17 ? CalendarContract.Events.UID_2445 :
                    CalendarContract.Events.SYNC_DATA2,
            COLUMN_SEQUENCE = CalendarContract.Events.SYNC_DATA3;

    protected String fileName;
    protected String eTag;

    public boolean weAreOrganizer = true;

    public LocalEvent(@NonNull AndroidCalendar calendar, Event event, String fileName, String eTag) {
        super(calendar, event);
        this.fileName = fileName;
        this.eTag = eTag;
    }

    protected LocalEvent(@NonNull AndroidCalendar calendar, long id, ContentValues baseInfo) {
        super(calendar, id, baseInfo);
        if (baseInfo != null) {
            fileName = baseInfo.getAsString(CalendarContract.Events._SYNC_ID);
            eTag = baseInfo.getAsString(COLUMN_ETAG);
        }
    }

    @Override
    protected void populateEvent(ContentValues values) {
        super.populateEvent(values);
        fileName = values.getAsString(CalendarContract.Events._SYNC_ID);
        eTag = values.getAsString(COLUMN_ETAG);
        event.uid = values.getAsString(COLUMN_UID);

        event.sequence = values.getAsInteger(COLUMN_SEQUENCE);
        if (Build.VERSION.SDK_INT >= 17) {
            weAreOrganizer = values.getAsInteger(CalendarContract.Events.IS_ORGANIZER) != 0;
        } else {
            String organizer = values.getAsString(CalendarContract.Events.ORGANIZER);
            weAreOrganizer = organizer == null || organizer.equals(calendar.account.name);
        }
    }

    @Override
    protected void buildEvent(Event recurrence, ContentProviderOperation.Builder builder) {
        super.buildEvent(recurrence, builder);

        boolean buildException = recurrence != null;
        Event eventToBuild = buildException ? recurrence : event;

        builder.withValue(COLUMN_UID, event.uid)
                .withValue(COLUMN_SEQUENCE, eventToBuild.sequence)
                .withValue(CalendarContract.Events.DIRTY, 0)
                .withValue(CalendarContract.Events.DELETED, 0);

        if (buildException) {
            builder.withValue(CalendarContract.Events.ORIGINAL_SYNC_ID, fileName);
        } else {
            builder.withValue(CalendarContract.Events._SYNC_ID, fileName)
                    .withValue(COLUMN_ETAG, eTag);
        }
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public String getFileName() {
        return fileName;
    }

    @Override
    public String getETag() {
        return eTag;
    }

    public void setETag(String eTag) {
        this.eTag = eTag;
    }

    @Override
    public int delete() throws CalendarStorageException {
        return super.delete();
    }

    public void prepareForUpload() throws CalendarStorageException {
        try {
            String uid = null;
            @Cleanup Cursor
                    c = calendar.provider.query(eventSyncURI(), new String[] {COLUMN_UID}, null, null, null);
            if (c.moveToNext()) {
                uid = c.getString(0);
            }
            if (uid == null) {
                uid = App.uidGenerator.generateUid().getValue();
            }

            final String newFileName = uid + ".ics";

            ContentValues values = new ContentValues(2);
            values.put(CalendarContract.Events._SYNC_ID, newFileName);
            values.put(COLUMN_UID, uid);
            calendar.provider.update(eventSyncURI(), values, null, null);

            fileName = newFileName;
            if (event != null) {
                event.uid = uid;
            }

        } catch (RemoteException e) {
            throw new CalendarStorageException("Couldn't update UID", e);
        }
    }

    @Override
    public void clearDirty(String eTag) throws CalendarStorageException {
        try {
            ContentValues values = new ContentValues(2);
            values.put(CalendarContract.Events.DIRTY, 0);
            values.put(COLUMN_ETAG, eTag);
            if (event != null) {
                values.put(COLUMN_SEQUENCE, event.sequence);
            }
            calendar.provider.update(eventSyncURI(), values, null, null);

            this.eTag = eTag;
        } catch (RemoteException e) {
            throw new CalendarStorageException("Couldn't update UID", e);
        }
    }

    static class Factory implements AndroidEventFactory {
        static final Factory INSTANCE = new Factory();

        @Override
        public AndroidEvent newInstance(AndroidCalendar calendar, long id, ContentValues baseInfo) {
            return new LocalEvent(calendar, id, baseInfo);
        }

        @Override
        public AndroidEvent newInstance(AndroidCalendar calendar, Event event) {
            return new LocalEvent(calendar, event, null, null);
        }

        @Override
        public AndroidEvent[] newArray(int size) {
            return new LocalEvent[size];
        }
    }
}


text:
package org.elasticsearch.xpack.rollup.v2;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
import org.elasticsearch.action.admin.indices.shrink.ResizeType;
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAction;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.OriginSettingClient;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexAbstraction;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.metadata.MetadataCreateIndexService;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.DateFieldMapper;
import org.elasticsearch.index.mapper.NumberFieldMapper;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.aggregatemetric.mapper.AggregateDoubleMetricFieldMapper;
import org.elasticsearch.xpack.core.ClientHelper;
import org.elasticsearch.xpack.core.rollup.RollupActionConfig;
import org.elasticsearch.xpack.core.rollup.RollupActionDateHistogramGroupConfig;
import org.elasticsearch.xpack.core.rollup.RollupActionGroupConfig;
import org.elasticsearch.xpack.core.rollup.action.RollupAction;
import org.elasticsearch.xpack.core.rollup.action.RollupActionRequestValidationException;
import org.elasticsearch.xpack.core.rollup.action.RollupIndexerAction;
import org.elasticsearch.xpack.core.rollup.job.HistogramGroupConfig;
import org.elasticsearch.xpack.core.rollup.job.MetricConfig;

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

/**
 * The master rollup action that coordinates
 *  -  creating rollup temporary index
 *  -  calling {@link TransportRollupIndexerAction} to index rollup-ed documents
 *  -  cleaning up state
 */
public class TransportRollupAction extends AcknowledgedTransportMasterNodeAction<RollupAction.Request> {

    private final Client client;
    private final ClusterService clusterService;
    private final MetadataCreateIndexService metadataCreateIndexService;

    @Inject
    public TransportRollupAction(Client client,
                                 ClusterService clusterService,
                                 TransportService transportService,
                                 ThreadPool threadPool,
                                 MetadataCreateIndexService metadataCreateIndexService,
                                 ActionFilters actionFilters,
                                 IndexNameExpressionResolver indexNameExpressionResolver) {
        super(RollupAction.NAME, transportService, clusterService, threadPool, actionFilters, RollupAction.Request::new,
            indexNameExpressionResolver, ThreadPool.Names.SAME);
        this.client = new OriginSettingClient(client, ClientHelper.ROLLUP_ORIGIN);
        this.clusterService = clusterService;
        this.metadataCreateIndexService = metadataCreateIndexService;
    }

    @Override
    protected void masterOperation(Task task, RollupAction.Request request, ClusterState state,
                                   ActionListener<AcknowledgedResponse> listener) throws IOException {
        String originalIndexName = request.getSourceIndex();

        final String rollupIndexName;
        if (request.getRollupIndex() == null) {
            rollupIndexName = "rollup-" + originalIndexName + "-" + UUIDs.randomBase64UUID(Randomness.get());
        } else {
            rollupIndexName = request.getRollupIndex();
        }

        String tmpIndexName = ".rolluptmp-" + rollupIndexName;

        final XContentBuilder mapping;
        try {
            mapping = getMapping(request.getRollupConfig());
        } catch (IOException e) {
            listener.onFailure(e);
            return;
        }

        FieldCapabilitiesRequest fieldCapsRequest = new FieldCapabilitiesRequest()
            .indices(originalIndexName)
            .fields(request.getRollupConfig().getAllFields().toArray(new String[0]));
        fieldCapsRequest.setParentTask(clusterService.localNode().getId(), task.getId());
        // Add the source index name and UUID to the rollup index metadata. If the original index is a rollup index itself,
        // we will add the name and UUID of the raw index that we initially rolled up.
        IndexMetadata originalIndexMetadata = state.getMetadata().index(originalIndexName);
        String sourceIndexName = IndexMetadata.INDEX_ROLLUP_SOURCE_NAME.exists(originalIndexMetadata.getSettings()) ?
            IndexMetadata.INDEX_ROLLUP_SOURCE_NAME.get(originalIndexMetadata.getSettings()) : originalIndexName;
        String sourceIndexUuid = IndexMetadata.INDEX_ROLLUP_SOURCE_UUID.exists(originalIndexMetadata.getSettings()) ?
            IndexMetadata.INDEX_ROLLUP_SOURCE_UUID.get(originalIndexMetadata.getSettings()) : originalIndexMetadata.getIndexUUID();

        CreateIndexClusterStateUpdateRequest createIndexClusterStateUpdateRequest =
            new CreateIndexClusterStateUpdateRequest("rollup", tmpIndexName, tmpIndexName)
                .settings(Settings.builder().put(IndexMetadata.SETTING_INDEX_HIDDEN, true).build())
                .mappings(XContentHelper.convertToJson(BytesReference.bytes(mapping), false, XContentType.JSON));

        RollupIndexerAction.Request rollupIndexerRequest = new RollupIndexerAction.Request(request);
        ResizeRequest resizeRequest = new ResizeRequest(request.getRollupIndex(), tmpIndexName);
        resizeRequest.setResizeType(ResizeType.CLONE);
        resizeRequest.getTargetIndexRequest()
            .settings(Settings.builder().put(IndexMetadata.SETTING_INDEX_HIDDEN, false).build());
        UpdateSettingsRequest updateSettingsReq = new UpdateSettingsRequest(
            Settings.builder().put(IndexMetadata.SETTING_BLOCKS_WRITE, true).build(), tmpIndexName);

        // 1. validate Rollup Config against Field Caps
        // 2. create hidden temporary index
        // 3. run rollup indexer
        // 4. make temp index read-only
        // 5. shrink index
        // 6. publish rollup metadata and add rollup index to datastream
        // 7. delete temporary index
        // at any point if there is an issue, then cleanup temp index

        // 1.
        client.fieldCaps(fieldCapsRequest, ActionListener.wrap(fieldCapsResponse -> {
            RollupActionRequestValidationException validationException = new RollupActionRequestValidationException();
            if (fieldCapsResponse.get().size() == 0) {
                validationException.addValidationError("Could not find any fields in the index ["
                    + originalIndexName + "] that were configured in job");
                listener.onFailure(validationException);
                return;
            }
            request.getRollupConfig().validateMappings(fieldCapsResponse.get(), validationException);
            if (validationException.validationErrors().size() > 0) {
                listener.onFailure(validationException);
                return;
            }

            // 2.
            clusterService.submitStateUpdateTask("rollup create index", new ClusterStateUpdateTask() {
                @Override
                public ClusterState execute(ClusterState currentState) throws Exception {
                    return metadataCreateIndexService
                        .applyCreateIndexRequest(currentState, createIndexClusterStateUpdateRequest, true,
                            (builder, indexMetadata) -> builder.put(IndexMetadata.builder(indexMetadata).settings(Settings.builder()
                                .put(indexMetadata.getSettings())
                                .put(IndexMetadata.INDEX_ROLLUP_SOURCE_NAME.getKey(), sourceIndexName)
                                .put(IndexMetadata.INDEX_ROLLUP_SOURCE_UUID.getKey(), sourceIndexUuid)
                            )));
                }

                public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
                    // index created
                    // 3.
                    client.execute(RollupIndexerAction.INSTANCE, rollupIndexerRequest, ActionListener.wrap(indexerResp -> {
                        if (indexerResp.isCreated()) {
                            // 4.
                            client.admin().indices().updateSettings(updateSettingsReq, ActionListener.wrap(updateSettingsResponse -> {
                                if (updateSettingsResponse.isAcknowledged()) {
                                    // 5.
                                    client.admin().indices().resizeIndex(resizeRequest, ActionListener.wrap(resizeResponse -> {
                                        if (resizeResponse.isAcknowledged()) {
                                            // 6.
                                            publishMetadata(originalIndexName, tmpIndexName, rollupIndexName, listener);
                                        } else {
                                            deleteTmpIndex(originalIndexName, tmpIndexName, listener,
                                                new ElasticsearchException("Unable to resize temp rollup index [" + tmpIndexName + "]"));
                                        }
                                    }, e -> deleteTmpIndex(originalIndexName, tmpIndexName, listener, e)));
                                } else {
                                    deleteTmpIndex(originalIndexName, tmpIndexName, listener,
                                        new ElasticsearchException("Unable to update settings of temp rollup index [" +tmpIndexName+ "]"));
                                }
                            }, e -> deleteTmpIndex(originalIndexName, tmpIndexName, listener, e)));
                        } else {
                            deleteTmpIndex(originalIndexName, tmpIndexName, listener,
                                new ElasticsearchException("Unable to index into temp rollup index [" + tmpIndexName + "]"));
                        }
                    }, e -> deleteTmpIndex(originalIndexName, tmpIndexName, listener, e)));
                }

                @Override
                public void onFailure(String source, Exception e) {
                    listener.onFailure(e);
                }
            });
        }, listener::onFailure));
    }

    @Override
    protected ClusterBlockException checkBlock(RollupAction.Request request, ClusterState state) {
        return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
    }

    private XContentBuilder getMapping(RollupActionConfig config) throws IOException {
        XContentBuilder builder = XContentFactory.jsonBuilder().startObject();
        builder = getDynamicTemplates(builder);
        builder = getProperties(builder, config);
        return builder.endObject();
    }

    /**
     * Configure the dynamic templates to always map strings to the keyword field type.
     */
    private static XContentBuilder getDynamicTemplates(XContentBuilder builder) throws IOException {
        return builder.startArray("dynamic_templates")
                .startObject()
                    .startObject("strings")
                        .field("match_mapping_type", "string")
                        .startObject("mapping")
                            .field("type", "keyword")
                        .endObject()
                    .endObject()
                .endObject()
            .endArray();
    }

    /**
     * Creates the rollup mapping properties from the provided {@link RollupActionConfig}.
     */
    private static XContentBuilder getProperties(XContentBuilder builder, RollupActionConfig config) throws IOException {
        builder.startObject("properties");

        RollupActionGroupConfig groupConfig = config.getGroupConfig();
        RollupActionDateHistogramGroupConfig dateHistogramConfig = groupConfig.getDateHistogram();
        String dateField = dateHistogramConfig.getField();
        String dateIntervalType = dateHistogramConfig.getIntervalTypeName();
        String dateInterval = dateHistogramConfig.getInterval().toString();
        String tz = dateHistogramConfig.getTimeZone() != null ? dateHistogramConfig.getTimeZone() :
            RollupActionDateHistogramGroupConfig.DEFAULT_TIMEZONE;

        builder.startObject(dateField).field("type", DateFieldMapper.CONTENT_TYPE)
                .startObject("meta")
                    .field(dateIntervalType, dateInterval)
                    .field(RollupActionDateHistogramGroupConfig.CalendarInterval.TIME_ZONE, tz)
                .endObject()
            .endObject();

        HistogramGroupConfig histogramGroupConfig = groupConfig.getHistogram();
        if (histogramGroupConfig != null) {
            for (String field : histogramGroupConfig.getFields()) {
                builder.startObject(field).field("type", NumberFieldMapper.NumberType.DOUBLE.typeName())
                    .startObject("meta")
                        .field(HistogramGroupConfig.INTERVAL, String.valueOf(histogramGroupConfig.getInterval()))
                    .endObject()
                .endObject();
            }
        }

        List<MetricConfig> metricConfigs = config.getMetricsConfig();
        for (MetricConfig metricConfig : metricConfigs) {
            List<String> metrics = FieldMetricsProducer.normalizeMetrics(metricConfig.getMetrics());
            String defaultMetric = metrics.contains("value_count") ? "value_count" : metrics.get(0);
            builder.startObject(metricConfig.getField())
                .field("type", AggregateDoubleMetricFieldMapper.CONTENT_TYPE)
                .array(AggregateDoubleMetricFieldMapper.Names.METRICS, metrics.toArray())
                .field(AggregateDoubleMetricFieldMapper.Names.DEFAULT_METRIC, defaultMetric)
                .endObject();
        }

        return builder.endObject();
    }

    private void publishMetadata(String originalIndexName, String tmpIndexName, String rollupIndexName,
                                 ActionListener<AcknowledgedResponse> listener) {
        // Update rollup metadata to include this index
        clusterService.submitStateUpdateTask("update-rollup-metadata", new ClusterStateUpdateTask() {
            @Override
            public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
                // Everything went well, time to delete the temporary index
                deleteTmpIndex(originalIndexName, tmpIndexName, listener, null);
            }

            @Override
            public ClusterState execute(ClusterState currentState) {
                IndexMetadata rollupIndexMetadata = currentState.getMetadata().index(rollupIndexName);
                Index rollupIndex = rollupIndexMetadata.getIndex();
                IndexAbstraction originalIndex = currentState.getMetadata().getIndicesLookup().get(originalIndexName);

                Metadata.Builder metadataBuilder = Metadata.builder(currentState.metadata());
                if (originalIndex.getParentDataStream() != null) {
                    // If rolling up a backing index of a data stream, add rolled up index to backing data stream
                    DataStream originalDataStream = originalIndex.getParentDataStream().getDataStream();
                    List<Index> backingIndices = new ArrayList<>(originalDataStream.getIndices().size() + 1);
                    // Adding rollup indices to the beginning of the list will prevent rollup indices from ever being
                    // considered a write index
                    backingIndices.add(rollupIndex);
                    backingIndices.addAll(originalDataStream.getIndices());
                    DataStream dataStream = new DataStream(originalDataStream.getName(), originalDataStream.getTimeStampField(),
                        backingIndices, originalDataStream.getGeneration(), originalDataStream.getMetadata());
                    metadataBuilder.put(dataStream);
                }
                return ClusterState.builder(currentState).metadata(metadataBuilder.build()).build();
            }

            @Override
            public void onFailure(String source, Exception e) {
                deleteTmpIndex(originalIndexName, tmpIndexName,
                    listener, new ElasticsearchException("failed to publish new cluster state with rollup metadata", e));
            }
        });
    }

    private void deleteTmpIndex(String originalIndex, String tmpIndex, ActionListener<AcknowledgedResponse> listener, Exception e) {
        client.admin().indices().delete(new DeleteIndexRequest(tmpIndex), new ActionListener<>() {
            @Override
            public void onResponse(AcknowledgedResponse acknowledgedResponse) {
                if (e == null && acknowledgedResponse.isAcknowledged()) {
                    listener.onResponse(acknowledgedResponse);
                } else {
                    listener.onFailure(new ElasticsearchException("Unable to rollup index [" + originalIndex + "]", e));
                }
            }

            @Override
            public void onFailure(Exception deleteException) {
                listener.onFailure(new ElasticsearchException("Unable to delete temp rollup index [" + tmpIndex + "]", e));
            }
        });
    }
}


text:
<?php

/**
 * This file is part of the Spryker Demoshop.
 * For full license information, please view the LICENSE file that was distributed with this source code.
 */

namespace Pyz\Yves\Price\Plugin;

use Pyz\Yves\Application\Plugin\Provider\AbstractYvesControllerProvider;
use Silex\Application;

class PriceControllerProvider extends AbstractYvesControllerProvider
{
    public const ROUTE_PRICE_SWITCH = 'price-mode-switch';

    /**
     * @param \Silex\Application $app
     *
     * @return void
     */
    protected function defineControllers(Application $app)
    {
        $allowedLocalesPattern = $this->getAllowedLocalesPattern();

        $this->createController(
            '/{price}/mode-switch',
            static::ROUTE_PRICE_SWITCH,
            'Price',
            'PriceModeSwitch',
            'index'
        )->assert('price', $allowedLocalesPattern . 'price|price')
            ->value('price', 'price');
    }
}


text:
<?php declare(strict_types=1);

namespace PHPUnit\TestFixture\MockObject;

interface InterfaceWithMethodReturningIntersection
{
    public function method(): AnInterface&AnotherInterface;
}


text:
package com.googlecode.luceneappengine;

import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.store.BufferedChecksumIndexInput;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexOutput;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.fail;

public class SegmentIndexOutputTest extends LocalDatastoreTest {

    @Test
    public void testGetChecksum_NoFlush() throws IOException {
        final String input1 = "Hello World!";
        final String input2 = "Hello World second string!";
        final String segmentName = "segments.gen";//main segment name

        try (Directory directory = new GaeDirectory()) {
            try (IndexOutput createOutput = directory.createOutput(segmentName, null)) {
                createOutput.writeBytes(input1.getBytes(), 0, input1.getBytes().length);
                CodecUtil.writeFooter(createOutput);
            }

            try (IndexOutput createOutput = directory.createOutput(segmentName, null)) {
                createOutput.writeBytes(input2.getBytes(), 0, input2.getBytes().length);
                createOutput.writeBytes(input2.getBytes(), 0, input2.getBytes().length);
                CodecUtil.writeFooter(createOutput);
            }

            try (BufferedChecksumIndexInput bcii = new BufferedChecksumIndexInput(directory.openInput(segmentName, null))) {
                bcii.readBytes(new byte[input2.getBytes().length], 0, input2.getBytes().length);
                bcii.readBytes(new byte[input2.getBytes().length], 0, input2.getBytes().length);
                try {
                    CodecUtil.checkFooter(bcii);
                } catch (CorruptIndexException e) {
                    fail(e.getMessage());
                }
            }
        }
    }

    @Test
    @SuppressWarnings("deprecation")
    public void testGetChecksum_Flush() throws IOException {
        final String input1 = "Hello World!";
        final String input2 = "Hello World second string!";
        final String segmentName = "segments.gen";//main segment name

        try (Directory directory = new GaeDirectory()) {
            try (IndexOutput createOutput = directory.createOutput(segmentName, null)) {
                createOutput.writeBytes(input1.getBytes(), 0, input1.getBytes().length);
//                createOutput.flush();
                CodecUtil.writeFooter(createOutput);
//                createOutput.flush();
            }

            try (IndexOutput createOutput = directory.createOutput(segmentName, null)) {
                createOutput.writeBytes(input2.getBytes(), 0, input2.getBytes().length);
//                createOutput.flush();
                createOutput.writeBytes(input2.getBytes(), 0, input2.getBytes().length);
//                createOutput.flush();
                CodecUtil.writeFooter(createOutput);
//                createOutput.flush();
            }

            try (BufferedChecksumIndexInput bcii = new BufferedChecksumIndexInput(directory.openInput(segmentName, null))) {
                bcii.readBytes(new byte[input2.getBytes().length], 0, input2.getBytes().length);
                bcii.readBytes(new byte[input2.getBytes().length], 0, input2.getBytes().length);
                try {
                    CodecUtil.checkFooter(bcii);
                } catch (CorruptIndexException e) {
                    fail(e.getMessage());
                }
            }
        }
    }

}


text:
package com.yourcompany.channels;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.Date;

import android.os.Bundle;
import androidx.annotation.NonNull;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.*;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
  @Override
  public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
    super.configureFlutterEngine(flutterEngine);

    DartExecutor dartExecutor = flutterEngine.getDartExecutor();
    setupMessageHandshake(new BasicMessageChannel<>(dartExecutor, "binary-msg", BinaryCodec.INSTANCE));
    setupMessageHandshake(new BasicMessageChannel<>(dartExecutor, "string-msg", StringCodec.INSTANCE));
    setupMessageHandshake(new BasicMessageChannel<>(dartExecutor, "json-msg", JSONMessageCodec.INSTANCE));
    setupMessageHandshake(new BasicMessageChannel<>(dartExecutor, "std-msg", ExtendedStandardMessageCodec.INSTANCE));
    setupMethodHandshake(new MethodChannel(dartExecutor, "json-method", JSONMethodCodec.INSTANCE));
    setupMethodHandshake(new MethodChannel(dartExecutor, "std-method", new StandardMethodCodec(ExtendedStandardMessageCodec.INSTANCE)));
  }

  private <T> void setupMessageHandshake(final BasicMessageChannel<T> channel) {
    // On message receipt, do a send/reply/send round-trip in the other direction,
    // then reply to the first message.
    channel.setMessageHandler(new BasicMessageChannel.MessageHandler<T>() {
      @Override
      public void onMessage(final T message, final BasicMessageChannel.Reply<T> reply) {
        final T messageEcho = echo(message);
        channel.send(messageEcho, new BasicMessageChannel.Reply<T>() {
          @Override
          public void reply(T replyMessage) {
            channel.send(echo(replyMessage));
            reply.reply(messageEcho);
          }
        });
      }
    });
  }

  // Outgoing ByteBuffer messages must be direct-allocated and payload placed between
  // position 0 and current position.
  @SuppressWarnings("unchecked")
  private <T> T echo(T message) {
    if (message instanceof ByteBuffer) {
      final ByteBuffer buffer = (ByteBuffer) message;
      final ByteBuffer echo = ByteBuffer.allocateDirect(buffer.remaining());
      echo.put(buffer);
      return (T) echo;
    }
    return message;
  }

  private void setupMethodHandshake(final MethodChannel channel) {
    channel.setMethodCallHandler(new MethodChannel.MethodCallHandler() {
      @Override
      public void onMethodCall(final MethodCall methodCall, final MethodChannel.Result result) {
        switch (methodCall.method) {
          case "success":
            doSuccessHandshake(channel, methodCall, result);
            break;
          case "error":
            doErrorHandshake(channel, methodCall, result);
            break;
          default:
            doNotImplementedHandshake(channel, methodCall, result);
            break;
        }
      }
    });
  }

  private void doSuccessHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) {
    channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() {
      @Override
      public void success(Object o) {
        channel.invokeMethod(methodCall.method, o);
        result.success(methodCall.arguments);
      }

      @Override
      public void error(String code, String message, Object details) {
        throw new AssertionError("Should not be called");
      }

      @Override
      public void notImplemented() {
        throw new AssertionError("Should not be called");
      }
    });
  }

  private void doErrorHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) {
    channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() {
      @Override
      public void success(Object o) {
        throw new AssertionError("Should not be called");
      }

      @Override
      public void error(String code, String message, Object details) {
        channel.invokeMethod(methodCall.method, details);
        result.error(code, message, methodCall.arguments);
      }

      @Override
      public void notImplemented() {
        throw new AssertionError("Should not be called");
      }
    });
  }

  private void doNotImplementedHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) {
    channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() {
      @Override
      public void success(Object o) {
        throw new AssertionError("Should not be called");
      }

      @Override
      public void error(String code, String message, Object details) {
        throw new AssertionError("Should not be called");
      }

      @Override
      public void notImplemented() {
        channel.invokeMethod(methodCall.method, null);
        result.notImplemented();
      }
    });
  }
}

final class ExtendedStandardMessageCodec extends StandardMessageCodec {
  public static final ExtendedStandardMessageCodec INSTANCE = new ExtendedStandardMessageCodec();
  private static final byte DATE = (byte) 128;
  private static final byte PAIR = (byte) 129;

  @Override
  protected void writeValue(ByteArrayOutputStream stream, Object value) {
    if (value instanceof Date) {
      stream.write(DATE);
      writeLong(stream, ((Date) value).getTime());
    } else if (value instanceof Pair) {
      stream.write(PAIR);
      writeValue(stream, ((Pair) value).left);
      writeValue(stream, ((Pair) value).right);
    } else {
      super.writeValue(stream, value);
    }
  }

  @Override
  protected Object readValueOfType(byte type, ByteBuffer buffer) {
    switch (type) {
      case DATE:
        return new Date(buffer.getLong());
      case PAIR:
        return new Pair(readValue(buffer), readValue(buffer));
      default: return super.readValueOfType(type, buffer);
    }
  }
}

final class Pair {
  public final Object left;
  public final Object right;

  public Pair(Object left, Object right) {
    this.left = left;
    this.right = right;
  }

  @Override
  public String toString() {
    return "Pair[" + left + ", " + right + "]";
  }
}


text:
<?php

namespace NetSuite\Classes;

class CustomerPaymentPaymentOperation {
    static $paramtypesmap = array(
    );
    const _authorization = "_authorization";
    const _capture = "_capture";
    const _sale = "_sale";
    const _refund = "_refund";
    const _credit = "_credit";
    const _refresh = "_refresh";
    const _void = "_void";
}


text:
'''
// Copyright 2009 Google Inc.
//
// 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.
//
// Original Author: James Powell
//
// Notification of Change: The original java source code has been
// modified in that it has been rewritten in the python programming
// language and additionally, may contain components and ideas that are
// not found in the original source code.

   Copyright 2013 Neil Borle and Paul Lu

   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.

Created on 2013-06-10

@author: Neil Borle
'''

import math
import numpy as np
from src.units.Vector3 import Vector3
from src.utils.Matrix4x4 import transform_vector
from RendererObjectManager import RendererObjectManager
from src.rendererUtil.SkyRegionMap import SkyRegionMap
from src.rendererUtil.LabelMaker import LabelMaker
from src.units.GeocentricCoordinates import GeocentricCoordinates
from src.utils.Matrix4x4 import create_rotation, multiply_MV
from src.utils.DebugOptions import Debug

class LabelObjectManager(RendererObjectManager):
    '''
    Manages the rendering of text labels by loading
    text sources into buffers for rendering and maintaining
    these buffers.
    '''
    class label(LabelMaker.LabelData):
        '''
        A private class which extends the LabelMaker's label data with an xyz position and rgba color values.
        For the red-eye mode, it's easier to set the color in the texture to white and set the color when we render
        the label than to have two textures, one with red labels and one without.
        '''

        def __init__(self, text_source):
            '''
            constructor
            '''
            LabelMaker.LabelData.__init__(self, text_source.label,
                                          0xFFFFFFFF, text_source.font_size)

            if text_source.label == None or text_source.label == '':
                raise Exception("Bad label " + str(self))

            self.x = text_source.geocentric_coords.x
            self.y = text_source.geocentric_coords.y
            self.z = text_source.geocentric_coords.z

            self.offset = text_source.offset

            # The distance this should be rendered underneath the specified position, in world coordinates.
            self.rgb = text_source.color
            self.a = 0xFF
            self.b = (self.rgb >> 16) & 0xFF
            self.g = (self.rgb >> 8) & 0xFF
            self.r = self.rgb & 0xFF
            # fixed point values
            #self.fixed_a = int(65536.0 * self.a / 255.0) & 0xFFFFFFFF
            #self.fixed_b = int(65536.0 * self.b / 255.0) & 0xFFFFFFFF
            #self.fixed_g = int(65536.0 * self.g / 255.0) & 0xFFFFFFFF
            #self.fixed_r = int(65536.0 * self.r / 255.0) & 0xFFFFFFFF

    # Should we compute the regions for the labels?
    # If false, we just put them in the catchall region.
    COMPUTE_REGIONS = True

    def update_objects(self, labels, update_type):
        if self.update_type.Reset in update_type:
            self.labels = [None] * len(labels)
            for i in range(0, len(labels)):
                self.labels[i] = self.label(labels[i])
            self.queue_for_reload(False)
        elif self.update_type.UpdatePositions in update_type:
            if len(labels) != len(self.labels):
                return

            # Since we don't store the positions in any GPU memory, and do the
            # transformations manually, we can just update the positions stored
            # on the label objects.
            for i in range(0, len(self.labels)):
                pos = labels[i].gc_coords
                self.labels[i].x = pos.x
                self.labels[i].y = pos.y
                self.labels[i].z = pos.z

        self.sky_region_map.clear()
        for l in self.labels:
            if self.COMPUTE_REGIONS:
                region = self.sky_region_map.get_object_region(GeocentricCoordinates(l.x, l.y, l.z))
            else:
                region = self.sky_region_map.CATCHALL_REGION_ID
            self.sky_region_map.get_region_data(region).append(l)

    def reload(self, gl, full_reload):
        # We need to regenerate the texture.  If we're re-creating the surface
        # (fullReload=true), all resources were automatically released by OpenGL,
        # so we don't want to try to release it again.  Otherwise, we need to
        # release it to avoid a resource leak (shutdown takes
        # care of freeing the texture).
        if not full_reload and self.label_maker == None:
            self.label_maker.shutdown(gl)

        self.label_maker = LabelMaker(True)
        self.texture_ref = self.label_maker.initialize(gl, self.render_state,
                                                       self.labels, self.texture_manager)

    def draw_internal(self, gl):
        if Debug.DRAWING == "POINTS ONLY" or Debug.DRAWING == "POINTS AND LINES": return

        gl.glTexEnvf(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE,
                     gl.GL_MODULATE)

        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
        gl.glActiveTexture(gl.GL_TEXTURE0)
        self.texture_ref.bind(gl)
        gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S,
                           gl.GL_REPEAT)
        gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T,
                           gl.GL_REPEAT)

        self.begin_drawing(gl)

        # Draw the labels for the active sky regions.
        active_regions = self.render_state.active_sky_region_set
        all_active_labels = self.sky_region_map.get_data_for_active_regions(active_regions)

        for labels_in_region in all_active_labels:
            for l in labels_in_region:
                self.draw_label(gl, l)

        self.end_drawing(gl)

    def draw_label(self, gl, label):
        look_dir = self.render_state.look_dir
        if look_dir.x * label.x + look_dir.y * label.y + \
                look_dir.z * label.z < self.dot_product_threshold:
            return

        # Offset the label to be underneath the given position (so a label will
        # always appear underneath a star no matter how the phone is rotated)
        v = Vector3(label.x - self.label_offset.x * label.offset,
                    label.y - self.label_offset.y * label.offset,
                    label.z - self.label_offset.z * label.offset)

        screen_pos = transform_vector(self.render_state.transform_to_screen, v)

        # We want this to align consistently with the pixels on the screen, so we
        # snap to the nearest x/y coordinate, and add a magic offset of less than
        # half a pixel.  Without this, rounding error can cause the bottom and
        # top of a label to be one pixel off, which results in a noticeable
        # distortion in the text.
        MAGIC_OFFSET = 0.25
        screen_pos.x = int(screen_pos.x) + MAGIC_OFFSET
        screen_pos.y = int(screen_pos.y) + MAGIC_OFFSET

        gl.glPushMatrix()

        gl.glTranslatef(screen_pos.x, screen_pos.y, 0)
        gl.glRotatef((180.0 / math.pi) * self.render_state.up_angle, 0, 0, -1)
        gl.glScalef(label.width_in_pixels, label.height_in_pixels, 1)

        gl.glVertexPointer(2, gl.GL_FLOAT, 0, self.quad_buffer)
        gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, label.text_coords)
        if self.render_state.night_vision_mode:
            gl.glColor4ub(0xFF, 0, 0, label.a)
        else:
            gl.glColor4ub(label.r, label.g, label.b, 128)

        gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        gl.glPopMatrix()

    def begin_drawing(self, gl):
        '''
        Sets OpenGL state for rapid drawing
        '''
        self.texture_ref.bind(gl)
        gl.glShadeModel(gl.GL_FLAT)

        ########################################################################## added Blending
        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glEnable(gl.GL_ALPHA_TEST)
        gl.glAlphaFunc(gl.GL_GREATER, 0.5)
        gl.glEnable(gl.GL_TEXTURE_2D)

        # We're going to do the transformation on the CPU, so set the matrices
        # to the identity
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glPushMatrix()
        gl.glLoadIdentity()
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glPushMatrix()
        gl.glLoadIdentity()
        gl.glOrtho(0, self.render_state.screen_width,
                    0, self.render_state.screen_height,
                    -1, 1)

        # equivalent of a call to GLBuffer.unbind(gl)
        gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
        gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, 0)

        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
        gl.glDisableClientState(gl.GL_COLOR_ARRAY)

        rs = self.render_state

        view_width = rs.screen_width
        view_height = rs.screen_height

        rotation = create_rotation(rs.up_angle, rs.look_dir)
        self.label_offset = multiply_MV(rotation, rs.up_dir)

        # If a label isn't within the field of view angle from the target vector, it can't
        # be on the screen.  Compute the cosine of this angle so we can quickly identify these.
        DEGREES_TO_RADIANS = math.pi / 180.0
        self.dot_product_threshold = math.cos(rs.radius_of_view * DEGREES_TO_RADIANS * \
                                            (1 + view_width / float(view_height)) * 0.5)

    def end_drawing(self, gl):
        ##########################################################################added blending
        gl.glDisable(gl.GL_BLEND)

        gl.glDisable(gl.GL_ALPHA_TEST)
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glPopMatrix()
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glPopMatrix()
        gl.glDisable(gl.GL_TEXTURE_2D)

        gl.glColor4f(1, 1, 1, 1)

    def __init__(self, sky_renderer, new_layer, new_texture_manager):
        '''
        Constructor
        '''
        RendererObjectManager.__init__(self, new_layer, new_texture_manager)

        self.label_maker = None
        self.labels = []
        self.sky_region_map = SkyRegionMap()

        # These are intermediate variables set in beginDrawing() and used in
        # draw() to make the transformations more efficient
        self.label_offset = Vector3(0, 0, 0)
        self.dot_product_threshold = None

        self.texture_ref = None

        # A quad with size 1 on each size, so we just need to multiply
        # by the label's width and height to get it to the right size for each
        # label.
        vertices = [-0.5, -0.5,   # lower left
                    -0.5,  0.5,   # upper left
                    0.5, -0.5,    # lower right
                    0.5,  0.5]    # upper right
        # make the vertices fixed point? byte buffer?
        self.quad_buffer = np.array(vertices, dtype=np.float32)
        # We want to initialize the labels of a sky region to an empty list.
        def construct_method():
            return []

        self.sky_region_map.region_data_factory = \
            SkyRegionMap.RegionDataFactory(construct_method)


text:
require 'rails_helper'

RSpec.shared_context "token_auth feature disabled" do
  around(:each) do |example|
    orig = Rails.application.config.try(:disable_token_auth) || false
    Rails.application.config.disable_token_auth = true

    example.run

    Rails.application.config.disable_token_auth = orig
  end
end

feature 'Token Authentication' do
  before { create(:group) }

  scenario 'trying to log in with an invalid email address' do
    visit '/'
    fill_in 'token_user_email', with: 'Bob'
    expect { click_button 'Log in' }.not_to change { ActionMailer::Base.deliveries.count }
    expect(page).to have_text('Email address is not formatted correctly')
  end

  scenario 'trying to log in with a non-whitelisted email address domain' do
    visit '/'
    fill_in 'token_user_email', with: 'james@abscond.org'
    expect { click_button 'Log in' }.not_to change { ActionMailer::Base.deliveries.count }
    expect(page).to have_text('Email address is not valid')
  end

  scenario 'accurate email' do
    visit '/'
    fill_in 'token_user_email', with: 'james.darling@digital.justice.gov.uk'
    expect { click_button 'Log in' }.to change { ActionMailer::Base.deliveries.count }.by(1)
    expect(page).to have_text('Check your email for a link to log in')

    expect(last_email.to).to eql(['james.darling@digital.justice.gov.uk'])
    expect(last_email.body.encoded).to have_text(token_url(Peoplefinder::Token.last))
  end

  scenario 'following valid link from email and getting prompted to complete my profile' do
    token = create(:token)
    visit token_path(token)

    expect(page).to have_link('Logged in as')
    expect(page).to have_text('Start building your profile now')
    within('h1') do
      expect(page).to have_text('Edit profile')
    end
  end

  scenario 'logging in and displaying a link to my profile' do
    person = create(:person, surname: 'Bob', email: 'test.user@digital.justice.gov.uk')
    token = Peoplefinder::Token.for_person(person)
    visit token_path(token)
    expect(page).to have_link('Logged in as Bob', href: person_path(person))
  end

  scenario 'following a link from an inadequate profile email' do
    person = create(:person, email: 'test.user@digital.justice.gov.uk')
    Peoplefinder::ReminderMailer.inadequate_profile(person).deliver

    visit links_in_email(last_email).last
    within('h1') do
      expect(page).to have_text('Edit profile')
    end
  end

  scenario 'logging out' do
    token_log_in_as('james.darling@digital.justice.gov.uk')
    expect(page).to have_text('James Darling')
    click_link 'Log out'
    expect(page).not_to have_text('james.darling@digital.justice.gov.uk')
    expect(page).to have_text('Log in to the people finder')
  end

  context 'token_auth feature disabled' do
    include_context "token_auth feature disabled"
    let(:token) { create(:token) }

    scenario 'following a valid link from an email redirects to login' do
      visit token_path(token)

      expect(page.current_path).to eq(new_sessions_path)
      expect(page).to have_text('login link is invalid')
      expect(page).to have_text('Log in to the people finder')
    end

    scenario 'login page does not have token auth login option' do
      visit new_sessions_path
      expect(page).not_to have_css('form.new_token')
    end

    scenario 'attempting to create an authentication token redirects to login' do
      visit token_path(token)

      expect(page.current_path).to eq(new_sessions_path)
      expect(page).to have_text('login link is invalid')
      expect(page).to have_text('Log in to the people finder')
    end
  end
end


text:
package com.uber.hoodie.cli.commands;

import com.uber.hoodie.cli.HoodieCLI;
import com.uber.hoodie.cli.HoodiePrintHelper;
import com.uber.hoodie.cli.TableHeader;
import com.uber.hoodie.common.model.FileSlice;
import com.uber.hoodie.common.table.HoodieTableMetaClient;
import com.uber.hoodie.common.table.HoodieTimeline;
import com.uber.hoodie.common.table.timeline.HoodieDefaultTimeline;
import com.uber.hoodie.common.table.timeline.HoodieInstant;
import com.uber.hoodie.common.table.view.HoodieTableFileSystemView;
import com.uber.hoodie.common.util.NumericUtils;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

@Component
public class FileSystemViewCommand implements CommandMarker {

  @CliCommand(value = "show fsview all", help = "Show entire file-system view")
  public String showAllFileSlices(
      @CliOption(key = {"pathRegex"},
          help = "regex to select files, eg: 2016/08/02", unspecifiedDefaultValue = "*/*/*") String globRegex,
      @CliOption(key = {"readOptimizedOnly"}, help = "Only display read-optimized view",
          unspecifiedDefaultValue = "false") boolean readOptimizedOnly,
      @CliOption(key = {"maxInstant"}, help = "File-Slices upto this instant are displayed",
          unspecifiedDefaultValue = "") String maxInstant,
      @CliOption(key = {
          "includeMax"}, help = "Include Max Instant", unspecifiedDefaultValue = "false") boolean includeMaxInstant,
      @CliOption(key = {
          "includeInflight"}, help = "Include Inflight Instants", unspecifiedDefaultValue = "false")
          boolean includeInflight,
      @CliOption(key = {"excludeCompaction"}, help = "Exclude compaction Instants", unspecifiedDefaultValue = "false")
          boolean excludeCompaction,
      @CliOption(key = {"limit"}, help = "Limit rows to be displayed", unspecifiedDefaultValue = "-1") Integer limit,
      @CliOption(key = {"sortBy"}, help = "Sorting Field", unspecifiedDefaultValue = "") final String sortByField,
      @CliOption(key = {"desc"}, help = "Ordering", unspecifiedDefaultValue = "false") final boolean descending,
      @CliOption(key = {
          "headeronly"}, help = "Print Header Only", unspecifiedDefaultValue = "false") final boolean headerOnly)
      throws IOException {

    HoodieTableFileSystemView fsView = buildFileSystemView(globRegex, maxInstant, readOptimizedOnly, includeMaxInstant,
        includeInflight, excludeCompaction);
    List<Comparable[]> rows = new ArrayList<>();
    fsView.getAllFileGroups().forEach(fg -> fg.getAllFileSlices().forEach(fs -> {
      int idx = 0;
      // For ReadOptimized Views, do not display any delta-file related columns
      Comparable[] row = new Comparable[readOptimizedOnly ? 5 : 8];
      row[idx++] = fg.getPartitionPath();
      row[idx++] = fg.getFileGroupId().getFileId();
      row[idx++] = fs.getBaseInstantTime();
      row[idx++] = fs.getDataFile().isPresent() ? fs.getDataFile().get().getPath() : "";
      row[idx++] = fs.getDataFile().isPresent() ? fs.getDataFile().get().getFileSize() : -1;
      if (!readOptimizedOnly) {
        row[idx++] = fs.getLogFiles().count();
        row[idx++] = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .mapToLong(lf -> lf.getFileSize().get()).sum();
        row[idx++] = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .collect(Collectors.toList()).toString();
      }
      rows.add(row);
    }));
    Function<Object, String> converterFunction =
        entry -> NumericUtils.humanReadableByteCount((Double.valueOf(entry.toString())));
    Map<String, Function<Object, String>> fieldNameToConverterMap = new HashMap<>();
    fieldNameToConverterMap.put("Total Delta File Size", converterFunction);
    fieldNameToConverterMap.put("Data-File Size", converterFunction);

    TableHeader header = new TableHeader()
        .addTableHeaderField("Partition")
        .addTableHeaderField("FileId")
        .addTableHeaderField("Base-Instant")
        .addTableHeaderField("Data-File")
        .addTableHeaderField("Data-File Size");
    if (!readOptimizedOnly) {
      header = header.addTableHeaderField("Num Delta Files")
          .addTableHeaderField("Total Delta File Size")
          .addTableHeaderField("Delta Files");
    }
    return HoodiePrintHelper.print(header, fieldNameToConverterMap, sortByField, descending, limit, headerOnly, rows);
  }

  @CliCommand(value = "show fsview latest", help = "Show latest file-system view")
  public String showLatestFileSlices(
      @CliOption(key = {"partitionPath"},
          help = "A valid paritition path", mandatory = true) String partition,
      @CliOption(key = {"readOptimizedOnly"}, help = "Only display read-optimized view",
          unspecifiedDefaultValue = "false") boolean readOptimizedOnly,
      @CliOption(key = {"maxInstant"}, help = "File-Slices upto this instant are displayed",
          unspecifiedDefaultValue = "") String maxInstant,
      @CliOption(key = {"merge"}, help = "Merge File Slices due to pending compaction",
          unspecifiedDefaultValue = "true") final boolean merge,
      @CliOption(key = {"includeMax"}, help = "Include Max Instant", unspecifiedDefaultValue = "false")
          boolean includeMaxInstant,
      @CliOption(key = {"includeInflight"}, help = "Include Inflight Instants", unspecifiedDefaultValue = "false")
          boolean includeInflight,
      @CliOption(key = {"excludeCompaction"}, help = "Exclude compaction Instants", unspecifiedDefaultValue = "false")
          boolean excludeCompaction,
      @CliOption(key = {"limit"}, help = "Limit rows to be displayed", unspecifiedDefaultValue = "-1") Integer limit,
      @CliOption(key = {"sortBy"}, help = "Sorting Field", unspecifiedDefaultValue = "") final String sortByField,
      @CliOption(key = {"desc"}, help = "Ordering", unspecifiedDefaultValue = "false") final boolean descending,
      @CliOption(key = {
          "headeronly"}, help = "Print Header Only", unspecifiedDefaultValue = "false") final boolean headerOnly)
      throws IOException {

    HoodieTableFileSystemView fsView = buildFileSystemView(partition, maxInstant, readOptimizedOnly, includeMaxInstant,
        includeInflight, excludeCompaction);
    List<Comparable[]> rows = new ArrayList<>();

    final Stream<FileSlice> fileSliceStream;
    if (!merge) {
      fileSliceStream = fsView.getLatestFileSlices(partition);
    } else {
      if (maxInstant.isEmpty()) {
        maxInstant = HoodieCLI.tableMetadata.getActiveTimeline().filterCompletedAndCompactionInstants().lastInstant()
            .get().getTimestamp();
      }
      fileSliceStream = fsView.getLatestMergedFileSlicesBeforeOrOn(partition, maxInstant);
    }

    fileSliceStream.forEach(fs -> {
      int idx = 0;
      Comparable[] row = new Comparable[readOptimizedOnly ? 5 : 13];
      row[idx++] = partition;
      row[idx++] = fs.getFileId();
      row[idx++] = fs.getBaseInstantTime();
      row[idx++] = fs.getDataFile().isPresent() ? fs.getDataFile().get().getPath() : "";

      long dataFileSize = fs.getDataFile().isPresent() ? fs.getDataFile().get().getFileSize() : -1;
      row[idx++] = dataFileSize;

      if (!readOptimizedOnly) {
        row[idx++] = fs.getLogFiles().count();
        row[idx++] = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .mapToLong(lf -> lf.getFileSize().get()).sum();
        long logFilesScheduledForCompactionTotalSize = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .filter(lf -> lf.getBaseCommitTime().equals(fs.getBaseInstantTime()))
            .mapToLong(lf -> lf.getFileSize().get()).sum();
        row[idx++] = logFilesScheduledForCompactionTotalSize;

        long logFilesUnscheduledTotalSize = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .filter(lf -> !lf.getBaseCommitTime().equals(fs.getBaseInstantTime()))
            .mapToLong(lf -> lf.getFileSize().get()).sum();
        row[idx++] = logFilesUnscheduledTotalSize;

        double logSelectedForCompactionToBaseRatio =
            dataFileSize > 0 ? logFilesScheduledForCompactionTotalSize / (dataFileSize * 1.0) : -1;
        row[idx++] = logSelectedForCompactionToBaseRatio;
        double logUnscheduledToBaseRatio =
            dataFileSize > 0 ? logFilesUnscheduledTotalSize / (dataFileSize * 1.0) : -1;
        row[idx++] = logUnscheduledToBaseRatio;

        row[idx++] = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .filter(lf -> lf.getBaseCommitTime().equals(fs.getBaseInstantTime()))
            .collect(Collectors.toList()).toString();
        row[idx++] = fs.getLogFiles().filter(lf -> lf.getFileSize().isPresent())
            .filter(lf -> !lf.getBaseCommitTime().equals(fs.getBaseInstantTime()))
            .collect(Collectors.toList()).toString();
      }
      rows.add(row);
    });

    Function<Object, String> converterFunction =
        entry -> NumericUtils.humanReadableByteCount((Double.valueOf(entry.toString())));
    Map<String, Function<Object, String>> fieldNameToConverterMap = new HashMap<>();
    fieldNameToConverterMap.put("Data-File Size", converterFunction);
    if (!readOptimizedOnly) {
      fieldNameToConverterMap.put("Total Delta Size", converterFunction);
      fieldNameToConverterMap.put("Delta Size - compaction scheduled", converterFunction);
      fieldNameToConverterMap.put("Delta Size - compaction unscheduled", converterFunction);
    }

    TableHeader header = new TableHeader()
        .addTableHeaderField("Partition")
        .addTableHeaderField("FileId")
        .addTableHeaderField("Base-Instant")
        .addTableHeaderField("Data-File")
        .addTableHeaderField("Data-File Size");

    if (!readOptimizedOnly) {
      header = header.addTableHeaderField("Num Delta Files")
          .addTableHeaderField("Total Delta Size")
          .addTableHeaderField("Delta Size - compaction scheduled")
          .addTableHeaderField("Delta Size - compaction unscheduled")
          .addTableHeaderField("Delta To Base Ratio - compaction scheduled")
          .addTableHeaderField("Delta To Base Ratio - compaction unscheduled")
          .addTableHeaderField("Delta Files - compaction scheduled")
          .addTableHeaderField("Delta Files - compaction unscheduled");
    }
    return HoodiePrintHelper.print(header, fieldNameToConverterMap, sortByField, descending, limit, headerOnly, rows);
  }

  /**
   * Build File System View
   * @param globRegex Path Regex
   * @param maxInstant  Max Instants to be used for displaying file-instants
   * @param readOptimizedOnly Include only read optimized view
   * @param includeMaxInstant Include Max instant
   * @param includeInflight   Include inflight instants
   * @param excludeCompaction Exclude Compaction instants
   * @return
   * @throws IOException
   */
  private HoodieTableFileSystemView buildFileSystemView(String globRegex, String maxInstant, boolean readOptimizedOnly,
      boolean includeMaxInstant, boolean includeInflight, boolean excludeCompaction) throws IOException {
    HoodieTableMetaClient metaClient = new HoodieTableMetaClient(HoodieCLI.tableMetadata.getHadoopConf(),
        HoodieCLI.tableMetadata.getBasePath(), true);
    FileSystem fs = HoodieCLI.fs;
    String globPath = String.format("%s/%s/*", HoodieCLI.tableMetadata.getBasePath(), globRegex);
    FileStatus[] statuses = fs.globStatus(new Path(globPath));
    Stream<HoodieInstant> instantsStream = null;

    HoodieTimeline timeline = null;
    if (readOptimizedOnly) {
      timeline = metaClient.getActiveTimeline().getCommitTimeline();
    } else if (excludeCompaction) {
      timeline = metaClient.getActiveTimeline().getCommitsTimeline();
    } else {
      timeline = metaClient.getActiveTimeline().getCommitsAndCompactionTimeline();
    }

    if (!includeInflight) {
      timeline = timeline.filterCompletedInstants();
    }

    instantsStream = timeline.getInstants();

    if (!maxInstant.isEmpty()) {
      final BiPredicate<String, String> predicate;
      if (includeMaxInstant) {
        predicate = HoodieTimeline.GREATER_OR_EQUAL;
      } else {
        predicate = HoodieTimeline.GREATER;
      }
      instantsStream = instantsStream.filter(is -> predicate.test(maxInstant, is.getTimestamp()));
    }

    HoodieTimeline filteredTimeline = new HoodieDefaultTimeline(instantsStream,
        (Function<HoodieInstant, Optional<byte[]>> & Serializable) metaClient.getActiveTimeline()::getInstantDetails);
    return new HoodieTableFileSystemView(metaClient, filteredTimeline, statuses);
  }
}


text:
module.exports = {
	name: 'commonjs.legacy.index_js/commonjs.legacy.index_js.js'
};


text:
		<title>PxObstacle Class Reference</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css">

				Main Page
				Class Hierarchy
				Compound List
				Compound Members

Public Member Functions |
Public Attributes |
Protected Member Functions |
Protected Attributes |
List of all members

PxObstacle Class Reference
Character

Base class for obstacles.
 More...

#include <PxControllerObstacles.h>

Inheritance diagram for PxObstacle:

<map name="PxObstacle_inherit__map" id="PxObstacle_inherit__map">
</map>
[legend]

Collaboration diagram for PxObstacle:

<map name="PxObstacle_coll__map" id="PxObstacle_coll__map">
</map>
[legend]

Public Member Functions

PX_FORCE_INLINE

PxGeometryType::Enum 	getType () const

Public Attributes

void * 	mUserData

PxExtendedVec3 	mPos

PxQuat 	mRot

Protected Member Functions

 	PxObstacle ()

 	~PxObstacle ()

Protected Attributes

PxGeometryType::Enum 	mType

Detailed Description

Base class for obstacles.

See Also

PxBoxObstacle PxCapsuleObstacle PxObstacleContext

Constructor & Destructor Documentation

          PxObstacle::PxObstacle
          (
          	)

inlineprotected

          PxObstacle::~PxObstacle
          (
          	)

inlineprotected

Member Function Documentation

          PX_FORCE_INLINE PxGeometryType::Enum PxObstacle::getType
          (
          	)
           const

inline

Member Data Documentation

          PxExtendedVec3 PxObstacle::mPos

          PxQuat PxObstacle::mRot

          PxGeometryType::Enum PxObstacle::mType

protected

          void* PxObstacle::mUserData

The documentation for this class was generated from the following file:

PxControllerObstacles.h

Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com


text:
package de.craften.plugins.managedentities.util.nms;

import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;

/**
 * NMS utility methods for entities.
 */
public class NmsEntityUtil {
    /**
     * Disables the AI for the given entity.
     *
     * @param entity entity
     * @deprecated use {@link #setAi(LivingEntity, boolean)} instead
     */
    @Deprecated
    public static void disableAi(LivingEntity entity) {
        setAi(entity, false);
    }

    /**
     * Sets whether the AI for the given entity is enabled. This also toggles gravity.
     *
     * @param entity entity
     * @param hasAi  whether the entity should have an AI
     */
    public static void setAi(LivingEntity entity, boolean hasAi) {
        Entity nmsEntity = ((CraftEntity) entity).getHandle();
        NBTTagCompound tag = nmsEntity.getNBTTag();
        if (tag == null) {
            tag = new NBTTagCompound();
        }
        nmsEntity.c(tag);
        tag.setInt("NoAI", hasAi ? 0 : 1);
        nmsEntity.f(tag);
    }

    /**
     * Sets whether the entity is invulnerable. This only blocks players in survival or adventure mode from hurting
     * the entity.
     *
     * @param entity       entity
     * @param invulnerable whether the entity should be invulnerable
     */
    public static void setInvulnerable(LivingEntity entity, boolean invulnerable) {
        Entity nmsEntity = ((CraftEntity) entity).getHandle();
        NBTTagCompound tag = nmsEntity.getNBTTag();
        if (tag == null) {
            tag = new NBTTagCompound();
        }
        nmsEntity.c(tag);
        tag.setInt("Invulnerable", invulnerable ? 1 : 0);
        nmsEntity.f(tag);
    }

    /**
     * Sets the head rotation of the given entity.
     *
     * @param entity entity
     * @param yaw    head yaw, in degree
     * @param pitch  head pitch, in degree
     */
    public static void setHeadRotation(LivingEntity entity, float yaw, float pitch) {
        EntityLiving nmsEntity = ((CraftLivingEntity) entity).getHandle();
        nmsEntity.f(clampYaw(yaw));
        nmsEntity.g(pitch);
    }

    private static float clampYaw(float yaw) {
        while (yaw < -180.0F) {
            yaw += 360.0F;
        }

        while (yaw >= 180.0F) {
            yaw -= 360.0F;
        }

        return yaw;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/angular-contacts.iml" filepath="$PROJECT_DIR$/.idea/angular-contacts.iml" />
    </modules>
  </component>
</project>


text:
/* common --------------------------------------------- by 不一 -------- */
body            { background-color: #f3f3f3; }
.none           { display:none; }

/* box 模型*/
.cssBorder-box  { -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; }
.flexBox        { display:moz-box; display:-webkit-box; display:-webkit-flex; display:flex; }
.box_flex_0     { -moz-box-flex:0.0; -webkit-box-flex:0.0; -webkit-flex:none; flex:none; }
.box_flex_1     { -moz-box-flex:1.0; -webkit-box-flex:1.0; -webkit-flex:1; flex:1; width:100%; }

/* page - new --------------------------------------------------------------- */
/* container */
.new_edm            { padding-top: 50px; width: 980px; margin: 0 auto; position: relative; }

/* action_bar */
.action_bar         { position: fixed; z-index: 2000; top: 0; left: 0; width: 100%; box-shadow: 0 1px 2px #bbb; background-color: #444; }
.action_bar button,
.action_bar a  		{ border: none; background-color: #373737; color: #fff; font-size: 16px; }
.action_bar button:hover,
.action_bar a:hover  		{ background-color: #474747; color: #f8f8f8; }
.action_bar .remFloor-btn	{ position: absolute;  left: 50%; margin-left: -40px; display: none; }

/* sidebar */
.sidebar            { position: fixed; top:36px; right: 0; width: 320px; height: 100%; z-index: 1000; }
.control_panel      { box-shadow: 0 1px 3px #bbb; width: 100%; height: 100%; min-height: 500px; background-color: #fff; padding: 15px; }
.control_panel .tab-content				{ margin-top: 20px; }
.control_panel > .fa-tachometer			{ position: absolute; top: 50%; left: 50%; font-size: 48px; margin: -48px 0 0 -24px; color: #888; transition: all 1s; /*text-shadow: -1px 0px 0px #777, 0px -1px 0px #777;*/ }
.control_panel > .dashboard				{ display: none; }
.control_panel .form-horizontal label	{ font-size: 12px; padding-right: 0; }
.control_panel .form-group .input-group { padding-left: 15px; padding-right: 15px; }
.control_panel .form-group .icn-btn     { line-height: 16px; }
.control_panel .form-group .icn-btn i   { font-size: 16px; }

#tab_editFloor .room-tp_img				{ min-height: 80px; max-height: 120px; }

/* modal */
.modal .newFloor_modal     	{ width: 800px; }
.modal .cfmRemFloor_modal	{ width: 692px; }
.modal .cfmRemFloor_modal .floorToRemove	{ width: 650px; overflow-x: hidden; }

.modal #newFloor_collapse .panel-heading		{ padding: 0; }
.modal #newFloor_collapse .panel-title > a		{ display: block; height: 100%; cursor: pointer; padding: 10px 15px; text-decoration: none; }
.modal #newFloor_collapse .panel-title > a:hover{ background-color: #eee; }

.modal .saveEDM_modal					{ width: 656px; }
.modal .saveEDM_modal .modal-header		{ border: none; }
.modal .saveEDM_modal .modal-body 		{ padding: 0; }
.modal .saveEDM_modal .tab-content > div{ padding: 15px 0; }
.modal .saveEDM_modal pre 				{ border: none; }

/* stage */
.stage              { box-shadow: 0 2px 25px #bbb; margin-left: 1%; width: 650px; min-height: 200px; overflow-x: hidden; background-color: #fff; }
.stage > table      { background-color: #fff; margin: 0 auto; font-size: 12px; font-family: arial; color: #333; }

.stage .floor-actived		{ outline: 1px solid #4aabff; margin-top: 1px; }
.stage .room-actived        { outline: 2px solid #4aabff; }

.stage .floor 				{ margin-top: 1px; }
.stage .room 				{ position: relative; }

.stage .fa-trash-o		    { left: 658px; width: 23px; height: 23px; line-height: 23px; box-shadow: 0 0 4px #aaa; margin-top: -80px; color: #c00; }
.stage .fa.fa-trash-o:hover	{ color: #fff; background-color: #d9534f; }
.stage .fa-angle-up			{ left: 658px; width: 23px; height: 23px; line-height: 23px; box-shadow: 0 0 4px #aaa; margin-top: -50px; }
.stage .fa-angle-down		{ left: 658px; width: 23px; height: 23px; line-height: 23px; box-shadow: 0 0 4px #aaa; margin-top: -26px; }
.stage .fa-angle-left		{ left: 50%; width: 23px; height: 23px; line-height: 23px; box-shadow: 0 0 4px #aaa; margin: -5px 0 0 -24px; padding-right: 1px; }
.stage .fa-angle-right		{ left: 50%; width: 23px; height: 23px; line-height: 23px; box-shadow: 0 0 4px #aaa; margin: -5px 0 0 1px; padding-right: 1px; }
.stage .fa,
.stage .glyphicon 			{ display: block; position: absolute; z-index: 500; font-size: 16px; text-align: center; cursor: pointer; top: auto; background-color: rgba(235, 235, 235, 0.9); }
.stage .fa:hover,
.stage .glyphicon:hover 	{ background-color: rgba(255, 255, 255, 1); z-index: 1000; box-shadow: 0 0 8px #aaa; }


text:
% This code belongs to the HDM05 mocap database which can be obtained
% from the website http://www.mpi-inf.mpg.de/resources/HDM05 .
%
% If you use and publish results based on this code and data, please
% cite the following technical report:
%
%   @techreport{MuellerRCEKW07_HDM05-Docu,
%     author = {Meinard M{\"u}ller and Tido R{\"o}der and Michael Clausen and Bernd Eberhardt and Bj{\"o}rn Kr{\"u}ger and Andreas Weber},
%     title = {Documentation: Mocap Database {HDM05}},
%     institution = {Universit{\"a}t Bonn},
%     number = {CG-2007-2},
%     year = {2007}
%   }
%
%
% THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
% KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
% PARTICULAR PURPOSE.

function mot = reflectMotYZ(mot)
%%%%%%%% reflect elderwalk about yz plane
for k=1:length(mot.jointTrajectories)
    mot.jointTrajectories{k,1}([1],:) = -mot.jointTrajectories{k,1}([1],:);
    mot.jointTrajectories{k,1} = mot.jointTrajectories{k,1} - repmat(mot.rootTranslation(:,1) - mot.rootTranslation(:,1),1,mot.nframes);
end
mot.rootTranslation([1],:) = -mot.rootTranslation([1],:);
mot.rootTranslation = mot.rootTranslation - repmat(mot.rootTranslation(:,1) - mot.rootTranslation(:,1),1,mot.nframes);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


text:
import { EventEmitter, QueryList, AfterContentInit } from '@angular/core';
import { WizardStepComponent } from './wizard-step.component';
export declare class WizardComponent implements AfterContentInit {
    wizardSteps: QueryList<WizardStepComponent>;
    private _steps;
    private _isCompleted;
    onStepChanged: EventEmitter<WizardStepComponent>;
    constructor();
    ngAfterContentInit(): void;
    readonly steps: Array<WizardStepComponent>;
    readonly isCompleted: boolean;
    activeStep: WizardStepComponent;
    readonly activeStepIndex: number;
    readonly hasNextStep: boolean;
    readonly hasPrevStep: boolean;
    goToStep(step: WizardStepComponent): void;
    next(): void;
    previous(): void;
    complete(): void;
}