text:
package vnic

import (
	"context"
	"errors"
	"flag"

	"github.com/vmware/govmomi/govc/cli"
	"github.com/vmware/govmomi/govc/flags"
	"github.com/vmware/govmomi/vim25/mo"
)

type change struct {
	*flags.HostSystemFlag

	mtu int32
}

func init() {
	cli.Register("host.vnic.change", &change{})
}

func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.HostSystemFlag, ctx = flags.NewHostSystemFlag(ctx)
	cmd.HostSystemFlag.Register(ctx, f)

	f.Var(flags.NewInt32(&cmd.mtu), "mtu", "vmk MTU")
}

func (cmd *change) Process(ctx context.Context) error {
	if err := cmd.HostSystemFlag.Process(ctx); err != nil {
		return err
	}

	return nil
}

func (cmd *change) Usage() string {
	return "DEVICE"
}

func (cmd *change) Description() string {
	return `Change a virtual nic DEVICE.

Examples:
  govc host.vnic.change -host hostname -mtu 9000 vmk1`
}

func (cmd *change) Run(ctx context.Context, f *flag.FlagSet) error {
	if f.NArg() != 1 {
		return flag.ErrHelp
	}

	device := f.Arg(0)

	ns, err := cmd.HostNetworkSystem()
	if err != nil {
		return err
	}

	var mns mo.HostNetworkSystem

	err = ns.Properties(ctx, ns.Reference(), []string{"networkInfo"}, &mns)
	if err != nil {
		return err
	}

	for _, nic := range mns.NetworkInfo.Vnic {
		if nic.Device == device {
			nic.Spec.Mtu = cmd.mtu
			return ns.UpdateVirtualNic(ctx, device, nic.Spec)
		}
	}

	return errors.New(device + " not found")
}


text:
/* see the implementation of __set_tls and pthread.c to understand this
 * code. Basically, the content of gs:[0] always is a pointer to the base
 * address of the tls region
 */
void*   __get_tls(void)
{
  void*  tls;
  asm ( "   movl  %%gs:0, %0" : "=r"(tls) );
  return tls;
}

redpajama_set_name: RedPajamaGithub


text:
title:            "Shop Homepage"
slug:             shop-homepage
src:              /templates/shop-homepage
categories:       ecommerce
description:      "A simple, unstyled, shop home page template with star icons and a header carousel"
bump:             "An online store homepage template"
img-thumbnail:    /assets/img/screenshots/templates/shop-homepage.jpg
img-full:         /assets/img/screenshots/templates/shop-homepage.png
img-desc:         "Free Bootstrap Ecommerce Template"
layout:		    	  overview-theme
type:             template
rank: 5

version:          4.2.1
bootstrap:        4.3.1
updated:          2019-06-14

meta-title:       "Shop Homepage - Bootstrap Ecommerce Store Template"
meta-description: "A Bootstrap 4 ecommerce homepage template for shop or store items. All Start Bootstrap templates are free to download and open source."

features:
  - Header carousel for featured items
  - Sidebar navigation list for shop categories
  - Product item cards with title, price, description, and reviews system

long-description: "Shop Homepage is a starter template for a Bootstrap based online store or ecommerce website."

redirect_from:
  - /shop-homepage/
  - /shop-homepage.php/
  - /templates/shop-homepage.html/
  - /templates/shop-homepage/
  - /downloads/shop-homepage.zip/
  - /template-overviews/shop-homepage/
---


text:
Credits
=======

The following people have contributed to the to HOOMD-blue:

* Aaron Keys, University of Michigan
* Alain Kadar, University of Michigan
* Alex Travesset, Iowa State University and Ames Laboratory
* Alex Yang, Vanderbilt University
* Alexander Hudson
* Allen LaCour, University of Michigan
* Alyssa Travitz, University of Michigan
* Andrew Schultz, University at Buffalo
* Andrew Mark, Max Planck Institute
* Andrey Kazennov, Joint Institute for High Temperatures of RAS
* Antonio Osorio, University of Michigan
* Avisek Das, University of Michigan
* Axel Kohlmeyer, Temple University
* Ben Levine, Temple University
* Ben Swerdlow, University of Michgan
* Benjamin Schultz, University of Michgan
* Bjørnar Jensen, University of Bergen
* Bradley Dice, University of Michigan
* Brandon Butler, University of Michigan
* Brandon Denis Smith, University of Michigan
* Bryan VanSaders, University of Michgan
* Carl Simon Adorf, University of Michigan
* Carolyn Phillips, University of Michigan
* Charlie Slominski, Caltech
* Chengyu Dai, University of Michigan
* Chris Jones, Boise State University
* Christoph Junghans
* Christoph Klein, Vanderbilt University
* Chrisy Du, University of Michigan
* Cong Qiao, Brandeis University
* Corwin Kerr, University of Michigan
* Charlotte Zhao, University of Michigan
* Dan Evans, University of Michigan
* David LeBard, Temple University
* Elizabeth R Chen, University of Michigan
* Eric Harper, University of Michigan
* Eric Irrgang, University of Michigan
* Eric Jankowski, Boise State University
* Erin Teich, University of Michigan
* Fengyi Gao, University of Michigan
* Gabrielle Jones, University of Michigan
* Geert Kapteijns, University of Amsterdam
* Greg van Anders, University of Michigan
* Grey Garrett, University of Michigan
* Igor Morozov, Joint Institute for High Temperatures of RAS
* Isaac Bruss, University of Michigan
* Jakin B. Delony, University of South Florida
* James Antonaglia, University of Michigan
* James Proctor, University of Michigan
* James W. Swan, Massachusetts Institute of Technology
* Jenny Fothergill, Boise State University
* Jens Glaser, Oak Ridge National Laboratory
* Joseph Berleant, University of Michigan
* Joshua A. Anderson, University of Michigan
* Kelly Wang, University of Michigan
* Kevin Daly, Princeton University
* Kevin Kohlstedt, University of Michigan
* Kevin Silmore, Princeton University
* Khalid Ahmed, University of Michigan
* Kristi Pepa, University of Michigan
* Kwanghwi Je, University of Michigan
* Lin Yang, Iowa State University
* Ludwig Schneider, Georg-August Univeristy Goettingen
* Luis Y. Rivera-Rivera, University of Michigan
* Malcolm Ramsay
* Matthew Spellings, University of Michgan
* Michael Howard, University of Texas
* Mike Henry, Boise State University
* Nathan Horst
* Nipuli Gunaratne, University of Michigan
* Patrick Lawton, University of Michigan
* Paul Dodd, University of Michigan
* Pavani Medapuram Lakshmi Narasimha, University of Minnesota
* Pengji Zhou, University of Michgan
* Peter Palm, Leipzig University
* Peter Schwendeman, University of Michigan
* Philipp Mertmann, Ruhr University Bochum
* Philipp Schönhöfer, University of Michigan
* Rastko Sknepnek, Northwestern
* Raymond Asare, University of Michigan
* Richmond Newman, University of Michigan
* Roman Bystryi, Joint Institute for High Temperatures of RAS
* Ross Smith, University of Michigan
* Ryan Marson, University of Michigan
* Sam Nola, University of Michigan
* Simone Ciarella, Eindhoven University of Technology
* Shannon Moran, University of Michigan
* Sophie YouJung Lee, University of Michigan
* Stephen Thomas, Boise State University
* Steve Barr, Princeton University
* Sumedh R. Risbud, Massachusetts Institute of Technology
* Thi Vo, University of Michigan
* Tim Moore, University of Michigan
* Tobias Dwyer, University of Michigan
* Tommy Waltmann, University of Michigan
* Trung Dac Nguyen, University of Michigan
* Vyas Ramasubramani, University of Michigan
* Wenbo Shen, University of Michigan
* William Zygmunt, University of Michigan
* Wouter Ellenbroek, Eindhoven University of Technology
* Yuan Zhou, University of Michigan
* Åsmund Ervik, SINTEF


text:
<?php

namespace Bpedroza\AssetCompiler\Assets;

use Bpedroza\AssetCompiler\Assets\BaseAsset;

/**
 * Description of CssAsset
 *
 * @author Bryan Pedroza
 */
