text:
from git.exc import InvalidGitRepositoryError
from mock import patch
import os
from tempfile import mkdtemp
import unittest

from cheat_ext.exceptions import CheatExtException
from cheat_ext.installer import (
    install, upgrade, remove,
)

class TestInstaller(unittest.TestCase):
    def setUp(self):
        self.sheet_dir = os.path.join(mkdtemp(), "autor_repo")

        self.get_sheet_path = \
            patch("cheat_ext.installer.get_sheet_path").start()
        self.get_sheet_path.return_value = self.sheet_dir

        self.Repo = patch("cheat_ext.installer.Repo").start()

    def test_install(self):
        install("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.Repo.clone_from.assert_called_with(
            "https://github.com/author/repo.git", self.sheet_dir,
            branch="master")

    def test_install_cheatsheets_installed(self):
        os.mkdir(self.sheet_dir)

        with self.assertRaises(CheatExtException):
            install("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.Repo.clone_from.assert_not_called()

    def test_upgrade(self):
        os.mkdir(self.sheet_dir)

        upgrade("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.Repo.assert_called_with(self.sheet_dir)
        self.Repo(self.sheet_dir).remote().pull.assert_called_with()

    def test_upgrade_failed_with_not_installed(self):
        with self.assertRaises(CheatExtException):
            upgrade("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.Repo.asesrt_not_called()

    def test_upgrade_failed_with_not_git_dir(self):
        self.Repo.side_effect = InvalidGitRepositoryError
        os.mkdir(self.sheet_dir)

        with self.assertRaises(CheatExtException):
            upgrade("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.Repo.asesrt_not_called()

    def test_remove(self):
        os.mkdir(self.sheet_dir)

        remove("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")
        self.assertFalse(os.path.exists(self.sheet_dir))

    def test_remove_failed_with_not_installed(self):
        with self.assertRaises(CheatExtException):
            remove("author/repo")

        self.get_sheet_path.assert_called_with("author/repo")

redpajama_set_name: RedPajamaGithub


text:
class AtoBoolC {
public:
  AtoBoolC(const AtoBoolC& aBool);
private:
  int myValue;
};

struct TestCase {
  AtoBoolC is_call_on_unack;
};

static TestCase the_cases[] = { { 0 } };	// { dg-error "" }


text:
package vspk

import "github.com/nuagenetworks/go-bambou/bambou"

// InfrastructurePortProfileIdentity represents the Identity of the object
var InfrastructurePortProfileIdentity = bambou.Identity{
	Name:     "infrastructureportprofile",
	Category: "infrastructureportprofiles",
}

// InfrastructurePortProfilesList represents a list of InfrastructurePortProfiles
type InfrastructurePortProfilesList []*InfrastructurePortProfile

// InfrastructurePortProfilesAncestor is the interface of an ancestor of a InfrastructurePortProfile must implement.
type InfrastructurePortProfilesAncestor interface {
	InfrastructurePortProfiles(*bambou.FetchingInfo) (InfrastructurePortProfilesList, *bambou.Error)
	CreateInfrastructurePortProfiles(*InfrastructurePortProfile) *bambou.Error
}

// InfrastructurePortProfile represents the model of a infrastructureportprofile
type InfrastructurePortProfile struct {
	ID            string `json:"ID,omitempty"`
	ParentID      string `json:"parentID,omitempty"`
	ParentType    string `json:"parentType,omitempty"`
	Owner         string `json:"owner,omitempty"`
	Name          string `json:"name,omitempty"`
	LastUpdatedBy string `json:"lastUpdatedBy,omitempty"`
	Description   string `json:"description,omitempty"`
	EnterpriseID  string `json:"enterpriseID,omitempty"`
	EntityScope   string `json:"entityScope,omitempty"`
	Speed         string `json:"speed,omitempty"`
	UplinkTag     string `json:"uplinkTag,omitempty"`
	Mtu           int    `json:"mtu,omitempty"`
	Duplex        string `json:"duplex,omitempty"`
	ExternalID    string `json:"externalID,omitempty"`
}

// NewInfrastructurePortProfile returns a new *InfrastructurePortProfile
func NewInfrastructurePortProfile() *InfrastructurePortProfile {

	return &InfrastructurePortProfile{
		Duplex: "FULL",
		Speed:  "AUTONEGOTIATE",
		Mtu:    1500,
	}
}

// Identity returns the Identity of the object.
func (o *InfrastructurePortProfile) Identity() bambou.Identity {

	return InfrastructurePortProfileIdentity
}

// Identifier returns the value of the object's unique identifier.
func (o *InfrastructurePortProfile) Identifier() string {

	return o.ID
}

// SetIdentifier sets the value of the object's unique identifier.
func (o *InfrastructurePortProfile) SetIdentifier(ID string) {

	o.ID = ID
}

// Fetch retrieves the InfrastructurePortProfile from the server
func (o *InfrastructurePortProfile) Fetch() *bambou.Error {

	return bambou.CurrentSession().FetchEntity(o)
}

// Save saves the InfrastructurePortProfile into the server
func (o *InfrastructurePortProfile) Save() *bambou.Error {

	return bambou.CurrentSession().SaveEntity(o)
}

// Delete deletes the InfrastructurePortProfile from the server
func (o *InfrastructurePortProfile) Delete() *bambou.Error {

	return bambou.CurrentSession().DeleteEntity(o)
}

// Metadatas retrieves the list of child Metadatas of the InfrastructurePortProfile
func (o *InfrastructurePortProfile) Metadatas(info *bambou.FetchingInfo) (MetadatasList, *bambou.Error) {

	var list MetadatasList
	err := bambou.CurrentSession().FetchChildren(o, MetadataIdentity, &list, info)
	return list, err
}

// CreateMetadata creates a new child Metadata under the InfrastructurePortProfile
func (o *InfrastructurePortProfile) CreateMetadata(child *Metadata) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}

// GlobalMetadatas retrieves the list of child GlobalMetadatas of the InfrastructurePortProfile
func (o *InfrastructurePortProfile) GlobalMetadatas(info *bambou.FetchingInfo) (GlobalMetadatasList, *bambou.Error) {

	var list GlobalMetadatasList
	err := bambou.CurrentSession().FetchChildren(o, GlobalMetadataIdentity, &list, info)
	return list, err
}

// CreateGlobalMetadata creates a new child GlobalMetadata under the InfrastructurePortProfile
func (o *InfrastructurePortProfile) CreateGlobalMetadata(child *GlobalMetadata) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}


text:
package com.github.basking2.sdsai.itrex.functions;

import com.github.basking2.sdsai.itrex.EvaluationContext;

import java.util.Iterator;
import java.util.function.BiFunction;

public interface FunctionInterface<R> extends BiFunction<Iterator<?>, EvaluationContext, R> {
}


text:
/**
* NCtoolKit © 2007-2017 Luís F.Loureiro, under zlib software license.
* https://github.com/nczeroshift/nctoolkit
*/

#ifndef _NCK_DEMO_GUI_H_
#define _NCK_DEMO_GUI_H_

#include "../nckDemo.h"

class WidgetEventsHandler;

class Demo_GUI : public Demo{
public:
    Demo_GUI(Core::Window * wnd, Graph::Device * dev);
	~Demo_GUI();

	void Load();
	void Render(float dt);
	void UpdateWndEvents();
    std::vector<std::string> GetKeywords();
    std::string GetDescription();

private:
    WidgetEventsHandler * wgtEventsHandler;
    Gui::Manager * wgtManager;
    Graph::Texture * fontTexture;
    Gui::FontMap * fontMap;
    Gui::ShapeRenderer * shpRender;
    Gui::WidgetRenderer * wgtRender;
};

Demo * CreateDemo_GUI(Core::Window * wnd, Graph::Device * dev);

#endif


text:
package org.springframework.security.oauth2.client.endpoint;

import java.util.Set;

import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.OAuth2AccessToken;
import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;

/**
 * The default implementation of an {@link ReactiveOAuth2AccessTokenResponseClient} for
 * the {@link AuthorizationGrantType#JWT_BEARER jwt-bearer} grant. This implementation
 * uses {@link WebClient} when requesting an access token credential at the Authorization
 * Server's Token Endpoint.
 *
 * @author Steve Riesenberg
 * @since 5.6
 * @see ReactiveOAuth2AccessTokenResponseClient
 * @see JwtBearerGrantRequest
 * @see OAuth2AccessToken
 * @see Section
 * 2.1 Using JWTs as Authorization Grants
 * @see Section
 * 4.1 Using Assertions as Authorization Grants
 */
public final class WebClientReactiveJwtBearerTokenResponseClient
		extends AbstractWebClientReactiveOAuth2AccessTokenResponseClient<JwtBearerGrantRequest> {

	@Override
	ClientRegistration clientRegistration(JwtBearerGrantRequest grantRequest) {
		return grantRequest.getClientRegistration();
	}

	@Override
	Set<String> scopes(JwtBearerGrantRequest grantRequest) {
		return grantRequest.getClientRegistration().getScopes();
	}

	@Override
	BodyInserters.FormInserter<String> populateTokenRequestBody(JwtBearerGrantRequest grantRequest,
			BodyInserters.FormInserter<String> body) {
		return super.populateTokenRequestBody(grantRequest, body).with(OAuth2ParameterNames.ASSERTION,
				grantRequest.getJwt().getTokenValue());
	}

}


text:
import Ember from 'ember';

import ParentController from './parent';

export default ParentController.extend({
  breadcrumbs: Ember.computed("model", function () {
    var ID = this.get("model.entityID");

    return [{
      text: `Query [ ${ID} ]`,
      routeName: "query.index",
      model: ID
    }];
  }),

  tabs: [{
    text: "Query Details",
    routeName: "query.index"
  }, {
    text: "Timeline",
    routeName: "query.timeline"
  }, {
    text: "Configurations",
    routeName: "query.configs"
  }]
});


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.01.22 at 02:22:17 PM CET
//

package client;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;

/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the client package.
 *
An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 *
 */
@XmlRegistry
public class ObjectFactory {

    private final static QName _Resources_QNAME = new QName("", "resources");

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: client
     *
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link ResourcesType }
     *
     */
    public ResourcesType createResourcesType() {
        return new ResourcesType();
    }

    /**
     * Create an instance of {@link ResourceType }
     *
     */
    public ResourceType createResourceType() {
        return new ResourceType();
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link ResourcesType }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "", name = "resources")
    public JAXBElement<ResourcesType> createResources(ResourcesType value) {
        return new JAXBElement<>(_Resources_QNAME, ResourcesType.class, null, value);
    }
}


text:
/*
 * This file is derived from /v7/recyclerview/tests/src/android/support/v7/widget/TestActivity.java
 */
/*
 * Copyright (C) 2014 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.
 */

package com.h6ah4i.android.widget.advrecyclerview;

import android.app.Activity;
import android.os.Bundle;
import android.widget.FrameLayout;

public class TestActivity extends Activity {

