text:
/* ipm_quark_se.c - Quark SE mailbox driver */

/*
 * Copyright (c) 2015 Intel Corporation
 *
 * 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.
 */

#include <nanokernel.h>
#include <stdint.h>
#include <string.h>
#include <device.h>
#include <init.h>
#include <ipm.h>
#include <arch/cpu.h>
#include <misc/printk.h>
#include <misc/__assert.h>
#include <errno.h>
#include "ipm_quark_se.h"

/* We have a single ISR for all channels, so in order to properly handle
 * messages we need to figure out which device object corresponds to
 * in incoming channel
 */
static struct device *device_by_channel[QUARK_SE_IPM_CHANNELS];
static uint32_t inbound_channels;

static uint32_t quark_se_ipm_sts_get(void)
{
	return sys_read32(QUARK_SE_IPM_CHALL_STS) & inbound_channels;
}

static void set_channel_irq_state(int channel, int enable)
{
	mem_addr_t addr = QUARK_SE_IPM_MASK;
	int bit = channel + QUARK_SE_IPM_MASK_START_BIT;

	if (enable) {
		sys_clear_bit(addr, bit);
	} else {
		sys_set_bit(addr, bit);
	}
}

/* Interrupt handler, gets messages on all incoming enabled mailboxes */
void quark_se_ipm_isr(void *param)
{
	int channel;
	int sts, bit;
	struct device *d;
	struct quark_se_ipm_config_info *config;
	struct quark_se_ipm_driver_data *driver_data;
	volatile struct quark_se_ipm *ipm;
	unsigned int key;

	ARG_UNUSED(param);
	sts = quark_se_ipm_sts_get();

	__ASSERT(sts, "spurious IPM interrupt");
	bit = find_msb_set(sts) - 1;
	channel = bit / 2;
	d = device_by_channel[channel];

	__ASSERT(d, "got IRQ on channel with no IPM device");
	config = d->config->config_info;
	driver_data = d->driver_data;
	ipm = config->ipm;

	__ASSERT(driver_data->callback, "enabled IPM channel with no callback");
	driver_data->callback(driver_data->callback_ctx, ipm->ctrl.ctrl,
			      &ipm->data);

	key = irq_lock();

	ipm->sts.irq = 1; /* Clear the interrupt bit */
	ipm->sts.sts = 1; /* Clear channel status bit */

	/* Wait for the above register writes to clear the channel
	 * to propagate to the global channel status register
	 */
	while (quark_se_ipm_sts_get() & (0x3 << (channel * 2))) {
		/* Busy-wait */
	}
	irq_unlock(key);
}

static int quark_se_ipm_send(struct device *d, int wait, uint32_t id,
			const void *data, int size)
{
	struct quark_se_ipm_config_info *config = d->config->config_info;
	volatile struct quark_se_ipm *ipm = config->ipm;
	const uint8_t *data8;
	int i;
	int flags;

	if (id > QUARK_SE_IPM_MAX_ID_VAL) {
		return -EINVAL;
	}

	if (config->direction != QUARK_SE_IPM_OUTBOUND) {
		return -EINVAL;
	}

	if (size > QUARK_SE_IPM_DATA_BYTES) {
		return -EMSGSIZE;
	}

	flags = irq_lock();

	if (ipm->sts.sts != 0) {
		irq_unlock(flags);
		return -EBUSY;
	}

	/* Populate the data, memcpy doesn't take volatiles */
	data8 = (const uint8_t *)data;

	for (i = 0; i < size; ++i) {
		ipm->data[i] = data8[i];
	}
	ipm->ctrl.ctrl = id;

	/* Cause the interrupt to assert on the remote side */
	ipm->ctrl.irq = 1;

	/* Wait for HW to set the sts bit */
	while (ipm->sts.sts == 0) {
	}
	irq_unlock(flags);

	if (wait) {
		/* Loop until remote clears the status bit */
		while (ipm->sts.sts != 0) {
		}
	}
	return 0;
}

static int quark_se_ipm_max_data_size_get(struct device *d)
{
	ARG_UNUSED(d);

	return QUARK_SE_IPM_DATA_BYTES;
}

static uint32_t quark_se_ipm_max_id_val_get(struct device *d)
{
	ARG_UNUSED(d);

	return QUARK_SE_IPM_MAX_ID_VAL;
}

static void quark_se_ipm_register_callback(struct device *d, ipm_callback_t cb,
				       void *context)
{
	struct quark_se_ipm_driver_data *driver_data = d->driver_data;

	driver_data->callback = cb;
	driver_data->callback_ctx = context;
}

static int quark_se_ipm_set_enabled(struct device *d, int enable)
{
	struct quark_se_ipm_config_info *config_info = d->config->config_info;

	if (config_info->direction != QUARK_SE_IPM_INBOUND) {
		return -EINVAL;
	}
	set_channel_irq_state(config_info->channel, enable);
	return 0;
}

static struct ipm_driver_api api_funcs = {
	.send = quark_se_ipm_send,
	.register_callback = quark_se_ipm_register_callback,
	.max_data_size_get = quark_se_ipm_max_data_size_get,
	.max_id_val_get = quark_se_ipm_max_id_val_get,
	.set_enabled = quark_se_ipm_set_enabled
};

int quark_se_ipm_controller_initialize(struct device *d)
{
	struct quark_se_ipm_controller_config_info *config = d->config->config_info;
#if CONFIG_IPM_QUARK_SE_MASTER
	int i;

	/* Mask all mailbox interrupts, we'll enable them
	 * individually later. Clear out any pending messages
	 */
	sys_write32(0xFFFFFFFF, QUARK_SE_IPM_MASK);
	for (i = 0; i < QUARK_SE_IPM_CHANNELS; ++i) {
		volatile struct quark_se_ipm *ipm = QUARK_SE_IPM(i);

		ipm->sts.sts = 0;
		ipm->sts.irq = 0;
	}
#endif

	if (config->controller_init) {
		return config->controller_init();
	}
	return DEV_OK;
}

int quark_se_ipm_initialize(struct device *d)
{
	struct quark_se_ipm_config_info *config = d->config->config_info;

	device_by_channel[config->channel] = d;
	d->driver_api = &api_funcs;
	if (config->direction == QUARK_SE_IPM_INBOUND) {
		inbound_channels |= (0x3 << (config->channel * 2));
	}

	return DEV_OK;
}


text:
package uk.ac.ebi.eva.commons.core.models.factories;

import uk.ac.ebi.eva.commons.core.models.VariantStatistics;
import uk.ac.ebi.eva.commons.core.models.pipeline.Variant;
import uk.ac.ebi.eva.commons.core.models.pipeline.VariantSourceEntry;

import java.util.Properties;

/**
 * Overrides the methods in VariantAggregatedVcfFactory that take care of the fields QUAL, FILTER and INFO, to support
 * the specific format of Exome Variant Server VCFs.
 */
public class VariantVcfEVSFactory extends VariantAggregatedVcfFactory {

    private static final String EVS_MAPPING_FILE = "/mappings/evs-mapping.properties";

    public VariantVcfEVSFactory() {
        this(null);
    }

    /**
     * @param tagMap Extends the VariantAggregatedVcfFactory(Properties properties) with one extra tag: GROUPS_ORDER.
     * Example:
     *

     * {@code
     *
     * EUR.AF=EUR_AF
     * EUR.AC=AC_EUR
     * EUR.AN=EUR_AN
     * EUR.GTC=EUR_GTC
     * ALL.AF=AF
     * ALL.AC=TAC
     * ALL.AN=AN
     * ALL.GTC=GTC
     * GROUPS_ORDER=EUR,ALL
     * }
     *

     *

     * The special tag 'GROUPS_ORDER' can be used to specify the order of the comma separated values for populations in
     * tags such as MAF.
     */
    public VariantVcfEVSFactory(Properties tagMap) {
        super(tagMap);
    }