class CssAsset extends BaseAsset
{
    /**
     * Get the css folder path
     * @return string
     */
    public function getTypeFolder()
    {
        return $this->config->cssPath();
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace ServiciosWCF.Servicios.acts
{
    [ServiceContract]
    public interface IActsService
    {
        [OperationContract]
        int InsertarActs(Dominio.Dtos.actsDTO dto);
        [OperationContract]
        bool ActualizarActs(Dominio.Dtos.actsDTO dto);
        [OperationContract]
        bool EliminarActs(int id);
        [OperationContract]
        Dominio.Dtos.actsDTO BuscarActs(int id);
        [OperationContract]
        List<Dominio.Dtos.actsDTO> ListarActs(string param);
    }
}


text:
#include "tensorflow/compiler/xla/service/dynamic_padder.h"

#include <algorithm>
#include <vector>

#include "absl/algorithm/container.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "tensorflow/compiler/xla/literal.h"
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/service/dynamic_dimension_inference.h"
#include "tensorflow/compiler/xla/service/hlo_dce.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/util.h"
#include "tensorflow/core/lib/core/errors.h"

namespace xla {

namespace {

// ChooseIdentityValue looks at the instruction's operand, returns a
// identity value which, when padded, doesn't change the result of the
// instruction.
//
// nullopt is returned if padding doesn't need to be reset.
StatusOr<HloInstruction*> ChooseIdentityValue(HloInstruction* inst,
                                              int64 operand_number) {
  HloComputation* comp = inst->parent();
  // Padding on elementwise operation doesn't affect the result of the effective
  // data.
  if (inst->IsElementwise()) {
    return nullptr;
  }

  switch (inst->opcode()) {
    case HloOpcode::kReduce: {
      TF_RET_CHECK(operand_number < inst->operand_count() / 2)
          << "Only data operand with dynamic dimension is valid.";
      // Variadic reduce has different init value for different operand, given a
      // data operand number, find the init value index.
      int64 init_value_index = inst->operand_count() / 2 + operand_number;
      return inst->mutable_operand(init_value_index);
    }
    case HloOpcode::kReduceWindow: {
      // Because of the way we do reduce, we already require the `init` operand
      // of hlo reduce instruction to be identity value. Here we reuse the
      // operand.
      return inst->mutable_operand(1);
    }

    case HloOpcode::kConvolution:
    case HloOpcode::kDot: {
      // Use 0 as padding value for convolution and dot.
      PrimitiveType ptype = inst->shape().element_type();
      return comp->AddInstruction(
          HloInstruction::CreateConstant(LiteralUtil::Zero(ptype)));
    }

    case HloOpcode::kPad: {
      return inst->mutable_operand(1);
    }

    case HloOpcode::kSelectAndScatter: {
      return inst->mutable_operand(2);
    }
    case HloOpcode::kScatter: {
      if (operand_number != 1) {
        return nullptr;
      }
      PrimitiveType indices_ptype =
          inst->operand(operand_number)->shape().element_type();

      return comp->AddInstruction(
          HloInstruction::CreateConstant(LiteralUtil::MaxValue(indices_ptype)));
    }
    case HloOpcode::kParameter:
    case HloOpcode::kGather:
    case HloOpcode::kDynamicSlice:
    case HloOpcode::kDynamicUpdateSlice:
    case HloOpcode::kGetDimensionSize:
    case HloOpcode::kSetDimensionSize:
    case HloOpcode::kConcatenate:
    case HloOpcode::kReshape:
    case HloOpcode::kReverse:
    case HloOpcode::kTuple:
    case HloOpcode::kAllReduce:
    case HloOpcode::kBroadcast:
    case HloOpcode::kTranspose:
    case HloOpcode::kSort:
    case HloOpcode::kSlice:
      return nullptr;
    default:
      return UnimplementedStrCat("Unimplemented padding for instruction: ",
                                 inst->ToString());
  }
}

bool ShouldSkipPadOnOperand(const HloInstruction* inst, int64 operand_num,
                            int64 dimension) {
  if ((inst->opcode() == HloOpcode::kReduceWindow ||
       inst->opcode() == HloOpcode::kSelectAndScatter) &&
      operand_num == 0 && inst->window().dimensions(dimension).size() == 1) {
    return true;
  }

  if (operand_num == 0 && inst->opcode() == HloOpcode::kConvolution &&
      inst->convolution_dimension_numbers().input_batch_dimension() ==
          dimension) {
    return true;
  }
  return false;
}

// Generates a mask representing the effective area of data and padded area of
// data using iota and dynamic_size. For example, given a dimension of 7
// elements and 5 effective elements:
//
// iota = [0, 1, 2, 3, 4, 5, 6]
// broadcast_dynamic_size = [5, 5, 5, 5, 5, 5, 5]
// mask = lt(iota, broadcast_dynamic_size) = [t, t, t, t, t, f, f]
//
// Once the mask is generated, the input data is then padded using the
// mask and pad value.
//
HloInstruction* PadWithScalar(HloInstruction* inst, int64 dim,
                              HloInstruction* dynamic_size,
                              HloInstruction* padding_scalar) {
  const Shape mask_shape =
      ShapeUtil::ChangeElementType(inst->shape(), xla::S32);
  const Shape pred_shape =
      ShapeUtil::ChangeElementType(inst->shape(), xla::PRED);
  HloComputation* computation = inst->parent();
  HloInstruction* iota =
      computation->AddInstruction(HloInstruction::CreateIota(mask_shape, dim));

  HloInstruction* broadcasted_effective_size = computation->AddInstruction(
      HloInstruction::CreateBroadcast(mask_shape, dynamic_size, {}));
  HloInstruction* pred =
      computation->AddInstruction(HloInstruction::CreateCompare(
          pred_shape, iota, broadcasted_effective_size,
          ComparisonDirection::kLt));

  HloInstruction* broadcasted_identity_value = computation->AddInstruction(
      HloInstruction::CreateBroadcast(inst->shape(), padding_scalar, {}));
  HloInstruction* padded = computation->AddInstruction(
      HloInstruction::CreateTernary(inst->shape(), HloOpcode::kSelect, pred,
                                    inst, broadcasted_identity_value));
  return padded;
}

// In a reshape if a dynamci dimension is splitted into multiple output
// dimensions, we need to rewrite the input of the reshape.
//
// The reason for this is that a continuous input may not be evenly reshaped
// into output.  Image we have [<=6] where valid data has size 4 and padding (P)
// data has size 2: [a,b,c,d,P,P]
//
// And we have a reshape that produces dynamic output dimensions.
//
// [<=6]
//  |
// Reshape
//  |
// [2, <=3]
//
// This should produce the same result as if the data has no padding:
//
// [4]     // [a, b, c, d]
//  |
// Reshape
//  |
// [2, 2]  // [[a,b], [c,d]]
//
// Without reshape rewriting, the result looks like:
//
// [[a,b,c]
//  [d,P,P]], which is incorrect.
//
// We need to rewrite the reshape such that it produces:
// [[a,b,P]
//  [c,d,P]]
//
// The way we do this is by a 6-steps double-sorting algorithm:
//
// 1.First we use the output shape to generate a binary 0-1 masking, which masks
// out the padded area of the output:
// [[0,0,1]
//  [0,0,1]]
//
// 2.Then we do an inverse reshape to reshape it from output shape back to input
// shape [2,3]->[6]:
//  [0,0,1,0,0,1]
//
// 3.We then generate an iota mask using the input shape:
//  [0,1,2,3,4,5]
//
// 4.Stable sort the iota mask using the binary mask as key:
//  key  [0,0,1,0,0,1]
//  value[0,1,2,3,4,5]
//     | Sort by key
//     v
//  key  [0,0,0,0,1,1]
//  value[0,1,3,4,2,5]
//
// 5.Sort the original input [a,b,c,d,P,P] using the sorted iota mask:
//  key  [0,1,3,4,2,5]
//  value[a,b,c,d,P,P]
//     | Sort by key
//     v
//  key  [0,1,2,3,4,5]
//  value[a,b,P,c,d,P]
//
// 6.Feed the sorted input to original reshape[6]->[2,3], we can get the correct
// reshape:
//  [[a,b,P]
//   [c,d,P]]
//
Status RewriteDynamicReshapeSplitInput(
    HloInstruction* reshape, int64 input_dim,
    absl::Span<const int64> output_dims,
    DynamicDimensionInference* dynamic_dimension_inference) {
  const Shape operand_shape = reshape->operand(0)->shape();
  TF_RET_CHECK(output_dims.size() > 1);

  HloComputation* comp = reshape->parent();
  const Shape mask_input_shape =
      ShapeUtil::ChangeElementType(operand_shape, xla::S32);
  const Shape mask_reshaped_shape =
      ShapeUtil::ChangeElementType(reshape->shape(), xla::S32);

  HloInstruction* zero = comp->AddInstruction(
      HloInstruction::CreateConstant(LiteralUtil::Zero(S32)));
  HloInstruction* one = comp->AddInstruction(
      HloInstruction::CreateConstant(LiteralUtil::One(S32)));
  // Step 1 -- generate binary mask.
  // Mask starts with all zero, each dynamic dimension sets one dimension of the
  // mask to partially one.
  HloInstruction* binary_mask = comp->AddInstruction(
      HloInstruction::CreateBroadcast(mask_reshaped_shape, zero, {}));

  bool need_rewrite = false;

  // Index starts from 1 since there is no need to rewrite a major output
  // dimension.
  for (int64 i = 1; i < output_dims.size(); ++i) {
    const int64 output_dim = output_dims[i];
    HloInstruction* dynamic_size =
        dynamic_dimension_inference->GetDynamicSize(reshape, {}, output_dim);
    if (dynamic_size == nullptr) {
      continue;
    }
    // If there is dynamic dimension in the output, need rewrite the input.
    need_rewrite = true;

    binary_mask = PadWithScalar(binary_mask, output_dim, dynamic_size, one);
  }
  if (!need_rewrite) {
    return Status::OK();
  }
  // Step 2.
  // Do a reverse reshape to flatten the binary mask (with output shape) back to
  // input shape.
  HloInstruction* input_shape_binary_mask = comp->AddInstruction(
      HloInstruction::CreateReshape(mask_input_shape, binary_mask));

  // Step 3. Generate iota mask.
  HloInstruction* iota_mask = comp->AddInstruction(
      HloInstruction::CreateIota(mask_input_shape, input_dim));

  // Step 4. Sort iota.
  // Use binary mark to sort iota mask, then use iota mask to reshape input.
  HloComputation::Builder comp_builder("compare_bianry_iota");
  {
    HloInstruction* lhs_key =
        comp_builder.AddInstruction(HloInstruction::CreateParameter(
            0, ShapeUtil::MakeShape(S32, {}), "lhs_key_binary"));
    HloInstruction* rhs_key =
        comp_builder.AddInstruction(HloInstruction::CreateParameter(
            1, ShapeUtil::MakeShape(S32, {}), "rhs_key_binary"));

    // Values for lhs and rhs
    comp_builder.AddInstruction(HloInstruction::CreateParameter(
        2, ShapeUtil::MakeShape(S32, {}), "lhs_iota"));
    comp_builder.AddInstruction(HloInstruction::CreateParameter(
        3, ShapeUtil::MakeShape(S32, {}), "rhs_iota"));
    comp_builder.AddInstruction(
        HloInstruction::CreateCompare(ShapeUtil::MakeShape(PRED, {}), lhs_key,
                                      rhs_key, ComparisonDirection::kLt));
  }

  HloComputation* compare_binary_iota =
      comp->parent()->AddEmbeddedComputation(comp_builder.Build());

  HloInstruction* sorted_binary_iota =
      comp->AddInstruction(HloInstruction::CreateSort(
          ShapeUtil::MakeTupleShape({mask_input_shape, mask_input_shape}),
          input_dim, {input_shape_binary_mask, iota_mask}, compare_binary_iota,
          /*is_stable=*/true));
  HloInstruction* sorted_iota_mask =
      comp->AddInstruction(HloInstruction::CreateGetTupleElement(
          mask_input_shape, sorted_binary_iota, 1));

  // Step 5. Sort original input using iota mask as key.
  HloComputation::Builder comp_builder_iota("compare_bianry_iota");
  {
    HloInstruction* lhs_key =
        comp_builder_iota.AddInstruction(HloInstruction::CreateParameter(
            0, ShapeUtil::MakeShape(S32, {}), "lhs_key_iota"));
    HloInstruction* rhs_key =
        comp_builder_iota.AddInstruction(HloInstruction::CreateParameter(
            1, ShapeUtil::MakeShape(S32, {}), "rhs_key_iota"));

    // Values for lhs and rhs
    comp_builder_iota.AddInstruction(HloInstruction::CreateParameter(
        2, ShapeUtil::MakeShape(operand_shape.element_type(), {}),
        "lhs_value"));
    comp_builder_iota.AddInstruction(HloInstruction::CreateParameter(
        3, ShapeUtil::MakeShape(operand_shape.element_type(), {}),
        "rhs_value"));
    comp_builder_iota.AddInstruction(
        HloInstruction::CreateCompare(ShapeUtil::MakeShape(PRED, {}), lhs_key,
                                      rhs_key, ComparisonDirection::kLt));
  }

  HloComputation* compare_iota_value =
      comp->parent()->AddEmbeddedComputation(comp_builder_iota.Build());

  // Temporarily removes dynamic dimension before entering sort -- we want the
  // sort to ignore dynamic dimension.
  HloInstruction* operand_static_dim_size =
      comp->AddInstruction(HloInstruction::CreateConstant(
          LiteralUtil::CreateR0<int32>(operand_shape.dimensions(input_dim))));

  HloInstruction* operand_static =
      comp->AddInstruction(HloInstruction::CreateSetDimensionSize(
          operand_shape, reshape->mutable_operand(0), operand_static_dim_size,
          input_dim));

  HloInstruction* sorted_iota_value =
      comp->AddInstruction(HloInstruction::CreateSort(
          ShapeUtil::MakeTupleShape({mask_input_shape, operand_shape}),
          input_dim, {sorted_iota_mask, operand_static}, compare_iota_value,
          /*is_stable=*/true));
  // Step 6: Feed sorted input to original reshape.
  HloInstruction* sorted_operand =
      comp->AddInstruction(HloInstruction::CreateGetTupleElement(
          operand_shape, sorted_iota_value, 1));

  TF_RETURN_IF_ERROR(reshape->ReplaceOperandWith(0, sorted_operand));

  HloInstruction* reshape_dynamic = reshape;

  auto users = reshape->users();

  // Forward the output dynamic dimension.
  for (int64 output_dim : output_dims) {
    HloInstruction* output_dynamic_size =
        dynamic_dimension_inference->GetDynamicSize(reshape, {}, output_dim);
    if (output_dynamic_size != nullptr) {
      reshape_dynamic =
          comp->AddInstruction(HloInstruction::CreateSetDimensionSize(
              reshape->shape(), reshape_dynamic, output_dynamic_size,
              output_dim));
    }
  }

  for (auto* user : users) {
    TF_RETURN_IF_ERROR(reshape->ReplaceUseWith(user, reshape_dynamic));
  }
  TF_RETURN_IF_ERROR(dynamic_dimension_inference->ForwardDynamicSize(
      reshape, reshape_dynamic, {}));

  return Status::OK();
}

Status RewriteDynamicReshapeCombineInput(
    HloInstruction* reshape, int64 input_dim, int64 output_dim,
    HloInstruction* dynamic_size,
    DynamicDimensionInference* dynamic_dimension_inference) {
  // Rewrite dynamic reshape into reshape followed by a sort, all padded
  // data will be moved to the end.
  const HloInstruction* operand = reshape->operand(0);
  HloComputation* comp = reshape->parent();
  HloInstruction* zero = comp->AddInstruction(
      HloInstruction::CreateConstant(LiteralUtil::Zero(S32)));
  HloInstruction* one = comp->AddInstruction(
      HloInstruction::CreateConstant(LiteralUtil::One(S32)));
  const Shape mask_shape =
      ShapeUtil::ChangeElementType(operand->shape(), xla::S32);
  const Shape mask_reshaped_shape =
      ShapeUtil::ChangeElementType(reshape->shape(), xla::S32);
  HloInstruction* broadcasted_zero = comp->AddInstruction(
      HloInstruction::CreateBroadcast(mask_shape, zero, {}));
  // Pad masking area with 1s, rest with 0s.
  HloInstruction* padding_mask =
      PadWithScalar(broadcasted_zero, input_dim, dynamic_size, one);
  HloInstruction* mask_reshaped = comp->AddInstruction(
      HloInstruction::CreateReshape(mask_reshaped_shape, padding_mask));

  // Build computation for reshape, key is the mask shape, value is reshape's
  // original data.
  HloComputation::Builder comp_builder("compare");
  HloInstruction* lhs_key =
      comp_builder.AddInstruction(HloInstruction::CreateParameter(
          0, ShapeUtil::MakeShape(S32, {}), "lhs_key"));
  HloInstruction* rhs_key =
      comp_builder.AddInstruction(HloInstruction::CreateParameter(
          1, ShapeUtil::MakeShape(S32, {}), "rhs_key"));

  // Values for lhs and rhs
  comp_builder.AddInstruction(HloInstruction::CreateParameter(
      2, ShapeUtil::MakeShape(operand->shape().element_type(), {}),
      "lhs_value"));
  comp_builder.AddInstruction(HloInstruction::CreateParameter(
      3, ShapeUtil::MakeShape(operand->shape().element_type(), {}),
      "rhs_value"));
  comp_builder.AddInstruction(
      HloInstruction::CreateCompare(ShapeUtil::MakeShape(PRED, {}), lhs_key,
                                    rhs_key, ComparisonDirection::kLt));
  HloComputation* compare =
      comp->parent()->AddEmbeddedComputation(comp_builder.Build());

  HloInstruction* static_dim_size = comp->AddInstruction(
      HloInstruction::CreateConstant(LiteralUtil::CreateR0<int32>(
          reshape->shape().dimensions(output_dim))));

  // Temporarily removes dynamic dimension of the reshape before we send it to
  // the sort -- we want padded area to also participate in the sort.
  HloInstruction* reshape_static =
      comp->AddInstruction(HloInstruction::CreateSetDimensionSize(
          reshape->shape(), reshape, static_dim_size, output_dim));

  // Use mask_reshaped as key, sort reshaped data as value.
  HloInstruction* sort = comp->AddInstruction(HloInstruction::CreateSort(
      ShapeUtil::MakeTupleShape({mask_reshaped_shape, reshape->shape()}),
      output_dim, {mask_reshaped, reshape_static}, compare,
      /*is_stable=*/true));
  HloInstruction* dynamic_reshape = comp->AddInstruction(
      HloInstruction::CreateGetTupleElement(reshape->shape(), sort, 1));
  // Forward dynamic size to the newly created reshape.
  HloInstruction* output_dynamic_size =
      dynamic_dimension_inference->GetDynamicSize(reshape, {}, output_dim);
  TF_RET_CHECK(output_dynamic_size != nullptr);
  dynamic_reshape = comp->AddInstruction(HloInstruction::CreateSetDimensionSize(
      dynamic_reshape->shape(), dynamic_reshape, output_dynamic_size,
      output_dim));
  auto users = reshape->users();
  for (auto* user : users) {
    // Avoid cycles by not replacing the staic reshape and get_dimension_size.
    if (user != reshape_static && user != output_dynamic_size) {
      TF_RETURN_IF_ERROR(reshape->ReplaceUseWith(user, dynamic_reshape));
    }
  }

  if (reshape == comp->root_instruction()) {
    comp->set_root_instruction(dynamic_reshape);
  }

  TF_RETURN_IF_ERROR(dynamic_dimension_inference->ForwardDynamicSize(
      reshape, dynamic_reshape, {}));

  return Status::OK();
}

Status RewriteDynamicReshapeSingleDim(
    HloInstruction* reshape, int64 input_dim, HloInstruction* dynamic_size,
    DynamicDimensionInference* dynamic_dimension_inference) {
  VLOG(2) << "Rewriting dynamic reshape " << reshape->ToString()
          << " input dim: " << input_dim;
  const Shape operand_shape = reshape->operand(0)->shape();
  const Shape output_shape = reshape->shape();

  const int64 static_input_dim_size = operand_shape.dimensions()[input_dim];

  // Don't need to rewrite size 1 input dims.
  if (static_input_dim_size == 1) {
    return Status::OK();
  }

  auto common_factors =
      CommonFactors(operand_shape.dimensions(), output_shape.dimensions());
  // If there are multiple input dims combining into one output dim,
  // input_dim_start and input_dim_end represent the input dimension range.
  int64 input_dim_start = -1;
  int64 input_dim_end = -1;
  // Similarly when one input dim is splitted into multiple outputs, we use
  // output_dim_start and output_dim_start to represent the output dimension
  // range.
  int64 output_dim_start = -1;
  int64 output_dim_end = -1;
  // Find common_factors that the input belong to.
  for (int64 i = 0; i < common_factors.size() - 1; ++i) {
    auto start = common_factors[i];
    auto end = common_factors[i + 1];
    if (input_dim >= start.first && input_dim < end.first) {
      // Found the common_factor group that the input_dim belongs to.
      input_dim_start = start.first;
      input_dim_end = end.first;
      output_dim_start = start.second;
      output_dim_end = end.second;
    }
  }

  TF_RET_CHECK(output_dim_end - output_dim_start > 0);

  std::vector<int64> output_dims;
  for (int64 i = output_dim_start; i < output_dim_end; ++i) {
    output_dims.push_back(i);
  }

  const int64 first_output_dim = output_dims[0];

  if (reshape->shape().dimensions(first_output_dim) < static_input_dim_size) {
    // One input dimension is splitted into multiple output dimensions.
    return RewriteDynamicReshapeSplitInput(reshape, input_dim, output_dims,
                                           dynamic_dimension_inference);
  }

  if (reshape->shape().dimensions(first_output_dim) == static_input_dim_size) {
    // Unchanged dynamic dimension doesn't need a rewrite.
    return Status::OK();
  }

  // Multiple dimensions got combined into one output.
  if (input_dim != input_dim_start) {
    // If 'input_dim' is not the first dimension that got combined into the
    // output. A reshape rewrite on the output is needed:
    //
    //  Need a write (d is dynamic):
    //  1, 2, d
    //   |
    //  Reshape
    //   |
    //   2d
    //
    //  Don't need rewrite:
    //  d, 2
    //   |
    //  Reshape
    //   |
    //   2d
    //
    return RewriteDynamicReshapeCombineInput(reshape, input_dim,
                                             first_output_dim, dynamic_size,
                                             dynamic_dimension_inference);
  }
  return Status::OK();
}

StatusOr<bool> RewriteDynamicReshape(
    HloInstruction* reshape,
    DynamicDimensionInference* dynamic_dimension_inference) {
  bool changed = false;
  HloInstruction* operand = reshape->mutable_operand(0);

  // We append sort instructions after reshape if there is a dynamic input, and
  // the order of sort matters. Rewrite minor dimensions first in case multiple
  // inputs have dynamic dimensions to ensure correct order of sort.
  for (int64 input_dim = operand->shape().rank() - 1; input_dim >= 0;
       --input_dim) {
    HloInstruction* operand_dynamic_size =
        dynamic_dimension_inference->GetDynamicSize(operand, {}, input_dim);

    if (operand_dynamic_size == nullptr) {
      continue;
    }
    TF_RETURN_IF_ERROR(RewriteDynamicReshapeSingleDim(
        reshape, input_dim, operand_dynamic_size, dynamic_dimension_inference));

    changed = true;
  }
  return changed;
}

}  // namespace

StatusOr<bool> DynamicPadder::Run(HloModule* module) {
  bool changed = false;
  VLOG(2) << "Pre DynamicPadder HLO:";
  XLA_VLOG_LINES(2, module->ToString());
  TF_ASSIGN_OR_RETURN(DynamicDimensionInference dynamic_dimension_inference,
                      DynamicDimensionInference::Run(module));

  for (HloComputation* computation : module->computations()) {
    for (HloInstruction* inst : computation->instructions()) {
      for (int64 operand_num = 0; operand_num < inst->operand_count();
           ++operand_num) {
        HloInstruction* original_operand = inst->mutable_operand(operand_num);
        HloInstruction* operand = original_operand;
        if (!operand->shape().IsArray()) {
          continue;
        }

        if (inst->opcode() == HloOpcode::kReshape) {
          TF_ASSIGN_OR_RETURN(changed, RewriteDynamicReshape(
                                           inst, &dynamic_dimension_inference));
          continue;
        }
        for (int64 input_dim = 0; input_dim < operand->shape().rank();
             ++input_dim) {
          HloInstruction* operand_dynamic_size =
              dynamic_dimension_inference.GetDynamicSize(original_operand, {},
                                                         input_dim);
          if (operand_dynamic_size == nullptr) {
            continue;
          }
          VLOG(2) << "Has dynamic dimension of operand" << operand_num << " @"
                  << input_dim;

          if (ShouldSkipPadOnOperand(inst, operand_num, input_dim)) {
            continue;
          }

          TF_ASSIGN_OR_RETURN(HloInstruction * identity_value,
                              ChooseIdentityValue(inst, operand_num));
          if (identity_value == nullptr) {
            continue;
          }

          HloInstruction* padded = PadWithScalar(
              operand, input_dim, operand_dynamic_size, identity_value);
          TF_RETURN_IF_ERROR(inst->ReplaceOperandWith(operand_num, padded));
          operand = inst->mutable_operand(operand_num);
          changed = true;
        }
      }
    }
  }

  HloDCE dce;
  TF_ASSIGN_OR_RETURN(changed, dce.Run(module));
  VLOG(2) << "Post DynamicPadder HLO:";
  XLA_VLOG_LINES(2, module->ToString());

  return changed;
}

}  // namespace xla


text:
.contact-info-sheet.hidden {
  display:none;}
.contact-info-sheet {
  background: white;
  position: fixed;
  z-index: 9999; }
  .contact-info-sheet .info-sheet-toggle,
  .contact-info-sheet .info-sheet-pagination,
  .contact-info-sheet .info-sheet-icon{
    background-repeat: no-repeat;
    display: block; }
  .web-page-template .contact-info-sheet .info-sheet-pagination{
    display: none; }
  .contact-info-sheet .info-sheet-content {
    min-height: 75px;
    padding: 1em 30px; }
  @media screen and (max-width: 667px) {
    .contact-info-sheet {
      background: #404040;
      bottom: 0;
      left: 0;
      width: 100%; }
      .contact-info-sheet.opened {
        bottom: 100%; }
      .contact-info-sheet .info-sheet-nav {
        *zoom: 1; }
        .contact-info-sheet .info-sheet-nav:before, .contact-info-sheet .info-sheet-nav:after {
          content: " ";
          display: table; }
        .contact-info-sheet .info-sheet-nav:after {
          clear: both; }
      .contact-info-sheet .info-sheet-toggle,
      .contact-info-sheet .info-sheet-pagination{
        background-image: url("https://widgets.g5dxm.com/contact-info/contact-icons-light.png"); }
      .contact-info-sheet .info-sheet-toggle {
        float: left;
        padding-left: 50px;
        padding-top: 10px;
        min-height: 50px;
        width: 50%; }
      .contact-info-sheet .info-sheet-phone-btn {
        background-position: 10px 10px; }
      .contact-info-sheet .info-sheet-email-btn {
        background-position: 10px -135px; }
      .contact-info-sheet .info-sheet-chat-btn{
        background-position: 10px -135px;
      }
      .contact-info-sheet .info-sheet-content {
        display: none !important; } }
  @media screen and (max-width: 1169px) {
    .contact-info-sheet .info-sheet-pagination{
      display: none; }
  }
  @media screen and (max-width: 909px) {
    .contact-info-sheet .info-sheet-icon {
      display: none; }
  }
  @media screen and (min-width: 668px) {
    .contact-info-sheet {
      -webkit-transition: left 0.3s ease-in-out;
      -moz-transition: left 0.3s ease-in-out;
      transition: left 0.3s ease-in-out;
      top: 155px;
      left: -375px;
      width: 375px; }
      .contact-info-sheet.opened {
        left: 75px; }
      .contact-info-sheet .info-sheet-nav {
        background: #1b1d1d;
        background: rgba(27, 29, 29, 0.75);
        position: fixed;
        left: 0; }
      .contact-info-sheet .info-sheet-toggle,
      .contact-info-sheet .info-sheet-pagination,
      .contact-info-sheet .info-sheet-icon{
        background-image: url("https://widgets.g5dxm.com/contact-info-sheet/contact-info-sheet-icons-test.png");
        height: 75px;
        width: 75px;
        text-indent: 100%;
        white-space: nowrap;
        overflow: hidden; }
      .contact-info-sheet .info-sheet-icon.chat-code{
        text-indent: 0;
        background-image:none;
      }
      .contact-info-sheet .info-sheet-icon.chat-code img{
        max-width: 75px;
        max-height: 75px;
      }
      .contact-info-sheet .info-sheet-phone-btn {
        background-position: center 21px; }
      .contact-info-sheet .info-sheet-email-btn {
        background-position: center -55px; }
      .contact-info-sheet .info-sheet-chat-btn {
        background-position: center -289px; }
      .contact-info-sheet .info-sheet-pagination,
      .contact-info-sheet .info-sheet-icon {
        cursor: pointer; }
      .contact-info-sheet .info-sheet-page-up {
        background-position: center -134px; }
      .contact-info-sheet .info-sheet-page-down {
        background-position: center -214px; }
      .contact-info-sheet .info-sheet-content {
        overflow-y: scroll; } }


text:
package it.swim.util;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;

import sessionBeans.localInterfaces.GestioneAmicizieLocal;
import sessionBeans.localInterfaces.GestioneCollaborazioniLocal;

import entityBeans.Collaborazione;
import entityBeans.Utente;
import exceptions.LoginException;

@Slf4j
public class PresenzaNotificheDiRisposta {

	/**
	 * Metodo che dice se ci sono notifiche di risposta da mostrare all'utente.
	 * @param emailUtenteCollegato : String che rappresenta l'email dell'utente collegato (utente richiedente delle collaborazione o utente1 delle amicizie)
	 * @param request : HttpServletRequest della servlet
	 * @param response : HttpServletResponse della servlet
	 * @param amicizie : GestioneAmicizieLocal, cioe' il riferimento all'interfaccia locale dell'entitybean GestioneAmicizie
	 * @param collab : GestioneCollaborazioniLocal, cioe' il riferimento all'interfaccia locale dell'entitybean GestioneCollaborazioni
	 * @return true se ci sono notifiche da visualizzare, false altrimenti.
	 */
	public static boolean isNotificheRispostaPresenti(String emailUtenteCollegato, HttpServletRequest request, HttpServletResponse response, GestioneAmicizieLocal amicizie, GestioneCollaborazioniLocal collab) {

		//ottengo utenti che hanno accettato le mie richieste, separandoli in diretti e indiretti (ottenuti con suggerimento)
		List<Utente> utentiAccettatiDiretti = amicizie.getUtentiCheHannoAccettatoLaRichiestaDiretti(emailUtenteCollegato);
		List<Utente> utentiAccettatiIndiretti = amicizie.getUtentiCheHannoAccettatoLaRichiestaIndiretti(emailUtenteCollegato);

		//ottengo tutte le collaborazioni da me create,che sono state accettate.
		//e dopo ottengo le collaborazioni da me create che pero' sono stante respinte
		List<Collaborazione> collaborazioniAccettate=new ArrayList<Collaborazione>();
		List<Collaborazione> collaborazioniRespinte=new ArrayList<Collaborazione>();
		try {
			collaborazioniAccettate = collab.getCollaborazioniDaNotificare(emailUtenteCollegato);
			collaborazioniRespinte = collab.getCollaborazioniRifiutate(emailUtenteCollegato);
		} catch (LoginException e) {
			log.error(e.getMessage(), e);
		}

		//ritorno true se c'e' qualche cosa da notificare, altrimenti false
		return ((utentiAccettatiIndiretti!=null && utentiAccettatiIndiretti.size()>=1) ||
				(utentiAccettatiDiretti!=null && utentiAccettatiDiretti.size()>=1) || collaborazioniAccettate.size()>=1
				|| collaborazioniRespinte.size()>=1);
	}
}


text:
package eecs2030.lab3;

import org.junit.Before;
import org.junit.FixMethodOrder;

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.runners.MethodSorters;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ComplexTest {

	private static double[] real = {
		0.0, -2.5, 7.20000001
	};
	private static double[] imag = {
		0.0, -3.6, 8.1
	};

	private static int[] hashes = {
			0,
			-356,
			801,
			-24997,
			-25353,
			-24195,
			71992,
			71636,
			72794
	};

	private static class Pair {
		public double first;
		public double second;

		public Pair(double first, double second) {
			this.first = first;
			this.second = second;
		}
	}

	private static Pair[] values;

	@Before
	public void setUp() throws Exception {
		ComplexTest.values = new Pair[ComplexTest.real.length *
		                              ComplexTest.imag.length];
		int i = 0;
		for (double re : ComplexTest.real) {
			for (double im : ComplexTest.imag) {
				ComplexTest.values[i++] = new Pair(re, im);
			}
		}
	}

	@Test
	public void test00_constants() {
		assertEquals("real part of ONE is wrong",
				1.0, Complex.ONE.re(), Math.ulp(1.0));
		assertEquals("imaginary part of ONE is wrong",
				0.0, Complex.ONE.im(), Math.ulp(0.0));

		assertEquals("real part of I is wrong",
				0.0, Complex.I.re(), Math.ulp(0.0));
		assertEquals("imaginary part of I is wrong",
				1.0, Complex.I.im(), Math.ulp(1.0));
	}

	/**
	 * Test for Complex()
	 */
	@Test
	public void test01_noArgCtor() {
		Complex c = new Complex();
		assertEquals("real part is incorrect",
				0.0, c.re(), Math.ulp(0));
		assertEquals("imaginary part is incorrect",
				0.0, c.im(), Math.ulp(0));
	}

	/**
	 * Test for Complex(double, double)
	 */
	@Test
	public void test02_ctor() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			assertEquals("real part is incorrect",
					v.first, c.re(), Math.ulp(v.first));
			assertEquals("imaginary part is incorrect",
					v.second, c.im(), Math.ulp(v.second));
		}
	}