    FrameLayout mContainer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContainer = new FrameLayout(this);
        setContentView(mContainer);
    }
}


text:
module Inforouter #:nodoc:
  module Errors #:nodoc:
    # This error is raised when a SOAP call fails.
    class SOAPError < InforouterError
      # Original SOAP fault.
      attr_reader :fault

      def initialize(e)
        @fault = e
        e.to_hash.tap do |fault|
          fault_code = fault[:fault][:faultcode]
          fault_string = parse_fault(fault[:fault][:faultstring])
          super(compose_message('soap_error',
                                message: fault_string,
                                code: fault_code
          ))
        end
      end

      private

      # @param fault_string [String]
      #
      # @return [String]
      def parse_fault(fault_string)
        fault_string.lines.first.strip
      end
    end
  end
end


text:
package com.bitbosh.lovat.webgateway;

import java.net.URI;
import java.net.URISyntaxException;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientConfiguration;
import io.dropwizard.db.DataSourceFactory;

public class ApplicationConfiguration extends Configuration {

	@Valid
	@NotNull
	@JsonProperty
	private JerseyClientConfiguration httpClient = new JerseyClientConfiguration();

	public JerseyClientConfiguration getJerseyClientConfiguration() {
		return httpClient;
	}

	@Valid
	@NotNull
	private DataSourceFactory database = new DataSourceFactory();

	/**
	 * A getter for the database factory.
	 *
	 * @return An instance of database factory deserialized from the
	 *         configuration file passed as a command-line argument to the
	 *         application.
	 * @throws URISyntaxException
	 */
	@JsonProperty("database")
	public DataSourceFactory getDataSourceFactory() throws URISyntaxException {

		// Overwrite the value read from the database property of the config.yml
		// file and use the value provided by Heroku
		// environment.
		//
		// When running the app locally using `heroku local` the remote postgres
		// db url needs to be added to the IDE or to
		// your environment. Run `heroku config` to get the environment variable
		// and its value. For local dev with Eclipse
		// add DATABASE_URL and its value as a parameter in the Environment tab.
		// For running the application with Heroku cli
		// add DATABASE_URL and its value to the .bash_profile file and either
		// restart your terminal or source it, i.e.
		// source ~/.bash_profile
		//
		// For reference:
		// https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java#connecting-to-a-database-remotely
		URI dbUri = null;
		final String databaseUrl = System.getenv("DATABASE_URL");
		if (databaseUrl != null) {
			dbUri = new URI(databaseUrl);
		}

		if (dbUri != null) {
			String username = dbUri.getUserInfo().split(":")[0];
			String password = dbUri.getUserInfo().split(":")[1];
			String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath()
					+ "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory";

			this.database.setUser(username);
			this.database.setPassword(password);
			this.database.setUrl(dbUrl);
		}
		return database;
	}

	/**
	 * Needed to set the database factory when the config.yml file is loaded.
	 *
	 * @param dataSourceFactory
	 */
	@JsonProperty("database")
	public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
		this.database = dataSourceFactory;
	}
}


text:
<?php

namespace Anax\Informer;

/**
 * Flash message class used for setting and displaying flash messages
 *
 */
class Informer
{
    use \Anax\DI\TInjectionaware;

    /**
     * Properties
     */
    public $valid = array();

    /**
     * Constructor for CInformer.
     *
     * @return void
     */
    public function __construct()
    {
        $this->valid = ['info', 'error', 'success', 'warning'];
    }

    /**
     * Set the message into session variable
     *
     * @return boolean
     */
    public function setMessage($data)
    {
        // initialize a flash session variable
        if($this->di->session->get('flash') == null) {
            $this->di->session->set('flash', array());
        }

        // check for valid message template. Set to default if not valid
        if(!in_array($data['type'], $this->valid)) {
            $data['type'] = $this->valid[0];
        }

        $this->di->session->set('flash', ['type' => $data['type'], 'message' => $data['message']]);

        return true;
    }

    /**
     * Get the message from the session variable
     *
     * @return array $flash that contains the message type and the message string
     */
    public function getMessage()
    {
        $flash = $this->di->session->get('flash');
        $this->clear();

        return $flash;
    }

    /**
     * Clear the session variable content
     *
     * @return boolean
     */
    private function clear()
    {
        $this->di->session->set('flash', array());
        return true;
    }
}


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

namespace Apache.NMS.Stomp.Threads
{
    /// <summary>
    /// A TaskRunner that dedicates a single thread to running a single Task.
    /// </summary>
    public class CompositeTaskRunner : TaskRunner
    {
        private readonly Mutex mutex = new Mutex();
        private readonly AutoResetEvent waiter = new AutoResetEvent(false);
        private readonly ManualResetEvent isShutdown = new ManualResetEvent(true);

        private readonly Thread theThread = null;
        private readonly LinkedList<CompositeTask> tasks = new LinkedList<CompositeTask>();

        private bool terminated = false;
        private bool pending = false;
        private bool shutdown = false;

        public CompositeTaskRunner()
        {
            this.theThread = new Thread(Run);
            this.theThread.IsBackground = true;
            this.theThread.Start();
        }

		public void AddTask(CompositeTask task)
		{
			lock(mutex)
			{
				this.tasks.AddLast(task);
				this.Wakeup();
			}
		}

		public void RemoveTask(CompositeTask task)
		{
			lock(mutex)
			{
				this.tasks.Remove(task);
				this.Wakeup();
			}
		}

        public void Shutdown()
        {
            Monitor.Enter(this.mutex);

            this.shutdown = true;
            this.pending = true;

            this.waiter.Set();

            // Wait till the thread stops ( no need to wait if shutdown
            // is called from thread that is shutting down)
            if(Thread.CurrentThread != this.theThread && !this.terminated)
            {
                Monitor.Exit(this.mutex);
                this.isShutdown.WaitOne();
            }
            else
            {
                Monitor.Exit(this.mutex);
            }
        }

        public void Shutdown(TimeSpan timeout)
        {
            Monitor.Enter(this.mutex);

            this.shutdown = true;
            this.pending = true;

            this.waiter.Set();

            // Wait till the thread stops ( no need to wait if shutdown
            // is called from thread that is shutting down)
            if(Thread.CurrentThread != this.theThread && !this.terminated)
            {
                Monitor.Exit(this.mutex);
                this.isShutdown.WaitOne((int)timeout.Milliseconds, false);
            }
            else
            {
                Monitor.Exit(this.mutex);
            }
        }

        public void Wakeup()
        {
            lock(mutex)
            {
                if(this.shutdown)
                {
                    return;
                }

                this.pending = true;

                this.waiter.Set();
            }
        }

        internal void Run()
        {
            lock(this.mutex)
            {
                this.isShutdown.Reset();
            }

            try
            {
                while(true)
                {
                    lock(this.mutex)
                    {
                        pending = false;

                        if(this.shutdown)
                        {
                            return;
                        }
                    }

                    if(!this.Iterate())
                    {
                        // wait to be notified.
                        Monitor.Enter(this.mutex);
                        if(this.shutdown)
                        {
                            return;
                        }

                        while(!this.pending)
                        {
                            Monitor.Exit(this.mutex);
                            this.waiter.WaitOne();
                            Monitor.Enter(this.mutex);
                        }
                        Monitor.Exit(this.mutex);
                    }
                }
            }
            catch
            {
            }
            finally
            {
                // Make sure we notify any waiting threads that thread
                // has terminated.
                Monitor.Enter(this.mutex);
                this.terminated = true;
                Monitor.Exit(this.mutex);
                this.isShutdown.Set();
            }
        }

		private bool Iterate()
		{
			lock(mutex)
			{
				foreach(CompositeTask task in this.tasks)
				{
					if(task.IsPending)
					{
						task.Iterate();

						// Always return true here so that we can check the next
						// task in the list to see if its done.
						return true;
					}
				}
			}

			return false;
		}
    }
}


text:
package org.broadinstitute.hellbender.tools.spark;

import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.broadcast.Broadcast;
import org.broadinstitute.barclay.argparser.Argument;
import org.broadinstitute.barclay.argparser.ArgumentCollection;
import org.broadinstitute.barclay.argparser.BetaFeature;
import org.broadinstitute.barclay.argparser.CommandLineProgramProperties;
import org.broadinstitute.barclay.help.DocumentedFeature;
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions;
import org.broadinstitute.hellbender.engine.spark.GATKSparkTool;
import org.broadinstitute.hellbender.tools.ApplyBQSRArgumentCollection;
import org.broadinstitute.hellbender.tools.spark.transforms.ApplyBQSRSparkFn;
import org.broadinstitute.hellbender.utils.gcs.BucketUtils;
import org.broadinstitute.hellbender.utils.read.GATKRead;
import org.broadinstitute.hellbender.utils.recalibration.RecalibrationReport;
import picard.cmdline.programgroups.ReadDataManipulationProgramGroup;

/**
 * Apply base quality score recalibration with Spark.
 *

 *
This tool performs the second pass in a two-stage process called Base Quality Score Recalibration (BQSR).
 * Specifically, it recalibrates the base qualities of the input reads based on the recalibration table produced by
 * the BaseRecalibrator tool, and outputs a recalibrated BAM or CRAM file.

 *
See Tutorial#10060
 * for an example of how to set up and run a Spark tool on a cloud Spark cluster.
 *

 *
Usage examples

 *

 * gatk ApplyBQSRSpark \
 * -I gs://my-gcs-bucket/input.bam \
 * -bqsr gs://my-gcs-bucket/recalibration.table \
 * -O gs://my-gcs-bucket/output.bam \
 * -- \
 * --sparkRunner GCS \
 * --cluster my-dataproc-cluster
 *

 *

 * To additionally bin base qualities:
 *

 * gatk ApplyBQSRSpark \
 * -I gs://my-gcs-bucket/input.bam \
 * -bqsr gs://my-gcs-bucket/recalibration.table \
 * --static-quantized-quals 10 --static-quantized-quals 20 \
 * --static-quantized-quals 30 --static-quantized-quals 40 \
 * -O gs://my-gcs-bucket/output.bam \
 * -- \
 * --sparkRunner GCS \
 * --cluster my-dataproc-cluster
 *

 */

@CommandLineProgramProperties(
        summary=ApplyBQSRSpark.USAGE_SUMMARY,
        oneLineSummary=ApplyBQSRSpark.USAGE_ONE_LINE_SUMMARY,
        programGroup = ReadDataManipulationProgramGroup.class
)

@DocumentedFeature
@BetaFeature
public final class ApplyBQSRSpark extends GATKSparkTool {
    private static final long serialVersionUID = 0l;
    static final String USAGE_ONE_LINE_SUMMARY = "Apply base quality score recalibration on Spark";
    static final String USAGE_SUMMARY = "Apply a linear base quality recalibration model trained with the BaseRecalibrator tool on Spark.";

    @Override
    public boolean requiresReads() { return true; }

    @Argument(doc = "the output bam", shortName = StandardArgumentDefinitions.OUTPUT_SHORT_NAME,
            fullName = StandardArgumentDefinitions.OUTPUT_LONG_NAME, optional = false)
    private String output;