    @Override
    protected void parseStats(Variant variant, VariantSourceEntry sourceEntry, int numAllele, String[] alternateAlleles,
                            String info) {
        VariantStatistics stats = new VariantStatistics(variant);
        if (sourceEntry.hasAttribute("MAF")) {
            String splitsMAF[] = sourceEntry.getAttribute("MAF").split(",");
            if (splitsMAF.length == 3) {
                float maf = Float.parseFloat(splitsMAF[2]) / 100;
                stats.setMaf(maf);
            }
        }

        if (sourceEntry.hasAttribute(GENOTYPE_STRING) && sourceEntry.hasAttribute(GENOTYPE_COUNT)) {
            String splitsGTC[] = sourceEntry.getAttribute(GENOTYPE_COUNT).split(",");
            addGenotypeWithGTS(variant, sourceEntry, splitsGTC, alternateAlleles, numAllele, stats);
        }

        sourceEntry.setStats(stats);
    }

    @Override
    protected void parseCohortStats(Variant variant, VariantSourceEntry sourceEntry, int numAllele,
                                    String[] alternateAlleles, String info) {
        if (tagMap != null) {
            for (String key : sourceEntry.getAttributes().keySet()) {
                String opencgaTag = reverseTagMap.get(key);
                String[] values = sourceEntry.getAttribute(key).split(",");
                if (opencgaTag != null) {
                    String[] opencgaTagSplit = opencgaTag.split("\\."); // a literal point
                    if (opencgaTagSplit.length == 2) {
                        String cohort = opencgaTagSplit[0];
                        VariantStatistics cohortStats = sourceEntry.getCohortStats(cohort);
                        if (cohortStats == null) {
                            cohortStats = new VariantStatistics(variant);
                            sourceEntry.setCohortStats(cohort, cohortStats);
                        }
                        switch (opencgaTagSplit[1]) {
                            case ALLELE_COUNT:
                                cohortStats.setAltAlleleCount(Integer.parseInt(values[numAllele]));
                                cohortStats.setRefAlleleCount(Integer.parseInt(
                                        values[values.length - 1]));    // ref allele count is the last one
                                break;
                            case ALLELE_FREQUENCY:
                                cohortStats.setAltAlleleFreq(Float.parseFloat(values[numAllele]));
                                cohortStats.setRefAlleleFreq(Float.parseFloat(values[values.length - 1]));
                                break;
                            case ALLELE_NUMBER:
                                // TODO implement this. also, take into account that needed fields may not be processed yet
                                break;
                            case GENOTYPE_COUNT:
                                addGenotypeWithGTS(variant, sourceEntry, values, alternateAlleles, numAllele,
                                                   cohortStats);
                                break;
                            default:
                                break;
                        }
                    }
                } else if (key.equals("MAF")) {
                    String groups_order = tagMap.getProperty("GROUPS_ORDER");
                    if (groups_order != null) {
                        String[] populations = groups_order.split(",");
                        if (populations.length == values.length) {
                            for (int i = 0; i < values.length; i++) {   // each value has the maf of each population
                                float maf = Float.parseFloat(values[i]) / 100;  // from [0, 100] (%) to [0, 1]
                                VariantStatistics cohortStats = sourceEntry.getCohortStats(populations[i]);
                                if (cohortStats == null) {
                                    cohortStats = new VariantStatistics(variant);
                                    sourceEntry.setCohortStats(populations[i], cohortStats);
                                }
                                cohortStats.setMaf(maf);
                            }
                        }
                    }
                }
            }
            // TODO reprocess stats to complete inferable values. A StatsHolder may be needed to keep values not storables in VariantStatistics
        }
    }

    @Override
    protected boolean canAlleleFrequenciesBeCalculated(VariantSourceEntry variantSourceEntry) {
        return variantSourceEntry.hasAttribute(GENOTYPE_STRING) && variantSourceEntry.hasAttribute(GENOTYPE_COUNT);
    }

    @Override
    protected boolean variantFrequencyIsZero(VariantSourceEntry variantSourceEntry) {
        return isAttributeZeroInVariantSourceEntry(variantSourceEntry, "TAC") ||
                isAttributeZeroInVariantSourceEntry(variantSourceEntry, ALLELE_NUMBER);
    }
}

redpajama_set_name: RedPajamaGithub


text:
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.Tasks.NetworkAnalysis;
using Esri.ArcGISRuntime.UI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Windows.UI.Popups;
using Windows.UI.Xaml;