	/**
	 * Test for Complex(Complex)
	 */
	@Test
	public void test03_copyCtor() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			Complex copy = new Complex(c);
			assertEquals("real part is incorrect",
					v.first, copy.re(), Math.ulp(v.first));
			assertEquals("imaginary part is incorrect",
					v.second, copy.im(), Math.ulp(v.second));
		}
	}

	/**
	 * Test for real(double re)
	 */
	@Test
	public void test04_real() {
		for (double re : ComplexTest.real) {
			Complex c = Complex.real(re);
			assertEquals("real part is incorrect",
					re, c.re(), Math.ulp(re));
			assertEquals("imaginary part is incorrect",
					0.0, c.im(), Math.ulp(0.0));
		}
	}

	/**
	 * Test for imag(double im)
	 */
	@Test
	public void test04_imag() {
		for (double im : ComplexTest.imag) {
			Complex c = Complex.imag(im);
			assertEquals("real part is incorrect",
					0.0, c.re(), Math.ulp(0.0));
			assertEquals("imaginary part is incorrect",
					im, c.im(), Math.ulp(im));
		}
	}

	/**
	 * Test for add(Complex)
	 */
	@Test
	public void test05_add() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			for (Pair w : ComplexTest.values) {
				Complex d = new Complex(w.first, w.second);
				Complex sum = c.add(d);

				// test the sum
				double exp = v.first + w.first;
				assertEquals("real part of the sum is incorrect",
						sum.re(), exp, Math.ulp(exp));
				exp = v.second + w.second;
				assertEquals("imaginary part of the sum is incorrect",
						sum.im(), exp, Math.ulp(exp));
			}
		}
	}

	/**
	 * Test for multiply(Complex)
	 */
	@Test
	public void test06_multiply() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			for (Pair w : ComplexTest.values) {
				Complex d = new Complex(w.first, w.second);
				Complex prod = c.multiply(d);

				// test the product
				double exp = v.first * w.first - v.second * w.second;
				assertEquals("real part of the product is incorrect",
						prod.re(), exp, Math.ulp(exp));
				exp = v.first * w.second + v.second * w.first;
				assertEquals("imaginary part of the sum is incorrect",
						prod.im(), exp, Math.ulp(exp));
			}
		}
	}

	/**
	 * Test for mag()
	 */
	@Test
	public void test07_mag() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			double exp = Math.hypot(v.first, v.second);
			assertEquals("the magnitude is incorrect",
					exp, c.mag(), Math.ulp(exp));
		}

		// test a complex number with large real and imaginary components
		double big = Math.sqrt(Double.MAX_VALUE);
		Complex huge = new Complex(big, big);
		final double HYPOT = Math.hypot(big, big);
		assertEquals("mag() overflowed! Look in java.lang.Math for a method to compute the magnitude",
				HYPOT, huge.mag(), Math.ulp(HYPOT));
	}

	/**
	 * Test for equals(Object)
	 */
	@Test
	public void test08_equals() {
		for (Pair v : ComplexTest.values) {
			Complex c = new Complex(v.first, v.second);
			Complex alias = c;
			Complex copy = new Complex(c);
			Complex diff1 = new Complex(v.first + Math.ulp(v.first), v.second);
			Complex diff2 = new Complex(v.first, v.second + Math.ulp(v.second));
			Complex diff3 = new Complex(v.first + Math.ulp(v.first),
					v.second + Math.ulp(v.second));

			assertEquals("c.equals(c) failed to return true",
					c, c);
			assertEquals("c.equals(c) failed to return true",
					c, alias);
			assertEquals("c.equals(d) failed to return true for equal complex numbers",
					c, copy);
			assertFalse("c.equals(null) failed to return false",
					c.equals(null));
			assertFalse("c.equals(v) failed to return false when v is not a Complex number",
					c.equals(v));
			assertFalse("c.equals(d) failed to return false when the real parts differ",
					c.equals(diff1));
			assertFalse("c.equals(d) failed to return false when the imaginary parts differ",
					c.equals(diff2));
			assertFalse("c.equals(d) failed to return false for unequal c and d",
					c.equals(diff3));
		}
	}

	/**
	 * Test for hashCode()
	 */
	@Test
	public void test09_hashCode() {
		for (int i = 0; i < ComplexTest.values.length; i++) {
			Pair v = ComplexTest.values[i];
			Complex c = new Complex(v.first, v.second);
			int exp = ComplexTest.hashes[i];
			assertEquals("wrong hash code for " + c,
					exp, c.hashCode());
		}
	}

	/**
	 * Test for toString()
	 */
	@Test
	public void test10_toString() {
		Complex c1 = new Complex();
		assertEquals("toString returned the wrong string",
				"0.0 + 0.0i", c1.toString());

		Complex c2 = new Complex(-1.23456789, 99.9999);
		assertEquals("toString returned the wrong string",
				"-1.23456789 + 99.9999i", c2.toString());

		Complex c3 = new Complex(1.0, -2.7300001);
		assertEquals("toString returned the wrong string",
				"1.0 - 2.7300001i", c3.toString());

		Complex c4 = new Complex(-1.0, -2.73);
		assertEquals("toString returned the wrong string",
				"-1.0 - 2.73i", c4.toString());
	}

	/**
	 * Test for valueOf(String)
	 */
	@Test
	public void test11_valueOf() {
		String s1 = "0.0 + 0.0i";
		Complex c1 = new Complex();
		assertEquals(c1, Complex.valueOf(s1));

		String s2 = "-1.23456789 + 99.9999i";
		Complex c2 = new Complex(-1.23456789, 99.9999);
		assertEquals(c2, Complex.valueOf(s2));

		String s3 = "1.0 - 2.73i";
		Complex c3 = new Complex(1.0, -2.73);
		assertEquals(c3, Complex.valueOf(s3));

		String s4 = "-1.0 - 2.73i";
		Complex c4 = new Complex(-1.0, -2.73);
		assertEquals(c4, Complex.valueOf(s4));
	}

	/**
	 * Tests for valueOf(String) where we expect the method to throw an
	 * exception.
	 */
	@Test(expected = IllegalArgumentException.class)
	public void testValueOfStringEx1() {
		// missing i
		Complex.valueOf("1 + 1");
	}

	@Test(expected = IllegalArgumentException.class)
	public void testValueOfStringEx2() {
		// missing sign
		Complex.valueOf("1 1");
	}

	@Test(expected = IllegalArgumentException.class)
	public void testValueOfStringEx3() {
		// missing imaginary part
		Complex.valueOf("1 + ");
	}
}