    /**
     * Enables recalibration of base qualities.
     * The covariates tables are produced by the BaseRecalibrator tool.
     * Please be aware that you should only run recalibration with the covariates file created on the same input bam(s).
     */
    @Argument(fullName= StandardArgumentDefinitions.BQSR_TABLE_LONG_NAME, shortName= StandardArgumentDefinitions.BQSR_TABLE_SHORT_NAME, doc="Input covariates table file for base quality score recalibration")
    private String bqsrRecalFile;

    @ArgumentCollection
    private ApplyBQSRArgumentCollection applyBQSRArgs = new ApplyBQSRArgumentCollection();

    @Override
    protected void runTool(JavaSparkContext ctx) {
        JavaRDD<GATKRead> initialReads = getReads();
        Broadcast<RecalibrationReport> recalibrationReportBroadCast = ctx.broadcast(new RecalibrationReport(BucketUtils.openFile(bqsrRecalFile)));
        final JavaRDD<GATKRead> recalibratedReads = ApplyBQSRSparkFn.apply(initialReads, recalibrationReportBroadCast, getHeaderForReads(), applyBQSRArgs);
        writeReads(ctx, output, recalibratedReads);
    }
}


text:
export canConfigureName from './canConfigureName';
export getPropertiesList from './getPropertiesList';
export isObject from './isObject';
export muteProperty from './muteProperty';
export prepareArguments from './prepareArguments';
export typeReviver from './typeReviver';
export typeReplacer from './typeReplacer';
export omitProperty from './omitProperty';


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* WorksheetPage.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Xml.Serialization;

using AM;
using AM.Collections;
using AM.IO;
using AM.Runtime;

using CodeJam;

using JetBrains.Annotations;

using MoonSharp.Interpreter;

using Newtonsoft.Json;

#endregion

namespace ManagedIrbis.Worksheet
{
    /// <summary>
    ///
    /// </summary>
    [PublicAPI]
    [XmlRoot("page")]
    [MoonSharpUserData]
    public sealed class WorksheetPage
        : IHandmadeSerializable,
        IVerifiable
    {
        #region Properties

        /// <summary>
        /// Имя страницы.
        /// </summary>
        [CanBeNull]
        [XmlElement("name")]
        [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
        public string Name { get; set; }

        /// <summary>
        /// Элементы страницы.
        /// </summary>
        [NotNull]
        [XmlElement("item")]
        [JsonProperty("items")]
        public NonNullCollection<WorksheetItem> Items { get; private set; }

        /// <summary>
        /// Arbitrary user data.
        /// </summary>
        [CanBeNull]
        [XmlIgnore]
        [JsonIgnore]
        [Browsable(false)]
        public object UserData { get; set; }

        #endregion

        #region Construction

        /// <summary>
        /// Constructor.
        /// </summary>
        public WorksheetPage()
        {
            Items = new NonNullCollection<WorksheetItem>();
        }

        #endregion

        #region Public methods

        /// <summary>
        /// Encode the page.
        /// </summary>
        public void Encode
            (
                [NotNull] TextWriter writer
            )
        {
            Code.NotNull(writer, "writer");

            foreach (WorksheetItem item in Items)
            {
                item.Encode(writer);
            }
        }

        /// <summary>
        /// Разбор потока.
        /// </summary>
        [NotNull]
        public static WorksheetPage ParseStream
            (
                [NotNull] TextReader reader,
                [NotNull] string name,
                int count
            )
        {
            Code.NotNull(reader, "reader");

            WorksheetPage result = new WorksheetPage
            {
                Name = name
            };

            for (int i = 0; i < count; i++)
            {
                WorksheetItem item = WorksheetItem.ParseStream(reader);
                result.Items.Add(item);
            }

            return result;
        }

        /// <summary>
        /// Should serialize the <see cref="Items"/> collection?
        /// </summary>
        [ExcludeFromCodeCoverage]
        [EditorBrowsable(EditorBrowsableState.Never)]
        public bool ShouldSerializeItems()
        {
            return Items.Count != 0;
        }

        #endregion

        #region IHandmadeSerializable members

        /// <inheritdoc cref="IHandmadeSerializable.RestoreFromStream" />
        public void RestoreFromStream
            (
                BinaryReader reader
            )
        {
            Code.NotNull(reader, "reader");

            Name = reader.ReadNullableString();
            Items = reader.ReadNonNullCollection<WorksheetItem>();
        }

        /// <inheritdoc cref="IHandmadeSerializable.SaveToStream" />
        public void SaveToStream
            (
                BinaryWriter writer
            )
        {
            Code.NotNull(writer, "writer");

            writer.WriteNullable(Name);
            writer.Write(Items);
        }

        #endregion

        #region IVerifiable members

        /// <inheritdoc cref="IVerifiable.Verify" />
        public bool Verify
            (
                bool throwOnError
            )
        {
            Verifier<WorksheetPage> verifier
                = new Verifier<WorksheetPage>(this, throwOnError);

            verifier
                .NotNullNorEmpty(Name, "Name")
                .Assert
                    (
                        Items.Count != 0,
                        "Items.Count != 0"
                    );

            foreach (WorksheetItem item in Items)
            {
                verifier.VerifySubObject
                    (
                        item,
                        "Item"
                    );
            }

            return verifier.Result;
        }

        #endregion

        #region Object members

        /// <inheritdoc cref="object.ToString" />
        public override string ToString()
        {
            return Name.ToVisibleString();
        }

        #endregion
    }
}


text:
"use strict";

const color = require('kleur');

const Prompt = require('./prompt');

const _require = require('../util'),
      style = _require.style;

const _require2 = require('sisteransi'),
      erase = _require2.erase,
      cursor = _require2.cursor;
/**
 * ConfirmPrompt Base Element
 * @param {Object} opts Options
 * @param {String} opts.message Message
 * @param {Boolean} [opts.initial] Default value (true/false)
 * @param {Stream} [opts.stdin] The Readable stream to listen to
 * @param {Stream} [opts.stdout] The Writable stream to write readline data to
 * @param {String} [opts.yes] The "Yes" label
 * @param {String} [opts.yesOption] The "Yes" option when choosing between yes/no
 * @param {String} [opts.no] The "No" label
 * @param {String} [opts.noOption] The "No" option when choosing between yes/no
 */

class ConfirmPrompt extends Prompt {
  constructor(opts = {}) {
    super(opts);
    this.msg = opts.message;
    this.value = opts.initial;
    this.initialValue = !!opts.initial;
    this.yesMsg = opts.yes || 'yes';
    this.yesOption = opts.yesOption || '(Y/n)';
    this.noMsg = opts.no || 'no';
    this.noOption = opts.noOption || '(y/N)';
    this.render();
  }

  reset() {
    this.value = this.initialValue;
    this.fire();
    this.render();
  }

  abort() {
    this.done = this.aborted = true;
    this.fire();
    this.render();
    this.out.write('\n');
    this.close();
  }

  submit() {
    this.value = this.value || false;
    this.done = true;
    this.aborted = false;
    this.fire();
    this.render();
    this.out.write('\n');
    this.close();
  }

  _(c, key) {
    if (c.toLowerCase() === 'y') {
      this.value = true;
      return this.submit();
    }

    if (c.toLowerCase() === 'n') {
      this.value = false;
      return this.submit();
    }

    return this.bell();
  }

  render() {
    if (this.closed) return;
    if (this.firstRender) this.out.write(cursor.hide);
    super.render();
    this.out.write(erase.line + cursor.to(0) + [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(' '));
  }

}

module.exports = ConfirmPrompt;


text:
require 'ostruct'

require_relative '../../VmsFromYaml'
require 'disk/MiqDisk'
require 'fs/ext3/superblock'

class Ext3TestSuperblock < Minitest::Test
  CONDITIONS = ['fs_type', 'ext3']
  TEST_DB = "#{File.dirname(__FILE__)}/../../vms.yml"

  def initialize(obj)
    # puts "Ext3:tc_ext3_superblock"
    @num_tests = 0
    super(obj)
  end

  def setup
    vms = VmsFromYaml.new(TEST_DB)
    @disk_specs = vms.find_vms_with_criteria(CONDITIONS)
    # puts "Ext3:tc_ext3_superblock:setup found #{@disk_specs.size} VMs"
    @disks = []
    @disk_specs.each do |spec|
      di = OpenStruct.new
      di.fileName = spec['location']
      di.rawDisk = di.fileName.include?('-flat') ? true : false
      dk = MiqDisk.getDisk(di)
      if dk
        thisDisk = OpenStruct.new('info' => di, 'dk' => dk)
        thisDisk.sb = Ext3::Superblock.new(dk.getPartitions[spec['vm_system_partition']])
        @disks << thisDisk
      else
        @disks << nil
        puts "\ntc_ext3_superblock: no disk for #{di.fileName}"
        puts "Spec is:\n#{spec.inspect}"
      end
    end
  end

  def teardown
    @disks.each do |disk|
      next if disk.nil?
      res, h = disk.dk.close if disk.dk
      if h
        puts "Got an invalid handle back from close on #{disk.info.fileName} in #{__FILE__}" if h == -1
      end
    end
  end

  def test_ext3_superblock
    @num_tests += 1
    @disks.each do |disk|
      next if disk.nil?
      if disk.sb
        # puts "\ntc_ext3_superblock: Testing Superblock on #{disk.info.fileName}"
        assert_equal(disk.sb.blockSize >= 1024, true, id(__LINE__, disk))
        assert_equal(disk.sb.blockSize <= 4096, true, id(__LINE__, disk))
        assert_equal(disk.sb.blockSize, disk.sb.fragmentSize, id(__LINE__, disk))
        assert_equal(disk.sb.blocksPerGroup, disk.sb.fragmentsPerGroup, id(__LINE__, disk))
      else
        puts "\ntc_ext3_superblock: Superblock is nil at line #{__LINE__} on #{disk.info.fileName}"
      end
    end
  end

  def test_ext3_superblock_inodes
    @num_tests += 1
    @disks.each do |disk|
      next if disk.nil?
      if disk.sb
        # puts "\ntc_ext3_superblock: Testing inodes on #{disk.info.fileName}"
        disk.sb.numInodes.times {|inode|
          assert_nothing_raised(id(__LINE__, disk)) { disk.sb.getInode(inode) if disk.sb.isValidInode?(inode) }
        }
      else
        puts "\ntc_ext3_superblock: Superblock is nil at line #{__LINE__} on #{disk.info.fileName}"
      end
    end
  end

  def test_ext3_superblock_blocks
    if $miq_test_deep
      @num_tests += 1
      @disks.each do |disk|
        next if disk.nil?
        if disk.sb
          # puts "\ntc_ext3_superblock: Testing blocks on #{disk.info.fileName}"
          disk.sb.numBlocks.times {|block|
            assert_nothing_raised(id(__LINE__, disk)) { disk.sb.getBlock(block) if disk.sb.isValidBlock?(block) }
          }
        else
          puts "/ntc_ext3_superblock: Superblock is nil at line #{__LINE__} on #{disk.info.fileName}"
        end
      end
    end
  end