namespace ArcGISRuntime.UWP.Samples.ClosestFacilityStatic
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Find closest facility to multiple incidents (service)",
        category: "Network analysis",
        description: "Find routes from several locations to the respective closest facility.",
        instructions: "Click the button to solve and display the route from each incident (fire) to the nearest facility (fire station).",
        tags: new[] { "incident", "network analysis", "route", "search" })]
    public partial class ClosestFacilityStatic
    {
        // Used to display route between incident and facility to mapview.
        private List<SimpleLineSymbol> _routeSymbols;

        // Solves task to find closest route between an incident and a facility.
        private ClosestFacilityTask _task;

        // Table of all facilities.
        private ServiceFeatureTable _facilityTable;

        // Table of all incidents.
        private ServiceFeatureTable _incidentTable;

        // Feature layer for facilities.
        private FeatureLayer _facilityLayer;

        // Feature layer for incidents.
        private FeatureLayer _incidentLayer;

        // Uri for facilities feature service.
        private Uri _facilityUri = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/ArcGIS/rest/services/San_Diego_Facilities/FeatureServer/0");

        // Uri for incident feature service.
        private Uri _incidentUri = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/ArcGIS/rest/services/San_Diego_Incidents/FeatureServer/0");

        // Uri for the closest facility service.
        private Uri _closestFacilityUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/ClosestFacility");

        public ClosestFacilityStatic()
        {
            InitializeComponent();

            // Create the map and graphics overlays.
            Initialize();
        }

        private async void Initialize()
        {
            try
            {
                // Construct the map and set the MapView.Map property.
                MyMapView.Map = new Map(BasemapStyle.ArcGISLightGray);

                // Add a graphics overlay to MyMapView. (Will be used later to display routes)
                MyMapView.GraphicsOverlays.Add(new GraphicsOverlay());

                // Create a ClosestFacilityTask using the San Diego Uri.
                _task = await ClosestFacilityTask.CreateAsync(_closestFacilityUri);

                // Create a symbol for displaying facilities.
                PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(new Uri("https://static.arcgis.com/images/Symbols/SafetyHealth/FireStation.png"))
                {
                    Height = 30,
                    Width = 30
                };

                // Incident symbol.
                PictureMarkerSymbol incidentSymbol = new PictureMarkerSymbol(new Uri("https://static.arcgis.com/images/Symbols/SafetyHealth/esriCrimeMarker_56_Gradient.png"))
                {
                    Height = 30,
                    Width = 30
                };

                // Create a list of line symbols to show unique routes. Different colors help make different routes visually distinguishable.
                _routeSymbols = new List<SimpleLineSymbol>()
                {
                    new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(125, 25, 45, 85), 5.0f),
                    new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(125, 35, 65, 120), 5.0f),
                    new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(125, 55, 100, 190), 5.0f),
                    new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(125, 75, 140, 255), 5.0f)
                };

                // Create a table for facilities using the FeatureServer.
                _facilityTable = new ServiceFeatureTable(_facilityUri);

                // Create a feature layer from the table.
                _facilityLayer = new FeatureLayer(_facilityTable)
                {
                    Renderer = new SimpleRenderer(facilitySymbol)
                };

                // Create a table for facilities using the FeatureServer.
                _incidentTable = new ServiceFeatureTable(_incidentUri);

                // Create a feature layer from the table.
                _incidentLayer = new FeatureLayer(_incidentTable)
                {
                    Renderer = new SimpleRenderer(incidentSymbol)
                };

                // Add the layers to the map.
                MyMapView.Map.OperationalLayers.Add(_facilityLayer);
                MyMapView.Map.OperationalLayers.Add(_incidentLayer);

                // Wait for both layers to load.
                await _facilityLayer.LoadAsync();
                await _incidentLayer.LoadAsync();

                // Zoom to the combined extent of both layers.
                Envelope fullExtent = GeometryEngine.CombineExtents(_facilityLayer.FullExtent, _incidentLayer.FullExtent);
                await MyMapView.SetViewpointGeometryAsync(fullExtent, 50);

                // Enable the solve button.
                SolveRoutesButton.IsEnabled = true;
            }
            catch (Exception exception)
            {
                await new MessageDialog("An exception has occurred.\n" + exception.Message, "Sample error").ShowAsync();
            }
        }

        private async void SolveRoutesClick(object sender, RoutedEventArgs e)
        {
            // Holds locations of hospitals around San Diego.
            List<Facility> facilities = new List<Facility>();

            // Holds locations of hospitals around San Diego.
            List<Incident> incidents = new List<Incident>();

            // Create query parameters to select all features.
            QueryParameters queryParams = new QueryParameters()
            {
                WhereClause = "1=1"
            };

            // Query all features in the facility table.
            FeatureQueryResult facilityResult = await _facilityTable.QueryFeaturesAsync(queryParams);

            // Add all of the query results to facilities as new Facility objects.
            facilities.AddRange(facilityResult.ToList().Select(feature => new Facility((MapPoint)feature.Geometry)));

            // Query all features in the incident table.
            FeatureQueryResult incidentResult = await _incidentTable.QueryFeaturesAsync(queryParams);

            // Add all of the query results to facilities as new Incident objects.
            incidents.AddRange(incidentResult.ToList().Select(feature => new Incident((MapPoint)feature.Geometry)));

            // Set facilities and incident in parameters.
            ClosestFacilityParameters closestFacilityParameters = await _task.CreateDefaultParametersAsync();
            closestFacilityParameters.SetFacilities(facilities);
            closestFacilityParameters.SetIncidents(incidents);

            try
            {
                // Use the task to solve for the closest facility.
                ClosestFacilityResult result = await _task.SolveClosestFacilityAsync(closestFacilityParameters);

                for (int i = 0; i < incidents.Count; i++)
                {
                    // Get the index of the closest facility to incident. (i) is the index of the incident, [0] is the index of the closest facility.
                    int closestFacility = result.GetRankedFacilityIndexes(i)[0];

                    // Get the route to the closest facility.
                    ClosestFacilityRoute route = result.GetRoute(closestFacility, i);

                    // Display the route on the graphics overlay.
                    MyMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(route.RouteGeometry, _routeSymbols[i % _routeSymbols.Count]));
                }

                // Disable the solve button.
                SolveRoutesButton.IsEnabled = false;

                // Enable the reset button.
                ResetButton.IsEnabled = true;
            }
            catch (Esri.ArcGISRuntime.Http.ArcGISWebException exception)
            {
                await new MessageDialog("An ArcGIS web exception occurred.\n" + exception.Message, "Sample error").ShowAsync();
            }
        }

        private void ResetClick(object sender, RoutedEventArgs e)
        {
            // Clear the route graphics.
            MyMapView.GraphicsOverlays[0].Graphics.Clear();

            // Reset the buttons.
            SolveRoutesButton.IsEnabled = true;
            ResetButton.IsEnabled = false;
        }
    }
}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/security/privateca/v1beta1/service.proto

package com.google.cloud.security.privateca.v1beta1;

/**
 *
 *
 *

 * Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate].
 *

 *
 * Protobuf type {@code google.cloud.security.privateca.v1beta1.CreateCertificateRequest}
 */