text:
var log = require('callback-logger')();

exports.coffee = function() {
  var coffee = require('coffee-files');

  coffee.file('files/coffee/a.coffee', 'tmp/coffee/a1.js');

  coffee.file('files/coffee/a.coffee', 'tmp/coffee/a2.js', { sourceMap: true }, log.cb('Built coffee file'));

  coffee.glob('*.coffee', 'files/coffee',
              'tmp/coffee/all', { sourceMapDir: 'tmp/coffee/maps', watch: true },
              log.cb('Built <%= res.length %> coffee files'), log.cb('Updated <%= res.outputFile %>'), log.cb('Removed <%= res %> '));
}

exports.less = function() {
  var less = require('less-files');

  less.file('files/less/a.less', 'tmp/less/a1.css');

  less.file('files/less/a.less', 'tmp/less/a2.css', { sourceMap: true }, log.cb('Built less file'));

  less.glob('*.less', 'files/less',
              'tmp/less/all', { sourceMapDir: 'tmp/less/maps', watch: true },
              log.cb('Built <%= res.length %> less files'), log.cb('Updated <%= res.outputFile %>'), log.cb('Removed <%= res %> '));
}

exports.minify = function() {
  var uglify = require('uglify-files');

  uglify('files/js/s.js', 'tmp/uglify/s.js.min', log.cb('Minified <%= res.outputFile %>, now has <%= res.outputData.length %> bytes'));

  uglify([ 'files/js/s.js', 'files/js/t.js' ], 'tmp/uglify/build.js.min', log.cb('Minified <%= res.outputFile %>, now has <%= res.outputData.length %> bytes'));
}