  def enum_ext3_superblock_all_blocks
    if $miq_test_deep
      @num_tests += 1
      @disks.each do |disk|
        next if disk.nil?
        if disk.sb
          disk.sb.numBlocks.times {|block|
            assert_nothing_raised(id(__LINE__, disk)) { disk.sb.getBlock(block, true) }
          }
        end
      end
    end
  end

  def id(line, disk)
    "Failure: Line #{line}, File: #{__FILE__}, Disk: #{disk.info.fileName}"
  end
end


text:
<?php defined('SYSPATH') or die('No direct script access.');

class Config_Database extends Kohana_Config_Database {}


text:
package com.google.cloud.bigtable.hbase.mirroring.utils.compat;

import java.io.IOException;
import org.apache.hadoop.hbase.client.Connection;

/**
 * Integration tests in bigtable-hbase-mirroring-client-1.x-integration-tests project are used to
 * test both 1.x MirroringConnection and 2.x MirroringConnection. This interface provides a
 * compatibility layer between 1.x and 2.x for creating a table and is used only in ITs.
 */
public interface TableCreator {
  void createTable(Connection connection, String tableName, byte[]... columnFamilies)
      throws IOException;
}


text:
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
    Created on : 14 Sep 14, 18:21:37
    Author     : Joko
*/

.spotlight {
    left: 45%;
    bottom: 23em;
    position: absolute;
    width: 250px;
    z-index: 999;
}
.light-1, .light-2 { position: absolute; }
.light-1 { left: 0; bottom: 0; }
.light-2 { left: 57%; bottom: -7px; }

.thin-spotlight {
    width: 401px;
    position: absolute;
    z-index: 999;
    bottom: 22em;
    left: 34%;
}
.thin-light-1, .thin-light-2 { position: absolute; }
.thin-light-1 { left: 0; bottom: 0; }
.thin-light-2 { right: -6%; bottom: -10px; }

@media (max-width: 1280px) {
    .spotlight { bottom: 21em; }
    .light-2 { bottom: 5px; }
    .thin-spotlight {
        bottom: 21em;
        left: 35%;
    }
    .thin-light-2 { right: 0; }
}
@media (min-width: 1920px) {
    .spotlight { bottom: 32em; }
    .light-2 { left: 80%; bottom: 0; }
    .thin-spotlight {
        bottom: 31em;
        left: 28%;
    }
    .thin-light-2 { right: -47%; }
}

.light-1 .animation {
    animation: left-animate-50d linear 6s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: left-animate-50d linear 6s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: left-animate-50d linear 6s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: left-animate-50d linear 6s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: left-animate-50d linear 6s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.light-2 .animation{
    animation: right-animate-50d linear 8s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: right-animate-50d linear 8s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: right-animate-50d linear 8s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: right-animate-50d linear 8s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: right-animate-50d linear 8s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.light-3 .animation {
    animation: left-animate-50d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: left-animate-50d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: left-animate-50d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: left-animate-50d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: left-animate-50d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.light-4 .animation{
    animation: right-animate-50d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: right-animate-50d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: right-animate-50d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: right-animate-50d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: right-animate-50d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.light-5 .animation {
    animation: left-animate-20d linear 6s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: left-animate-20d linear 6s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: left-animate-20d linear 6s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: left-animate-20d linear 6s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: left-animate-20d linear 6s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.light-6 .animation{
    animation: right-animate-20d linear 6s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: right-animate-20d linear 6s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: right-animate-20d linear 6s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: right-animate-20d linear 6s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: right-animate-20d linear 6s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.thin-light-1 .animation {
    animation: left-animate-50d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: left-animate-50d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: left-animate-50d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: left-animate-50d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: left-animate-50d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.thin-light-2 .animation{
    animation: right-animate-20d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: right-animate-20d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: right-animate-20d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: right-animate-20d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: right-animate-20d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.thin-light-3 .animation{
    animation: left-animate-20d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: left-animate-20d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: left-animate-20d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: left-animate-20d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: left-animate-20d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

.thin-light-4 .animation{
    animation: right-animate-50d linear 10s;
    animation-iteration-count: infinite;
    transform-origin: 50% 100%;
    -webkit-animation: right-animate-50d linear 10s;
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 50% 100%;
    -moz-animation: right-animate-50d linear 10s;
    -moz-animation-iteration-count: infinite;
    -moz-transform-origin: 50% 100%;
    -o-animation: right-animate-50d linear 10s;
    -o-animation-iteration-count: infinite;
    -o-transform-origin: 50% 100%;
    -ms-animation: right-animate-50d linear 10s;
    -ms-animation-iteration-count: infinite;
    -ms-transform-origin: 50% 100%;
}

/* left animate 50d */
@keyframes left-animate-50d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-moz-keyframes left-animate-50d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-webkit-keyframes left-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-o-keyframes left-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-ms-keyframes left-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}

/* left animate 20d */
@keyframes left-animate-20d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-moz-keyframes left-animate-20d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-webkit-keyframes left-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-o-keyframes left-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-ms-keyframes left-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(-20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}

/* right animate 50d */
@keyframes right-animate-50d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-moz-keyframes right-animate-50d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-webkit-keyframes right-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-o-keyframes right-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-ms-keyframes right-animate-50d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-50deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(50deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}

/* right animate 20d */
@keyframes right-animate-20d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-moz-keyframes right-animate-20d{
    0% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-webkit-keyframes right-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-o-keyframes right-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}
@-ms-keyframes right-animate-20d {
    0% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg) ; }
    50% { transform:  rotate(-20deg); }
    100% { left:0px; top:0px; opacity:1; transform:  rotate(20deg) scaleX(1) scaleY(1) skewX(0deg) skewY(0deg);}
}


text:
.class Lcom/android/internal/telephony/cat/PlayToneParams;
.super Lcom/android/internal/telephony/cat/CommandParams;
.source "CommandParams.java"

# instance fields
.field mSettings:Lcom/android/internal/telephony/cat/ToneSettings;

.field mTextMsg:Lcom/android/internal/telephony/cat/TextMessage;

# direct methods
.method constructor <init>(Lcom/android/internal/telephony/cat/CommandDetails;Lcom/android/internal/telephony/cat/TextMessage;Lcom/android/internal/telephony/cat/Tone;Lcom/android/internal/telephony/cat/Duration;Z)V
    .locals 1
    .param p1, "cmdDet"    # Lcom/android/internal/telephony/cat/CommandDetails;
    .param p2, "textMsg"    # Lcom/android/internal/telephony/cat/TextMessage;
    .param p3, "tone"    # Lcom/android/internal/telephony/cat/Tone;
    .param p4, "duration"    # Lcom/android/internal/telephony/cat/Duration;
    .param p5, "vibrate"    # Z

    .prologue
    .line 123
    invoke-direct {p0, p1}, Lcom/android/internal/telephony/cat/CommandParams;-><init>(Lcom/android/internal/telephony/cat/CommandDetails;)V

    .line 124
    iput-object p2, p0, Lcom/android/internal/telephony/cat/PlayToneParams;->mTextMsg:Lcom/android/internal/telephony/cat/TextMessage;

    .line 125
    new-instance v0, Lcom/android/internal/telephony/cat/ToneSettings;

    invoke-direct {v0, p4, p3, p5}, Lcom/android/internal/telephony/cat/ToneSettings;-><init>(Lcom/android/internal/telephony/cat/Duration;Lcom/android/internal/telephony/cat/Tone;Z)V

    iput-object v0, p0, Lcom/android/internal/telephony/cat/PlayToneParams;->mSettings:Lcom/android/internal/telephony/cat/ToneSettings;

    .line 126
    return-void
.end method

# virtual methods
.method setIcon(Landroid/graphics/Bitmap;)Z
    .locals 1
    .param p1, "icon"    # Landroid/graphics/Bitmap;

    .prologue
    .line 130
    if-eqz p1, :cond_0

    iget-object v0, p0, Lcom/android/internal/telephony/cat/PlayToneParams;->mTextMsg:Lcom/android/internal/telephony/cat/TextMessage;

    if-eqz v0, :cond_0

    .line 131
    iget-object v0, p0, Lcom/android/internal/telephony/cat/PlayToneParams;->mTextMsg:Lcom/android/internal/telephony/cat/TextMessage;

    iput-object p1, v0, Lcom/android/internal/telephony/cat/TextMessage;->icon:Landroid/graphics/Bitmap;

    .line 132
    const/4 v0, 0x1

    .line 134
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


text:
package dao

import (
	"context"
	"strconv"
	"time"

	"go-common/app/job/main/credit-timer/model"
	"go-common/library/database/sql"
	"go-common/library/log"
)

const (
	_updateKPISQL         = "INSERT INTO blocked_kpi(mid,day,rate,rank,rank_per,rank_total) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE rate=?,rank=?,rank_per=?,rank_total=?"
	_updateKPIDataSQL     = "INSERT INTO blocked_kpi_data(mid,day,point,active_days,vote_total,vote_radio,blocked_total,opinion_num,opinion_likes,opinion_hates,vote_real_total) VALUES (?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE point=?,active_days=?,vote_total=?,vote_radio=?,blocked_total=?,opinion_num=?,opinion_likes=?,opinion_hates=?,vote_real_total=?"
	_updateKPIPointSQL    = "INSERT INTO blocked_kpi_point(mid,day,point,active_days,vote_total,vote_radio,blocked_total,opinion_num,opinion_likes,opinion_hates) VALUES (?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE point=?,active_days=?,vote_total=?,vote_radio=?,blocked_total=?,opinion_num=?,opinion_likes=?,opinion_hates=?"
	_updateCaseEndTimeSQL = "UPDATE blocked_case SET status=3 WHERE status = 1 AND end_time < ?"
	_updateCaseEndVoteSQL = "UPDATE blocked_case SET end_time=? WHERE status = 1 AND end_time > ? AND (vote_rule+vote_break+vote_delete) >= ?"
	_updateJurySQL        = "UPDATE blocked_jury SET status=2,invalid_reason=? WHERE status=1 AND expired < ?"
	_updateJuryExpiredSQL = "UPDATE blocked_jury SET status=1, expired=? WHERE mid =  ?"
	_updateVoteSQL        = "UPDATE blocked_case_vote SET vote=3 WHERE vote=0 AND expired > ? AND expired < ? "
	_selConfSQL           = "SELECT config_key,content FROM blocked_config"
	_selJurySQL           = "SELECT mid FROM blocked_jury WHERE status=1"
	_selJuryKPISQL        = "SELECT mid FROM blocked_jury WHERE expired BETWEEN ? AND ?"
	_countVoteTotalSQL    = "SELECT COUNT(*) FROM blocked_case_vote v INNER JOIN blocked_case c ON c.id=v.cid AND c.status=4 WHERE v.mid = ? AND v.vote IN (1,2,4) AND v.ctime BETWEEN ? AND ?"
	_countRightViolateSQL = "SELECT COUNT(*) FROM blocked_case_vote v INNER JOIN blocked_case c ON c.id=v.cid AND v.vote IN(1,4) AND c.judge_type = 1 AND c.status=4 WHERE v.mid = ? AND v.ctime BETWEEN ? AND ?"
	_countRightLegalSQL   = "SELECT COUNT(*) FROM blocked_case_vote v INNER JOIN blocked_case c ON c.id=v.cid AND v.vote = 2 AND c.judge_type = 2 AND c.status=4 WHERE v.mid = ? AND v.ctime BETWEEN ? AND ?"
	_CountBlockedSQL      = "SELECT COUNT(*) FROM blocked_info WHERE uid = ? AND status=0 AND ctime BETWEEN ? AND ?"
	_selKPIPointDaySQL    = "SELECT k.mid,k.day,k.point,k.active_days,k.vote_total,k.vote_radio,k.blocked_total,k.opinion_num,k.opinion_likes,k.opinion_hates,j.expired FROM blocked_kpi_point k INNER JOIN blocked_jury j ON k.mid = j.mid WHERE day = ? ORDER BY k.point desc"
	_selKPIPointSQL       = "SELECT mid,day,point,active_days,vote_total,vote_radio,blocked_total FROM blocked_kpi_point WHERE mid = ? AND day = ? ORDER BY point desc"
	_selKPISQL            = "SELECT mid,day,rate,rank,rank_per,rank_total FROM blocked_kpi WHERE mid = ?"
	_countActiveSQL       = "SELECT COUNT(*) FROM (SELECT DATE_FORMAT(ctime,'%Y-%m-%d') FROM blocked_case_vote WHERE vote IN(1,2,4) AND mid=? AND ctime BETWEEN ? AND ? GROUP BY DATE_FORMAT(ctime,'%Y-%m-%d')) t"
	_countOpinionSQL      = "SELECT COUNT(*) FROM blocked_opinion WHERE mid = ? AND state = 0 AND ctime BETWEEN ? AND ?"
	_opinionQualitySQL    = "SELECT COALESCE(SUM(likes),0),COALESCE(SUM(hates),0) FROM blocked_opinion WHERE mid = ? AND state = 0 AND ctime BETWEEN ? AND ?"
	_countVoteByTimeSQL   = "SELECT count(*) from blocked_case_vote where vote in(1,2,4) and mid=? and ctime between ? and ?"
)

// UpdateKPI update KPI info.
func (d *Dao) UpdateKPI(c context.Context, r *model.Kpi) (err error) {
	if _, err = d.db.Exec(c, _updateKPISQL, r.Mid, r.Day, r.Rate, r.Rank, r.RankPer, r.RankTotal, r.Rate, r.Rank, r.RankPer, r.RankTotal); err != nil {
		log.Error("d.UpdateKPI err(%v)", err)
	}
	return
}

// UpdateKPIData update kpi_data info.
func (d *Dao) UpdateKPIData(c context.Context, r *model.KpiData) (err error) {
	if _, err = d.db.Exec(c, _updateKPIDataSQL, r.Mid, r.Day, r.Point, r.ActiveDays, r.VoteTotal, r.VoteRadio, r.BlockedTotal, r.OpinionNum, r.OpinionLikes, r.OpinionHates, r.VoteRealTotal, r.Point, r.ActiveDays, r.VoteTotal, r.VoteRadio, r.BlockedTotal, r.OpinionNum, r.OpinionLikes, r.OpinionHates, r.VoteRealTotal); err != nil {
		log.Error("d.UpdateKPIPoint err(%v)", err)
	}
	return
}

// UpdateKPIPoint update kpi point info.
func (d *Dao) UpdateKPIPoint(c context.Context, r *model.KpiPoint) (err error) {
	if _, err = d.db.Exec(c, _updateKPIPointSQL, r.Mid, r.Day, r.Point, r.ActiveDays, r.VoteTotal, r.VoteRadio, r.BlockedTotal, r.OpinionNum, r.OpinionLikes, r.OpinionHates, r.Point, r.ActiveDays, r.VoteTotal, r.VoteRadio, r.BlockedTotal, r.OpinionNum, r.OpinionLikes, r.OpinionHates); err != nil {
		log.Error("d.UpdateKPIPoint err(%v)", err)
	}
	return
}

// UpdateCaseEndTime update case status to CaseStatusDealing which expired time less than now.
func (d *Dao) UpdateCaseEndTime(c context.Context, now time.Time) (affect int64, err error) {
	rows, err := d.db.Exec(c, _updateCaseEndTimeSQL, now)
	if err != nil {
		log.Error("d.UpdateCaseEndTime err(%v)", err)
		return
	}
	return rows.RowsAffected()
}

// UpdateCaseEndVote update case status to CaseStatusDealing which vote total more than conf case vote total.
func (d *Dao) UpdateCaseEndVote(c context.Context, vt int64, ts time.Time) (affect int64, err error) {
	rows, err := d.db.Exec(c, _updateCaseEndVoteSQL, ts, ts, vt)
	if err != nil {
		log.Error("d.UpdateCaseEndVote err(%v)", err)
		return
	}
	return rows.RowsAffected()
}

// UpdateJury update jury status to expired which expired time less than ts.
func (d *Dao) UpdateJury(c context.Context, now time.Time) (affect int64, err error) {
	rows, err := d.db.Exec(c, _updateJurySQL, model.JuryExpire, now)
	if err != nil {
		log.Error("d.UpdateJury err(%v)", err)
		return
	}
	return rows.RowsAffected()
}

// UpdateJuryExpired update jury expired.
func (d *Dao) UpdateJuryExpired(c context.Context, mid int64, expired time.Time) (err error) {
	if _, err = d.db.Exec(c, _updateJuryExpiredSQL, expired, mid); err != nil {
		log.Error("d.UpdateJuryExpired err(%v)", err)
	}
	return
}

// UpdateVote update vote status to give up which do not vote and expired less than ts.
func (d *Dao) UpdateVote(c context.Context, now time.Time) (affect int64, err error) {
	rows, err := d.db.Exec(c, _updateVoteSQL, now.Add(-4*time.Hour), now)
	if err != nil {
		log.Error("d.updateVote err(%v)", err)
		return
	}
	return rows.RowsAffected()
}

// LoadConf load conf.
func (d *Dao) LoadConf(c context.Context) (vTotal int64, err error) {
	var (
		key   string
		value string
	)
	rows, err := d.db.Query(c, _selConfSQL)
	if err != nil {
		log.Error("d.loadConf err(%v)", err)
		return
	}
	defer rows.Close()
	for rows.Next() {
		if err = rows.Scan(&key, &value); err != nil {
			log.Error("rows.Scan err(%v)", err)
			return
		}
		switch key {
		case "case_vote_max":
			if vTotal, err = strconv.ParseInt(value, 10, 64); err != nil {
				return
			}
		}
	}
	err = rows.Err()
	return
}

// JuryList get jury list.
func (d *Dao) JuryList(c context.Context) (res []int64, err error) {
	var rows *sql.Rows
	if rows, err = d.db.Prepared(_selJurySQL).Query(c); err != nil {
		log.Error("dao.JuryList error(%v)", err)
		return
	}
	defer rows.Close()
	for rows.Next() {
		var r int64
		if err = rows.Scan(&r); err != nil {
			log.Error("row.Scan() error(%v)", err)
			res = nil
			return
		}
		res = append(res, r)
	}
	err = rows.Err()
	return
}

// JuryKPI get jury list.
func (d *Dao) JuryKPI(c context.Context, begin, end string) (res []int64, err error) {
	var rows *sql.Rows
	if rows, err = d.db.Prepared(_selJuryKPISQL).Query(c, begin, end); err != nil {
		log.Error("dao.JuryKPI error(%v)", err)
		return
	}
	defer rows.Close()
	for rows.Next() {
		var r int64
		if err = rows.Scan(&r); err != nil {
			log.Error("row.Scan() error(%v)", err)
			res = nil
			return
		}
		res = append(res, r)
	}
	err = rows.Err()
	return
}

// CountVoteTotal get vote total.
func (d *Dao) CountVoteTotal(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _countVoteTotalSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountVoteTotal err(%v)", err)
	}
	return
}

// CountVoteRightViolate get vote right violate count.
func (d *Dao) CountVoteRightViolate(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _countRightViolateSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountVoteRightViolate err(%v)", err)
	}
	return
}

// CountVoteRightLegal get vote right legal count.
func (d *Dao) CountVoteRightLegal(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _countRightLegalSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountVoteRightLegal err(%v)", err)
	}
	return
}

// CountBlocked get user block count ofter ts.
func (d *Dao) CountBlocked(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _CountBlockedSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountBlocked err(%v)", err)
	}
	return
}

// KPIPointDay get KPI point day list.
func (d *Dao) KPIPointDay(c context.Context, day string) (res []model.KpiPoint, err error) {
	var rows *sql.Rows
	if rows, err = d.db.Query(c, _selKPIPointDaySQL, day); err != nil {
		log.Error("dao.JuryKpi error(%v)", err)
		return
	}
	defer rows.Close()
	for rows.Next() {
		r := model.KpiPoint{}
		if err = rows.Scan(&r.Mid, &r.Day, &r.Point, &r.ActiveDays, &r.VoteTotal, &r.VoteRadio, &r.BlockedTotal, &r.OpinionNum, &r.OpinionLikes, &r.OpinionHates, &r.Expired); err != nil {
			log.Error("row.Scan() error(%v)", err)
			res = nil
			return
		}
		res = append(res, r)
	}
	err = rows.Err()
	return
}

// KPIPoint get kpi point.
func (d *Dao) KPIPoint(c context.Context, mid int64, day string) (r model.KpiPoint, err error) {
	row := d.db.QueryRow(c, _selKPIPointSQL, mid, day)
	if err = row.Scan(&r.Mid, &r.Day, &r.Point, &r.ActiveDays, &r.VoteTotal, &r.VoteRadio, &r.BlockedTotal); err != nil {
		log.Error("d.KPIPoint err(%v)", err)
	}
	return
}

// KPIList get kpi list.
func (d *Dao) KPIList(c context.Context, mid int64) (res []model.Kpi, err error) {
	var rows *sql.Rows
	if rows, err = d.db.Query(c, _selKPISQL, mid); err != nil {
		log.Error("dao.KPIList error(%v)", err)
		return
	}
	defer rows.Close()
	for rows.Next() {
		r := model.Kpi{}
		if err = rows.Scan(&r.Mid, &r.Day, &r.Rate, &r.Rank, &r.RankPer, &r.RankTotal); err != nil {
			log.Error("row.Scan() error(%v)", err)
			res = nil
			return
		}
		res = append(res, r)
	}
	err = rows.Err()
	return
}

// CountVoteActive get vote active days count.
func (d *Dao) CountVoteActive(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _countActiveSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountVoteActive err(%v)", err)
	}
	return
}

// CountOpinion count user opinion in 30 days.
func (d *Dao) CountOpinion(c context.Context, mid int64, begin, end string) (count int64, err error) {
	row := d.db.QueryRow(c, _countOpinionSQL, mid, begin, end)
	if err = row.Scan(&count); err != nil {
		log.Error("d.CountOpinion(mid:%d begin:%s end:%s) err(%v)", mid, begin, end, err)
	}
	return
}

// OpinionQuality count user opinion quality(fields likes - hates) in 30days.
func (d *Dao) OpinionQuality(c context.Context, mid int64, begin, end string) (likes, hates int64, err error) {
	row := d.db.QueryRow(c, _opinionQualitySQL, mid, begin, end)
	if err = row.Scan(&likes, &hates); err != nil {
		if err != sql.ErrNoRows {
			log.Error("d.OpinionQuality(mid:%d begin:%s end:%s) err(%v)", mid, begin, end, err)
			return
		}
		err = nil
	}
	return
}

// CountVoteByTime count vote by time.
func (d *Dao) CountVoteByTime(c context.Context, mid int64, begin, end time.Time) (count int64, err error) {
	var row *sql.Row
	if row = d.db.QueryRow(c, _countVoteByTimeSQL, mid, begin, end); err != nil {
		log.Error("d.CountVoteByTime.Query(%d) error(%v)", mid, err)
		return
	}
	if err = row.Scan(&count); err != nil {
		log.Error("row.Scan() error(%v)", err)
	}
	return
}


text:
package io.crate.breaker;

import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.RamUsageEstimator;

import javax.annotation.Nullable;

public final class StringSizeEstimator extends SizeEstimator<String> {

    public static final StringSizeEstimator INSTANCE = new StringSizeEstimator();
    /**
     * In this base value, we account for the {@link BytesRef} object itself as
     * well as the header of the byte[] array it holds, and some lost bytes due
     * to object alignment. So consumers of this constant just have to add the
     * length of the byte[] (assuming it is not shared between multiple
     * instances). */
    private static final long BASE_BYTES_PER_BYTES_REF =
        // shallow memory usage of the BytesRef object
        RamUsageEstimator.shallowSizeOfInstance(BytesRef.class) +
        // header of the byte[] array
        RamUsageEstimator.NUM_BYTES_ARRAY_HEADER +
        // with an alignment size (-XX:ObjectAlignmentInBytes) of 8 (default),
        // there could be between 0 and 7 lost bytes, so we account for 3
        // lost bytes on average
        3;

    private StringSizeEstimator() {
    }

    public static long estimate(@Nullable String value) {
        return RamUsageEstimator.sizeOf(value);
    }

    @Override
    public long estimateSize(@Nullable String value) {
        return RamUsageEstimator.sizeOf(value);
    }

    public static long estimateSize(@Nullable BytesRef value) {
        if (value == null) {
            return 8;
        }
        return RamUsageEstimator.alignObjectSize(BASE_BYTES_PER_BYTES_REF + value.length);
    }
}


text:
  /**
   * Converts a Promise to an Observable sequence
   * @param {Promise} An ES6 Compliant promise.
   * @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
   */
  var observableFromPromise = Observable.fromPromise = function (promise) {
    return observableDefer(function () {
      var subject = new Rx.AsyncSubject();

      promise.then(
        function (value) {
          if (!subject.isDisposed) {
            subject.onNext(value);
            subject.onCompleted();
          }
        },
        subject.onError.bind(subject));

      return subject;
    });
  };


text:
package org.broadleafcommerce.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * Form of ServiceException thrown when their is a security
 * failure while attempting to execute the operation.
 *
 * @author Jeff Fischer
 */
@ResponseStatus(value= HttpStatus.FORBIDDEN, reason="Access is denied")
public class SecurityServiceException extends ServiceException {

    public SecurityServiceException() {
        super();
    }

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

    public SecurityServiceException(String message) {
        super(message);
    }

    public SecurityServiceException(String message, Throwable cause) {
        super(message, cause);
    }
}


text:
layout: kanji
v4: 1645
v6: 1774
kanji: 緯
keyword: horizontal
elements: horizontal, thread, spiderman, locket, stick, key, mouth, monocle, sunglasses with one lens missing
strokes: 16
image: E7B7AF
on-yomi: イ
kun-yomi: よこいと、ぬき
permalink: /rtk/緯/
prev: 違
next: 衛
---

1) [notgoing2argue] 31-8-2007(311): Spiderman buys a locket for Mary Jane because he wants to get HORIZONTAL with her.

2) [akrodha] 31-5-2007(54): Spiderman on a boat, marking the Earth's latitudes. He first attaches a personal locket to a small piece of thread for ballast and good luck, and shoots with his right hand. After a few minutes (and lots and lots of thread), the locket and thread have flown around the world. Spiderman catches the locket with his left hand, and ties the thread's ends together. Voilà.

3) [fuaburisu] 21-1-2006(27): Hint : this kanji also means "latitude", which are the horizontal lines on a globe. Do you remember James Heisig's story for frame 175 "black ink" ? Here a cartographer on a ship, is using his "thread locket" to mark horizontal lines on a map. He pulls a chalked thread from the locket, and snaps it to mark horizontal lines. Imagine the "thread-locket" in the shape of a globe, filled with dark powder and a little bobbin of thread.