public final class CreateCertificateRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.security.privateca.v1beta1.CreateCertificateRequest)
    CreateCertificateRequestOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use CreateCertificateRequest.newBuilder() to construct.
  private CreateCertificateRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private CreateCertificateRequest() {
    parent_ = "";
    certificateId_ = "";
    requestId_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new CreateCertificateRequest();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.security.privateca.v1beta1.PrivateCaProto
        .internal_static_google_cloud_security_privateca_v1beta1_CreateCertificateRequest_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.security.privateca.v1beta1.PrivateCaProto
        .internal_static_google_cloud_security_privateca_v1beta1_CreateCertificateRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest.class,
            com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest.Builder.class);
  }

  public static final int PARENT_FIELD_NUMBER = 1;
  private volatile java.lang.Object parent_;
  /**
   *
   *
   *

   * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
   * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
   * `projects/*/locations/*/certificateAuthorities/*`.
   *

   *
   *
   * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The parent.
   */
  @java.lang.Override
  public java.lang.String getParent() {
    java.lang.Object ref = parent_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      parent_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
   * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
   * `projects/*/locations/*/certificateAuthorities/*`.
   *

   *
   *
   * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The bytes for parent.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getParentBytes() {
    java.lang.Object ref = parent_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      parent_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CERTIFICATE_ID_FIELD_NUMBER = 2;
  private volatile java.lang.Object certificateId_;
  /**
   *
   *
   *

   * Optional. It must be unique within a location and match the regular
   * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
   * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
   * but is optional and its value is ignored otherwise.
   *

   *
   * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The certificateId.
   */
  @java.lang.Override
  public java.lang.String getCertificateId() {
    java.lang.Object ref = certificateId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      certificateId_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Optional. It must be unique within a location and match the regular
   * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
   * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
   * but is optional and its value is ignored otherwise.
   *

   *
   * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The bytes for certificateId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getCertificateIdBytes() {
    java.lang.Object ref = certificateId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      certificateId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CERTIFICATE_FIELD_NUMBER = 3;
  private com.google.cloud.security.privateca.v1beta1.Certificate certificate_;
  /**
   *
   *
   *

   * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
   *

   *
   *
   * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return Whether the certificate field is set.
   */
  @java.lang.Override
  public boolean hasCertificate() {
    return certificate_ != null;
  }
  /**
   *
   *
   *

   * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
   *

   *
   *
   * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return The certificate.
   */
  @java.lang.Override
  public com.google.cloud.security.privateca.v1beta1.Certificate getCertificate() {
    return certificate_ == null
        ? com.google.cloud.security.privateca.v1beta1.Certificate.getDefaultInstance()
        : certificate_;
  }
  /**
   *
   *
   *

   * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
   *

   *
   *
   * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
   *
   */
  @java.lang.Override
  public com.google.cloud.security.privateca.v1beta1.CertificateOrBuilder
      getCertificateOrBuilder() {
    return getCertificate();
  }

  public static final int REQUEST_ID_FIELD_NUMBER = 4;
  private volatile java.lang.Object requestId_;
  /**
   *
   *
   *

   * Optional. An ID to identify requests. Specify a unique request ID so that if you must
   * retry your request, the server will know to ignore the request if it has
   * already been completed. The server will guarantee that for at least 60
   * minutes since the first request.
   * For example, consider a situation where you make an initial request and t
   * he request times out. If you make the request again with the same request
   * ID, the server can check if original operation with the same request ID
   * was received, and if so, will ignore the second request. This prevents
   * clients from accidentally creating duplicate commitments.
   * The request ID must be a valid UUID with the exception that zero UUID is
   * not supported (00000000-0000-0000-0000-000000000000).
   *

   *
   * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The requestId.
   */
  @java.lang.Override
  public java.lang.String getRequestId() {
    java.lang.Object ref = requestId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      requestId_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Optional. An ID to identify requests. Specify a unique request ID so that if you must
   * retry your request, the server will know to ignore the request if it has
   * already been completed. The server will guarantee that for at least 60
   * minutes since the first request.
   * For example, consider a situation where you make an initial request and t
   * he request times out. If you make the request again with the same request
   * ID, the server can check if original operation with the same request ID
   * was received, and if so, will ignore the second request. This prevents
   * clients from accidentally creating duplicate commitments.
   * The request ID must be a valid UUID with the exception that zero UUID is
   * not supported (00000000-0000-0000-0000-000000000000).
   *

   *
   * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The bytes for requestId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getRequestIdBytes() {
    java.lang.Object ref = requestId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      requestId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(certificateId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, certificateId_);
    }
    if (certificate_ != null) {
      output.writeMessage(3, getCertificate());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, requestId_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(certificateId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, certificateId_);
    }
    if (certificate_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCertificate());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, requestId_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest other =
        (com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest) obj;

    if (!getParent().equals(other.getParent())) return false;
    if (!getCertificateId().equals(other.getCertificateId())) return false;
    if (hasCertificate() != other.hasCertificate()) return false;
    if (hasCertificate()) {
      if (!getCertificate().equals(other.getCertificate())) return false;
    }
    if (!getRequestId().equals(other.getRequestId())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + PARENT_FIELD_NUMBER;
    hash = (53 * hash) + getParent().hashCode();
    hash = (37 * hash) + CERTIFICATE_ID_FIELD_NUMBER;
    hash = (53 * hash) + getCertificateId().hashCode();
    if (hasCertificate()) {
      hash = (37 * hash) + CERTIFICATE_FIELD_NUMBER;
      hash = (53 * hash) + getCertificate().hashCode();
    }
    hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER;
    hash = (53 * hash) + getRequestId().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
      parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
      parseDelimitedFrom(
          java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   *

   * Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate].
   *

   *
   * Protobuf type {@code google.cloud.security.privateca.v1beta1.CreateCertificateRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.security.privateca.v1beta1.CreateCertificateRequest)
      com.google.cloud.security.privateca.v1beta1.CreateCertificateRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.security.privateca.v1beta1.PrivateCaProto
          .internal_static_google_cloud_security_privateca_v1beta1_CreateCertificateRequest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.security.privateca.v1beta1.PrivateCaProto
          .internal_static_google_cloud_security_privateca_v1beta1_CreateCertificateRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest.class,
              com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest.Builder.class);
    }

    // Construct using
    // com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      parent_ = "";

      certificateId_ = "";

      if (certificateBuilder_ == null) {
        certificate_ = null;
      } else {
        certificate_ = null;
        certificateBuilder_ = null;
      }
      requestId_ = "";

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.security.privateca.v1beta1.PrivateCaProto
          .internal_static_google_cloud_security_privateca_v1beta1_CreateCertificateRequest_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
        getDefaultInstanceForType() {
      return com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
          .getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest build() {
      com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest buildPartial() {
      com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest result =
          new com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest(this);
      result.parent_ = parent_;
      result.certificateId_ = certificateId_;
      if (certificateBuilder_ == null) {
        result.certificate_ = certificate_;
      } else {
        result.certificate_ = certificateBuilder_.build();
      }
      result.requestId_ = requestId_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest) {
        return mergeFrom(
            (com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(
        com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest other) {
      if (other
          == com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
              .getDefaultInstance()) return this;
      if (!other.getParent().isEmpty()) {
        parent_ = other.parent_;
        onChanged();
      }
      if (!other.getCertificateId().isEmpty()) {
        certificateId_ = other.certificateId_;
        onChanged();
      }
      if (other.hasCertificate()) {
        mergeCertificate(other.getCertificate());
      }
      if (!other.getRequestId().isEmpty()) {
        requestId_ = other.requestId_;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                parent_ = input.readStringRequireUtf8();

                break;
              } // case 10
            case 18:
              {
                certificateId_ = input.readStringRequireUtf8();

                break;
              } // case 18
            case 26:
              {
                input.readMessage(getCertificateFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 26
            case 34:
              {
                requestId_ = input.readStringRequireUtf8();

                break;
              } // case 34
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private java.lang.Object parent_ = "";
    /**
     *
     *
     *

     * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
     * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
     * `projects/*/locations/*/certificateAuthorities/*`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return The parent.
     */
    public java.lang.String getParent() {
      java.lang.Object ref = parent_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        parent_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
     * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
     * `projects/*/locations/*/certificateAuthorities/*`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return The bytes for parent.
     */
    public com.google.protobuf.ByteString getParentBytes() {
      java.lang.Object ref = parent_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        parent_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
     * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
     * `projects/*/locations/*/certificateAuthorities/*`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @param value The parent to set.
     * @return This builder for chaining.
     */
    public Builder setParent(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      parent_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
     * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
     * `projects/*/locations/*/certificateAuthorities/*`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return This builder for chaining.
     */
    public Builder clearParent() {

      parent_ = getDefaultInstance().getParent();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]
     * associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format
     * `projects/*/locations/*/certificateAuthorities/*`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @param value The bytes for parent to set.
     * @return This builder for chaining.
     */
    public Builder setParentBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      parent_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object certificateId_ = "";
    /**
     *
     *
     *

     * Optional. It must be unique within a location and match the regular
     * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
     * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
     * but is optional and its value is ignored otherwise.
     *

     *
     * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The certificateId.
     */
    public java.lang.String getCertificateId() {
      java.lang.Object ref = certificateId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        certificateId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. It must be unique within a location and match the regular
     * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
     * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
     * but is optional and its value is ignored otherwise.
     *

     *
     * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The bytes for certificateId.
     */
    public com.google.protobuf.ByteString getCertificateIdBytes() {
      java.lang.Object ref = certificateId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        certificateId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. It must be unique within a location and match the regular
     * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
     * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
     * but is optional and its value is ignored otherwise.
     *

     *
     * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The certificateId to set.
     * @return This builder for chaining.
     */
    public Builder setCertificateId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      certificateId_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Optional. It must be unique within a location and match the regular
     * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
     * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
     * but is optional and its value is ignored otherwise.
     *

     *
     * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return This builder for chaining.
     */
    public Builder clearCertificateId() {

      certificateId_ = getDefaultInstance().getCertificateId();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Optional. It must be unique within a location and match the regular
     * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a
     * [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier],
     * but is optional and its value is ignored otherwise.
     *

     *
     * string certificate_id = 2 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The bytes for certificateId to set.
     * @return This builder for chaining.
     */
    public Builder setCertificateIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      certificateId_ = value;
      onChanged();
      return this;
    }

    private com.google.cloud.security.privateca.v1beta1.Certificate certificate_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.security.privateca.v1beta1.Certificate,
            com.google.cloud.security.privateca.v1beta1.Certificate.Builder,
            com.google.cloud.security.privateca.v1beta1.CertificateOrBuilder>
        certificateBuilder_;
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     *
     * @return Whether the certificate field is set.
     */
    public boolean hasCertificate() {
      return certificateBuilder_ != null || certificate_ != null;
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     *
     * @return The certificate.
     */
    public com.google.cloud.security.privateca.v1beta1.Certificate getCertificate() {
      if (certificateBuilder_ == null) {
        return certificate_ == null
            ? com.google.cloud.security.privateca.v1beta1.Certificate.getDefaultInstance()
            : certificate_;
      } else {
        return certificateBuilder_.getMessage();
      }
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder setCertificate(com.google.cloud.security.privateca.v1beta1.Certificate value) {
      if (certificateBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        certificate_ = value;
        onChanged();
      } else {
        certificateBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder setCertificate(
        com.google.cloud.security.privateca.v1beta1.Certificate.Builder builderForValue) {
      if (certificateBuilder_ == null) {
        certificate_ = builderForValue.build();
        onChanged();
      } else {
        certificateBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder mergeCertificate(com.google.cloud.security.privateca.v1beta1.Certificate value) {
      if (certificateBuilder_ == null) {
        if (certificate_ != null) {
          certificate_ =
              com.google.cloud.security.privateca.v1beta1.Certificate.newBuilder(certificate_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          certificate_ = value;
        }
        onChanged();
      } else {
        certificateBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder clearCertificate() {
      if (certificateBuilder_ == null) {
        certificate_ = null;
        onChanged();
      } else {
        certificate_ = null;
        certificateBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public com.google.cloud.security.privateca.v1beta1.Certificate.Builder getCertificateBuilder() {

      onChanged();
      return getCertificateFieldBuilder().getBuilder();
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public com.google.cloud.security.privateca.v1beta1.CertificateOrBuilder
        getCertificateOrBuilder() {
      if (certificateBuilder_ != null) {
        return certificateBuilder_.getMessageOrBuilder();
      } else {
        return certificate_ == null
            ? com.google.cloud.security.privateca.v1beta1.Certificate.getDefaultInstance()
            : certificate_;
      }
    }
    /**
     *
     *
     *

     * Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values.
     *

     *
     *
     * .google.cloud.security.privateca.v1beta1.Certificate certificate = 3 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.security.privateca.v1beta1.Certificate,
            com.google.cloud.security.privateca.v1beta1.Certificate.Builder,
            com.google.cloud.security.privateca.v1beta1.CertificateOrBuilder>
        getCertificateFieldBuilder() {
      if (certificateBuilder_ == null) {
        certificateBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.security.privateca.v1beta1.Certificate,
                com.google.cloud.security.privateca.v1beta1.Certificate.Builder,
                com.google.cloud.security.privateca.v1beta1.CertificateOrBuilder>(
                getCertificate(), getParentForChildren(), isClean());
        certificate_ = null;
      }
      return certificateBuilder_;
    }

    private java.lang.Object requestId_ = "";
    /**
     *
     *
     *

     * Optional. An ID to identify requests. Specify a unique request ID so that if you must
     * retry your request, the server will know to ignore the request if it has
     * already been completed. The server will guarantee that for at least 60
     * minutes since the first request.
     * For example, consider a situation where you make an initial request and t
     * he request times out. If you make the request again with the same request
     * ID, the server can check if original operation with the same request ID
     * was received, and if so, will ignore the second request. This prevents
     * clients from accidentally creating duplicate commitments.
     * The request ID must be a valid UUID with the exception that zero UUID is
     * not supported (00000000-0000-0000-0000-000000000000).
     *

     *
     * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The requestId.
     */
    public java.lang.String getRequestId() {
      java.lang.Object ref = requestId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        requestId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. An ID to identify requests. Specify a unique request ID so that if you must
     * retry your request, the server will know to ignore the request if it has
     * already been completed. The server will guarantee that for at least 60
     * minutes since the first request.
     * For example, consider a situation where you make an initial request and t
     * he request times out. If you make the request again with the same request
     * ID, the server can check if original operation with the same request ID
     * was received, and if so, will ignore the second request. This prevents
     * clients from accidentally creating duplicate commitments.
     * The request ID must be a valid UUID with the exception that zero UUID is
     * not supported (00000000-0000-0000-0000-000000000000).
     *

     *
     * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The bytes for requestId.
     */
    public com.google.protobuf.ByteString getRequestIdBytes() {
      java.lang.Object ref = requestId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        requestId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. An ID to identify requests. Specify a unique request ID so that if you must
     * retry your request, the server will know to ignore the request if it has
     * already been completed. The server will guarantee that for at least 60
     * minutes since the first request.
     * For example, consider a situation where you make an initial request and t
     * he request times out. If you make the request again with the same request
     * ID, the server can check if original operation with the same request ID
     * was received, and if so, will ignore the second request. This prevents
     * clients from accidentally creating duplicate commitments.
     * The request ID must be a valid UUID with the exception that zero UUID is
     * not supported (00000000-0000-0000-0000-000000000000).
     *

     *
     * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The requestId to set.
     * @return This builder for chaining.
     */
    public Builder setRequestId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      requestId_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Optional. An ID to identify requests. Specify a unique request ID so that if you must
     * retry your request, the server will know to ignore the request if it has
     * already been completed. The server will guarantee that for at least 60
     * minutes since the first request.
     * For example, consider a situation where you make an initial request and t
     * he request times out. If you make the request again with the same request
     * ID, the server can check if original operation with the same request ID
     * was received, and if so, will ignore the second request. This prevents
     * clients from accidentally creating duplicate commitments.
     * The request ID must be a valid UUID with the exception that zero UUID is
     * not supported (00000000-0000-0000-0000-000000000000).
     *

     *
     * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return This builder for chaining.
     */
    public Builder clearRequestId() {

      requestId_ = getDefaultInstance().getRequestId();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Optional. An ID to identify requests. Specify a unique request ID so that if you must
     * retry your request, the server will know to ignore the request if it has
     * already been completed. The server will guarantee that for at least 60
     * minutes since the first request.
     * For example, consider a situation where you make an initial request and t
     * he request times out. If you make the request again with the same request
     * ID, the server can check if original operation with the same request ID
     * was received, and if so, will ignore the second request. This prevents
     * clients from accidentally creating duplicate commitments.
     * The request ID must be a valid UUID with the exception that zero UUID is
     * not supported (00000000-0000-0000-0000-000000000000).
     *

     *
     * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The bytes for requestId to set.
     * @return This builder for chaining.
     */
    public Builder setRequestIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      requestId_ = value;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.security.privateca.v1beta1.CreateCertificateRequest)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.security.privateca.v1beta1.CreateCertificateRequest)
  private static final com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest();
  }

  public static com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
      getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<CreateCertificateRequest> PARSER =
      new com.google.protobuf.AbstractParser<CreateCertificateRequest>() {
        @java.lang.Override
        public CreateCertificateRequest parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<CreateCertificateRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<CreateCertificateRequest> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest
      getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}


text:
require 'formula'

class GitPublish < Formula
  homepage "http://www.will-ob.com/git-publish/"
  url 'https://api.github.com/repos/will-ob/git-publish/tarball'
  sha1 '2ed45f83c5cfee56a94423da0848b7c7e82f29f2'
  version '0.1.0'

  def install
    bin.install "git-publish"
  end
end


text:
<?php
if(!isset($_SESSION)) {
     session_start();
}
if(!isset($_SESSION['username'])){
?>
<script>document.location.href="../login/"</script>
<?php
}

$host="localhost"; //deklarasi variabel
$user="root";
$password="";
$database="hospital";

//sambungkan ke database
$koneksi=mysql_connect($host,$user,$password);

//memilih database yang akan dipakai
mysql_select_db($database,$koneksi);

if($koneksi){  //cek koneksi
//echo "berhasil koneksi";
}else{
 echo "koneksi ke database mysql gagal";
}

?>


text:
from important import do_important

def main():
    '''business logic for when running this module as the primary one!'''
    #setup()
    foo = do_important()
    print('business logic for when running this module as the primary one!')

if __name__ == '__main__':
    # Do something appropriate here, like calling a
    # main() function defined elsewhere in this module.
    main()
else:
	foo = do_important()
    # Do nothing. This module has been imported by another
    # module that wants to make use of the functions,
    # classes and other useful bits it has defined.


text:
/**
 *
 */
package libs;

import libs.functions.Function;

/**
 * @author iskoulis
 *
 */
public class Input {

	public Function func;
	public Range range;
	public double steps;
	public int dim;

	public Input(Function func, Range range, double steps) {
		this.func = func;
		this.range = range;
		this.steps = steps;
		this.dim = range.min.length;
	}

}


text:
struct MemoryManager
{
    std::forward_list<Allocation> allocated;

    template<typename T>
    Allocation allocate(std::size_t size)
    {
        void* memory = std::calloc(sizeof(T), size);
        if (memory == nullptr)
        {
            throw std::bad_alloc();
        }
        return Allocation { memory };
    }
};


text:
//  See http://www.boost.org/libs/test for the library home page.
//
//  File        : $RCSfile$
//
//  Version     : $Revision: 41369 $
//
//  Description : defines algoirthms for comparing 2 floating point values
// ***************************************************************************

#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER

#include <boost/limits.hpp>  // for std::numeric_limits

#include <boost/test/utils/class_properties.hpp>

#include <boost/test/detail/suppress_warnings.hpp>

//____________________________________________________________________________//

namespace boost {

namespace test_tools {

using unit_test::readonly_property;

// ************************************************************************** //
// **************        floating_point_comparison_type        ************** //
// ************************************************************************** //

enum floating_point_comparison_type {
    FPC_STRONG, // "Very close"   - equation 1' in docs, the default
    FPC_WEAK    // "Close enough" - equation 2' in docs.

};

// ************************************************************************** //
// **************                    details                   ************** //
// ************************************************************************** //

namespace tt_detail {

// FPT is Floating-Point Type: float, double, long double or User-Defined.
template<typename FPT>
inline FPT
fpt_abs( FPT arg )
{
    return arg < static_cast<FPT>(0) ? -arg : arg;
}

//____________________________________________________________________________//

template<typename FPT>
struct fpt_limits {
    static FPT    min_value()
    {
        return std::numeric_limits<FPT>::is_specialized
                    ? (std::numeric_limits<FPT>::min)()
                    : 0;
    }
    static FPT    max_value()
    {
        return std::numeric_limits<FPT>::is_specialized
                    ? (std::numeric_limits<FPT>::max)()
                    : static_cast<FPT>(1000000); // for the our purpuses it doesn't really matter what value is returned here
    }
};

//____________________________________________________________________________//

// both f1 and f2 are unsigned here
template<typename FPT>
inline FPT
safe_fpt_division( FPT f1, FPT f2 )
{
    // Avoid overflow.
    if( f2 < static_cast<FPT>(1)  && f1 > f2*fpt_limits<FPT>::max_value() )
        return fpt_limits<FPT>::max_value();

    // Avoid underflow.
    if( f1 == static_cast<FPT>(0) ||
        f2 > static_cast<FPT>(1) && f1 < f2*fpt_limits<FPT>::min_value() )
        return static_cast<FPT>(0);

    return f1/f2;
}

//____________________________________________________________________________//

} // namespace tt_detail

// ************************************************************************** //
// **************         tolerance presentation types         ************** //
// ************************************************************************** //

template<typename FPT>
struct percent_tolerance_t {
    explicit    percent_tolerance_t( FPT v ) : m_value( v ) {}

    FPT m_value;
};

//____________________________________________________________________________//

template<typename Out,typename FPT>
Out& operator<<( Out& out, percent_tolerance_t<FPT> t )
{
    return out << t.m_value;
}

//____________________________________________________________________________//

template<typename FPT>
inline percent_tolerance_t<FPT>
percent_tolerance( FPT v )
{
    return percent_tolerance_t<FPT>( v );
}

//____________________________________________________________________________//

template<typename FPT>
struct fraction_tolerance_t {
    explicit fraction_tolerance_t( FPT v ) : m_value( v ) {}

    FPT m_value;
};

//____________________________________________________________________________//

template<typename Out,typename FPT>
Out& operator<<( Out& out, fraction_tolerance_t<FPT> t )
{
    return out << t.m_value;
}

//____________________________________________________________________________//

template<typename FPT>
inline fraction_tolerance_t<FPT>
fraction_tolerance( FPT v )
{
    return fraction_tolerance_t<FPT>( v );
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************             close_at_tolerance               ************** //
// ************************************************************************** //

template<typename FPT>
class close_at_tolerance {
public:
    // Public typedefs
    typedef bool result_type;

    // Constructor
    template<typename ToleranceBaseType>
    explicit    close_at_tolerance( percent_tolerance_t<ToleranceBaseType>  tolerance,
                                    floating_point_comparison_type          fpc_type = FPC_STRONG )
    : p_fraction_tolerance( tt_detail::fpt_abs( static_cast<FPT>(0.01)*tolerance.m_value ) )
    , p_strong_or_weak( fpc_type ==  FPC_STRONG )
    {}
    template<typename ToleranceBaseType>
    explicit    close_at_tolerance( fraction_tolerance_t<ToleranceBaseType> tolerance,
                                    floating_point_comparison_type          fpc_type = FPC_STRONG )
    : p_fraction_tolerance( tt_detail::fpt_abs( tolerance.m_value ) )
    , p_strong_or_weak( fpc_type ==  FPC_STRONG )
    {}

    bool        operator()( FPT left, FPT right ) const
    {
        FPT diff = tt_detail::fpt_abs( left - right );
        FPT d1   = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( right ) );
        FPT d2   = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( left ) );

        return p_strong_or_weak
                   ? (d1 <= p_fraction_tolerance && d2 <= p_fraction_tolerance)
                   : (d1 <= p_fraction_tolerance || d2 <= p_fraction_tolerance);
    }

    // Public properties
    readonly_property<FPT>  p_fraction_tolerance;
    readonly_property<bool> p_strong_or_weak;
};

//____________________________________________________________________________//

// ************************************************************************** //
// **************               check_is_close                 ************** //
// ************************************************************************** //

struct BOOST_TEST_DECL check_is_close_t {
    // Public typedefs
    typedef bool result_type;

    template<typename FPT, typename ToleranceBaseType>
    bool
    operator()( FPT left, FPT right, percent_tolerance_t<ToleranceBaseType> tolerance,
                floating_point_comparison_type fpc_type = FPC_STRONG )
    {
        close_at_tolerance<FPT> pred( tolerance, fpc_type );

        return pred( left, right );
    }
    template<typename FPT, typename ToleranceBaseType>
    bool
    operator()( FPT left, FPT right, fraction_tolerance_t<ToleranceBaseType> tolerance,
                floating_point_comparison_type fpc_type = FPC_STRONG )
    {
        close_at_tolerance<FPT> pred( tolerance, fpc_type );

        return pred( left, right );
    }
};

namespace {
check_is_close_t check_is_close;
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************               check_is_small                 ************** //
// ************************************************************************** //

struct BOOST_TEST_DECL check_is_small_t {
    // Public typedefs
    typedef bool result_type;

    template<typename FPT>
    bool
    operator()( FPT fpv, FPT tolerance )
    {
        return tt_detail::fpt_abs( fpv ) < tt_detail::fpt_abs( tolerance );
    }
};

namespace {
check_is_small_t check_is_small;
}

//____________________________________________________________________________//

} // namespace test_tools

} // namespace boost

//____________________________________________________________________________//

#include <boost/test/detail/enable_warnings.hpp>

#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER


text:
package org.apache.spark.streaming.util

import java.io.FileNotFoundException
import java.nio.ByteBuffer
import java.util.{Iterator => JIterator}
import java.util.concurrent.RejectedExecutionException

import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer
import scala.collection.parallel.ExecutionContextTaskSupport
import scala.collection.parallel.immutable.ParVector
import scala.concurrent.{Await, ExecutionContext, Future}

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path

import org.apache.spark.SparkConf
import org.apache.spark.internal.Logging
import org.apache.spark.util.{CompletionIterator, ThreadUtils}

/**
 * This class manages write ahead log files.
 *
 *  - Writes records (bytebuffers) to periodically rotating log files.
 *  - Recovers the log files and the reads the recovered records upon failures.
 *  - Cleans up old log files.
 *
 * Uses [[org.apache.spark.streaming.util.FileBasedWriteAheadLogWriter]] to write
 * and [[org.apache.spark.streaming.util.FileBasedWriteAheadLogReader]] to read.
 *
 * @param logDirectory Directory when rotating log files will be created.
 * @param hadoopConf Hadoop configuration for reading/writing log files.
 */
private[streaming] class FileBasedWriteAheadLog(
    conf: SparkConf,
    logDirectory: String,
    hadoopConf: Configuration,
    rollingIntervalSecs: Int,
    maxFailures: Int,
    closeFileAfterWrite: Boolean
  ) extends WriteAheadLog with Logging {

  import FileBasedWriteAheadLog._

  private val pastLogs = new ArrayBuffer[LogInfo]
  private val callerName = getCallerName

  private val threadpoolName = {
    "WriteAheadLogManager" + callerName.map(c => s" for $c").getOrElse("")
  }
  private val forkJoinPool = ThreadUtils.newForkJoinPool(threadpoolName, 20)
  private val executionContext = ExecutionContext.fromExecutorService(forkJoinPool)

  override protected def logName = {
    getClass.getName.stripSuffix("$") +
      callerName.map("_" + _).getOrElse("").replaceAll("[ ]", "_")
  }

  private var currentLogPath: Option[String] = None
  private var currentLogWriter: FileBasedWriteAheadLogWriter = null
  private var currentLogWriterStartTime: Long = -1L
  private var currentLogWriterStopTime: Long = -1L

  initializeOrRecover()

  /**
   * Write a byte buffer to the log file. This method synchronously writes the data in the
   * ByteBuffer to HDFS. When this method returns, the data is guaranteed to have been flushed
   * to HDFS, and will be available for readers to read.
   */
  def write(byteBuffer: ByteBuffer, time: Long): FileBasedWriteAheadLogSegment = synchronized {
    var fileSegment: FileBasedWriteAheadLogSegment = null
    var failures = 0
    var lastException: Exception = null
    var succeeded = false
    while (!succeeded && failures < maxFailures) {
      try {
        fileSegment = getLogWriter(time).write(byteBuffer)
        if (closeFileAfterWrite) {
          resetWriter()
        }
        succeeded = true
      } catch {
        case ex: Exception =>
          lastException = ex
          logWarning("Failed to write to write ahead log")
          resetWriter()
          failures += 1
      }
    }
    if (fileSegment == null) {
      logError(s"Failed to write to write ahead log after $failures failures")
      throw lastException
    }
    fileSegment
  }

  def read(segment: WriteAheadLogRecordHandle): ByteBuffer = {
    val fileSegment = segment.asInstanceOf[FileBasedWriteAheadLogSegment]
    var reader: FileBasedWriteAheadLogRandomReader = null
    var byteBuffer: ByteBuffer = null
    try {
      reader = new FileBasedWriteAheadLogRandomReader(fileSegment.path, hadoopConf)
      byteBuffer = reader.read(fileSegment)
    } finally {
      reader.close()
    }
    byteBuffer
  }

  /**
   * Read all the existing logs from the log directory.
   *
   * Note that this is typically called when the caller is initializing and wants
   * to recover past state from the write ahead logs (that is, before making any writes).
   * If this is called after writes have been made using this manager, then it may not return
   * the latest the records. This does not deal with currently active log files, and
   * hence the implementation is kept simple.
   */
  def readAll(): JIterator[ByteBuffer] = synchronized {
    val logFilesToRead = pastLogs.map{ _.path} ++ currentLogPath
    logInfo("Reading from the logs:\n" + logFilesToRead.mkString("\n"))
    def readFile(file: String): Iterator[ByteBuffer] = {
      logDebug(s"Creating log reader with $file")
      val reader = new FileBasedWriteAheadLogReader(file, hadoopConf)
      CompletionIterator[ByteBuffer, Iterator[ByteBuffer]](reader, () => reader.close())
    }
    if (!closeFileAfterWrite) {
      logFilesToRead.iterator.flatMap(readFile).asJava
    } else {
      // For performance gains, it makes sense to parallelize the recovery if
      // closeFileAfterWrite = true
      seqToParIterator(executionContext, logFilesToRead.toSeq, readFile).asJava
    }
  }

  /**
   * Delete the log files that are older than the threshold time.
   *
   * Its important to note that the threshold time is based on the time stamps used in the log
   * files, which is usually based on the local system time. So if there is coordination necessary
   * between the node calculating the threshTime (say, driver node), and the local system time
   * (say, worker node), the caller has to take account of possible time skew.
   *
   * If waitForCompletion is set to true, this method will return only after old logs have been
   * deleted. This should be set to true only for testing. Else the files will be deleted
   * asynchronously.
   */
  def clean(threshTime: Long, waitForCompletion: Boolean): Unit = {
    val oldLogFiles = synchronized {
      val expiredLogs = pastLogs.filter { _.endTime < threshTime }
      pastLogs --= expiredLogs
      expiredLogs
    }
    logInfo(s"Attempting to clear ${oldLogFiles.size} old log files in $logDirectory " +
      s"older than $threshTime: ${oldLogFiles.map { _.path }.mkString("\n")}")

    def deleteFile(walInfo: LogInfo): Unit = {
      try {
        val path = new Path(walInfo.path)
        val fs = HdfsUtils.getFileSystemForPath(path, hadoopConf)
        fs.delete(path, true)
        logDebug(s"Cleared log file $walInfo")
      } catch {
        case ex: Exception =>
          logWarning(s"Error clearing write ahead log file $walInfo", ex)
      }
      logInfo(s"Cleared log files in $logDirectory older than $threshTime")
    }
    oldLogFiles.foreach { logInfo =>
      if (!executionContext.isShutdown) {
        try {
          val f = Future { deleteFile(logInfo) }(executionContext)
          if (waitForCompletion) {
            import scala.concurrent.duration._
            // scalastyle:off awaitready
            Await.ready(f, 1.second)
            // scalastyle:on awaitready
          }
        } catch {
          case e: RejectedExecutionException =>
            logWarning("Execution context shutdown before deleting old WriteAheadLogs. " +
              "This would not affect recovery correctness.", e)
        }
      }
    }
  }

  /** Stop the manager, close any open log writer */
  def close(): Unit = synchronized {
    if (!executionContext.isShutdown) {
      if (currentLogWriter != null) {
        currentLogWriter.close()
      }
      executionContext.shutdown()
    }
    logInfo("Stopped write ahead log manager")
  }

  /** Get the current log writer while taking care of rotation */
  private def getLogWriter(currentTime: Long): FileBasedWriteAheadLogWriter = synchronized {
    if (currentLogWriter == null || currentTime > currentLogWriterStopTime) {
      resetWriter()
      currentLogPath.foreach {
        pastLogs += LogInfo(currentLogWriterStartTime, currentLogWriterStopTime, _)
      }
      currentLogWriterStartTime = currentTime
      currentLogWriterStopTime = currentTime + (rollingIntervalSecs * 1000L)
      val newLogPath = new Path(logDirectory,
        timeToLogFile(currentLogWriterStartTime, currentLogWriterStopTime))
      currentLogPath = Some(newLogPath.toString)
      currentLogWriter = new FileBasedWriteAheadLogWriter(currentLogPath.get, hadoopConf)
    }
    currentLogWriter
  }

  /** Initialize the log directory or recover existing logs inside the directory */
  private def initializeOrRecover(): Unit = synchronized {
    val logDirectoryPath = new Path(logDirectory)
    val fileSystem = HdfsUtils.getFileSystemForPath(logDirectoryPath, hadoopConf)

    try {
      // If you call listStatus(file) it returns a stat of the file in the array,
      // rather than an array listing all the children.
      // This makes it hard to differentiate listStatus(file) and
      // listStatus(dir-with-one-child) except by examining the name of the returned status,
      // and once you've got symlinks in the mix that differentiation isn't easy.
      // Checking for the path being a directory is one more call to the filesystem, but
      // leads to much clearer code.
      if (fileSystem.getFileStatus(logDirectoryPath).isDirectory) {
        val logFileInfo = logFilesTologInfo(
          fileSystem.listStatus(logDirectoryPath).map { _.getPath })
        pastLogs.clear()
        pastLogs ++= logFileInfo
        logInfo(s"Recovered ${logFileInfo.size} write ahead log files from $logDirectory")
        logDebug(s"Recovered files are:\n${logFileInfo.map(_.path).mkString("\n")}")
      }
    } catch {
      case _: FileNotFoundException =>
        // there is no log directory, hence nothing to recover
    }
  }

  private def resetWriter(): Unit = synchronized {
    if (currentLogWriter != null) {
      currentLogWriter.close()
      currentLogWriter = null
    }
  }
}

private[streaming] object FileBasedWriteAheadLog {

  case class LogInfo(startTime: Long, endTime: Long, path: String)

  val logFileRegex = """log-(\d+)-(\d+)""".r

  def timeToLogFile(startTime: Long, stopTime: Long): String = {
    s"log-$startTime-$stopTime"
  }

  def getCallerName(): Option[String] = {
    val ignoreList = Seq("WriteAheadLog", "Logging", "java.lang", "scala.")
    Thread.currentThread.getStackTrace()
      .map(_.getClassName)
      .find { c => !ignoreList.exists(c.contains) }
      .flatMap(_.split("\\.").lastOption)
      .flatMap(_.split("\\$\\$").headOption)
  }

  /** Convert a sequence of files to a sequence of sorted LogInfo objects */
  def logFilesTologInfo(files: Seq[Path]): Seq[LogInfo] = {
    files.flatMap { file =>
      logFileRegex.findFirstIn(file.getName()) match {
        case Some(logFileRegex(startTimeStr, stopTimeStr)) =>
          val startTime = startTimeStr.toLong
          val stopTime = stopTimeStr.toLong
          Some(LogInfo(startTime, stopTime, file.toString))
        case None =>
          None
      }
    }.sortBy { _.startTime }
  }

  /**
   * This creates an iterator from a parallel collection, by keeping at most `n` objects in memory
   * at any given time, where `n` is at most the max of the size of the thread pool or 8. This is
   * crucial for use cases where we create `FileBasedWriteAheadLogReader`s during parallel recovery.
   * We don't want to open up `k` streams altogether where `k` is the size of the Seq that we want
   * to parallelize.
   */
  def seqToParIterator[I, O](
      executionContext: ExecutionContext,
      source: Seq[I],
      handler: I => Iterator[O]): Iterator[O] = {
    val taskSupport = new ExecutionContextTaskSupport(executionContext)
    val groupSize = taskSupport.parallelismLevel.max(8)

    source.grouped(groupSize).flatMap { group =>
      val parallelCollection = new ParVector(group.toVector)
      parallelCollection.tasksupport = taskSupport
      parallelCollection.map(handler)
    }.flatten
  }
}


text:
<?php require_once('../Connections/connect_supply.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$cat_var_CategorieData = "0";
if (isset($_GET["recordID"])) {
  $cat_var_CategorieData = $_GET["recordID"];
}
mysql_select_db($database_connect_supply, $connect_supply);
$query_CategorieData = sprintf("SELECT * FROM categories WHERE categories.cat_id = %s", GetSQLValueString($cat_var_CategorieData, "int"));
$CategorieData = mysql_query($query_CategorieData, $connect_supply) or die(mysql_error());
$row_CategorieData = mysql_fetch_assoc($CategorieData);
$totalRows_CategorieData = mysql_num_rows($CategorieData);

$prod_var_ProductData = "0";
if (isset($_GET["recordID"])) {
  $prod_var_ProductData = $_GET["recordID"];
}
mysql_select_db($database_connect_supply, $connect_supply);
$query_ProductData = sprintf("SELECT * FROM products WHERE products.prod_categorie = %s", GetSQLValueString($prod_var_ProductData, "int"));
$ProductData = mysql_query($query_ProductData, $connect_supply) or die(mysql_error());
$row_ProductData = mysql_fetch_assoc($ProductData);
$totalRows_ProductData = mysql_num_rows($ProductData);
?>
<!doctype html>

<meta charset="utf-8">

<title>Supply CVBA</title>

<meta name="keywords" content="
Supply, Niel, tanden, tandlabo, tandtechnicus, groothandel tanden, tandprothese, tandmateriaal, porselein, acryl, tandchirurg, [Dentaaltechnische bedrijven]" >
<meta name="description" content="GG Supply in Niel is uw specialist groothandel in tanden uit acryl en porselein prothese. Slijtvastheid en kwaliteit zijn onze troeven voor u de juiste service!" >
<link href="../CSS/main_2col_hdrftr.css" rel="stylesheet" type="text/css">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">

Home

Producten

Contact

      <?php include("../includes/catalogus.php"); ?>

  	<?php if(isset($_GET["recordID"])) {
		echo "
" . $row_CategorieData['cat_soort'] . " " . $row_CategorieData['cat_beschrijving'] . " " . $row_CategorieData['cat_tandkies'] . "
";
        if($_GET['recordID'] == 4 || $_GET['recordID'] == 11 ) { ?>

*Langere levertijd

  	    <?php } ?>
		<form method="post" name="form" class="formclass" autocomplete="off" action="shoppingcart.php?submit=true">
		<?php if ($totalRows_ProductData > 0) { // Show if recordset not empty
  			include("../includes/formswitch.php"); ?>
			<input type="submit" value="Toevoegen" class="submitbutton">
  	 	<?php } // Show if recordset not empty
		else { ?>

Deze categorie is momenteel leeg.

		<?php } ?>
        </form>
        <?php include('../includes/scripts/calcRow.php'); ?>
	<?php }
    else { ?>

Welkom!

Kies een categorie aan de linkerzijde.

    <?php } ?>

Copyright © Supply CVBA, Raf Smits

    	Matteottistraat 65

		2845 Niel

		België

		Tel.: +32(0)3 888 68 61

		GSM:  +32(0)483 08 33 22

<?php
mysql_free_result($CategorieData);

mysql_free_result($ProductData);

mysql_close($connect_supply);
?>


text:
class CreateMovies < ActiveRecord::Migration
  def change
    create_table :movies do |t|
      t.integer :auditorium_id
      t.string :title
      t.string :rating
      t.string :female_lead
      t.string :male_lead
      t.integer :year_released
      t.integer :run_time

      t.timestamps null: false
    end
  end
end