exports.concat = function() {
  var concat = require('concatenate-files');

  concat([ 'files/css/a.css', 'files/css/b.css' ], 'tmp/concat/concat.css', log.cb('Generated <%= res.outputFile %>'));

  concat([ 'files/js/s.js', 'files/js/t.js' ], 'tmp/concat/concat.js', { separator: ';' }, log.cb('Generated <%= res.outputFile %>'));
}

exports.useref = function() {
  var useref = require('useref-file');

  useref('files/useref.html', 'tmp/useref', log.cb("replaced references in index.html and wrote <%= _.size(res) %> files"))

  useref('files/useref.html', 'tmp/useref2', { handlers: { js: 'uglify' } }, log.cb("replaced references in index.html and wrote <%= _.size(res) %> files"))
}

exports.server = function() {
  var server = require('livereload-static-server'),
      watchGlob = require('watch-glob');

  var livereload = server('tmp', 3001)
  log.success("Server running on port 3001")

  // Watch files and trigger livereload
  watchGlob([ 'tmp/**/*.+(js|css)' ], function(changedFile) {
    livereload(changedFile.path);
    log.success("Reloading")
  });

  // Alternative version
  watchGlob([ 'tmp/**/*' ], { callbackArg: 'absolute' }, livereload);

  // Alternative version
  watchGlob([ 'tmp/**/*.+(js|css)' ], function(changedFile) {
    var reloadedClients = livereload(changedFile.path);
    if(reloadedClients > 0) {
      log.success("reloading " + reloadedClients + " client(s)")
    }
  });

}

exports.clean = function() {
  var rimraf = require('rimraf');
  rimraf('tmp/coffee/a1.js', log.cb('Cleaned file'));
}

exports.clean2 = function() {
  var rimraf = require('rimraf');
  rimraf('tmp/', log.cb('Cleaned folder'));
}

exports.copy = function() {
  var fs = require('fs-extra');
  fs.copy('files/foo.txt', 'tmp/copy/foo.txt');
}

exports.copy2 = function() {
  var fs = require('fs-extra');
  fs.copy('files/coffee', 'tmp/copy/coffee');
}


text:
//FirstView Component Constructor

var createProfil = {
	reussi: false,
	envoie:'idl'
};
function RegisterView(winClose, winOpen) {
	var Theme = require('ui/mobi/Theme');
	var Button = require('ui/mobi/Button');
	var LoginView = require('ui/common/LoginView');
	var InfoUser = require('ui/mobi/InfoUser');

	//create object instance, a parasitic subclass of Observable
	var self = Ti.UI.createScrollView({
		top: '7.5%',
		left: '5%',
		width: '90%',
		height: '95%',
		layout: 'vertical'
	});

	//create object instance, a parasitic subclass of Observable
	var hView = Ti.UI.createView({
		top: '5%',
		width: '100%',
		height: '80',
		layout: 'horizontal'
	});

	var pseudoField = Ti.UI.createTextField({
		color: Theme.textColor,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		width: '100%',
		height: '80',
		top: '5%',
		hintText: 'Pseudo',
		value:'',
		keyboardType: Ti.UI.KEYBOARD_DEFAULT
	})

	self.add(pseudoField);

	var villeField = Ti.UI.createTextField({
		color: Theme.textColor,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		width: '100%',
		height: '80',
		top: '1%',
		bottom: '1%',
		hintText: 'Ville',
		value:'',
		keyboardType: Ti.UI.KEYBOARD_DEFAULT
	})

	self.add(villeField);

	var adressMailField = Ti.UI.createTextField({
		color: Theme.textColor,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		width: '100%',
		height: '80',
		top: '1%',
		bottom: '1%',
		hintText: 'Adresse mail',
		value:'',
		keyboardType: Ti.UI.KEYBOARD_DEFAULT
	})

	self.add(adressMailField);

	var passwordField = Ti.UI.createTextField({
		color: Theme.textColor,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		width: '100%',
		height: '80',
		top: '1%',
		bottom: '1%',
		hintText: 'Mon mot de passe',
		keyboardType: Ti.UI.KEYBOARD_DEFAULT,
		value:'',
		passwordMask: true
	})

	self.add(passwordField);

	var returnButton = Button("RETOUR");
	returnButton.addEventListener('click', function(e) {
		alert(createProfil.reussi);
	/*		pseudoField.value='';
           villeField.value='';
            adressMailField.value='';
            passwordField.value='' ;
			winOpen.open();
			winClose.close();*/

	});
	self.add(returnButton);

	var validateButton = Button("VALIDER");
	// Connexion
	validateButton.addEventListener('click', function(e) {
		var validate=validateForm(pseudoField, villeField, adressMailField, passwordField);
		if(validate == true){

		saveUser(pseudoField, villeField, adressMailField, passwordField);
			pseudoField.value='';
           villeField.value='';
            adressMailField.value='';
            passwordField.value='' ;
		//	winOpen.open();
		//	winClose.close();
		}
	});
	self.add(validateButton);

//	self.add(hView);

	Ti.Facebook.addEventListener('login', function(e) {
	    if (e.success) {
	        alert('Logged in');
	    }
	});
	Ti.Facebook.addEventListener('logout', function(e) {
	    alert('Logged out');
	});

	var facebookButton = Ti.Facebook.createLoginButton();

	facebookButton.addEventListener('click', function(e) {
  		Titanium.Facebook.authorize();
	});

	hView.add(facebookButton);

	self.add(hView);

	var footer = Ti.UI.createView({
		bottom: 0,
		height: '50'
	})

	var footerMentions = Ti.UI.createView({
		layout: 'vertical'
	})

	var author = Ti.UI.createLabel({
		width: '100%',
		color: '#555',
		text: 'Créé par Daniel Seng et Djaber Bouzekoula',
		textAlign: 'center',
		font:{
			textSize: '14'
		}
	})

	var mentionCeri = Ti.UI.createLabel({
		width: '100%',
		color: '#555',
		text: 'CERI - M2ALINFO E-commerce',
		textAlign: 'center',
		font:{
			textSize: '14'
		}
	})

	footerMentions.add(author);
	footerMentions.add(mentionCeri);
	footer.add(footerMentions);

	self.add(footer);

	return self;
}