4) [scotty28] 14-12-2009(17): Spiderman gave up being spiderman and promised Mary Jane to live the horizontal life like the rest of us. Whenever he starts to feel like he wants to go back to his spidy ways, he takes out his locket with a mary jane picture to remind him that he will forever live horizontaly.

5) [lifeflaw] 26-3-2009(13): Imagine yourself tie a locket to the end of a thread and spin it horizontally..


text:
Rails.application.routes.draw do

  mount Resurrection::Engine => "/resurrection"
end


text:
namespace PivotalTrackerDotNet.Domain
{
    public class SearchResultContainer
    {
        public string Query { get; set; }
        public StoriesSearchResult Stories { get; set; }
        public EpicsSearchResult  Epics { get; set; }
        public string Kind { get; set; }
    }
}


text:
class Tangent : public UnaryOperator
{
protected:
	Tangent(const Tangent&);

public:
	Tangent(ExpressionTree* = 0);

	ExpressionTree* Clone() const;
	std::string ToString() const;
	double Evaluate() const;
};

#endif


text:
#include <stdio.h>
#include <unistd.h>
#include "vectornav.h"

/* Change the connection settings to your configuration. */
const char* PORT_NAME = "//dev//ttyS1";
const int BAUDRATE = 115200;

void errorCodeReceivedListener(void* sender, VN_ERROR_CODE errorCode);

