code
stringlengths
4
1.01M
language
stringclasses
2 values
/* * Copyright 2016 Bjoern Bilger * * 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.jrestless.core.container; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response.Status; import org.glassfish.jersey.server.ContainerResponse; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import com.jrestless.core.container.JRestlessHandlerContainer.JRestlessContainerResponse; import com.jrestless.core.container.JRestlessHandlerContainer.JRestlessContainerResponseWriter; import com.jrestless.core.container.io.JRestlessResponseWriter; public class JRestlessContainerResponseWriterTest { private JRestlessContainerResponseWriter containerResponseWriter; private JRestlessContainerResponse response; @BeforeEach public void setup() { JRestlessResponseWriter responseWriter = mock(JRestlessResponseWriter.class); when(responseWriter.getEntityOutputStream()).thenReturn(new ByteArrayOutputStream()); response = spy(new JRestlessContainerResponse(responseWriter)); containerResponseWriter = new JRestlessContainerResponseWriter(response); } @Test public void commit_ResponseNotYetClosed_ShouldCloseResponse() { containerResponseWriter.commit(); verify(response, times(1)).close(); } @Test public void writeResponseStatusAndHeaders_ContextHeaderAndStatusGiven_ShouldUpdateResponseStatusAndHeaders() { MultivaluedMap<String, String> actualHeaders = new MultivaluedHashMap<>(); actualHeaders.add("header0", "value0_0"); actualHeaders.add("header0", "value0_1"); actualHeaders.add("header1", "value1_0"); MultivaluedMap<String, String> expectedHeaders = new MultivaluedHashMap<>(); expectedHeaders.add("header0", "value0_0"); expectedHeaders.add("header0", "value0_1"); expectedHeaders.add("header1", "value1_0"); ContainerResponse context = mock(ContainerResponse.class); when(context.getStatusInfo()).thenReturn(Status.CONFLICT); when(context.getStringHeaders()).thenReturn(actualHeaders); containerResponseWriter.writeResponseStatusAndHeaders(-1, context); assertEquals(Status.CONFLICT, response.getStatusType()); assertEquals(expectedHeaders, response.getHeaders()); } @Test public void writeResponseStatusAndHeaders_ShouldReturnEntityOutputStreamOfResponse() { ContainerResponse context = mock(ContainerResponse.class); when(context.getStringHeaders()).thenReturn(new MultivaluedHashMap<>()); when(context.getStatusInfo()).thenReturn(Status.OK); OutputStream entityOutputStream = containerResponseWriter.writeResponseStatusAndHeaders(-1, context); assertSame(response.getEntityOutputStream(), entityOutputStream); } @Test public void failure_ResponseNotYetCommitted_ShouldSetInternalServerErrorStatusOnFail() { ContainerResponse context = mock(ContainerResponse.class); when(context.getStatusInfo()).thenReturn(Status.OK); when(context.getStringHeaders()).thenReturn(new MultivaluedHashMap<>()); containerResponseWriter.writeResponseStatusAndHeaders(-1, context); containerResponseWriter.failure(new RuntimeException()); assertEquals(Status.INTERNAL_SERVER_ERROR, response.getStatusType()); } @Test public void failure_ResponseNotYetCommitted_ShouldCommitOnFailure() { containerResponseWriter = spy(containerResponseWriter); containerResponseWriter.failure(new RuntimeException()); verify(containerResponseWriter, times(1)).commit(); } @Test public void failure_ResponseNotYetCommitted_ShouldRethrowOnCommitFailure() { containerResponseWriter = spy(containerResponseWriter); containerResponseWriter.failure(new RuntimeException()); doThrow(CommitException.class).when(containerResponseWriter).commit(); assertThrows(RuntimeException.class, () -> containerResponseWriter.failure(new RuntimeException())); } @Test public void enableResponseBuffering_Always_ShouldBeDisabled() { assertFalse(containerResponseWriter.enableResponseBuffering()); } @Test public void setSuspendTimeout_Always_ShouldBeUnsupported() { assertThrows(UnsupportedOperationException.class, () -> containerResponseWriter.setSuspendTimeout(1, null)); } @Test public void suspend_Always_ShouldBeUnsupported() { assertThrows(UnsupportedOperationException.class, () -> containerResponseWriter.suspend(1, null, null)); } @SuppressWarnings("serial") private static class CommitException extends RuntimeException { } }
Java
#!/bin/bash # Clone pinned Kuberay commit to temporary directory, copy the CRD definitions # into the autoscaler folder. SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) DIR=$(mktemp -d -t "kuberay-XXXXXX") pushd "$DIR" || exit git clone https://github.com/ray-project/kuberay/ pushd "kuberay" || exit # If you changed the Kuberay CRD, you need to update this commit to point # to the new CRD. The following always need to be compatible: The used CRDs, # the docker image of the Kuberay operator and the KuberayNodeProvider. # This is normally not a problem since the KuberayNodeProvider uses a # stable part of the CRD definition and the Kuberay operator and the # CRDs are in the https://github.com/ray-project/kuberay/ so they # get updated together. It is important to keep this in mind when making # changes. The CRD is designed to be stable so one operator can run many # different versions of Ray. git checkout 6f87ca64c107cd51d3ab955faf4be198e0094536 # Here is where we specify the docker image that is used for the operator. # If you want to use your own version of Kuberay, you should change the content # of kuberay-autoscaler.patch to point to your operator. # This would normally better be done with kustomization, but we don't want to make # kustomization a dependency for running this. git apply "$SCRIPT_DIR/kuberay-autoscaler.patch" cp -r ray-operator/config "$SCRIPT_DIR/" popd || exit popd || exit
Java
/** * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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 io.jboot.support.metric.annotation; import java.lang.annotation.*; @Documented @Target(ElementType.METHOD) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface EnableMetricTimer { String value() default ""; }
Java
<?php header("Content-Type: text/html;charset=utf-8"); $name = $_POST['first_name']; $email = $_POST['email']; $message = $_POST['comments']; $to = "jgo@camaraderepresentantes.org"; $subject = "Estimado Representante"; $body = ' <html> <head> <title>Estimado Representante</title> </head> <body> <p><b>Name: </b> '.$name.'</p> <p><b>Email: </b> '.$email.'</p> <p><b>Message: </b> '.$message.'</p> </body> </html> '; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=utf-8\r\n"; $headers .= "Bcc: estimadosenador@gmail.com" . "\r\n"; $headers .= "From: ".$name." <".$email.">\r\n"; $sended = mail($to, $subject, $body, $headers); ?> <html> <head> <title>Estimado Representante</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="bigone"> <div class="menu clearfix"> <a href="index.html"><h2>Home</h2></a> <a href="about.html"><h2>About</h2></a> </div> <div class="line"></div> <div class="cta"> <h1>Estimado Representante,</h1> <h4> Esta p&aacute;gina es dedicada al pueblo puertorrique&ntilde;o para ejercer nuestro derecho de libertad de expresi&oacute;n <br>y exigir el m&aacute;s alto respeto y cumplimiento a nuestros representantes legislativos. Este canal ser&aacute; una fuente de ideas, uno que fomente la unidad y el progreso, uno que demande fiscalizaci&oacute;n, responsabilidad, &eacute;tica, e igualdad.<br> <br><b>Puertorrique&ntilde;o</b>, felicita, comenta, y protesta pero siempre con propiedad y respeto. Di lo que ves. Di lo que piensas. La libertad de expresi&oacute;n te lo permite. La democracia te lo pide. Porque todo representante tiene que escuchar para poder cumplir. </h4> </div> <div class="about"> <h5><b>Tu mensaje fue enviado.</b><br> <br>Si te gust&oacute; la p&aacute;gina, por favor comp&aacute;rtela, y as&iacute; lograremos que m&aacute;s puertorrique&ntilde;os se expresen.<br> <br>Gracias por usar Estimado Representante.</h5> </div> </body> </html>
Java
--- date: 2017-03-21T23:55:53Z title: Comment fonctionne Waziup? url: /fr/documentation/how-waziup-works/ --- Regardons à l'intérieur de la grande machine. Dans cette section vous pouvez trouver: - [L'architecture] (/fr/documentation/how-waziup-works/architecture) - [Concepts Cloud locaux et globaux] (/fr/documentation/how-waziup-works/localglobal) - [Les exigences] (/fr/documentation/how-waziup-works/requirements)
Java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.fhuss.kafka.streams.cep.core.state.internal; import java.util.Objects; /** * Class for aggregated state. * * @param <K> the record key type. */ public class Aggregated<K> { private final K key; private final Aggregate aggregate; /** * Creates a new {@link Aggregated} instance. * @param key the record key * @param aggregate the instance of {@link Aggregate}. */ public Aggregated(final K key, final Aggregate aggregate) { this.key = key; this.aggregate = aggregate; } public K getKey() { return key; } public Aggregate getAggregate() { return aggregate; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Aggregated<?> that = (Aggregated<?>) o; return Objects.equals(key, that.key) && Objects.equals(aggregate, that.aggregate); } @Override public int hashCode() { return Objects.hash(key, aggregate); } @Override public String toString() { return "Aggregated{" + "key=" + key + ", aggregate=" + aggregate + '}'; } }
Java
/* * ! ${copyright} */ sap.ui.define([ "delegates/odata/v4/TableDelegate", "sap/ui/core/Core" ], function( TableDelegate, Core ) { "use strict"; /** * Test delegate for OData V4. */ var ODataTableDelegate = Object.assign({}, TableDelegate); /** * Updates the binding info with the relevant path and model from the metadata. * * @param {Object} oTable The MDC table instance * @param {Object} oBindingInfo The bindingInfo of the table */ ODataTableDelegate.updateBindingInfo = function(oTable, oBindingInfo) { TableDelegate.updateBindingInfo.apply(this, arguments); var oFilterBar = Core.byId(oTable.getFilter()); if (oFilterBar) { // get the basic search var sSearchText = oFilterBar.getSearch instanceof Function ? oFilterBar.getSearch() : ""; if (sSearchText && sSearchText.indexOf(" ") === -1) { // to allow search for "("..... sSearchText = '"' + sSearchText + '"'; // TODO: escape " in string } // if it contains spaces allow opeartors like OR... oBindingInfo.parameters.$search = sSearchText || undefined; } }; return ODataTableDelegate; });
Java
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.apigateway.model.transform; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.apigateway.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * UpdateMethodResponseRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class UpdateMethodResponseRequestMarshaller { private static final MarshallingInfo<String> RESTAPIID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("restapi_id").build(); private static final MarshallingInfo<String> RESOURCEID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("resource_id").build(); private static final MarshallingInfo<String> HTTPMETHOD_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("http_method").build(); private static final MarshallingInfo<String> STATUSCODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("status_code").build(); private static final MarshallingInfo<List> PATCHOPERATIONS_BINDING = MarshallingInfo.builder(MarshallingType.LIST) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("patchOperations").build(); private static final UpdateMethodResponseRequestMarshaller instance = new UpdateMethodResponseRequestMarshaller(); public static UpdateMethodResponseRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(UpdateMethodResponseRequest updateMethodResponseRequest, ProtocolMarshaller protocolMarshaller) { if (updateMethodResponseRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateMethodResponseRequest.getRestApiId(), RESTAPIID_BINDING); protocolMarshaller.marshall(updateMethodResponseRequest.getResourceId(), RESOURCEID_BINDING); protocolMarshaller.marshall(updateMethodResponseRequest.getHttpMethod(), HTTPMETHOD_BINDING); protocolMarshaller.marshall(updateMethodResponseRequest.getStatusCode(), STATUSCODE_BINDING); protocolMarshaller.marshall(updateMethodResponseRequest.getPatchOperations(), PATCHOPERATIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
Java
package ip_test import ( . "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo" . "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega" "testing" ) func TestPlatform(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Ip Suite") }
Java
# -*- coding: utf-8 -*- # # 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. from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import str from past.builtins import basestring from datetime import datetime import logging from urllib.parse import urlparse from time import sleep import airflow from airflow import hooks, settings from airflow.exceptions import AirflowException, AirflowSensorTimeout, AirflowSkipException from airflow.models import BaseOperator, TaskInstance, Connection as DB from airflow.hooks.base_hook import BaseHook from airflow.utils.state import State from airflow.utils.decorators import apply_defaults class BaseSensorOperator(BaseOperator): ''' Sensor operators are derived from this class an inherit these attributes. Sensor operators keep executing at a time interval and succeed when a criteria is met and fail if and when they time out. :param soft_fail: Set to true to mark the task as SKIPPED on failure :type soft_fail: bool :param poke_interval: Time in seconds that the job should wait in between each tries :type poke_interval: int :param timeout: Time, in seconds before the task times out and fails. :type timeout: int ''' ui_color = '#e6f1f2' @apply_defaults def __init__( self, poke_interval=60, timeout=60*60*24*7, soft_fail=False, *args, **kwargs): super(BaseSensorOperator, self).__init__(*args, **kwargs) self.poke_interval = poke_interval self.soft_fail = soft_fail self.timeout = timeout def poke(self, context): ''' Function that the sensors defined while deriving this class should override. ''' raise AirflowException('Override me.') def execute(self, context): started_at = datetime.now() while not self.poke(context): if (datetime.now() - started_at).total_seconds() > self.timeout: if self.soft_fail: raise AirflowSkipException('Snap. Time is OUT.') else: raise AirflowSensorTimeout('Snap. Time is OUT.') sleep(self.poke_interval) logging.info("Success criteria met. Exiting.") class SqlSensor(BaseSensorOperator): """ Runs a sql statement until a criteria is met. It will keep trying until sql returns no row, or if the first cell in (0, '0', ''). :param conn_id: The connection to run the sensor against :type conn_id: string :param sql: The sql to run. To pass, it needs to return at least one cell that contains a non-zero / empty string value. """ template_fields = ('sql',) template_ext = ('.hql', '.sql',) @apply_defaults def __init__(self, conn_id, sql, *args, **kwargs): self.sql = sql self.conn_id = conn_id super(SqlSensor, self).__init__(*args, **kwargs) def poke(self, context): hook = BaseHook.get_connection(self.conn_id).get_hook() logging.info('Poking: ' + self.sql) records = hook.get_records(self.sql) if not records: return False else: if str(records[0][0]) in ('0', '',): return False else: return True print(records[0][0]) class MetastorePartitionSensor(SqlSensor): """ An alternative to the HivePartitionSensor that talk directly to the MySQL db. This was created as a result of observing sub optimal queries generated by the Metastore thrift service when hitting subpartitioned tables. The Thrift service's queries were written in a way that wouldn't leverage the indexes. :param schema: the schema :type schema: str :param table: the table :type table: str :param partition_name: the partition name, as defined in the PARTITIONS table of the Metastore. Order of the fields does matter. Examples: ``ds=2016-01-01`` or ``ds=2016-01-01/sub=foo`` for a sub partitioned table :type partition_name: str :param mysql_conn_id: a reference to the MySQL conn_id for the metastore :type mysql_conn_id: str """ template_fields = ('partition_name', 'table', 'schema') @apply_defaults def __init__( self, table, partition_name, schema="default", mysql_conn_id="metastore_mysql", *args, **kwargs): self.partition_name = partition_name self.table = table self.schema = schema self.first_poke = True self.conn_id = mysql_conn_id super(SqlSensor, self).__init__(*args, **kwargs) def poke(self, context): if self.first_poke: self.first_poke = False if '.' in self.table: self.schema, self.table = self.table.split('.') self.sql = """ SELECT 'X' FROM PARTITIONS A0 LEFT OUTER JOIN TBLS B0 ON A0.TBL_ID = B0.TBL_ID LEFT OUTER JOIN DBS C0 ON B0.DB_ID = C0.DB_ID WHERE B0.TBL_NAME = '{self.table}' AND C0.NAME = '{self.schema}' AND A0.PART_NAME = '{self.partition_name}'; """.format(self=self) return super(MetastorePartitionSensor, self).poke(context) class ExternalTaskSensor(BaseSensorOperator): """ Waits for a task to complete in a different DAG :param external_dag_id: The dag_id that contains the task you want to wait for :type external_dag_id: string :param external_task_id: The task_id that contains the task you want to wait for :type external_task_id: string :param allowed_states: list of allowed states, default is ``['success']`` :type allowed_states: list :param execution_delta: time difference with the previous execution to look at, the default is the same execution_date as the current task. For yesterday, use [positive!] datetime.timedelta(days=1). Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both. :type execution_delta: datetime.timedelta :param execution_date_fn: function that receives the current execution date and returns the desired execution date to query. Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both. :type execution_date_fn: callable """ @apply_defaults def __init__( self, external_dag_id, external_task_id, allowed_states=None, execution_delta=None, execution_date_fn=None, *args, **kwargs): super(ExternalTaskSensor, self).__init__(*args, **kwargs) self.allowed_states = allowed_states or [State.SUCCESS] if execution_delta is not None and execution_date_fn is not None: raise ValueError( 'Only one of `execution_date` or `execution_date_fn` may' 'be provided to ExternalTaskSensor; not both.') self.execution_delta = execution_delta self.execution_date_fn = execution_date_fn self.external_dag_id = external_dag_id self.external_task_id = external_task_id def poke(self, context): if self.execution_delta: dttm = context['execution_date'] - self.execution_delta elif self.execution_date_fn: dttm = self.execution_date_fn(context['execution_date']) else: dttm = context['execution_date'] logging.info( 'Poking for ' '{self.external_dag_id}.' '{self.external_task_id} on ' '{dttm} ... '.format(**locals())) TI = TaskInstance session = settings.Session() count = session.query(TI).filter( TI.dag_id == self.external_dag_id, TI.task_id == self.external_task_id, TI.state.in_(self.allowed_states), TI.execution_date == dttm, ).count() session.commit() session.close() return count class NamedHivePartitionSensor(BaseSensorOperator): """ Waits for a set of partitions to show up in Hive. :param partition_names: List of fully qualified names of the partitions to wait for. A fully qualified name is of the form schema.table/pk1=pv1/pk2=pv2, for example, default.users/ds=2016-01-01. This is passed as is to the metastore Thrift client "get_partitions_by_name" method. Note that you cannot use logical operators as in HivePartitionSensor. :type partition_names: list of strings :param metastore_conn_id: reference to the metastore thrift service connection id :type metastore_conn_id: str """ template_fields = ('partition_names', ) @apply_defaults def __init__( self, partition_names, metastore_conn_id='metastore_default', poke_interval=60*3, *args, **kwargs): super(NamedHivePartitionSensor, self).__init__( poke_interval=poke_interval, *args, **kwargs) if isinstance(partition_names, basestring): raise TypeError('partition_names must be an array of strings') self.metastore_conn_id = metastore_conn_id self.partition_names = partition_names self.next_poke_idx = 0 def parse_partition_name(self, partition): try: schema, table_partition = partition.split('.') table, partition = table_partition.split('/', 1) return schema, table, partition except ValueError as e: raise ValueError('Could not parse ' + partition) def poke(self, context): if not hasattr(self, 'hook'): self.hook = airflow.hooks.hive_hooks.HiveMetastoreHook( metastore_conn_id=self.metastore_conn_id) def poke_partition(partition): schema, table, partition = self.parse_partition_name(partition) logging.info( 'Poking for {schema}.{table}/{partition}'.format(**locals()) ) return self.hook.check_for_named_partition( schema, table, partition) while self.next_poke_idx < len(self.partition_names): if poke_partition(self.partition_names[self.next_poke_idx]): self.next_poke_idx += 1 else: return False return True class HivePartitionSensor(BaseSensorOperator): """ Waits for a partition to show up in Hive. Note: Because @partition supports general logical operators, it can be inefficient. Consider using NamedHivePartitionSensor instead if you don't need the full flexibility of HivePartitionSensor. :param table: The name of the table to wait for, supports the dot notation (my_database.my_table) :type table: string :param partition: The partition clause to wait for. This is passed as is to the metastore Thrift client "get_partitions_by_filter" method, and apparently supports SQL like notation as in `ds='2015-01-01' AND type='value'` and > < sings as in "ds>=2015-01-01" :type partition: string :param metastore_conn_id: reference to the metastore thrift service connection id :type metastore_conn_id: str """ template_fields = ('schema', 'table', 'partition',) @apply_defaults def __init__( self, table, partition="ds='{{ ds }}'", metastore_conn_id='metastore_default', schema='default', poke_interval=60*3, *args, **kwargs): super(HivePartitionSensor, self).__init__( poke_interval=poke_interval, *args, **kwargs) if not partition: partition = "ds='{{ ds }}'" self.metastore_conn_id = metastore_conn_id self.table = table self.partition = partition self.schema = schema def poke(self, context): if '.' in self.table: self.schema, self.table = self.table.split('.') logging.info( 'Poking for table {self.schema}.{self.table}, ' 'partition {self.partition}'.format(**locals())) if not hasattr(self, 'hook'): self.hook = airflow.hooks.hive_hooks.HiveMetastoreHook( metastore_conn_id=self.metastore_conn_id) return self.hook.check_for_partition( self.schema, self.table, self.partition) class HdfsSensor(BaseSensorOperator): """ Waits for a file or folder to land in HDFS """ template_fields = ('filepath',) @apply_defaults def __init__( self, filepath, hdfs_conn_id='hdfs_default', *args, **kwargs): super(HdfsSensor, self).__init__(*args, **kwargs) self.filepath = filepath self.hdfs_conn_id = hdfs_conn_id def poke(self, context): import airflow.hooks.hdfs_hook sb = airflow.hooks.hdfs_hook.HDFSHook(self.hdfs_conn_id).get_conn() logging.getLogger("snakebite").setLevel(logging.WARNING) logging.info( 'Poking for file {self.filepath} '.format(**locals())) try: files = [f for f in sb.ls([self.filepath])] except: return False return True class WebHdfsSensor(BaseSensorOperator): """ Waits for a file or folder to land in HDFS """ template_fields = ('filepath',) @apply_defaults def __init__( self, filepath, webhdfs_conn_id='webhdfs_default', *args, **kwargs): super(WebHdfsSensor, self).__init__(*args, **kwargs) self.filepath = filepath self.webhdfs_conn_id = webhdfs_conn_id def poke(self, context): c = airflow.hooks.webhdfs_hook.WebHDFSHook(self.webhdfs_conn_id) logging.info( 'Poking for file {self.filepath} '.format(**locals())) return c.check_for_path(hdfs_path=self.filepath) class S3KeySensor(BaseSensorOperator): """ Waits for a key (a file-like instance on S3) to be present in a S3 bucket. S3 being a key/value it does not support folders. The path is just a key a resource. :param bucket_key: The key being waited on. Supports full s3:// style url or relative path from root level. :type bucket_key: str :param bucket_name: Name of the S3 bucket :type bucket_name: str :param wildcard_match: whether the bucket_key should be interpreted as a Unix wildcard pattern :type wildcard_match: bool :param s3_conn_id: a reference to the s3 connection :type s3_conn_id: str """ template_fields = ('bucket_key', 'bucket_name') @apply_defaults def __init__( self, bucket_key, bucket_name=None, wildcard_match=False, s3_conn_id='s3_default', *args, **kwargs): super(S3KeySensor, self).__init__(*args, **kwargs) session = settings.Session() db = session.query(DB).filter(DB.conn_id == s3_conn_id).first() if not db: raise AirflowException("conn_id doesn't exist in the repository") # Parse if bucket_name is None: parsed_url = urlparse(bucket_key) if parsed_url.netloc == '': raise AirflowException('Please provide a bucket_name') else: bucket_name = parsed_url.netloc if parsed_url.path[0] == '/': bucket_key = parsed_url.path[1:] else: bucket_key = parsed_url.path self.bucket_name = bucket_name self.bucket_key = bucket_key self.wildcard_match = wildcard_match self.s3_conn_id = s3_conn_id session.commit() session.close() def poke(self, context): import airflow.hooks.S3_hook hook = airflow.hooks.S3_hook.S3Hook(s3_conn_id=self.s3_conn_id) full_url = "s3://" + self.bucket_name + "/" + self.bucket_key logging.info('Poking for key : {full_url}'.format(**locals())) if self.wildcard_match: return hook.check_for_wildcard_key(self.bucket_key, self.bucket_name) else: return hook.check_for_key(self.bucket_key, self.bucket_name) class S3PrefixSensor(BaseSensorOperator): """ Waits for a prefix to exist. A prefix is the first part of a key, thus enabling checking of constructs similar to glob airfl* or SQL LIKE 'airfl%'. There is the possibility to precise a delimiter to indicate the hierarchy or keys, meaning that the match will stop at that delimiter. Current code accepts sane delimiters, i.e. characters that are NOT special characters in the Python regex engine. :param bucket_name: Name of the S3 bucket :type bucket_name: str :param prefix: The prefix being waited on. Relative path from bucket root level. :type prefix: str :param delimiter: The delimiter intended to show hierarchy. Defaults to '/'. :type delimiter: str """ template_fields = ('prefix', 'bucket_name') @apply_defaults def __init__( self, bucket_name, prefix, delimiter='/', s3_conn_id='s3_default', *args, **kwargs): super(S3PrefixSensor, self).__init__(*args, **kwargs) session = settings.Session() db = session.query(DB).filter(DB.conn_id == s3_conn_id).first() if not db: raise AirflowException("conn_id doesn't exist in the repository") # Parse self.bucket_name = bucket_name self.prefix = prefix self.delimiter = delimiter self.full_url = "s3://" + bucket_name + '/' + prefix self.s3_conn_id = s3_conn_id session.commit() session.close() def poke(self, context): logging.info('Poking for prefix : {self.prefix}\n' 'in bucket s3://{self.bucket_name}'.format(**locals())) import airflow.hooks.S3_hook hook = airflow.hooks.S3_hook.S3Hook(s3_conn_id=self.s3_conn_id) return hook.check_for_prefix( prefix=self.prefix, delimiter=self.delimiter, bucket_name=self.bucket_name) class TimeSensor(BaseSensorOperator): """ Waits until the specified time of the day. :param target_time: time after which the job succeeds :type target_time: datetime.time """ template_fields = tuple() @apply_defaults def __init__(self, target_time, *args, **kwargs): super(TimeSensor, self).__init__(*args, **kwargs) self.target_time = target_time def poke(self, context): logging.info( 'Checking if the time ({0}) has come'.format(self.target_time)) return datetime.now().time() > self.target_time class TimeDeltaSensor(BaseSensorOperator): """ Waits for a timedelta after the task's execution_date + schedule_interval. In Airflow, the daily task stamped with ``execution_date`` 2016-01-01 can only start running on 2016-01-02. The timedelta here represents the time after the execution period has closed. :param delta: time length to wait after execution_date before succeeding :type delta: datetime.timedelta """ template_fields = tuple() @apply_defaults def __init__(self, delta, *args, **kwargs): super(TimeDeltaSensor, self).__init__(*args, **kwargs) self.delta = delta def poke(self, context): dag = context['dag'] target_dttm = dag.following_schedule(context['execution_date']) target_dttm += self.delta logging.info('Checking if the time ({0}) has come'.format(target_dttm)) return datetime.now() > target_dttm class HttpSensor(BaseSensorOperator): """ Executes a HTTP get statement and returns False on failure: 404 not found or response_check function returned False :param http_conn_id: The connection to run the sensor against :type http_conn_id: string :param endpoint: The relative part of the full url :type endpoint: string :param params: The parameters to be added to the GET url :type params: a dictionary of string key/value pairs :param headers: The HTTP headers to be added to the GET request :type headers: a dictionary of string key/value pairs :param response_check: A check against the 'requests' response object. Returns True for 'pass' and False otherwise. :type response_check: A lambda or defined function. :param extra_options: Extra options for the 'requests' library, see the 'requests' documentation (options to modify timeout, ssl, etc.) :type extra_options: A dictionary of options, where key is string and value depends on the option that's being modified. """ template_fields = ('endpoint',) @apply_defaults def __init__(self, endpoint, http_conn_id='http_default', params=None, headers=None, response_check=None, extra_options=None, *args, **kwargs): super(HttpSensor, self).__init__(*args, **kwargs) self.endpoint = endpoint self.http_conn_id = http_conn_id self.params = params or {} self.headers = headers or {} self.extra_options = extra_options or {} self.response_check = response_check self.hook = hooks.http_hook.HttpHook(method='GET', http_conn_id=http_conn_id) def poke(self, context): logging.info('Poking: ' + self.endpoint) try: response = self.hook.run(self.endpoint, data=self.params, headers=self.headers, extra_options=self.extra_options) if self.response_check: # run content check on response return self.response_check(response) except AirflowException as ae: if str(ae).startswith("404"): return False raise ae return True
Java
/* Copyright 2014 Google Inc. All rights reserved. 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 multiwriter provides an io.Writer that duplicates its writes to multiple writers concurrently. package multiwriter import ( "io" ) // multiWriter duplicates writes to multiple writers. type multiWriter []io.Writer // New returns an io.Writer that duplicates writes to all provided writers. func New(w ...io.Writer) io.Writer { return multiWriter(w) } // Write writes p to all writers concurrently. If any errors occur, the shortest write is returned. func (mw multiWriter) Write(p []byte) (int, error) { done := make(chan result, len(mw)) for _, w := range mw { go send(w, p, done) } endResult := result{n: len(p)} for _ = range mw { res := <-done if res.err != nil && (endResult.err == nil || res.n < endResult.n) { endResult = res } } return endResult.n, endResult.err } func send(w io.Writer, p []byte, done chan<- result) { var res result res.n, res.err = w.Write(p) if res.n < len(p) && res.err == nil { res.err = io.ErrShortWrite } done <- res } type result struct { n int err error }
Java
package org.aksw.servicecat.web.api; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.aksw.servicecat.core.ServiceAnalyzerProcessor; import org.springframework.beans.factory.annotation.Autowired; @org.springframework.stereotype.Service @Path("/services") public class ServletServiceApi { @Autowired private ServiceAnalyzerProcessor processor; @GET @Produces(MediaType.APPLICATION_JSON) @Path("/put") public String registerService(@QueryParam("url") String serviceUrl) { processor.process(serviceUrl); String result = "{}"; return result; } }
Java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.macie2.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.macie2.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * AccountDetailMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class AccountDetailMarshaller { private static final MarshallingInfo<String> ACCOUNTID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("accountId").build(); private static final MarshallingInfo<String> EMAIL_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("email").build(); private static final AccountDetailMarshaller instance = new AccountDetailMarshaller(); public static AccountDetailMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(AccountDetail accountDetail, ProtocolMarshaller protocolMarshaller) { if (accountDetail == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(accountDetail.getAccountId(), ACCOUNTID_BINDING); protocolMarshaller.marshall(accountDetail.getEmail(), EMAIL_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
Java
package org.apache.rya.indexing.external; import java.net.UnknownHostException; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.util.List; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.rya.indexing.pcj.storage.PcjException; import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openrdf.model.URI; import org.openrdf.model.impl.LiteralImpl; import org.openrdf.model.impl.URIImpl; import org.openrdf.model.vocabulary.RDF; import org.openrdf.model.vocabulary.RDFS; import org.openrdf.query.BindingSet; import org.openrdf.query.MalformedQueryException; import org.openrdf.query.QueryEvaluationException; import org.openrdf.query.QueryLanguage; import org.openrdf.query.QueryResultHandlerException; import org.openrdf.query.TupleQueryResultHandler; import org.openrdf.query.TupleQueryResultHandlerException; import org.openrdf.repository.RepositoryException; import org.openrdf.repository.sail.SailRepository; import org.openrdf.repository.sail.SailRepositoryConnection; import org.openrdf.sail.SailException; import com.google.common.base.Optional; import org.apache.rya.api.persist.RyaDAOException; import org.apache.rya.rdftriplestore.inference.InferenceEngineException; public class AccumuloConstantPcjIntegrationTest { private SailRepositoryConnection conn, pcjConn; private SailRepository repo, pcjRepo; private Connector accCon; String prefix = "table_"; String tablename = "table_INDEX_"; URI obj, obj2, subclass, subclass2, talksTo; @Before public void init() throws RepositoryException, TupleQueryResultHandlerException, QueryEvaluationException, MalformedQueryException, AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, RyaDAOException, InferenceEngineException, NumberFormatException, UnknownHostException, SailException { repo = PcjIntegrationTestingUtil.getNonPcjRepo(prefix, "instance"); conn = repo.getConnection(); pcjRepo = PcjIntegrationTestingUtil.getPcjRepo(prefix, "instance"); pcjConn = pcjRepo.getConnection(); final URI sub = new URIImpl("uri:entity"); subclass = new URIImpl("uri:class"); obj = new URIImpl("uri:obj"); talksTo = new URIImpl("uri:talksTo"); conn.add(sub, RDF.TYPE, subclass); conn.add(sub, RDFS.LABEL, new LiteralImpl("label")); conn.add(sub, talksTo, obj); final URI sub2 = new URIImpl("uri:entity2"); subclass2 = new URIImpl("uri:class2"); obj2 = new URIImpl("uri:obj2"); conn.add(sub2, RDF.TYPE, subclass2); conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2")); conn.add(sub2, talksTo, obj2); accCon = new MockInstance("instance").getConnector("root",new PasswordToken("")); } @After public void close() throws RepositoryException, AccumuloException, AccumuloSecurityException, TableNotFoundException { PcjIntegrationTestingUtil.closeAndShutdown(conn, repo); PcjIntegrationTestingUtil.closeAndShutdown(pcjConn, pcjRepo); PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, prefix); PcjIntegrationTestingUtil.deleteIndexTables(accCon, 2, prefix); } @Test public void testEvaluateTwoIndexVarInstantiate1() throws PcjException, RepositoryException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, MalformedQueryException, SailException, QueryEvaluationException, TupleQueryResultHandlerException { final URI superclass = new URIImpl("uri:superclass"); final URI superclass2 = new URIImpl("uri:superclass2"); conn.add(subclass, RDF.TYPE, superclass); conn.add(subclass2, RDF.TYPE, superclass2); conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); final String indexSparqlString = ""// + "SELECT ?dog ?pig ?duck " // + "{" // + " ?pig a ?dog . "// + " ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "// + "}";// final String indexSparqlString2 = ""// + "SELECT ?o ?f ?e ?c ?l " // + "{" // + " ?e <uri:talksTo> ?o . "// + " ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " ?c a ?f . " // + "}";// final String queryString = ""// + "SELECT ?c ?l ?f ?o " // + "{" // + " <uri:entity> a ?c . "// + " <uri:entity> <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " <uri:entity> <uri:talksTo> ?o . "// + " ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " ?c a ?f . " // + "}";// PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1, indexSparqlString, new String[] { "dog", "pig", "duck" }, Optional.<PcjVarOrderFactory> absent()); PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 2, indexSparqlString2, new String[] { "o", "f", "e", "c", "l" }, Optional.<PcjVarOrderFactory> absent()); final CountingResultHandler crh1 = new CountingResultHandler(); final CountingResultHandler crh2 = new CountingResultHandler(); conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString) .evaluate(crh1); PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, prefix); pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); Assert.assertEquals(crh1.getCount(), crh2.getCount()); } @Test public void testEvaluateThreeIndexVarInstantiate() throws PcjException, RepositoryException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, MalformedQueryException, SailException, QueryEvaluationException, TupleQueryResultHandlerException { final URI superclass = new URIImpl("uri:superclass"); final URI superclass2 = new URIImpl("uri:superclass2"); final URI sub = new URIImpl("uri:entity"); subclass = new URIImpl("uri:class"); obj = new URIImpl("uri:obj"); talksTo = new URIImpl("uri:talksTo"); final URI howlsAt = new URIImpl("uri:howlsAt"); final URI subType = new URIImpl("uri:subType"); conn.add(subclass, RDF.TYPE, superclass); conn.add(subclass2, RDF.TYPE, superclass2); conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); conn.add(sub, howlsAt, superclass); conn.add(superclass, subType, obj); conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); final String indexSparqlString = ""// + "SELECT ?dog ?pig ?duck " // + "{" // + " ?pig a ?dog . "// + " ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "// + "}";// final String indexSparqlString2 = ""// + "SELECT ?o ?f ?e ?c ?l " // + "{" // + " ?e <uri:talksTo> ?o . "// + " ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " ?c a ?f . " // + "}";// final String indexSparqlString3 = ""// + "SELECT ?wolf ?sheep ?chicken " // + "{" // + " ?wolf <uri:howlsAt> ?sheep . "// + " ?sheep <uri:subType> ?chicken. "// + "}";// final String queryString = ""// + "SELECT ?c ?l ?f ?o " // + "{" // + " <uri:entity> a ?c . "// + " <uri:entity> <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " <uri:entity> <uri:talksTo> ?o . "// + " ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "// + " ?c a ?f . " // + " <uri:entity> <uri:howlsAt> ?f. "// + " ?f <uri:subType> <uri:obj>. "// + "}";// PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1, indexSparqlString, new String[] { "dog", "pig", "duck" }, Optional.<PcjVarOrderFactory> absent()); PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 2, indexSparqlString2, new String[] { "o", "f", "e", "c", "l" }, Optional.<PcjVarOrderFactory> absent()); PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 3, indexSparqlString3, new String[] { "wolf", "sheep", "chicken" }, Optional.<PcjVarOrderFactory> absent()); final CountingResultHandler crh1 = new CountingResultHandler(); final CountingResultHandler crh2 = new CountingResultHandler(); conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString) .evaluate(crh1); PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, prefix); pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate( crh2); Assert.assertEquals(crh1.getCount(), crh2.getCount()); } @Test public void testEvaluateFilterInstantiate() throws RepositoryException, PcjException, MalformedQueryException, SailException, QueryEvaluationException, TableNotFoundException, TupleQueryResultHandlerException, AccumuloException, AccumuloSecurityException { final URI e1 = new URIImpl("uri:e1"); final URI e2 = new URIImpl("uri:e2"); final URI e3 = new URIImpl("uri:e3"); final URI f1 = new URIImpl("uri:f1"); final URI f2 = new URIImpl("uri:f2"); final URI f3 = new URIImpl("uri:f3"); final URI g1 = new URIImpl("uri:g1"); final URI g2 = new URIImpl("uri:g2"); final URI g3 = new URIImpl("uri:g3"); conn.add(e1, talksTo, f1); conn.add(f1, talksTo, g1); conn.add(g1, talksTo, e1); conn.add(e2, talksTo, f2); conn.add(f2, talksTo, g2); conn.add(g2, talksTo, e2); conn.add(e3, talksTo, f3); conn.add(f3, talksTo, g3); conn.add(g3, talksTo, e3); final String queryString = ""// + "SELECT ?x ?y ?z " // + "{" // + "Filter(?x = <uri:e1>) . " // + " ?x <uri:talksTo> ?y. " // + " ?y <uri:talksTo> ?z. " // + " ?z <uri:talksTo> <uri:e1>. " // + "}";// final String indexSparqlString = ""// + "SELECT ?a ?b ?c ?d " // + "{" // + "Filter(?a = ?d) . " // + " ?a <uri:talksTo> ?b. " // + " ?b <uri:talksTo> ?c. " // + " ?c <uri:talksTo> ?d. " // + "}";// PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1, indexSparqlString, new String[] { "a", "b", "c", "d" }, Optional.<PcjVarOrderFactory> absent()); final CountingResultHandler crh1 = new CountingResultHandler(); final CountingResultHandler crh2 = new CountingResultHandler(); conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString) .evaluate(crh1); PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, prefix); pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); Assert.assertEquals(crh1.getCount(), crh2.getCount()); } @Test public void testEvaluateCompoundFilterInstantiate() throws RepositoryException, PcjException, MalformedQueryException, SailException, QueryEvaluationException, TableNotFoundException, TupleQueryResultHandlerException, AccumuloException, AccumuloSecurityException { final URI e1 = new URIImpl("uri:e1"); final URI f1 = new URIImpl("uri:f1"); conn.add(e1, talksTo, e1); conn.add(e1, talksTo, f1); conn.add(f1, talksTo, e1); final String queryString = ""// + "SELECT ?x ?y ?z " // + "{" // + "Filter(?x = <uri:e1> && ?y = <uri:e1>) . " // + " ?x <uri:talksTo> ?y. " // + " ?y <uri:talksTo> ?z. " // + " ?z <uri:talksTo> <uri:e1>. " // + "}";// final String indexSparqlString = ""// + "SELECT ?a ?b ?c ?d " // + "{" // + "Filter(?a = ?d && ?b = ?d) . " // + " ?a <uri:talksTo> ?b. " // + " ?b <uri:talksTo> ?c. " // + " ?c <uri:talksTo> ?d. " // + "}";// PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1, indexSparqlString, new String[] { "a", "b", "c", "d" }, Optional.<PcjVarOrderFactory> absent()); final CountingResultHandler crh1 = new CountingResultHandler(); final CountingResultHandler crh2 = new CountingResultHandler(); conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString) .evaluate(crh1); PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, prefix); pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate( crh2); Assert.assertEquals(2, crh1.getCount()); Assert.assertEquals(crh1.getCount(), crh2.getCount()); } public static class CountingResultHandler implements TupleQueryResultHandler { private int count = 0; public int getCount() { return count; } public void resetCount() { count = 0; } @Override public void startQueryResult(final List<String> arg0) throws TupleQueryResultHandlerException { } @Override public void handleSolution(final BindingSet arg0) throws TupleQueryResultHandlerException { count++; } @Override public void endQueryResult() throws TupleQueryResultHandlerException { } @Override public void handleBoolean(final boolean arg0) throws QueryResultHandlerException { } @Override public void handleLinks(final List<String> arg0) throws QueryResultHandlerException { } } }
Java
// Copyright 2007-2008 The Apache Software Foundation. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace MassTransit { using System; /// <summary> /// Specifies the elapsed time before a message expires. When a message expires, the content is no longer /// // important and it can be automatically discarded by the message service. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class ExpiresInAttribute : Attribute { private readonly TimeSpan _timeToLive; /// <summary> /// Specifies the elapsed time before the message expires. /// </summary> /// <param name="timeToLive">The duration of the time period.</param> public ExpiresInAttribute(string timeToLive) { TimeSpan value; if (!TimeSpan.TryParse(timeToLive, out value)) throw new ArgumentException("Unable to convert string to TimeSpan", "timeToLive"); _timeToLive = value; } /// <summary> /// Returns the TimeSpan for the message expiration /// </summary> public TimeSpan TimeToLive { get { return _timeToLive; } } } }
Java
# aws included via metadata.rb # if node[:ebs_volumes] # node[:ebs_volumes].each do |name, conf| # aws_ebs_volume "attach hdfs volume #{conf.inspect}" do # provider "aws_ebs_volume" # aws_access_key node[:aws][:aws_access_key] # aws_secret_access_key node[:aws][:aws_secret_access_key] # aws_region node[:aws][:aws_region] # availability_zone node[:aws][:availability_zone] # volume_id conf[:volume_id] # device conf[:device] # action :attach # end # end # end
Java
package de.jpaw.fixedpoint.tests; import java.math.BigDecimal; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import de.jpaw.fixedpoint.types.MicroUnits; public class TestConversions { @Test public void testFromConversions() throws Exception { MicroUnits fromLong = MicroUnits.valueOf(2); MicroUnits fromDouble = MicroUnits.valueOf(2.0); MicroUnits fromString = MicroUnits.valueOf("2.0"); MicroUnits fromBigDecimal = MicroUnits.valueOf(BigDecimal.valueOf(2)); MicroUnits fromMantissa = MicroUnits.of(2_000_000L); Assertions.assertEquals(fromMantissa, fromBigDecimal, "from BigDecimal"); Assertions.assertEquals(fromMantissa, fromString, "from String"); Assertions.assertEquals(fromMantissa, fromDouble, "from double"); Assertions.assertEquals(fromMantissa, fromLong, "from long"); } @Test public void testToConversions() throws Exception { MicroUnits value = MicroUnits.valueOf(2); Assertions.assertEquals("2", value.toString(), "to String"); Assertions.assertEquals(BigDecimal.valueOf(2).setScale(6), value.toBigDecimal(), "to BigDecimal"); Assertions.assertEquals(2, value.intValue(), "to int"); Assertions.assertEquals(2.0, value.doubleValue(), "to double"); Assertions.assertEquals(2_000_000L, value.getMantissa(), "to Mantissa"); } }
Java
package org.dominokit.domino.api.client; @FunctionalInterface public interface ApplicationStartHandler { void onApplicationStarted(); }
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_20) on Fri Mar 25 19:54:51 PDT 2011 --> <TITLE> org.apache.hadoop.io.nativeio (Hadoop 0.20.2-cdh3u0 API) </TITLE> <META NAME="date" CONTENT="2011-03-25"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../../../../../org/apache/hadoop/io/nativeio/package-summary.html" target="classFrame">org.apache.hadoop.io.nativeio</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Classes</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="NativeIO.html" title="class in org.apache.hadoop.io.nativeio" target="classFrame">NativeIO</A></FONT></TD> </TR> </TABLE> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Enums</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="Errno.html" title="enum in org.apache.hadoop.io.nativeio" target="classFrame">Errno</A></FONT></TD> </TR> </TABLE> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Exceptions</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="NativeIOException.html" title="class in org.apache.hadoop.io.nativeio" target="classFrame">NativeIOException</A></FONT></TD> </TR> </TABLE> </BODY> </HTML>
Java
Arkivo::Engine.routes.draw do namespace :api, defaults: { format: :json } do resources :items, except: :index end end
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jboss.arquillian.warp.utils; import java.io.UnsupportedEncodingException; import org.apache.commons.codec.DecoderException; /** * Abstract superclass for Base-N encoders and decoders. * * <p> * This class is not thread-safe. Each thread should use its own instance. * </p> */ public abstract class BaseNCodec { /** * MIME chunk size per RFC 2045 section 6.8. * * <p> * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any equal * signs. * </p> * * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a> */ public static final int MIME_CHUNK_SIZE = 76; /** * PEM chunk size per RFC 1421 section 4.3.2.4. * * <p> * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any equal * signs. * </p> * * @see <a href="http://tools.ietf.org/html/rfc1421">RFC 1421 section 4.3.2.4</a> */ public static final int PEM_CHUNK_SIZE = 64; private static final int DEFAULT_BUFFER_RESIZE_FACTOR = 2; /** * Defines the default buffer size - currently {@value} - must be large enough for at least one encoded block+separator */ private static final int DEFAULT_BUFFER_SIZE = 8192; /** Mask used to extract 8 bits, used in decoding bytes */ protected static final int MASK_8BITS = 0xff; /** * Byte used to pad output. */ protected static final byte PAD_DEFAULT = '='; // Allow static access to default protected final byte PAD = PAD_DEFAULT; // instance variable just in case it needs to vary later /** Number of bytes in each full block of unencoded data, e.g. 4 for Base64 and 5 for Base32 */ private final int unencodedBlockSize; /** Number of bytes in each full block of encoded data, e.g. 3 for Base64 and 8 for Base32 */ private final int encodedBlockSize; /** * Chunksize for encoding. Not used when decoding. A value of zero or less implies no chunking of the encoded data. Rounded * down to nearest multiple of encodedBlockSize. */ protected final int lineLength; /** * Size of chunk separator. Not used unless {@link #lineLength} > 0. */ private final int chunkSeparatorLength; /** * Buffer for streaming. */ protected byte[] buffer; /** * Position where next character should be written in the buffer. */ protected int pos; /** * Position where next character should be read from the buffer. */ private int readPos; /** * Boolean flag to indicate the EOF has been reached. Once EOF has been reached, this object becomes useless, and must be * thrown away. */ protected boolean eof; /** * Variable tracks how many characters have been written to the current line. Only used when encoding. We use it to make * sure each encoded line never goes beyond lineLength (if lineLength > 0). */ protected int currentLinePos; /** * Writes to the buffer only occur after every 3/5 reads when encoding, and every 4/8 reads when decoding. This variable * helps track that. */ protected int modulus; /** * Note <code>lineLength</code> is rounded down to the nearest multiple of {@link #encodedBlockSize} If * <code>chunkSeparatorLength</code> is zero, then chunking is disabled. * * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) * @param lineLength if &gt; 0, use chunking with a length <code>lineLength</code> * @param chunkSeparatorLength the chunk separator length, if relevant */ protected BaseNCodec(int unencodedBlockSize, int encodedBlockSize, int lineLength, int chunkSeparatorLength) { this.unencodedBlockSize = unencodedBlockSize; this.encodedBlockSize = encodedBlockSize; this.lineLength = (lineLength > 0 && chunkSeparatorLength > 0) ? (lineLength / encodedBlockSize) * encodedBlockSize : 0; this.chunkSeparatorLength = chunkSeparatorLength; } /** * Returns true if this object has buffered data for reading. * * @return true if there is data still available for reading. */ boolean hasData() { // package protected for access from I/O streams return this.buffer != null; } /** * Returns the amount of buffered data available for reading. * * @return The amount of buffered data available for reading. */ int available() { // package protected for access from I/O streams return buffer != null ? pos - readPos : 0; } /** * Get the default buffer size. Can be overridden. * * @return {@link #DEFAULT_BUFFER_SIZE} */ protected int getDefaultBufferSize() { return DEFAULT_BUFFER_SIZE; } /** Increases our buffer by the {@link #DEFAULT_BUFFER_RESIZE_FACTOR}. */ private void resizeBuffer() { if (buffer == null) { buffer = new byte[getDefaultBufferSize()]; pos = 0; readPos = 0; } else { byte[] b = new byte[buffer.length * DEFAULT_BUFFER_RESIZE_FACTOR]; System.arraycopy(buffer, 0, b, 0, buffer.length); buffer = b; } } /** * Ensure that the buffer has room for <code>size</code> bytes * * @param size minimum spare space required */ protected void ensureBufferSize(int size) { if ((buffer == null) || (buffer.length < pos + size)) { resizeBuffer(); } } /** * Extracts buffered data into the provided byte[] array, starting at position bPos, up to a maximum of bAvail bytes. * Returns how many bytes were actually extracted. * * @param b byte[] array to extract the buffered data into. * @param bPos position in byte[] array to start extraction at. * @param bAvail amount of bytes we're allowed to extract. We may extract fewer (if fewer are available). * @return The number of bytes successfully extracted into the provided byte[] array. */ int readResults(byte[] b, int bPos, int bAvail) { // package protected for access from I/O streams if (buffer != null) { int len = Math.min(available(), bAvail); System.arraycopy(buffer, readPos, b, bPos, len); readPos += len; if (readPos >= pos) { buffer = null; // so hasData() will return false, and this method can return -1 } return len; } return eof ? -1 : 0; } /** * Checks if a byte value is whitespace or not. Whitespace is taken to mean: space, tab, CR, LF * * @param byteToCheck the byte to check * @return true if byte is whitespace, false otherwise */ protected static boolean isWhiteSpace(byte byteToCheck) { switch (byteToCheck) { case ' ': case '\n': case '\r': case '\t': return true; default: return false; } } /** * Resets this object to its initial newly constructed state. */ private void reset() { buffer = null; pos = 0; readPos = 0; currentLinePos = 0; modulus = 0; eof = false; } /** * Encodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of the Encoder * interface, and will throw an IllegalStateException if the supplied object is not of type byte[]. * * @param pObject Object to encode * @return An object (of type byte[]) containing the Base-N encoded data which corresponds to the byte[] supplied. * @throws IllegalStateException if the parameter supplied is not of type byte[] */ public Object encode(Object pObject) { if (!(pObject instanceof byte[])) { throw new IllegalStateException("Parameter supplied to Base-N encode is not a byte[]"); } return encode((byte[]) pObject); } /** * Encodes a byte[] containing binary data, into a String containing characters in the Base-N alphabet. * * @param pArray a byte array containing binary data * @return A String containing only Base-N character data */ public String encodeToString(byte[] pArray) { return newStringUtf8(encode(pArray)); } /** * Decodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of the Decoder * interface, and will throw a DecoderException if the supplied object is not of type byte[] or String. * * @param pObject Object to decode * @return An object (of type byte[]) containing the binary data which corresponds to the byte[] or String supplied. * @throws DecoderException if the parameter supplied is not of type byte[] */ public Object decode(Object pObject) throws IllegalStateException { if (pObject instanceof byte[]) { return decode((byte[]) pObject); } else if (pObject instanceof String) { return decode((String) pObject); } else { throw new IllegalStateException("Parameter supplied to Base-N decode is not a byte[] or a String"); } } /** * Decodes a String containing characters in the Base-N alphabet. * * @param pArray A String containing Base-N character data * @return a byte array containing binary data */ public byte[] decode(String pArray) { return decode(getBytesUtf8(pArray)); } /** * Decodes a byte[] containing characters in the Base-N alphabet. * * @param pArray A byte array containing Base-N character data * @return a byte array containing binary data */ public byte[] decode(byte[] pArray) { reset(); if (pArray == null || pArray.length == 0) { return pArray; } decode(pArray, 0, pArray.length); decode(pArray, 0, -1); // Notify decoder of EOF. byte[] result = new byte[pos]; readResults(result, 0, result.length); return result; } /** * Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet. * * @param pArray a byte array containing binary data * @return A byte array containing only the basen alphabetic character data */ public byte[] encode(byte[] pArray) { reset(); if (pArray == null || pArray.length == 0) { return pArray; } encode(pArray, 0, pArray.length); encode(pArray, 0, -1); // Notify encoder of EOF. byte[] buf = new byte[pos - readPos]; readResults(buf, 0, buf.length); return buf; } /** * Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet. Uses UTF8 * encoding. * * @param pArray a byte array containing binary data * @return String containing only character data in the appropriate alphabet. */ public String encodeAsString(byte[] pArray) { return newStringUtf8(encode(pArray)); } abstract void encode(byte[] pArray, int i, int length); // package protected for access from I/O streams abstract void decode(byte[] pArray, int i, int length); // package protected for access from I/O streams /** * Returns whether or not the <code>octet</code> is in the current alphabet. Does not allow whitespace or pad. * * @param value The value to test * * @return <code>true</code> if the value is defined in the current alphabet, <code>false</code> otherwise. */ protected abstract boolean isInAlphabet(byte value); /** * Tests a given byte array to see if it contains only valid characters within the alphabet. The method optionally treats * whitespace and pad as valid. * * @param arrayOctet byte array to test * @param allowWSPad if <code>true</code>, then whitespace and PAD are also allowed * * @return <code>true</code> if all bytes are valid characters in the alphabet or if the byte array is empty; * <code>false</code>, otherwise */ public boolean isInAlphabet(byte[] arrayOctet, boolean allowWSPad) { for (int i = 0; i < arrayOctet.length; i++) { if (!isInAlphabet(arrayOctet[i]) && (!allowWSPad || (arrayOctet[i] != PAD) && !isWhiteSpace(arrayOctet[i]))) { return false; } } return true; } /** * Tests a given String to see if it contains only valid characters within the alphabet. The method treats whitespace and * PAD as valid. * * @param basen String to test * @return <code>true</code> if all characters in the String are valid characters in the alphabet or if the String is empty; * <code>false</code>, otherwise * @see #isInAlphabet(byte[], boolean) */ public boolean isInAlphabet(String basen) { return isInAlphabet(getBytesUtf8(basen), true); } /** * Tests a given byte array to see if it contains any characters within the alphabet or PAD. * * Intended for use in checking line-ending arrays * * @param arrayOctet byte array to test * @return <code>true</code> if any byte is a valid character in the alphabet or PAD; <code>false</code> otherwise */ protected boolean containsAlphabetOrPad(byte[] arrayOctet) { if (arrayOctet == null) { return false; } for (byte element : arrayOctet) { if (PAD == element || isInAlphabet(element)) { return true; } } return false; } /** * Calculates the amount of space needed to encode the supplied array. * * @param pArray byte[] array which will later be encoded * * @return amount of space needed to encoded the supplied array. Returns a long since a max-len array will require > * Integer.MAX_VALUE */ public long getEncodedLength(byte[] pArray) { // Calculate non-chunked size - rounded up to allow for padding // cast to long is needed to avoid possibility of overflow long len = ((pArray.length + unencodedBlockSize - 1) / unencodedBlockSize) * (long) encodedBlockSize; if (lineLength > 0) { // We're using chunking // Round up to nearest multiple len += ((len + lineLength - 1) / lineLength) * chunkSeparatorLength; } return len; } /** * Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8 charset. * * @param bytes The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-8 charset, or <code>null</code> * if the input byte array was <code>null</code>. * @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen * since the charset is required. */ public static String newStringUtf8(byte[] bytes) { if (bytes == null) { return null; } try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8", e); } } /** * Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte array. * * @param string the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws IllegalStateException Thrown when the charset is missing, which should be never according the the Java * specification. * @see <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/nio/charset/Charset.html">Standard charsets</a> * @see #getBytesUnchecked(String, String) */ public static byte[] getBytesUtf8(String string) { if (string == null) { return null; } try { return string.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8", e); } } }
Java
public class Customers { public static string[] allCustomers = {"Peter Parker", "Klark Kent", "Bruce Vayne"}; }
Java
# Zygnema gorakhporense Singh SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
Java
package dk.lessismore.nojpa.reflection.db.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created : with IntelliJ IDEA. * User: seb */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface SearchField { public static final String NULL = ""; public boolean translate() default false; public boolean searchReverse() default false; public float boostFactor() default 3f; public float reverseBoostFactor() default 0.3f; public String dynamicSolrPostName() default NULL; }
Java
/* * 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. */ package com.hoang.fu; /** * * @author hoangpt */ public class Teacher extends Employee implements ITeacher { Teacher(String name) { this.name = name; } @Override float calculateSalary(){ return 500f; } @Override public int calculateBonus() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public float calculateAllowance() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
Java
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org) package org.xbill.DNS; import java.io.*; import java.util.*; import org.xbill.DNS.utils.*; /** * Transaction Signature - this record is automatically generated by the * resolver. TSIG records provide transaction security between the * sender and receiver of a message, using a shared key. * @see org.xbill.DNS.Resolver * @see org.xbill.DNS.TSIG * * @author Brian Wellington */ public class TSIGRecord extends Record { private static final long serialVersionUID = -88820909016649306L; private Name alg; private Date timeSigned; private int fudge; private byte [] signature; private int originalID; private int error; private byte [] other; TSIGRecord() {} Record getObject() { return new TSIGRecord(); } /** * Creates a TSIG Record from the given data. This is normally called by * the TSIG class * @param alg The shared key's algorithm * @param timeSigned The time that this record was generated * @param fudge The fudge factor for time - if the time that the message is * received is not in the range [now - fudge, now + fudge], the signature * fails * @param signature The signature * @param originalID The message ID at the time of its generation * @param error The extended error field. Should be 0 in queries. * @param other The other data field. Currently used only in BADTIME * responses. * @see org.xbill.DNS.TSIG */ public TSIGRecord(Name name, int dclass, long ttl, Name alg, Date timeSigned, int fudge, byte [] signature, int originalID, int error, byte other[]) { super(name, Type.TSIG, dclass, ttl); this.alg = checkName("alg", alg); this.timeSigned = timeSigned; this.fudge = checkU16("fudge", fudge); this.signature = signature; this.originalID = checkU16("originalID", originalID); this.error = checkU16("error", error); this.other = other; } void rrFromWire(DNSInput in) throws IOException { alg = new Name(in); long timeHigh = in.readU16(); long timeLow = in.readU32(); long time = (timeHigh << 32) + timeLow; timeSigned = new Date(time * 1000); fudge = in.readU16(); int sigLen = in.readU16(); signature = in.readByteArray(sigLen); originalID = in.readU16(); error = in.readU16(); int otherLen = in.readU16(); if (otherLen > 0) other = in.readByteArray(otherLen); else other = null; } void rdataFromString(Tokenizer st, Name origin) throws IOException { throw st.exception("no text format defined for TSIG"); } /** Converts rdata to a String */ String rrToString() { StringBuffer sb = new StringBuffer(); sb.append(alg); sb.append(" "); if (Options.check("multiline")) sb.append("(\n\t"); sb.append (timeSigned.getTime() / 1000); sb.append (" "); sb.append (fudge); sb.append (" "); sb.append (signature.length); if (Options.check("multiline")) { sb.append ("\n"); sb.append (base64.formatString(signature, 64, "\t", false)); } else { sb.append (" "); sb.append (base64.toString(signature)); } sb.append (" "); sb.append (Rcode.TSIGstring(error)); sb.append (" "); if (other == null) sb.append (0); else { sb.append (other.length); if (Options.check("multiline")) sb.append("\n\n\n\t"); else sb.append(" "); if (error == Rcode.BADTIME) { if (other.length != 6) { sb.append("<invalid BADTIME other data>"); } else { long time = ((long)(other[0] & 0xFF) << 40) + ((long)(other[1] & 0xFF) << 32) + ((other[2] & 0xFF) << 24) + ((other[3] & 0xFF) << 16) + ((other[4] & 0xFF) << 8) + ((other[5] & 0xFF) ); sb.append("<server time: "); sb.append(new Date(time * 1000)); sb.append(">"); } } else { sb.append("<"); sb.append(base64.toString(other)); sb.append(">"); } } if (Options.check("multiline")) sb.append(" )"); return sb.toString(); } /** Returns the shared key's algorithm */ public Name getAlgorithm() { return alg; } /** Returns the time that this record was generated */ public Date getTimeSigned() { return timeSigned; } /** Returns the time fudge factor */ public int getFudge() { return fudge; } /** Returns the signature */ public byte [] getSignature() { return signature; } /** Returns the original message ID */ public int getOriginalID() { return originalID; } /** Returns the extended error */ public int getError() { return error; } /** Returns the other data */ public byte [] getOther() { return other; } void rrToWire(DNSOutput out, Compression c, boolean canonical) { alg.toWire(out, null, canonical); long time = timeSigned.getTime() / 1000; int timeHigh = (int) (time >> 32); long timeLow = (time & 0xFFFFFFFFL); out.writeU16(timeHigh); out.writeU32(timeLow); out.writeU16(fudge); out.writeU16(signature.length); out.writeByteArray(signature); out.writeU16(originalID); out.writeU16(error); if (other != null) { out.writeU16(other.length); out.writeByteArray(other); } else out.writeU16(0); } }
Java
-- Users delete from user where id <= 6; insert into user (id,password,user_name, email, role) values (6,'$2a$08$rWw15tM4D8JGNkoSnosvUOWktluv1CnxCZfJslvHWaiFSaSOpnYZS','boisterous', 'neuban35@gmail.com', 'USER'); insert into user (id,password,user_name, email, role) values (5,'$2a$08$2/f6i7QzmdvM0wVDghFdkOUPtUA66SSaOGCNZj8uEczUodB49ZpIS','traumatic', 'neuban34@gmail.com', 'USER'); insert into user (id,password,user_name, email, role) values (4,'$2a$08$rxpMCbm7zfyQR5GVaah1duKOyoGDPCgsN1ruXkWgUagbfyyXl7J/a','chopchop', 'neuban33@gmail.com', 'USER'); insert into user (id,password,user_name, email, role) values (3,'$2a$08$5MBR1BRsenDZSKyQoofETubRmvH3GIxgDs3LTZlCFMjfftFn3HM9K','krisztmas', 'neuban32@gmail.com', 'USER'); insert into user (id,password,user_name, email, role) values (2,'$2a$08$P2LGQAUIk6TjQcLE533Ec.5EFTwUPJOmt1LsDKmS9PbJxW6tKGz8u','pivanyi', 'neuban31@gmail.com', 'USER'); insert into user (id,password,user_name, email, role) values (1,'$2a$08$0E.G3Tt9BsDtapmmc1pgruh4myKCy6ySEi//ptScWjRmres1U0txi','falatka', 'neuban3@gmail.com', 'USER'); -- Boards delete from board where id <= 2; insert into board (id,title) values (1,'Test board 1'); insert into board (id,title) values (2,'Test board 2'); -- User-Board delete from user_board_relation_table where user_id = 1; insert into user_board_relation_table (user_id,board_id) values (1,1); insert into user_board_relation_table (user_id,board_id) values (1,2); -- Columns delete from board_column where id <= 4; insert into board_column (id,title,board_id) values (1,'TODO',1); insert into board_column (id,title,board_id) values (2,'IN DEV',1); insert into board_column (id,title,board_id) values (3,'QA',1); insert into board_column (id,title,board_id) values (4,'DONE',1); -- Cards delete from card where id <= 8; insert into card (id,description,title,column_id) values (1,'Sample description for task 1','Task 1',1); insert into card (id,description,title,column_id) values (2,'Sample description for task 2','Task 2',1); insert into card (id,description,title,column_id) values (3,'Sample description for task 3','Task 3',2); insert into card (id,description,title,column_id) values (4,'Sample description for task 4','Task 4',3); insert into card (id,description,title,column_id) values (5,'Sample description for task 5','Task 5',3); insert into card (id,description,title,column_id) values (6,'Sample description for task 6','Task 6',4); insert into card (id,description,title,column_id) values (7,'Sample description for task 7','Task 7',4); insert into card (id,description,title,column_id) values (8,'Sample description for task 8','Task 8',4); insert into comment (id,content,created_time,user_id,card_id) values (1,"Some birthday content",'1993-12-03 12:30',1,1); insert into comment (id,content,created_time,user_id,card_id) values (2,"Some birthday content",'1994-08-20 12:30',2,1); insert into comment (id,content,created_time,user_id,card_id) values (3,"Some birthday content",'1994-08-19 06:30',3,1); -- User-Card delete from user_card_relation_table where user_id = 1; insert into user_card_relation_table (card_id,user_id) values (3,1); insert into user_card_relation_table (card_id,user_id) values (4,1); insert into user_card_relation_table (card_id,user_id) values (7,1);
Java
package app.monitor.job; import core.framework.internal.log.LogManager; import core.framework.json.JSON; import core.framework.kafka.MessagePublisher; import core.framework.log.message.StatMessage; import core.framework.scheduler.Job; import core.framework.scheduler.JobContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.time.Duration; import java.time.Instant; import java.time.ZonedDateTime; import java.util.List; import java.util.Map; /** * @author neo */ public class KubeMonitorJob implements Job { public final MessagePublisher<StatMessage> publisher; public final KubeClient kubeClient; public final List<String> namespaces; private final Logger logger = LoggerFactory.getLogger(KubeMonitorJob.class); public KubeMonitorJob(List<String> namespaces, KubeClient kubeClient, MessagePublisher<StatMessage> publisher) { this.publisher = publisher; this.kubeClient = kubeClient; this.namespaces = namespaces; } @Override public void execute(JobContext context) { try { var now = ZonedDateTime.now(); for (String namespace : namespaces) { KubePodList pods = kubeClient.listPods(namespace); for (KubePodList.Pod pod : pods.items) { String errorMessage = check(pod, now); if (errorMessage != null) { publishPodFailure(pod, errorMessage); } } } } catch (Throwable e) { logger.error(e.getMessage(), e); publisher.publish(StatMessageFactory.failedToCollect(LogManager.APP_NAME, null, e)); } } String check(KubePodList.Pod pod, ZonedDateTime now) { if (pod.metadata.deletionTimestamp != null) { Duration elapsed = Duration.between(pod.metadata.deletionTimestamp, now); if (elapsed.toSeconds() >= 300) { return "pod is still in deletion, elapsed=" + elapsed; } return null; } String phase = pod.status.phase; if ("Succeeded".equals(phase)) return null; // terminated if ("Failed".equals(phase) || "Unknown".equals(phase)) return "unexpected pod phase, phase=" + phase; if ("Pending".equals(phase)) { // newly created pod may not have container status yet, containerStatuses is initialized as empty for (KubePodList.ContainerStatus status : pod.status.containerStatuses) { if (status.state.waiting != null && "ImagePullBackOff".equals(status.state.waiting.reason)) { return "ImagePullBackOff: " + status.state.waiting.message; } } // for unschedulable pod for (KubePodList.PodCondition condition : pod.status.conditions) { if ("PodScheduled".equals(condition.type) && "False".equals(condition.status) && Duration.between(condition.lastTransitionTime, now).toSeconds() >= 300) { return condition.reason + ": " + condition.message; } } } if ("Running".equals(phase)) { boolean ready = true; for (KubePodList.ContainerStatus status : pod.status.containerStatuses) { if (status.state.waiting != null && "CrashLoopBackOff".equals(status.state.waiting.reason)) { return "CrashLoopBackOff: " + status.state.waiting.message; } boolean containerReady = Boolean.TRUE.equals(status.ready); if (!containerReady && status.lastState != null && status.lastState.terminated != null) { var terminated = status.lastState.terminated; return "pod was terminated, reason=" + terminated.reason + ", exitCode=" + terminated.exitCode; } if (!containerReady) { ready = false; } } if (ready) return null; // all running, all ready } ZonedDateTime startTime = pod.status.startTime != null ? pod.status.startTime : pod.metadata.creationTimestamp; // startTime may not be populated yet if pod is just created Duration elapsed = Duration.between(startTime, now); if (elapsed.toSeconds() >= 300) { // can be: 1) took long to be ready after start, or 2) readiness check failed in the middle run return "pod is not in ready state, uptime=" + elapsed; } return null; } private void publishPodFailure(KubePodList.Pod pod, String errorMessage) { var now = Instant.now(); var message = new StatMessage(); message.id = LogManager.ID_GENERATOR.next(now); message.date = now; message.result = "ERROR"; message.app = pod.metadata.labels.getOrDefault("app", pod.metadata.name); message.host = pod.metadata.name; message.errorCode = "POD_FAILURE"; message.errorMessage = errorMessage; message.info = Map.of("pod", JSON.toJSON(pod)); publisher.publish(message); } }
Java
/* * 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. */ import {AfterViewInit, ElementRef, EventEmitter, Injector, OnDestroy, OnInit, Output} from '@angular/core'; import {AbstractComponent} from '@common/component/abstract.component'; import {Field, Rule} from '@domain/data-preparation/pr-dataset'; export abstract class EditRuleComponent extends AbstractComponent implements OnInit, AfterViewInit, OnDestroy { /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Private Variables |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Protected Variables |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Public Variables |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ public isShow: boolean = false; public mode: string = 'APPEND'; public ruleVO: Rule; public colDescs: any; public fields: Field[]; public selectedFields: Field[] = []; public forceFormula: string = ''; public forceCondition: string = ''; @Output() public onEvent: EventEmitter<any> = new EventEmitter(); /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Constructor |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ // 생성자 protected constructor( protected elementRef: ElementRef, protected injector: Injector) { super(elementRef, injector); } /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Override Method |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * 컴포넌트 초기 실행 */ public ngOnInit() { super.ngOnInit(); } // function - ngOnInit /** * 화면 초기화 */ public ngAfterViewInit() { super.ngAfterViewInit(); } // function - ngAfterViewInit /** * 컴포넌트 제거 */ public ngOnDestroy() { super.ngOnDestroy(); } // function - ngOnDestroy /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Public Method - API |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ public init(fields: Field[], selectedFields: Field[], data?: { ruleString?: string, jsonRuleString: any }) { this.fields = fields; this.selectedFields = selectedFields; if (!this.isNullOrUndefined(data)) { this.parsingRuleString(data); } this.beforeShowComp(); this.isShow = true; this.safelyDetectChanges(); this.afterShowComp(); this.safelyDetectChanges(); } // function - init public setValue(key: string, value: any) { Object.keys(this).some(item => { if (key === item && 'function' !== typeof this[key]) { this[key] = value; return true; } else { return false; } }); this.safelyDetectChanges(); } // function - setValue /** * Apply formula using Advanced formula popup * @param {{command: string, formula: string}} data */ public doneInputFormula(data: { command: string, formula: string }) { if (data.command === 'setCondition') { this.setValue('forceCondition', data.formula); } else { this.setValue('forceFormula', data.formula); } } /** * Returns value of variable name equals the key * @param {string} key * @returns {string} */ public getValue(key: string): string { let returnValue: string = undefined; if (!this.isNullOrUndefined(this[key])) { returnValue = this[key]; } this.safelyDetectChanges(); return returnValue; } // function - setValue /** * Rule 형식 정의 및 반환 */ public abstract getRuleData(); /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Public Method |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Protected Method |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * 컴포넌트 표시 전 실행 * @protected */ protected abstract beforeShowComp(); /** * 컴포넌트 표시 후 실행 * @protected */ protected abstract afterShowComp(); /** * rule string 을 분석한다. * @param ruleString * @protected */ protected abstract parsingRuleString(ruleString: any); protected getColumnNamesInArray(fields: Field[], isWrap: boolean = false): string[] { return fields.map((item) => { if (isWrap) { return '`' + item.name + '`' } else { return item.name } }); } /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | Private Method |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ }
Java
package mahjong type Hand []Pai func remove(list []Pai, p Pai) []Pai { var result []Pai removed := false for _, e := range list { if e == p && !removed { removed = true } else { result = append(result, e) } } return result } func contain(list []Pai, p Pai) bool { for _, a := range list { if a == p { return true } } return false } func contain2(list []Pai, p Pai) bool { count := 0 for _, a := range list { if a == p { count += 1 } } return count >= 2 } func createCandidates(list []Pai, cand [][][]Pai) [][][]Pai { if len(list) <= 0 { return cand } current := list[0] remain := list[1:] nextOne := current + 1 nextTwo := current + 2 if current.IsNumber() { if current.Suit() == nextOne.Suit() && current.Suit() == nextTwo.Suit() && contain(remain, nextOne) && contain(remain, nextTwo) { idx := len(cand) - 1 tmp := make([][]Pai, len(cand[idx])) copy(tmp, cand[idx]) cand[idx] = append(cand[idx], []Pai{current, nextOne, nextTwo}) _remain := remove(remove(remain, nextOne), nextTwo) cand = createCandidates(_remain, cand) cand = append(cand, tmp) } if current.Suit() == nextOne.Suit() && contain(remain, nextOne) { idx := len(cand) - 1 tmp := make([][]Pai, len(cand[idx])) copy(tmp, cand[idx]) cand[len(cand)-1] = append(cand[len(cand)-1], []Pai{current, nextOne}) _remain := remove(remain, nextOne) cand = createCandidates(_remain, cand) cand = append(cand, tmp) } if current.Suit() == nextTwo.Suit() && contain(remain, nextTwo) { idx := len(cand) - 1 tmp := make([][]Pai, len(cand[idx])) copy(tmp, cand[idx]) cand[len(cand)-1] = append(cand[len(cand)-1], []Pai{current, nextTwo}) _remain := remove(remain, nextTwo) cand = createCandidates(_remain, cand) cand = append(cand, tmp) } } if contain2(remain, current) { idx := len(cand) - 1 tmp := make([][]Pai, len(cand[idx])) copy(tmp, cand[idx]) cand[len(cand)-1] = append(cand[len(cand)-1], []Pai{current, current, current}) _remain := remove(remove(remain, current), current) cand = createCandidates(_remain, cand) cand = append(cand, tmp) } if contain(remain, current) { idx := len(cand) - 1 tmp := make([][]Pai, len(cand[idx])) copy(tmp, cand[idx]) cand[len(cand)-1] = append(cand[len(cand)-1], []Pai{current, current}) _remain := remove(remain, current) cand = createCandidates(_remain, cand) cand = append(cand, tmp) } cand[len(cand)-1] = append(cand[len(cand)-1], []Pai{current}) return createCandidates(remain, cand) } func isUnique(list []Pai) bool { result := []Pai{} for _, p := range list { if contain(result, p) { // nothing to do } else { result = append(result, p) } } return len(list) == len(result) } func isSevenPairs(list [][]Pai) bool { if len(list) != 7 { return false } stack := []Pai{} for _, pair := range list { if len(pair) == 2 && pair[0] != pair[1] { return false } stack = append(stack, pair[0]) } return isUnique(stack) } func isThirteenOrphans(list [][]Pai) bool { if len(list) == 12 || len(list) == 13 { for _, pair := range list { for _, pai := range pair { if !pai.IsOrphan() { return false } } } return true } return false } func (hand *Hand) IsTenpai() bool { _hand := *hand cand := [][][]Pai{[][]Pai{}} cand = createCandidates(_hand, cand) for _, a := range cand { // regular type if len(a) == 5 { return true } // seven pairs if isSevenPairs(a) { return true } if isThirteenOrphans(a) { return true } } return false }
Java
/* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package org.apache.geode.internal.logging.log4j; import static org.apache.geode.test.util.ResourceUtils.createFileFromResource; import static org.apache.geode.test.util.ResourceUtils.getResource; import static org.assertj.core.api.Assertions.assertThat; import java.net.URL; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.junit.LoggerContextRule; import org.apache.logging.log4j.test.appender.ListAppender; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.apache.geode.internal.logging.LogService; import org.apache.geode.test.junit.categories.LoggingTest; @Category(LoggingTest.class) public class GemfireVerboseMarkerFilterAcceptIntegrationTest { private static final String APPENDER_NAME = "LIST"; private static String configFilePath; private Logger logger; private String logMessage; private ListAppender listAppender; @ClassRule public static TemporaryFolder temporaryFolder = new TemporaryFolder(); @Rule public LoggerContextRule loggerContextRule = new LoggerContextRule(configFilePath); @BeforeClass public static void setUpLogConfigFile() throws Exception { String configFileName = GemfireVerboseMarkerFilterAcceptIntegrationTest.class.getSimpleName() + "_log4j2.xml"; URL resource = getResource(configFileName); configFilePath = createFileFromResource(resource, temporaryFolder.getRoot(), configFileName) .getAbsolutePath(); } @Before public void setUp() throws Exception { logger = LogService.getLogger(); logMessage = "this is a log statement"; assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo()) .isFalse(); listAppender = loggerContextRule.getListAppender(APPENDER_NAME); } @Test public void gemfireVerboseShouldLogIfGemfireVerboseIsAccept() { logger.info(LogMarker.GEMFIRE_VERBOSE, logMessage); LogEvent logEvent = listAppender.getEvents().get(0); assertThat(logEvent.getLoggerName()).isEqualTo(logger.getName()); assertThat(logEvent.getLevel()).isEqualTo(Level.INFO); assertThat(logEvent.getMessage().getFormattedMessage()).isEqualTo(logMessage); } @Test public void geodeVerboseShouldLogIfGemfireVerboseIsAccept() { logger.info(LogMarker.GEODE_VERBOSE, logMessage); LogEvent logEvent = listAppender.getEvents().get(0); assertThat(logEvent.getLoggerName()).isEqualTo(logger.getName()); assertThat(logEvent.getLevel()).isEqualTo(Level.INFO); assertThat(logEvent.getMessage().getFormattedMessage()).isEqualTo(logMessage); } }
Java
/* ** Stack.cpp for cpp_abstractvm in /var/projects/cpp_abstractvm/Stack.cpp ** ** Made by kevin labbe ** Login <labbe_k@epitech.net> ** ** Started on Mar 1, 2014 2:15:13 AM 2014 kevin labbe ** Last update Mar 1, 2014 2:15:13 AM 2014 kevin labbe */ #include "EmptyStackException.hpp" #include "AssertFailedException.hpp" #include "WrongParameterException.hpp" #include "Stack.hpp" namespace Arithmetic { Stack::Stack() { _funcs["add"] = &Stack::add; _funcs["sub"] = &Stack::sub; _funcs["mul"] = &Stack::mul; _funcs["div"] = &Stack::div; _funcs["mod"] = &Stack::mod; _funcs["pop"] = &Stack::pop; _funcs["dump"] = &Stack::dump; _funcs["print"] = &Stack::print; } Stack::~Stack() { } void Stack::execFunc(const std::string& name) { if (_funcs[name.c_str()]) (this->*_funcs[name.c_str()])(); } void Stack::push(IOperand* op) { _stack.push_front(op); } void Stack::pop() { if (_stack.empty()) throw Exception::EmptyStackException("pop"); delete _stack.front(); _stack.pop_front(); } void Stack::assert(IOperand* op) { if (_stack.empty()) throw Exception::AssertFailedException("Stack empty"); if (_stack.front()->getPrecision() != op->getPrecision() || _stack.front()->getType() != op->getType() || _stack.front()->toString() != op->toString()) throw Exception::AssertFailedException("Operand different at the top of the stack"); } void Stack::dump() { for (std::deque<IOperand*>::iterator it = _stack.begin(); it != _stack.end(); it++) std::cout << (*it)->toString() << std::endl; } void Stack::print() { std::stringstream stream; char chr; int nbr; if (_stack.empty()) throw Exception::EmptyStackException("print"); if (_stack.front()->getType() != INT8) throw Exception::WrongParameterException("print expects an int8 at the top of the stack"); stream << _stack.front()->toString(); stream >> nbr; chr = nbr; std::cout << chr << std::endl; } void Stack::add() { _loadOperands(); _pushResult(*_op1 + *_op2); } void Stack::sub() { _loadOperands(); _pushResult(*_op1 - *_op2); } void Stack::mul() { _loadOperands(); _pushResult(*_op1 * *_op2); } void Stack::div() { _loadOperands(); _pushResult(*_op1 / *_op2); } void Stack::mod() { _loadOperands(); _pushResult(*_op1 % *_op2); } void Stack::_loadOperands() { if (_stack.size() < 2) throw Exception::EmptyStackException("Calc"); _op1 = _stack.front(); _stack.pop_front(); _op2 = _stack.front(); _stack.pop_front(); } void Stack::_pushResult(IOperand* result) { _stack.push_front(result); delete _op1; delete _op2; } } /* namespace Arithmetic */
Java
# Di Roccia | Di Luce Website of the exibition [Di Roccia | Di Luce](http://www.dirocciadiluce.it) ## Credits * Theme by [Grayscale](http://startbootstrap.com/template-overviews/grayscale/) * Gallery by [Bootstrap Lightbox](http://ashleydw.github.io/lightbox/)
Java
# Tomodon Rafinesque, 1838 GENUS #### Status ACCEPTED #### According to IRMNG Homonym List #### Published in null #### Original name null ### Remarks null
Java
# Misgomyces perigonae Thaxt. SPECIES #### Status ACCEPTED #### According to Index Fungorum #### Published in Mem. Amer. Acad. Arts 16: 294 (1931) #### Original name Misgomyces perigonae Thaxt. ### Remarks null
Java
# Tilletiopsis Derx, 1948 GENUS #### Status ACCEPTED #### According to Interim Register of Marine and Nonmarine Genera #### Published in null #### Original name null ### Remarks null
Java
# Oleispira Yakimov, Giuliano, Gentile, Crisafi, Chernikova, Abraham, Lunsdorf, Timmis & Golyshin, 2003 GENUS #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
Java
# Solidago caesia var. paniculata A.Gray VARIETY #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
Java
# Oncocalyx glabratus (Engl.) M.G.Gilbert SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
Java
# Listrostachys whytei Rolfe SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
Java
import { Upload } from './../models/upload/upload.model'; import { SUPController } from './sup.server.controller'; const yellow = '\x1b[33m%s\x1b[0m: '; export class SUP { constructor(private io: SocketIOClient.Manager) { } registerIO() { this.io.on('connection', (socket: SocketIOClient.Socket) => { console.log(yellow, 'Socket connected!'); socket.on('NextChunk', (data) => { console.log(yellow, 'Receiving data.'); SUPController.nextChunk(data, socket); }); socket.on('NextFile', (data) => { console.log(yellow, 'Receiving next File.'); SUPController.nextFile(data, socket); }); }); } static handshake(data, cb): void { SUPController.handshake(data, cb); } static pause(data, cb): void { SUPController.pause(data, cb); } static continue(data, cb): void { SUPController.continue(data, cb); } static abort(data, cb): void { SUPController.abort(data, cb); } }
Java
package com.yueny.demo.job.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.yueny.demo.common.example.bo.ModifyDemoBo; import com.yueny.demo.common.example.service.IDataPrecipitationService; import lombok.extern.slf4j.Slf4j; /** * @author yueny09 <deep_blue_yang@163.com> * * @DATE 2016年2月16日 下午8:23:11 * */ @Controller @Slf4j public class DemoController { @Autowired private IDataPrecipitationService dataPrecipitationService; /** * */ @RequestMapping(value = { "/", "welcome" }, method = RequestMethod.GET) @ResponseBody public List<ModifyDemoBo> bar() { try { return dataPrecipitationService.queryAll(); } catch (final Exception e) { log.error("exception:", e); } return null; } @RequestMapping(value = "/healthy", method = RequestMethod.GET) @ResponseBody public String healthy() { return "OK"; } }
Java
/* * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #pragma once #include "plugin_common.hpp" #include "serialize.hpp" #include "onnx2trt_common.hpp" #include <NvInferPlugin.h> #include <memory> #include <vector> namespace onnx2trt { // A convenient base class for plugins. Provides default implementations of // some methods. // Adapts a plugin so that its type is automatically serialized, enabling it // to be identified when deserializing. class Plugin : public nvinfer1::IPluginExt, public IOwnable { public: virtual const char* getPluginType() const = 0; nvinfer1::Dims const& getInputDims(int index) const { return _input_dims.at(index); } size_t getMaxBatchSize() const { return _max_batch_size; } nvinfer1::DataType getDataType() const { return _data_type; } nvinfer1::PluginFormat getDataFormat() const { return _data_format; } size_t getWorkspaceSize(int) const override { return 0; } int initialize() override { return 0;} void terminate() override {} bool supportsFormat(nvinfer1::DataType type, nvinfer1::PluginFormat format) const override; void configureWithFormat(const nvinfer1::Dims* inputDims, int nbInputs, const nvinfer1::Dims* outputDims, int nbOutputs, nvinfer1::DataType type, nvinfer1::PluginFormat format, int maxBatchSize) override; void destroy() override { delete this; } protected: void deserializeBase(void const*& serialData, size_t& serialLength); size_t getBaseSerializationSize(); void serializeBase(void*& buffer); std::vector<nvinfer1::Dims> _input_dims; size_t _max_batch_size; nvinfer1::DataType _data_type; nvinfer1::PluginFormat _data_format; virtual ~Plugin() {} }; class PluginAdapter : public Plugin { protected: nvinfer1::IPlugin* _plugin; nvinfer1::IPluginExt* _ext; public: PluginAdapter(nvinfer1::IPlugin* plugin) : _plugin(plugin), _ext(dynamic_cast<IPluginExt*>(plugin)) {} virtual int getNbOutputs() const override; virtual nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims *inputDims, int nbInputs) override ; virtual void serialize(void* buffer) override; virtual size_t getSerializationSize() override; virtual int initialize() override; virtual void terminate() override; virtual bool supportsFormat(nvinfer1::DataType type, nvinfer1::PluginFormat format) const override; virtual void configureWithFormat(const nvinfer1::Dims *inputDims, int nbInputs, const nvinfer1::Dims *outputDims, int nbOutputs, nvinfer1::DataType type, nvinfer1::PluginFormat format, int maxBatchSize); virtual size_t getWorkspaceSize(int maxBatchSize) const override; virtual int enqueue(int batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream) override; }; // This makes a plugin compatible with onnx2trt::PluginFactory by serializing // its plugin type. class TypeSerializingPlugin : public PluginAdapter { UniqueOwnable _owned_plugin; Plugin* _plugin; public: TypeSerializingPlugin(Plugin* plugin) : PluginAdapter(plugin), _owned_plugin(plugin), _plugin(plugin) {} void serialize(void* buffer) override { const char* plugin_type = _plugin->getPluginType(); serialize_value(&buffer, (const char*)REGISTERABLE_PLUGIN_MAGIC_STRING); serialize_value(&buffer, plugin_type); return _plugin->serialize(buffer); } size_t getSerializationSize() override { const char* plugin_type = _plugin->getPluginType(); // Note: +1 for NULL-terminated string return (sizeof(REGISTERABLE_PLUGIN_MAGIC_STRING) + 1 + strlen(plugin_type) + _plugin->getSerializationSize()); } const char* getPluginType() const override { return _plugin->getPluginType(); } void destroy() override { delete this; } }; // Adapts nvinfer1::plugin::INvPlugin into onnx2trt::Plugin // (This enables existing NV plugins to be used in this plugin infrastructure) class NvPlugin : public PluginAdapter { nvinfer1::plugin::INvPlugin* _plugin; public: NvPlugin(nvinfer1::plugin::INvPlugin* plugin) : PluginAdapter(plugin), _plugin(plugin) {} virtual const char* getPluginType() const override; virtual void destroy() override; }; } // namespace onnx2trt
Java
<html> <head></head> <body> <!-- output should be the same in Client/Server rendering --> <div class="dotvvm-upload" data-bind="with: Files"> <span class="dotvvm-upload-button" data-bind="visible: !IsBusy()"> <a href="javascript:;" onclick="dotvvm.fileUpload.showUploadDialog(this); return false;">Upload</a> </span> <input data-bind="dotvvm-FileUpload: {&quot;url&quot;:&quot;/dotvvmFileUpload?multiple=true&quot;}" multiple="multiple" style="display:none" type="file"> <span class="dotvvm-upload-files" data-bind="html: dotvvm.globalize.format(&quot;{0} files&quot;, Files().length)"></span> <span class="dotvvm-upload-progress-wrapper" data-bind="visible: IsBusy"> <span class="dotvvm-upload-progress" data-bind="style: { 'width': (Progress() == -1 ? '50' : Progress()) + '%' }"></span> </span> <span class="dotvvm-upload-result" data-bind="html: Error() ? &quot;Error occurred.&quot; : &quot;The files were uploaded successfully.&quot;, attr: { title: Error }, css: { 'dotvvm-upload-result-success': !Error(), 'dotvvm-upload-result-error': Error }, visible: !IsBusy() &amp;&amp; Files().length > 0"></span> </div> </body> </html>
Java
--- layout: base title: 'Statistics of root in UD_Kurmanji-MG' udver: '2' --- ## Treebank Statistics: UD_Kurmanji-MG: Relations: `root` This relation is universal. 754 nodes (7%) are attached to their parents as `root`. 754 instances of `root` (100%) are left-to-right (parent precedes child). Average distance between parent and child is 7.41246684350133. The following 12 pairs of parts of speech are connected with `root`: -<tt><a href="kmr_mg-pos-VERB.html">VERB</a></tt> (490; 65% instances), -<tt><a href="kmr_mg-pos-NOUN.html">NOUN</a></tt> (120; 16% instances), -<tt><a href="kmr_mg-pos-PROPN.html">PROPN</a></tt> (44; 6% instances), -<tt><a href="kmr_mg-pos-AUX.html">AUX</a></tt> (41; 5% instances), -<tt><a href="kmr_mg-pos-ADJ.html">ADJ</a></tt> (31; 4% instances), -<tt><a href="kmr_mg-pos-NUM.html">NUM</a></tt> (13; 2% instances), -<tt><a href="kmr_mg-pos-PRON.html">PRON</a></tt> (8; 1% instances), -<tt><a href="kmr_mg-pos-ADP.html">ADP</a></tt> (2; 0% instances), -<tt><a href="kmr_mg-pos-ADV.html">ADV</a></tt> (2; 0% instances), -<tt><a href="kmr_mg-pos-CCONJ.html">CCONJ</a></tt> (1; 0% instances), -<tt><a href="kmr_mg-pos-INTJ.html">INTJ</a></tt> (1; 0% instances), -<tt><a href="kmr_mg-pos-SCONJ.html">SCONJ</a></tt> (1; 0% instances). ~~~ conllu # visual-style 6 bgColor:blue # visual-style 6 fgColor:white # visual-style 0 bgColor:blue # visual-style 0 fgColor:white # visual-style 0 6 root color:blue 1 Bi bi ADP pr AdpType=Prep 2 case _ _ 2 spêdê spêde NOUN n Case=Acc|Gender=Fem|Number=Sing|PronType=Ind 6 nmod _ _ 3 ve ve ADP post AdpType=Post 2 case _ _ 4 ez ez PRON prn Case=Nom|Gender=Fem,Masc|Number=Sing|Person=1|PronType=Prs 6 nsubj _ _ 5 hişyar hişyar X x _ 6 dep _ _ 6 bû bûn VERB vblex Tense=Past|VerbForm=Part 0 root _ _ 7 bûm bûn AUX vaux Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 6 aux _ SpaceAfter=No 8 . . PUNCT sent _ 6 punct _ _ ~~~ ~~~ conllu # visual-style 1 bgColor:blue # visual-style 1 fgColor:white # visual-style 0 bgColor:blue # visual-style 0 fgColor:white # visual-style 0 1 root color:blue 1 Meheke meh NOUN n Case=Con|Gender=Fem|Number=Sing|PronType=Ind 0 root _ _ 2 Nîsanê nîsan NOUN n Case=Acc|Definite=Def|Gender=Fem|Number=Sing 1 nmod:poss _ _ 3 bû bûn AUX vbcop Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 1 cop _ SpaceAfter=No 4 . . PUNCT sent _ 1 punct _ _ ~~~ ~~~ conllu # visual-style 1 bgColor:blue # visual-style 1 fgColor:white # visual-style 0 bgColor:blue # visual-style 0 fgColor:white # visual-style 0 1 root color:blue 1 Holmes Holmes PROPN np Case=Nom|Gender=Masc|Number=Sing 0 root _ SpaceAfter=No 2 : : PUNCT sent _ 7 punct _ _ 3 Xanimeke xanim NOUN n Case=Acc|Gender=Fem|Number=Sing|PronType=Ind 7 nsubj _ _ 4 ciwan ciwan ADJ adj Degree=Pos 3 amod _ _ 5 desta dest NOUN n Case=Con|Definite=Def|Gender=Fem|Number=Sing 7 obj _ _ 6 me em PRON prn Case=Acc|Gender=Fem,Masc|Number=Plur|Person=1|PronType=Prs 5 nmod:poss _ _ 7 kiriye kirin VERB vblex Evident=Nfh|Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 1 parataxis _ SpaceAfter=No 8 . . PUNCT sent _ 7 punct _ _ ~~~
Java
/** * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package docs.extension; //#imports import akka.actor.Extension; import akka.actor.AbstractExtensionId; import akka.actor.ExtensionIdProvider; import akka.actor.ActorSystem; import akka.actor.ExtendedActorSystem; import scala.concurrent.duration.Duration; import com.typesafe.config.Config; import java.util.concurrent.TimeUnit; //#imports import akka.actor.UntypedActor; import org.junit.Test; public class SettingsExtensionDocTest { static //#extension public class SettingsImpl implements Extension { public final String DB_URI; public final Duration CIRCUIT_BREAKER_TIMEOUT; public SettingsImpl(Config config) { DB_URI = config.getString("myapp.db.uri"); CIRCUIT_BREAKER_TIMEOUT = Duration.create(config.getDuration("myapp.circuit-breaker.timeout", TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS); } } //#extension static //#extensionid public class Settings extends AbstractExtensionId<SettingsImpl> implements ExtensionIdProvider { public final static Settings SettingsProvider = new Settings(); private Settings() {} public Settings lookup() { return Settings.SettingsProvider; } public SettingsImpl createExtension(ExtendedActorSystem system) { return new SettingsImpl(system.settings().config()); } } //#extensionid static //#extension-usage-actor public class MyActor extends UntypedActor { // typically you would use static import of the Settings.SettingsProvider field final SettingsImpl settings = Settings.SettingsProvider.get(getContext().system()); Connection connection = connect(settings.DB_URI, settings.CIRCUIT_BREAKER_TIMEOUT); //#extension-usage-actor public Connection connect(String dbUri, Duration circuitBreakerTimeout) { return new Connection(); } public void onReceive(Object msg) { } //#extension-usage-actor } //#extension-usage-actor public static class Connection { } @Test public void demonstrateHowToCreateAndUseAnAkkaExtensionInJava() { final ActorSystem system = null; try { //#extension-usage // typically you would use static import of the Settings.SettingsProvider field String dbUri = Settings.SettingsProvider.get(system).DB_URI; //#extension-usage } catch (Exception e) { //do nothing } } }
Java
/** * Copyright 2011-2016 GatlingCorp (http://gatling.io) * * 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 io.gatling.jms.integration import javax.jms.{ Message, MessageListener } import scala.concurrent.duration._ import io.gatling.core.CoreComponents import io.gatling.core.action.{ Action, ActorDelegatingAction } import io.gatling.core.config.GatlingConfiguration import io.gatling.core.controller.throttle.Throttler import io.gatling.core.pause.Constant import io.gatling.core.protocol.{ ProtocolComponentsRegistry, Protocols } import io.gatling.core.session.Session import io.gatling.core.stats.StatsEngine import io.gatling.core.structure.{ ScenarioBuilder, ScenarioContext } import io.gatling.jms._ import io.gatling.jms.client.{ BrokerBasedSpec, SimpleJmsClient } import io.gatling.jms.request.JmsDestination import akka.actor.ActorRef import org.apache.activemq.jndi.ActiveMQInitialContextFactory class JmsMockCustomer(client: SimpleJmsClient, mockResponse: PartialFunction[Message, String]) extends MessageListener { val producer = client.session.createProducer(null) client.createReplyConsumer().setMessageListener(this) override def onMessage(request: Message): Unit = { if (mockResponse.isDefinedAt(request)) { val response = client.session.createTextMessage(mockResponse(request)) response.setJMSCorrelationID(request.getJMSMessageID) producer.send(request.getJMSReplyTo, response) } } def close(): Unit = { producer.close() client.close() } } trait JmsMockingSpec extends BrokerBasedSpec with JmsDsl { def jmsProtocol = jms .connectionFactoryName("ConnectionFactory") .url("vm://gatling?broker.persistent=false&broker.useJmx=false") .contextFactory(classOf[ActiveMQInitialContextFactory].getName) .listenerCount(1) def runScenario(sb: ScenarioBuilder, timeout: FiniteDuration = 10.seconds, protocols: Protocols = Protocols(jmsProtocol))(implicit configuration: GatlingConfiguration) = { val coreComponents = CoreComponents(mock[ActorRef], mock[Throttler], mock[StatsEngine], mock[Action], configuration) val next = new ActorDelegatingAction("next", self) val actor = sb.build(ScenarioContext(system, coreComponents, new ProtocolComponentsRegistry(system, coreComponents, protocols), Constant, throttled = false), next) actor ! Session("TestSession", 0) val session = expectMsgClass(timeout, classOf[Session]) session } def jmsMock(queue: JmsDestination, f: PartialFunction[Message, String]): Unit = { val processor = new JmsMockCustomer(createClient(queue), f) registerCleanUpAction(() => processor.close()) } }
Java
/** * Copyright Intellectual Reserve, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gedcomx.build.enunciate; import org.codehaus.enunciate.main.ClasspathHandler; import org.codehaus.enunciate.main.ClasspathResource; import org.codehaus.enunciate.main.Enunciate; import org.gedcomx.test.Recipe; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import java.io.File; import java.util.ArrayList; import java.util.List; /** * @author Ryan Heaton */ public class RecipeClasspathHandler implements ClasspathHandler { private final Enunciate enunciate; private final List<Recipe> recipes = new ArrayList<Recipe>(); private final Unmarshaller unmarshaller; public RecipeClasspathHandler(Enunciate enunciate) { this.enunciate = enunciate; try { unmarshaller = JAXBContext.newInstance(Recipe.class).createUnmarshaller(); } catch (JAXBException e) { throw new RuntimeException(e); } } public List<Recipe> getRecipes() { return recipes; } @Override public void startPathEntry(File pathEntry) { } @Override public void handleResource(ClasspathResource resource) { if (resource.getPath().endsWith(".recipe.xml")) { try { this.recipes.add((Recipe) unmarshaller.unmarshal(resource.read())); } catch (Exception e) { this.enunciate.error("Unable to unmarshal recipe %s: %s.", resource.getPath(), e.getMessage()); } } } @Override public boolean endPathEntry(File pathEntry) { return false; } }
Java
// Generated from /POI/java/org/apache/poi/hssf/record/BoundSheetRecord.java #include <org/apache/poi/hssf/record/BoundSheetRecord.hpp> #include <java/lang/ArrayStoreException.hpp> #include <java/lang/NullPointerException.hpp> #include <java/lang/String.hpp> #include <java/lang/StringBuffer.hpp> #include <java/util/Arrays.hpp> #include <java/util/Comparator.hpp> #include <java/util/List.hpp> #include <org/apache/poi/hssf/record/BoundSheetRecord_1.hpp> #include <org/apache/poi/hssf/record/Record.hpp> #include <org/apache/poi/hssf/record/RecordBase.hpp> #include <org/apache/poi/hssf/record/RecordInputStream.hpp> #include <org/apache/poi/hssf/record/StandardRecord.hpp> #include <org/apache/poi/ss/util/WorkbookUtil.hpp> #include <org/apache/poi/util/BitField.hpp> #include <org/apache/poi/util/BitFieldFactory.hpp> #include <org/apache/poi/util/HexDump.hpp> #include <org/apache/poi/util/LittleEndian.hpp> #include <org/apache/poi/util/LittleEndianConsts.hpp> #include <org/apache/poi/util/LittleEndianOutput.hpp> #include <org/apache/poi/util/StringUtil.hpp> #include <Array.hpp> #include <ObjectArray.hpp> #include <SubArray.hpp> template<typename ComponentType, typename... Bases> struct SubArray; namespace poi { namespace hssf { namespace record { typedef ::SubArray< ::poi::hssf::record::RecordBase, ::java::lang::ObjectArray > RecordBaseArray; typedef ::SubArray< ::poi::hssf::record::Record, RecordBaseArray > RecordArray; typedef ::SubArray< ::poi::hssf::record::StandardRecord, RecordArray > StandardRecordArray; typedef ::SubArray< ::poi::hssf::record::BoundSheetRecord, StandardRecordArray > BoundSheetRecordArray; } // record } // hssf } // poi template<typename T> static T* npc(T* t) { if(!t) throw new ::java::lang::NullPointerException(); return t; } poi::hssf::record::BoundSheetRecord::BoundSheetRecord(const ::default_init_tag&) : super(*static_cast< ::default_init_tag* >(0)) { clinit(); } poi::hssf::record::BoundSheetRecord::BoundSheetRecord(::java::lang::String* sheetname) : BoundSheetRecord(*static_cast< ::default_init_tag* >(0)) { ctor(sheetname); } poi::hssf::record::BoundSheetRecord::BoundSheetRecord(RecordInputStream* in) : BoundSheetRecord(*static_cast< ::default_init_tag* >(0)) { ctor(in); } constexpr int16_t poi::hssf::record::BoundSheetRecord::sid; poi::util::BitField*& poi::hssf::record::BoundSheetRecord::hiddenFlag() { clinit(); return hiddenFlag_; } poi::util::BitField* poi::hssf::record::BoundSheetRecord::hiddenFlag_; poi::util::BitField*& poi::hssf::record::BoundSheetRecord::veryHiddenFlag() { clinit(); return veryHiddenFlag_; } poi::util::BitField* poi::hssf::record::BoundSheetRecord::veryHiddenFlag_; void poi::hssf::record::BoundSheetRecord::ctor(::java::lang::String* sheetname) { super::ctor(); field_2_option_flags = 0; setSheetname(sheetname); } void poi::hssf::record::BoundSheetRecord::ctor(RecordInputStream* in) { super::ctor(); auto buf = new ::int8_tArray(::poi::util::LittleEndianConsts::INT_SIZE); npc(in)->readPlain(buf, int32_t(0), npc(buf)->length); field_1_position_of_BOF = ::poi::util::LittleEndian::getInt(buf); field_2_option_flags = npc(in)->readUShort(); auto field_3_sheetname_length = npc(in)->readUByte(); field_4_isMultibyteUnicode = npc(in)->readByte(); if(isMultibyte()) { field_5_sheetname = npc(in)->readUnicodeLEString(field_3_sheetname_length); } else { field_5_sheetname = npc(in)->readCompressedUnicode(field_3_sheetname_length); } } void poi::hssf::record::BoundSheetRecord::setPositionOfBof(int32_t pos) { field_1_position_of_BOF = pos; } void poi::hssf::record::BoundSheetRecord::setSheetname(::java::lang::String* sheetName) { ::poi::ss::util::WorkbookUtil::validateSheetName(sheetName); field_5_sheetname = sheetName; field_4_isMultibyteUnicode = ::poi::util::StringUtil::hasMultibyte(sheetName) ? int32_t(1) : int32_t(0); } int32_t poi::hssf::record::BoundSheetRecord::getPositionOfBof() { return field_1_position_of_BOF; } bool poi::hssf::record::BoundSheetRecord::isMultibyte() { return (field_4_isMultibyteUnicode & int32_t(1)) != 0; } java::lang::String* poi::hssf::record::BoundSheetRecord::getSheetname() { return field_5_sheetname; } java::lang::String* poi::hssf::record::BoundSheetRecord::toString() { auto buffer = new ::java::lang::StringBuffer(); npc(buffer)->append(u"[BOUNDSHEET]\n"_j); npc(npc(npc(buffer)->append(u" .bof = "_j))->append(::poi::util::HexDump::intToHex(getPositionOfBof())))->append(u"\n"_j); npc(npc(npc(buffer)->append(u" .options = "_j))->append(::poi::util::HexDump::shortToHex(field_2_option_flags)))->append(u"\n"_j); npc(npc(npc(buffer)->append(u" .unicodeflag= "_j))->append(::poi::util::HexDump::byteToHex(field_4_isMultibyteUnicode)))->append(u"\n"_j); npc(npc(npc(buffer)->append(u" .sheetname = "_j))->append(field_5_sheetname))->append(u"\n"_j); npc(buffer)->append(u"[/BOUNDSHEET]\n"_j); return npc(buffer)->toString(); } int32_t poi::hssf::record::BoundSheetRecord::getDataSize() { return int32_t(8) + npc(field_5_sheetname)->length() * (isMultibyte() ? int32_t(2) : int32_t(1)); } void poi::hssf::record::BoundSheetRecord::serialize(::poi::util::LittleEndianOutput* out) { npc(out)->writeInt(getPositionOfBof()); npc(out)->writeShort(field_2_option_flags); auto name = field_5_sheetname; npc(out)->writeByte(npc(name)->length()); npc(out)->writeByte(field_4_isMultibyteUnicode); if(isMultibyte()) { ::poi::util::StringUtil::putUnicodeLE(name, out); } else { ::poi::util::StringUtil::putCompressedUnicode(name, out); } } int16_t poi::hssf::record::BoundSheetRecord::getSid() { return sid; } bool poi::hssf::record::BoundSheetRecord::isHidden() { return npc(hiddenFlag_)->isSet(field_2_option_flags); } void poi::hssf::record::BoundSheetRecord::setHidden(bool hidden) { field_2_option_flags = npc(hiddenFlag_)->setBoolean(field_2_option_flags, hidden); } bool poi::hssf::record::BoundSheetRecord::isVeryHidden() { return npc(veryHiddenFlag_)->isSet(field_2_option_flags); } void poi::hssf::record::BoundSheetRecord::setVeryHidden(bool veryHidden) { field_2_option_flags = npc(veryHiddenFlag_)->setBoolean(field_2_option_flags, veryHidden); } poi::hssf::record::BoundSheetRecordArray* poi::hssf::record::BoundSheetRecord::orderByBofPosition(::java::util::List* boundSheetRecords) { clinit(); auto bsrs = new BoundSheetRecordArray(npc(boundSheetRecords)->size()); npc(boundSheetRecords)->toArray_(static_cast< ::java::lang::ObjectArray* >(bsrs)); ::java::util::Arrays::sort(bsrs, BOFComparator_); return bsrs; } java::util::Comparator*& poi::hssf::record::BoundSheetRecord::BOFComparator() { clinit(); return BOFComparator_; } java::util::Comparator* poi::hssf::record::BoundSheetRecord::BOFComparator_; extern java::lang::Class *class_(const char16_t *c, int n); java::lang::Class* poi::hssf::record::BoundSheetRecord::class_() { static ::java::lang::Class* c = ::class_(u"org.apache.poi.hssf.record.BoundSheetRecord", 43); return c; } void poi::hssf::record::BoundSheetRecord::clinit() { super::clinit(); static bool in_cl_init = false; struct clinit_ { clinit_() { in_cl_init = true; hiddenFlag_ = ::poi::util::BitFieldFactory::getInstance(1); veryHiddenFlag_ = ::poi::util::BitFieldFactory::getInstance(2); BOFComparator_ = new BoundSheetRecord_1(); } }; if(!in_cl_init) { static clinit_ clinit_instance; } } int32_t poi::hssf::record::BoundSheetRecord::serialize(int32_t offset, ::int8_tArray* data) { return super::serialize(offset, data); } int8_tArray* poi::hssf::record::BoundSheetRecord::serialize() { return super::serialize(); } java::lang::Class* poi::hssf::record::BoundSheetRecord::getClass0() { return class_(); }
Java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.devicefarm.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Represents a specific warning or failure. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/devicefarm-2015-06-23/Problem" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Problem implements Serializable, Cloneable, StructuredPojo { /** * <p> * Information about the associated run. * </p> */ private ProblemDetail run; /** * <p> * Information about the associated job. * </p> */ private ProblemDetail job; /** * <p> * Information about the associated suite. * </p> */ private ProblemDetail suite; /** * <p> * Information about the associated test. * </p> */ private ProblemDetail test; /** * <p> * Information about the associated device. * </p> */ private Device device; /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> */ private String result; /** * <p> * A message about the problem's result. * </p> */ private String message; /** * <p> * Information about the associated run. * </p> * * @param run * Information about the associated run. */ public void setRun(ProblemDetail run) { this.run = run; } /** * <p> * Information about the associated run. * </p> * * @return Information about the associated run. */ public ProblemDetail getRun() { return this.run; } /** * <p> * Information about the associated run. * </p> * * @param run * Information about the associated run. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withRun(ProblemDetail run) { setRun(run); return this; } /** * <p> * Information about the associated job. * </p> * * @param job * Information about the associated job. */ public void setJob(ProblemDetail job) { this.job = job; } /** * <p> * Information about the associated job. * </p> * * @return Information about the associated job. */ public ProblemDetail getJob() { return this.job; } /** * <p> * Information about the associated job. * </p> * * @param job * Information about the associated job. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withJob(ProblemDetail job) { setJob(job); return this; } /** * <p> * Information about the associated suite. * </p> * * @param suite * Information about the associated suite. */ public void setSuite(ProblemDetail suite) { this.suite = suite; } /** * <p> * Information about the associated suite. * </p> * * @return Information about the associated suite. */ public ProblemDetail getSuite() { return this.suite; } /** * <p> * Information about the associated suite. * </p> * * @param suite * Information about the associated suite. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withSuite(ProblemDetail suite) { setSuite(suite); return this; } /** * <p> * Information about the associated test. * </p> * * @param test * Information about the associated test. */ public void setTest(ProblemDetail test) { this.test = test; } /** * <p> * Information about the associated test. * </p> * * @return Information about the associated test. */ public ProblemDetail getTest() { return this.test; } /** * <p> * Information about the associated test. * </p> * * @param test * Information about the associated test. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withTest(ProblemDetail test) { setTest(test); return this; } /** * <p> * Information about the associated device. * </p> * * @param device * Information about the associated device. */ public void setDevice(Device device) { this.device = device; } /** * <p> * Information about the associated device. * </p> * * @return Information about the associated device. */ public Device getDevice() { return this.device; } /** * <p> * Information about the associated device. * </p> * * @param device * Information about the associated device. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withDevice(Device device) { setDevice(device); return this; } /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> * * @param result * The problem's result.</p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * @see ExecutionResult */ public void setResult(String result) { this.result = result; } /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> * * @return The problem's result.</p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * @see ExecutionResult */ public String getResult() { return this.result; } /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> * * @param result * The problem's result.</p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * @return Returns a reference to this object so that method calls can be chained together. * @see ExecutionResult */ public Problem withResult(String result) { setResult(result); return this; } /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> * * @param result * The problem's result.</p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * @see ExecutionResult */ public void setResult(ExecutionResult result) { withResult(result); } /** * <p> * The problem's result. * </p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * </ul> * * @param result * The problem's result.</p> * <p> * Allowed values include: * </p> * <ul> * <li> * <p> * PENDING * </p> * </li> * <li> * <p> * PASSED * </p> * </li> * <li> * <p> * WARNED * </p> * </li> * <li> * <p> * FAILED * </p> * </li> * <li> * <p> * SKIPPED * </p> * </li> * <li> * <p> * ERRORED * </p> * </li> * <li> * <p> * STOPPED * </p> * </li> * @return Returns a reference to this object so that method calls can be chained together. * @see ExecutionResult */ public Problem withResult(ExecutionResult result) { this.result = result.toString(); return this; } /** * <p> * A message about the problem's result. * </p> * * @param message * A message about the problem's result. */ public void setMessage(String message) { this.message = message; } /** * <p> * A message about the problem's result. * </p> * * @return A message about the problem's result. */ public String getMessage() { return this.message; } /** * <p> * A message about the problem's result. * </p> * * @param message * A message about the problem's result. * @return Returns a reference to this object so that method calls can be chained together. */ public Problem withMessage(String message) { setMessage(message); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRun() != null) sb.append("Run: ").append(getRun()).append(","); if (getJob() != null) sb.append("Job: ").append(getJob()).append(","); if (getSuite() != null) sb.append("Suite: ").append(getSuite()).append(","); if (getTest() != null) sb.append("Test: ").append(getTest()).append(","); if (getDevice() != null) sb.append("Device: ").append(getDevice()).append(","); if (getResult() != null) sb.append("Result: ").append(getResult()).append(","); if (getMessage() != null) sb.append("Message: ").append(getMessage()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Problem == false) return false; Problem other = (Problem) obj; if (other.getRun() == null ^ this.getRun() == null) return false; if (other.getRun() != null && other.getRun().equals(this.getRun()) == false) return false; if (other.getJob() == null ^ this.getJob() == null) return false; if (other.getJob() != null && other.getJob().equals(this.getJob()) == false) return false; if (other.getSuite() == null ^ this.getSuite() == null) return false; if (other.getSuite() != null && other.getSuite().equals(this.getSuite()) == false) return false; if (other.getTest() == null ^ this.getTest() == null) return false; if (other.getTest() != null && other.getTest().equals(this.getTest()) == false) return false; if (other.getDevice() == null ^ this.getDevice() == null) return false; if (other.getDevice() != null && other.getDevice().equals(this.getDevice()) == false) return false; if (other.getResult() == null ^ this.getResult() == null) return false; if (other.getResult() != null && other.getResult().equals(this.getResult()) == false) return false; if (other.getMessage() == null ^ this.getMessage() == null) return false; if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRun() == null) ? 0 : getRun().hashCode()); hashCode = prime * hashCode + ((getJob() == null) ? 0 : getJob().hashCode()); hashCode = prime * hashCode + ((getSuite() == null) ? 0 : getSuite().hashCode()); hashCode = prime * hashCode + ((getTest() == null) ? 0 : getTest().hashCode()); hashCode = prime * hashCode + ((getDevice() == null) ? 0 : getDevice().hashCode()); hashCode = prime * hashCode + ((getResult() == null) ? 0 : getResult().hashCode()); hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode()); return hashCode; } @Override public Problem clone() { try { return (Problem) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.devicefarm.model.transform.ProblemMarshaller.getInstance().marshall(this, protocolMarshaller); } }
Java
var logger = require('../logging').getLogger(__LOGGER__); var {PAGE_CSS_NODE_ID} = require('../constants'); var Q = require('q'); var PageUtil = require('./PageUtil') var loadedCss = {}; module.exports = { registerPageLoad: function registerPageLoad() { if (SERVER_SIDE) { throw new Error("ClientCssHelper.registerPageLoad can't be called server-side"); } // for each css node in the head that the react-server server wrote to the response, note it down in the cache, so that // we can remove it on a page to page transition. var serverWrittenLinkNodes = document.head.querySelectorAll(`link[${PAGE_CSS_NODE_ID}],style[${PAGE_CSS_NODE_ID}]`); for (var i = 0; i < serverWrittenLinkNodes.length; i++) { var key, styleNode = serverWrittenLinkNodes[i]; if (styleNode.href) { key = normalizeLocalUrl(styleNode.href); } else { key = styleNode.innerHTML; } loadedCss[key] = styleNode; } }, ensureCss: function ensureCss(routeName, pageObject) { if (SERVER_SIDE) { throw new Error("ClientCssHelper.registerPageLoad can't be called server-side"); } return Q.all(PageUtil.standardizeStyles(pageObject.getHeadStylesheets())).then(newCss => { var newCssByKey = {}; newCss .filter(style => !!style) .forEach(style => {newCssByKey[this._keyFromStyleSheet(style)] = style}); // first, remove the unneeded CSS link elements. Object.keys(loadedCss).forEach(loadedCssKey => { if (!newCssByKey[loadedCssKey]) { // remove the corresponding node from the DOM. logger.debug("Removing stylesheet: " + loadedCssKey); var node = loadedCss[loadedCssKey]; node.parentNode.removeChild(node); delete loadedCss[loadedCssKey]; } }); // next add the style URLs that weren't already loaded. return Q.all(Object.keys(newCssByKey).map(newCssKey => { var retval; if (!loadedCss[newCssKey]) { // this means that the CSS is not currently present in the // document, so we need to add it. logger.debug("Adding stylesheet: " + newCssKey); var style = newCssByKey[newCssKey]; var styleTag; if (style.href) { styleTag = document.createElement('link'); styleTag.rel = 'stylesheet'; styleTag.href = style.href; // If we _can_ wait for the CSS to be loaded before // proceeding, let's do so. if ('onload' in styleTag) { var dfd = Q.defer(); styleTag.onload = dfd.resolve; retval = dfd.promise; } } else { styleTag = document.createElement('style'); styleTag.innerHTML = style.text; } styleTag.type = style.type; styleTag.media = style.media; loadedCss[newCssKey] = styleTag; document.head.appendChild(styleTag); } else { logger.debug(`Stylesheet already loaded (no-op): ${newCssKey}`); } return retval; })); }); }, _keyFromStyleSheet: function(style) { return normalizeLocalUrl(style.href) || style.text; }, } function normalizeLocalUrl(url) { // Step 1: make the url protocol less first. This helps recognizing http://0.0.0.0:3001/common.css // and //0.0.0.0:3001/common.css as the same file. // Step 2: The browser will give us a full URL even if we only put a // path in on the server. So, if we're comparing against just // a path here we need to strip the base off to avoid a flash // of unstyled content. if (typeof url === 'string') { url = url .replace(/^http[s]?:/, '') .replace(new RegExp("^//" + location.host), ''); } return url; }
Java
package lesson.types; public class Classes { public static void main(String[] args) { JustClass one = new JustClass(); JustClass two = new JustClass(123, "sdf"); System.out.println(one); System.out.println(two); } } class JustClass { private int number; private String name; public JustClass() { } public JustClass(int number, String name) { this.number = number; this.name = name; } @Override public String toString() { return String .format("JustClass {%s, %d}", name,number); } }
Java
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ #ifndef TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_CONTEXT_H_ #define TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_CONTEXT_H_ #include <algorithm> #include <cstddef> #include <map> #include <memory> #include <queue> #include <string> #include <vector> #include "tensorflow/core/common_runtime/device_factory.h" #include "tensorflow/core/common_runtime/device_mgr.h" #include "tensorflow/core/common_runtime/eager/eager_executor.h" #include "tensorflow/core/common_runtime/eager/kernel_and_device.h" #include "tensorflow/core/common_runtime/function.h" #include "tensorflow/core/common_runtime/rendezvous_mgr.h" #ifndef __ANDROID__ #include "tensorflow/core/distributed_runtime/eager/eager_client.h" #include "tensorflow/core/distributed_runtime/server_lib.h" #endif #include "tensorflow/core/framework/log_memory.h" #include "tensorflow/core/framework/rendezvous.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/lib/core/threadpool.h" #include "tensorflow/core/lib/gtl/flatmap.h" #include "tensorflow/core/lib/gtl/flatset.h" #include "tensorflow/core/lib/gtl/inlined_vector.h" #include "tensorflow/core/lib/gtl/map_util.h" #include "tensorflow/core/lib/gtl/stl_util.h" #include "tensorflow/core/platform/fingerprint.h" #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/thread_annotations.h" #include "tensorflow/core/public/session_options.h" #include "tensorflow/core/public/version.h" namespace tensorflow { // Note: there's a copy enum in eager/c_api.h. It should be kept in sync. enum ContextDevicePlacementPolicy { // Running operations with input tensors on the wrong device will fail. DEVICE_PLACEMENT_EXPLICIT = 0, // Copy the tensor to the right device but log a warning. DEVICE_PLACEMENT_WARN = 1, // Silently copy the tensor, which has a performance cost since the operation // will be blocked till the copy completes. This is the default policy. DEVICE_PLACEMENT_SILENT = 2, // Default placement policy which silently copies int32 tensors but not other // dtypes. DEVICE_PLACEMENT_SILENT_FOR_INT32 = 3, }; class EagerContext { public: // TODO: remove this constructor once we migrate all callers to the next one. EagerContext(const SessionOptions& opts, ContextDevicePlacementPolicy default_policy, bool async, std::unique_ptr<const DeviceMgr> device_mgr, Rendezvous* rendezvous); EagerContext(const SessionOptions& opts, ContextDevicePlacementPolicy default_policy, bool async, const DeviceMgr* device_mgr, bool device_mgr_owned, Rendezvous* rendezvous); ~EagerContext(); // Returns the function library runtime for the given device. FunctionLibraryRuntime* func_lib(Device* d) const { return pflr_->GetFLR(d->name()); } // True if running in asynchronous mode. bool Async() const; EagerExecutor* Executor() { return &executor_; } std::function<void(std::function<void()>)>* runner() { return &runner_; } // Sets whether this thread should run in synchronous or asynchronous mode. Status SetAsyncForThread(bool async); // TODO(apassos) make this return a constant reference gtl::FlatMap<string, Device*, StringPieceHasher>* device_map() { return &devices_map_; } // TODO(apassos) make this return a constant reference std::vector<Device*>* devices() { return &devices_; } const std::vector<DeviceType>& prioritized_device_type_list() { return prioritized_device_type_list_; } // Clears the kernel caches. void ClearCaches(); // Sets the device placement policy for the current thread. void SetThreadLocalDevicePlacementPolicy(ContextDevicePlacementPolicy policy); // Returns the device placement policy for the current thread. ContextDevicePlacementPolicy GetDevicePlacementPolicy(); Status AsyncWait() { return executor_.WaitForAllPendingNodes(); } Status GetStatus() { return executor_.status(); } void ClearAsyncError() { executor_.ClearError(); } bool FindFunctionByName(const string& name); Status FindFunctionOpData(const string& name, const tensorflow::OpRegistrationData** op_data); const FunctionDef* FindFunctionDef(const string& name); Status FindDeviceByName(const string& name, Device** result); Device* HostCPU() { return devices_[0]; } GraphCollector* GetGraphCollector() { return &graph_collector_; } uint64 NextId() { return executor_.NextId(); } void ExecutorAdd(EagerNode* node) { executor_.Add(node); } Status AddFunctionDef(const FunctionDef& fdef); KernelAndDevice* GetCachedKernel(Fprint128 cache_key); void AddKernelToCache(Fprint128 cache_key, KernelAndDevice* kernel); bool LogDevicePlacement() { return log_device_placement_; } bool LogMemory() { return log_memory_; } Rendezvous* GetRendezvous() { return rendezvous_; } const tensorflow::DeviceMgr* local_device_mgr() const { return (local_device_manager_ != nullptr) ? local_device_manager_.get() : local_unowned_device_manager_; } const tensorflow::DeviceMgr* remote_device_mgr() { return remote_device_manager_.get(); } // TODO(apassos) remove the need for this void ReleaseDeviceMgr() { local_device_manager_.release(); } // TODO(apassos) clean up RunMetadata storage. mutex* MetadataMu() { return &metadata_mu_; } bool ShouldStoreMetadata() { return should_store_metadata_.load(); } void SetShouldStoreMetadata(bool value); RunMetadata* RunMetadataProto() { return &run_metadata_; } void StartStep(); void EndStep(); ScopedStepContainer* StepContainer(); FunctionLibraryDefinition* FuncLibDef() { return &func_lib_def_; } #ifndef __ANDROID__ Status GetClientAndContextID(Device* device, eager::EagerClient** client, uint64* context_id); // TODO(nareshmodi): Encapsulate remote state into a separate // class/struct. // // Enables the eager context to communicate with remote devices. // // - server: A ServerInterface that exports the tensorflow.WorkerService. // Note that this class expects the server to already have been started. // - remote_eager_workers: A cache from which we can get "EagerClient"s to // communicate with remote eager services. // - remote_device_mgr: A DeviceMgr* which contains all remote devices // (should contain no local devices). // - remote_contexts: A map containing task name to remote context ID. void InitializeRemote( std::unique_ptr<ServerInterface> server, std::unique_ptr<eager::EagerClientCache> remote_eager_workers, std::unique_ptr<DeviceMgr> remote_device_manager, const gtl::FlatMap<string, uint64>& remote_contexts, Rendezvous* r, DeviceMgr* local_device_mgr, int keep_alive_secs); bool HasActiveRemoteContext(uint64 context_id) { return active_remote_contexts_.find(context_id) != active_remote_contexts_.end(); } #endif // If true, then tensors should be shipped across processes via the // EagerService.SendTensor RPC. If false, _Send/_Recv ops should be used // instead (which in-turn use WorkerService.RecvTensor RPCs). bool UseSendTensorRPC() { return use_send_tensor_rpc_; } bool PinSmallOpsToCPU() { return pin_small_ops_to_cpu_; } tensorflow::Env* TFEnv() const { return env_; } private: void InitDeviceMapAndAsync(); Status MaybeRegisterFunctionRemotely(const FunctionDef& fdef); const ContextDevicePlacementPolicy policy_; // Note: we cannot use C++11 thread_local here as there is no concept of a // thread-local-object-local variable in C++11. mutex policy_map_mu_; std::unordered_map<std::thread::id, ContextDevicePlacementPolicy> thread_local_policies_ GUARDED_BY(policy_map_mu_); // Only one of the below is set. std::unique_ptr<const DeviceMgr> local_device_manager_; const DeviceMgr* local_unowned_device_manager_; std::unique_ptr<DeviceMgr> remote_device_manager_; // Devices owned by device_manager std::vector<Device*> devices_; std::vector<DeviceType> prioritized_device_type_list_; // All devices are not owned. gtl::FlatMap<string, Device*, StringPieceHasher> devices_map_; Rendezvous* rendezvous_; mutex functions_mu_; FunctionLibraryDefinition func_lib_def_ GUARDED_BY(functions_mu_){ OpRegistry::Global(), {}}; std::unique_ptr<thread::ThreadPool> thread_pool_; // One FunctionLibraryRuntime per device. // func_libs[i] is the FunctionLibraryRuntime corresponding to // session->devices[i]. std::unique_ptr<ProcessFunctionLibraryRuntime> pflr_; std::function<void(std::function<void()>)> runner_; mutex cache_mu_; std::unordered_map<Fprint128, KernelAndDevice*, Fprint128Hasher> kernel_cache_ GUARDED_BY(cache_mu_); // Whether we should compute RunMetadata. std::atomic<bool> should_store_metadata_{false}; mutex metadata_mu_; RunMetadata run_metadata_ GUARDED_BY(metadata_mu_); GraphCollector graph_collector_; const bool log_device_placement_; // EagerExecutor for async execution. EagerExecutor executor_; // Information related to step containers. std::atomic<int> num_active_steps_; std::unique_ptr<ScopedStepContainer> step_container_ GUARDED_BY(metadata_mu_); // True if the default value for execution mode is async. Note that this value // can be overridden per thread based on `thread_local_async` overrides. const bool async_default_; mutable mutex async_map_mu_; std::unordered_map<std::thread::id, bool> thread_local_async_ GUARDED_BY(async_map_mu_); const bool log_memory_; Env* const env_; #ifndef __ANDROID__ void CloseRemoteContexts(); // The server_ is not const since we release it when the context is destroyed. // Therefore the server_ object is not marked as const (even though it should // be). std::unique_ptr<ServerInterface> server_; std::unique_ptr<eager::EagerClientCache> remote_eager_workers_; mutex remote_state_mu_; gtl::FlatMap<string, uint64> remote_contexts_; gtl::FlatSet<uint64> active_remote_contexts_; gtl::FlatMap<Device*, std::pair<eager::EagerClient*, uint64>> device_to_client_cache_; int keep_alive_secs_ GUARDED_BY(remote_state_mu_); std::atomic<int> sleep_for_secs_; std::unique_ptr<Thread> keep_alive_thread_; mutex keep_alive_thread_shutdown_mu_; condition_variable keep_alive_thread_cv_; bool shutting_down_ GUARDED_BY(keep_alive_thread_shutdown_mu_) = false; #endif bool use_send_tensor_rpc_; const bool pin_small_ops_to_cpu_; }; } // namespace tensorflow #endif // TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_CONTEXT_H_
Java
using GeneticCreatures.Classes.UtilityClasses; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tester.classes; namespace GeneticCreatures.Classes.Objects.InanimateObjects { class Wall : Selectable { public Wall(Position pos) : base(pos, defaultColour) { allWalls.Add(this); } public Wall(Position pos, Colour col) : base(pos, col) { allWalls.Add(this); } public static List<Wall> allWalls = new List<Wall>(); private static Colour defaultColour = new Colour(100, 100, 100); private static Colour selectedColour = Colour.White; public override void Draw() { if (GameState.GetState() != GameStates.CreatingNet) { Colour chosenCol = colour; if (this.isSelected) chosenCol = selectedColour; ShapeDrawer.DrawCircle(position.Location, DrawRadius, chosenCol); } } protected override void DestroyWorldObject() { allWalls.Remove(this); base.DestroyWorldObject(); } } }
Java
/** * Utility classes for converting between granularities of SI (power-of-ten) and IEC (power-of-two) * byte units and bit units. * <p> * <h3>Example Usage</h3> * What's the difference in hard drive space between perception and actual? * <pre><code> * long perception = BinaryByteUnit.TEBIBYTES.toBytes(2); * long usable = DecimalByteUnit.TERABYTES.toBytes(2); * long lost = BinaryByteUnit.BYTES.toGibibytes(perception - usable); * System.out.println(lost + " GiB lost on a 2TB drive."); * </code></pre> * <p> * Method parameter for specifying a resource size. * <pre><code> * public void installDiskCache(long count, ByteUnit unit) { * long size = unit.toBytes(count); * // TODO Install disk cache of 'size' bytes. * } * </code></pre> */ package com.jakewharton.byteunits;
Java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pig.experimental.logical.relational; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.pig.data.DataType; import org.apache.pig.impl.util.Pair; /** * Schema, from a logical perspective. */ public class LogicalSchema { public static class LogicalFieldSchema { public String alias; public byte type; public long uid; public LogicalSchema schema; public LogicalFieldSchema(String alias, LogicalSchema schema, byte type) { this(alias, schema, type, -1); } public LogicalFieldSchema(String alias, LogicalSchema schema, byte type, long uid) { this.alias = alias; this.type = type; this.schema = schema; this.uid = uid; } /** * Equality is defined as having the same type and either the same schema * or both null schema. Alias and uid are not checked. */ public boolean isEqual(Object other) { if (other instanceof LogicalFieldSchema) { LogicalFieldSchema ofs = (LogicalFieldSchema)other; if (type != ofs.type) return false; if (schema == null && ofs.schema == null) return true; if (schema == null) return false; else return schema.isEqual(ofs.schema); } else { return false; } } public String toString() { if( type == DataType.BAG ) { if( schema == null ) { return ( alias + "#" + uid + ":bag{}#" ); } return ( alias + "#" + uid + ":bag{" + schema.toString() + "}" ); } else if( type == DataType.TUPLE ) { if( schema == null ) { return ( alias + "#" + uid + ":tuple{}" ); } return ( alias + "#" + uid + ":tuple(" + schema.toString() + ")" ); } return ( alias + "#" + uid + ":" + DataType.findTypeName(type) ); } } private List<LogicalFieldSchema> fields; private Map<String, Pair<Integer, Boolean>> aliases; public LogicalSchema() { fields = new ArrayList<LogicalFieldSchema>(); aliases = new HashMap<String, Pair<Integer, Boolean>>(); } /** * Add a field to this schema. * @param field to be added to the schema */ public void addField(LogicalFieldSchema field) { fields.add(field); if (field.alias != null && !field.alias.equals("")) { // put the full name of this field into aliases map // boolean in the pair indicates if this alias is full name aliases.put(field.alias, new Pair<Integer, Boolean>(fields.size()-1, true)); int index = 0; // check and put short names into alias map if there is no conflict while(index != -1) { index = field.alias.indexOf("::", index); if (index != -1) { String a = field.alias.substring(index+2); if (aliases.containsKey(a)) { // remove conflict if the conflict is not full name // we can never remove full name if (!aliases.get(a).second) { aliases.remove(a); } }else{ // put alias into map and indicate it is a short name aliases.put(a, new Pair<Integer, Boolean>(fields.size()-1, false)); } index = index +2; } } } } /** * Fetch a field by alias * @param alias * @return field associated with alias, or null if no such field */ public LogicalFieldSchema getField(String alias) { Pair<Integer, Boolean> p = aliases.get(alias); if (p == null) { return null; } return fields.get(p.first); } /** * Fetch a field by field number * @param fieldNum field number to fetch * @return field */ public LogicalFieldSchema getField(int fieldNum) { return fields.get(fieldNum); } /** * Get all fields * @return list of all fields */ public List<LogicalFieldSchema> getFields() { return fields; } /** * Get the size of the schema. * @return size */ public int size() { return fields.size(); } /** * Two schemas are equal if they are of equal size and their fields * schemas considered in order are equal. */ public boolean isEqual(Object other) { if (other != null && other instanceof LogicalSchema) { LogicalSchema os = (LogicalSchema)other; if (size() != os.size()) return false; for (int i = 0; i < size(); i++) { if (!getField(i).isEqual(os.getField(i))) return false; } return true; } else { return false; } } /** * Look for the index of the field that contains the specified uid * @param uid the uid to look for * @return the index of the field, -1 if not found */ public int findField(long uid) { for(int i=0; i< size(); i++) { LogicalFieldSchema f = getField(i); // if this field has the same uid, then return this field if (f.uid == uid) { return i; } // if this field has a schema, check its schema if (f.schema != null) { if (f.schema.findField(uid) != -1) { return i; } } } return -1; } /** * Merge two schemas. * @param s1 * @param s2 * @return a merged schema, or null if the merge fails */ public static LogicalSchema merge(LogicalSchema s1, LogicalSchema s2) { // TODO return null; } public String toString() { StringBuilder str = new StringBuilder(); for( LogicalFieldSchema field : fields ) { str.append( field.toString() + "," ); } if( fields.size() != 0 ) { str.deleteCharAt( str.length() -1 ); } return str.toString(); } }
Java
# Polystictus glaucoeffusus Lloyd, 1925 SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in Mycol. Writ. 7: 1334 (1925) #### Original name Polystictus glaucoeffusus Lloyd, 1925 ### Remarks null
Java
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Experian.Qas.Prowebintegration { public partial class RapidAddress { /// <summary> /// ButtonNew control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlButton ButtonNew; /// <summary> /// ButtonBack control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlButton ButtonBack; /// <summary> /// RadioTypedown control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.RadioButton RadioTypedown; /// <summary> /// RadioSingleline control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.RadioButton RadioSingleline; /// <summary> /// RadioKeyfinder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.RadioButton RadioKeyfinder; /// <summary> /// country control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.DropDownList country; /// <summary> /// LabelPrompt control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Label LabelPrompt; /// <summary> /// searchText control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.TextBox searchText; /// <summary> /// TableAddress control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Table TableAddress; /// <summary> /// TableMultiDPCtrl control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Table TableMultiDPCtrl; /// <summary> /// PlaceholderInfo control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.PlaceHolder PlaceholderInfo; /// <summary> /// LiteralRoute control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Literal LiteralRoute; /// <summary> /// LiteralError control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Literal LiteralError; /// <summary> /// statusData control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlTableCell statusData; /// <summary> /// matchCount control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl matchCount; /// <summary> /// infoStatus control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl infoStatus; } }
Java
// Copyright 2019 Google LLC // // 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 // // https://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 contexttip import ( "context" "fmt" "net/http" "net/http/httptest" "os" "strings" "testing" "cloud.google.com/go/pubsub" ) func TestPublishMessage(t *testing.T) { // TODO: Use testutil to get the project. projectID = os.Getenv("GOLANG_SAMPLES_PROJECT_ID") if projectID == "" { t.Skip("Missing GOLANG_SAMPLES_PROJECT_ID.") } ctx := context.Background() var err error client, err = pubsub.NewClient(ctx, projectID) if err != nil { t.Fatalf("pubsub.NewClient: %v", err) } topicName := os.Getenv("FUNCTIONS_TOPIC_NAME") if topicName == "" { topicName = "functions-test-topic" } topic := client.Topic(topicName) exists, err := topic.Exists(ctx) if err != nil { t.Fatalf("topic(%s).Exists: %v", topicName, err) } if !exists { _, err = client.CreateTopic(context.Background(), topicName) if err != nil { t.Fatalf("topic(%s).CreateTopic: %v", topicName, err) } } payload := strings.NewReader(fmt.Sprintf(`{"topic":%q, "message": %q}`, topicName, "my_message")) rr := httptest.NewRecorder() req := httptest.NewRequest("GET", "/", payload) PublishMessage(rr, req) if rr.Code != http.StatusOK { t.Errorf("PublishMessage: got response code %v, want %v", rr.Code, http.StatusOK) } want := "published" if got := rr.Body.String(); !strings.Contains(got, want) { t.Errorf("PublishMessage: got %q, want to contain %q", got, want) } }
Java
# BitmapFontImporter Import bitmap font in Unity generated by Glyph designer or ShoeBox # Tutorial http://www.benoitfreslon.com/unity-generate-and-import-a-bitmap-font-with-a-free-tool
Java
package grequests import "testing" func TestErrorOpenFile(t *testing.T) { fd, err := FileUploadFromDisk("file", "I am Not A File") if err == nil { t.Error("We are not getting an error back from our non existent file: ") } if fd != nil { t.Error("We actually got back a pointer: ", fd) } }
Java
package com.github.nikolaymakhonin.android_app_example.di.factories; import android.content.Context; import android.support.annotation.NonNull; import com.github.nikolaymakhonin.android_app_example.di.components.AppComponent; import com.github.nikolaymakhonin.android_app_example.di.components.DaggerAppComponent; import com.github.nikolaymakhonin.android_app_example.di.components.DaggerServiceComponent; import com.github.nikolaymakhonin.android_app_example.di.components.ServiceComponent; import com.github.nikolaymakhonin.common_di.modules.service.ServiceModuleBase; public final class ComponentsFactory { public static AppComponent buildAppComponent(@NonNull Context appContext) { ServiceComponent serviceComponent = buildServiceComponent(appContext); AppComponent appComponent = DaggerAppComponent.builder() .serviceComponent(serviceComponent) .build(); return appComponent; } public static ServiceComponent buildServiceComponent(@NonNull Context appContext) { ServiceComponent serviceComponent = DaggerServiceComponent.builder() .serviceModuleBase(new ServiceModuleBase(appContext)) .build(); return serviceComponent; } }
Java
/* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: https://plantuml.com * * If you like this project or if you find it useful, you can support us at: * * https://plantuml.com/patreon (only 1$ per month!) * https://plantuml.com/paypal * * This file is part of PlantUML. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * Original Author: Arnaud Roques */ package net.sourceforge.plantuml.objectdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiagram> { public CommandAddData() { super(getRegexConcat()); } static IRegex getRegexConcat() { return RegexConcat.build(CommandAddData.class.getName(), RegexLeaf.start(), // new RegexLeaf("NAME", "([%pLN_.]+)"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf(":"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("DATA", "(.*)"), RegexLeaf.end()); // } @Override protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { final String name = arg.get("NAME", 0); final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), diagram.buildCode(name), null, null); final String field = arg.get("DATA", 0); if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) { diagram.setVisibilityModifierPresent(true); } entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } }
Java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.xml.security.test.stax.c14n; import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_Excl; import org.junit.Before; import org.apache.xml.security.stax.ext.stax.XMLSecEvent; import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_ExclOmitCommentsTransformer; import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_ExclWithCommentsTransformer; import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator; import org.apache.xml.security.utils.XMLUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.*; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author $Author: coheigea $ * @version $Revision: 1721336 $ $Date: 2015-12-22 10:45:18 +0000 (Tue, 22 Dec 2015) $ */ public class Canonicalizer20010315ExclusiveTest extends org.junit.Assert { private XMLInputFactory xmlInputFactory; @Before public void setUp() throws Exception { this.xmlInputFactory = XMLInputFactory.newInstance(); this.xmlInputFactory.setEventAllocator(new XMLSecEventAllocator()); } @org.junit.Test public void test221excl() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(); c.setOutputStream(baos); XMLEventReader xmlSecEventReader = xmlInputFactory.createXMLEventReader( this.getClass().getClassLoader().getResourceAsStream( "org/apache/xml/security/c14n/inExcl/example2_2_1.xml") ); XMLSecEvent xmlSecEvent = null; while (xmlSecEventReader.hasNext()) { xmlSecEvent = (XMLSecEvent) xmlSecEventReader.nextEvent(); if (xmlSecEvent.isStartElement() && xmlSecEvent.asStartElement().getName().equals(new QName("http://example.net", "elem2"))) { break; } } while (xmlSecEventReader.hasNext()) { c.transform(xmlSecEvent); if (xmlSecEvent.isEndElement() && xmlSecEvent.asEndElement().getName().equals(new QName("http://example.net", "elem2"))) { break; } xmlSecEvent = (XMLSecEvent) xmlSecEventReader.nextEvent(); } byte[] reference = getBytesFromResource(this.getClass().getClassLoader().getResource( "org/apache/xml/security/c14n/inExcl/example2_2_c14nized_exclusive.xml")); boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray()); if (!equals) { System.out.println("Expected:\n" + new String(reference, "UTF-8")); System.out.println(""); System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8")); } assertTrue(equals); } @org.junit.Test public void test222excl() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(); c.setOutputStream(baos); canonicalize(c, this.getClass().getClassLoader().getResourceAsStream( "org/apache/xml/security/c14n/inExcl/example2_2_2.xml"), new QName("http://example.net", "elem2") ); byte[] reference = getBytesFromResource(this.getClass().getClassLoader().getResource( "org/apache/xml/security/c14n/inExcl/example2_2_c14nized_exclusive.xml")); boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray()); if (!equals) { System.out.println("Expected:\n" + new String(reference, "UTF-8")); System.out.println(""); System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8")); } assertTrue(equals); } @org.junit.Test public void test24excl() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(); c.setOutputStream(baos); canonicalize(c, this.getClass().getClassLoader().getResourceAsStream( "org/apache/xml/security/c14n/inExcl/example2_4.xml"), new QName("http://example.net", "elem2") ); byte[] reference = getBytesFromResource(this.getClass().getClassLoader().getResource( "org/apache/xml/security/c14n/inExcl/example2_4_c14nized.xml")); boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray()); if (!equals) { System.out.println("Expected:\n" + new String(reference, "UTF-8")); System.out.println(""); System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8")); } assertTrue(equals); } @org.junit.Test public void testComplexDocexcl() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(); c.setOutputStream(baos); canonicalize(c, this.getClass().getClassLoader().getResourceAsStream( "org/apache/xml/security/c14n/inExcl/plain-soap-1.1.xml"), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body", "env") ); byte[] reference = getBytesFromResource(this.getClass().getClassLoader().getResource( "org/apache/xml/security/c14n/inExcl/plain-soap-c14nized.xml")); boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray()); if (!equals) { System.out.println("Expected:\n" + new String(reference, "UTF-8")); System.out.println(""); System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8")); } assertTrue(equals); } @org.junit.Test public void testNodeSet() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("env"); inclusiveNamespaces.add("ns0"); inclusiveNamespaces.add("xsi"); inclusiveNamespaces.add("wsu"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } /** * Method test24Aexcl - a testcase for SANTUARIO-263 * "Canonicalizer can't handle dynamical created DOM correctly" * https://issues.apache.org/jira/browse/SANTUARIO-263 */ @org.junit.Test public void test24Aexcl() throws Exception { Document doc = XMLUtils.createDocumentBuilder(false).newDocument(); Element local = doc.createElementNS("foo:bar", "dsig:local"); Element test = doc.createElementNS("http://example.net", "etsi:test"); Element elem2 = doc.createElementNS("http://example.net", "etsi:elem2"); Element stuff = doc.createElementNS("foo:bar", "dsig:stuff"); elem2.appendChild(stuff); test.appendChild(elem2); local.appendChild(test); doc.appendChild(local); TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); StringWriter stringWriter = new StringWriter(); StreamResult streamResult = new StreamResult(stringWriter); t.transform(new DOMSource(doc), streamResult); ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(stringWriter.toString()), new QName("http://example.net", "elem2")); byte[] reference = getBytesFromResource(this.getClass().getClassLoader().getResource( "org/apache/xml/security/c14n/inExcl/example2_4_c14nized.xml")); boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray()); assertTrue(equals); } /** * Test default namespace behavior if its in the InclusiveNamespace prefix list. * * @throws Exception */ @org.junit.Test public void testDefaultNSInInclusiveNamespacePrefixList1() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; { ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } { //exactly the same outcome is expected if #default is not set: ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } } /** * Test default namespace behavior if its in the InclusiveNamespace prefix list. * * @throws Exception */ @org.junit.Test public void testDefaultNSInInclusiveNamespacePrefixList2() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns=\"http://example.com\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xmlns=\"\" xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML1 = "<env:Body" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xsi:type=\"ns0:ping\">" + "<ns0:text xmlns=\"\" xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; final String c14nXML2 = "<env:Body" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; { ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML1); } { ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML2); } } /** * Test default namespace behavior if its in the InclusiveNamespace prefix list. * * @throws Exception */ @org.junit.Test public void testDefaultNSInInclusiveNamespacePrefixList3() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns=\"\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; { ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } { //exactly the same outcome is expected if #default is not set: ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } } /** * Test default namespace behavior if its in the InclusiveNamespace prefix list. * * @throws Exception */ @org.junit.Test public void testDefaultNSInInclusiveNamespacePrefixList4() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xmlns=\"\" xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; { ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } { //exactly the same outcome is expected if #default is not set: ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("xsi"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } } /** * Test default namespace behavior if its in the InclusiveNamespace prefix list. * * @throws Exception */ @org.junit.Test public void testPropagateDefaultNs1() throws Exception { final String XML = "<env:Envelope" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns=\"\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } @org.junit.Test public void testPropagateDefaultNs2() throws Exception { final String XML = "<env:Envelope" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<env:Body" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } @org.junit.Test public void testPropagateDefaultNs3() throws Exception { final String XML = "<Envelope" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xmlns=\"\" xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</Envelope>"; final String c14nXML = "<env:Body" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns0:ping\">" + "<ns0:text xmlns=\"\" xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } @org.junit.Test public void testPropagateDefaultNs4() throws Exception { final String XML = "<Envelope" + " xmlns=\"\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</Envelope>"; final String c14nXML = "<env:Body" + " xmlns=\"\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + " wsu:Id=\"body\">" + "<ns0:Ping xmlns:ns0=\"http://xmlsoap.org/Ping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } @org.junit.Test public void testPropagateDefaultNs5() throws Exception { final String XML = "<env:Envelope" + " xmlns=\"http://example.com\"" + " xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ns0=\"http://xmlsoap.org/Ping\"" + " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + "<env:Body xmlns=\"\" wsu:Id=\"body\">" + "<ns0:Ping xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>" + "</env:Body>" + "</env:Envelope>"; final String c14nXML = "<ns0:Ping xmlns=\"\" xmlns:ns0=\"http://xmlsoap.org/Ping\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns0:ping\">" + "<ns0:text xsi:type=\"xsd:string\">hello</ns0:text>" + "</ns0:Ping>"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<String> inclusiveNamespaces = new ArrayList<String>(); inclusiveNamespaces.add("#default"); Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(); Map<String, Object> transformerProperties = new HashMap<String, Object>(); transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces); transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE); c.setProperties(transformerProperties); c.setOutputStream(baos); canonicalize(c, new StringReader(XML), new QName("http://xmlsoap.org/Ping", "Ping")); assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML); } private void canonicalize( Canonicalizer20010315_Excl c, InputStream inputStream, QName elementName) throws XMLStreamException { canonicalize(c, xmlInputFactory.createXMLEventReader(inputStream), elementName); } private void canonicalize( Canonicalizer20010315_Excl c, Reader reader, QName elementName) throws XMLStreamException { canonicalize(c, xmlInputFactory.createXMLEventReader(reader), elementName); } private void canonicalize( Canonicalizer20010315_Excl c, XMLEventReader xmlEventReader, QName elementName) throws XMLStreamException { XMLSecEvent xmlSecEvent = null; while (xmlEventReader.hasNext()) { xmlSecEvent = (XMLSecEvent) xmlEventReader.nextEvent(); if (xmlSecEvent.isStartElement() && xmlSecEvent.asStartElement().getName().equals(elementName)) { break; } } while (xmlEventReader.hasNext()) { c.transform(xmlSecEvent); if (xmlSecEvent.isEndElement() && xmlSecEvent.asEndElement().getName().equals(elementName)) { break; } xmlSecEvent = (XMLSecEvent) xmlEventReader.nextEvent(); } } public static byte[] getBytesFromResource(URL resource) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream inputStream = resource.openStream(); try { byte buf[] = new byte[1024]; int len; while ((len = inputStream.read(buf)) > 0) { baos.write(buf, 0, len); } return baos.toByteArray(); } finally { inputStream.close(); } } }
Java
"""Let's Encrypt constants.""" import logging from acme import challenges SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins" """Setuptools entry point group name for plugins.""" CLI_DEFAULTS = dict( config_files=["/etc/letsencrypt/cli.ini"], verbose_count=-(logging.WARNING / 10), server="https://www.letsencrypt-demo.org/acme/new-reg", rsa_key_size=2048, rollback_checkpoints=0, config_dir="/etc/letsencrypt", work_dir="/var/lib/letsencrypt", backup_dir="/var/lib/letsencrypt/backups", key_dir="/etc/letsencrypt/keys", certs_dir="/etc/letsencrypt/certs", cert_path="/etc/letsencrypt/certs/cert-letsencrypt.pem", chain_path="/etc/letsencrypt/certs/chain-letsencrypt.pem", renewer_config_file="/etc/letsencrypt/renewer.conf", no_verify_ssl=False, dvsni_port=challenges.DVSNI.PORT, ) """Defaults for CLI flags and `.IConfig` attributes.""" RENEWER_DEFAULTS = dict( renewer_config_file="/etc/letsencrypt/renewer.conf", renewal_configs_dir="/etc/letsencrypt/configs", archive_dir="/etc/letsencrypt/archive", live_dir="/etc/letsencrypt/live", renewer_enabled="yes", renew_before_expiry="30 days", deploy_before_expiry="20 days", ) """Defaults for renewer script.""" EXCLUSIVE_CHALLENGES = frozenset([frozenset([ challenges.DVSNI, challenges.SimpleHTTP])]) """Mutually exclusive challenges.""" ENHANCEMENTS = ["redirect", "http-header", "ocsp-stapling", "spdy"] """List of possible :class:`letsencrypt.interfaces.IInstaller` enhancements. List of expected options parameters: - redirect: None - http-header: TODO - ocsp-stapling: TODO - spdy: TODO """ CONFIG_DIRS_MODE = 0o755 """Directory mode for ``.IConfig.config_dir`` et al.""" TEMP_CHECKPOINT_DIR = "temp_checkpoint" """Temporary checkpoint directory (relative to IConfig.work_dir).""" IN_PROGRESS_DIR = "IN_PROGRESS" """Directory used before a permanent checkpoint is finalized (relative to IConfig.work_dir).""" CERT_KEY_BACKUP_DIR = "keys-certs" """Directory where all certificates and keys are stored (relative to IConfig.work_dir. Used for easy revocation.""" ACCOUNTS_DIR = "accounts" """Directory where all accounts are saved.""" ACCOUNT_KEYS_DIR = "keys" """Directory where account keys are saved. Relative to ACCOUNTS_DIR.""" REC_TOKEN_DIR = "recovery_tokens" """Directory where all recovery tokens are saved (relative to IConfig.work_dir)."""
Java
/* * Copyright 2015 OpenCB * * 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 org.opencb.biodata.formats.io; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class AbstractFormatReader<T> { protected Path path; protected Logger logger; protected AbstractFormatReader() { path = null; logger = LoggerFactory.getLogger(AbstractFormatReader.class); // logger.setLevel(Logger.DEBUG_LEVEL); } protected AbstractFormatReader(Path f) throws IOException { Files.exists(f); this.path = f; logger = LoggerFactory.getLogger(AbstractFormatReader.class); // logger.setLevel(Logger.DEBUG_LEVEL); } public abstract int size() throws IOException, FileFormatException; public abstract T read() throws FileFormatException; public abstract T read(String regexFilter) throws FileFormatException; public abstract List<T> read(int size) throws FileFormatException; public abstract List<T> readAll() throws FileFormatException, IOException; public abstract List<T> readAll(String pattern) throws FileFormatException; public abstract void close() throws IOException; }
Java
<?php if ( ! function_exists('env') ) { /** * 获取一个环境变量的值,支持布尔值,null,empty * * @param string $key * @param mixed $default * @return mixed */ function env($key, $default = null) { $value = getenv($key); if ($value === false) return value($default); return $value; } } if ( ! function_exists('dump') ) { /** * 浏览器友好的变量输出 * @param mixed $var 变量 * @param boolean $echo 是否输出 默认为True 如果为false 则返回输出字符串 * @param string $label 标签 默认为空 * @param boolean $strict 是否严谨 默认为true * @return void|string */ function dump($var, $echo=true, $label=null, $strict=true) { $label = ($label === null) ? '' : rtrim($label) . ' '; if (!$strict) { if (ini_get('html_errors')) { $output = print_r($var, true); $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>'; } else { $output = $label . print_r($var, true); } } else { ob_start(); var_dump($var); $output = ob_get_clean(); if (!extension_loaded('xdebug')) { $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>'; } } if ($echo) { echo($output); return null; }else return $output; } }
Java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jp.gihyo.spark.ch05 import java.text.SimpleDateFormat case class Station(id: Int, name: String, lat: Double, lon: Double, dockcount: Int, landmark: String, installation: java.sql.Date) object Station { def parse(line: String): Station = { val dateFormat = new SimpleDateFormat("MM/dd/yyy") val elms = line.split(",") val id = elms(0).toInt val name = elms(1) val lat = elms(2).toDouble val lon = elms(3).toDouble val dockcount = elms(4).toInt val landmark = elms(5) val parsedInstallation = dateFormat.parse(elms(6)) val installation = new java.sql.Date(parsedInstallation.getTime) Station(id, name, lat, lon, dockcount, landmark, installation) } }
Java
package org.ovirt.engine.ui.uicommonweb.models.configure.roles_ui; import java.util.ArrayList; import org.ovirt.engine.core.common.businessentities.ActionGroup; import org.ovirt.engine.core.common.mode.ApplicationMode; import org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper; import org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel; import org.ovirt.engine.ui.uicompat.ConstantsManager; @SuppressWarnings("unused") public class RoleTreeView { public static ArrayList<SelectionTreeNodeModel> GetRoleTreeView(boolean isReadOnly, boolean isAdmin) { RoleNode tree = initTreeView(); ArrayList<ActionGroup> userActionGroups = null; if (isAdmin == false) { userActionGroups = GetUserActionGroups(); } ArrayList<SelectionTreeNodeModel> roleTreeView = new ArrayList<SelectionTreeNodeModel>(); SelectionTreeNodeModel firstNode = null, secondNode = null, thirdNode = null; for (RoleNode first : tree.getLeafRoles()) { firstNode = new SelectionTreeNodeModel(); firstNode.setTitle(first.getName()); firstNode.setDescription(first.getName()); firstNode.setIsChangable(!isReadOnly); for (RoleNode second : first.getLeafRoles()) { secondNode = new SelectionTreeNodeModel(); secondNode.setTitle(second.getName()); secondNode.setDescription(second.getName()); secondNode.setIsChangable(!isReadOnly); secondNode.setTooltip(second.getTooltip()); for (RoleNode third : second.getLeafRoles()) { thirdNode = new SelectionTreeNodeModel(); thirdNode.setTitle(third.getName()); thirdNode.setDescription(third.getDesc()); thirdNode.setIsSelectedNotificationPrevent(true); // thirdNode.IsSelected = // attachedActions.Contains((VdcActionType) Enum.Parse(typeof (VdcActionType), name)); //TODO: // suppose to be action group thirdNode.setIsChangable(!isReadOnly); thirdNode.setIsSelectedNullable(false); thirdNode.setTooltip(third.getTooltip()); if (!isAdmin) { if (userActionGroups.contains(ActionGroup.valueOf(thirdNode.getTitle()))) { secondNode.getChildren().add(thirdNode); } } else { secondNode.getChildren().add(thirdNode); } } if (secondNode.getChildren().size() > 0) { firstNode.getChildren().add(secondNode); } } if (firstNode.getChildren().size() > 0) { roleTreeView.add(firstNode); } } return roleTreeView; } private static ArrayList<ActionGroup> GetUserActionGroups() { ArrayList<ActionGroup> array = new ArrayList<ActionGroup>(); array.add(ActionGroup.CREATE_VM); array.add(ActionGroup.DELETE_VM); array.add(ActionGroup.EDIT_VM_PROPERTIES); array.add(ActionGroup.VM_BASIC_OPERATIONS); array.add(ActionGroup.CHANGE_VM_CD); array.add(ActionGroup.MIGRATE_VM); array.add(ActionGroup.CONNECT_TO_VM); array.add(ActionGroup.CONFIGURE_VM_NETWORK); array.add(ActionGroup.CONFIGURE_VM_STORAGE); array.add(ActionGroup.MOVE_VM); array.add(ActionGroup.MANIPULATE_VM_SNAPSHOTS); array.add(ActionGroup.CREATE_TEMPLATE); array.add(ActionGroup.EDIT_TEMPLATE_PROPERTIES); array.add(ActionGroup.DELETE_TEMPLATE); array.add(ActionGroup.COPY_TEMPLATE); array.add(ActionGroup.CONFIGURE_TEMPLATE_NETWORK); array.add(ActionGroup.CREATE_VM_POOL); array.add(ActionGroup.EDIT_VM_POOL_CONFIGURATION); array.add(ActionGroup.DELETE_VM_POOL); array.add(ActionGroup.VM_POOL_BASIC_OPERATIONS); array.add(ActionGroup.MANIPULATE_PERMISSIONS); array.add(ActionGroup.CREATE_DISK); array.add(ActionGroup.ATTACH_DISK); array.add(ActionGroup.DELETE_DISK); array.add(ActionGroup.CONFIGURE_DISK_STORAGE); array.add(ActionGroup.EDIT_DISK_PROPERTIES); array.add(ActionGroup.LOGIN); array.add(ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES); array.add(ActionGroup.PORT_MIRRORING); return array; } private static RoleNode initTreeView() { RoleNode tree = new RoleNode(ConstantsManager.getInstance().getConstants().rootRoleTree(), new RoleNode[] { new RoleNode(ConstantsManager.getInstance().getConstants().systemRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureSystemRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.MANIPULATE_USERS, ConstantsManager.getInstance() .getConstants() .allowToAddRemoveUsersFromTheSystemRoleTreeTooltip()), new RoleNode(ActionGroup.MANIPULATE_PERMISSIONS, ConstantsManager.getInstance() .getConstants() .allowToAddRemovePermissionsForUsersOnObjectsInTheSystemRoleTreeTooltip()), new RoleNode(ActionGroup.MANIPULATE_ROLES, ConstantsManager.getInstance() .getConstants() .allowToDefineConfigureRolesInTheSystemRoleTreeTooltip()), new RoleNode(ActionGroup.LOGIN, ConstantsManager.getInstance() .getConstants() .allowToLoginToTheSystemRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_ENGINE, ConstantsManager.getInstance() .getConstants() .allowToGetOrSetSystemConfigurationRoleTreeTooltip()) })), new RoleNode(ConstantsManager.getInstance().getConstants().dataCenterRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureDataCenterRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_STORAGE_POOL, ConstantsManager.getInstance() .getConstants() .allowToCreateDataCenterRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_STORAGE_POOL, ConstantsManager.getInstance() .getConstants() .allowToRemoveDataCenterRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, ConstantsManager.getInstance() .getConstants() .allowToModifyDataCenterPropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_STORAGE_POOL_NETWORK, ConstantsManager.getInstance() .getConstants() .allowToConfigureLogicalNetworkPerDataCenterRoleTreeTooltip()) })), new RoleNode(ConstantsManager.getInstance().getConstants().storageDomainRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureStorageDomainRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_STORAGE_DOMAIN, ConstantsManager.getInstance() .getConstants() .allowToCreateStorageDomainRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_STORAGE_DOMAIN, ConstantsManager.getInstance() .getConstants() .allowToDeleteStorageDomainRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_STORAGE_DOMAIN_CONFIGURATION, ConstantsManager.getInstance() .getConstants() .allowToModifyStorageDomainPropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.MANIPULATE_STORAGE_DOMAIN, ConstantsManager.getInstance() .getConstants() .allowToChangeStorageDomainStatusRoleTreeTooltip()) })), new RoleNode(ConstantsManager.getInstance().getConstants().clusterRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureClusterRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_CLUSTER, ConstantsManager.getInstance() .getConstants() .allowToCreateNewClusterRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_CLUSTER, ConstantsManager.getInstance() .getConstants() .allowToRemoveClusterRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_CLUSTER_CONFIGURATION, ConstantsManager.getInstance() .getConstants() .allowToEditClusterPropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_CLUSTER_NETWORK, ConstantsManager.getInstance() .getConstants() .allowToAddRemoveLogicalNetworksForTheClusterRoleTreeTooltip()) })), new RoleNode(ConstantsManager.getInstance().getConstants().glusterRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureVolumesRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_GLUSTER_VOLUME, ConstantsManager.getInstance() .getConstants() .allowToCreateGlusterVolumesRoleTree()), new RoleNode(ActionGroup.MANIPULATE_GLUSTER_VOLUME, ConstantsManager.getInstance() .getConstants() .allowToManipulateGlusterVolumesRoleTree()) })), new RoleNode(ConstantsManager.getInstance().getConstants().hostRoleTree(), new RoleNode(ConstantsManager.getInstance() .getConstants() .configureHostRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_HOST, ConstantsManager.getInstance() .getConstants() .allowToAddNewHostToTheClusterRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_HOST, ConstantsManager.getInstance() .getConstants() .allowToRemoveExistingHostFromTheClusterRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_HOST_CONFIGURATION, ConstantsManager.getInstance() .getConstants() .allowToEditHostPropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.MANIPUTLATE_HOST, ConstantsManager.getInstance() .getConstants() .allowToChangeHostStatusRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_HOST_NETWORK, ConstantsManager.getInstance() .getConstants() .allowToConfigureHostsNetworkPhysicalInterfacesRoleTreeTooltip()) })), new RoleNode(ConstantsManager.getInstance().getConstants().templateRoleTree(), new RoleNode[] { new RoleNode(ConstantsManager.getInstance() .getConstants() .basicOperationsRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.EDIT_TEMPLATE_PROPERTIES, ConstantsManager.getInstance() .getConstants() .allowToChangeTemplatePropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_TEMPLATE_NETWORK, ConstantsManager.getInstance() .getConstants() .allowToConfigureTemlateNetworkRoleTreeTooltip()) }), new RoleNode(ConstantsManager.getInstance() .getConstants() .provisioningOperationsRoleTree(), ConstantsManager.getInstance() .getConstants() .notePermissionsContainigTheseOperationsShuoldAssociatSdOrAboveRoleTreeTooltip(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_TEMPLATE, ConstantsManager.getInstance() .getConstants() .allowToCreateNewTemplateRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_TEMPLATE, ConstantsManager.getInstance() .getConstants() .allowToRemoveExistingTemplateRoleTreeTooltip()), new RoleNode(ActionGroup.IMPORT_EXPORT_VM, ConstantsManager.getInstance() .getConstants() .allowImportExportOperationsRoleTreeTooltip()), new RoleNode(ActionGroup.COPY_TEMPLATE, ConstantsManager.getInstance() .getConstants() .allowToCopyTemplateBetweenStorageDomainsRoleTreeTooltip()) }) }), new RoleNode(ConstantsManager.getInstance().getConstants().vmRoleTree(), new RoleNode[] { new RoleNode(ConstantsManager.getInstance() .getConstants() .basicOperationsRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.VM_BASIC_OPERATIONS, ConstantsManager.getInstance() .getConstants() .allowBasicVmOperationsRoleTreeTooltip()), new RoleNode(ActionGroup.CHANGE_VM_CD, ConstantsManager.getInstance() .getConstants() .allowToAttachCdToTheVmRoleTreeTooltip()), new RoleNode(ActionGroup.CONNECT_TO_VM, ConstantsManager.getInstance() .getConstants() .allowViewingTheVmConsoleScreenRoleTreeTooltip()) }), new RoleNode(ConstantsManager.getInstance() .getConstants() .provisioningOperationsRoleTree(), ConstantsManager.getInstance() .getConstants() .notePermissionsContainigTheseOperationsShuoldAssociatSdOrAboveRoleTreeTooltip(), new RoleNode[] { new RoleNode(ActionGroup.EDIT_VM_PROPERTIES, ConstantsManager.getInstance() .getConstants() .allowChangeVmPropertiesRoleTreeTooltip()), new RoleNode(ActionGroup.CREATE_VM, ConstantsManager.getInstance() .getConstants() .allowToCreateNewVmsRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_VM, ConstantsManager.getInstance() .getConstants() .allowToRemoveVmsFromTheSystemRoleTreeTooltip()), new RoleNode(ActionGroup.IMPORT_EXPORT_VM, ConstantsManager.getInstance() .getConstants() .allowImportExportOperationsRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_VM_NETWORK, ConstantsManager.getInstance() .getConstants() .allowToConfigureVMsNetworkRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_VM_STORAGE, ConstantsManager.getInstance() .getConstants() .allowToAddRemoveDiskToTheVmRoleTreeTooltip()), new RoleNode(ActionGroup.MANIPULATE_VM_SNAPSHOTS, ConstantsManager.getInstance() .getConstants() .allowToCreateDeleteSnapshotsOfTheVmRoleTreeTooltip()) }), new RoleNode(ConstantsManager.getInstance() .getConstants() .administrationOperationsRoleTree(), ConstantsManager.getInstance() .getConstants() .notePermissionsContainigTheseOperationsShuoldAssociatDcOrEqualRoleTreeTooltip(), new RoleNode[] { new RoleNode(ActionGroup.MOVE_VM, ConstantsManager.getInstance() .getConstants() .allowToMoveVmImageToAnotherStorageDomainRoleTreeTooltip()), new RoleNode(ActionGroup.MIGRATE_VM, ConstantsManager.getInstance() .getConstants() .allowMigratingVmBetweenHostsInClusterRoleTreeTooltip()), new RoleNode(ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES, ConstantsManager.getInstance() .getConstants() .allowMigratingVmBetweenHostsInClusterRoleTreeTooltip()), new RoleNode(ActionGroup.PORT_MIRRORING, ConstantsManager.getInstance() .getConstants() .allowVmNetworkPortMirroringRoleTreeTooltip()) }) }), new RoleNode(ConstantsManager.getInstance().getConstants().vmPoolRoleTree(), new RoleNode[] { new RoleNode(ConstantsManager.getInstance() .getConstants() .basicOperationsRoleTree(), new RoleNode[] { new RoleNode(ActionGroup.VM_POOL_BASIC_OPERATIONS, ConstantsManager.getInstance() .getConstants() .allowToRunPauseStopVmFromVmPoolRoleTreeTooltip()) }), new RoleNode(ConstantsManager.getInstance() .getConstants() .provisioningOperationsRoleTree(), ConstantsManager.getInstance() .getConstants() .notePermissionsContainigTheseOperationsShuoldAssociatSdOrAboveRoleTreeTooltip(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_VM_POOL, ConstantsManager.getInstance() .getConstants() .allowToCreateVmPoolRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_VM_POOL, ConstantsManager.getInstance() .getConstants() .allowToDeleteVmPoolRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_VM_POOL_CONFIGURATION, ConstantsManager.getInstance() .getConstants() .allowToChangePropertiesOfTheVmPoolRoleTreeTooltip()) }) }), new RoleNode(ConstantsManager.getInstance().getConstants().diskRoleTree(), new RoleNode[] { new RoleNode(ConstantsManager.getInstance() .getConstants() .provisioningOperationsRoleTree(), ConstantsManager.getInstance() .getConstants() .notePermissionsContainingOperationsRoleTreeTooltip(), new RoleNode[] { new RoleNode(ActionGroup.CREATE_DISK, ConstantsManager.getInstance() .getConstants() .allowToCreateDiskRoleTreeTooltip()), new RoleNode(ActionGroup.DELETE_DISK, ConstantsManager.getInstance() .getConstants() .allowToDeleteDiskRoleTreeTooltip()), new RoleNode(ActionGroup.CONFIGURE_DISK_STORAGE, ConstantsManager.getInstance() .getConstants() .allowToMoveDiskToAnotherStorageDomainRoleTreeTooltip()), new RoleNode(ActionGroup.ATTACH_DISK, ConstantsManager.getInstance() .getConstants() .allowToAttachDiskToVmRoleTreeTooltip()), new RoleNode(ActionGroup.EDIT_DISK_PROPERTIES, ConstantsManager.getInstance() .getConstants() .allowToChangePropertiesOfTheDiskRoleTreeTooltip()) }) }) }); // nothing to filter if (!ApplicationModeHelper.getUiMode().equals(ApplicationMode.AllModes)) { ApplicationModeHelper.filterActionGroupTreeByApplictionMode(tree); } return tree; } }
Java
package com.jpattern.core.command; import com.jpattern.core.IProvider; import com.jpattern.core.exception.NullProviderException; import com.jpattern.logger.ILogger; import com.jpattern.logger.SystemOutLoggerFactory; /** * * @author Francesco Cina' * * 11/set/2011 */ public abstract class ACommand<T extends IProvider> { private ICommandExecutor commandExecutor; private IOnExceptionStrategy onExceptionStrategy; private T provider; private ILogger logger = null; private boolean executed = false; private boolean rolledback = false; /** * This method launch the execution of the command (or chain of commands) using the default * default Executor and catching every runtime exception. * This command is the same of: * exec(provider, true); * @return the result of the execution */ public final ACommandResult exec(T provider) { return exec(provider, new DefaultCommandExecutor()); } /** * This method launch the execution of the command (or chain of commands). * Every command in the chain will be managed by an ICommandExecutor object. * This command is the same of: * exec(commandExecutor, true); * @param aCommandExecutor the pool in which the command will runs * @return the result of the execution */ public final ACommandResult exec(T provider, ICommandExecutor commandExecutor) { visit(provider); return exec( commandExecutor, new CommandResult()); } /** * This method launch the rollback of the command execution (or chain of commands) using the default * default Executor and catching every runtime exception. * The rollback is effectively performed only if the command has been executed with a positive result, otherwise * the command is intended as "not executed" then no rollback will be performed. * This command is the same of: * rollback(provider, true); * @return the result of the rollback */ public final ACommandResult rollback(T provider) { return rollback(provider, new DefaultCommandExecutor()); } /** * This method launch the rollback of the command execution (or chain of commands) using a custom command executor. * The rollback is effectively performed only if the command has been executed with a positive result, otherwise * the command is intended as "not executed" then no rollback will be performed. * This command is the same of: * rollback(provider, commandExecutor, true); * @return the result of the rollback */ public final ACommandResult rollback(T provider, ICommandExecutor commandExecutor) { visit(provider); return rollback(commandExecutor, new CommandResult()); } void visit(T provider) { this.provider = provider; } protected final ACommandResult exec(ICommandExecutor commandExecutor, ACommandResult commandResult) { this.commandExecutor = commandExecutor; commandResult.setExecutionStart(this); getCommandExecutor().execute(this, commandResult); return commandResult; } protected final ACommandResult rollback(ICommandExecutor commandExecutor, ACommandResult commandResult) { this.commandExecutor = commandExecutor; commandResult.setExecutionStart(this); getCommandExecutor().rollback(this, commandResult); return commandResult; } protected final ICommandExecutor getCommandExecutor() { if (commandExecutor==null) { commandExecutor = new DefaultCommandExecutor(); } return commandExecutor; } protected final T getProvider() { if (provider==null) { throw new NullProviderException(); } return provider; } protected final ILogger getLogger() { if (logger == null) { if (provider == null) { logger = new SystemOutLoggerFactory().logger(getClass()); } else { logger = getProvider().getLoggerService().logger(this.getClass()); } } return logger; } public void setOnExceptionStrategy(IOnExceptionStrategy onExceptionStrategy) { this.onExceptionStrategy = onExceptionStrategy; } public IOnExceptionStrategy getOnExceptionStrategy() { if (onExceptionStrategy == null) { onExceptionStrategy = new CatchOnExceptionStrategy(); } return onExceptionStrategy; } protected final void doExec(ACommandResult commandResult) { try { int errorSize = commandResult.getErrorMessages().size(); executed = false; rolledback = false; execute(commandResult); executed = commandResult.getErrorMessages().size() == errorSize; } catch (RuntimeException e) { getOnExceptionStrategy().onException(e, getLogger(), commandResult, "RuntimeException thrown"); } finally { try { postExecute(commandResult); } finally { commandResult.setExecutionEnd(this); } } } void postExecute(ACommandResult commandResult) { } void postRollback(ACommandResult commandResult) { } protected final void doRollback(ACommandResult commandResult) { try { if (executed && !rolledback) { rollback(commandResult); rolledback = true; } } catch (RuntimeException e) { getOnExceptionStrategy().onException(e, getLogger(), commandResult, "RuntimeException thrown while rollbacking"); } finally { try { postRollback(commandResult); } finally { commandResult.setExecutionEnd(this); } } } protected abstract void execute(ACommandResult commandResult); protected abstract void rollback(ACommandResult commandResult); void setExecuted(boolean executed) { this.executed = executed; } boolean isExecuted() { return executed; } void setRolledback(boolean rolledback) { this.rolledback = rolledback; } boolean isRolledback() { return rolledback; } }
Java
#ifndef AXISCOLORSTRUCT_H #define AXISCOLORSTRUCT_H struct axisColorStruct { public : double XAxiscolor[3]; double YAxiscolor[3]; double ZAxiscolor[3]; bool complementaryColor; bool sameColor; }; #endif // AXISCOLORSTRUCT_H
Java
<?php namespace App\Http\Controllers\Sadmin; use App\Http\Controllers\Controller; use App\Driver; use App\Customer; use App\User; use App\Detail; use Illuminate\Http\Request; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\DB; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Support\Facades\Auth; use File; use Mail; use PDF; class BillingController extends Controller { public function __construct() { $this->middleware(function ($request, $next) { $user = Auth::user(); $customer_email = Auth::user()->email; $customer = Customer::where("email", $customer_email)->get(); $this->customer_id = $customer[0]->id; return $next($request); }); } public function index(Request $request) { if(Auth::user() == NULL) { return redirect('sadmin'); } $customer_email = Auth::user()->email; $login_user_id = Auth::user()->id; $s = $request->s; $billings = Detail::join('drivers', 'details.driver_id', '=', 'drivers.id'); $billings=$billings->select('details.*', 'drivers.user_id'); $billings=$billings->where('drivers.company_id', $this->customer_id); $billings=$billings->where('details.invoice_created','<>',''); if(isset($s))$billings -> search($s); $billings=$billings->orderBy('details.created_at','desc')->paginate(10); return view('sadmin.billing.index', compact('billings','s','customer_email')); } public function set_paymentmark(Request $request) { $id = $request->id; $detail = Detail::find($id); $detail->paid_status = 1; $detail->save(); $result['status'] = 'success'; die(json_encode($result)); } public function create_invoice($id){ $detail_id = $id; $detail = Detail::join('contact_lists as c','details.contact_id','c.id')-> select('details.*','c.d_company_name','c.address1','c.city','c.state','c.zipcode')->where('details.id', $detail_id)->get(); $driver = Driver::join('details', 'details.driver_id','=', 'drivers.id') ->join('contact_lists','details.contact_id','contact_lists.id') ->join('users','users.id','drivers.user_id') ->where('details.id',$detail_id)->get(); $driver = $driver[0]; $customer = Customer::find($this->customer_id); return view('sadmin.billing.invoice_template', compact('detail_id','detail','driver','customer')); } public function generate_invoice(Request $request) { $detail_id = $request['detail_id']; $activity = $request['activity']; $amount = $request['sp_rate']; $charge_array = array(); for($i=0; $i< count($activity); $i++) { $item['text'] = $activity[$i]; $item['rate'] = $amount[$i]; array_push($charge_array,$item); } $invoice_details = $this->arrayToObject($charge_array); //return response()->json(['add_charge'=>$add_charge[0]->text], $this->successStatus); $drivers = Driver::join('details', 'details.driver_id','=', 'drivers.id') ->join('contact_lists','details.contact_id','contact_lists.id') ->join('users','users.id','drivers.user_id') ->where('details.id',$detail_id)->get(); // $contact = Detail::where('id', $drivers[0]->contact_id)->get(); $customers = Customer::where('id', $drivers[0]->company_id)->get(); $filename ='Invoice_'. uniqid(). ".pdf" ; $filepath = public_path('files').'/'.$filename; // $pdf=PDF::loadView('driver_invoice_pdf',['drivers' => $drivers, 'customers' => $customers, 'invoice_details' => $invoice_details])->setPaper('a4')->save($filepath); $pdf=PDF::setOptions([ 'logOutputFile' => storage_path('logs/log.htm'), 'tempDir' => storage_path('logs/') ])->loadView('driver_invoice_pdf',['drivers' => $drivers, 'customers' => $customers, 'invoice_details' => $invoice_details])->setPaper('a4')->save($filepath); $filepath_str = asset('/files/'.$filename); $detail = Detail::findOrFail($detail_id); $files = $detail->upload; $names = $detail->filename; $detail->upload = ($files=="")?$filepath_str:$files.",".$filepath_str ; $detail->filename = ($names=="")?$filename:$names.",".$filename; $detail->invoice_created = date("Y-m-d"); $detail->save(); $result['status'] = 'ok'; die(json_encode($result)); } private function array_to_obj($array, &$obj) { foreach ($array as $key => $value) { if (is_array($value)) { $obj->$key = new \stdClass(); $this->array_to_obj($value, $obj->$key); } else { $obj->$key = $value; } } return $obj; } private function arrayToObject($array) { $object= new \stdClass(); return $this->array_to_obj($array,$object); } public function send_invoice(Request $request){ $detail_id = $request->detail_id; /////// $from = Auth::user(); $to = $request->to; $subject = $request->subject; $content = $request->message; $attach = json_decode($request->attach); $message_arr = json_decode($content); $data = array( 'from' => $from, 'to' => $to, 'subject' => $subject, 'content' => $message_arr, 'attach' => $attach ); $mail_status = Mail::send('sadmin.invoice.invoice_mail', $data,function($message) use($data){ $message->to($data['to'])->subject($data['subject']); $message->from($data['from']->email, $data['from']->firstname." " .$data['from']->lastname); $message->replyTo($data['from']->email, $data['from']->firstname." " .$data['from']->lastname); foreach($data['attach'] as $filePath){ $message->attach($filePath); } }); if(count(Mail::failures()) > 0){ $result['msg'] = 'Failed to send invoice email, please try again.'; $result['status'] = "fail"; }else{ $result['msg'] = 'Sent the invoice email succesfully.'; $result['status'] = "success"; } die(json_encode($result)); } /* public function set_payment(Request $request){ $invoice_id = $request->id; $invoice = Invoice::find($invoice_id); if($invoice->send_status == 0){ $result['msg'] = "The invoice is not sent yet.\n Please confirm before."; $result['status']="fail"; }else{ $invoice->paid_status=1; if($invoice->save()){ $result['status']="success"; }else{ $result['status']="fail"; $result['msg'] = "Failed the save."; } } die(json_encode($result)); } //invoice delete public function destroy($id) { $invoice_detail = Invoice_detail::where('inv_id','=',$id)->get(); foreach ($invoice_detail as $recode) { $recode -> delete(); } $invoice_special = Invoice_special::where('inv_id',$id)->get(); foreach ($invoice_special as $recode) { $recode -> delete(); } $invoice = Invoice::find($id); $invoice->delete(); // return redirect('admin/invoice'); return back(); } */ }
Java
var child_process = require('child_process'), fs = require('fs'), path = require('path'); module.exports = function(context) { var IOS_DEPLOYMENT_TARGET = '8.0', SWIFT_VERSION = '3.0', COMMENT_KEY = /_comment$/, CORDOVA_VERSION = process.env.CORDOVA_VERSION; run(); function run() { var cordova_util = context.requireCordovaModule('cordova-lib/src/cordova/util'), ConfigParser = CORDOVA_VERSION >= 6.0 ? context.requireCordovaModule('cordova-common').ConfigParser : context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser'), projectRoot = cordova_util.isCordova(), platform_ios, xml = cordova_util.projectConfig(projectRoot), cfg = new ConfigParser(xml), projectName = cfg.name(), iosPlatformPath = path.join(projectRoot, 'platforms', 'ios'), iosProjectFilesPath = path.join(iosPlatformPath, projectName), xcconfigPath = path.join(iosPlatformPath, 'cordova', 'build.xcconfig'), xcconfigContent, projectFile, xcodeProject, bridgingHeaderPath; if(CORDOVA_VERSION < 7.0) { platform_ios = CORDOVA_VERSION < 5.0 ? context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios'] : context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios') projectFile = platform_ios.parseProjectFile(iosPlatformPath); } else { var project_files = context.requireCordovaModule('glob').sync(path.join(iosPlatformPath, '*.xcodeproj', 'project.pbxproj')); if (project_files.length === 0) { throw new Error('Can\'t found xcode project file'); } var pbxPath = project_files[0]; var xcodeproj = context.requireCordovaModule('xcode').project(pbxPath); xcodeproj.parseSync(); projectFile = { 'xcode': xcodeproj, write: function () { var fs = context.requireCordovaModule('fs'); var frameworks_file = path.join(iosPlatformPath, 'frameworks.json'); var frameworks = {}; try { frameworks = context.requireCordovaModule(frameworks_file); console.log(JSON.stringify(frameworks)); } catch(e) {} fs.writeFileSync(pbxPath, xcodeproj.writeSync()); fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4)); } }; } xcodeProject = projectFile.xcode; if (fs.existsSync(xcconfigPath)) { xcconfigContent = fs.readFileSync(xcconfigPath, 'utf-8'); } bridgingHeaderPath = getBridgingHeader(projectName, xcconfigContent, xcodeProject); if(bridgingHeaderPath) { bridgingHeaderPath = path.join(iosPlatformPath, bridgingHeaderPath); } else { bridgingHeaderPath = createBridgingHeader(xcodeProject, projectName, iosProjectFilesPath); } getExistingBridgingHeaders(iosProjectFilesPath, function (headers) { importBridgingHeaders(bridgingHeaderPath, headers); var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection()), config, buildSettings; for (config in configurations) { buildSettings = configurations[config].buildSettings; buildSettings['IPHONEOS_DEPLOYMENT_TARGET'] = IOS_DEPLOYMENT_TARGET; buildSettings['SWIFT_VERSION'] = SWIFT_VERSION; buildSettings['EMBEDDED_CONTENT_CONTAINS_SWIFT'] = "YES"; buildSettings['LD_RUNPATH_SEARCH_PATHS'] = '"@executable_path/Frameworks"'; } console.log('IOS project now has deployment target set as:[' + IOS_DEPLOYMENT_TARGET + '] ...'); console.log('IOS project option EMBEDDED_CONTENT_CONTAINS_SWIFT set as:[YES] ...'); console.log('IOS project swift_objc Bridging-Header set to:[' + bridgingHeaderPath + '] ...'); console.log('IOS project Runpath Search Paths set to: @executable_path/Frameworks ...'); projectFile.write(); }); } function getBridgingHeader(projectName, xcconfigContent, xcodeProject) { var configurations, config, buildSettings, bridgingHeader; if (xcconfigContent) { var regex = /^SWIFT_OBJC_BRIDGING_HEADER *=(.*)$/m, match = xcconfigContent.match(regex); if (match) { bridgingHeader = match[1]; bridgingHeader = bridgingHeader .replace("$(PROJECT_DIR)/", "") .replace("$(PROJECT_NAME)", projectName) .trim(); return bridgingHeader; } } configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection()); for (config in configurations) { buildSettings = configurations[config].buildSettings; bridgingHeader = buildSettings['SWIFT_OBJC_BRIDGING_HEADER']; if (bridgingHeader) { return unquote(bridgingHeader); } } } function createBridgingHeader(xcodeProject, projectName, xcodeProjectRootPath) { var newBHPath = path.join(xcodeProjectRootPath, "Plugins", "Bridging-Header.h"), content = ["//", "// Use this file to import your target's public headers that you would like to expose to Swift.", "//", "#import <Cordova/CDV.h>"] //fs.openSync(newBHPath, 'w'); console.log('Creating new Bridging-Header.h at path: ', newBHPath); fs.writeFileSync(newBHPath, content.join("\n"), { encoding: 'utf-8', flag: 'w' }); xcodeProject.addHeaderFile("Bridging-Header.h"); setBridgingHeader(xcodeProject, path.join(projectName, "Plugins", "Bridging-Header.h")); return newBHPath; } function setBridgingHeader(xcodeProject, headerPath) { var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection()), config, buildSettings, bridgingHeader; for (config in configurations) { buildSettings = configurations[config].buildSettings; buildSettings['SWIFT_OBJC_BRIDGING_HEADER'] = '"' + headerPath + '"'; } } function getExistingBridgingHeaders(xcodeProjectRootPath, callback) { var searchPath = path.join(xcodeProjectRootPath, 'Plugins'); child_process.exec('find . -name "*Bridging-Header*.h"', { cwd: searchPath }, function (error, stdout, stderr) { var headers = stdout.toString().split('\n').map(function (filePath) { return path.basename(filePath); }); callback(headers); }); } function importBridgingHeaders(mainBridgingHeader, headers) { var content = fs.readFileSync(mainBridgingHeader, 'utf-8'), mainHeaderName = path.basename(mainBridgingHeader); headers.forEach(function (header) { if(header !== mainHeaderName && content.indexOf(header) < 0) { if (content.charAt(content.length - 1) != '\n') { content += "\n"; } content += "#import \""+header+"\"\n" console.log('Importing ' + header + ' into main bridging-header at: ' + mainBridgingHeader); } }); fs.writeFileSync(mainBridgingHeader, content, 'utf-8'); } function nonComments(obj) { var keys = Object.keys(obj), newObj = {}, i = 0; for (i; i < keys.length; i++) { if (!COMMENT_KEY.test(keys[i])) { newObj[keys[i]] = obj[keys[i]]; } } return newObj; } function unquote(str) { if (str) return str.replace(/^"(.*)"$/, "$1"); } }
Java
/* * Copyright 2017 the original author or authors. * * 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 org.gradle.internal.hash; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import static com.google.common.base.Preconditions.checkNotNull; /** * Output stream decorator that hashes data written to the stream. * Inspired by the Google Guava project. */ public final class HashingOutputStream extends FilterOutputStream { private final Hasher hasher; public HashingOutputStream(HashFunction hashFunction, OutputStream out) { super(checkNotNull(out)); this.hasher = checkNotNull(hashFunction.newHasher()); } @Override public void write(int b) throws IOException { hasher.putByte((byte) b); out.write(b); } @Override public void write(byte[] bytes, int off, int len) throws IOException { hasher.putBytes(bytes, off, len); out.write(bytes, off, len); } public HashCode hash() { return hasher.hash(); } @Override public void close() throws IOException { out.close(); } }
Java
/* * Copyright (c) 2014 Spotify AB. * * 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.spotify.helios.agent; import com.spotify.docker.client.ContainerNotFoundException; import com.spotify.docker.client.DockerClient; import com.spotify.docker.client.DockerException; import com.spotify.docker.client.messages.ContainerInfo; import com.spotify.helios.common.descriptors.Goal; import com.spotify.helios.common.descriptors.Job; import com.spotify.helios.servicescommon.DefaultReactor; import com.spotify.helios.servicescommon.Reactor; import com.spotify.helios.servicescommon.statistics.MetricsContext; import com.spotify.helios.servicescommon.statistics.SupervisorMetrics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InterruptedIOException; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static com.spotify.helios.common.descriptors.TaskStatus.State.STOPPED; import static com.spotify.helios.common.descriptors.TaskStatus.State.STOPPING; import static java.util.concurrent.TimeUnit.SECONDS; /** * Supervises docker containers for a single job. */ public class Supervisor { public interface Listener { void stateChanged(Supervisor supervisor); } private static final Logger log = LoggerFactory.getLogger(Supervisor.class); private final DockerClient docker; private final Job job; private final RestartPolicy restartPolicy; private final SupervisorMetrics metrics; private final Reactor reactor; private final Listener listener; private final TaskRunnerFactory runnerFactory; private final StatusUpdater statusUpdater; private final TaskMonitor monitor; private final Sleeper sleeper; private volatile Goal goal; private volatile String containerId; private volatile TaskRunner runner; private volatile Command currentCommand; private volatile Command performedCommand; public Supervisor(final Builder builder) { this.job = checkNotNull(builder.job, "job"); this.docker = checkNotNull(builder.dockerClient, "docker"); this.restartPolicy = checkNotNull(builder.restartPolicy, "restartPolicy"); this.metrics = checkNotNull(builder.metrics, "metrics"); this.listener = checkNotNull(builder.listener, "listener"); this.currentCommand = new Nop(); this.containerId = builder.existingContainerId; this.runnerFactory = checkNotNull(builder.runnerFactory, "runnerFactory"); this.statusUpdater = checkNotNull(builder.statusUpdater, "statusUpdater"); this.monitor = checkNotNull(builder.monitor, "monitor"); this.reactor = new DefaultReactor("supervisor-" + job.getId(), new Update(), SECONDS.toMillis(30)); this.reactor.startAsync(); statusUpdater.setContainerId(containerId); this.sleeper = builder.sleeper; } public void setGoal(final Goal goal) { if (this.goal == goal) { return; } log.debug("Supervisor {}: setting goal: {}", job.getId(), goal); this.goal = goal; statusUpdater.setGoal(goal); switch (goal) { case START: currentCommand = new Start(); reactor.signal(); metrics.supervisorStarted(); break; case STOP: case UNDEPLOY: currentCommand = new Stop(); reactor.signal(); metrics.supervisorStopped(); break; } } /** * Close this supervisor. The actual container is left as-is. */ public void close() { reactor.stopAsync(); if (runner != null) { runner.stopAsync(); } metrics.supervisorClosed(); monitor.close(); } /** * Wait for supervisor to stop after closing it. */ public void join() { reactor.awaitTerminated(); if (runner != null) { // Stop the runner again in case it was rewritten by the reactor before it terminated. runner.stopAsync(); runner.awaitTerminated(); } } /** * Check if the current command is start. * @return True if current command is start, otherwise false. */ public boolean isStarting() { return currentCommand instanceof Start; } /** * Check if the current command is stop. * @return True if current command is stop, otherwise false. */ public boolean isStopping() { return currentCommand instanceof Stop; } /** * Check whether the last start/stop command is done. * @return True if last start/stop command is done, otherwise false. */ public boolean isDone() { return currentCommand == performedCommand; } /** * Get the current container id * @return The container id. */ public String containerId() { return containerId; } private class Update implements Reactor.Callback { @Override public void run(final boolean timeout) throws InterruptedException { final Command command = currentCommand; final boolean done = performedCommand == command; log.debug("Supervisor {}: update: performedCommand={}, command={}, done={}", job.getId(), performedCommand, command, done); command.perform(done); if (!done) { performedCommand = command; fireStateChanged(); } } } private void fireStateChanged() { log.debug("Supervisor {}: state changed", job.getId()); try { listener.stateChanged(this); } catch (Exception e) { log.error("Listener threw exception", e); } } public static Builder newBuilder() { return new Builder(); } public static class Builder { private Builder() { } private Job job; private String existingContainerId; private DockerClient dockerClient; private RestartPolicy restartPolicy; private SupervisorMetrics metrics; private Listener listener = new NopListener(); private TaskRunnerFactory runnerFactory; private StatusUpdater statusUpdater; private TaskMonitor monitor; private Sleeper sleeper = new ThreadSleeper(); public Builder setJob(final Job job) { this.job = job; return this; } public Builder setExistingContainerId(final String existingContainerId) { this.existingContainerId = existingContainerId; return this; } public Builder setRestartPolicy(final RestartPolicy restartPolicy) { this.restartPolicy = restartPolicy; return this; } public Builder setDockerClient(final DockerClient dockerClient) { this.dockerClient = dockerClient; return this; } public Builder setMetrics(SupervisorMetrics metrics) { this.metrics = metrics; return this; } public Builder setListener(final Listener listener) { this.listener = listener; return this; } public Builder setRunnerFactory(final TaskRunnerFactory runnerFactory) { this.runnerFactory = runnerFactory; return this; } public Builder setStatusUpdater(final StatusUpdater statusUpdater) { this.statusUpdater = statusUpdater; return this; } public Builder setMonitor(final TaskMonitor monitor) { this.monitor = monitor; return this; } public Builder setSleeper(final Sleeper sleeper) { this.sleeper = sleeper; return this; } public Supervisor build() { return new Supervisor(this); } private class NopListener implements Listener { @Override public void stateChanged(final Supervisor supervisor) { } } } private interface Command { /** * Perform the command. Although this is declared to throw InterruptedException, this will only * happen when the supervisor is being shut down. During normal operations, the operation will * be allowed to run until it's done. * @param done Flag indicating if operation is done. * @throws InterruptedException If thread is interrupted. */ void perform(final boolean done) throws InterruptedException; } /** * Starts a container and attempts to keep it up indefinitely, restarting it when it exits. */ private class Start implements Command { @Override public void perform(final boolean done) throws InterruptedException { if (runner == null) { // There's no active runner, start it to bring up the container. startAfter(0); return; } if (runner.isRunning()) { // There's an active runner, brought up by this or another Start command previously. return; } // Check if the runner exited normally or threw an exception final Result<Integer> result = runner.result(); if (!result.isSuccess()) { // Runner threw an exception, inspect it. final Throwable t = result.getException(); if (t instanceof InterruptedException || t instanceof InterruptedIOException) { // We're probably shutting down, remove the runner and bail. log.debug("task runner interrupted"); runner = null; reactor.signal(); return; } else if (t instanceof DockerException) { log.error("docker error", t); } else { log.error("task runner threw exception", t); } } // Restart the task startAfter(restartPolicy.delay(monitor.throttle())); } private void startAfter(final long delay) { log.debug("starting job (delay={}): {}", delay, job); runner = runnerFactory.create(delay, containerId, new TaskListener()); runner.startAsync(); runner.resultFuture().addListener(reactor.signalRunnable(), directExecutor()); } } /** * Stops a container, making sure that the runner spawned by {@link Start} is stopped and the * container is not running. */ private class Stop implements Command { @Override public void perform(final boolean done) throws InterruptedException { if (done) { return; } final Integer gracePeriod = job.getGracePeriod(); if (gracePeriod != null && gracePeriod > 0) { log.info("Unregistering from service discovery for {} seconds before stopping", gracePeriod); statusUpdater.setState(STOPPING); statusUpdater.update(); if (runner.unregister()) { log.info("Unregistered. Now sleeping for {} seconds.", gracePeriod); sleeper.sleep(TimeUnit.MILLISECONDS.convert(gracePeriod, TimeUnit.SECONDS)); } } log.info("stopping job: {}", job); // Stop the runner if (runner != null) { runner.stop(); runner = null; } final RetryScheduler retryScheduler = BoundedRandomExponentialBackoff.newBuilder() .setMinIntervalMillis(SECONDS.toMillis(1)) .setMaxIntervalMillis(SECONDS.toMillis(30)) .build().newScheduler(); // Kill the container after stopping the runner while (!containerNotRunning()) { killContainer(); Thread.sleep(retryScheduler.nextMillis()); } statusUpdater.setState(STOPPED); statusUpdater.setContainerError(containerError()); statusUpdater.update(); } private void killContainer() throws InterruptedException { if (containerId == null) { return; } try { docker.killContainer(containerId); } catch (DockerException e) { log.error("failed to kill container {}", containerId, e); } } private boolean containerNotRunning() throws InterruptedException { if (containerId == null) { return true; } final ContainerInfo containerInfo; try { containerInfo = docker.inspectContainer(containerId); } catch (ContainerNotFoundException e) { return true; } catch (DockerException e) { log.error("failed to query container {}", containerId, e); return false; } return !containerInfo.state().running(); } private String containerError() throws InterruptedException { if (containerId == null) { return null; } final ContainerInfo containerInfo; try { containerInfo = docker.inspectContainer(containerId); } catch (ContainerNotFoundException e) { return null; } catch (DockerException e) { log.error("failed to query container {}", containerId, e); return null; } return containerInfo.state().error(); } } private static class Nop implements Command { @Override public void perform(final boolean done) { } } @Override public String toString() { return "Supervisor{" + "job=" + job + ", currentCommand=" + currentCommand + ", performedCommand=" + performedCommand + '}'; } private class TaskListener extends TaskRunner.NopListener { private MetricsContext pullContext; @Override public void failed(final Throwable t, final String containerError) { metrics.containersThrewException(); } @Override public void pulling() { pullContext = metrics.containerPull(); } @Override public void pullFailed() { if (pullContext != null) { pullContext.failure(); } } @Override public void pulled() { if (pullContext != null) { pullContext.success(); } } @Override public void created(final String createdContainerId) { containerId = createdContainerId; } } }
Java
package de.saxsys.mvvmfx.examples.contacts.model; public class Subdivision { private final String name; private final String abbr; private final Country country; public Subdivision(String name, String abbr, Country country) { this.name = name; this.abbr = abbr; this.country = country; } public String getName() { return name; } public String getAbbr() { return abbr; } public Country getCountry() { return country; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Subdivision that = (Subdivision) o; if (!abbr.equals(that.abbr)) { return false; } if (!country.equals(that.country)) { return false; } if (!name.equals(that.name)) { return false; } return true; } @Override public int hashCode() { int result = name.hashCode(); result = 31 * result + abbr.hashCode(); result = 31 * result + country.hashCode(); return result; } }
Java
package http import ( bm "go-common/library/net/http/blademaster" ) func debugCache(c *bm.Context) { opt := new(struct { Keys string `form:"keys" validate:"required"` }) if err := c.Bind(opt); err != nil { return } c.JSONMap(srv.DebugCache(opt.Keys), nil) }
Java
-- MySQL dump 10.13 Distrib 5.1.61, for redhat-linux-gnu (x86_64) -- -- Host: mysql-eg-devel-1.ebi.ac.uk Database: test_escherichia_coli_core -- ------------------------------------------------------ -- Server version 5.5.36-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `analysis_description` -- DROP TABLE IF EXISTS `analysis_description`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `analysis_description` ( `analysis_id` smallint(5) unsigned NOT NULL, `description` text, `display_label` varchar(255) NOT NULL, `displayable` tinyint(1) NOT NULL DEFAULT '1', `web_data` text, UNIQUE KEY `analysis_idx` (`analysis_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2014-05-23 13:47:08
Java
# Poneramoeba Lühe, 1909 GENUS #### Status ACCEPTED #### According to Interim Register of Marine and Nonmarine Genera #### Published in Schr. Ges. Königsb. , 49, 421. #### Original name null ### Remarks null
Java
package com.twitter.io import java.io.IOException import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class BufInputStreamTest extends FunSuite { private[this] val fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\n" private[this] val fileBuf = Buf.ByteArray(fileString.getBytes) test("Constructor") { val is = new BufInputStream(fileBuf) assert(is.available() == fileString.length()) } test("available") { val is = new BufInputStream(fileBuf) assert(is.available() == fileString.length(), "Returned incorrect number of available bytes") } test("close") { val is = new BufInputStream(fileBuf) val i = is.read() assert(i != -1) try { is.close() } catch { case e: IOException => fail("Test 1: Failed to close the input stream.") } try { val j = is.read() assert(j != -1) } catch { case e: Exception => fail("Test 2: Should be able to read from closed stream.") } } test("markI") { val is = new BufInputStream(fileBuf) // Test for method void java.io.ByteArrayInputStream.mark(int) val array1 = new Array[Byte](100) val array2 = new Array[Byte](100) try { is.skip(3000) is.mark(1000) is.read(array1, 0, array1.length) is.reset() is.read(array2, 0, array2.length) is.reset() val s1 = new String(array1, 0, array1.length) val s2 = new String(array2, 0, array2.length) assert(s1.equals(s2), "Failed to mark correct position") } catch { case e: Exception => fail("Exception during mark test") } } test("markSupported") { val is = new BufInputStream(fileBuf) assert(is.markSupported(), "markSupported returned incorrect value") } test("read one") { val is = new BufInputStream(fileBuf) val c = is.read() is.reset() assert(c == fileString.charAt(0), "read returned incorrect char %s %s".format(c, fileString.charAt(0))) } test("read") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) is.skip(50) is.mark(100) is.read(array, 0, array.length) val s1 = new String(array, 0, array.length) val s2 = fileString.substring(50, 70) assert(s1.equals(s2), "Failed to read correct data.") } test("read into null array") { val is = new BufInputStream(fileBuf) intercept[NullPointerException] { is.read(null, 0, 1) fail("NullPointerException expected.") } } test("read into offset < 0") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IndexOutOfBoundsException] { is.read(array , -1, 1) fail("IndexOutOfBoundsException expected.") } } test("read negative len bytes") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IllegalArgumentException] { is.read(array , 1, -1) fail("IllegalArgumentException expected.") } } test("read beyond end of array") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IndexOutOfBoundsException] { is.read(array, 1, array.length) fail("IndexOutOfBoundsException expected.") } intercept[IndexOutOfBoundsException] { is.read(array, array.length, array.length) fail("IndexOutOfBoundsException expected.") } } test("reset") { val is = new BufInputStream(fileBuf) // Test for method void java.io.ByteArrayInputStream.reset() val array1 = new Array[Byte](10) val array2 = new Array[Byte](10) is.mark(200) is.read(array1, 0, 10) is.reset() is.read(array2, 0, 10) is.reset() val s1 = new String(array1, 0, array1.length) val s2 = new String(array2, 0, array2.length) assert(s1.equals(s2), "Reset failed") } test("skip") { val is = new BufInputStream(fileBuf) val array1 = new Array[Byte](10) is.skip(100) is.read(array1, 0, array1.length) val s1 = new String(array1, 0, array1.length) val s2 = fileString.substring(100, 110) assert(s1.equals(s2), "Failed to skip to correct position") } test("read len=0 from non-empty stream should return 0") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](1) assert(is.read(array, 0, 0) == 0) } test("read len >= 0 from exhausted stream should return -1") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](10000) val c = is.read(array, 0, array.length) assert(c == fileBuf.length, "Stream should have been exhausted") assert(is.read(array, c, 0) == -1, "Stream should have repored exhaustion") assert(is.read(array, c, array.length - c) == -1, "Stream should have repored exhaustion") } }
Java
package fr.jmini.asciidoctorj.testcases; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.OptionsBuilder; import org.asciidoctor.ast.Block; import org.asciidoctor.ast.Document; import org.asciidoctor.ast.Title; public class ShowTitleTrueTestCase implements AdocTestCase { public static final String ASCIIDOC = "" + "= My page\n" + "\n" + "Some text\n" + ""; @Override public String getAdocInput() { return ASCIIDOC; } @Override public Map<String, Object> getInputOptions() { AttributesBuilder attributesBuilder = AttributesBuilder.attributes() .showTitle(true); return OptionsBuilder.options() .attributes(attributesBuilder) .asMap(); } // tag::expected-html[] public static final String EXPECTED_HTML = "" + "<h1>My page</h1>\n" + "<div class=\"paragraph\">\n" + "<p>Some text</p>\n" + "</div>"; // end::expected-html[] @Override public String getHtmlOutput() { return EXPECTED_HTML; } @Override // tag::assert-code[] public void checkAst(Document astDocument) { Document document1 = astDocument; assertThat(document1.getId()).isNull(); assertThat(document1.getNodeName()).isEqualTo("document"); assertThat(document1.getParent()).isNull(); assertThat(document1.getContext()).isEqualTo("document"); assertThat(document1.getDocument()).isSameAs(document1); assertThat(document1.isInline()).isFalse(); assertThat(document1.isBlock()).isTrue(); assertThat(document1.getAttributes()).containsEntry("doctitle", "My page") .containsEntry("doctype", "article") .containsEntry("example-caption", "Example") .containsEntry("figure-caption", "Figure") .containsEntry("filetype", "html") .containsEntry("notitle", "") .containsEntry("prewrap", "") .containsEntry("showtitle", true) .containsEntry("table-caption", "Table"); assertThat(document1.getRoles()).isNullOrEmpty(); assertThat(document1.isReftext()).isFalse(); assertThat(document1.getReftext()).isNull(); assertThat(document1.getCaption()).isNull(); assertThat(document1.getTitle()).isNull(); assertThat(document1.getStyle()).isNull(); assertThat(document1.getLevel()).isEqualTo(0); assertThat(document1.getContentModel()).isEqualTo("compound"); assertThat(document1.getSourceLocation()).isNull(); assertThat(document1.getSubstitutions()).isNullOrEmpty(); assertThat(document1.getBlocks()).hasSize(1); Block block1 = (Block) document1.getBlocks() .get(0); assertThat(block1.getId()).isNull(); assertThat(block1.getNodeName()).isEqualTo("paragraph"); assertThat(block1.getParent()).isSameAs(document1); assertThat(block1.getContext()).isEqualTo("paragraph"); assertThat(block1.getDocument()).isSameAs(document1); assertThat(block1.isInline()).isFalse(); assertThat(block1.isBlock()).isTrue(); assertThat(block1.getAttributes()).isNullOrEmpty(); assertThat(block1.getRoles()).isNullOrEmpty(); assertThat(block1.isReftext()).isFalse(); assertThat(block1.getReftext()).isNull(); assertThat(block1.getCaption()).isNull(); assertThat(block1.getTitle()).isNull(); assertThat(block1.getStyle()).isNull(); assertThat(block1.getLevel()).isEqualTo(0); assertThat(block1.getContentModel()).isEqualTo("simple"); assertThat(block1.getSourceLocation()).isNull(); assertThat(block1.getSubstitutions()).containsExactly("specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"); assertThat(block1.getBlocks()).isNullOrEmpty(); assertThat(block1.getLines()).containsExactly("Some text"); assertThat(block1.getSource()).isEqualTo("Some text"); Title title1 = document1.getStructuredDoctitle(); assertThat(title1.getMain()).isEqualTo("My page"); assertThat(title1.getSubtitle()).isNull(); assertThat(title1.getCombined()).isEqualTo("My page"); assertThat(title1.isSanitized()).isFalse(); assertThat(document1.getDoctitle()).isEqualTo("My page"); assertThat(document1.getOptions()).containsEntry("header_footer", false); } // end::assert-code[] @Override // tag::mock-code[] public Document createMock() { Document mockDocument1 = mock(Document.class); when(mockDocument1.getId()).thenReturn(null); when(mockDocument1.getNodeName()).thenReturn("document"); when(mockDocument1.getParent()).thenReturn(null); when(mockDocument1.getContext()).thenReturn("document"); when(mockDocument1.getDocument()).thenReturn(mockDocument1); when(mockDocument1.isInline()).thenReturn(false); when(mockDocument1.isBlock()).thenReturn(true); Map<String, Object> map1 = new HashMap<>(); map1.put("doctitle", "My page"); map1.put("doctype", "article"); map1.put("example-caption", "Example"); map1.put("figure-caption", "Figure"); map1.put("filetype", "html"); map1.put("notitle", ""); map1.put("prewrap", ""); map1.put("showtitle", true); map1.put("table-caption", "Table"); when(mockDocument1.getAttributes()).thenReturn(map1); when(mockDocument1.getRoles()).thenReturn(Collections.emptyList()); when(mockDocument1.isReftext()).thenReturn(false); when(mockDocument1.getReftext()).thenReturn(null); when(mockDocument1.getCaption()).thenReturn(null); when(mockDocument1.getTitle()).thenReturn(null); when(mockDocument1.getStyle()).thenReturn(null); when(mockDocument1.getLevel()).thenReturn(0); when(mockDocument1.getContentModel()).thenReturn("compound"); when(mockDocument1.getSourceLocation()).thenReturn(null); when(mockDocument1.getSubstitutions()).thenReturn(Collections.emptyList()); Block mockBlock1 = mock(Block.class); when(mockBlock1.getId()).thenReturn(null); when(mockBlock1.getNodeName()).thenReturn("paragraph"); when(mockBlock1.getParent()).thenReturn(mockDocument1); when(mockBlock1.getContext()).thenReturn("paragraph"); when(mockBlock1.getDocument()).thenReturn(mockDocument1); when(mockBlock1.isInline()).thenReturn(false); when(mockBlock1.isBlock()).thenReturn(true); when(mockBlock1.getAttributes()).thenReturn(Collections.emptyMap()); when(mockBlock1.getRoles()).thenReturn(Collections.emptyList()); when(mockBlock1.isReftext()).thenReturn(false); when(mockBlock1.getReftext()).thenReturn(null); when(mockBlock1.getCaption()).thenReturn(null); when(mockBlock1.getTitle()).thenReturn(null); when(mockBlock1.getStyle()).thenReturn(null); when(mockBlock1.getLevel()).thenReturn(0); when(mockBlock1.getContentModel()).thenReturn("simple"); when(mockBlock1.getSourceLocation()).thenReturn(null); when(mockBlock1.getSubstitutions()).thenReturn(Arrays.asList("specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements")); when(mockBlock1.getBlocks()).thenReturn(Collections.emptyList()); when(mockBlock1.getLines()).thenReturn(Collections.singletonList("Some text")); when(mockBlock1.getSource()).thenReturn("Some text"); when(mockDocument1.getBlocks()).thenReturn(Collections.singletonList(mockBlock1)); Title mockTitle1 = mock(Title.class); when(mockTitle1.getMain()).thenReturn("My page"); when(mockTitle1.getSubtitle()).thenReturn(null); when(mockTitle1.getCombined()).thenReturn("My page"); when(mockTitle1.isSanitized()).thenReturn(false); when(mockDocument1.getStructuredDoctitle()).thenReturn(mockTitle1); when(mockDocument1.getDoctitle()).thenReturn("My page"); Map<Object, Object> map2 = new HashMap<>(); map2.put("attributes", "{\"showtitle\"=>true}"); map2.put("header_footer", false); when(mockDocument1.getOptions()).thenReturn(map2); return mockDocument1; } // end::mock-code[] }
Java
package fr.sii.ogham.sms.message; import fr.sii.ogham.core.util.EqualsBuilder; import fr.sii.ogham.core.util.HashCodeBuilder; /** * Represents a phone number. It wraps a simple string. The aim is to abstracts * the concept and to be able to provide other fields latter if needed. * * @author Aurélien Baudet * */ public class PhoneNumber { /** * The phone number as string */ private String number; /** * Initialize the phone number with the provided number. * * @param number * the phone number */ public PhoneNumber(String number) { super(); this.number = number; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } @Override public String toString() { return number; } @Override public int hashCode() { return new HashCodeBuilder().append(number).hashCode(); } @Override public boolean equals(Object obj) { return new EqualsBuilder(this, obj).appendFields("number").isEqual(); } }
Java
# Vagrant Kafka Lab ------ **Prerequistes:** Vagrant (2.0.1), Virtual Box (5.2.0) and Ansible (2.4.1.0) ## Web UIs - Grafana: [http://kafka-1:3000](http://kafka-1:3000) - Prometheus-UI: [http://kafka-1:9090](http://kafka-1:9090) ## Installation ```bash git clone https://github.com/ineedcode/vagrant-kafka-lab cd vagrant-kafka-lab vagrant plugin install vagrant-hostmanager vagrant up ``` ##### Grafana Konfiguration access to Grafana and use the default credentials with `admin:admin`. Add Dashboard with Prometheus as source, the source is available at `localhost:9000. Upload the Kafka Dashboard which is included in the doc folder: [Grafana-Kafka-Dashboard](doc/Grafana-Kafka-Dashboard-v1.json) ## Components In the following you'll find list of components that has been used and with some general settings. | IP | Hostname | Description | Settings | |--------------|----------|-------------------------------------|----------| | 192.168.10.2 | kafka-1 | ZK, Kafka Broker, Prometheus | 2GB RAM | | 192.168.10.3 | kafka-2 | ZK, Kafka Broker | 1GB RAM | | 192.168.10.4 | kafka-3 | ZK, Kafka Broker | 1GB RAM | # Ansible ```bash ansible all -i ansible/inventories/vbox/hosts -m ping -o ansible-playbook ansible/cluster.yml --tags "new-kafka-config" ``` ## Usage ##### Use pre build commands to interact with Kafka The `script` folder has been added to the PATH therefore you can use the shell scripts from your cli of the virtual machines. ```bash vagrant ssh kafka-1 list-topics.sh #lists all topics ``` ### Versions Following versions are used in this lab - Kafka is using 0.11.0.2 ([change it here](ansible/roles/kafka/defaults/main.yml)) - Zookeeper is using 3.4.10 ([change it here](ansible/roles/zookeeper/defaults/main.yml)) - Promeutheus is using 1.7.1 ([change it here](ansible/roles/promeutheus/defaults/main.yml)) - Grafana is using 4.3.2 ([change it here](ansible/roles/promeutheus/defaults/main.yml))
Java
package org.fastnate.generator.converter; import java.time.Duration; import org.fastnate.generator.context.GeneratorContext; import org.fastnate.generator.statements.ColumnExpression; import org.fastnate.generator.statements.PrimitiveColumnExpression; /** * Converts a {@link Duration} to an SQL expression. * * @author Tobias Liefke */ public class DurationConverter implements ValueConverter<Duration> { @Override public ColumnExpression getExpression(final Duration value, final GeneratorContext context) { return PrimitiveColumnExpression.create(value.toNanos(), context.getDialect()); } @Override public ColumnExpression getExpression(final String defaultValue, final GeneratorContext context) { return getExpression(Duration.parse(defaultValue), context); } }
Java
module AssemblyAndServiceOperationsMixin # Commands used from new dtk client def check_if_instance_running(node_address, port, path) endpoint = node_address + ":" + port response = request_response(path, {}, 'get', endpoint); response.code == 200 end def get_node_by_name(service_instance_name, node_name) nodes_response = send_request("/rest/api/v1/services/#{service_instance_name}/nodes", {}, 'get') nodes = nodes_response['data'] if nodes.empty? puts "No nodes found"; return false end selected_node_arr = nodes.select { |node| node['display_name'] == node_name } if nodes if selected_node_arr.empty? || selected_node_arr.length > 1 puts "Expected only one node, but found: #{selected_node_arr}" return false end node = selected_node_arr.first puts "Found requested node: #{node}" node end def verify_service_instance_nodes_terminated(service_instance_name) require 'aws-sdk-ec2' puts "Verify service instance nodes have been terminated", "-----------------------------------------------------" nodes_terminated = true ec2 = Aws::EC2::Client.new(region: 'us-east-1') ec2_instance = ec2.describe_instances(filters:[{ name: 'tag:Name', values: ["*" + service_instance_name + "*"] }]) ec2_instance.reservations.each do |status| puts "Instance details: #{status}" if status.instances.first.state.name == "running" nodes_terminated = false puts "Service instance: #{service_instance_name} nodes have not been terminated" end end puts "" puts "Service instance: #{service_instance_name} nodes have been terminated" if nodes_terminated nodes_terminated end def check_if_service_instance_exists(service_instance_name) puts "Check if service instance exists", "-----------------------------------" service_instance_exists = false service_instances_list = send_request("/rest/api/v1/services/list", {}, 'get') ap service_instances_list if service_instances_list['status'] == 'ok' && !service_instances_list['data'].empty? service_instances_list['data'].each do |instance| if instance['display_name'] == service_instance_name puts "Service instance: #{service_instance_name} found!" service_instance_exists = true end end else puts "Service instance #{service_instance_name} is not found!" end puts "Service instance #{service_instance_name} is not found!" unless service_instance_exists puts "" service_instance_exists end def check_if_node_exists_in_service_instance(service_instance_name, node_name) puts "Check if node exists in service instance", "---------------------------------------" node_exists = false nodes_list = send_request("/rest/api/v1/services/#{service_instance_name}/nodes", {}, 'get') ap nodes_list if nodes_list['status'] == 'ok' && !nodes_list['data'].empty? nodes_list['data'].each do |node| if node['display_name'] == node_name puts "Node: #{node_name} found!" node_exists = true end end else puts "Node #{node_name} is not found in #{service_instance_name}" end puts "Node #{node_name} is not found in #{service_instance_name}" unless node_exists puts "" node_exists end def check_if_node_group_exists_in_service_instance(service_instance_name, node_group_name, cardinality) puts "Check if node group exists in service instance", "-------------------------------------------" node_group_exist = false nodes_list = send_request("/rest/api/v1/services/#{service_instance_name}/nodes", {}, 'get') ap nodes_list if nodes_list['status'] == 'ok' && !nodes_list['data'].empty? node_group_members = [] nodes_list['data'].each do |node| if node['display_name'].include? node_group_name + ":" # indicator it is node group member node_group_members << node['display_name'] end end if node_group_members.size == cardinality puts "Node group #{node_group_name} is found in #{service_instance_name}" node_group_exist = true end else puts "Node group #{node_group_name} is not found in #{service_instance_name}" end puts "Node group #{node_group_name} is not found in #{service_instance_name}" unless node_group_exist puts "" node_group_exist end def check_if_component_exists_in_service_instance(service_instance_name, component_name) puts "Check if component exists in service instance", "-----------------------------------------" component_exists = false components_list = send_request("/rest/api/v1/services/#{service_instance_name}/components", {}, 'get') ap components_list if components_list['status'] == 'ok' && !components_list['data'].empty? components_list['data'].each do |cmp| if cmp['display_name'] == component_name puts "Component: #{component_name} found!" component_exists = true end end else puts "Component #{component_name} is not found in #{service_instance_name}" end puts "Component #{component_name} is not found in #{service_instance_name}" unless component_exists puts "" component_exists end def check_if_action_exists_in_service_instance(service_instance_name, action_to_check) puts "Check if action exists in service instance", "------------------------------------------" action_exists = false list_of_actions = send_request("/rest/api/v1/services/#{service_instance_name}/actions", {}, 'get') ap list_of_actions if list_of_actions['status'] == 'ok' && !list_of_actions['data'].empty? list_of_actions['data'].each do |action| if action['display_name'] == action_to_check puts "Action: #{action_to_check} found!" action_exists = true end end else puts "Action #{action_to_check} is not found in #{service_instance_name}" end puts "Action #{action_to_check} is not found in #{service_instance_name}" unless action_exists puts "" action_exists end def check_if_attributes_exists_in_service_instance(service_instance_name, attributes_to_check) puts "Check if attributes exist and are correct in service instance", "---------------------------------------------------" attributes_exist = false attributes_list = send_request("/rest/api/v1/services/#{service_instance_name}/attributes?all&format=yaml", {}, 'get') puts "Attributes to check:" ap attributes_to_check puts "" puts "Attributes on service instance:" ap attributes_list puts "" if attributes_list['status'] == 'ok' && !attributes_list['data'].empty? attributes_exist_and_values_correct = [] attributes_list['data'].each do |attr| if (attributes_to_check.keys.include? attr['name']) && (attributes_to_check.values.include? attr['value']) attributes_exist_and_values_correct << true end end if (attributes_exist_and_values_correct.count == attributes_to_check.count) && (!attributes_exist_and_values_correct.include? false) puts "All attributes: #{attributes_to_check} are verified and exist on service instance" attributes_exist = true else puts "Some attributes are missing or they don't have expected values on service instance" end else puts "Attributes #{attributes_to_check} are not found in #{service_instance_name}" end puts "" attributes_exist end def check_task_status(service_instance_name) puts "Check task status", "----------------" service_converged = { pass: false, error: nil } end_loop = false count = 0 max_num_of_retries = 80 while (count < max_num_of_retries) sleep 10 count += 1 task_status_response = send_request("/rest/api/v1/services/#{service_instance_name}/task_status", {}, 'get') if task_status_response['status'] == 'ok' if task_status_response['data'].first['status'] == 'succeeded' puts "Service was converged successfully!" service_converged[:pass] = true break elsif task_status_response['data'].first['status'] == 'failed' puts 'Service was not converged successfully!' ap task_status_response['data'] service_converged[:error] = task_status_response['data'] break end else ap task_status_response['data'] service_converged[:error] = task_status_response['data'] puts "Service was not converged successfully!" break end end puts '' service_converged end def check_task_status_with_breakpoint(service_instance_name, subtask_name_with_breakpoint) puts "Check task status with breakpoint", "---------------------------------" debug_passed = false end_loop = false count = 0 max_num_of_retries = 30 while (count < max_num_of_retries) sleep 10 count += 1 task_status_response = send_request("/rest/api/v1/services/#{service_instance_name}/task_status", {}, 'get') ap task_status_response if task_status_response['status'] == 'ok' if task_status_response['data'].first['status'] == 'debugging' subtask = task_status_response['data'].select { |subtask| subtask['type'].include? subtask_name_with_breakpoint }.first debug_command = subtask['info']['message'].match(/(byebug -R.+)'/)[1] debug_execution = `echo c | #{debug_command}` puts debug_execution if debug_execution.include? "Connected" debug_passed = true break else debug_passed = false break end end else ap task_status_response['data'] puts "Service was not converged successfully! Debug cannot proceed" break end end puts '' debug_passed end def check_delete_task_status(service_instance_name) puts "Check delete task status", "------------------------" service_deleted = { pass: false, error: nil } end_loop = false count = 0 max_num_of_retries = 50 while (count < max_num_of_retries) sleep 10 count += 1 task_status_response = send_request("/rest/api/v1/services/#{service_instance_name}/task_status", {}, 'get') if task_status_response['status'] == 'ok' if task_status_response['data'].first['status'] == 'succeeded' puts "Service was deleted successfully!" service_deleted[:pass] = true break elsif task_status_response['data'].first['status'] == 'failed' puts 'Service was not deleted successfully!' ap task_status_response['data'] service_deleted[:error] = task_status_response['data'] break end else ap task_status_response if task_status_response['errors'].first['message'] == "No context with the name '#{service_instance_name}' exists" puts "Service was deleted successfully!" service_deleted[:pass] = true else puts "Service was not deleted successfully!" service_deleted[:error] = task_status_response['data'] end break end end puts '' service_deleted end def stage_service_instance(service_instance_name, context = nil) #Get list of assemblies, extract selected assembly, stage service and return its id puts "Stage service:", "--------------" service_id = nil extract_id_regex = /id: (\d+)/ assembly_list = send_request('/rest/assembly/list', {:subtype=>'template'}) puts "List of avaliable assemblies: " pretty_print_JSON(assembly_list) test_template = assembly_list['data'].select { |x| x['display_name'] == @assembly }.first if (!test_template.nil?) puts "Assembly #{@assembly} found!" assembly_id = test_template['id'] puts "Assembly id: #{assembly_id}" if @is_context stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name, :service_module_name => service_instance_name, :is_context => @is_context}) else unless context stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name, :service_module_name => service_instance_name}) else stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name, :service_module_name => service_instance_name, :context_id=>context}) end end pretty_print_JSON(stage_service_response) if (stage_service_response['data'].include? "name: #{@service_name}") puts "Stage of #{@service_name} assembly completed successfully!" service_id_match = stage_service_response['data'].match(extract_id_regex) self.service_id = service_id_match[1].to_i puts "Service id for a staged service: #{self.service_id}" else puts "Stage service didnt pass!" end else puts "Assembly #{@service_name} not found!" end puts "" end # Commands used from old dtk client def stage_service(context = nil) #Get list of assemblies, extract selected assembly, stage service and return its id puts "Stage service:", "--------------" service_id = nil extract_id_regex = /id: (\d+)/ assembly_list = send_request('/rest/assembly/list', {:subtype=>'template'}) puts "List of avaliable assemblies: " pretty_print_JSON(assembly_list) test_template = assembly_list['data'].select { |x| x['display_name'] == @assembly }.first if (!test_template.nil?) puts "Assembly #{@assembly} found!" assembly_id = test_template['id'] puts "Assembly id: #{assembly_id}" if @is_context stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name, :is_context => @is_context}) else unless context stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name}) else stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name, :context_id=>context}) end end pretty_print_JSON(stage_service_response) if (stage_service_response['data'].include? "name: #{@service_name}") puts "Stage of #{@service_name} assembly completed successfully!" service_id_match = stage_service_response['data'].match(extract_id_regex) self.service_id = service_id_match[1].to_i puts "Service id for a staged service: #{self.service_id}" else puts "Stage service didnt pass!" end else puts "Assembly #{@service_name} not found!" end puts "" end def get_components_versions(service_id) puts "Get all component versions from service:", "-----------------------------" components_list = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :node_id => nil, :component_id => nil, :subtype=>'instance', :about=>'components'}) components_list = components_list['data'].map! { |c| c['version'] } puts "" return components_list end def get_default_context_service puts "Get default context service instance id:", "---------------------------------------" service_id = nil default_context_service_response = send_request('/rest/assembly/get_default_context', {}) if default_context_service_response['status'] == 'ok' puts "Default context service instance succesfully found." service_id = default_context_service_response['data']['id'] else puts "Default context service was not succesfully found." end puts '' service_id end def stage_service_with_namespace(namespace) #Get list of assemblies, extract selected assembly, stage service and return its id puts "Stage service:", "--------------" service_id = nil extract_id_regex = /id: (\d+)/ assembly_list = send_request('/rest/assembly/list', {:subtype=>'template'}) puts "List of avaliable assemblies: " pretty_print_JSON(assembly_list) test_template = assembly_list['data'].select { |x| x['display_name'] == @assembly && x['namespace'] == namespace }.first if (!test_template.nil?) puts "Assembly #{@assembly} from namespace #{namespace} found!" assembly_id = test_template['id'] puts "Assembly id: #{assembly_id}" stage_service_response = send_request('/rest/assembly/stage', {:assembly_id=>assembly_id, :name=>@service_name}) pretty_print_JSON(stage_service_response) if (stage_service_response['data'].include? "name: #{@service_name}") puts "Stage of #{@service_name} assembly completed successfully!" service_id_match = stage_service_response['data'].match(extract_id_regex) self.service_id = service_id_match[1].to_i puts "Service id for a staged service: #{self.service_id}" else puts "Stage service didnt pass!" end else puts "Assembly #{@service_name} not found!" end puts "" end def check_service_info(service_id, info_to_check) puts "Show service info:", "------------------" info_exist = false service_info_response = send_request('/rest/assembly/info', {:assembly_id=>service_id, :subtype=>:instance}) pretty_print_JSON(service_info_response) if service_info_response['data'].include? info_to_check puts "#{info_to_check} exists in info output!" info_exist = true else puts "#{info_to_check} does not exist in info output!" end puts "" return info_exist end def rename_service(service_id, new_service_name) puts "Rename service:", "---------------" service_renamed = false service_list = send_request('/rest/assembly/list', {:detail_level=>'nodes', :subtype=>'instance'}) service_name = service_list['data'].select { |x| x['id'] == service_id } if service_name.any? puts "Old service name is: #{service_name}. Proceed with renaming it to #{new_service_name}..." rename_status = send_request('/rest/assembly/rename', {:assembly_id=>service_id, :assembly_name=>service_name, :new_assembly_name=>new_service_name}) if rename_status['status'] == 'ok' puts "Service #{service_name} renamed to #{new_service_name} successfully!" service_renamed = true else puts "Service #{service_name} was not renamed to #{new_service_name} successfully!" end else puts "Service with id #{service_id} does not exist!" end puts "" return service_renamed end def create_attribute(service_id, attribute_name) #Create attribute puts "Create attribute:", "-----------------" attributes_created = false create_attribute_response = send_request('/rest/assembly/set_attributes', {:assembly_id=>service_id, :create=>true, :pattern=>attribute_name}) puts "List of service attributes:" service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) pretty_print_JSON(service_attributes) extract_attribute = service_attributes['data'].select { |x| x['display_name'].include? attribute_name }.first['display_name'] if (extract_attribute == attribute_name) puts "Creating #{attribute_name} attribute completed successfully!" attributes_created = true end puts "" return attributes_created end def check_if_attribute_exists(service_id, attribute_name) puts "Check if attribute exists:", "--------------------------" attribute_exists = false puts "List of service attributes:" service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) pretty_print_JSON(service_attributes) extract_attribute = service_attributes['data'].select { |x| x['display_name'].include? attribute_name }.first['display_name'] if (extract_attribute == attribute_name) puts "#{attribute_name} attribute exists!" attribute_exists = true else puts "#{attribute_name} attribute does not exist!" end puts "" return attribute_exists end def link_attributes(service_id, source_attribute, context_attribute) puts "Link attributes:", "----------------" attributes_linked = false link_attributes_response = send_request('/rest/assembly/add_ad_hoc_attribute_links', {:assembly_id=>service_id, :context_attribute_term=>context_attribute, :source_attribute_term=>"$#{source_attribute}"}) pretty_print_JSON(link_attributes_response) if link_attributes_response['status'] == 'ok' puts "Link between #{source_attribute} attribute and #{context_attribute} attribute is established!" attributes_linked = true else puts "Link between #{source_attribute} attribute and #{context_attribute} attribute is not established!" end puts "" return attributes_linked end def get_service_id_by_name(service_name) puts "Get service instance id by its name", "-----------------------------------" service_list = send_request('/rest/assembly/list', {:detail_level=>'nodes', :subtype=>'instance'}) puts "List of all services and its content:" service_instance = nil filtered_services = service_list['data'].select { |x| x['display_name'] == service_name } if filtered_services.length == 1 puts "Service instance with name #{service_name} exists: " pretty_print_JSON(filtered_services) service_instance = filtered_services[0] elsif filtered_services.length.zero? puts "Service instance with name #{service_name} does not exist." else puts "Multiple service instances with name #{service_name} exist." end end def check_if_service_exists(service_id) #Get list of existing services and check if staged service exists puts "Check if service exists:", "------------------------" service_exists = false service_list = send_request('/rest/assembly/list', {:detail_level=>'nodes', :subtype=>'instance'}) puts "List of all services and its content:" pretty_print_JSON(service_list) test_service = service_list['data'].select { |x| x['id'] == service_id } puts "Service with id #{service_id}: " pretty_print_JSON(test_service) if (test_service.any?) extract_service_id = test_service.first['id'] execution_status = test_service.first['execution_status'] if ((extract_service_id == service_id) && (execution_status == 'staged')) puts "Service with id #{service_id} exists!" service_exists = true end else puts "Service with id #{service_id} does not exist!" end puts "" return service_exists end def list_specific_success_service(service_name) puts "List success services:", "------------------------" service_list = send_request('/rest/assembly/list', {:subtype=>'instance', :detail_level => 'nodes'}) success_services = service_list['data'].select { |x| x['display_name'] == service_name && x['execution_status'] == 'succeeded' } pretty_print_JSON(success_services) return success_services end def list_matched_success_service(service_name) puts "List success services:", "------------------------" service_list = send_request('/rest/assembly/list', {:subtype=>'instance', :detail_level => 'nodes'}) success_services = service_list['data'].select { |x| (x['display_name'].include? service_name) && (x['execution_status'] == 'succeeded') } pretty_print_JSON(success_services) return success_services end def list_specific_failed_service(service_name) puts "List failed services:", "-------------------------" service_list = send_request('/rest/assembly/list', {:subtype=>'instance', :detail_level => 'nodes'}) failed_services = service_list['data'].select { |x| x['display_name'] == service_name && x['execution_status'] == 'failed' } pretty_print_JSON(failed_services) return failed_services end def list_matched_failed_service(service_name) puts "List failed services:", "-------------------------" service_list = send_request('/rest/assembly/list', {:subtype=>'instance', :detail_level => 'nodes'}) failed_services = service_list['data'].select { |x| (x['display_name'].include? service_name) && (x['execution_status'] == 'failed') } pretty_print_JSON(failed_services) return failed_services end def check_service_status(service_id, status_to_check) #Get list of services and check if service exists and its status puts "Check service status:", "---------------------" service_exists = false end_loop = false count = 0 max_num_of_retries = 50 while (end_loop == false) sleep 5 count += 1 service_list = send_request('/rest/assembly/list', {:subtype=>'instance'}) service = service_list['data'].select { |x| x['id'] == service_id }.first if (!service.nil?) test_service = send_request('/rest/assembly/info', {:assembly_id=>service_id,:subtype=>:instance}) op_status = test_service['data']['op_status'] extract_service_id = service['id'] if ((extract_service_id == service_id) && (op_status == status_to_check)) puts "Service with id #{extract_service_id} has current op status: #{status_to_check}" service_exists = true end_loop = true else puts "Service with id #{extract_service_id} still does not have current op status: #{status_to_check}" end else puts "Service with id #{service_id} not found in list" end_loop = true end if (count > max_num_of_retries) puts "Max number of retries reached..." end_loop = true end end puts "" return service_exists end def set_attribute(service_id, attribute_name, attribute_value) #Set attribute on particular service puts "Set attribute:", "--------------" is_attributes_set = false service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) attribute_id = service_attributes['data'].select { |x| x['display_name'].include? attribute_name } if attribute_id.empty? set_attribute_value_response = send_request('/rest/assembly/set_attributes', {:assembly_id=>service_id, :value=>attribute_value, :pattern=>attribute_name}) if set_attribute_value_response['status'] == 'ok' puts "Setting of attribute #{attribute_name} completed successfully!" is_attributes_set = true end else set_attribute_value_response = send_request('/rest/assembly/set_attributes', {:assembly_id=>service_id, :value=>attribute_value, :pattern=>attribute_id.first['id']}) service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) extract_attribute_value = service_attributes['data'].select { |x| x['value'] == attribute_value }.first['value'] if extract_attribute_value != nil puts "Setting of attribute #{attribute_name} completed successfully!" is_attributes_set = true end end puts "" return is_attributes_set end def set_attribute_on_service_level_component(service_id, attribute_name, attribute_value) #Set attribute on particular service puts "Set attribute:", "--------------" is_attributes_set = false #Get attribute id for which value will be set service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) attribute_id = service_attributes['data'].select { |x| x['display_name'].include? attribute_name }.first['id'] #Set attribute value for given attribute id set_attribute_value_response = send_request('/rest/assembly/set_attributes', {:assembly_id=>service_id, :value=>attribute_value, :pattern=>attribute_id}) service_attributes = send_request('/rest/assembly/info_about', {:about=>'attributes', :filter=>nil, :subtype=>'instance', :assembly_id=>service_id}) extract_attribute_value = attribute_id = service_attributes['data'].select { |x| x['display_name'].include? attribute_name }.first['value'] if extract_attribute_value == attribute_value puts "Setting of attribute #{attribute_name} completed successfully!" is_attributes_set = true end puts "" return is_attributes_set end def get_attribute_value(service_id, node_name, component_name, attribute_name) puts "Get attribute value by name:", "----------------------------" puts "List of service attributes:" service_attributes = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :filter=>nil, :about=>'attributes', :subtype=>'instance'}) pretty_print_JSON(service_attributes) attributes = service_attributes['data'].select { |x| x['display_name'] == "#{node_name}/#{component_name}/#{attribute_name}" }.first if !attributes.nil? attribute_value = service_attributes['data'].select { |x| x['display_name'] == "#{node_name}/#{component_name}/#{attribute_name}" }.first['value'] puts "Attribute value is: #{attribute_value}" else puts "Some of the input parameters is incorrect or missing. Node name: #{node_name}, Component name: #{component_name}, Attribute name: #{attribute_name}" end puts "" return attribute_value end # new client def check_component_depedency(service_instance_name, source_component, dependency_component, type) puts "Check component dependency:", "---------------------------" dependency_found = false puts "List service components with dependencies:" components_list = send_request("/rest/api/v1/services/#{service_instance_name}/component_links", {}, 'get') component = components_list['data'].select { |x| x['base_component'] == source_component} if (!component.nil?) puts "Component #{source_component} exists. Check its dependencies..." component.each do |deps| if (deps['dependent_component'] == dependency_component) && (deps['type'] == type) dependency_found = true puts "Component #{source_component} has expected dependency component #{dependency_component} with type #{type}" else puts "Component #{source_component} does not have expected dependency component #{dependency_component} with type #{type}" end end else puts "Component #{source_component} does not exist and therefore it does not have any dependencies" end puts "" return dependency_found end def converge_service(service_id, max_num_of_retries=15) puts "Converge service:", "-----------------" service_converged = false puts "Converge process for service with id #{service_id} started!" find_violations = send_request('/rest/assembly/find_violations', {'assembly_id' => service_id}) create_task_response = send_request('/rest/assembly/create_task', {'assembly_id' => service_id}) if (@error_message == "") task_id = create_task_response['data']['task_id'] puts "Task id: #{task_id}" task_execute_response = send_request('/rest/task/execute', {'task_id' => task_id}) end_loop = false count = 0 task_status = 'executing' while ((task_status.include? 'executing') && (end_loop == false)) sleep 20 count += 1 response_task_status = send_request('/rest/assembly/task_status', {'assembly_id'=> service_id}) status = response_task_status['data'].first['status'] unless status.nil? if (status.include? 'succeeded') service_converged = true puts "Task execution status: #{status}" puts "Converge process finished successfully!" end_loop = true elsif (status.include? 'failed') puts "Error details on subtasks:" ap response_task_status['data'] response_task_status['data'].each do |error_message| unless error_message['errors'].nil? puts error_message['errors']['message'] puts error_message['errors']['type'] end end puts "Task execution status: #{status}" puts "Converge process was not finished successfully! Some tasks failed!" end_loop = true end puts "Task execution status: #{status}" end if (count > max_num_of_retries) puts "Max number of retries reached..." puts "Converge process was not finished successfully!" end_loop = true end end else puts "Service was not converged successfully!" end puts "" return service_converged end def stop_running_service(service_id) puts "Stop running service:", "---------------------" service_stopped = false stop_service_response = send_request('/rest/assembly/stop', {:assembly_id => service_id}) if (stop_service_response['status'] == "ok") puts "Service stopped successfully!" service_stopped = true else puts "Service was not stopped successfully!" end puts "" return service_stopped end def create_assembly_from_service(service_id, service_module_name, assembly_name, namespace=nil) puts "Create assembly from service:", "-----------------------------" assembly_created = false create_assembly_response = send_request('/rest/assembly/promote_to_template', {:service_module_name=>service_module_name, :mode=>:create, :assembly_id=>service_id, :assembly_template_name=>assembly_name, :namespace=>namespace}) if (create_assembly_response['status'] == 'ok') puts "Assembly #{assembly_name} created in service module #{service_module_name}" assembly_created = true else puts "Assembly #{assembly_name} was not created in service module #{service_module_name}" end puts "" return assembly_created end def netstats_check(service_id, port) puts "Netstats check:", "---------------" netstats_check = false end_loop = false count = 0 max_num_of_retries = 15 while (end_loop == false) sleep 10 count += 1 if (count > max_num_of_retries) puts "Max number of retries for getting netstats reached..." end_loop = true end response = send_request('/rest/assembly/initiate_get_netstats', {:node_id=>nil, :assembly_id=>service_id}) pretty_print_JSON(response) action_results_id = response['data']['action_results_id'] 5.downto(1) do |i| sleep 1 response = send_request('/rest/assembly/get_action_results', {:disable_post_processing=>false, :return_only_if_complete=>true, :action_results_id=>action_results_id, :sort_key=>"port"}) puts "Netstats check:" pretty_print_JSON(response) if response['data']['is_complete'] port_to_check = response['data']['results'].select { |x| x['port'] == port}.first if (!port_to_check.nil?) puts "Netstats check completed! Port #{port} available!" netstats_check = true end_loop = true break else puts "Netstats check completed! Port #{port} is not available!" netstats_check = false break end end end end puts "" return netstats_check end def start_running_service(service_id) puts "Start service:", "--------------" service_started = false response = send_request('/rest/assembly/start', {:assembly_id => service_id, :node_pattern=>nil}) pretty_print_JSON(response) task_id = response['data']['task_id'] response = send_request('/rest/task/execute', {:task_id=>task_id}) if (response['status'] == 'ok') end_loop = false count = 0 max_num_of_retries = 30 while (end_loop == false) sleep 10 count += 1 response = send_request('/rest/assembly/info_about', {:assembly_id => service_id, :subtype => 'instance', :about => 'tasks'}) puts "Start instance check:" status = response['data'].select { |x| x['status'] == 'executing'}.first pretty_print_JSON(status) if (count > max_num_of_retries) puts "Max number of retries for starting instance reached..." end_loop = true elsif (status.nil?) puts "Instance started!" service_started = true end_loop = true end end else puts "Start instance is not completed successfully!" end puts "" return service_started end def add_component_by_name_to_service_node(service_id, node_name, component_name) puts "Add component to service:", "--------------------------" component_added = false service_nodes = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :filter=>nil, :about=>'nodes', :subtype=>'instance'}) if (service_nodes['data'].select { |x| x['display_name'] == node_name }.first) puts "Node #{node_name} exists in service. Get node id..." node_id = service_nodes['data'].select { |x| x['display_name'] == node_name }.first['id'] component_add_response = send_request('/rest/assembly/add_component', {:node_id=>node_id, :component_template_id=>component_name.split(":").last, :assembly_id=>service_id, :namespace=>component_name.split(":").first}) if (component_add_response['status'] == 'ok') puts "Component #{component_name} added to service!" component_added = true end else component_add_response = send_request('/rest/assembly/add_component', {:node_id=>nil, :component_template_id=>component_name.split(":").last, :assembly_id=>service_id, :namespace=>component_name.split(":").first}) if (component_add_response['status'] == 'ok') puts "Component #{component_name} added to service!" component_added = true end end puts "" return component_added end def delete_and_destroy_service(service_id) puts "Delete and destroy service:", "---------------------------" service_deleted = false delete_service_response = send_request('/rest/assembly/delete', {:assembly_id=>service_id}) if (delete_service_response['status'] == "ok") puts "Service deleted successfully!" service_deleted = true else puts "Service was not deleted successfully!" end puts "" return service_deleted end def delete_task_status(service_id, component_to_delete, delete_type, check_component_in_task_status=true) service_deleted = false end_loop = false count = 0 max_num_of_retries = 50 task_status = 'executing' while ((task_status.include? 'executing') && (end_loop == false)) sleep 2 count += 1 response_task_status = send_request('/rest/assembly/task_status', {'assembly_id'=> service_id}) delete_status = response_task_status['data'].first['status'] if !delete_status.nil? if check_component_in_task_status component_delete_status = response_task_status['data'].select { |x| x['type'].include? component_to_delete }.first['status'] else # case when performing delete action on staged service component_delete_status = 'succeeded' end if (delete_status.include? "succeeded") && (component_delete_status.include? "succeeded") service_deleted = true task_status = delete_status puts "Task execution status: #{delete_status}" puts "#{delete_type} finished successfully!" end_loop = true end if (delete_status.include? 'failed') puts "Error details:" ap response_task_status['data'] response_task_status['data'].each do |error_message| unless error_message['errors'].nil? puts error_message['errors']['message'] puts error_message['errors']['type'] end end puts "Task execution status: #{delete_status}" puts "#{delete_type} with workflow did not finish successfully!" task_status = delete_status end_loop = true end puts "Task execution status: #{delete_status}" else if delete_type == 'delete_service' # This is set to true only in case when we delete service instance # Reason: we cannot get task status details on instance that does not exist anymore service_deleted = true break end end if (count > max_num_of_retries) puts "Max number of retries reached..." puts "#{delete_type} with workflow did not finish successfully!" break end end service_deleted end def delete_service_with_workflow(service_id, component_to_delete, check_component_in_task_status) puts "Delete and destroy service with workflow:", "-----------------------------------------" service_deleted_successfully = false delete_service_response = send_request('/rest/assembly/delete_using_workflow', {:assembly_id=>service_id, :subtype => :instance}) if delete_service_response['status'] == 'ok' service_deleted_successfully = delete_task_status(service_id, component_to_delete, 'delete_service', check_component_in_task_status) puts "Service was deleted successfully!" else puts "Service was not deleted successfully!" end puts "" return service_deleted_successfully end def delete_node_with_workflow(service_id, node_name, component_to_delete, check_component_in_task_status) puts "Delete node with workflow:", "----------------------------------" node_deleted_successfully = false delete_node_response = send_request('/rest/assembly/delete_node_using_workflow', {:assembly_id=>service_id, :subtype => :instance, :node_id => node_name}) if delete_node_response['status'] == 'ok' node_deleted_successfully = delete_task_status(service_id, component_to_delete, 'delete_node', check_component_in_task_status) puts "Node: #{node_name} was deleted successfully!" else puts "Node: #{node_name} was not deleted successfully!" end puts "" return node_deleted_successfully end def delete_component_with_workflow(service_id, node_name, component_to_delete, check_component_in_task_status) puts "Delete component with workflow:", "---------------------------------------" component_deleted_successfully = false delete_component_response = send_request('/rest/assembly/delete_component_using_workflow', {:assembly_id=>service_id, :task_action => "#{component_to_delete}.delete", :task_params => { "node" => node_name }, :component_id => component_to_delete, :noop_if_no_action => nil, :cmp_full_name => "#{node_name}/#{component_to_delete}", :node_id => node_name }) if delete_component_response['status'] == 'ok' component_deleted_successfully = delete_task_status(service_id, component_to_delete, 'delete_component', check_component_in_task_status) puts "Component: #{component_to_delete} was deleted successfully!" else puts "Component: #{component_to_delete} was not deleted successfully!" end puts "" return component_deleted_successfully end def delete_context(context_name) puts "Delete context:", "-----------------" context_deleted = false delete_context_service_response = send_request('/rest/assembly/delete', {:assembly_id=>context_name}) if (delete_context_service_response['status'] == "ok") puts "context service deleted successfully!" context_deleted = true else puts "context service was not deleted successfully!" end puts "" return context_deleted end def push_assembly_updates(service_id, service_module) puts "Push assembly updates:", "---------------------" assembly_updated = false response = send_request('/rest/assembly/promote_to_template', {:assembly_id=>service_id, :mode => 'update', :use_module_namespace => true }) pretty_print_JSON(response) if response['status'] == 'ok' && response['data']['full_module_name'] == service_module assembly_updated = true end puts "" return assembly_updated end def push_component_module_updates_without_changes(service_id, component_module) puts "Push component module updates:", "-------------------------------" response = send_request('/rest/assembly/promote_module_updates', {:assembly_id=>service_id, :module_name => component_module, :module_type => "component_module" }) return response end def get_nodes(service_id) puts "Get all nodes from service:", "-----------------------------" nodes_list = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :node_id => nil, :component_id => nil, :subtype=>'instance', :about=>'nodes'}) nodes_list = nodes_list['data'].map! { |c| c['display_name'] } pretty_print_JSON(nodes_list) puts "" return nodes_list end def get_components(service_id) puts "Get all components from service:", "-----------------------------" components_list = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :node_id => nil, :component_id => nil, :subtype=>'instance', :about=>'components'}) components_list = components_list['data'].map! { |c| c['display_name'] } puts "" return components_list end def get_cardinality(service_id, node_name) puts "Get cardinality from service:", "-----------------------------" cardinality = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :node_id => nil, :component_id => nil, :subtype=>'instance', :about=>'attributes', :format=>'yaml'}) content = YAML.load(cardinality['data']) puts content attributes = (content["nodes"]["#{node_name}/"]||{})['attributes']||{} puts "" return attributes['cardinality'] && attributes['cardinality'].to_i end def get_workflow_info(service_id) puts "Get workflow info:", "----------------------" workflow_info = send_request('/rest/assembly/info_about_task', {:assembly_id=>service_id, :subtype => 'instance'}) content = YAML.load(workflow_info['data']) puts content puts "" return content end def grant_access(service_id, system_user, rsa_pub_name, ssh_key) puts "Grant access:", "-----------------" response = send_request('/rest/assembly/initiate_ssh_pub_access', {:agent_action => :grant_access, :assembly_id=>service_id, :system_user => system_user, :rsa_pub_name => rsa_pub_name, :rsa_pub_key => ssh_key}) pretty_print_JSON(response) puts "" return response end def revoke_access(service_id, system_user, rsa_pub_name, ssh_key) puts "Revoke access:", "-----------------" resp = send_request('/rest/assembly/initiate_ssh_pub_access', {:agent_action => :revoke_access, :assembly_id=>service_id, :system_user => system_user, :rsa_pub_name => rsa_pub_name, :rsa_pub_key => ssh_key}) pretty_print_JSON(resp) response = nil if resp['status'] != 'notok' response = send_request('/rest/assembly/get_action_results', {:action_results_id => resp['data']['action_results_id'], :return_only_if_complete => true, :disable_post_processing => true}) puts response else response = resp end puts "" return response end def list_services_by_property(key, value) # Get list of existing workspace service instances in a specific context puts "List service instances with #{value} value for #{key} property:", "----------------------------------------------------------------------------------" service_instance_list = send_request('/rest/assembly/list', {:detail_level=>'nodes', :subtype=>'instance', :include_namespaces => true}) filtered_services = nil if service_instance_list['status'] == 'ok' filtered_services = service_instance_list['data'].select{ |x| x[key].include? value } if filtered_services.length.zero? puts "No service instances with #{value} value for #{key} property been found." filtered_services = nil else puts "#{filtered_services.length} service instances with #{value} value for #{key} property found: " end else puts "Could not get service instance list." end puts '' filtered_services end def list_ssh_access(service_id, system_user, rsa_pub_name, nodes) puts "List ssh access:", "---------------------" sleep 5 response = send_request('/rest/assembly/list_ssh_access', {:assembly_id=>service_id}) pretty_print_JSON(response) list = response['data'].select { |x| x['attributes']['linux_user'] == system_user && x['attributes']['key_name'] == rsa_pub_name && (nodes.include? x['node_name']) } puts "" return list.map! { |x| x['attributes']['key_name']} end def get_task_action_output(service_id, action_id) puts "Get task action output:", "------------------------" response = send_request('/rest/assembly/task_action_detail', {:assembly_id=>service_id, :message_id=>action_id}) pretty_print_JSON(response) runs = {} if response['status'] == "ok" output = response['data'] output.gsub!("=","") if response['data'].include? "=" runs = output.split(/\n \n\n|\n\n\n|\n\n/) else puts "Task action details were not retrieved successfully!" end puts "" return runs end def verify_flags(service_id, component_module_name, update_flag, update_saved_flag) puts "Verify update and update saved flags:", "---------------------------------" flags_verified = false response = send_request('/rest/assembly/info_about', {:assembly_id=>service_id, :subtype=>:instance, :about=>'modules', :detail_to_include=>[:version_info]}) pretty_print_JSON(response) component_module_details = response['data'].select { |x| x['display_name'] == component_module_name }.first if !component_module_details.nil? puts "Component module found! Check flags..." pretty_print_JSON(component_module_details) unless component_module_details.key?('local_copy') || component_module_details.key?('update_saved') puts "Flags dont not exist in the output" end if component_module_details['local_copy'] == update_flag && component_module_details['update_saved'] == update_saved_flag puts "Update and update saved flags match the comparison" flags_verified = true else puts "Update and update saved flags does not match the comparison" end else puts "Component module was not found!" end puts "" flags_verified end end
Java
using System.Collections.Specialized; using System.ComponentModel; using System.Linq; using DNTProfiler.Common.JsonToolkit; using DNTProfiler.Common.Models; using DNTProfiler.Common.Mvvm; using DNTProfiler.Infrastructure.Core; using DNTProfiler.Infrastructure.ScriptDomVisitors; using DNTProfiler.Infrastructure.ViewModels; using DNTProfiler.PluginsBase; namespace DNTProfiler.InCorrectNullComparisons.ViewModels { public class MainViewModel : MainViewModelBase { private readonly CallbacksManagerBase _callbacksManager; public MainViewModel(ProfilerPluginBase pluginContext) : base(pluginContext) { if (Designer.IsInDesignModeStatic) return; setActions(); setGuiModel(); _callbacksManager = new CallbacksManagerBase(PluginContext, GuiModelData); setEvenets(); } private void Commands_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (Command command in e.NewItems) { var visitor = new NullComparisonVisitor(); foreach (var parameter in command.Parameters.Where(parameter => parameter.Value == "null")) { visitor.NullVariableNames.Add(parameter.Name); } _callbacksManager.RunAnalysisVisitorOnCommand(visitor, command); } break; } } private void GuiModelData_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case "SelectedApplicationIdentity": _callbacksManager.ShowSelectedApplicationIdentityLocalCommands(); break; case "SelectedExecutedCommand": _callbacksManager.ShowSelectedCommandRelatedStackTraces(); break; } } private void setActions() { PluginContext.Reset = () => { ResetAll(); }; PluginContext.GetResults = () => { return GuiModelData.RelatedCommands.ToFormattedJson(); }; } private void setEvenets() { PluginContext.ProfilerData.Commands.CollectionChanged += Commands_CollectionChanged; } private void setGuiModel() { GuiModelData.PropertyChanged += GuiModelData_PropertyChanged; } } }
Java
/*! * Bootstrap v3.3.6 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100% } body { margin: 0 } article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block } audio, canvas, progress, video { display: inline-block; vertical-align: baseline } audio:not([controls]) { display: none; height: 0 } [hidden], template { display: none } a { background-color: transparent } a:active, a:hover { outline: 0 } abbr[title] { border-bottom: 1px dotted } b, strong { font-weight: 700 } dfn { font-style: italic } h1 { margin: .67em 0; font-size: 2em } mark { color: #000; background: #ff0 } small { font-size: 80% } sub, sup { position: relative; font-size: 75%; line-height: 0; vertical-align: baseline } sup { top: -.5em } sub { bottom: -.25em } img { border: 0 } svg:not(:root) { overflow: hidden } figure { margin: 1em 40px } hr { height: 0; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box } pre { overflow: auto } code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em } button, input, optgroup, select, textarea { margin: 0; font: inherit; color: inherit } button { overflow: visible } button, select { text-transform: none } button, html input[type=button], input[type=reset], input[type=submit] { -webkit-appearance: button; cursor: pointer } button[disabled], html input[disabled] { cursor: default } button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: 0 } input { line-height: normal } input[type=checkbox], input[type=radio] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 0 } input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { height: auto } input[type=search] { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield } input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none } fieldset { padding: .35em .625em .75em; margin: 0 2px; border: 1px solid silver } legend { padding: 0; border: 0 } textarea { overflow: auto } optgroup { font-weight: 700 } table { border-spacing: 0; border-collapse: collapse } td, th { padding: 0 } /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ @media print { *, :after, :before { color: #000!important; text-shadow: none!important; background: 0 0!important; -webkit-box-shadow: none!important; box-shadow: none!important } a, a:visited { text-decoration: underline } a[href]:after { content: " (" attr(href) ")" } abbr[title]:after { content: " (" attr(title) ")" } a[href^="javascript:"]:after, a[href^="#"]:after { content: "" } blockquote, pre { border: 1px solid #999; page-break-inside: avoid } thead { display: table-header-group } img, tr { page-break-inside: avoid } img { max-width: 100%!important } h2, h3, p { orphans: 3; widows: 3 } h2, h3 { page-break-after: avoid } .navbar { display: none } .btn>.caret, .dropup>.btn>.caret { border-top-color: #000!important } .label { border: 1px solid #000 } .table { border-collapse: collapse!important } .table td, .table th { background-color: #fff!important } .table-bordered td, .table-bordered th { border: 1px solid #ddd!important } } @font-face { font-family: 'Glyphicons Halflings'; src: url(../fonts/glyphicons-halflings-regular.eot); src: url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'), url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'), url(../fonts/glyphicons-halflings-regular.woff) format('woff'), url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'), url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg') } .glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: 400; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale } .glyphicon-asterisk:before { content: "\002a" } .glyphicon-plus:before { content: "\002b" } .glyphicon-eur:before, .glyphicon-euro:before { content: "\20ac" } .glyphicon-minus:before { content: "\2212" } .glyphicon-cloud:before { content: "\2601" } .glyphicon-envelope:before { content: "\2709" } .glyphicon-pencil:before { content: "\270f" } .glyphicon-glass:before { content: "\e001" } .glyphicon-music:before { content: "\e002" } .glyphicon-search:before { content: "\e003" } .glyphicon-heart:before { content: "\e005" } .glyphicon-star:before { content: "\e006" } .glyphicon-star-empty:before { content: "\e007" } .glyphicon-user:before { content: "\e008" } .glyphicon-film:before { content: "\e009" } .glyphicon-th-large:before { content: "\e010" } .glyphicon-th:before { content: "\e011" } .glyphicon-th-list:before { content: "\e012" } .glyphicon-ok:before { content: "\e013" } .glyphicon-remove:before { content: "\e014" } .glyphicon-zoom-in:before { content: "\e015" } .glyphicon-zoom-out:before { content: "\e016" } .glyphicon-off:before { content: "\e017" } .glyphicon-signal:before { content: "\e018" } .glyphicon-cog:before { content: "\e019" } .glyphicon-trash:before { content: "\e020" } .glyphicon-home:before { content: "\e021" } .glyphicon-file:before { content: "\e022" } .glyphicon-time:before { content: "\e023" } .glyphicon-road:before { content: "\e024" } .glyphicon-download-alt:before { content: "\e025" } .glyphicon-download:before { content: "\e026" } .glyphicon-upload:before { content: "\e027" } .glyphicon-inbox:before { content: "\e028" } .glyphicon-play-circle:before { content: "\e029" } .glyphicon-repeat:before { content: "\e030" } .glyphicon-refresh:before { content: "\e031" } .glyphicon-list-alt:before { content: "\e032" } .glyphicon-lock:before { content: "\e033" } .glyphicon-flag:before { content: "\e034" } .glyphicon-headphones:before { content: "\e035" } .glyphicon-volume-off:before { content: "\e036" } .glyphicon-volume-down:before { content: "\e037" } .glyphicon-volume-up:before { content: "\e038" } .glyphicon-qrcode:before { content: "\e039" } .glyphicon-barcode:before { content: "\e040" } .glyphicon-tag:before { content: "\e041" } .glyphicon-tags:before { content: "\e042" } .glyphicon-book:before { content: "\e043" } .glyphicon-bookmark:before { content: "\e044" } .glyphicon-print:before { content: "\e045" } .glyphicon-camera:before { content: "\e046" } .glyphicon-font:before { content: "\e047" } .glyphicon-bold:before { content: "\e048" } .glyphicon-italic:before { content: "\e049" } .glyphicon-text-height:before { content: "\e050" } .glyphicon-text-width:before { content: "\e051" } .glyphicon-align-left:before { content: "\e052" } .glyphicon-align-center:before { content: "\e053" } .glyphicon-align-right:before { content: "\e054" } .glyphicon-align-justify:before { content: "\e055" } .glyphicon-list:before { content: "\e056" } .glyphicon-indent-left:before { content: "\e057" } .glyphicon-indent-right:before { content: "\e058" } .glyphicon-facetime-video:before { content: "\e059" } .glyphicon-picture:before { content: "\e060" } .glyphicon-map-marker:before { content: "\e062" } .glyphicon-adjust:before { content: "\e063" } .glyphicon-tint:before { content: "\e064" } .glyphicon-edit:before { content: "\e065" } .glyphicon-share:before { content: "\e066" } .glyphicon-check:before { content: "\e067" } .glyphicon-move:before { content: "\e068" } .glyphicon-step-backward:before { content: "\e069" } .glyphicon-fast-backward:before { content: "\e070" } .glyphicon-backward:before { content: "\e071" } .glyphicon-play:before { content: "\e072" } .glyphicon-pause:before { content: "\e073" } .glyphicon-stop:before { content: "\e074" } .glyphicon-forward:before { content: "\e075" } .glyphicon-fast-forward:before { content: "\e076" } .glyphicon-step-forward:before { content: "\e077" } .glyphicon-eject:before { content: "\e078" } .glyphicon-chevron-left:before { content: "\e079" } .glyphicon-chevron-right:before { content: "\e080" } .glyphicon-plus-sign:before { content: "\e081" } .glyphicon-minus-sign:before { content: "\e082" } .glyphicon-remove-sign:before { content: "\e083" } .glyphicon-ok-sign:before { content: "\e084" } .glyphicon-question-sign:before { content: "\e085" } .glyphicon-info-sign:before { content: "\e086" } .glyphicon-screenshot:before { content: "\e087" } .glyphicon-remove-circle:before { content: "\e088" } .glyphicon-ok-circle:before { content: "\e089" } .glyphicon-ban-circle:before { content: "\e090" } .glyphicon-arrow-left:before { content: "\e091" } .glyphicon-arrow-right:before { content: "\e092" } .glyphicon-arrow-up:before { content: "\e093" } .glyphicon-arrow-down:before { content: "\e094" } .glyphicon-share-alt:before { content: "\e095" } .glyphicon-resize-full:before { content: "\e096" } .glyphicon-resize-small:before { content: "\e097" } .glyphicon-exclamation-sign:before { content: "\e101" } .glyphicon-gift:before { content: "\e102" } .glyphicon-leaf:before { content: "\e103" } .glyphicon-fire:before { content: "\e104" } .glyphicon-eye-open:before { content: "\e105" } .glyphicon-eye-close:before { content: "\e106" } .glyphicon-warning-sign:before { content: "\e107" } .glyphicon-plane:before { content: "\e108" } .glyphicon-calendar:before { content: "\e109" } .glyphicon-random:before { content: "\e110" } .glyphicon-comment:before { content: "\e111" } .glyphicon-magnet:before { content: "\e112" } .glyphicon-chevron-up:before { content: "\e113" } .glyphicon-chevron-down:before { content: "\e114" } .glyphicon-retweet:before { content: "\e115" } .glyphicon-shopping-cart:before { content: "\e116" } .glyphicon-folder-close:before { content: "\e117" } .glyphicon-folder-open:before { content: "\e118" } .glyphicon-resize-vertical:before { content: "\e119" } .glyphicon-resize-horizontal:before { content: "\e120" } .glyphicon-hdd:before { content: "\e121" } .glyphicon-bullhorn:before { content: "\e122" } .glyphicon-bell:before { content: "\e123" } .glyphicon-certificate:before { content: "\e124" } .glyphicon-thumbs-up:before { content: "\e125" } .glyphicon-thumbs-down:before { content: "\e126" } .glyphicon-hand-right:before { content: "\e127" } .glyphicon-hand-left:before { content: "\e128" } .glyphicon-hand-up:before { content: "\e129" } .glyphicon-hand-down:before { content: "\e130" } .glyphicon-circle-arrow-right:before { content: "\e131" } .glyphicon-circle-arrow-left:before { content: "\e132" } .glyphicon-circle-arrow-up:before { content: "\e133" } .glyphicon-circle-arrow-down:before { content: "\e134" } .glyphicon-globe:before { content: "\e135" } .glyphicon-wrench:before { content: "\e136" } .glyphicon-tasks:before { content: "\e137" } .glyphicon-filter:before { content: "\e138" } .glyphicon-briefcase:before { content: "\e139" } .glyphicon-fullscreen:before { content: "\e140" } .glyphicon-dashboard:before { content: "\e141" } .glyphicon-paperclip:before { content: "\e142" } .glyphicon-heart-empty:before { content: "\e143" } .glyphicon-link:before { content: "\e144" } .glyphicon-phone:before { content: "\e145" } .glyphicon-pushpin:before { content: "\e146" } .glyphicon-usd:before { content: "\e148" } .glyphicon-gbp:before { content: "\e149" } .glyphicon-sort:before { content: "\e150" } .glyphicon-sort-by-alphabet:before { content: "\e151" } .glyphicon-sort-by-alphabet-alt:before { content: "\e152" } .glyphicon-sort-by-order:before { content: "\e153" } .glyphicon-sort-by-order-alt:before { content: "\e154" } .glyphicon-sort-by-attributes:before { content: "\e155" } .glyphicon-sort-by-attributes-alt:before { content: "\e156" } .glyphicon-unchecked:before { content: "\e157" } .glyphicon-expand:before { content: "\e158" } .glyphicon-collapse-down:before { content: "\e159" } .glyphicon-collapse-up:before { content: "\e160" } .glyphicon-log-in:before { content: "\e161" } .glyphicon-flash:before { content: "\e162" } .glyphicon-log-out:before { content: "\e163" } .glyphicon-new-window:before { content: "\e164" } .glyphicon-record:before { content: "\e165" } .glyphicon-save:before { content: "\e166" } .glyphicon-open:before { content: "\e167" } .glyphicon-saved:before { content: "\e168" } .glyphicon-import:before { content: "\e169" } .glyphicon-export:before { content: "\e170" } .glyphicon-send:before { content: "\e171" } .glyphicon-floppy-disk:before { content: "\e172" } .glyphicon-floppy-saved:before { content: "\e173" } .glyphicon-floppy-remove:before { content: "\e174" } .glyphicon-floppy-save:before { content: "\e175" } .glyphicon-floppy-open:before { content: "\e176" } .glyphicon-credit-card:before { content: "\e177" } .glyphicon-transfer:before { content: "\e178" } .glyphicon-cutlery:before { content: "\e179" } .glyphicon-header:before { content: "\e180" } .glyphicon-compressed:before { content: "\e181" } .glyphicon-earphone:before { content: "\e182" } .glyphicon-phone-alt:before { content: "\e183" } .glyphicon-tower:before { content: "\e184" } .glyphicon-stats:before { content: "\e185" } .glyphicon-sd-video:before { content: "\e186" } .glyphicon-hd-video:before { content: "\e187" } .glyphicon-subtitles:before { content: "\e188" } .glyphicon-sound-stereo:before { content: "\e189" } .glyphicon-sound-dolby:before { content: "\e190" } .glyphicon-sound-5-1:before { content: "\e191" } .glyphicon-sound-6-1:before { content: "\e192" } .glyphicon-sound-7-1:before { content: "\e193" } .glyphicon-copyright-mark:before { content: "\e194" } .glyphicon-registration-mark:before { content: "\e195" } .glyphicon-cloud-download:before { content: "\e197" } .glyphicon-cloud-upload:before { content: "\e198" } .glyphicon-tree-conifer:before { content: "\e199" } .glyphicon-tree-deciduous:before { content: "\e200" } .glyphicon-cd:before { content: "\e201" } .glyphicon-save-file:before { content: "\e202" } .glyphicon-open-file:before { content: "\e203" } .glyphicon-level-up:before { content: "\e204" } .glyphicon-copy:before { content: "\e205" } .glyphicon-paste:before { content: "\e206" } .glyphicon-alert:before { content: "\e209" } .glyphicon-equalizer:before { content: "\e210" } .glyphicon-king:before { content: "\e211" } .glyphicon-queen:before { content: "\e212" } .glyphicon-pawn:before { content: "\e213" } .glyphicon-bishop:before { content: "\e214" } .glyphicon-knight:before { content: "\e215" } .glyphicon-baby-formula:before { content: "\e216" } .glyphicon-tent:before { content: "\26fa" } .glyphicon-blackboard:before { content: "\e218" } .glyphicon-bed:before { content: "\e219" } .glyphicon-apple:before { content: "\f8ff" } .glyphicon-erase:before { content: "\e221" } .glyphicon-hourglass:before { content: "\231b" } .glyphicon-lamp:before { content: "\e223" } .glyphicon-duplicate:before { content: "\e224" } .glyphicon-piggy-bank:before { content: "\e225" } .glyphicon-scissors:before { content: "\e226" } .glyphicon-bitcoin:before { content: "\e227" } .glyphicon-btc:before { content: "\e227" } .glyphicon-xbt:before { content: "\e227" } .glyphicon-yen:before { content: "\00a5" } .glyphicon-jpy:before { content: "\00a5" } .glyphicon-ruble:before { content: "\20bd" } .glyphicon-rub:before { content: "\20bd" } .glyphicon-scale:before { content: "\e230" } .glyphicon-ice-lolly:before { content: "\e231" } .glyphicon-ice-lolly-tasted:before { content: "\e232" } .glyphicon-education:before { content: "\e233" } .glyphicon-option-horizontal:before { content: "\e234" } .glyphicon-option-vertical:before { content: "\e235" } .glyphicon-menu-hamburger:before { content: "\e236" } .glyphicon-modal-window:before { content: "\e237" } .glyphicon-oil:before { content: "\e238" } .glyphicon-grain:before { content: "\e239" } .glyphicon-sunglasses:before { content: "\e240" } .glyphicon-text-size:before { content: "\e241" } .glyphicon-text-color:before { content: "\e242" } .glyphicon-text-background:before { content: "\e243" } .glyphicon-object-align-top:before { content: "\e244" } .glyphicon-object-align-bottom:before { content: "\e245" } .glyphicon-object-align-horizontal:before { content: "\e246" } .glyphicon-object-align-left:before { content: "\e247" } .glyphicon-object-align-vertical:before { content: "\e248" } .glyphicon-object-align-right:before { content: "\e249" } .glyphicon-triangle-right:before { content: "\e250" } .glyphicon-triangle-left:before { content: "\e251" } .glyphicon-triangle-bottom:before { content: "\e252" } .glyphicon-triangle-top:before { content: "\e253" } .glyphicon-console:before { content: "\e254" } .glyphicon-superscript:before { content: "\e255" } .glyphicon-subscript:before { content: "\e256" } .glyphicon-menu-left:before { content: "\e257" } .glyphicon-menu-right:before { content: "\e258" } .glyphicon-menu-down:before { content: "\e259" } .glyphicon-menu-up:before { content: "\e260" } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box } :after, :before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box } html { font-size: 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } body { /* font-family: "Arimo", "Segoe UI", Helvetica, Arial, sans-serif; */ font-family: "Roboto", "Open Sans", Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.42857143; color: #000000; background-color: #fff } button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit } a { color: #337ab7; text-decoration: none } a:focus, a:hover { color: #23527c; text-decoration: underline } a:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } figure { margin: 0 } img { vertical-align: middle } .carousel-inner>.item>a>img, .carousel-inner>.item>img, .img-responsive, .thumbnail a>img, .thumbnail>img { display: block; max-width: 100%; height: auto } .img-rounded { border-radius: 6px } .img-thumbnail { display: inline-block; max-width: 100%; height: auto; padding: 4px; line-height: 1.42857143; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: all .2s ease-in-out; -o-transition: all .2s ease-in-out; transition: all .2s ease-in-out } .img-circle { border-radius: 50% } hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #eee } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0 } .sr-only-focusable:active, .sr-only-focusable:focus { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto } [role=button] { cursor: pointer } .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { font-family: inherit; font-weight: 500; line-height: 1; color: inherit } .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small { font-weight: 400; line-height: 1; color: #777 } .h1, .h2, .h3, h1, h2, h3 { margin-top: 20px; margin-bottom: 10px } .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small { font-size: 65% } .h4, .h5, .h6, h4, h5, h6 { margin-top: 10px; margin-bottom: 10px } .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small { font-size: 75% } .h1, h1 { font-size: 36px } .h2, h2 { font-size: 30px } .h3, h3 { font-size: 24px } .h4, h4 { font-size: 18px } .h5, h5 { font-size: 14px } .h6, h6 { font-size: 12px } p { margin: 0 0 10px } .lead { margin-bottom: 20px; font-size: 16px; font-weight: 300; line-height: 1.4 } @media (min-width:768px) { .lead { font-size: 21px } } .small, small { font-size: 85% } .mark, mark { padding: .2em; background-color: #fcf8e3 } .text-left { text-align: left } .text-right { text-align: right } .text-center { text-align: center } .text-justify { text-align: justify } .text-nowrap { white-space: nowrap } .text-lowercase { text-transform: lowercase } .text-uppercase { text-transform: uppercase } .text-capitalize { text-transform: capitalize } .text-muted { color: #777 } .text-primary { color: #337ab7 } a.text-primary:focus, a.text-primary:hover { color: #286090 } .text-success { color: #3c763d } a.text-success:focus, a.text-success:hover { color: #2b542c } .text-info { color: #31708f } a.text-info:focus, a.text-info:hover { color: #245269 } .text-warning { color: #8a6d3b } a.text-warning:focus, a.text-warning:hover { color: #66512c } .text-danger { color: #a94442 } a.text-danger:focus, a.text-danger:hover { color: #843534 } .bg-primary { color: #fff; background-color: #337ab7 } a.bg-primary:focus, a.bg-primary:hover { background-color: #286090 } .bg-success { background-color: #dff0d8 } a.bg-success:focus, a.bg-success:hover { background-color: #c1e2b3 } .bg-info { background-color: #d9edf7 } a.bg-info:focus, a.bg-info:hover { background-color: #afd9ee } .bg-warning { background-color: #fcf8e3 } a.bg-warning:focus, a.bg-warning:hover { background-color: #f7ecb5 } .bg-danger { background-color: #f2dede } a.bg-danger:focus, a.bg-danger:hover { background-color: #e4b9b9 } .page-header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eee } ol, ul { margin-top: 0; margin-bottom: 10px } ol ol, ol ul, ul ol, ul ul { margin-bottom: 0 } .list-unstyled { padding-left: 0; list-style: none } .list-inline { padding-left: 0; margin-left: -5px; list-style: none } .list-inline>li { display: inline-block; padding-right: 5px; padding-left: 5px } dl { margin-top: 0; margin-bottom: 20px } dd, dt { line-height: 1.42857143 } dt { font-weight: 700 } dd { margin-left: 0 } @media (min-width:768px) { .dl-horizontal dt { float: left; width: 160px; overflow: hidden; clear: left; text-align: right; text-overflow: ellipsis; white-space: nowrap } .dl-horizontal dd { margin-left: 180px } } abbr[data-original-title], abbr[title] { cursor: help; border-bottom: 1px dotted #777 } .initialism { font-size: 90%; text-transform: uppercase } blockquote { padding: 10px 20px; margin: 0 0 20px; font-size: 17.5px; border-left: 5px solid #eee } blockquote ol:last-child, blockquote p:last-child, blockquote ul:last-child { margin-bottom: 0 } blockquote .small, blockquote footer, blockquote small { display: block; font-size: 80%; line-height: 1.42857143; color: #777 } blockquote .small:before, blockquote footer:before, blockquote small:before { content: '\2014 \00A0' } .blockquote-reverse, blockquote.pull-right { padding-right: 15px; padding-left: 0; text-align: right; border-right: 5px solid #eee; border-left: 0 } .blockquote-reverse .small:before, .blockquote-reverse footer:before, .blockquote-reverse small:before, blockquote.pull-right .small:before, blockquote.pull-right footer:before, blockquote.pull-right small:before { content: '' } .blockquote-reverse .small:after, .blockquote-reverse footer:after, .blockquote-reverse small:after, blockquote.pull-right .small:after, blockquote.pull-right footer:after, blockquote.pull-right small:after { content: '\00A0 \2014' } address { margin-bottom: 20px; font-style: normal; line-height: 1.42857143 } code, kbd, pre, samp { font-family: Menlo, Monaco, Consolas, "Courier New", monospace } code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px } kbd { padding: 2px 4px; font-size: 90%; color: #fff; background-color: #333; border-radius: 3px; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25) } kbd kbd { padding: 0; font-size: 100%; font-weight: 700; -webkit-box-shadow: none; box-shadow: none } pre { display: block; padding: 9.5px; margin: 0 0 10px; font-size: 13px; line-height: 1.42857143; color: #333; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent; border-radius: 0 } .pre-scrollable { max-height: 340px; overflow-y: scroll } .container { padding-right: 30px; padding-left: 30px; margin-right: auto; margin-left: auto } @media (min-width:768px) { .container { /* width: 750px*/ /* padding-top: 30px; padding-bottom: 30px*/ } } @media (min-width:992px) { .container { width: 970px } } @media (min-width:1200px) { .container { /* margin-top:30px; margin-bottom:30px;*/ width: 100%; max-width: auto } } .container-fluid { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto } .row { margin-right: -15px; margin-left: -15px } .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 { position: relative; min-height: 1px; padding-right: 15px; padding-left: 15px } .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 { float: left } .col-xs-12 { width: 100% } .col-xs-11 { width: 91.66666667% } .col-xs-10 { width: 83.33333333% } .col-xs-9 { width: 75% } .col-xs-8 { width: 66.66666667% } .col-xs-7 { width: 58.33333333% } .col-xs-6 { width: 50% } .col-xs-5 { width: 41.66666667% } .col-xs-4 { width: 33.33333333% } .col-xs-3 { width: 25% } .col-xs-2 { width: 16.66666667% } .col-xs-1 { width: 8.33333333% } .col-xs-pull-12 { right: 100% } .col-xs-pull-11 { right: 91.66666667% } .col-xs-pull-10 { right: 83.33333333% } .col-xs-pull-9 { right: 75% } .col-xs-pull-8 { right: 66.66666667% } .col-xs-pull-7 { right: 58.33333333% } .col-xs-pull-6 { right: 50% } .col-xs-pull-5 { right: 41.66666667% } .col-xs-pull-4 { right: 33.33333333% } .col-xs-pull-3 { right: 25% } .col-xs-pull-2 { right: 16.66666667% } .col-xs-pull-1 { right: 8.33333333% } .col-xs-pull-0 { right: auto } .col-xs-push-12 { left: 100% } .col-xs-push-11 { left: 91.66666667% } .col-xs-push-10 { left: 83.33333333% } .col-xs-push-9 { left: 75% } .col-xs-push-8 { left: 66.66666667% } .col-xs-push-7 { left: 58.33333333% } .col-xs-push-6 { left: 50% } .col-xs-push-5 { left: 41.66666667% } .col-xs-push-4 { left: 33.33333333% } .col-xs-push-3 { left: 25% } .col-xs-push-2 { left: 16.66666667% } .col-xs-push-1 { left: 8.33333333% } .col-xs-push-0 { left: auto } .col-xs-offset-12 { margin-left: 100% } .col-xs-offset-11 { margin-left: 91.66666667% } .col-xs-offset-10 { margin-left: 83.33333333% } .col-xs-offset-9 { margin-left: 75% } .col-xs-offset-8 { margin-left: 66.66666667% } .col-xs-offset-7 { margin-left: 58.33333333% } .col-xs-offset-6 { margin-left: 50% } .col-xs-offset-5 { margin-left: 41.66666667% } .col-xs-offset-4 { margin-left: 33.33333333% } .col-xs-offset-3 { margin-left: 25% } .col-xs-offset-2 { margin-left: 16.66666667% } .col-xs-offset-1 { margin-left: 8.33333333% } .col-xs-offset-0 { margin-left: 0 } @media (min-width:768px) { .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9 { float: left } .col-sm-12 { width: 100% } .col-sm-11 { width: 91.66666667% } .col-sm-10 { width: 83.33333333% } .col-sm-9 { width: 75% } .col-sm-8 { width: 66.66666667% } .col-sm-7 { width: 58.33333333% } .col-sm-6 { width: 50% } .col-sm-5 { width: 41.66666667% } .col-sm-4 { width: 33.33333333% } .col-sm-3 { width: 25% } .col-sm-2 { width: 16.66666667% } .col-sm-1 { width: 8.33333333% } .col-sm-pull-12 { right: 100% } .col-sm-pull-11 { right: 91.66666667% } .col-sm-pull-10 { right: 83.33333333% } .col-sm-pull-9 { right: 75% } .col-sm-pull-8 { right: 66.66666667% } .col-sm-pull-7 { right: 58.33333333% } .col-sm-pull-6 { right: 50% } .col-sm-pull-5 { right: 41.66666667% } .col-sm-pull-4 { right: 33.33333333% } .col-sm-pull-3 { right: 25% } .col-sm-pull-2 { right: 16.66666667% } .col-sm-pull-1 { right: 8.33333333% } .col-sm-pull-0 { right: auto } .col-sm-push-12 { left: 100% } .col-sm-push-11 { left: 91.66666667% } .col-sm-push-10 { left: 83.33333333% } .col-sm-push-9 { left: 75% } .col-sm-push-8 { left: 66.66666667% } .col-sm-push-7 { left: 58.33333333% } .col-sm-push-6 { left: 50% } .col-sm-push-5 { left: 41.66666667% } .col-sm-push-4 { left: 33.33333333% } .col-sm-push-3 { left: 25% } .col-sm-push-2 { left: 16.66666667% } .col-sm-push-1 { left: 8.33333333% } .col-sm-push-0 { left: auto } .col-sm-offset-12 { margin-left: 100% } .col-sm-offset-11 { margin-left: 91.66666667% } .col-sm-offset-10 { margin-left: 83.33333333% } .col-sm-offset-9 { margin-left: 75% } .col-sm-offset-8 { margin-left: 66.66666667% } .col-sm-offset-7 { margin-left: 58.33333333% } .col-sm-offset-6 { margin-left: 50% } .col-sm-offset-5 { margin-left: 41.66666667% } .col-sm-offset-4 { margin-left: 33.33333333% } .col-sm-offset-3 { margin-left: 25% } .col-sm-offset-2 { margin-left: 16.66666667% } .col-sm-offset-1 { margin-left: 8.33333333% } .col-sm-offset-0 { margin-left: 0 } } @media (min-width:992px) { .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9 { float: left } .col-md-12 { width: 100% } .col-md-11 { width: 91.66666667% } .col-md-10 { width: 83.33333333% } .col-md-9 { width: 75% } .col-md-8 { width: 66.66666667% } .col-md-7 { width: 58.33333333% } .col-md-6 { width: 50% } .col-md-5 { width: 41.66666667% } .col-md-4 { width: 33.33333333% } .col-md-3 { width: 25% } .col-md-2 { width: 16.66666667% } .col-md-1 { width: 8.33333333% } .col-md-pull-12 { right: 100% } .col-md-pull-11 { right: 91.66666667% } .col-md-pull-10 { right: 83.33333333% } .col-md-pull-9 { right: 75% } .col-md-pull-8 { right: 66.66666667% } .col-md-pull-7 { right: 58.33333333% } .col-md-pull-6 { right: 50% } .col-md-pull-5 { right: 41.66666667% } .col-md-pull-4 { right: 33.33333333% } .col-md-pull-3 { right: 25% } .col-md-pull-2 { right: 16.66666667% } .col-md-pull-1 { right: 8.33333333% } .col-md-pull-0 { right: auto } .col-md-push-12 { left: 100% } .col-md-push-11 { left: 91.66666667% } .col-md-push-10 { left: 83.33333333% } .col-md-push-9 { left: 75% } .col-md-push-8 { left: 66.66666667% } .col-md-push-7 { left: 58.33333333% } .col-md-push-6 { left: 50% } .col-md-push-5 { left: 41.66666667% } .col-md-push-4 { left: 33.33333333% } .col-md-push-3 { left: 25% } .col-md-push-2 { left: 16.66666667% } .col-md-push-1 { left: 8.33333333% } .col-md-push-0 { left: auto } .col-md-offset-12 { margin-left: 100% } .col-md-offset-11 { margin-left: 91.66666667% } .col-md-offset-10 { margin-left: 83.33333333% } .col-md-offset-9 { margin-left: 75% } .col-md-offset-8 { margin-left: 66.66666667% } .col-md-offset-7 { margin-left: 58.33333333% } .col-md-offset-6 { margin-left: 50% } .col-md-offset-5 { margin-left: 41.66666667% } .col-md-offset-4 { margin-left: 33.33333333% } .col-md-offset-3 { margin-left: 25% } .col-md-offset-2 { margin-left: 16.66666667% } .col-md-offset-1 { margin-left: 8.33333333% } .col-md-offset-0 { margin-left: 0 } } @media (min-width:1200px) { .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9 { float: left } .col-lg-12 { width: 100% } .col-lg-11 { width: 91.66666667% } .col-lg-10 { width: 83.33333333% } .col-lg-9 { width: 75% } .col-lg-8 { width: 66.66666667% } .col-lg-7 { width: 58.33333333% } .col-lg-6 { width: 50% } .col-lg-5 { width: 41.66666667% } .col-lg-4 { width: 33.33333333% } .col-lg-3 { width: 25% } .col-lg-2 { width: 16.66666667% } .col-lg-1 { width: 8.33333333% } .col-lg-pull-12 { right: 100% } .col-lg-pull-11 { right: 91.66666667% } .col-lg-pull-10 { right: 83.33333333% } .col-lg-pull-9 { right: 75% } .col-lg-pull-8 { right: 66.66666667% } .col-lg-pull-7 { right: 58.33333333% } .col-lg-pull-6 { right: 50% } .col-lg-pull-5 { right: 41.66666667% } .col-lg-pull-4 { right: 33.33333333% } .col-lg-pull-3 { right: 25% } .col-lg-pull-2 { right: 16.66666667% } .col-lg-pull-1 { right: 8.33333333% } .col-lg-pull-0 { right: auto } .col-lg-push-12 { left: 100% } .col-lg-push-11 { left: 91.66666667% } .col-lg-push-10 { left: 83.33333333% } .col-lg-push-9 { left: 75% } .col-lg-push-8 { left: 66.66666667% } .col-lg-push-7 { left: 58.33333333% } .col-lg-push-6 { left: 50% } .col-lg-push-5 { left: 41.66666667% } .col-lg-push-4 { left: 33.33333333% } .col-lg-push-3 { left: 25% } .col-lg-push-2 { left: 16.66666667% } .col-lg-push-1 { left: 8.33333333% } .col-lg-push-0 { left: auto } .col-lg-offset-12 { margin-left: 100% } .col-lg-offset-11 { margin-left: 91.66666667% } .col-lg-offset-10 { margin-left: 83.33333333% } .col-lg-offset-9 { margin-left: 75% } .col-lg-offset-8 { margin-left: 66.66666667% } .col-lg-offset-7 { margin-left: 58.33333333% } .col-lg-offset-6 { margin-left: 50% } .col-lg-offset-5 { margin-left: 41.66666667% } .col-lg-offset-4 { margin-left: 33.33333333% } .col-lg-offset-3 { margin-left: 25% } .col-lg-offset-2 { margin-left: 16.66666667% } .col-lg-offset-1 { margin-left: 8.33333333% } .col-lg-offset-0 { margin-left: 0 } } table { background-color: transparent } caption { padding-top: 8px; padding-bottom: 8px; color: #777; text-align: left } th { text-align: left } .table { width: 100%; max-width: 100%; margin-bottom: 20px } .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { padding: 8px; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd } .table>thead>tr>th { vertical-align: bottom; border-bottom: 2px solid #ddd } .table>caption+thead>tr:first-child>td, .table>caption+thead>tr:first-child>th, .table>colgroup+thead>tr:first-child>td, .table>colgroup+thead>tr:first-child>th, .table>thead:first-child>tr:first-child>td, .table>thead:first-child>tr:first-child>th { border-top: 0 } .table>tbody+tbody { border-top: 2px solid #ddd } .table .table { background-color: #fff } .table-condensed>tbody>tr>td, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>td, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>thead>tr>th { padding: 5px } .table-bordered { border: 1px solid #ddd } .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th { border: 1px solid #ddd } .table-bordered>thead>tr>td, .table-bordered>thead>tr>th { border-bottom-width: 2px } .table-striped>tbody>tr:nth-of-type(odd) { background-color: #f9f9f9 } .table-hover>tbody>tr:hover { background-color: #f5f5f5 } table col[class*=col-] { position: static; display: table-column; float: none } table td[class*=col-], table th[class*=col-] { position: static; display: table-cell; float: none } .table>tbody>tr.active>td, .table>tbody>tr.active>th, .table>tbody>tr>td.active, .table>tbody>tr>th.active, .table>tfoot>tr.active>td, .table>tfoot>tr.active>th, .table>tfoot>tr>td.active, .table>tfoot>tr>th.active, .table>thead>tr.active>td, .table>thead>tr.active>th, .table>thead>tr>td.active, .table>thead>tr>th.active { background-color: #f5f5f5 } .table-hover>tbody>tr.active:hover>td, .table-hover>tbody>tr.active:hover>th, .table-hover>tbody>tr:hover>.active, .table-hover>tbody>tr>td.active:hover, .table-hover>tbody>tr>th.active:hover { background-color: #e8e8e8 } .table>tbody>tr.success>td, .table>tbody>tr.success>th, .table>tbody>tr>td.success, .table>tbody>tr>th.success, .table>tfoot>tr.success>td, .table>tfoot>tr.success>th, .table>tfoot>tr>td.success, .table>tfoot>tr>th.success, .table>thead>tr.success>td, .table>thead>tr.success>th, .table>thead>tr>td.success, .table>thead>tr>th.success { background-color: #dff0d8 } .table-hover>tbody>tr.success:hover>td, .table-hover>tbody>tr.success:hover>th, .table-hover>tbody>tr:hover>.success, .table-hover>tbody>tr>td.success:hover, .table-hover>tbody>tr>th.success:hover { background-color: #d0e9c6 } .table>tbody>tr.info>td, .table>tbody>tr.info>th, .table>tbody>tr>td.info, .table>tbody>tr>th.info, .table>tfoot>tr.info>td, .table>tfoot>tr.info>th, .table>tfoot>tr>td.info, .table>tfoot>tr>th.info, .table>thead>tr.info>td, .table>thead>tr.info>th, .table>thead>tr>td.info, .table>thead>tr>th.info { background-color: #d9edf7 } .table-hover>tbody>tr.info:hover>td, .table-hover>tbody>tr.info:hover>th, .table-hover>tbody>tr:hover>.info, .table-hover>tbody>tr>td.info:hover, .table-hover>tbody>tr>th.info:hover { background-color: #c4e3f3 } .table>tbody>tr.warning>td, .table>tbody>tr.warning>th, .table>tbody>tr>td.warning, .table>tbody>tr>th.warning, .table>tfoot>tr.warning>td, .table>tfoot>tr.warning>th, .table>tfoot>tr>td.warning, .table>tfoot>tr>th.warning, .table>thead>tr.warning>td, .table>thead>tr.warning>th, .table>thead>tr>td.warning, .table>thead>tr>th.warning { background-color: #fcf8e3 } .table-hover>tbody>tr.warning:hover>td, .table-hover>tbody>tr.warning:hover>th, .table-hover>tbody>tr:hover>.warning, .table-hover>tbody>tr>td.warning:hover, .table-hover>tbody>tr>th.warning:hover { background-color: #faf2cc } .table>tbody>tr.danger>td, .table>tbody>tr.danger>th, .table>tbody>tr>td.danger, .table>tbody>tr>th.danger, .table>tfoot>tr.danger>td, .table>tfoot>tr.danger>th, .table>tfoot>tr>td.danger, .table>tfoot>tr>th.danger, .table>thead>tr.danger>td, .table>thead>tr.danger>th, .table>thead>tr>td.danger, .table>thead>tr>th.danger { background-color: #f2dede } .table-hover>tbody>tr.danger:hover>td, .table-hover>tbody>tr.danger:hover>th, .table-hover>tbody>tr:hover>.danger, .table-hover>tbody>tr>td.danger:hover, .table-hover>tbody>tr>th.danger:hover { background-color: #ebcccc } .table-responsive { min-height: .01%; overflow-x: auto } @media screen and (max-width:767px) { .table-responsive { width: 100%; margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; border: 1px solid #ddd } .table-responsive>.table { margin-bottom: 0 } .table-responsive>.table>tbody>tr>td, .table-responsive>.table>tbody>tr>th, .table-responsive>.table>tfoot>tr>td, .table-responsive>.table>tfoot>tr>th, .table-responsive>.table>thead>tr>td, .table-responsive>.table>thead>tr>th { white-space: nowrap } .table-responsive>.table-bordered { border: 0 } .table-responsive>.table-bordered>tbody>tr>td:first-child, .table-responsive>.table-bordered>tbody>tr>th:first-child, .table-responsive>.table-bordered>tfoot>tr>td:first-child, .table-responsive>.table-bordered>tfoot>tr>th:first-child, .table-responsive>.table-bordered>thead>tr>td:first-child, .table-responsive>.table-bordered>thead>tr>th:first-child { border-left: 0 } .table-responsive>.table-bordered>tbody>tr>td:last-child, .table-responsive>.table-bordered>tbody>tr>th:last-child, .table-responsive>.table-bordered>tfoot>tr>td:last-child, .table-responsive>.table-bordered>tfoot>tr>th:last-child, .table-responsive>.table-bordered>thead>tr>td:last-child, .table-responsive>.table-bordered>thead>tr>th:last-child { border-right: 0 } .table-responsive>.table-bordered>tbody>tr:last-child>td, .table-responsive>.table-bordered>tbody>tr:last-child>th, .table-responsive>.table-bordered>tfoot>tr:last-child>td, .table-responsive>.table-bordered>tfoot>tr:last-child>th { border-bottom: 0 } } fieldset { min-width: 0; padding: 0; margin: 0; border: 0 } legend { display: block; width: 100%; padding: 0; margin-bottom: 20px; font-size: 21px; line-height: inherit; color: #333; border: 0; border-bottom: 1px solid #e5e5e5 } label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: 700 } input[type=search] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box } input[type=checkbox], input[type=radio] { margin: 4px 0 0; margin-top: 1px\9; line-height: normal } input[type=file] { display: block } input[type=range] { display: block; width: 100% } select[multiple], select[size] { height: auto } input[type=file]:focus, input[type=checkbox]:focus, input[type=radio]:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } output { display: block; padding-top: 7px; font-size: 14px; line-height: 1.42857143; color: #555 } .form-control { display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s } .form-control:focus { border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) } .form-control::-moz-placeholder { color: #999; opacity: 1 } .form-control:-ms-input-placeholder { color: #999 } .form-control::-webkit-input-placeholder { color: #999 } .form-control::-ms-expand { background-color: transparent; border: 0 } .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: #eee; opacity: 1 } .form-control[disabled], fieldset[disabled] .form-control { cursor: not-allowed } textarea.form-control { height: auto } input[type=search] { -webkit-appearance: none } @media screen and (-webkit-min-device-pixel-ratio:0) { input[type=date].form-control, input[type=time].form-control, input[type=datetime-local].form-control, input[type=month].form-control { line-height: 34px } .input-group-sm input[type=date], .input-group-sm input[type=time], .input-group-sm input[type=datetime-local], .input-group-sm input[type=month], input[type=date].input-sm, input[type=time].input-sm, input[type=datetime-local].input-sm, input[type=month].input-sm { line-height: 30px } .input-group-lg input[type=date], .input-group-lg input[type=time], .input-group-lg input[type=datetime-local], .input-group-lg input[type=month], input[type=date].input-lg, input[type=time].input-lg, input[type=datetime-local].input-lg, input[type=month].input-lg { line-height: 46px } } .form-group { margin-bottom: 15px } .checkbox, .radio { position: relative; display: block; margin-top: 10px; margin-bottom: 10px } .checkbox label, .radio label { min-height: 20px; padding-left: 20px; margin-bottom: 0; font-weight: 400; cursor: pointer } .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { position: absolute; margin-top: 4px\9; margin-left: -20px } .checkbox+.checkbox, .radio+.radio { margin-top: -5px } .checkbox-inline, .radio-inline { position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; font-weight: 400; vertical-align: middle; cursor: pointer } .checkbox-inline+.checkbox-inline, .radio-inline+.radio-inline { margin-top: 0; margin-left: 10px } fieldset[disabled] input[type=checkbox], fieldset[disabled] input[type=radio], input[type=checkbox].disabled, input[type=checkbox][disabled], input[type=radio].disabled, input[type=radio][disabled] { cursor: not-allowed } .checkbox-inline.disabled, .radio-inline.disabled, fieldset[disabled] .checkbox-inline, fieldset[disabled] .radio-inline { cursor: not-allowed } .checkbox.disabled label, .radio.disabled label, fieldset[disabled] .checkbox label, fieldset[disabled] .radio label { cursor: not-allowed } .form-control-static { min-height: 34px; padding-top: 7px; padding-bottom: 7px; margin-bottom: 0 } .form-control-static.input-lg, .form-control-static.input-sm { padding-right: 0; padding-left: 0 } .input-sm { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } select.input-sm { height: 30px; line-height: 30px } select[multiple].input-sm, textarea.input-sm { height: auto } .form-group-sm .form-control { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } .form-group-sm select.form-control { height: 30px; line-height: 30px } .form-group-sm select[multiple].form-control, .form-group-sm textarea.form-control { height: auto } .form-group-sm .form-control-static { height: 30px; min-height: 32px; padding: 6px 10px; font-size: 12px; line-height: 1.5 } .input-lg { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px } select.input-lg { height: 46px; line-height: 46px } select[multiple].input-lg, textarea.input-lg { height: auto } .form-group-lg .form-control { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px } .form-group-lg select.form-control { height: 46px; line-height: 46px } .form-group-lg select[multiple].form-control, .form-group-lg textarea.form-control { height: auto } .form-group-lg .form-control-static { height: 46px; min-height: 38px; padding: 11px 16px; font-size: 18px; line-height: 1.3333333 } .has-feedback { position: relative } .has-feedback .form-control { padding-right: 42.5px } .form-control-feedback { position: absolute; top: 0; right: 0; z-index: 2; display: block; width: 34px; height: 34px; line-height: 34px; text-align: center; pointer-events: none } .form-group-lg .form-control+.form-control-feedback, .input-group-lg+.form-control-feedback, .input-lg+.form-control-feedback { width: 46px; height: 46px; line-height: 46px } .form-group-sm .form-control+.form-control-feedback, .input-group-sm+.form-control-feedback, .input-sm+.form-control-feedback { width: 30px; height: 30px; line-height: 30px } .has-success .checkbox, .has-success .checkbox-inline, .has-success .control-label, .has-success .help-block, .has-success .radio, .has-success .radio-inline, .has-success.checkbox label, .has-success.checkbox-inline label, .has-success.radio label, .has-success.radio-inline label { color: #3c763d } .has-success .form-control { border-color: #3c763d; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-success .form-control:focus { border-color: #2b542c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168 } .has-success .input-group-addon { color: #3c763d; background-color: #dff0d8; border-color: #3c763d } .has-success .form-control-feedback { color: #3c763d } .has-warning .checkbox, .has-warning .checkbox-inline, .has-warning .control-label, .has-warning .help-block, .has-warning .radio, .has-warning .radio-inline, .has-warning.checkbox label, .has-warning.checkbox-inline label, .has-warning.radio label, .has-warning.radio-inline label { color: #8a6d3b } .has-warning .form-control { border-color: #8a6d3b; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-warning .form-control:focus { border-color: #66512c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b } .has-warning .input-group-addon { color: #8a6d3b; background-color: #fcf8e3; border-color: #8a6d3b } .has-warning .form-control-feedback { color: #8a6d3b } .has-error .checkbox, .has-error .checkbox-inline, .has-error .control-label, .has-error .help-block, .has-error .radio, .has-error .radio-inline, .has-error.checkbox label, .has-error.checkbox-inline label, .has-error.radio label, .has-error.radio-inline label { color: #a94442 } .has-error .form-control { border-color: #a94442; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-error .form-control:focus { border-color: #843534; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483 } .has-error .input-group-addon { color: #a94442; background-color: #f2dede; border-color: #a94442 } .has-error .form-control-feedback { color: #a94442 } .has-feedback label~.form-control-feedback { top: 25px } .has-feedback label.sr-only~.form-control-feedback { top: 0 } .help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #737373 } @media (min-width:768px) { .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle } .form-inline .form-control { display: inline-block; width: auto; vertical-align: middle } .form-inline .form-control-static { display: inline-block } .form-inline .input-group { display: inline-table; vertical-align: middle } .form-inline .input-group .form-control, .form-inline .input-group .input-group-addon, .form-inline .input-group .input-group-btn { width: auto } .form-inline .input-group>.form-control { width: 100% } .form-inline .control-label { margin-bottom: 0; vertical-align: middle } .form-inline .checkbox, .form-inline .radio { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle } .form-inline .checkbox label, .form-inline .radio label { padding-left: 0 } .form-inline .checkbox input[type=checkbox], .form-inline .radio input[type=radio] { position: relative; margin-left: 0 } .form-inline .has-feedback .form-control-feedback { top: 0 } } .form-horizontal .checkbox, .form-horizontal .checkbox-inline, .form-horizontal .radio, .form-horizontal .radio-inline { padding-top: 7px; margin-top: 0; margin-bottom: 0 } .form-horizontal .checkbox, .form-horizontal .radio { min-height: 27px } .form-horizontal .form-group { margin-right: -15px; margin-left: -15px } @media (min-width:768px) { .form-horizontal .control-label { padding-top: 7px; margin-bottom: 0; text-align: right } } .form-horizontal .has-feedback .form-control-feedback { right: 15px } @media (min-width:768px) { .form-horizontal .form-group-lg .control-label { padding-top: 11px; font-size: 18px } } @media (min-width:768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; font-size: 12px } } .btn { display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-image: none; border: 1px solid transparent; border-radius: 4px } .btn.active.focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn:active:focus, .btn:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } .btn.focus, .btn:focus, .btn:hover { color: #333; text-decoration: none } .btn.active, .btn:active { background-image: none; outline: 0; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) } .btn.disabled, .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: none; opacity: .65 } a.btn.disabled, fieldset[disabled] a.btn { pointer-events: none } .btn-default { color: #333; background-color: #fff; border-color: #ccc } .btn-default.focus, .btn-default:focus { color: #333; background-color: #e6e6e6; border-color: #8c8c8c } .btn-default:hover { color: #333; background-color: #e6e6e6; border-color: #adadad } .btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default { color: #333; background-color: #e6e6e6; border-color: #adadad } .btn-default.active.focus, .btn-default.active:focus, .btn-default.active:hover, .btn-default:active.focus, .btn-default:active:focus, .btn-default:active:hover, .open>.dropdown-toggle.btn-default.focus, .open>.dropdown-toggle.btn-default:focus, .open>.dropdown-toggle.btn-default:hover { color: #333; background-color: #d4d4d4; border-color: #8c8c8c } .btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default { background-image: none } .btn-default.disabled.focus, .btn-default.disabled:focus, .btn-default.disabled:hover, .btn-default[disabled].focus, .btn-default[disabled]:focus, .btn-default[disabled]:hover, fieldset[disabled] .btn-default.focus, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:hover { background-color: #fff; border-color: #ccc } .btn-default .badge { color: #fff; background-color: #333 } .btn-primary { color: #fff; background-color: #337ab7; border-color: #2e6da4 } .btn-primary.focus, .btn-primary:focus { color: #fff; background-color: #286090; border-color: #122b40 } .btn-primary:hover { color: #fff; background-color: #286090; border-color: #204d74 } .btn-primary.active, .btn-primary:active, .open>.dropdown-toggle.btn-primary { color: #fff; background-color: #286090; border-color: #204d74 } .btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary:hover { color: #fff; background-color: #204d74; border-color: #122b40 } .btn-primary.active, .btn-primary:active, .open>.dropdown-toggle.btn-primary { background-image: none } .btn-primary.disabled.focus, .btn-primary.disabled:focus, .btn-primary.disabled:hover, .btn-primary[disabled].focus, .btn-primary[disabled]:focus, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary.focus, fieldset[disabled] .btn-primary:focus, fieldset[disabled] .btn-primary:hover { background-color: #337ab7; border-color: #2e6da4 } .btn-primary .badge { color: #337ab7; background-color: #fff } .btn-success { color: #fff; background-color: #5cb85c; border-color: #4cae4c } .btn-success.focus, .btn-success:focus { color: #fff; background-color: #449d44; border-color: #255625 } .btn-success:hover { color: #fff; background-color: #449d44; border-color: #398439 } .btn-success.active, .btn-success:active, .open>.dropdown-toggle.btn-success { color: #fff; background-color: #449d44; border-color: #398439 } .btn-success.active.focus, .btn-success.active:focus, .btn-success.active:hover, .btn-success:active.focus, .btn-success:active:focus, .btn-success:active:hover, .open>.dropdown-toggle.btn-success.focus, .open>.dropdown-toggle.btn-success:focus, .open>.dropdown-toggle.btn-success:hover { color: #fff; background-color: #398439; border-color: #255625 } .btn-success.active, .btn-success:active, .open>.dropdown-toggle.btn-success { background-image: none } .btn-success.disabled.focus, .btn-success.disabled:focus, .btn-success.disabled:hover, .btn-success[disabled].focus, .btn-success[disabled]:focus, .btn-success[disabled]:hover, fieldset[disabled] .btn-success.focus, fieldset[disabled] .btn-success:focus, fieldset[disabled] .btn-success:hover { background-color: #5cb85c; border-color: #4cae4c } .btn-success .badge { color: #5cb85c; background-color: #fff } .btn-info { color: #fff; background-color: #5bc0de; border-color: #46b8da } .btn-info.focus, .btn-info:focus { color: #fff; background-color: #31b0d5; border-color: #1b6d85 } .btn-info:hover { color: #fff; background-color: #31b0d5; border-color: #269abc } .btn-info.active, .btn-info:active, .open>.dropdown-toggle.btn-info { color: #fff; background-color: #31b0d5; border-color: #269abc } .btn-info.active.focus, .btn-info.active:focus, .btn-info.active:hover, .btn-info:active.focus, .btn-info:active:focus, .btn-info:active:hover, .open>.dropdown-toggle.btn-info.focus, .open>.dropdown-toggle.btn-info:focus, .open>.dropdown-toggle.btn-info:hover { color: #fff; background-color: #269abc; border-color: #1b6d85 } .btn-info.active, .btn-info:active, .open>.dropdown-toggle.btn-info { background-image: none } .btn-info.disabled.focus, .btn-info.disabled:focus, .btn-info.disabled:hover, .btn-info[disabled].focus, .btn-info[disabled]:focus, .btn-info[disabled]:hover, fieldset[disabled] .btn-info.focus, fieldset[disabled] .btn-info:focus, fieldset[disabled] .btn-info:hover { background-color: #5bc0de; border-color: #46b8da } .btn-info .badge { color: #5bc0de; background-color: #fff } .btn-warning { color: #fff; background-color: #f0ad4e; border-color: #eea236 } .btn-warning.focus, .btn-warning:focus { color: #fff; background-color: #ec971f; border-color: #985f0d } .btn-warning:hover { color: #fff; background-color: #ec971f; border-color: #d58512 } .btn-warning.active, .btn-warning:active, .open>.dropdown-toggle.btn-warning { color: #fff; background-color: #ec971f; border-color: #d58512 } .btn-warning.active.focus, .btn-warning.active:focus, .btn-warning.active:hover, .btn-warning:active.focus, .btn-warning:active:focus, .btn-warning:active:hover, .open>.dropdown-toggle.btn-warning.focus, .open>.dropdown-toggle.btn-warning:focus, .open>.dropdown-toggle.btn-warning:hover { color: #fff; background-color: #d58512; border-color: #985f0d } .btn-warning.active, .btn-warning:active, .open>.dropdown-toggle.btn-warning { background-image: none } .btn-warning.disabled.focus, .btn-warning.disabled:focus, .btn-warning.disabled:hover, .btn-warning[disabled].focus, .btn-warning[disabled]:focus, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning.focus, fieldset[disabled] .btn-warning:focus, fieldset[disabled] .btn-warning:hover { background-color: #f0ad4e; border-color: #eea236 } .btn-warning .badge { color: #f0ad4e; background-color: #fff } .btn-danger { color: #fff; background-color: #d9534f; border-color: #d43f3a } .btn-danger.focus, .btn-danger:focus { color: #fff; background-color: #c9302c; border-color: #761c19 } .btn-danger:hover { color: #fff; background-color: #c9302c; border-color: #ac2925 } .btn-danger.active, .btn-danger:active, .open>.dropdown-toggle.btn-danger { color: #fff; background-color: #c9302c; border-color: #ac2925 } .btn-danger.active.focus, .btn-danger.active:focus, .btn-danger.active:hover, .btn-danger:active.focus, .btn-danger:active:focus, .btn-danger:active:hover, .open>.dropdown-toggle.btn-danger.focus, .open>.dropdown-toggle.btn-danger:focus, .open>.dropdown-toggle.btn-danger:hover { color: #fff; background-color: #ac2925; border-color: #761c19 } .btn-danger.active, .btn-danger:active, .open>.dropdown-toggle.btn-danger { background-image: none } .btn-danger.disabled.focus, .btn-danger.disabled:focus, .btn-danger.disabled:hover, .btn-danger[disabled].focus, .btn-danger[disabled]:focus, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger.focus, fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger:hover { background-color: #d9534f; border-color: #d43f3a } .btn-danger .badge { color: #d9534f; background-color: #fff } .btn-link { font-weight: 400; color: #337ab7; border-radius: 0 } .btn-link, .btn-link.active, .btn-link:active, .btn-link[disabled], fieldset[disabled] .btn-link { background-color: transparent; -webkit-box-shadow: none; box-shadow: none } .btn-link, .btn-link:active, .btn-link:focus, .btn-link:hover { border-color: transparent } .btn-link:focus, .btn-link:hover { color: #23527c; text-decoration: underline; background-color: transparent } .btn-link[disabled]:focus, .btn-link[disabled]:hover, fieldset[disabled] .btn-link:focus, fieldset[disabled] .btn-link:hover { color: #777; text-decoration: none } .btn-group-lg>.btn, .btn-lg { padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px } .btn-group-sm>.btn, .btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } .btn-group-xs>.btn, .btn-xs { padding: 1px 5px; font-size: 12px; line-height: 1.5; border-radius: 3px } .btn-block { display: block; width: 100% } .btn-block+.btn-block { margin-top: 5px } input[type=button].btn-block, input[type=reset].btn-block, input[type=submit].btn-block { width: 100% } .fade { opacity: 0; -webkit-transition: opacity .15s linear; -o-transition: opacity .15s linear; transition: opacity .15s linear } .fade.in { opacity: 1 } .collapse { display: none } .collapse.in { display: block } tr.collapse.in { display: table-row } tbody.collapse.in { display: table-row-group } .collapsing { position: relative; height: 0; overflow: hidden; -webkit-transition-timing-function: ease; -o-transition-timing-function: ease; transition-timing-function: ease; -webkit-transition-duration: .35s; -o-transition-duration: .35s; transition-duration: .35s; -webkit-transition-property: height, visibility; -o-transition-property: height, visibility; transition-property: height, visibility } .caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px dashed; border-top: 4px solid\9; border-right: 4px solid transparent; border-left: 4px solid transparent } .dropdown, .dropup { position: relative } .dropdown-toggle:focus { outline: 0 } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; text-align: left; list-style: none; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); box-shadow: 0 6px 12px rgba(0, 0, 0, .175) } .dropdown-menu.pull-right { right: 0; left: auto } .dropdown-menu .divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5 } .dropdown-menu>li>a { display: block; padding: 3px 20px; clear: both; font-weight: 400; line-height: 1.42857143; color: #333; white-space: nowrap } .dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover { color: #262626; text-decoration: none; background-color: #f5f5f5 } .dropdown-menu>.active>a, .dropdown-menu>.active>a:focus, .dropdown-menu>.active>a:hover { color: #fff; text-decoration: none; background-color: #337ab7; outline: 0 } .dropdown-menu>.disabled>a, .dropdown-menu>.disabled>a:focus, .dropdown-menu>.disabled>a:hover { color: #777 } .dropdown-menu>.disabled>a:focus, .dropdown-menu>.disabled>a:hover { text-decoration: none; cursor: not-allowed; background-color: transparent; background-image: none; filter: progid: DXImageTransform.Microsoft.gradient(enabled=false) } .open>.dropdown-menu { display: block } .open>a { outline: 0 } .dropdown-menu-right { right: 0; left: auto } .dropdown-menu-left { right: auto; left: 0 } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.42857143; color: #777; white-space: nowrap } .dropdown-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 990 } .pull-right>.dropdown-menu { right: 0; left: auto } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { content: ""; border-top: 0; border-bottom: 4px dashed; border-bottom: 4px solid\9 } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 2px } @media (min-width:768px) { .navbar-right .dropdown-menu { right: 0; left: auto } .navbar-right .dropdown-menu-left { right: auto; left: 0 } } .btn-group, .btn-group-vertical { position: relative; display: inline-block; vertical-align: middle } .btn-group-vertical>.btn, .btn-group>.btn { position: relative; float: left } .btn-group-vertical>.btn.active, .btn-group-vertical>.btn:active, .btn-group-vertical>.btn:focus, .btn-group-vertical>.btn:hover, .btn-group>.btn.active, .btn-group>.btn:active, .btn-group>.btn:focus, .btn-group>.btn:hover { z-index: 2 } .btn-group .btn+.btn, .btn-group .btn+.btn-group, .btn-group .btn-group+.btn, .btn-group .btn-group+.btn-group { margin-left: -1px } .btn-toolbar { margin-left: -5px } .btn-toolbar .btn, .btn-toolbar .btn-group, .btn-toolbar .input-group { float: left } .btn-toolbar>.btn, .btn-toolbar>.btn-group, .btn-toolbar>.input-group { margin-left: 5px } .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { border-radius: 0 } .btn-group>.btn:first-child { margin-left: 0 } .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle) { border-top-right-radius: 0; border-bottom-right-radius: 0 } .btn-group>.btn:last-child:not(:first-child), .btn-group>.dropdown-toggle:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0 } .btn-group>.btn-group { float: left } .btn-group>.btn-group:not(:first-child):not(:last-child)>.btn { border-radius: 0 } .btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child, .btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle { border-top-right-radius: 0; border-bottom-right-radius: 0 } .btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child { border-top-left-radius: 0; border-bottom-left-radius: 0 } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0 } .btn-group>.btn+.dropdown-toggle { padding-right: 8px; padding-left: 8px } .btn-group>.btn-lg+.dropdown-toggle { padding-right: 12px; padding-left: 12px } .btn-group.open .dropdown-toggle { -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) } .btn-group.open .dropdown-toggle.btn-link { -webkit-box-shadow: none; box-shadow: none } .btn .caret { margin-left: 0 } .btn-lg .caret { border-width: 5px 5px 0; border-bottom-width: 0 } .dropup .btn-lg .caret { border-width: 0 5px 5px } .btn-group-vertical>.btn, .btn-group-vertical>.btn-group, .btn-group-vertical>.btn-group>.btn { display: block; float: none; width: 100%; max-width: 100% } .btn-group-vertical>.btn-group>.btn { float: none } .btn-group-vertical>.btn+.btn, .btn-group-vertical>.btn+.btn-group, .btn-group-vertical>.btn-group+.btn, .btn-group-vertical>.btn-group+.btn-group { margin-top: -1px; margin-left: 0 } .btn-group-vertical>.btn:not(:first-child):not(:last-child) { border-radius: 0 } .btn-group-vertical>.btn:first-child:not(:last-child) { border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .btn-group-vertical>.btn:last-child:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px } .btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn { border-radius: 0 } .btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child, .btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle { border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child { border-top-left-radius: 0; border-top-right-radius: 0 } .btn-group-justified { display: table; width: 100%; table-layout: fixed; border-collapse: separate } .btn-group-justified>.btn, .btn-group-justified>.btn-group { display: table-cell; float: none; width: 1% } .btn-group-justified>.btn-group .btn { width: 100% } .btn-group-justified>.btn-group .dropdown-menu { left: auto } [data-toggle=buttons]>.btn input[type=checkbox], [data-toggle=buttons]>.btn input[type=radio], [data-toggle=buttons]>.btn-group>.btn input[type=checkbox], [data-toggle=buttons]>.btn-group>.btn input[type=radio] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none } .input-group { position: relative; display: table; border-collapse: separate } .input-group[class*=col-] { float: none; padding-right: 0; padding-left: 0 } .input-group .form-control { position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0 } .input-group .form-control:focus { z-index: 3 } .input-group-lg>.form-control, .input-group-lg>.input-group-addon, .input-group-lg>.input-group-btn>.btn { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.3333333; border-radius: 6px } select.input-group-lg>.form-control, select.input-group-lg>.input-group-addon, select.input-group-lg>.input-group-btn>.btn { height: 46px; line-height: 46px } select[multiple].input-group-lg>.form-control, select[multiple].input-group-lg>.input-group-addon, select[multiple].input-group-lg>.input-group-btn>.btn, textarea.input-group-lg>.form-control, textarea.input-group-lg>.input-group-addon, textarea.input-group-lg>.input-group-btn>.btn { height: auto } .input-group-sm>.form-control, .input-group-sm>.input-group-addon, .input-group-sm>.input-group-btn>.btn { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } select.input-group-sm>.form-control, select.input-group-sm>.input-group-addon, select.input-group-sm>.input-group-btn>.btn { height: 30px; line-height: 30px } select[multiple].input-group-sm>.form-control, select[multiple].input-group-sm>.input-group-addon, select[multiple].input-group-sm>.input-group-btn>.btn, textarea.input-group-sm>.form-control, textarea.input-group-sm>.input-group-addon, textarea.input-group-sm>.input-group-btn>.btn { height: auto } .input-group .form-control, .input-group-addon, .input-group-btn { display: table-cell } .input-group .form-control:not(:first-child):not(:last-child), .input-group-addon:not(:first-child):not(:last-child), .input-group-btn:not(:first-child):not(:last-child) { border-radius: 0 } .input-group-addon, .input-group-btn { width: 1%; white-space: nowrap; vertical-align: middle } .input-group-addon { padding: 6px 12px; font-size: 14px; font-weight: 400; line-height: 1; color: #555; text-align: center; background-color: #eee; border: 1px solid #ccc; border-radius: 4px } .input-group-addon.input-sm { padding: 5px 10px; font-size: 12px; border-radius: 3px } .input-group-addon.input-lg { padding: 10px 16px; font-size: 18px; border-radius: 6px } .input-group-addon input[type=checkbox], .input-group-addon input[type=radio] { margin-top: 0 } .input-group .form-control:first-child, .input-group-addon:first-child, .input-group-btn:first-child>.btn, .input-group-btn:first-child>.btn-group>.btn, .input-group-btn:first-child>.dropdown-toggle, .input-group-btn:last-child>.btn-group:not(:last-child)>.btn, .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle) { border-top-right-radius: 0; border-bottom-right-radius: 0 } .input-group-addon:first-child { border-right: 0 } .input-group .form-control:last-child, .input-group-addon:last-child, .input-group-btn:first-child>.btn-group:not(:first-child)>.btn, .input-group-btn:first-child>.btn:not(:first-child), .input-group-btn:last-child>.btn, .input-group-btn:last-child>.btn-group>.btn, .input-group-btn:last-child>.dropdown-toggle { border-top-left-radius: 0; border-bottom-left-radius: 0 } .input-group-addon:last-child { border-left: 0 } .input-group-btn { position: relative; font-size: 0; white-space: nowrap } .input-group-btn>.btn { position: relative } .input-group-btn>.btn+.btn { margin-left: -1px } .input-group-btn>.btn:active, .input-group-btn>.btn:focus, .input-group-btn>.btn:hover { z-index: 2 } .input-group-btn:first-child>.btn, .input-group-btn:first-child>.btn-group { margin-right: -1px } .input-group-btn:last-child>.btn, .input-group-btn:last-child>.btn-group { z-index: 2; margin-left: -1px } .nav { padding-left: 0; margin-bottom: 0; list-style: none } .nav>li { position: relative; display: block } .nav>li>a { position: relative; display: block; padding: 10px 15px } .nav>li>a:focus, .nav>li>a:hover { text-decoration: none; background-color: #eee } .nav>li.disabled>a { color: #777 } .nav>li.disabled>a:focus, .nav>li.disabled>a:hover { color: #777; text-decoration: none; cursor: not-allowed; background-color: transparent } .nav .open>a, .nav .open>a:focus, .nav .open>a:hover { background-color: #eee; border-color: #337ab7 } .nav .nav-divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5 } .nav>li>a>img { max-width: none } .nav-tabs { border-bottom: 1px solid #ddd } .nav-tabs>li { float: left; margin-bottom: -1px } .nav-tabs>li>a { margin-right: 2px; line-height: 1.42857143; border: 1px solid transparent; border-radius: 4px 4px 0 0 } .nav-tabs>li>a:hover { border-color: #eee #eee #ddd } .nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover { color: #555; cursor: default; background-color: #fff; border: 1px solid #ddd; border-bottom-color: transparent } .nav-tabs.nav-justified { width: 100%; border-bottom: 0 } .nav-tabs.nav-justified>li { float: none } .nav-tabs.nav-justified>li>a { margin-bottom: 5px; text-align: center } .nav-tabs.nav-justified>.dropdown .dropdown-menu { top: auto; left: auto } @media (min-width:768px) { .nav-tabs.nav-justified>li { display: table-cell; width: 1% } .nav-tabs.nav-justified>li>a { margin-bottom: 0 } } .nav-tabs.nav-justified>li>a { margin-right: 0; border-radius: 4px } .nav-tabs.nav-justified>.active>a, .nav-tabs.nav-justified>.active>a:focus, .nav-tabs.nav-justified>.active>a:hover { border: 1px solid #ddd } @media (min-width:768px) { .nav-tabs.nav-justified>li>a { border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0 } .nav-tabs.nav-justified>.active>a, .nav-tabs.nav-justified>.active>a:focus, .nav-tabs.nav-justified>.active>a:hover { border-bottom-color: #fff } } .nav-pills>li { float: left } .nav-pills>li>a { border-radius: 4px } .nav-pills>li+li { margin-left: 2px } .nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover { color: #fff; background-color: #337ab7 } .nav-stacked>li { float: none } .nav-stacked>li+li { margin-top: 2px; margin-left: 0 } .nav-justified { width: 100% } .nav-justified>li { float: none } .nav-justified>li>a { margin-bottom: 5px; text-align: center } .nav-justified>.dropdown .dropdown-menu { top: auto; left: auto } @media (min-width:768px) { .nav-justified>li { display: table-cell; width: 1% } .nav-justified>li>a { margin-bottom: 0 } } .nav-tabs-justified { border-bottom: 0 } .nav-tabs-justified>li>a { margin-right: 0; border-radius: 4px } .nav-tabs-justified>.active>a, .nav-tabs-justified>.active>a:focus, .nav-tabs-justified>.active>a:hover { border: 1px solid #ddd } @media (min-width:768px) { .nav-tabs-justified>li>a { border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0 } .nav-tabs-justified>.active>a, .nav-tabs-justified>.active>a:focus, .nav-tabs-justified>.active>a:hover { border-bottom-color: #fff } } .tab-content>.tab-pane { display: none } .tab-content>.active { display: block } .nav-tabs .dropdown-menu { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0 } .navbar { position: relative; min-height: 50px; margin-bottom: 20px; border: 1px solid transparent } @media (min-width:768px) { .navbar { border-radius: 4px } } @media (min-width:768px) { .navbar-header { float: left } } .navbar-collapse { padding-right: 15px; padding-left: 15px; overflow-x: visible; -webkit-overflow-scrolling: touch; border-top: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1) } .navbar-collapse.in { overflow-y: auto } @media (min-width:768px) { .navbar-collapse { width: auto; border-top: 0; -webkit-box-shadow: none; box-shadow: none } .navbar-collapse.collapse { display: block!important; height: auto!important; padding-bottom: 0; overflow: visible!important } .navbar-collapse.in { overflow-y: visible } .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse { padding-right: 0; padding-left: 0 } } .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse { max-height: 340px } @media (max-device-width:480px) and (orientation:landscape) { .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse { max-height: 200px } } .container-fluid>.navbar-collapse, .container-fluid>.navbar-header, .container>.navbar-collapse, .container>.navbar-header { margin-right: -15px; margin-left: -15px } @media (min-width:768px) { .container-fluid>.navbar-collapse, .container-fluid>.navbar-header, .container>.navbar-collapse, .container>.navbar-header { margin-right: 0; margin-left: 0 } } .navbar-static-top { z-index: 1000; border-width: 0 0 1px } @media (min-width:768px) { .navbar-static-top { border-radius: 0 } } .navbar-fixed-bottom, .navbar-fixed-top { position: fixed; right: 0; left: 0; z-index: 1030 } @media (min-width:768px) { .navbar-fixed-bottom, .navbar-fixed-top { border-radius: 0 } } .navbar-fixed-top { top: 0; border-width: 0 0 1px } .navbar-fixed-bottom { bottom: 0; margin-bottom: 0; border-width: 1px 0 0 } .navbar-brand { float: left; height: 50px; padding: 15px 15px; font-size: 18px; line-height: 20px } .navbar-brand:focus, .navbar-brand:hover { text-decoration: none } .navbar-brand>img { display: block } @media (min-width:768px) { .navbar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand { margin-left: -15px } } .navbar-toggle { position: relative; float: right; padding: 9px 10px; margin-top: 8px; margin-right: 15px; margin-bottom: 8px; background-color: transparent; background-image: none; border: 1px solid transparent; border-radius: 4px } .navbar-toggle:focus { outline: 0 } .navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; border-radius: 1px } .navbar-toggle .icon-bar+.icon-bar { margin-top: 4px } @media (min-width:768px) { .navbar-toggle { display: none } } .navbar-nav { margin: 7.5px -15px } .navbar-nav>li>a { padding-top: 10px; padding-bottom: 10px; line-height: 20px } @media (max-width:767px) { .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; -webkit-box-shadow: none; box-shadow: none } .navbar-nav .open .dropdown-menu .dropdown-header, .navbar-nav .open .dropdown-menu>li>a { padding: 5px 15px 5px 25px } .navbar-nav .open .dropdown-menu>li>a { line-height: 20px } .navbar-nav .open .dropdown-menu>li>a:focus, .navbar-nav .open .dropdown-menu>li>a:hover { background-image: none } } @media (min-width:768px) { .navbar-nav { float: left; margin: 0 } .navbar-nav>li { float: left } .navbar-nav>li>a { padding-top: 15px; padding-bottom: 15px } } .navbar-form { padding: 10px 15px; margin-top: 8px; margin-right: -15px; margin-bottom: 8px; margin-left: -15px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1) } @media (min-width:768px) { .navbar-form .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle } .navbar-form .form-control { display: inline-block; width: auto; vertical-align: middle } .navbar-form .form-control-static { display: inline-block } .navbar-form .input-group { display: inline-table; vertical-align: middle } .navbar-form .input-group .form-control, .navbar-form .input-group .input-group-addon, .navbar-form .input-group .input-group-btn { width: auto } .navbar-form .input-group>.form-control { width: 100% } .navbar-form .control-label { margin-bottom: 0; vertical-align: middle } .navbar-form .checkbox, .navbar-form .radio { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle } .navbar-form .checkbox label, .navbar-form .radio label { padding-left: 0 } .navbar-form .checkbox input[type=checkbox], .navbar-form .radio input[type=radio] { position: relative; margin-left: 0 } .navbar-form .has-feedback .form-control-feedback { top: 0 } } @media (max-width:767px) { .navbar-form .form-group { margin-bottom: 5px } .navbar-form .form-group:last-child { margin-bottom: 0 } } @media (min-width:768px) { .navbar-form { width: auto; padding-top: 0; padding-bottom: 0; margin-right: 0; margin-left: 0; border: 0; -webkit-box-shadow: none; box-shadow: none } } .navbar-nav>li>.dropdown-menu { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0 } .navbar-fixed-bottom .navbar-nav>li>.dropdown-menu { margin-bottom: 0; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .navbar-btn { margin-top: 8px; margin-bottom: 8px } .navbar-btn.btn-sm { margin-top: 10px; margin-bottom: 10px } .navbar-btn.btn-xs { margin-top: 14px; margin-bottom: 14px } .navbar-text { margin-top: 15px; margin-bottom: 15px } @media (min-width:768px) { .navbar-text { float: left; margin-right: 15px; margin-left: 15px } } @media (min-width:768px) { .navbar-left { float: left!important } .navbar-right { float: right!important; margin-right: -15px } .navbar-right~.navbar-right { margin-right: 0 } } .navbar-default { background-color: #f8f8f8; /* border-color: #e7e7e7*/ } .navbar-default .navbar-brand { color: #777 } .navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover { color: #5e5e5e; background-color: transparent } .navbar-default .navbar-text { color: #777 } .navbar-default .navbar-nav>li>a { color: #777 } .navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover { color: #333; background-color: transparent } .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:focus, .navbar-default .navbar-nav>.active>a:hover { color: #555; /*background-color: #e7e7e7*/ } .navbar-default .navbar-nav>.disabled>a, .navbar-default .navbar-nav>.disabled>a:focus, .navbar-default .navbar-nav>.disabled>a:hover { color: #ccc; background-color: transparent } .navbar-default .navbar-toggle { border-color: #ddd } .navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover { background-color: #ddd } .navbar-default .navbar-toggle .icon-bar { background-color: #888 } .navbar-default .navbar-collapse, .navbar-default .navbar-form { border-color: #e7e7e7 } .navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover { color: #555; /*background-color: #e7e7e7*/ } @media (max-width:767px) { .navbar-default .navbar-nav .open .dropdown-menu>li>a { color: #777 } .navbar-default .navbar-nav .open .dropdown-menu>li>a:focus, .navbar-default .navbar-nav .open .dropdown-menu>li>a:hover { color: #333; background-color: transparent } .navbar-default .navbar-nav .open .dropdown-menu>.active>a, .navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus, .navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover { color: #555; /*background-color: #e7e7e7*/ } .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a, .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus, .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover { color: #ccc; background-color: transparent } } .navbar-default .navbar-link { color: #777 } .navbar-default .navbar-link:hover { color: #333 } .navbar-default .btn-link { color: #777 } .navbar-default .btn-link:focus, .navbar-default .btn-link:hover { color: #333 } .navbar-default .btn-link[disabled]:focus, .navbar-default .btn-link[disabled]:hover, fieldset[disabled] .navbar-default .btn-link:focus, fieldset[disabled] .navbar-default .btn-link:hover { color: #ccc } .navbar-inverse { background-color: #222; border-color: #080808 } .navbar-inverse .navbar-brand { color: #9d9d9d } .navbar-inverse .navbar-brand:focus, .navbar-inverse .navbar-brand:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-text { color: #9d9d9d } .navbar-inverse .navbar-nav>li>a { color: #9d9d9d } .navbar-inverse .navbar-nav>li>a:focus, .navbar-inverse .navbar-nav>li>a:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover { color: #fff; background-color: #080808 } .navbar-inverse .navbar-nav>.disabled>a, .navbar-inverse .navbar-nav>.disabled>a:focus, .navbar-inverse .navbar-nav>.disabled>a:hover { color: #444; background-color: transparent } .navbar-inverse .navbar-toggle { border-color: #333 } .navbar-inverse .navbar-toggle:focus, .navbar-inverse .navbar-toggle:hover { background-color: #333 } .navbar-inverse .navbar-toggle .icon-bar { background-color: #fff } .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { border-color: #101010 } .navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:focus, .navbar-inverse .navbar-nav>.open>a:hover { color: #fff; background-color: #080808 } @media (max-width:767px) { .navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header { border-color: #080808 } .navbar-inverse .navbar-nav .open .dropdown-menu .divider { background-color: #080808 } .navbar-inverse .navbar-nav .open .dropdown-menu>li>a { color: #9d9d9d } .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a, .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover { color: #fff; background-color: #080808 } .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a, .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover { color: #444; background-color: transparent } } .navbar-inverse .navbar-link { color: #9d9d9d } .navbar-inverse .navbar-link:hover { color: #fff } .navbar-inverse .btn-link { color: #9d9d9d } .navbar-inverse .btn-link:focus, .navbar-inverse .btn-link:hover { color: #fff } .navbar-inverse .btn-link[disabled]:focus, .navbar-inverse .btn-link[disabled]:hover, fieldset[disabled] .navbar-inverse .btn-link:focus, fieldset[disabled] .navbar-inverse .btn-link:hover { color: #444 } .breadcrumb { padding: 8px 15px; margin-bottom: 20px; list-style: none; background-color: #f5f5f5; border-radius: 4px } .breadcrumb>li { display: inline-block } .breadcrumb>li+li:before { padding: 0 5px; color: #ccc; content: "/\00a0" } .breadcrumb>.active { color: #777 } .pagination { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px } .pagination>li { display: inline } .pagination>li>a, .pagination>li>span { position: relative; float: left; padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; color: #337ab7; text-decoration: none; background-color: #fff; border: 1px solid #ddd } .pagination>li:first-child>a, .pagination>li:first-child>span { margin-left: 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px } .pagination>li:last-child>a, .pagination>li:last-child>span { border-top-right-radius: 4px; border-bottom-right-radius: 4px } .pagination>li>a:focus, .pagination>li>a:hover, .pagination>li>span:focus, .pagination>li>span:hover { z-index: 2; color: #23527c; background-color: #eee; border-color: #ddd } .pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover { z-index: 3; color: #fff; cursor: default; background-color: #337ab7; border-color: #337ab7 } .pagination>.disabled>a, .pagination>.disabled>a:focus, .pagination>.disabled>a:hover, .pagination>.disabled>span, .pagination>.disabled>span:focus, .pagination>.disabled>span:hover { color: #777; cursor: not-allowed; background-color: #fff; border-color: #ddd } .pagination-lg>li>a, .pagination-lg>li>span { padding: 10px 16px; font-size: 18px; line-height: 1.3333333 } .pagination-lg>li:first-child>a, .pagination-lg>li:first-child>span { border-top-left-radius: 6px; border-bottom-left-radius: 6px } .pagination-lg>li:last-child>a, .pagination-lg>li:last-child>span { border-top-right-radius: 6px; border-bottom-right-radius: 6px } .pagination-sm>li>a, .pagination-sm>li>span { padding: 5px 10px; font-size: 12px; line-height: 1.5 } .pagination-sm>li:first-child>a, .pagination-sm>li:first-child>span { border-top-left-radius: 3px; border-bottom-left-radius: 3px } .pagination-sm>li:last-child>a, .pagination-sm>li:last-child>span { border-top-right-radius: 3px; border-bottom-right-radius: 3px } .pager { padding-left: 0; margin: 20px 0; text-align: center; list-style: none } .pager li { display: inline } .pager li>a, .pager li>span { display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; border-radius: 15px } .pager li>a:focus, .pager li>a:hover { text-decoration: none; background-color: #eee } .pager .next>a, .pager .next>span { float: right } .pager .previous>a, .pager .previous>span { float: left } .pager .disabled>a, .pager .disabled>a:focus, .pager .disabled>a:hover, .pager .disabled>span { color: #777; cursor: not-allowed; background-color: #fff } .label { display: inline; padding: .2em .6em .3em; font-size: 75%; font-weight: 700; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25em } a.label:focus, a.label:hover { color: #fff; text-decoration: none; cursor: pointer } .label:empty { display: none } .btn .label { position: relative; top: -1px } .label-default { background-color: #777 } .label-default[href]:focus, .label-default[href]:hover { background-color: #5e5e5e } .label-primary { background-color: #337ab7 } .label-primary[href]:focus, .label-primary[href]:hover { background-color: #286090 } .label-success { background-color: #5cb85c } .label-success[href]:focus, .label-success[href]:hover { background-color: #449d44 } .label-info { background-color: #5bc0de } .label-info[href]:focus, .label-info[href]:hover { background-color: #31b0d5 } .label-warning { background-color: #f0ad4e } .label-warning[href]:focus, .label-warning[href]:hover { background-color: #ec971f } .label-danger { background-color: #d9534f } .label-danger[href]:focus, .label-danger[href]:hover { background-color: #c9302c } .badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 12px; font-weight: 700; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: middle; background-color: #777; border-radius: 10px } .badge:empty { display: none } .btn .badge { position: relative; top: -1px } .btn-group-xs>.btn .badge, .btn-xs .badge { top: 0; padding: 1px 5px } a.badge:focus, a.badge:hover { color: #fff; text-decoration: none; cursor: pointer } .list-group-item.active>.badge, .nav-pills>.active>a>.badge { color: #337ab7; background-color: #fff } .list-group-item>.badge { float: right } .list-group-item>.badge+.badge { margin-right: 5px } .nav-pills>li>a>.badge { margin-left: 3px } .jumbotron { padding-top: 30px; padding-bottom: 30px; margin-bottom: 30px; color: inherit; background-color: #eee } .jumbotron .h1, .jumbotron h1 { color: inherit } .jumbotron p { margin-bottom: 15px; font-size: 21px; font-weight: 200 } .jumbotron>hr { border-top-color: #d5d5d5 } .container .jumbotron, .container-fluid .jumbotron { padding-right: 15px; padding-left: 15px; border-radius: 6px } .jumbotron .container { max-width: 100% } @media screen and (min-width:768px) { .jumbotron { padding-top: 48px; padding-bottom: 48px } .container .jumbotron, .container-fluid .jumbotron { padding-right: 60px; padding-left: 60px } .jumbotron .h1, .jumbotron h1 { font-size: 63px } } .thumbnail { display: block; padding: 4px; margin-bottom: 20px; line-height: 1.42857143; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: border .2s ease-in-out; -o-transition: border .2s ease-in-out; transition: border .2s ease-in-out } .thumbnail a>img, .thumbnail>img { margin-right: auto; margin-left: auto } a.thumbnail.active, a.thumbnail:focus, a.thumbnail:hover { border-color: #337ab7 } .thumbnail .caption { padding: 9px; color: #333 } .alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px } .alert h4 { margin-top: 0; color: inherit } .alert .alert-link { font-weight: 700 } .alert>p, .alert>ul { margin-bottom: 0 } .alert>p+p { margin-top: 5px } .alert-dismissable, .alert-dismissible { padding-right: 35px } .alert-dismissable .close, .alert-dismissible .close { position: relative; top: -2px; right: -21px; color: inherit } .alert-success { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6 } .alert-success hr { border-top-color: #c9e2b3 } .alert-success .alert-link { color: #2b542c } .alert-info { color: #31708f; background-color: #d9edf7; border-color: #bce8f1 } .alert-info hr { border-top-color: #a6e1ec } .alert-info .alert-link { color: #245269 } .alert-warning { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc } .alert-warning hr { border-top-color: #f7e1b5 } .alert-warning .alert-link { color: #66512c } .alert-danger { color: #a94442; background-color: #f2dede; border-color: #ebccd1 } .alert-danger hr { border-top-color: #e4b9c0 } .alert-danger .alert-link { color: #843534 } @-webkit-keyframes progress-bar-stripes { from { background-position: 40px 0 } to { background-position: 0 0 } } @-o-keyframes progress-bar-stripes { from { background-position: 40px 0 } to { background-position: 0 0 } } @keyframes progress-bar-stripes { from { background-position: 40px 0 } to { background-position: 0 0 } } .progress { height: 20px; margin-bottom: 20px; overflow: hidden; background-color: #f5f5f5; border-radius: 4px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1) } .progress-bar { float: left; width: 0; height: 100%; font-size: 12px; line-height: 20px; color: #fff; text-align: center; background-color: #337ab7; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); -webkit-transition: width .6s ease; -o-transition: width .6s ease; transition: width .6s ease } .progress-bar-striped, .progress-striped .progress-bar { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; background-size: 40px 40px } .progress-bar.active, .progress.active .progress-bar { -webkit-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite } .progress-bar-success { background-color: #5cb85c } .progress-striped .progress-bar-success { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) } .progress-bar-info { background-color: #5bc0de } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) } .progress-bar-warning { background-color: #f0ad4e } .progress-striped .progress-bar-warning { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) } .progress-bar-danger { background-color: #d9534f } .progress-striped .progress-bar-danger { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) } .media { margin-top: 15px } .media:first-child { margin-top: 0 } .media, .media-body { overflow: hidden; zoom: 1 } .media-body { width: 10000px } .media-object { display: block } .media-object.img-thumbnail { max-width: none } .media-right, .media>.pull-right { padding-left: 10px } .media-left, .media>.pull-left { padding-right: 10px } .media-body, .media-left, .media-right { display: table-cell; vertical-align: top } .media-middle { vertical-align: middle } .media-bottom { vertical-align: bottom } .media-heading { margin-top: 0; margin-bottom: 5px } .media-list { padding-left: 0; list-style: none } .list-group { padding-left: 0; margin-bottom: 20px } .list-group-item { position: relative; display: block; padding: 10px 15px; margin-bottom: -1px; background-color: #fff; border: 1px solid #ddd } .list-group-item:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px } .list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px } a.list-group-item, button.list-group-item { color: #555 } a.list-group-item .list-group-item-heading, button.list-group-item .list-group-item-heading { color: #333 } a.list-group-item:focus, a.list-group-item:hover, button.list-group-item:focus, button.list-group-item:hover { color: #555; text-decoration: none; background-color: #f5f5f5 } button.list-group-item { width: 100%; text-align: left } .list-group-item.disabled, .list-group-item.disabled:focus, .list-group-item.disabled:hover { color: #777; cursor: not-allowed; background-color: #eee } .list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading { color: inherit } .list-group-item.disabled .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text { color: #777 } .list-group-item.active, .list-group-item.active:focus, .list-group-item.active:hover { z-index: 2; color: #fff; background-color: #337ab7; border-color: #337ab7 } .list-group-item.active .list-group-item-heading, .list-group-item.active .list-group-item-heading>.small, .list-group-item.active .list-group-item-heading>small, .list-group-item.active:focus .list-group-item-heading, .list-group-item.active:focus .list-group-item-heading>.small, .list-group-item.active:focus .list-group-item-heading>small, .list-group-item.active:hover .list-group-item-heading, .list-group-item.active:hover .list-group-item-heading>.small, .list-group-item.active:hover .list-group-item-heading>small { color: inherit } .list-group-item.active .list-group-item-text, .list-group-item.active:focus .list-group-item-text, .list-group-item.active:hover .list-group-item-text { color: #c7ddef } .list-group-item-success { color: #3c763d; background-color: #dff0d8 } a.list-group-item-success, button.list-group-item-success { color: #3c763d } a.list-group-item-success .list-group-item-heading, button.list-group-item-success .list-group-item-heading { color: inherit } a.list-group-item-success:focus, a.list-group-item-success:hover, button.list-group-item-success:focus, button.list-group-item-success:hover { color: #3c763d; background-color: #d0e9c6 } a.list-group-item-success.active, a.list-group-item-success.active:focus, a.list-group-item-success.active:hover, button.list-group-item-success.active, button.list-group-item-success.active:focus, button.list-group-item-success.active:hover { color: #fff; background-color: #3c763d; border-color: #3c763d } .list-group-item-info { color: #31708f; background-color: #d9edf7 } a.list-group-item-info, button.list-group-item-info { color: #31708f } a.list-group-item-info .list-group-item-heading, button.list-group-item-info .list-group-item-heading { color: inherit } a.list-group-item-info:focus, a.list-group-item-info:hover, button.list-group-item-info:focus, button.list-group-item-info:hover { color: #31708f; background-color: #c4e3f3 } a.list-group-item-info.active, a.list-group-item-info.active:focus, a.list-group-item-info.active:hover, button.list-group-item-info.active, button.list-group-item-info.active:focus, button.list-group-item-info.active:hover { color: #fff; background-color: #31708f; border-color: #31708f } .list-group-item-warning { color: #8a6d3b; background-color: #fcf8e3 } a.list-group-item-warning, button.list-group-item-warning { color: #8a6d3b } a.list-group-item-warning .list-group-item-heading, button.list-group-item-warning .list-group-item-heading { color: inherit } a.list-group-item-warning:focus, a.list-group-item-warning:hover, button.list-group-item-warning:focus, button.list-group-item-warning:hover { color: #8a6d3b; background-color: #faf2cc } a.list-group-item-warning.active, a.list-group-item-warning.active:focus, a.list-group-item-warning.active:hover, button.list-group-item-warning.active, button.list-group-item-warning.active:focus, button.list-group-item-warning.active:hover { color: #fff; background-color: #8a6d3b; border-color: #8a6d3b } .list-group-item-danger { color: #a94442; background-color: #f2dede } a.list-group-item-danger, button.list-group-item-danger { color: #a94442 } a.list-group-item-danger .list-group-item-heading, button.list-group-item-danger .list-group-item-heading { color: inherit } a.list-group-item-danger:focus, a.list-group-item-danger:hover, button.list-group-item-danger:focus, button.list-group-item-danger:hover { color: #a94442; background-color: #ebcccc } a.list-group-item-danger.active, a.list-group-item-danger.active:focus, a.list-group-item-danger.active:hover, button.list-group-item-danger.active, button.list-group-item-danger.active:focus, button.list-group-item-danger.active:hover { color: #fff; background-color: #a94442; border-color: #a94442 } .list-group-item-heading { margin-top: 0; margin-bottom: 5px } .list-group-item-text { margin-bottom: 0; line-height: 1.3 } .panel { margin-bottom: 20px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); box-shadow: 0 1px 1px rgba(0, 0, 0, .05) } .panel-body { padding: 15px } .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px } .panel-heading>.dropdown .dropdown-toggle { color: inherit } .panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit } .panel-title>.small, .panel-title>.small>a, .panel-title>a, .panel-title>small, .panel-title>small>a { color: inherit } .panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #ddd; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel>.list-group, .panel>.panel-collapse>.list-group { margin-bottom: 0 } .panel>.list-group .list-group-item, .panel>.panel-collapse>.list-group .list-group-item { border-width: 1px 0; border-radius: 0 } .panel>.list-group:first-child .list-group-item:first-child, .panel>.panel-collapse>.list-group:first-child .list-group-item:first-child { border-top: 0; border-top-left-radius: 3px; border-top-right-radius: 3px } .panel>.list-group:last-child .list-group-item:last-child, .panel>.panel-collapse>.list-group:last-child .list-group-item:last-child { border-bottom: 0; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child { border-top-left-radius: 0; border-top-right-radius: 0 } .panel-heading+.list-group .list-group-item:first-child { border-top-width: 0 } .list-group+.panel-footer { border-top-width: 0 } .panel>.panel-collapse>.table, .panel>.table, .panel>.table-responsive>.table { margin-bottom: 0 } .panel>.panel-collapse>.table caption, .panel>.table caption, .panel>.table-responsive>.table caption { padding-right: 15px; padding-left: 15px } .panel>.table-responsive:first-child>.table:first-child, .panel>.table:first-child { border-top-left-radius: 3px; border-top-right-radius: 3px } .panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child, .panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child, .panel>.table:first-child>tbody:first-child>tr:first-child, .panel>.table:first-child>thead:first-child>tr:first-child { border-top-left-radius: 3px; border-top-right-radius: 3px } .panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child, .panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child, .panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child, .panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child, .panel>.table:first-child>tbody:first-child>tr:first-child td:first-child, .panel>.table:first-child>tbody:first-child>tr:first-child th:first-child, .panel>.table:first-child>thead:first-child>tr:first-child td:first-child, .panel>.table:first-child>thead:first-child>tr:first-child th:first-child { border-top-left-radius: 3px } .panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child, .panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child, .panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child, .panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child, .panel>.table:first-child>tbody:first-child>tr:first-child td:last-child, .panel>.table:first-child>tbody:first-child>tr:first-child th:last-child, .panel>.table:first-child>thead:first-child>tr:first-child td:last-child, .panel>.table:first-child>thead:first-child>tr:first-child th:last-child { border-top-right-radius: 3px } .panel>.table-responsive:last-child>.table:last-child, .panel>.table:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child, .panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child, .panel>.table:last-child>tbody:last-child>tr:last-child, .panel>.table:last-child>tfoot:last-child>tr:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child, .panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child, .panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child, .panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child, .panel>.table:last-child>tbody:last-child>tr:last-child td:first-child, .panel>.table:last-child>tbody:last-child>tr:last-child th:first-child, .panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child, .panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child { border-bottom-left-radius: 3px } .panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child, .panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child, .panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child, .panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child, .panel>.table:last-child>tbody:last-child>tr:last-child td:last-child, .panel>.table:last-child>tbody:last-child>tr:last-child th:last-child, .panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child, .panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child { border-bottom-right-radius: 3px } .panel>.panel-body+.table, .panel>.panel-body+.table-responsive, .panel>.table+.panel-body, .panel>.table-responsive+.panel-body { border-top: 1px solid #ddd } .panel>.table>tbody:first-child>tr:first-child td, .panel>.table>tbody:first-child>tr:first-child th { border-top: 0 } .panel>.table-bordered, .panel>.table-responsive>.table-bordered { border: 0 } .panel>.table-bordered>tbody>tr>td:first-child, .panel>.table-bordered>tbody>tr>th:first-child, .panel>.table-bordered>tfoot>tr>td:first-child, .panel>.table-bordered>tfoot>tr>th:first-child, .panel>.table-bordered>thead>tr>td:first-child, .panel>.table-bordered>thead>tr>th:first-child, .panel>.table-responsive>.table-bordered>tbody>tr>td:first-child, .panel>.table-responsive>.table-bordered>tbody>tr>th:first-child, .panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child, .panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child, .panel>.table-responsive>.table-bordered>thead>tr>td:first-child, .panel>.table-responsive>.table-bordered>thead>tr>th:first-child { border-left: 0 } .panel>.table-bordered>tbody>tr>td:last-child, .panel>.table-bordered>tbody>tr>th:last-child, .panel>.table-bordered>tfoot>tr>td:last-child, .panel>.table-bordered>tfoot>tr>th:last-child, .panel>.table-bordered>thead>tr>td:last-child, .panel>.table-bordered>thead>tr>th:last-child, .panel>.table-responsive>.table-bordered>tbody>tr>td:last-child, .panel>.table-responsive>.table-bordered>tbody>tr>th:last-child, .panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child, .panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child, .panel>.table-responsive>.table-bordered>thead>tr>td:last-child, .panel>.table-responsive>.table-bordered>thead>tr>th:last-child { border-right: 0 } .panel>.table-bordered>tbody>tr:first-child>td, .panel>.table-bordered>tbody>tr:first-child>th, .panel>.table-bordered>thead>tr:first-child>td, .panel>.table-bordered>thead>tr:first-child>th, .panel>.table-responsive>.table-bordered>tbody>tr:first-child>td, .panel>.table-responsive>.table-bordered>tbody>tr:first-child>th, .panel>.table-responsive>.table-bordered>thead>tr:first-child>td, .panel>.table-responsive>.table-bordered>thead>tr:first-child>th { border-bottom: 0 } .panel>.table-bordered>tbody>tr:last-child>td, .panel>.table-bordered>tbody>tr:last-child>th, .panel>.table-bordered>tfoot>tr:last-child>td, .panel>.table-bordered>tfoot>tr:last-child>th, .panel>.table-responsive>.table-bordered>tbody>tr:last-child>td, .panel>.table-responsive>.table-bordered>tbody>tr:last-child>th, .panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td, .panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th { border-bottom: 0 } .panel>.table-responsive { margin-bottom: 0; border: 0 } .panel-group { margin-bottom: 20px } .panel-group .panel { margin-bottom: 0; border-radius: 4px } .panel-group .panel+.panel { margin-top: 5px } .panel-group .panel-heading { border-bottom: 0 } .panel-group .panel-heading+.panel-collapse>.list-group, .panel-group .panel-heading+.panel-collapse>.panel-body { border-top: 1px solid #ddd } .panel-group .panel-footer { border-top: 0 } .panel-group .panel-footer+.panel-collapse .panel-body { border-bottom: 1px solid #ddd } .panel-default { border-color: #ddd } .panel-default>.panel-heading { color: #333; background-color: #f5f5f5; border-color: #ddd } .panel-default>.panel-heading+.panel-collapse>.panel-body { border-top-color: #ddd } .panel-default>.panel-heading .badge { color: #f5f5f5; background-color: #333 } .panel-default>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #ddd } .panel-primary { border-color: #337ab7 } .panel-primary>.panel-heading { color: #fff; background-color: #337ab7; border-color: #337ab7 } .panel-primary>.panel-heading+.panel-collapse>.panel-body { border-top-color: #337ab7 } .panel-primary>.panel-heading .badge { color: #337ab7; background-color: #fff } .panel-primary>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #337ab7 } .panel-success { border-color: #d6e9c6 } .panel-success>.panel-heading { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6 } .panel-success>.panel-heading+.panel-collapse>.panel-body { border-top-color: #d6e9c6 } .panel-success>.panel-heading .badge { color: #dff0d8; background-color: #3c763d } .panel-success>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #d6e9c6 } .panel-info { border-color: #bce8f1 } .panel-info>.panel-heading { color: #31708f; background-color: #d9edf7; border-color: #bce8f1 } .panel-info>.panel-heading+.panel-collapse>.panel-body { border-top-color: #bce8f1 } .panel-info>.panel-heading .badge { color: #d9edf7; background-color: #31708f } .panel-info>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #bce8f1 } .panel-warning { border-color: #faebcc } .panel-warning>.panel-heading { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc } .panel-warning>.panel-heading+.panel-collapse>.panel-body { border-top-color: #faebcc } .panel-warning>.panel-heading .badge { color: #fcf8e3; background-color: #8a6d3b } .panel-warning>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #faebcc } .panel-danger { border-color: #ebccd1 } .panel-danger>.panel-heading { color: #a94442; background-color: #f2dede; border-color: #ebccd1 } .panel-danger>.panel-heading+.panel-collapse>.panel-body { border-top-color: #ebccd1 } .panel-danger>.panel-heading .badge { color: #f2dede; background-color: #a94442 } .panel-danger>.panel-footer+.panel-collapse>.panel-body { border-bottom-color: #ebccd1 } .embed-responsive { position: relative; display: block; height: 0; padding: 0; overflow: hidden } .embed-responsive .embed-responsive-item, .embed-responsive embed, .embed-responsive iframe, .embed-responsive object, .embed-responsive video { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; height: 100%; border: 0 } .embed-responsive-16by9 { padding-bottom: 56.25% } .embed-responsive-4by3 { padding-bottom: 75% } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05) } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, .15) } .well-lg { padding: 24px; border-radius: 6px } .well-sm { padding: 9px; border-radius: 3px } .close { float: right; font-size: 21px; font-weight: 700; line-height: 1; color: #000; text-shadow: 0 1px 0 #fff; filter: alpha(opacity=20); opacity: .2 } .close:focus, .close:hover { color: #000; text-decoration: none; cursor: pointer; filter: alpha(opacity=50); opacity: .5 } button.close { -webkit-appearance: none; padding: 0; cursor: pointer; background: 0 0; border: 0 } .modal-open { overflow: hidden } .modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; display: none; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0 } .modal.fade .modal-dialog { -webkit-transition: -webkit-transform .3s ease-out; -o-transition: -o-transform .3s ease-out; transition: transform .3s ease-out; -webkit-transform: translate(0, -25%); -ms-transform: translate(0, -25%); -o-transform: translate(0, -25%); transform: translate(0, -25%) } .modal.in .modal-dialog { -webkit-transform: translate(0, 0); -ms-transform: translate(0, 0); -o-transform: translate(0, 0); transform: translate(0, 0) } .modal-open .modal { overflow-x: hidden; overflow-y: auto } .modal-dialog { position: relative; width: auto; margin: 10px } .modal-content { position: relative; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; outline: 0; -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5); box-shadow: 0 3px 9px rgba(0, 0, 0, .5) } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000 } .modal-backdrop.fade { filter: alpha(opacity=0); opacity: 0 } .modal-backdrop.in { filter: alpha(opacity=50); opacity: .5 } .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5 } .modal-header .close { margin-top: -2px } .modal-title { margin: 0; line-height: 1.42857143 } .modal-body { position: relative; padding: 15px } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5 } .modal-footer .btn+.btn { margin-bottom: 0; margin-left: 5px } .modal-footer .btn-group .btn+.btn { margin-left: -1px } .modal-footer .btn-block+.btn-block { margin-left: 0 } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll } @media (min-width:768px) { .modal-dialog { width: 600px; margin: 30px auto } .modal-content { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); box-shadow: 0 5px 15px rgba(0, 0, 0, .5) } .modal-sm { width: 300px } } @media (min-width:992px) { .modal-lg { width: 900px } } .tooltip { position: absolute; z-index: 1070; display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; font-style: normal; font-weight: 400; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; letter-spacing: normal; word-break: normal; word-spacing: normal; word-wrap: normal; white-space: normal; filter: alpha(opacity=0); opacity: 0; line-break: auto } .tooltip.in { filter: alpha(opacity=90); opacity: .9 } .tooltip.top { padding: 5px 0; margin-top: -3px } .tooltip.right { padding: 0 5px; margin-left: 3px } .tooltip.bottom { padding: 5px 0; margin-top: 3px } .tooltip.left { padding: 0 5px; margin-left: -3px } .tooltip-inner { max-width: 200px; padding: 3px 8px; color: #fff; text-align: center; background-color: #000; border-radius: 4px } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000 } .tooltip.top-left .tooltip-arrow { right: 5px; bottom: 0; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000 } .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000 } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000 } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000 } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .popover { position: absolute; top: 0; left: 0; z-index: 1060; display: none; max-width: 276px; padding: 1px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; letter-spacing: normal; word-break: normal; word-spacing: normal; word-wrap: normal; white-space: normal; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); box-shadow: 0 5px 10px rgba(0, 0, 0, .2); line-break: auto } .popover.top { margin-top: -10px } .popover.right { margin-left: 10px } .popover.bottom { margin-top: 10px } .popover.left { margin-left: -10px } .popover-title { padding: 8px 14px; margin: 0; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0 } .popover-content { padding: 9px 14px } .popover>.arrow, .popover>.arrow:after { position: absolute; display: block; width: 0; height: 0; border-color: transparent; border-style: solid } .popover>.arrow { border-width: 11px } .popover>.arrow:after { content: ""; border-width: 10px } .popover.top>.arrow { bottom: -11px; left: 50%; margin-left: -11px; border-top-color: #999; border-top-color: rgba(0, 0, 0, .25); border-bottom-width: 0 } .popover.top>.arrow:after { bottom: 1px; margin-left: -10px; content: " "; border-top-color: #fff; border-bottom-width: 0 } .popover.right>.arrow { top: 50%; left: -11px; margin-top: -11px; border-right-color: #999; border-right-color: rgba(0, 0, 0, .25); border-left-width: 0 } .popover.right>.arrow:after { bottom: -10px; left: 1px; content: " "; border-right-color: #fff; border-left-width: 0 } .popover.bottom>.arrow { top: -11px; left: 50%; margin-left: -11px; border-top-width: 0; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, .25) } .popover.bottom>.arrow:after { top: 1px; margin-left: -10px; content: " "; border-top-width: 0; border-bottom-color: #fff } .popover.left>.arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; border-left-color: #999; border-left-color: rgba(0, 0, 0, .25) } .popover.left>.arrow:after { right: 1px; bottom: -10px; content: " "; border-right-width: 0; border-left-color: #fff } .carousel { position: relative } .carousel-inner { position: relative; width: 100%; overflow: hidden } .carousel-inner>.item { position: relative; display: none; -webkit-transition: .6s ease-in-out left; -o-transition: .6s ease-in-out left; transition: .6s ease-in-out left } .carousel-inner>.item>a>img, .carousel-inner>.item>img { line-height: 1 } @media all and (transform-3d), (-webkit-transform-3d) { .carousel-inner>.item { -webkit-transition: -webkit-transform .6s ease-in-out; -o-transition: -o-transform .6s ease-in-out; transition: transform .6s ease-in-out; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-perspective: 1000px; perspective: 1000px } .carousel-inner>.item.active.right, .carousel-inner>.item.next { left: 0; -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) } .carousel-inner>.item.active.left, .carousel-inner>.item.prev { left: 0; -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) } .carousel-inner>.item.active, .carousel-inner>.item.next.left, .carousel-inner>.item.prev.right { left: 0; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0) } } .carousel-inner>.active, .carousel-inner>.next, .carousel-inner>.prev { display: block } .carousel-inner>.active { left: 0 } .carousel-inner>.next, .carousel-inner>.prev { position: absolute; top: 0; width: 100% } .carousel-inner>.next { left: 100% } .carousel-inner>.prev { left: -100% } .carousel-inner>.next.left, .carousel-inner>.prev.right { left: 0 } .carousel-inner>.active.left { left: -100% } .carousel-inner>.active.right { left: 100% } .carousel-control { position: absolute; top: 0; bottom: 0; left: 0; width: 15%; font-size: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, 0); filter: alpha(opacity=50); opacity: .5 } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); background-repeat: repeat-x } .carousel-control.right { right: 0; left: auto; background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5))); background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); background-repeat: repeat-x } .carousel-control:focus, .carousel-control:hover { color: #fff; text-decoration: none; filter: alpha(opacity=90); outline: 0; opacity: .9 } .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next, .carousel-control .icon-prev { position: absolute; top: 50%; z-index: 5; display: inline-block; margin-top: -10px } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { left: 50%; margin-left: -10px } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { right: 50%; margin-right: -10px } .carousel-control .icon-next, .carousel-control .icon-prev { width: 20px; height: 20px; font-family: serif; line-height: 1 } .carousel-control .icon-prev:before { content: '\2039' } .carousel-control .icon-next:before { content: '\203a' } .carousel-indicators { position: absolute; bottom: 10px; left: 50%; z-index: 15; width: 60%; padding-left: 0; margin-left: -30%; text-align: center; list-style: none } .carousel-indicators li { display: inline-block; width: 10px; height: 10px; margin: 1px; text-indent: -999px; cursor: pointer; background-color: #000\9; background-color: rgba(0, 0, 0, 0); border: 1px solid #fff; border-radius: 10px } .carousel-indicators .active { width: 12px; height: 12px; margin: 0; background-color: #fff } .carousel-caption { position: absolute; right: 15%; bottom: 20px; left: 15%; z-index: 10; padding-top: 20px; padding-bottom: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6) } .carousel-caption .btn { text-shadow: none } @media screen and (min-width:768px) { .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next, .carousel-control .icon-prev { width: 30px; height: 30px; margin-top: -10px; font-size: 30px } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { margin-left: -10px } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { margin-right: -10px } .carousel-caption { right: 20%; left: 20%; padding-bottom: 30px } .carousel-indicators { bottom: 20px } } .btn-group-vertical>.btn-group:after, .btn-group-vertical>.btn-group:before, .btn-toolbar:after, .btn-toolbar:before, .clearfix:after, .clearfix:before, .container-fluid:after, .container-fluid:before, .container:after, .container:before, .dl-horizontal dd:after, .dl-horizontal dd:before, .form-horizontal .form-group:after, .form-horizontal .form-group:before, .modal-footer:after, .modal-footer:before, .modal-header:after, .modal-header:before, .nav:after, .nav:before, .navbar-collapse:after, .navbar-collapse:before, .navbar-header:after, .navbar-header:before, .navbar:after, .navbar:before, .pager:after, .pager:before, .panel-body:after, .panel-body:before, .row:after, .row:before { display: table; content: " " } .btn-group-vertical>.btn-group:after, .btn-toolbar:after, .clearfix:after, .container-fluid:after, .container:after, .dl-horizontal dd:after, .form-horizontal .form-group:after, .modal-footer:after, .modal-header:after, .nav:after, .navbar-collapse:after, .navbar-header:after, .navbar:after, .pager:after, .panel-body:after, .row:after { clear: both } .center-block { display: block; margin-right: auto; margin-left: auto } .pull-right { float: right!important } .pull-left { float: left!important } .hide { display: none!important } .show { display: block!important } .invisible { visibility: hidden } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0 } .hidden { display: none!important } .affix { position: fixed } @-ms-viewport { width: device-width } .visible-lg, .visible-md, .visible-sm, .visible-xs { display: none!important } .visible-lg-block, .visible-lg-inline, .visible-lg-inline-block, .visible-md-block, .visible-md-inline, .visible-md-inline-block, .visible-sm-block, .visible-sm-inline, .visible-sm-inline-block, .visible-xs-block, .visible-xs-inline, .visible-xs-inline-block { display: none!important } @media (max-width:767px) { .visible-xs { display: block!important } table.visible-xs { display: table!important } tr.visible-xs { display: table-row!important } td.visible-xs, th.visible-xs { display: table-cell!important } } @media (max-width:767px) { .visible-xs-block { display: block!important } } @media (max-width:767px) { .visible-xs-inline { display: inline!important } } @media (max-width:767px) { .visible-xs-inline-block { display: inline-block!important } } @media (min-width:768px) and (max-width:991px) { .visible-sm { display: block!important } table.visible-sm { display: table!important } tr.visible-sm { display: table-row!important } td.visible-sm, th.visible-sm { display: table-cell!important } } @media (min-width:768px) and (max-width:991px) { .visible-sm-block { display: block!important } } @media (min-width:768px) and (max-width:991px) { .visible-sm-inline { display: inline!important } } @media (min-width:768px) and (max-width:991px) { .visible-sm-inline-block { display: inline-block!important } } @media (min-width:992px) and (max-width:1199px) { .visible-md { display: block!important } table.visible-md { display: table!important } tr.visible-md { display: table-row!important } td.visible-md, th.visible-md { display: table-cell!important } } @media (min-width:992px) and (max-width:1199px) { .visible-md-block { display: block!important } } @media (min-width:992px) and (max-width:1199px) { .visible-md-inline { display: inline!important } } @media (min-width:992px) and (max-width:1199px) { .visible-md-inline-block { display: inline-block!important } } @media (min-width:1200px) { .visible-lg { display: block!important } table.visible-lg { display: table!important } tr.visible-lg { display: table-row!important } td.visible-lg, th.visible-lg { display: table-cell!important } } @media (min-width:1200px) { .visible-lg-block { display: block!important } } @media (min-width:1200px) { .visible-lg-inline { display: inline!important } } @media (min-width:1200px) { .visible-lg-inline-block { display: inline-block!important } } @media (max-width:767px) { .hidden-xs { display: none!important } } @media (min-width:768px) and (max-width:991px) { .hidden-sm { display: none!important } } @media (min-width:992px) and (max-width:1199px) { .hidden-md { display: none!important } } @media (min-width:1200px) { .hidden-lg { display: none!important } } .visible-print { display: none!important } @media print { .visible-print { display: block!important } table.visible-print { display: table!important } tr.visible-print { display: table-row!important } td.visible-print, th.visible-print { display: table-cell!important } } .visible-print-block { display: none!important } @media print { .visible-print-block { display: block!important } } .visible-print-inline { display: none!important } @media print { .visible-print-inline { display: inline!important } } .visible-print-inline-block { display: none!important } @media print { .visible-print-inline-block { display: inline-block!important } } @media print { .hidden-print { display: none!important } } /*# sourceMappingURL=bootstrap.min.css.map */
Java
// // Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 // Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. // Generato il: 2014.10.23 alle 11:27:04 AM CEST // package org.cumulus.certificate.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java per HistoryStateType complex type. * * <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. * * <pre> * &lt;complexType name="HistoryStateType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;attribute name="stateId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="refersToStateId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "HistoryStateType") public class HistoryStateType { @XmlAttribute(name = "stateId", required = true) protected String stateId; @XmlAttribute(name = "refersToStateId", required = true) protected String refersToStateId; /** * Recupera il valore della proprietà stateId. * * @return * possible object is * {@link String } * */ public String getStateId() { return stateId; } /** * Imposta il valore della proprietà stateId. * * @param value * allowed object is * {@link String } * */ public void setStateId(String value) { this.stateId = value; } /** * Recupera il valore della proprietà refersToStateId. * * @return * possible object is * {@link String } * */ public String getRefersToStateId() { return refersToStateId; } /** * Imposta il valore della proprietà refersToStateId. * * @param value * allowed object is * {@link String } * */ public void setRefersToStateId(String value) { this.refersToStateId = value; } }
Java
//--------------------------------------------------------------------------- // Greenplum Database // Copyright (C) 2013 EMC Corp. // // @filename: // CMDIdCast.cpp // // @doc: // Implementation of mdids for cast functions //--------------------------------------------------------------------------- #include "naucrates/md/CMDIdCast.h" #include "naucrates/dxl/xml/CXMLSerializer.h" using namespace gpos; using namespace gpmd; //--------------------------------------------------------------------------- // @function: // CMDIdCast::CMDIdCast // // @doc: // Ctor // //--------------------------------------------------------------------------- CMDIdCast::CMDIdCast ( CMDIdGPDB *pmdidSrc, CMDIdGPDB *pmdidDest ) : m_pmdidSrc(pmdidSrc), m_pmdidDest(pmdidDest), m_str(m_wszBuffer, GPOS_ARRAY_SIZE(m_wszBuffer)) { GPOS_ASSERT(pmdidSrc->FValid()); GPOS_ASSERT(pmdidDest->FValid()); // serialize mdid into static string Serialize(); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::~CMDIdCast // // @doc: // Dtor // //--------------------------------------------------------------------------- CMDIdCast::~CMDIdCast() { m_pmdidSrc->Release(); m_pmdidDest->Release(); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::Serialize // // @doc: // Serialize mdid into static string // //--------------------------------------------------------------------------- void CMDIdCast::Serialize() { // serialize mdid as SystemType.mdidSrc.mdidDest m_str.AppendFormat ( GPOS_WSZ_LIT("%d.%d.%d.%d;%d.%d.%d"), Emdidt(), m_pmdidSrc->OidObjectId(), m_pmdidSrc->UlVersionMajor(), m_pmdidSrc->UlVersionMinor(), m_pmdidDest->OidObjectId(), m_pmdidDest->UlVersionMajor(), m_pmdidDest->UlVersionMinor() ); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::Wsz // // @doc: // Returns the string representation of the mdid // //--------------------------------------------------------------------------- const WCHAR * CMDIdCast::Wsz() const { return m_str.Wsz(); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::PmdidSrc // // @doc: // Returns the source type id // //--------------------------------------------------------------------------- IMDId * CMDIdCast::PmdidSrc() const { return m_pmdidSrc; } //--------------------------------------------------------------------------- // @function: // CMDIdCast::PmdidDest // // @doc: // Returns the destination type id // //--------------------------------------------------------------------------- IMDId * CMDIdCast::PmdidDest() const { return m_pmdidDest; } //--------------------------------------------------------------------------- // @function: // CMDIdCast::FEquals // // @doc: // Checks if the mdids are equal // //--------------------------------------------------------------------------- BOOL CMDIdCast::FEquals ( const IMDId *pmdid ) const { if (NULL == pmdid || EmdidCastFunc != pmdid->Emdidt()) { return false; } const CMDIdCast *pmdidCastFunc = CMDIdCast::PmdidConvert(pmdid); return m_pmdidSrc->FEquals(pmdidCastFunc->PmdidSrc()) && m_pmdidDest->FEquals(pmdidCastFunc->PmdidDest()); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::Serialize // // @doc: // Serializes the mdid as the value of the given attribute // //--------------------------------------------------------------------------- void CMDIdCast::Serialize ( CXMLSerializer * pxmlser, const CWStringConst *pstrAttribute ) const { pxmlser->AddAttribute(pstrAttribute, &m_str); } //--------------------------------------------------------------------------- // @function: // CMDIdCast::OsPrint // // @doc: // Debug print of the id in the provided stream // //--------------------------------------------------------------------------- IOstream & CMDIdCast::OsPrint ( IOstream &os ) const { os << "(" << m_str.Wsz() << ")"; return os; } // EOF
Java
/* * Copyright 2021 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.thoughtworks.go.serverhealth; import com.thoughtworks.go.config.CruiseConfig; import com.thoughtworks.go.config.CruiseConfigProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Service; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @Service public class ServerHealthService implements ApplicationContextAware { private static final Logger LOG = LoggerFactory.getLogger(ServerHealthService.class); private HashMap<ServerHealthState, Set<String>> pipelinesWithErrors; private Map<HealthStateType, ServerHealthState> serverHealth; private ApplicationContext applicationContext; public ServerHealthService() { this.serverHealth = new ConcurrentHashMap<>(); this.pipelinesWithErrors = new HashMap<>(); } public void removeByScope(HealthStateScope scope) { for (HealthStateType healthStateType : entryKeys()) { if (healthStateType.isSameScope(scope)) { serverHealth.remove(healthStateType); } } } private Set<HealthStateType> entryKeys() { return new HashSet<>(serverHealth.keySet()); } public List<ServerHealthState> filterByScope(HealthStateScope scope) { List<ServerHealthState> filtered = new ArrayList<>(); for (Map.Entry<HealthStateType, ServerHealthState> entry : sortedEntries()) { HealthStateType type = entry.getKey(); if (type.isSameScope(scope)) { filtered.add(entry.getValue()); } } return filtered; } public HealthStateType update(ServerHealthState serverHealthState) { HealthStateType type = serverHealthState.getType(); if (serverHealthState.getLogLevel() == HealthStateLevel.OK) { if (serverHealth.containsKey(type)) { serverHealth.remove(type); } return null; } else { serverHealth.put(type, serverHealthState); return type; } } // called from spring timer public synchronized void onTimer() { CruiseConfig currentConfig = applicationContext.getBean(CruiseConfigProvider.class).getCurrentConfig(); purgeStaleHealthMessages(currentConfig); LOG.debug("Recomputing material to pipeline mappings."); HashMap<ServerHealthState, Set<String>> erroredPipelines = new HashMap<>(); for (Map.Entry<HealthStateType, ServerHealthState> entry : serverHealth.entrySet()) { erroredPipelines.put(entry.getValue(), entry.getValue().getPipelineNames(currentConfig)); } pipelinesWithErrors = erroredPipelines; LOG.debug("Done recomputing material to pipeline mappings."); } public Set<String> getPipelinesWithErrors(ServerHealthState serverHealthState) { return pipelinesWithErrors.get(serverHealthState); } void purgeStaleHealthMessages(CruiseConfig cruiseConfig) { removeMessagesForElementsNoLongerInConfig(cruiseConfig); removeExpiredMessages(); } @Deprecated(forRemoval = true) // Remove once we get rid of SpringJUnitTestRunner public void removeAllLogs() { serverHealth.clear(); } private void removeMessagesForElementsNoLongerInConfig(CruiseConfig cruiseConfig) { for (HealthStateType type : entryKeys()) { if (type.isRemovedFromConfig(cruiseConfig)) { this.removeByScope(type); } } } private void removeExpiredMessages() { for (Map.Entry<HealthStateType, ServerHealthState> entry : new HashSet<>(serverHealth.entrySet())) { ServerHealthState value = entry.getValue(); if (value.hasExpired()) { serverHealth.remove(entry.getKey()); } } } private void removeByScope(HealthStateType type) { removeByScope(type.getScope()); } public ServerHealthStates logs() { ArrayList<ServerHealthState> logs = new ArrayList<>(); for (Map.Entry<HealthStateType, ServerHealthState> entry : sortedEntries()) { logs.add(entry.getValue()); } return new ServerHealthStates(logs); } private List<Map.Entry<HealthStateType, ServerHealthState>> sortedEntries() { List<Map.Entry<HealthStateType, ServerHealthState>> entries = new ArrayList<>(serverHealth.entrySet()); entries.sort(Comparator.comparing(Map.Entry::getKey)); return entries; } public String getLogsAsText() { StringBuilder text = new StringBuilder(); for (ServerHealthState state : logs()) { text.append(state.getDescription()); text.append("\n\t"); text.append(state.getMessage()); text.append("\n"); } return text.toString(); } public boolean containsError(HealthStateType type, HealthStateLevel level) { ServerHealthStates allLogs = logs(); for (ServerHealthState log : allLogs) { if (log.getType().equals(type) && log.getLogLevel() == level) { return true; } } return false; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } }
Java
package gov.ic.geoint.spreadsheet; /** * */ public interface ICell extends Hashable { /** * * @return */ public int getColumnNum(); /** * * @return */ public int getRowNum(); /** * * @return */ public String getValue(); }
Java
package sdk.chat.demo.examples.api; import io.reactivex.functions.Consumer; import sdk.guru.common.DisposableMap; public class BaseExample implements Consumer<Throwable> { // Add the disposables to a map so you can dispose of them all at one time protected DisposableMap dm = new DisposableMap(); @Override public void accept(Throwable throwable) throws Exception { // Handle exception } }
Java
//Copyright (c) 2014 by Disy Informationssysteme GmbH package net.disy.eenvplus.tfes.core.api.query; // NOT_PUBLISHED public interface ISuggestionQuery extends ISourceQuery { String getKeyword(); }
Java
//////////////////////////////////////////////////////////////////////////// // Module : script_value_container_impl.h // Created : 16.07.2004 // Modified : 16.07.2004 // Author : Dmitriy Iassenev // Description : Script value container //////////////////////////////////////////////////////////////////////////// #pragma once #include "object_broker.h" #ifdef XRSE_FACTORY_EXPORTS #include "script_value.h" #endif IC CScriptValueContainer::~CScriptValueContainer() { clear(); } IC void CScriptValueContainer::add(CScriptValue* new_value) { #ifdef XRSE_FACTORY_EXPORTS CScriptValue* value = 0; xr_vector<CScriptValue*>::const_iterator I = m_values.begin(); xr_vector<CScriptValue*>::const_iterator E = m_values.end(); for (; I != E; ++I) if (!xr_strcmp((*I)->name(), new_value->name())) { value = *I; break; } if (value) return; m_values.push_back(new_value); #endif } IC void CScriptValueContainer::assign() { #ifdef XRSE_FACTORY_EXPORTS xr_vector<CScriptValue*>::iterator I = m_values.begin(); xr_vector<CScriptValue*>::iterator E = m_values.end(); for (; I != E; ++I) (*I)->assign(); #endif } IC void CScriptValueContainer::clear() { delete_data(m_values); }
Java
package com.jwetherell.algorithms.data_structures.interfaces; /** * A tree can be defined recursively (locally) as a collection of nodes (starting at a root node), * where each node is a data structure consisting of a value, together with a list of nodes (the "children"), * with the constraints that no node is duplicated. A tree can be defined abstractly as a whole (globally) * as an ordered tree, with a value assigned to each node. * <p> * @see <a href="https://en.wikipedia.org/wiki/Tree_(data_structure)">Tree (Wikipedia)</a> * <br> * @author Justin Wetherell <phishman3579@gmail.com> */ public interface ITree<T> { /** * Add value to the tree. Tree can contain multiple equal values. * * @param value to add to the tree. * @return True if successfully added to tree. */ public boolean add(T value); /** * Remove first occurrence of value in the tree. * * @param value to remove from the tree. * @return T value removed from tree. */ public T remove(T value); /** * Clear the entire stack. */ public void clear(); /** * Does the tree contain the value. * * @param value to locate in the tree. * @return True if tree contains value. */ public boolean contains(T value); /** * Get number of nodes in the tree. * * @return Number of nodes in the tree. */ public int size(); /** * Validate the tree according to the invariants. * * @return True if the tree is valid. */ public boolean validate(); /** * Get Tree as a Java compatible Collection * * @return Java compatible Collection */ public java.util.Collection<T> toCollection(); }
Java
/* * Copyright 2014, The Sporting Exchange Limited * Copyright 2014, Simon Matić Langford * * 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 uk.co.exemel.disco.transport.jetty; import uk.co.exemel.disco.DiscoVersion; import org.eclipse.jetty.servlets.CrossOriginFilter; import org.junit.Test; import java.util.Collections; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; /** * Unit tests for {@link uk.co.exemel.disco.transport.jetty.CrossOriginHandler} */ public class CrossOriginHandlerTest { @Test public void testHandlerSetsServerHeaderInTheResponse() throws Exception { final CrossOriginHandler victim = new CrossOriginHandler("betfair.com", "GET,POST,HEAD", "X-Requested-With,Content-Type,Accept,Origin", "1800", "true", ""); final MockJettyRequest req = mock(MockJettyRequest.class); final MockJettyResponse res = mock(MockJettyResponse.class); victim.handle("/", req, req, res); verify(res, times(1)).setHeader(eq("Server"), eq("Disco 2 - " + DiscoVersion.getVersion())); } @Test public void testHandlerMarksRequestAsHandledByDefault() throws Exception { final CrossOriginHandler victim = new CrossOriginHandler("betfair.com", "GET,POST,HEAD", "X-Requested-With,Content-Type,Accept,Origin", "1800", "true", ""); final MockJettyRequest req = mock(MockJettyRequest.class); final MockJettyResponse res = mock(MockJettyResponse.class); victim.handle("/", req, req, res); verify(req, times(1)).setHandled(eq(true)); verify(req, times(1)).setHandled(eq(false)); } @Test public void testHandlerUnmarksRequestAsHandledIfFilterContinuesTheChainExplicitDomain() throws Exception { testHandlesCrossOriginRequest("betfair.com", true); } @Test public void testHandlerUnmarksRequestAsHandledIfFilterContinuesTheChainAllDomains() throws Exception { testHandlesCrossOriginRequest("*", true); } @Test public void testHandlerUnmarksRequestAsHandledIfFilterContinuesTheChainNoDomains() throws Exception { testHandlesCrossOriginRequest("", false); } private void testHandlesCrossOriginRequest(String domains, boolean wantHandled) throws Exception { final CrossOriginHandler victim = new CrossOriginHandler(domains, "GET,POST,HEAD", "X-Requested-With,Content-Type,Accept,Origin", "1800", "true", ""); final MockJettyRequest req = mock(MockJettyRequest.class); final MockJettyResponse res = mock(MockJettyResponse.class); when(req.getMethod()).thenReturn("OPTIONS"); when(req.getHeader("Origin")).thenReturn("betfair.com"); when(req.getHeader(CrossOriginFilter.ACCESS_CONTROL_REQUEST_METHOD_HEADER)).thenReturn("PUT"); when(req.getHeaders("Connection")).thenReturn(Collections.<String>emptyEnumeration()); victim.handle("/", req, req, res); // this is always called verify(req, times(1)).setHandled(eq(true)); if (wantHandled) { verify(req, never()).setHandled(eq(false)); } else { verify(req, times(1)).setHandled(eq(false)); } } }
Java
package org.nd4j.linalg.indexing; import com.google.common.base.Function; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.nd4j.linalg.BaseNd4jTest; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.api.ops.impl.accum.MatchCondition; import org.nd4j.linalg.api.ops.impl.transforms.comparison.CompareAndReplace; import org.nd4j.linalg.api.ops.impl.transforms.comparison.CompareAndSet; import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.factory.Nd4jBackend; import org.nd4j.linalg.indexing.conditions.AbsValueGreaterThan; import org.nd4j.linalg.indexing.conditions.Condition; import org.nd4j.linalg.indexing.conditions.Conditions; import org.nd4j.linalg.indexing.functions.Value; import java.util.Arrays; import static org.junit.Assert.*; /** * @author raver119@gmail.com */ @RunWith(Parameterized.class) public class BooleanIndexingTest extends BaseNd4jTest { public BooleanIndexingTest(Nd4jBackend backend) { super(backend); } /* 1D array checks */ @Test public void testAnd1() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertTrue(BooleanIndexing.and(array, Conditions.greaterThan(0.5f))); } @Test public void testAnd2() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertTrue(BooleanIndexing.and(array, Conditions.lessThan(6.0f))); } @Test public void testAnd3() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertFalse(BooleanIndexing.and(array, Conditions.lessThan(5.0f))); } @Test public void testAnd4() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertFalse(BooleanIndexing.and(array, Conditions.greaterThan(4.0f))); } @Test public void testAnd5() throws Exception { INDArray array = Nd4j.create(new float[] {1e-5f, 1e-5f, 1e-5f, 1e-5f, 1e-5f}); assertTrue(BooleanIndexing.and(array, Conditions.greaterThanOrEqual(1e-5f))); } @Test public void testAnd6() throws Exception { INDArray array = Nd4j.create(new float[] {1e-5f, 1e-5f, 1e-5f, 1e-5f, 1e-5f}); assertFalse(BooleanIndexing.and(array, Conditions.lessThan(1e-5f))); } @Test public void testAnd7() throws Exception { INDArray array = Nd4j.create(new float[] {1e-5f, 1e-5f, 1e-5f, 1e-5f, 1e-5f}); assertTrue(BooleanIndexing.and(array, Conditions.equals(1e-5f))); } @Test public void testOr1() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertTrue(BooleanIndexing.or(array, Conditions.greaterThan(3.0f))); } @Test public void testOr2() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertTrue(BooleanIndexing.or(array, Conditions.lessThan(3.0f))); } @Test public void testOr3() throws Exception { INDArray array = Nd4j.create(new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f}); assertFalse(BooleanIndexing.or(array, Conditions.greaterThan(6.0f))); } @Test public void testApplyWhere1() throws Exception { INDArray array = Nd4j.create(new float[] {-1f, -1f, -1f, -1f, -1f}); BooleanIndexing.applyWhere(array, Conditions.lessThan(Nd4j.EPS_THRESHOLD), new Value(Nd4j.EPS_THRESHOLD)); //System.out.println("Array contains: " + Arrays.toString(array.data().asFloat())); assertTrue(BooleanIndexing.and(array, Conditions.equals(Nd4j.EPS_THRESHOLD))); } @Test public void testApplyWhere2() throws Exception { INDArray array = Nd4j.create(new float[] {0f, 0f, 0f, 0f, 0f}); BooleanIndexing.applyWhere(array, Conditions.lessThan(1.0f), new Value(1.0f)); assertTrue(BooleanIndexing.and(array, Conditions.equals(1.0f))); } @Test public void testApplyWhere3() throws Exception { INDArray array = Nd4j.create(new float[] {1e-18f, 1e-18f, 1e-18f, 1e-18f, 1e-18f}); BooleanIndexing.applyWhere(array, Conditions.lessThan(1e-12f), new Value(1e-12f)); //System.out.println("Array contains: " + Arrays.toString(array.data().asFloat())); assertTrue(BooleanIndexing.and(array, Conditions.equals(1e-12f))); } @Test public void testApplyWhere4() throws Exception { INDArray array = Nd4j.create(new float[] {1e-18f, Float.NaN, 1e-18f, 1e-18f, 1e-18f}); BooleanIndexing.applyWhere(array, Conditions.lessThan(1e-12f), new Value(1e-12f)); //System.out.println("Array contains: " + Arrays.toString(array.data().asFloat())); BooleanIndexing.applyWhere(array, Conditions.isNan(), new Value(1e-16f)); System.out.println("Array contains: " + Arrays.toString(array.data().asFloat())); assertFalse(BooleanIndexing.or(array, Conditions.isNan())); assertTrue(BooleanIndexing.or(array, Conditions.equals(1e-12f))); assertTrue(BooleanIndexing.or(array, Conditions.equals(1e-16f))); } /* 2D array checks */ @Test public void test2dAnd1() throws Exception { INDArray array = Nd4j.zeros(10, 10); assertTrue(BooleanIndexing.and(array, Conditions.equals(0f))); } @Test public void test2dAnd2() throws Exception { INDArray array = Nd4j.zeros(10, 10); array.slice(4).putScalar(2, 1e-5f); System.out.println(array); assertFalse(BooleanIndexing.and(array, Conditions.equals(0f))); } @Test public void test2dAnd3() throws Exception { INDArray array = Nd4j.zeros(10, 10); array.slice(4).putScalar(2, 1e-5f); assertFalse(BooleanIndexing.and(array, Conditions.greaterThan(0f))); } @Test public void test2dAnd4() throws Exception { INDArray array = Nd4j.zeros(10, 10); array.slice(4).putScalar(2, 1e-5f); assertTrue(BooleanIndexing.or(array, Conditions.greaterThan(1e-6f))); } @Test public void test2dApplyWhere1() throws Exception { INDArray array = Nd4j.ones(4, 4); array.slice(3).putScalar(2, 1e-5f); //System.out.println("Array before: " + Arrays.toString(array.data().asFloat())); BooleanIndexing.applyWhere(array, Conditions.lessThan(1e-4f), new Value(1e-12f)); //System.out.println("Array after 1: " + Arrays.toString(array.data().asFloat())); assertTrue(BooleanIndexing.or(array, Conditions.equals(1e-12f))); assertTrue(BooleanIndexing.or(array, Conditions.equals(1.0f))); assertFalse(BooleanIndexing.and(array, Conditions.equals(1e-12f))); } /** * This test fails, because it highlights current mechanics on SpecifiedIndex stuff. * Internally there's * * @throws Exception */ @Test public void testSliceAssign1() throws Exception { INDArray array = Nd4j.zeros(4, 4); INDArray patch = Nd4j.create(new float[] {1e-5f, 1e-5f, 1e-5f}); INDArray slice = array.slice(1); int[] idx = new int[] {0, 1, 3}; INDArrayIndex[] range = new INDArrayIndex[] {new SpecifiedIndex(idx)}; INDArray subarray = slice.get(range); System.out.println("Subarray: " + Arrays.toString(subarray.data().asFloat()) + " isView: " + subarray.isView()); slice.put(range, patch); System.out.println("Array after being patched: " + Arrays.toString(array.data().asFloat())); assertFalse(BooleanIndexing.and(array, Conditions.equals(0f))); } @Test public void testConditionalAssign1() throws Exception { INDArray array1 = Nd4j.create(new double[] {1, 2, 3, 4, 5, 6, 7}); INDArray array2 = Nd4j.create(new double[] {7, 6, 5, 4, 3, 2, 1}); INDArray comp = Nd4j.create(new double[] {1, 2, 3, 4, 3, 2, 1}); BooleanIndexing.replaceWhere(array1, array2, Conditions.greaterThan(4)); assertEquals(comp, array1); } @Test public void testCaSTransform1() throws Exception { INDArray array = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray comp = Nd4j.create(new double[] {1, 2, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndSet(array, 3, Conditions.equals(0))); assertEquals(comp, array); } @Test public void testCaSTransform2() throws Exception { INDArray array = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray comp = Nd4j.create(new double[] {3, 2, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndSet(array, 3.0, Conditions.lessThan(2))); assertEquals(comp, array); } @Test public void testCaSPairwiseTransform1() throws Exception { INDArray array = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray comp = Nd4j.create(new double[] {1, 2, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndSet(array, comp, Conditions.lessThan(5))); assertEquals(comp, array); } @Test public void testCaRPairwiseTransform1() throws Exception { INDArray array = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray comp = Nd4j.create(new double[] {1, 2, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndReplace(array, comp, Conditions.lessThan(1))); assertEquals(comp, array); } @Test public void testCaSPairwiseTransform2() throws Exception { INDArray x = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray y = Nd4j.create(new double[] {2, 4, 3, 0, 5}); INDArray comp = Nd4j.create(new double[] {2, 4, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndSet(x, y, Conditions.epsNotEquals(0.0))); assertEquals(comp, x); } @Test public void testCaRPairwiseTransform2() throws Exception { INDArray x = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray y = Nd4j.create(new double[] {2, 4, 3, 4, 5}); INDArray comp = Nd4j.create(new double[] {2, 4, 0, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndReplace(x, y, Conditions.epsNotEquals(0.0))); assertEquals(comp, x); } @Test public void testCaSPairwiseTransform3() throws Exception { INDArray x = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray y = Nd4j.create(new double[] {2, 4, 3, 4, 5}); INDArray comp = Nd4j.create(new double[] {2, 4, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndReplace(x, y, Conditions.lessThan(4))); assertEquals(comp, x); } @Test public void testCaRPairwiseTransform3() throws Exception { INDArray x = Nd4j.create(new double[] {1, 2, 0, 4, 5}); INDArray y = Nd4j.create(new double[] {2, 4, 3, 4, 5}); INDArray comp = Nd4j.create(new double[] {2, 2, 3, 4, 5}); Nd4j.getExecutioner().exec(new CompareAndReplace(x, y, Conditions.lessThan(2))); assertEquals(comp, x); } @Test public void testMatchConditionAllDimensions1() throws Exception { INDArray array = Nd4j.create(new double[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); int val = (int) Nd4j.getExecutioner().exec(new MatchCondition(array, Conditions.lessThan(5)), Integer.MAX_VALUE) .getDouble(0); assertEquals(5, val); } @Test public void testMatchConditionAllDimensions2() throws Exception { INDArray array = Nd4j.create(new double[] {0, 1, 2, 3, Double.NaN, 5, 6, 7, 8, 9}); int val = (int) Nd4j.getExecutioner().exec(new MatchCondition(array, Conditions.isNan()), Integer.MAX_VALUE) .getDouble(0); assertEquals(1, val); } @Test public void testMatchConditionAllDimensions3() throws Exception { INDArray array = Nd4j.create(new double[] {0, 1, 2, 3, Double.NEGATIVE_INFINITY, 5, 6, 7, 8, 9}); int val = (int) Nd4j.getExecutioner() .exec(new MatchCondition(array, Conditions.isInfinite()), Integer.MAX_VALUE).getDouble(0); assertEquals(1, val); } @Test public void testAbsValueGreaterThan() { final double threshold = 2; Condition absValueCondition = new AbsValueGreaterThan(threshold); Function<Number, Number> clipFn = new Function<Number, Number>() { @Override public Number apply(Number number) { System.out.println("Number: " + number.doubleValue()); return (number.doubleValue() > threshold ? threshold : -threshold); } }; Nd4j.getRandom().setSeed(12345); INDArray orig = Nd4j.rand(1, 20).muli(6).subi(3); //Random numbers: -3 to 3 INDArray exp = orig.dup(); INDArray after = orig.dup(); for (int i = 0; i < exp.length(); i++) { double d = exp.getDouble(i); if (d > threshold) { exp.putScalar(i, threshold); } else if (d < -threshold) { exp.putScalar(i, -threshold); } } BooleanIndexing.applyWhere(after, absValueCondition, clipFn); System.out.println(orig); System.out.println(exp); System.out.println(after); assertEquals(exp, after); } @Test public void testMatchConditionAlongDimension1() throws Exception { INDArray array = Nd4j.ones(3, 10); array.getRow(2).assign(0.0); boolean result[] = BooleanIndexing.and(array, Conditions.equals(0.0), 1); boolean comp[] = new boolean[] {false, false, true}; System.out.println("Result: " + Arrays.toString(result)); assertArrayEquals(comp, result); } @Test public void testMatchConditionAlongDimension2() throws Exception { INDArray array = Nd4j.ones(3, 10); array.getRow(2).assign(0.0).putScalar(0, 1.0); System.out.println("Array: " + array); boolean result[] = BooleanIndexing.or(array, Conditions.lessThan(0.9), 1); boolean comp[] = new boolean[] {false, false, true}; System.out.println("Result: " + Arrays.toString(result)); assertArrayEquals(comp, result); } @Test public void testMatchConditionAlongDimension3() throws Exception { INDArray array = Nd4j.ones(3, 10); array.getRow(2).assign(0.0).putScalar(0, 1.0); boolean result[] = BooleanIndexing.and(array, Conditions.lessThan(0.0), 1); boolean comp[] = new boolean[] {false, false, false}; System.out.println("Result: " + Arrays.toString(result)); assertArrayEquals(comp, result); } @Test public void testConditionalUpdate() { INDArray arr = Nd4j.linspace(-2, 2, 5); INDArray ones = Nd4j.ones(5); INDArray exp = Nd4j.create(new double[] {1, 1, 0, 1, 1}); Nd4j.getExecutioner().exec(new CompareAndSet(ones, arr, ones, Conditions.equals(0.0))); assertEquals(exp, ones); } @Test public void testFirstIndex1() { INDArray arr = Nd4j.create(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}); INDArray result = BooleanIndexing.firstIndex(arr, Conditions.greaterThanOrEqual(3)); assertEquals(2, result.getDouble(0), 0.0); } @Test public void testFirstIndex2() { INDArray arr = Nd4j.create(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}); INDArray result = BooleanIndexing.firstIndex(arr, Conditions.lessThan(3)); assertEquals(0, result.getDouble(0), 0.0); } @Test public void testLastIndex1() { INDArray arr = Nd4j.create(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}); INDArray result = BooleanIndexing.lastIndex(arr, Conditions.greaterThanOrEqual(3)); assertEquals(8, result.getDouble(0), 0.0); } @Test public void testFirstIndex2D() { INDArray arr = Nd4j.create(new double[] {1, 2, 3, 0, 1, 3, 7, 8, 9}).reshape('c', 3, 3); INDArray result = BooleanIndexing.firstIndex(arr, Conditions.greaterThanOrEqual(2), 1); INDArray exp = Nd4j.create(new double[] {1, 2, 0}); assertEquals(exp, result); } @Test public void testLastIndex2D() { INDArray arr = Nd4j.create(new double[] {1, 2, 3, 0, 1, 3, 7, 8, 0}).reshape('c', 3, 3); INDArray result = BooleanIndexing.lastIndex(arr, Conditions.greaterThanOrEqual(2), 1); INDArray exp = Nd4j.create(new double[] {2, 2, 1}); assertEquals(exp, result); } @Test public void testEpsEquals1() throws Exception { INDArray array = Nd4j.create(new double[]{-1, -1, -1e-8, 1e-8, 1, 1}); MatchCondition condition = new MatchCondition(array, Conditions.epsEquals(0.0)); int numZeroes = Nd4j.getExecutioner().exec(condition, Integer.MAX_VALUE).getInt(0); assertEquals(2, numZeroes); } @Override public char ordering() { return 'c'; } }
Java
# coding: utf-8 # # Copyright 2018 The Oppia Authors. All Rights Reserved. # # 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. """Tests for methods in the action registry.""" from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.domain import action_registry from core.tests import test_utils class ActionRegistryUnitTests(test_utils.GenericTestBase): """Test for the action registry.""" def test_action_registry(self): """Do some sanity checks on the action registry.""" self.assertEqual( len(action_registry.Registry.get_all_actions()), 3)
Java
package com.xiaojinzi.component.error; public class ServiceRepeatCreateException extends RuntimeException { public ServiceRepeatCreateException() { } public ServiceRepeatCreateException(String message) { super(message); } public ServiceRepeatCreateException(String message, Throwable cause) { super(message, cause); } public ServiceRepeatCreateException(Throwable cause) { super(cause); } }
Java
#/bin/bash set -x #wget --user linzhbj@cn.ibm.com --password New=1baby --no-check-certificate -c -r -np -k -L -p \ wget -c -r -np -k -L -p \ http://rchgsa.ibm.com/projects/e/emsol/ccs/build/driver/osee-liberty/rhel7.1/openstack/latest-bld/
Java