function validateForm(pseudoField, villeField, adressMailField, passwordField){
	if (pseudoField.value == '' || villeField.value == '' || adressMailField.value == '' || passwordField.value == ''){
		validateForm = false;
		alert("veuillez remplir tous les champs");
	}
	else
		validateForm = true;

	return validateForm;
}

function saveUser(pseudo, ville, adressMail, password){

	var xhr = Titanium.Network.createHTTPClient();
	if (createProfil.envoie != 'idl') {
		alert( 'YouTube uploader already in use!');
		return;
	}
	xhr.onerror = function(e)
	{
		var	err = 'HTTP Error (last state: saveUser) (onerror: ' + e.error + ')';
		alert(err);
	};
xhr.onload = function(){

    switch (createProfil.envoie) {

    	case 'fait' :

    	 var json = JSON.parse(this.responseText);
    if (!json) {
        alert('Error - Null return!');
        return false;
    }
    	alert("ici1");
    	createProfil.reussi=true;
    	createProfil.envoie='recu';

    	break;

    	case 'recu' :

    	alert("ici2");
    	if(json.createAccount==true){
   	alert("compte crée avec succès ");
   	createProfil.reussi=true;

   }
   	else{
   	alert("compte existe déja ");

   	}
   	createProfil.envoie='idl';
    	break;

    	default :
				Ti.API.info('Unknown state during YouTube upload!');
				var errormsg = 'Bad state ';
				Ti.App.fireEvent('youtube:error', {});
				break;

    }

};
	var params = {
		  	requete:'createUser',
            pseudoU: pseudo.value,
            villeU: ville.value,
            adressMailU:adressMail.value,
            passwordU:password.value
        };
        createProfil.envoie='fait';
        xhr.open('POST', 'http://ceriyves.byethost7.com/DbAction.php');
	xhr.send(params);

}

module.exports = RegisterView;


text:
(function($) {
    $.widget('ui.placeholder', {
        _create: function() {
            if ($.ui.placeholder.browserSupport) { return false; }

            var base = this;

            this.placeholder = $('<label/>', {
                text: this.element.attr('placeholder'),
                'class': 'placeholder',
                css: {
                    overflow: 'hidden',
                    whiteSpace: 'nowrap',
                    cursor: 'text',
                    display: 'block',
                    position: 'absolute',
                    color: '#999',
                    lineHeight: this.element.css('line-height'),
                    fontFamily: this.element.css('font-family'),
                    fontSize: this.element.css('font-size'),
                    fontWeight: this.element.css('font-weight')
                }
            });

            this.wrapper = $('<span/>', {
                'class': 'ui-placeholder',
                css: {
                    'position': 'relative',
                    'display': this.element.css('display') == 'block' ? 'block' : 'inline-block',
                    'float': this.element.css('float'),
                    'height': this.element.outerHeight(),
                    'marginTop': this.element.css('margin-top'),
                    'marginRight': this.element.css('margin-right'),
                    'marginBottom': this.element.css('margin-bottom'),
                    'marginLeft': this.element.css('margin-left')
                }
            });
            this.wrapper.insertBefore(this.element);

            this.element.add(this.placeholder).appendTo(this.wrapper);
            this.element.css('margin', 0);

            this.placeholder.bind('click', function(e) {
                base.element.trigger('focus');
            });

            this.element.bind('focus', function() {
                base.placeholder.hide();
            });

            this.element.bind('blur', function() {
                if (this.value.match(/^\s*$/)) {
                    base.element.val('');
                    base.placeholder.show();
                }
            });

            this.placeholder.hide();
            this.element.trigger('blur');
        },
        _init: function() {
            if ($.ui.placeholder.browserSupport) { return false; }

            var topOffset = parseInt(this.element.css('border-top-width'), 10);
            this.placeholder.css({
                width: this.element.width(),
                top: ($.browser.msie ? topOffset : 0) + topOffset,
                left: this.element.css('border-left-width'),
                paddingTop: this.element.css('padding-top'),
                paddingRight: this.element.css('padding-right'),
                paddingBottom: this.element.css('padding-bottom'),
                paddingLeft: this.element.css('padding-left')
            });
        },
        destroy: function() {
            $.Widget.prototype.destroy.apply(this, arguments);
        }
    });

    $.extend($.ui.placeholder, {
        browserSupport: (function() {
            var i = document.createElement('input');
            return ('placeholder' in i);
        })()
    });
})(jQuery);


text:
require 'google/protobuf'

require 'google/ads/google_ads/v12/enums/keyword_match_type_pb'
require 'google/api/field_behavior_pb'
require 'google/api/resource_pb'

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file("google/ads/googleads/v12/resources/keyword_plan_ad_group_keyword.proto", :syntax => :proto3) do
    add_message "google.ads.googleads.v12.resources.KeywordPlanAdGroupKeyword" do
      optional :resource_name, :string, 1
      proto3_optional :keyword_plan_ad_group, :string, 8
      proto3_optional :id, :int64, 9
      proto3_optional :text, :string, 10
      optional :match_type, :enum, 5, "google.ads.googleads.v12.enums.KeywordMatchTypeEnum.KeywordMatchType"
      proto3_optional :cpc_bid_micros, :int64, 11
      proto3_optional :negative, :bool, 12
    end
  end
end

module Google
  module Ads
    module GoogleAds
      module V12
        module Resources
          KeywordPlanAdGroupKeyword = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v12.resources.KeywordPlanAdGroupKeyword").msgclass
        end
      end
    end
  end
end


text:
package com.streamsets.pipeline.lib.jdbc;

import com.google.common.base.Strings;
import com.streamsets.pipeline.api.Field;
import com.streamsets.pipeline.api.Record;
import com.streamsets.pipeline.api.StageException;
import com.streamsets.pipeline.api.base.OnRecordErrorException;
import com.streamsets.pipeline.lib.operation.UnsupportedOperationAction;
import java.math.BigDecimal;
import java.sql.Types;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.zip.DataFormatException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.sql.DataSource;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Array;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;

public abstract class JdbcBaseRecordWriter implements JdbcRecordWriter {
  private static final Logger LOG = LoggerFactory.getLogger(JdbcBaseRecordWriter.class);
  private final List<JdbcFieldColumnParamMapping> customMappings;

  private final String connectionString;
  private final DataSource dataSource;
  private final String schema;
  private final String tableName;
  private final boolean rollbackOnError;
  private final boolean caseSensitive;

  private Map<String, String> columnsToFields = new HashMap<>();
  private Map<String, String> columnsToParameters = new HashMap<>();
  private final List<JdbcFieldColumnMapping> generatedColumnMappings;
  private Map<String, Integer> columnType = new HashMap<>();
  private List<String> primaryKeyColumns;
  private Map<String, String> columnsWithoutPrimaryKeys;
  JdbcRecordReader recordReader;
  /* Static lists for column type checking in setParamsToStatement */
  private Set<Integer> binaryTypes = new HashSet<>(Arrays.asList(
      Types.BINARY,
      Types.LONGVARBINARY,
      Types.VARBINARY
  ));
  private Set<Integer> textTypes = new HashSet<>(Arrays.asList(
      Types.CHAR,
      Types.VARCHAR,
      Types.BLOB,
      Types.LONGNVARCHAR,
      Types.NCHAR,
      Types.NVARCHAR,
      Types.LONGVARCHAR,
      Types.SQLXML,
      Types.CLOB,
      Types.NCLOB
  ));
  private Set<Integer> numericTypes = new HashSet<>(Arrays.asList(
      Types.BIT,
      Types.TINYINT,
      Types.SMALLINT,
      Types.INTEGER,
      Types.BIGINT,
      Types.DECIMAL,
      Types.NUMERIC,
      Types.FLOAT,
      Types.REAL,
      Types.DOUBLE
  ));
  /*
    The following should be handled by setObject() and hence
    won't be checked.
    Types.TIME_WITH_TIMEZONE
    Types.TIMESTAMP_WITH_TIMEZONE
 */
  private Set<Integer> dateTypes = new HashSet<>(Arrays.asList(
      Types.DATE,
      Types.TIME,
      Types.TIMESTAMP
  ));

  // Index of columns returned by DatabaseMetaData.getColumns. Defined in DatabaseMetaData class.
  private static final int COLUMN_NAME = 4;
  private static final int DATA_TYPE = 5;

  private final int defaultOpCode;
  private final UnsupportedOperationAction unsupportedAction;
  private final List<String> primaryKeyParams;

  protected final JdbcUtil jdbcUtil;

  public JdbcBaseRecordWriter(
      String connectionString,
      DataSource dataSource,
      String schema,
      String tableName,
      boolean rollbackOnError,
      List<JdbcFieldColumnParamMapping> customMappings,
      int defaultOpCode,
      UnsupportedOperationAction unsupportedAction,
      JdbcRecordReader recordReader,
      List<JdbcFieldColumnMapping> generatedColumnMappings,
      boolean caseSensitive
  ) throws StageException {
    this.jdbcUtil = UtilsProvider.getJdbcUtil();

    this.connectionString = connectionString;
    this.dataSource = dataSource;

    if (Strings.isNullOrEmpty(schema) && tableName.contains(".") && !caseSensitive) {
      // Need to split this into the schema and table parts for column metadata to be retrieved.
      LOG.warn("Schema in the tableName is no longer supported. Schema should defined in Schema configuration: {}", tableName);

      String[] parts = tableName.split("\\.");
      if (parts.length != 2) {
        throw new StageException(JdbcErrors.JDBC_16, tableName);
      }

      this.schema = parts[0];
      this.tableName = tableName;
    } else {
      this.schema = schema;
      this.tableName = tableName;
    }
    this.rollbackOnError = rollbackOnError;
    this.customMappings = customMappings;
    this.defaultOpCode = defaultOpCode;
    this.unsupportedAction = unsupportedAction;
    this.recordReader = recordReader;
    this.generatedColumnMappings = generatedColumnMappings;
    this.caseSensitive = caseSensitive;

    createDefaultFieldMappings();
    createCustomFieldMappings();
    lookupPrimaryKeys();
    primaryKeyParams = new LinkedList<>();
    columnsWithoutPrimaryKeys = new HashMap<>(columnsToFields);
    for (String key: primaryKeyColumns) {
      primaryKeyParams.add(getColumnsToParameters().get(key));
      columnsWithoutPrimaryKeys.remove(key);
    }
  }

  @Override
  public void deinit() {
  }