int main()
{
	Vn200 vn200;
	int errorCode;

	errorCode = vn200_connect(&vn200, PORT_NAME, BAUDRATE);

	if (errorCode != VNERR_NO_ERROR)
	{
		printf("Error trying to connect to sensor.\n");

		return 0;
	}

	errorCode = vn200_registerErrorCodeReceivedListener(
		&vn200,
		&errorCodeReceivedListener);

	if (errorCode != VNERR_NO_ERROR)
	{
		printf("Error attempting to register our errorCodeReceivedListener function.\n");

		return 0;
	}

	/* We will try to set the asynchronous data output frequency to an invalid
	 * value to demonstrate the error code system. */
	errorCode = vn200_setAsynchronousDataOutputFrequency(
		&vn200,
		27,
		true);

	if (errorCode == VNERR_SENSOR_INVALID_PARAMETER)
	{
		printf("Received VNERR_SENSOR_INVALID_PARAMETER in main function.\n");
	}
	else if (errorCode != VNERR_NO_ERROR)
	{
		/* This is not the error code the example expected to receive. */
		printf("Received error code %u in main function.\n", errorCode);
	}
	else
	{
		printf("Did not receive an error as expected.\n");
	}

	/* Sleep 1 second to make sure our errorCodeReceivedListener function gets the error code. */
	sleep(1);

	errorCode = vn200_unregisterErrorCodeReceivedListener(
		&vn200,
		&errorCodeReceivedListener);

	if (errorCode != VNERR_NO_ERROR)
	{
		printf("Received error when trying to unregister our errorCodeReceivedListener function.\n");

		return 0;
	}

	errorCode = vn200_disconnect(&vn200);

	if (errorCode != VNERR_NO_ERROR)
	{
		printf("Received error when trying to disconnect from the sensor.\n");

		return 0;
	}

	return 0;
}

void errorCodeReceivedListener(void* sender, VN_ERROR_CODE errorCode)
{
	if (errorCode == VNERR_SENSOR_INVALID_PARAMETER)
	{
		printf("Received VNERR_SENSOR_INVALID_PARAMETER in errorCodeReceivedListener function.\n");
	}
	else
	{
		/* This is not the error code the example expected to receive. */
		printf("Received error code %u in errorCodeReceivedListener function.\n", errorCode);
	}
}


text:
// Copyright (c) 2009, Tom Lokovic
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

using System;
using Midi;

namespace MidiUnitTests
{
    /// Unit tests for the ScalePattern class.
    [TestFixture]
    class ScalePatternTest
    {
        [Test]
        public void ConstructionErrors()
        {
            Assert.Throws(typeof(ArgumentNullException),
                () => new ScalePattern(null, new int[] { 0, 1, 2, 3 }));
            Assert.Throws(typeof(ArgumentNullException),
                () => new ScalePattern("a", null));
            Assert.Throws(typeof(ArgumentException),
                () => new ScalePattern("a", new int[] { 1, 2, 3, 4 }));
            Assert.Throws(typeof(ArgumentException),
                () => new ScalePattern("a", new int[] { 0, 1, 2, 3, 3 }));
        }

        [Test]
        public void Equality()
        {
            Assert.AreEqual(
                new ScalePattern("a", new int[] { 0, 1, 2 }),
                new ScalePattern("a", new int[] { 0, 1, 2 }));
            Assert.AreNotEqual(
                new ScalePattern("a", new int[] { 0, 1, 2 }),
                new ScalePattern("b", new int[] { 0, 1, 2 }));
            Assert.AreNotEqual(
                new ScalePattern("a", new int[] { 0, 1, 3 }),
                new ScalePattern("a", new int[] { 0, 1, 2 }));
            Assert.AreNotEqual(
                new ScalePattern("a", new int[] { 0, 1, 2, 3 }),
                new ScalePattern("a", new int[] { 0, 1, 2 }));
        }

        [Test]
        public void Properties()
        {
            ScalePattern sp = new ScalePattern("a", new int[] { 0, 1, 2, 3 });
            Assert.AreEqual(sp.Name, "a");
            Assert.AreEqual(sp.Ascent.Length, 4);
        }
    }

    /// Unit tests for the Scale class.
    [TestFixture]
    class ScaleTest
    {
        [Test]
        public void Construction()
        {
            Assert.Throws(typeof(ArgumentNullException),
                () => new Scale(new Note('F'), null));
            Assert.AreEqual(new Scale(new Note('C'), Scale.Major),
                new Scale(new Note('C'), Scale.Major));
            Assert.AreNotEqual(new Scale(new Note('C'), Scale.Major),
                new Scale(new Note('C', Note.Sharp), Scale.Major));
            Assert.AreNotEqual(new Scale(new Note('C'), Scale.Major),
                new Scale(new Note('D'), Scale.Major));
            Assert.AreNotEqual(new Scale(new Note('C'), Scale.Major),
                new Scale(new Note('C'), Scale.NaturalMinor));
        }

        [Test]
        public void Properties()
        {
            Assert.AreEqual(new Scale(new Note("Fb"), Scale.NaturalMinor).Name, "Fb Natural Minor");
            Assert.AreEqual(new Scale(new Note("Fb"), Scale.NaturalMinor).Tonic, new Note("Fb"));
            Assert.AreEqual(new Scale(new Note("Fb"), Scale.NaturalMinor).Pattern,
                Scale.NaturalMinor);
        }

        ///
        /// Returns a comma-separated string with the note names of c's NoteSequence.
        ///
        private static string SequenceString(Scale s)
        {
            string result = "";
            for (int i = 0; i < s.NoteSequence.Length; ++i)
            {
                if (i > 0)
                {
                    result += ", ";
                }
                result += s.NoteSequence[i].ToString();
            }
            return result;
        }

        [Test]
        public void NoteSequences()
        {
            Assert.AreEqual(SequenceString(new Scale(new Note("C"), Scale.Major)),
                "C, D, E, F, G, A, B");
            Assert.AreEqual(SequenceString(new Scale(new Note("F#"), Scale.Major)),
                "F#, G#, A#, B, C#, D#, E#");
            Assert.AreEqual(SequenceString(new Scale(new Note("Gb"), Scale.Major)),
                "Gb, Ab, Bb, Cb, Db, Eb, F");
            Assert.AreEqual(SequenceString(new Scale(new Note("Bb"), Scale.NaturalMinor)),
                "Bb, C, Db, Eb, F, Gb, Ab");
            Assert.AreEqual(SequenceString(new Scale(new Note("Bb"), Scale.NaturalMinor)),
                "Bb, C, Db, Eb, F, Gb, Ab");
            Assert.AreEqual(SequenceString(new Scale(new Note("Bb"), Scale.HarmonicMinor)),
                "Bb, C, Db, Eb, F, Gb, A");

        }

        [Test]
        public void Contains()
        {
            Scale cmajor = new Scale(new Note("C"), Scale.Major);
            Pitch[] cmajorPitches = new Pitch[] {
                Pitch.C2, Pitch.D2, Pitch.E2, Pitch.F2, Pitch.G2, Pitch.A2, Pitch.B2 };
            Pitch[] cmajorNotPitches = new Pitch[] {
                Pitch.CSharp2, Pitch.DSharp2, Pitch.FSharp2, Pitch.GSharp2, Pitch.ASharp2 };
            foreach (Pitch p in cmajorPitches)
            {
                Assert.True(cmajor.Contains(p));
            }
            foreach (Pitch p in cmajorNotPitches)
            {
                Assert.False(cmajor.Contains(p));
            }

            Scale bbhminor = new Scale(new Note("Bb"), Scale.HarmonicMinor);
            Pitch[] bbhminorPitches = new Pitch[] {
                Pitch.ASharp2, Pitch.C3, Pitch.CSharp3, Pitch.DSharp3, Pitch.F3, Pitch.FSharp3,
                Pitch.A3 };
            Pitch[] bbhminorNotPitches = new Pitch[] {
                Pitch.B2, Pitch.D3, Pitch.E3, Pitch.G3, Pitch.GSharp3  };
            foreach (Pitch p in bbhminorPitches)
            {
                Assert.True(bbhminor.Contains(p));
            }
            foreach (Pitch p in bbhminorNotPitches)
            {
                Assert.False(bbhminor.Contains(p));
            }
        }
    }
}


text:
meteor-migrations
=================

A meteor package for database migrations.

[![Build Status](https://travis-ci.org/rantav/meteor-migrations.png?branch=master)](https://travis-ci.org/rantav/meteor-migrations)

Datebase migrations are "administrative" updates to your collections, for example iteration over all Items and add a status attribute if the status doesn't already exist.
A migration is typically run when refactoring code, for example if the status attribute is a new attribute and it doesn't exist in old Items then you might want to iterate over all items to add this attribute (instead of checking for its existence at runtime). This can make the codebase cleaner and easier to read. It's not always the right solution, but many times it is.

This package adds simple instrumentation to this process.

* Run all not previously run migrations at startup
* If a migration was already run, don't run it again
* Provides a useful log object that logs to the console as well as to the migration item in the database
* Records the result of all migrations, so if for example at error was thrown if gets logged and the migration status is set to ERROR (and then throws)
* Provides an easy way to introspect previous migrations.

# Installation
```
mrt add migrations
```

This package creates a collection named migrations and adds status and log lines to the collection.

# Usage
```
// Add a migration. Usually you want to add it at server startup.
Meteor.startup(function(){
  Meteor.Migrations.add('1', function(log) {
    // log writes to the console as well as to the database.
    log.info("Adding the attribute status to all items that don't have it");
    Items.find({status: {$exists : false}}).forEach(function (item) {
      log.info("Adding status to " + item._id);
      Items.update(item._id, {$set: {status: 'CREATED'}});
    });
  });
});

// Get migration by ID
var migration = Meteor.Migrations.get('1');
console.log(migration);

// List all migrations (returns a cursor)
var list = Meteor.Migrations.list();
console.log(list.fetch());

// List only error migrations
var errors = Meteor.Migrations.list('ERROR');
console.log(errors.fetch());

```

## The log
The function passed to `Meteor.Migrations.add` accepts a log object.
This object has three methods: `log.info`, `log.warn` and `log.error`.
These methods write both to the console as well as to the loglines array of the migration item in the database, so when you need to retrive old loglines per migration it's easy to do this via the mongo console: `db.migrations.findOne({_id: 'migration-id'})`

You can also get a migration item in Meteor, not in the mongo console,  using `Meteor.Migrations.get('migration-id')`. This will provide the status and loglines.

## The migrations collection
This package logs the migrations status using the collection `migrations`. So this assumes you don't use this collecgion for other purposes.
The IDs of the objects in this collecgion are the migration IDs you specify to the function `Meteor.Migrations.add`.


text:
namespace {

base::StringPiece PlatformResourceProvider(int key) {
  if (key == IDR_DIR_HEADER_HTML) {
    base::StringPiece html_data =
        ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
            IDR_DIR_HEADER_HTML);
    return html_data;
  }
  return base::StringPiece();
}

// FIXME: Compare with method in startup_browser_creator.cc.
static GURL GetURLFromCommandLine(const CommandLine& command_line) {
#if !defined(OS_ANDROID)
  const CommandLine::StringVector& args = command_line.GetArgs();

  if (args.empty())
    return GURL();

  GURL url(args[0]);
  if (url.is_valid() && url.has_scheme()) {
    return url;
  } else {
    base::FilePath path(args[0]);
    if (!path.IsAbsolute())
      path = MakeAbsoluteFilePath(path);
    return url = net::FilePathToFileURL(path);
  }
#endif
  return GURL();
}

}  // namespace

namespace xswitches {
// Redefine settings not exposed by content module.
const char kEnableViewport[] = "enable-viewport";
const char kEnableOverlayScrollbars[] = "enable-overlay-scrollbars";
}

namespace xwalk {

void SetXWalkCommandLineFlags() {
  static bool already_initialized = false;
  if (already_initialized)
    return;
  already_initialized = true;

  CommandLine* command_line = CommandLine::ForCurrentProcess();

#if defined(OS_TIZEN_MOBILE)
  command_line->AppendSwitch(switches::kIgnoreGpuBlacklist);

  const char* gl_name;
  if (base::PathExists(base::FilePath("/usr/lib/xwalk/libosmesa.so")))
    gl_name = gfx::kGLImplementationOSMesaName;
  else if (base::PathExists(base::FilePath("/usr/lib/libGL.so")))
    gl_name = gfx::kGLImplementationDesktopName;
  else
    gl_name = gfx::kGLImplementationEGLName;
  command_line->AppendSwitchASCII(switches::kUseGL, gl_name);
#endif

  command_line->AppendSwitch(xswitches::kEnableViewport);

  command_line->AppendSwitch(xswitches::kEnableOverlayScrollbars);

  // Enable multithreaded GPU compositing of web content.
  // This also enables pinch on Tizen.
  command_line->AppendSwitch(switches::kEnableThreadedCompositing);

  // Show feedback on touch.
  command_line->AppendSwitch(switches::kEnableGestureTapHighlight);

#if defined(OS_ANDROID)
  // Disable ExtensionProcess for Android.
  // External extensions will run in the BrowserProcess (in process mode).
  command_line->AppendSwitch(switches::kXWalkDisableExtensionProcess);

  // Enable WebGL for Android.
  command_line->AppendSwitch(switches::kIgnoreGpuBlacklist);

  // Disable HW encoding/decoding acceleration for WebRTC on Android.
  // FIXME: Remove these switches for Android when Android OS is removed from
  // GPU accelerated_video_decode blacklist or we stop ignoring the GPU
  // blacklist.
  command_line->AppendSwitch(switches::kDisableWebRtcHWDecoding);
  command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
#endif

  // FIXME: Add comment why this is needed on Android and Tizen.
  command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
}

XWalkBrowserMainParts::XWalkBrowserMainParts(
    const content::MainFunctionParams& parameters)
    : BrowserMainParts(),
      startup_url_(content::kAboutBlankURL),
      parameters_(parameters),
      run_default_message_loop_(true) {
}

XWalkBrowserMainParts::~XWalkBrowserMainParts() {
}

#if defined(OS_ANDROID)
void XWalkBrowserMainParts::SetRuntimeContext(RuntimeContext* context) {
  runtime_context_ = context;
}
#endif

void XWalkBrowserMainParts::PreMainMessageLoopStart() {
  SetXWalkCommandLineFlags();

  CommandLine* command_line = CommandLine::ForCurrentProcess();
  startup_url_ = GetURLFromCommandLine(*command_line);

#if defined(OS_MACOSX)
  PreMainMessageLoopStartMac();
#endif
}

void XWalkBrowserMainParts::PostMainMessageLoopStart() {
#if defined(OS_ANDROID)
  base::MessageLoopForUI::current()->Start();
#endif
}

void XWalkBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && defined(USE_X11)
    ui::InitializeInputMethodForTesting();
#endif
#if defined(OS_ANDROID)
  net::NetworkChangeNotifier::SetFactory(
      new net::NetworkChangeNotifierFactoryAndroid());

  CommandLine::ForCurrentProcess()->AppendSwitch(
      cc::switches::kCompositeToMailbox);

  // Initialize the Compositor.
  content::Compositor::Initialize();
#endif

#if defined(OS_LINUX)
  // FIXME: We disable the setuid sandbox on Linux because we don't ship
  // the setuid binary. It is important to remember that the seccomp-bpf
  // sandbox is still fully operational if supported by the kernel. See
  // issue #496.
  //
  // switches::kDisableSetuidSandbox is not being used here because it
  // doesn't have the CONTENT_EXPORT macro despite the fact it is exposed by
  // content_switches.h.
  CommandLine::ForCurrentProcess()->AppendSwitch("disable-setuid-sandbox");
#endif
}

int XWalkBrowserMainParts::PreCreateThreads() {
#if defined(OS_ANDROID)
  DCHECK(runtime_context_);
  runtime_context_->InitializeBeforeThreadCreation();
#endif
  return content::RESULT_CODE_NORMAL_EXIT;
}

void XWalkBrowserMainParts::RegisterExternalExtensions() {
  CommandLine* cmd_line = CommandLine::ForCurrentProcess();
  if (!cmd_line->HasSwitch(switches::kXWalkExternalExtensionsPath))
    return;

  if (!cmd_line->HasSwitch(
          switches::kXWalkAllowExternalExtensionsForRemoteSources) &&
      !startup_url_.SchemeIsFile()) {
    VLOG(0) << "Unsupported scheme for external extensions: " <<
          startup_url_.scheme();
    return;
  }

  base::FilePath extensions_dir =
      cmd_line->GetSwitchValuePath(switches::kXWalkExternalExtensionsPath);
  if (!base::DirectoryExists(extensions_dir)) {
    LOG(WARNING) << "Ignoring non-existent extension directory: "
                 << extensions_dir.AsUTF8Unsafe();
    return;
  }

  extension_service_->RegisterExternalExtensionsForPath(extensions_dir);
}

void XWalkBrowserMainParts::PreMainMessageLoopRun() {
#if defined(OS_ANDROID)
  net::NetModule::SetResourceProvider(PlatformResourceProvider);
  if (parameters_.ui_task) {
    parameters_.ui_task->Run();
    delete parameters_.ui_task;
    run_default_message_loop_ = false;
  }

  DCHECK(runtime_context_);
  runtime_context_->PreMainMessageLoopRun();
  runtime_registry_.reset(new RuntimeRegistry);
  extension_service_.reset(new extensions::XWalkExtensionService(this));
#else
  runtime_context_.reset(new RuntimeContext);
  runtime_registry_.reset(new RuntimeRegistry);

  runtime_registry_->AddObserver(
      runtime_context_->GetApplicationSystem()->process_manager());

  CommandLine* command_line = CommandLine::ForCurrentProcess();
  if (!command_line->HasSwitch(switches::kInstall) &&
      !command_line->HasSwitch(switches::kUninstall)) {
    extension_service_.reset(new extensions::XWalkExtensionService(this));

    RegisterExternalExtensions();
  }

  if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) {
    std::string port_str =
        command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort);
    int port;
    const char* loopback_ip = "127.0.0.1";
    if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
      remote_debugging_server_.reset(
          new RemoteDebuggingServer(runtime_context_.get(),
              loopback_ip, port, std::string()));
    }
  }

  NativeAppWindow::Initialize();

  xwalk::application::ApplicationSystem* app_system =
      runtime_context_->GetApplicationSystem();
  if (app_system->HandleApplicationManagementCommands(*command_line,
                                                      startup_url_)) {
    run_default_message_loop_ = false;
    return;
  }