  /**
   * Access the database, obtain a list of primary key columns, and store them in primaryKeyColumns.
   * If table has no primary keys, primaryKeyColumns stays empty.
   *
   * @throws StageException
   */
  void lookupPrimaryKeys() throws StageException {
    Connection connection = null;
    try {
      connection = dataSource.getConnection();
      primaryKeyColumns = jdbcUtil.getPrimaryKeys(connection, schema, tableName);
    } catch (SQLException e) {
      String formattedError = jdbcUtil.formatSqlException(e);
      LOG.error(formattedError, e);
      throw new StageException(JdbcErrors.JDBC_17, tableName, formattedError);
    } finally {
      if (connection != null) {
        try {
          connection.close();
        } catch (SQLException e) {
          String formattedError = jdbcUtil.formatSqlException(e);
          LOG.error(formattedError, e);
        }
      }
    }
  }

  int getColumnType(String columnName) { return columnType.get(columnName); }

  /**
   * Access database and obtain the metadata for the table.
   * Store columnName and "/columnName" to the columnsToFields map as a default column-to-field mapping.
   * Store columnName and "?" to columnsToParameters map as a default column-to-value mapping.
   * They will be updated later in createCustomFieldMappings().
   *
   * @throws StageException
   */
  private void createDefaultFieldMappings() throws StageException {
    try (Connection connection = dataSource.getConnection()) {
      try (ResultSet res = jdbcUtil.getTableMetadata(connection, schema, tableName)) {
        if (!res.next()) {
          throw new StageException(JdbcErrors.JDBC_16, getTableName());
        }
      }

      try (ResultSet columns = jdbcUtil.getColumnMetadata(connection, schema, tableName)) {
        while (columns.next()) {
          String columnName = columns.getString(COLUMN_NAME);
          columnsToFields.put(columnName, "/" + columnName); // Default implicit field mappings
          columnsToParameters.put(columnName, "?");
          columnType.put(columnName, columns.getInt(DATA_TYPE));
        }
      }
    } catch (SQLException e) {
      String errorMessage = jdbcUtil.formatSqlException(e);
      LOG.error(errorMessage);
      LOG.debug(errorMessage, e);
      throw new StageException(JdbcErrors.JDBC_09, tableName);
    }
  }

  /**
   * Use "Field to Column Mapping" option obtained from configuration and update
   * columnsToFields and columnsToParameters.
   */
  private void createCustomFieldMappings() {
    for (JdbcFieldColumnParamMapping mapping : customMappings) {
      LOG.debug("Custom mapping field {} to column {}", mapping.field, mapping.columnName);
      if (columnsToFields.containsKey(mapping.columnName)) {
        LOG.debug("Mapping field {} to column {}", mapping.field, mapping.columnName);
        columnsToFields.put(mapping.columnName, mapping.field);
        columnsToParameters.put(mapping.columnName, mapping.paramValue);
      }
    }
  }

  // This is necessary for supporting array data types. For some awful reason, the JDBC
  // spec requires a string name for a data type, rather than just an enum.
  static String getSQLTypeName(Field.Type type) throws OnRecordErrorException {
    switch (type) {
      case BOOLEAN:
        return "BOOLEAN";
      case CHAR:
        return "CHAR";
      case BYTE:
        return "BINARY";
      case SHORT:
        return "SMALLINT";
      case INTEGER:
        return "INTEGER";
      case LONG:
        return "BIGINT";
      case FLOAT:
        return "FLOAT";
      case DOUBLE:
        return "DOUBLE";
      case DATE:
        return "DATE";
      case TIME:
        return "TIME";
      case DATETIME:
        return "TIMESTAMP";
      case DECIMAL:
        return "DECIMAL";
      case STRING:
        return "VARCHAR";
      case BYTE_ARRAY:
        return "VARBINARY";
      case LIST_MAP:
      case MAP:
        throw new OnRecordErrorException(JdbcErrors.JDBC_05, "Unsupported list or map type: MAP");
      case LIST:
        return "ARRAY";
      default:
        throw new OnRecordErrorException(JdbcErrors.JDBC_05, "Unsupported type: " + type.name());
    }
  }

  /**
   * Database connection string
   * @return connection string
   */
  protected String getConnectionString() {
    return connectionString;
  }

  /**
   * Table this writer will write to.
   * @return table name
   */
  protected String getTableName() {
    if (!Strings.isNullOrEmpty(schema)) {
      if (caseSensitive) {
        return "\"" + schema + "\"." + "\"" + tableName + "\"";
      } else {
        return schema + "." + tableName;
      }
    }

    if (caseSensitive) {
      return "\"" + tableName + "\"";
    }

    return tableName;
  }

  /**
   * JDBC DataSource used for writing.
   * @return JDBC DataSource
   */
  DataSource getDataSource() {
    return dataSource;
  }

  /**
   * SQL Table to SDC Field mappings
   * @return map of the mappings
   */
  Map<String, String> getColumnsToFields() {
    return columnsToFields;
  }

  /**
   * SQL Columns to custom parameter mappings. These will be used to parameterized
   * an INSERT statement
   * @return map of the mappings
   */
  Map<String, String> getColumnsToParameters() {
    return columnsToParameters;
  }

  /**
   * A list of primary key column names
   * @return List of primary key column names
   */
  List<String> getPrimaryKeyColumns() {
    return primaryKeyColumns;
  }

  /**
   * A list of primary key column name
   * @return List of primary key column names
   */
  List<String> getPrimaryKeyParams() {
    return primaryKeyParams;
  }

  /**
   * A list of table columns that don't include primary key columns
   * @return List of table columns without primary keys
   */
  Map<String, String> getColumnsToFieldNoPK() {
    return columnsWithoutPrimaryKeys;
  }

  /**
   * Whether or not to try to perform a transaction rollback on error.
   * @return whether to rollback the transaction
   */
  boolean getRollbackOnError() {
    return rollbackOnError;
  }

  static List<Object> unpackList(List<Field> value) {
    List<Object> unpackedList = new ArrayList<>();
    for (Field item : value) {
      unpackedList.add(item.getValue());
    }
    return unpackedList;
  }

  List<JdbcFieldColumnMapping> getGeneratedColumnMappings() {
    return generatedColumnMappings;
  }

  void writeGeneratedColumns(
      PreparedStatement statement,
      Iterator<Record> iter,
      List<OnRecordErrorException> errorRecords
  ) throws SQLException {
    ResultSet resultSet = statement.getGeneratedKeys();

    ResultSetMetaData md = resultSet.getMetaData();
    int numColumns = md.getColumnCount();

    while (resultSet.next()) {
      Record record = iter.next();
      // Process row
      for (int i = 1; i <= numColumns; i++) {
        try {
          // Assuming generated columns can't be CLOBs/BLOBs, so just pass
          // zero for maxClobSize
          Field field = jdbcUtil.resultToField(
            md,
            resultSet,
            i,
            0,
            0,
            UnknownTypeAction.STOP_PIPELINE
          );

          if (field == null) {
            LOG.error(JdbcErrors.JDBC_03.getMessage(), md.getColumnName(i), resultSet.getObject(i));
            errorRecords.add(new OnRecordErrorException(record, JdbcErrors.JDBC_03,
                md.getColumnName(i), resultSet.getObject(i)));
          }

          record.set(generatedColumnMappings.get(i - 1).field, field);
        } catch (IOException|StageException e) {
          LOG.error(JdbcErrors.JDBC_03.getMessage(), md.getColumnName(i), resultSet.getObject(i), e);
          errorRecords.add(new OnRecordErrorException(record, JdbcErrors.JDBC_03,
              md.getColumnName(i), resultSet.getObject(i)));
        }
      }
    }
  }

  boolean isColumnTypeNumeric(int columnType) {
    return numericTypes.contains(columnType);
  }
  boolean isColumnTypeText(int columnType) {
    return textTypes.contains(columnType);
  }

  boolean isColumnTypeDate(int columnType) {
    return dateTypes.contains(columnType);
  }

  boolean isColumnTypeBinary(int columnType) {
    return binaryTypes.contains(columnType);
  }