#if defined(OS_TIZEN_MOBILE)
  if (content::DeviceInertialSensorService* sensor_service =
          content::DeviceInertialSensorService::GetInstance()) {
    TizenDataFetcherSharedMemory* data_fetcher =
        new TizenDataFetcherSharedMemory();
    // As the data fetcher of sensors is implemented outside of Chromium, we
    // need to make it available to Chromium by "abusing" the test framework.
    // TODO(zliang7): Find a decent way to inject our sensor fetcher for Tizen.
    sensor_service->SetDataFetcherForTests(data_fetcher);
  }
#endif  // OS_TIZEN_MOBILE

  if (app_system->LaunchFromCommandLine(*command_line, startup_url_,
                                        &run_default_message_loop_)) {
    return;
  }

  // The new created Runtime instance will be managed by RuntimeRegistry.
  Runtime::CreateWithDefaultWindow(runtime_context_.get(), startup_url_);

  // If the |ui_task| is specified in main function parameter, it indicates
  // that we will run this UI task instead of running the the default main
  // message loop. See |content::BrowserTestBase::SetUp| for |ui_task| usage
  // case.
  if (parameters_.ui_task) {
    parameters_.ui_task->Run();
    delete parameters_.ui_task;
    run_default_message_loop_ = false;
  }
#endif
}

bool XWalkBrowserMainParts::MainMessageLoopRun(int* result_code) {
  return !run_default_message_loop_;
}

void XWalkBrowserMainParts::PostMainMessageLoopRun() {
  runtime_registry_->RemoveObserver(
      runtime_context_->GetApplicationSystem()->process_manager());
#if defined(OS_ANDROID)
  base::MessageLoopForUI::current()->Start();
#else
  runtime_context_.reset();
#endif
}

void XWalkBrowserMainParts::RegisterInternalExtensionsInServer(
    extensions::XWalkExtensionServer* server) {
  CHECK(server);
#if defined(OS_ANDROID)
  ScopedVector<XWalkExtension>::const_iterator it = extensions_.begin();
  for (; it != extensions_.end(); ++it)
    server->RegisterExtension(scoped_ptr<XWalkExtension>(*it));
#elif defined(OS_TIZEN_MOBILE)
  server->RegisterExtension(scoped_ptr<XWalkExtension>(
      new sysapps::DeviceCapabilitiesExtension(runtime_registry_.get())));
#else
  server->RegisterExtension(scoped_ptr<XWalkExtension>(new RuntimeExtension()));
  server->RegisterExtension(scoped_ptr<XWalkExtension>(
      new ApplicationExtension(runtime_context()->GetApplicationSystem())));
  server->RegisterExtension(scoped_ptr<XWalkExtension>(
      new experimental::DialogExtension(runtime_registry_.get())));
#endif
  server->RegisterExtension(scoped_ptr<XWalkExtension>(
      new sysapps::RawSocketExtension()));
}

#if defined(OS_ANDROID)
void XWalkBrowserMainParts::RegisterExtension(
    scoped_ptr<XWalkExtension> extension) {
  extensions_.push_back(extension.release());
}

void XWalkBrowserMainParts::UnregisterExtension(
    scoped_ptr<XWalkExtension> extension) {
  ScopedVector<XWalkExtension>::iterator it = extensions_.begin();
  for (; it != extensions_.end(); ++it) {
    if (*it == extension.release()) break;
  }

  if (it != extensions_.end())
    extensions_.erase(it);
}
#endif

}  // namespace xwalk


text:
""" Ce module permet de calculer num|é|riquement l'incertitude
    d'une fonction par rapport |à| l'incertitude de ces param|è|tres
    En th|é|orie |ç|a marche, mais aucune garantie.
    (c)Gabriel Desharnais, 2016. Fa|î|tes-en ce que vous-voulez."""

import numpy as np
from scipy import misc

def result(n,e):            #fonction de formatage de sortie
	ordre = int(np.floor(np.log10(e)))
	if ordre < 0 :
		f = "{:."+str(-ordre)+"f}"
		re = f.format(n)
	else:
		#|à| changer
		re=str(n)
	return re

def resultI(n,e):
	ordre = int(np.floor(np.log10(e)))
	re = np.around(n,-ordre)
	return re
def rotate(l,n):            #fonction pour rotater une liste
	return l[n:]+l[:n]

def wrap(*ag):              #fonction interfa|ç|ant la vrai fonction
	global n
	global M
	return M(*rotate(ag,-n))

def err(f,ar,e):
	t=0
	global n
	n=0
	for x in range(len(ar)):
		ar=rotate(ar,1)
		t+=np.abs(misc.derivative(f,ar[0],args=ar[:-1])*e[x])
		n+=1
	return t

def erreur(fonction,arguments,erreurs):
	global M
	M=fonction
	return err(wrap,arguments,erreurs)
def error(func):
	def supper(*args,**ag):
		try:
			return erreur(func,args,ag['er'])
		except KeyError:
			return func(*args)
	return supper

def e(func):
	def supper(*args,**ag):
		try:
			return resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er']))
		except KeyError:
			return func(*args)
	return supper

def es(func):
	def supper(*args,**ag):
		try:
			return str( resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er'])))
		except KeyError:
			return func(*args)
	return supper
def rs(func):
	def supper(*args,**ag):
		try:
			return str( resultI(func(*args),erreur(func,args,ag['er'])))+'±'+str( resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er'])))
		except KeyError:
			return func(*args)
	return supper

def rl(func):
	def supper(*args,**ag):
		try:
			return [ resultI(func(*args),erreur(func,args,ag['er'])), resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er']))]
		except KeyError:
			return func(*args)
	return supper

def rls(func):
	def supper(*args,**ag):
		try:
			return [str( resultI(func(*args),erreur(func,args,ag['er']))),str( resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er'])))]
		except KeyError:
			return func(*args)
	return supper

def resultatl(func):
	def supper(*args,**ag):
		try:
			return [func(*args),erreur(func,args,ag['er'])]
		except KeyError:
			return func(*args)
	return supper
def rst(func):
	def supper(*args,**ag):
		try:
			return '$'+str( resultI(func(*args),erreur(func,args,ag['er'])))+'\pm'+str( resultI(erreur(func,args,ag['er']),erreur(func,args,ag['er'])))+'$'
		except KeyError:
			return func(*args)
	return supper
n=0
M=0


text:
#ifndef P_SPINDLE_CORRELATE_H_
# define P_SPINDLE_CORRELATE_H_         1

# include <stdio.h>
# include <stdlib.h>
# include <string.h>

# include "spindle-common.h"

# undef PLUGIN_NAME
# define PLUGIN_NAME                    "spindle-correlate"

# define SET_BLOCKSIZE                  4

/* Perform coreference correlation on a graph */
int spindle_correlate(twine_graph *graph, void *data);

/* Matching callbacks */
int spindle_match_sameas(struct spindle_corefset_struct *set, const char *subject, const char *object);
int spindle_match_wikipedia(struct spindle_corefset_struct *set, const char *subject, const char *object);

/* Extract a list of co-references from a librdf model */
struct spindle_corefset_struct *spindle_coref_create(void);
struct spindle_corefset_struct *spindle_coref_extract(SPINDLE *spindle, librdf_model *model, const char *graphuri);
/* Free the resources used by a co-reference set */
int spindle_coref_destroy(struct spindle_corefset_struct *set);

int spindle_graph_discard(SPINDLE *spindle, const char *uri);
int spindle_cache_update_set(SPINDLE *spindle, struct spindle_strset_struct *set);

#endif /*!P_SPINDLE_CORRELATE_H_*/