  int setParamsToStatement(int paramIdx,
                PreparedStatement statement,
                SortedMap<String, String> columnsToParameters,
                Record record,
                Connection connection,
                int opCode) throws OnRecordErrorException {
    // fill in parameters to existing statement
    for (String column : columnsToParameters.keySet()) {
      Field field = record.get(recordReader.getFieldPath(column, getColumnsToFields(), opCode));
      Field.Type fieldType = field.getType();
      Object value = field.getValue();
      int columnType = getColumnType(column);

      /* See SDC-7959: MapD does not support PreparedStatement.setObject()
      * To minimise exceptions, explicitly set values using setType method.
      * Note:
      * - MAP, LIST_MAP not implemented as handled prior to calling. */
      try {
        /* If a value is null, regardless of its passed in Field.Type, the column should be set to null
         */
        if (value == null) {
          statement.setObject(paramIdx, value, getColumnType(column));
          paramIdx++;
          continue;
        }
        switch (fieldType) {
          case LIST:
            List<Field> fieldList = field.getValueAsList();
            if (fieldList.size() > 0) {
              Field.Type elementFieldType = fieldList.get(0).getType();
              Array array = connection.createArrayOf(getSQLTypeName(elementFieldType), unpackList(fieldList).toArray());
              statement.setArray(paramIdx, array);
            } else {
              statement.setArray(paramIdx, null);
            }
            break;
          case DATE:
          case TIME:
          case DATETIME:
            if (!isColumnTypeDate(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            // Java Date types are not accepted by JDBC drivers, so we need to convert to java.sql.Timestamp
            statement.setTimestamp(paramIdx,
                field.getValueAsDate() == null ? null : new java.sql.Timestamp(field.getValueAsDatetime().getTime())
            );
            break;
          case BOOLEAN:
            if (columnType != Types.BOOLEAN) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setBoolean(paramIdx, (Boolean)value);
            break;
          case CHAR:
          case STRING:
            if (!isColumnTypeText(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setString(paramIdx, String.valueOf(value));
            break;
          case BYTE:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setByte(paramIdx, (Byte)value);
            break;
          case SHORT:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setShort(paramIdx, (Short)value);
            break;
          case INTEGER:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setInt(paramIdx, (Integer)value);
            break;
          case LONG:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setLong(paramIdx, (Long)value);
            break;
          case FLOAT:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setFloat(paramIdx, (Float)value);
            break;
          case DOUBLE:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setDouble(paramIdx, (Double)value);
            break;
          case DECIMAL:
            if (!isColumnTypeNumeric(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setBigDecimal(paramIdx, (BigDecimal)value);
            break;
          case BYTE_ARRAY:
            if (!isColumnTypeBinary(columnType)) {
              LOG.debug("fieldType: {} and column: {} not directly compatible. Attempting to use setObject()",
                  fieldType,
                  column
              );
              statement.setObject(paramIdx, value, getColumnType(column));
              break;
            }
            statement.setBytes(paramIdx, (byte[])value);
            break;
          case FILE_REF:
          case MAP: // should not be seen as un-mapping handled prior to call
          case LIST_MAP: // should not be seen as un-mapping handled prior to call
            throw new DataFormatException(fieldType.name());
          case ZONED_DATETIME: //guidance is to use setObject() for this type
          default:
            LOG.debug("fieldType: {} handled by default case. Attempting to use setObject()", fieldType);
            statement.setObject(paramIdx, value, getColumnType(column));
            break;
        }
      } catch (DataFormatException e) {
        LOG.error("Query failed unsupported type {}", e.getMessage());
        throw new OnRecordErrorException(record, JdbcErrors.JDBC_05, field.getValue(), fieldType.toString(), column);
      } catch (SQLException e) {
        LOG.error("Query failed due to {}", e.getMessage(), e);
        throw new OnRecordErrorException(record, JdbcErrors.JDBC_23, field.getValue(), fieldType.toString(), column);
      }
      ++paramIdx;
    }
    return paramIdx;
  }

  /**
   * Set primary key values to query. This is called only for UPDATE and DELETE operations.
   * If primary key value is missing in record, it throws OnRecordErrorException.
   * @param index
   * @param record
   * @param statement
   * @param opCode
   * @return
   * @throws OnRecordErrorException
   */
  int setPrimaryKeys(int index, final Record record, PreparedStatement statement, int opCode)
      throws OnRecordErrorException {
    for (String key : getPrimaryKeyColumns()) {
      Field field = record.get(recordReader.getFieldPath(key, getColumnsToFields(), opCode));
      if(field == null){
        LOG.error("Primary key {} is missing in record", key);
        throw new OnRecordErrorException(record, JdbcErrors.JDBC_19, key);
      }
      Object value = field.getValue();

      try {
        statement.setObject(index, value, getColumnType(key));
      } catch (SQLException ex){
        LOG.error("SQLException thrown: {}", ex.getMessage());
        throw new OnRecordErrorException(record, JdbcErrors.JDBC_19, key, ex);
      }
      ++index;
    }
    return index;
  }

  /**
   * This is an error that is not due to bad input record and should throw a StageException
   * once we format the error.
   *
   * @param e SQLException
   * @throws StageException
   */
  void handleSqlException(SQLException e) throws StageException {
    String formattedError = jdbcUtil.formatSqlException(e);
    LOG.error(formattedError, e);
    throw new StageException(JdbcErrors.JDBC_14, formattedError);
  }

  /**
   * Get the numeric operation code from record header. The default code is
   * used if the operation code is not found in the header.
   *
   * @param record the record to find the operation code
   * @param errorRecords the list to take error records
   * @return the numeric operation code or -1 for unsupported operation
   */
  protected int getOperationCode(Record record, List<OnRecordErrorException> errorRecords) {
    return recordReader.getOperationFromRecord(
        record,
        defaultOpCode,
        unsupportedAction,
        errorRecords);
  }

}


text:
<?php

namespace Jhg\DoctrinePagination\Collection;

use Doctrine\Common\Collections\ArrayCollection;

class PaginatedArrayCollection extends ArrayCollection
{
    protected ?int $page;

    protected ?int $rpp;

    protected ?int $total;

    public function __construct(array $elements = [], ?int $page = null, ?int $rpp = 10, ?int $total = null)
    {
        $this->page = $page;
        $this->rpp = $rpp;
        $this->total = $total;

        parent::__construct($elements);
    }

    public function getPage(): ?int
    {
        return $this->page;
    }

    public function getRpp(): ?int
    {
        return $this->rpp;
    }

    public function getTotal(): ?int
    {
        return $this->total;
    }

    public function getPages(): int
    {
        if (!$this->getRpp()) {
            throw new \LogicException('Rpp was not set');
        }

        if (!$this->getTotal()) {
            return 0;
        }

        return ceil($this->total / $this->rpp);
    }

    public function getFirstPage(): ?int
    {
        if (0 == $this->getPages()) {
            return null;
        }

        return 1;
    }

    public function getLastPage(): ?int
    {
        if (0 == $this->getPages()) {
            return null;
        }

        return $this->getPages();
    }

    public function getNextPage(): ?int
    {
        if (!$this->isLastPage()) {
            return $this->getPage() + 1;
        }

        return null;
    }

    public function getPrevPage(): ?int
    {
        if (!$this->isFirstPage()) {
            return $this->getPage() - 1;
        }

        return null;
    }

    public function isFirstPage(): bool
    {
        return $this->getPage() == 1;
    }

    public function isLastPage(): bool
    {
        return !$this->getPages() || $this->getPage() == $this->getPages();
    }
}


text:
namespace ccb { namespace log
{
    enum class LogLevel
    {
        Trace = 0,

        Info = 1,

        Warning = 2,

        Error = 3,

        Critical = 4
    };

    inline std::wostream& operator << (std::wostream& stream, LogLevel level)
    {
        switch (level)
        {
        case LogLevel::Trace:
            return stream << L"Trace";

        case LogLevel::Info:
            return stream << L"Info";
            break;

        case LogLevel::Warning:
            return stream << L"Warning";

        case LogLevel::Error:
            return stream << L"Error";

        case LogLevel::Critical:
            return stream << L"Critical";

        default:
            return stream << L"Unknown";
        };

        return stream;
    }
} }


text:
package pl.rpolak.fizzbuzz.bo;

/**
 * Created by Rafal Polak on 25.11.2017.
 */
public class FizzBuzzBO implements IFizzBuzzBO {

    @Override
    public String recognizeWords(long number) {

        StringBuilder stringBuilder = new StringBuilder();
        String output;

        for (int index = 1; index <= number; index++) {

            if (index % 3 != 0 && index % 5 != 0) {
                stringBuilder.append(index + " ");
            }

            if (index % 3 == 0) {
                stringBuilder.append("Fizz ");
            }

            if (index % 5 == 0) {
                stringBuilder.append("Buzz ");
            }
        }

        output = stringBuilder.toString();

        return output;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

[Serializable]
public class InventoryInfo
{
    [Tooltip("The weight in KGs of the item.")]
    public float Weight = 2f;
}


text:
{% load i18n %}
<div>{% trans 'Place your content here...' %}</div>


text:
using namespace std;

#define MAX_FRAMES 256

vector<string> bin::printStack(int skip) {
	// Thanks to http://stackoverflow.com/a/5699483/510036

	unsigned int i;
	void *stack[MAX_FRAMES];
	unsigned short frames;
	SYMBOL_INFO *symbol;
	HANDLE process;

	process = GetCurrentProcess();

	SymInitialize(process, NULL, TRUE);

	frames               = CaptureStackBackTrace(0, MAX_FRAMES, stack, NULL);
	symbol               = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1);
	symbol->MaxNameLen   = 255;
	symbol->SizeOfStruct = sizeof(SYMBOL_INFO);

	vector<string> result;
	stringstream ss;

	ios::fmtflags fmt(ss.flags());

	for (i = 0; i < frames; i++) {
		bool hasSymbol = SymFromAddr(process, (DWORD64)(stack[ i ]), 0, symbol);
		ss << (frames - i - 1) << ": "
			<< (hasSymbol ? symbol->Name : "???")
			<< " (" << hex
			<< (hasSymbol ? symbol->Address : stack[i])
			<< ")";

		result.push_back(ss.str());
		ss.flags(fmt);
		ss.str("");
		ss.clear();
	}

	free(symbol);

	return result;
}

int bin::getAnsiLevel(int fd) {
	// ANSI escapes are only supported on Windows version 10 build 10586 and above.
	DWORD version = GetVersion();
	DWORD majorVersion = (DWORD)(LOBYTE(LOWORD(version)));
	if (majorVersion < 10) {
		return 0;
	}

	DWORD build = 0;
	if (majorVersion == 10) {
		if (version >= 0x80000000) {
			return 0;
		}

		build = (DWORD)(HIWORD(version));
		if (build < 10586) {
			return 0;
		}
	}

	const char *force = getenv("FORCE_COLOR");
	if ((force && string(force) == "0") || (!force && !_isatty(fd))) {
		return 0;
	}

	if (majorVersion > 10 || build >= 14393) {
		// enable VT escapes on the particular output
		// we perform the check since between 10586 and 14393 (exclusive) colors were implicitly enabled.
		// after 14393, they were disabled and have to be explicitly enabled.
		// thanks to https://github.com/symfony/symfony/issues/17499#issuecomment-243481052
		HANDLE hOut = GetStdHandle(fd == 1 ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE);
		DWORD dwMode = 0;
		GetConsoleMode(hOut, &dwMode);
		dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
		SetConsoleMode(hOut, dwMode);
	}

	return 1;
}


text:
ALTER TABLE smgCharacteristic ADD CONSTRAINT FK_smgc_ctv
FOREIGN KEY (valuetype_id) REFERENCES characteristicTypeValue(id);


text:
<?php

namespace Pok\PoolDBM\Console\Helper;

use Symfony\Component\Console\Helper\Helper;

use Pok\PoolDBM\ModelManager;

/**
 * ModelManagerHelper
 */
class ModelManagerHelper extends Helper
{
    /**
     * @var ModelManager
     */
    protected $modelManager;

    /**
     * Constructor.
     *
     * @param ModelManager $modelManager Model manager
     */
    public function __construct(ModelManager $modelManager)
    {
        $this->modelManager = $modelManager;
    }

    /**
     * Retrieves Model manager.
     *
     * @return ModelManager
     */
    public function getModelManager()
    {
        return $this->modelManager;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'modelManager';
    }
}


text:
module CustomAssertions
  def assert_similar_time(expected, actual)
    difference = (expected - actual).abs
    assert difference < 3, "exepected #{expected} to be within 3 seconds of #{actual} but was #{difference} seconds away"
  end
end


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Nova Hedwigia 11: 548 (1966)

#### Original name
Ceriosporopsis longissima Kohlm., 1962

### Remarks
null


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';

import { AutoComplete } from 'antd';

import ServiceClient from "../service/ServiceClient";
import { activeSelectedSong } from '../actions/PlayListAction';

class SearchBar extends Component {

    constructor(props) {
        super(props);

        this.handleChange = this.handleChange.bind(this);
        this.handleSelect = this.handleSelect.bind(this);
        this.inputEvent = null;
    }

    state = {
        dataSource: []
    }

    componentDidMount()
    {

    }

    handleChange(value)
    {
        if (value.trim() !== "") {
            if (!this.inputEvent) {
                this.inputEvent = setTimeout(async () => {
                    const res = await ServiceClient.getInstance().search(value, true);
                    console.log(res);
                    if (res.songs) {
                        const names = res.songs.map(item => {
                            return {
                                value: item.id,
                                text: item.name
                            }
                        });
                        this.setState({
                            dataSource: names
                        });
                    }
                }, 500);
            } else {
                clearTimeout(this.inputEvent);
                this.inputEvent = setTimeout(async () => {
                    const res = await ServiceClient.getInstance().search(value, true);
                    if (res.songs) {
                        const names = res.songs.map(item => {
                            return {
                                value: item.id,
                                text: item.name
                            }
                        });
                        this.setState({
                            dataSource: names
                        });
                    }
                }, 500);
            }
        }
    }

    handleSelect(value)
    {
        if (value.trim() !== "") {
            const song = this.state.dataSource.find(item => item.value == value);
            this.props.onSearch(song.text);
        }
    }

    render() {
        return (
          <div className="nmr-search-bar">
              <AutoComplete
                  className="nmr-autocomplete"
                  style={{ width: 200 }}
                  dataSource={this.state.dataSource}
                  onChange={this.handleChange}
                  onSelect={this.handleSelect}
                  placeholder="搜索歌曲"
              />
          </div>
        )
    }

}

export default SearchBar;