text:
#include "tensorflow/compiler/xla/python/py_client.h"

#include <memory>
#include <string>
#include <utility>

#include "absl/base/casts.h"
#include "absl/container/flat_hash_map.h"
#include "tensorflow/compiler/xla/pjrt/mlir_to_hlo.h"
#include "tensorflow/compiler/xla/pjrt/pjrt_client.h"
#include "tensorflow/compiler/xla/pjrt/pjrt_stream_executor_client.h"
#include "tensorflow/compiler/xla/pjrt/transpose.h"
#include "tensorflow/compiler/xla/primitive_util.h"
#include "tensorflow/compiler/xla/python/exceptions.h"
#include "tensorflow/compiler/xla/python/pprof_profile_builder.h"
#include "tensorflow/compiler/xla/python/py_buffer.h"
#include "tensorflow/compiler/xla/python/py_executable.h"
#include "tensorflow/compiler/xla/python/py_values.h"
#include "tensorflow/compiler/xla/python/python_ref_manager.h"
#include "tensorflow/compiler/xla/python/traceback.h"
#include "tensorflow/compiler/xla/python/transfer_guard_lib.h"
#include "tensorflow/compiler/xla/python/types.h"
#include "tensorflow/compiler/xla/service/custom_call_status.h"
#include "tensorflow/compiler/xla/service/custom_call_target_registry.h"
#include "tensorflow/core/platform/statusor.h"

namespace xla {

namespace py = pybind11;

PyClient::PyClient(std::unique_ptr<PjRtClient> pjrt_client)
    : PyClient(std::shared_ptr<PjRtClient>(std::move(pjrt_client))) {}

PyClient::PyClient(std::shared_ptr<PjRtClient> pjrt_client)
    : pjrt_client_(std::move(pjrt_client)) {
  CHECK(pjrt_client_ != nullptr);
  buffers_.resize(pjrt_client_->device_count());
  for (PjRtDevice* device : pjrt_client_->addressable_devices()) {
    if (device->id() >= buffers_.size()) {
      buffers_.resize(device->id() + 1);
    }
  }
}

PyClient::~PyClient() {
  py::gil_scoped_release gil;
  pjrt_client_ = nullptr;
}

std::vector<ClientAndPtr<PjRtDevice>> PyClient::Devices() {
  std::vector<ClientAndPtr<PjRtDevice>> devices;
  auto span = pjrt_client_->devices();
  devices.reserve(span.size());
  for (PjRtDevice* device : span) {
    devices.push_back(WrapWithClient(shared_from_this(), device));
  }
  return devices;
}

std::vector<ClientAndPtr<PjRtDevice>> PyClient::LocalDevices() {
  std::vector<ClientAndPtr<PjRtDevice>> devices;
  devices.reserve(pjrt_client_->addressable_devices().size());
  for (PjRtDevice* device : pjrt_client_->addressable_devices()) {
    devices.push_back(WrapWithClient(shared_from_this(), device));
  }
  return devices;
}

std::vector<py::object> PyClient::LiveBuffers() {
  CHECK(PyGILState_Check());
  std::vector<py::object> buffers;
  for (PyBuffer* device_buffers : buffers_) {
    for (PyBuffer* buffer = device_buffers; buffer; buffer = buffer->next_) {
      if (!buffer->is_deleted()) {
        buffers.push_back(
            py::reinterpret_borrow<py::object>(buffer->AsHandle()));
      }
    }
  }
  return buffers;
}

std::vector<py::object> PyClient::LiveBuffersOnDevice(PjRtDevice* device) {
  CHECK_EQ(device->client(), pjrt_client());
  CHECK(PyGILState_Check());
  std::vector<py::object> buffers;
  for (PyBuffer* buffer = buffers_[device->id()]; buffer;
       buffer = buffer->next_) {
    if (!buffer->is_deleted()) {
      buffers.push_back(py::reinterpret_borrow<py::object>(buffer->AsHandle()));
    }
  }
  return buffers;
}

std::vector<std::shared_ptr<PyExecutable>> PyClient::LiveExecutables() {
  CHECK(PyGILState_Check());
  std::vector<std::shared_ptr<PyExecutable>> executables;
  for (PyExecutable* exec = executables_; exec; exec = exec->next_) {
    if (!exec->is_deleted()) {
      executables.push_back(exec->shared_from_this());
    }
  }
  return executables;
}

Status PyClient::Defragment() {
  CHECK(PyGILState_Check());
  switch (pjrt_client_->runtime_type()) {
    case PjRtRuntimeType::kTfrt:
      return pjrt_client_->Defragment();
    case PjRtRuntimeType::kStreamExecutor:
      struct TmpBuffer {
        PyBuffer* py_buffer;
        // TODO(skyewm): maybe use py_buffer's HostValue
        std::shared_ptr<Literal> host_copy;
      };

      // Synchronously copy all buffers to host
      std::vector<TmpBuffer> tmp_buffers;
      for (PyBuffer* device_buffers : buffers_) {
        for (PyBuffer* buffer = device_buffers; buffer;
             buffer = buffer->next_) {
          if (!buffer->is_deleted()) {
            TF_ASSIGN_OR_RETURN(std::shared_ptr<Literal> literal,
                                buffer->buffer_->ToLiteralSync());
            tmp_buffers.push_back({buffer, literal});
          }
        }
      }

      // All buffers successfully copied to host, delete on-device copies.
      //
      // Use blocking delete operation to ensure all memory is actually cleared
      // before we start rewriting buffers.
      //
      // Die instead of returning a bad status because program presumably can't
      // continue if we fail to reconstitute device buffers.
      for (TmpBuffer& tmp_buffer : tmp_buffers) {
        TF_CHECK_OK(tensorflow::down_cast<PjRtStreamExecutorBuffer*>(
                        tmp_buffer.py_buffer->buffer_.get())
                        ->Release(/*wait_for_operations_to_complete=*/true)
                        .status());
      }

      // Copy host copies back to device and update PyBuffers in-place.
      for (TmpBuffer& tmp_buffer : tmp_buffers) {
        std::unique_ptr<PjRtBuffer> new_copy =
            pjrt_client_
                ->BufferFromHostLiteral(*tmp_buffer.host_copy,
                                        tmp_buffer.py_buffer->buffer_->device())
                .ValueOrDie();
        TF_CHECK_OK(new_copy->BlockHostUntilReady());
        tmp_buffer.py_buffer->buffer_.reset(new_copy.release());
      }

      // TODO(skyewm): delete executables?
  }
  return Status::OK();
}

StatusOr<std::vector<std::vector<ClientAndPtr<PjRtDevice>>>>
PyClient::GetDefaultDeviceAssignment(int num_replicas, int num_partitions) {
  TF_ASSIGN_OR_RETURN(
      DeviceAssignment device_assignment,
      pjrt_client_->GetDefaultDeviceAssignment(num_replicas, num_partitions));
  std::vector<std::vector<ClientAndPtr<PjRtDevice>>> result;
  result.resize(num_replicas);
  for (int r = 0; r < num_replicas; ++r) {
    result[r].resize(num_partitions);
    for (int p = 0; p < num_partitions; ++p) {
      int device_id = device_assignment(r, p);
      TF_ASSIGN_OR_RETURN(PjRtDevice * device,
                          pjrt_client_->LookupDevice(device_id));
      result[r][p] = WrapWithClient(shared_from_this(), device);
    }
  }
  return result;
}

StatusOr<std::vector<ClientAndPtr<PjRtDevice>>>
PyClient::GetDefaultDeviceAssignment1D(int num_replicas) {
  TF_ASSIGN_OR_RETURN(DeviceAssignment device_assignment,
                      pjrt_client_->GetDefaultDeviceAssignment(
                          num_replicas, /*num_partitions=*/1));
  std::vector<ClientAndPtr<PjRtDevice>> result;
  for (int i = 0; i < num_replicas; ++i) {
    int device_id = device_assignment(i, 0);
    TF_ASSIGN_OR_RETURN(PjRtDevice * device,
                        pjrt_client_->LookupDevice(device_id));
    result.push_back(WrapWithClient(shared_from_this(), device));
  }
  return result;
}

StatusOr<py::object> PyClient::BufferFromPyval(
    pybind11::handle argument, PjRtDevice* device, bool force_copy,
    PjRtClient::HostBufferSemantics host_buffer_semantics) {
  if (device == nullptr) {
    TF_RET_CHECK(!pjrt_client_->addressable_devices().empty());
    device = pjrt_client_->addressable_devices().front();
  }
  CHECK(device != nullptr);

  auto transfer_guard_formatter = [&argument, dst_device = device] {
    auto type = py::cast<std::string>(py::str(argument.get_type()));
    // Catch exceptions because shape and dtype properties convertible to str
    // are not guaranteed to present in an arbitrary argument.
    std::string shape;
    std::string dtype;
    try {
      shape = py::cast<std::string>(py::str(argument.attr("shape")));
    } catch (const std::exception& e) {
      shape = "<unknown>";
    }
    try {
      dtype = py::cast<std::string>(py::str(argument.attr("dtype")));
    } catch (const std::exception& e) {
      dtype = "<unknown>";
    }
    return absl::StrCat("type=", type, ", shape=", shape, ", dtype=", dtype,
                        ", dst_device=", dst_device->DebugString());
  };
  TF_RETURN_IF_ERROR(
      jax::ApplyTransferGuardToHostToDevice(transfer_guard_formatter));

  TF_ASSIGN_OR_RETURN(PjRtDevice * found_device,
                      pjrt_client_->LookupDevice(device->id()));
  if (found_device != device) {
    return InvalidArgument("Cannot copy value to device '%s' with '%s' backend",
                           device->DebugString(),
                           pjrt_client_->platform_name());
  }
  GlobalPyRefManager()->CollectGarbage();

  DevicePutOptions options;
  options.squash_64bit_types = false;
  options.allow_zero_copy =
      (!force_copy &&
       (host_buffer_semantics == PjRtClient::HostBufferSemantics::kZeroCopy));
  TF_ASSIGN_OR_RETURN(DevicePutResult put,
                      DevicePut(argument, device, options));

  if (put.owned_buffer) {
    auto traceback = Traceback::Get();
    return PyBuffer::Make(shared_from_this(), std::move(put.owned_buffer),
                          std::move(traceback));
  } else {
    return py::reinterpret_borrow<py::object>(put.owning_pybuffer);
  }
}

StatusOr<std::vector<std::pair<pybind11::bytes, pybind11::object>>>
PyClient::MakeCrossHostReceiveBuffers(absl::Span<const Shape> shapes,
                                      PjRtDevice* device) {
  CHECK(device != nullptr);
  absl::Mutex mu;
  bool done = false;
  StatusOr<std::vector<std::pair<pybind11::bytes, pybind11::object>>>
      recv_buffers_or;

  auto shared_this = shared_from_this();
  pjrt_client_->MakeCrossHostReceiveBuffers(
      shapes, device,
      [&done, &recv_buffers_or, &shared_this,
       &mu](StatusOr<std::pair<std::vector<PjRtCrossHostRecvBuffer>,
                               PjRtCrossHostSendCancelNotifier>>&& buffers_or) {
        absl::MutexLock l(&mu);
        done = true;
        if (buffers_or.ok()) {
          py::gil_scoped_acquire gil;
          auto& buffers = buffers_or.ValueOrDie().first;
          std::vector<std::pair<pybind11::bytes, pybind11::object>>
              recv_buffers;
          for (auto& buf : buffers) {
            std::string desc = buf.serialized_descriptors[0];
            pybind11::bytes py_desc = pybind11::bytes(desc);
            auto traceback = Traceback::Get();
            auto py_buf =
                PyBuffer::Make(shared_this, std::move(buf.buffer), traceback);
            recv_buffers.push_back(std::make_pair(py_desc, py_buf));
          }
          recv_buffers_or = recv_buffers;
        } else {
          recv_buffers_or = buffers_or.status();
        }
      });

  {
    py::gil_scoped_release gil_release;
    absl::MutexLock l(&mu);
    mu.Await(absl::Condition(
        +[](bool* done) { return *done; }, &done));
  }

  return recv_buffers_or;
}

StatusOr<std::shared_ptr<PyExecutable>> PyClient::Compile(
    const XlaComputation& computation, CompileOptions options) {
  std::unique_ptr<PjRtExecutable> executable;
  absl::optional<std::string> fingerprint;
  {
    py::gil_scoped_release gil_release;
    TF_ASSIGN_OR_RETURN(executable,
                        pjrt_client_->Compile(computation, std::move(options)));
    TF_ASSIGN_OR_RETURN(fingerprint,
                        pjrt_client_->ExecutableFingerprint(*executable));
  }
  auto traceback = Traceback::Get();
  return std::make_shared<PyExecutable>(
      shared_from_this(), std::move(executable), std::move(traceback),
      std::move(fingerprint));
}

StatusOr<std::shared_ptr<PyExecutable>> PyClient::CompileMlir(
    std::string mlir_module, CompileOptions options) {
  std::unique_ptr<PjRtExecutable> executable;
  absl::optional<std::string> fingerprint;
  {
    py::gil_scoped_release gil_release;
    mlir::MLIRContext context;
    TF_ASSIGN_OR_RETURN(mlir::OwningOpRef<mlir::ModuleOp> module,
                        ParseMlirModuleString(mlir_module, context));
    TF_ASSIGN_OR_RETURN(
        executable, pjrt_client_->Compile(module.get(), std::move(options)));
    TF_ASSIGN_OR_RETURN(fingerprint,
                        pjrt_client_->ExecutableFingerprint(*executable));
  }
  auto traceback = Traceback::Get();
  return std::make_shared<PyExecutable>(
      shared_from_this(), std::move(executable), std::move(traceback),
      std::move(fingerprint));
}

StatusOr<py::bytes> PyClient::SerializeExecutable(
    const PyExecutable& executable) const {
  return pjrt_client_->SerializeExecutable(executable.pjrt_executable());
}

StatusOr<std::shared_ptr<PyExecutable>> PyClient::DeserializeExecutable(
    const std::string& serialized, CompileOptions options) {
  std::unique_ptr<PjRtExecutable> executable;
  absl::optional<std::string> fingerprint;
  {
    py::gil_scoped_release gil_release;
    TF_ASSIGN_OR_RETURN(executable, pjrt_client_->DeserializeExecutable(
                                        serialized, std::move(options)));
    TF_ASSIGN_OR_RETURN(fingerprint,
                        pjrt_client_->ExecutableFingerprint(*executable));
  }
  auto traceback = Traceback::Get();
  return std::make_shared<PyExecutable>(
      shared_from_this(), std::move(executable), std::move(traceback),
      std::move(fingerprint));
}

namespace {

struct HeapProfileKey {
  Traceback* traceback;
  int64_t size;
  PjRtDevice* device;
  bool operator==(const HeapProfileKey& other) const;
};

bool HeapProfileKey::operator==(const HeapProfileKey& other) const {
  if (size != other.size || device != other.device) {
    return false;
  }
  if ((traceback == nullptr) != (other.traceback == nullptr)) {
    return false;
  }
  if (traceback && traceback->raw_frames() != other.traceback->raw_frames()) {
    return false;
  }
  return true;
}

template <typename H>
H AbslHashValue(H h, const HeapProfileKey& key) {
  if (key.traceback) {
    h = H::combine(std::move(h), key.traceback->raw_frames());
  }
  h = H::combine(std::move(h), key.size, key.device);
  return h;
}

}  // namespace

StatusOr<py::bytes> PyClient::HeapProfile() {
  CHECK(PyGILState_Check());
  absl::flat_hash_set<PjRtBuffer*> buffer_set;
  absl::flat_hash_map<HeapProfileKey, int64_t> entries;
  for (PyBuffer* device_buffers : buffers_) {
    for (PyBuffer* buffer = device_buffers; buffer; buffer = buffer->next_) {
      // We only wish to count each PjRtBuffer once, even though they may be
      // shared by multiple PyBuffers.
      if (!buffer->is_deleted() && buffer_set.insert(buffer->buffer()).second) {
        TF_ASSIGN_OR_RETURN(size_t size,
                            buffer->buffer()->GetOnDeviceSizeInBytes());
        HeapProfileKey key{buffer->traceback().get(),
                           static_cast<int64_t>(size),
                           buffer->buffer()->device()};
        ++entries[key];
      }
    }
  }

  for (PyExecutable* executable = executables_; executable;
       executable = executable->next_) {
    if (!executable->is_deleted()) {
      HeapProfileKey key{executable->traceback(),
                         executable->SizeOfGeneratedCodeInBytes(), nullptr};
      ++entries[key];
    }
  }

  PprofProfileBuilder builder;
  auto* allocations = builder.profile().add_sample_type();
  allocations->set_type(builder.StringId("allocations"));
  allocations->set_unit(builder.StringId("count"));
  auto* space = builder.profile().add_sample_type();
  space->set_type(builder.StringId("space"));
  space->set_unit(builder.StringId("bytes"));

  const int kind_string_id = builder.StringId("kind");
  const int buffer_string_id = builder.StringId("buffer");
  const int executable_string_id = builder.StringId("executable");
  const int device_string_id = builder.StringId("device");
  for (const auto& entry : entries) {
    auto* sample = builder.profile().add_sample();
    if (entry.first.traceback) {
      for (const auto& frame : entry.first.traceback->raw_frames()) {
        sample->add_location_id(builder.LocationId(frame.first, frame.second));
      }
    }
    sample->add_value(entry.second);
    sample->add_value(entry.first.size * entry.second);

    auto* kind_label = sample->add_label();
    kind_label->set_key(kind_string_id);
    if (entry.first.device) {
      kind_label->set_str(buffer_string_id);
      auto* device_label = sample->add_label();
      device_label->set_key(device_string_id);
      device_label->set_str(
          builder.StringId(entry.first.device->DebugString()));
    } else {
      kind_label->set_str(executable_string_id);
    }
  }
  return py::bytes(builder.profile().SerializeAsString());
}

namespace {

class CpuCallback {
 public:
  struct Arg {
    PrimitiveType type;                    // XLA type
    py::dtype dtype;                       // NumPy type, for array types.
    absl::InlinedVector<int64_t, 4> dims;  // Dimensions, for array types.
    std::vector<ssize_t> strides;          // Byte strides, for array types.
  };
  struct Result {
    PrimitiveType type;  // XLA type
    // Expected output shape, for array types
    absl::InlinedVector<int64_t, 4> expected_dims;
    // Expected output byte strides, for array types. If the strides do not
    // match the output will be transposed into the expected layout.
    std::vector<int64_t> expected_strides;
    // The desired order of output dimensions in major-to-minor order.
    absl::InlinedVector<int64_t, 4> reversed_layout;
    // Size of the array in bytes.
    size_t size_in_bytes;
  };

  explicit CpuCallback(py::function callable, std::vector<Arg> args,
                       std::vector<Result> results)
      : callable_(std::move(callable)),
        args_(std::move(args)),
        results_(std::move(results)),
        transpose_cache_(/*capacity=*/16) {}

  void Call(void* result, void** arg_ptrs, XlaCustomCallStatus* status);

 private:
  py::function callable_;
  std::vector<Arg> const args_;
  std::vector<Result> const results_;
  TransposePlanCache transpose_cache_;
};

void CpuCallback::Call(void* result, void** arg_ptrs,
                       XlaCustomCallStatus* status) {
  absl::Span<void* const> inputs(arg_ptrs, args_.size());
  absl::Span<void* const> outputs(reinterpret_cast<void**>(result),
                                  results_.size());

  py::gil_scoped_acquire gil;
  py::tuple args(inputs.size());
  for (size_t i = 0; i < inputs.size(); ++i) {
    if (args_[i].type == TOKEN) {
      args[i] = py::none();
    } else {
      args[i] = py::array(args_[i].dtype, args_[i].dims, args_[i].strides,
                          const_cast<void*>(inputs[i]));
      args[i].attr("flags").attr("writeable") = Py_False;
    }
  }
  py::object result_tuple;
  try {
    result_tuple = callable_(*py::reinterpret_borrow<py::args>(args));
  } catch (py::error_already_set& e) {
    PyErr_Clear();
    std::string error_message = e.what();
    XlaCustomCallStatusSetFailure(status, error_message.c_str(),
                                  error_message.length());
    return;
  }
  if (!PyTuple_Check(result_tuple.ptr())) {
    throw xla::XlaRuntimeError(
        absl::StrFormat("CPU callback expected a tuple result, got %s",
                        static_cast<std::string>(py::repr(result_tuple))));
  }
  if (PyTuple_Size(result_tuple.ptr()) != results_.size()) {
    throw xla::XlaRuntimeError(
        absl::StrFormat("CPU callback expected a tuple with %d results, got %d",
                        results_.size(), PyTuple_Size(result_tuple.ptr())));
  }
  for (size_t i = 0; i < results_.size(); ++i) {
    py::object output = py::reinterpret_borrow<py::object>(
        PyTuple_GetItem(result_tuple.ptr(), i));
    if (results_[i].type == TOKEN) {
      if (!output.is_none()) {
        throw xla::XlaRuntimeError(absl::StrFormat(
            "Token output from Python callback should be None, got %s",
            static_cast<std::string>(py::repr(output))));
      }
      continue;
    }
    py::array array = py::cast<py::array>(std::move(output));
    static_assert(sizeof(ssize_t) == sizeof(int64_t),
                  "Expected ssize_t to be of equal size to int64_t");
    absl::Span<int64_t const> dims(
        reinterpret_cast<const int64_t*>(array.shape()), array.ndim());
    if (dims != results_[i].expected_dims) {
      throw xla::XlaRuntimeError(absl::StrFormat(
          "Mismatched result shape for %d-th return value from CPU callback; "
          "expected array with dimensions %s, got %s",
          i, absl::StrJoin(results_[i].expected_dims, ","),
          absl::StrJoin(dims, ",")));
    }
    absl::Span<int64_t const> strides(
        reinterpret_cast<const int64_t*>(array.strides()), array.ndim());
    if (strides == results_[i].expected_strides) {
      std::memcpy(outputs[i], array.data(), results_[i].size_in_bytes);
    } else {
      StatusOr<std::shared_ptr<TransposePlan>> plan =
          transpose_cache_.GetOrCreate(
              primitive_util::ByteWidth(results_[i].type), dims,
              results_[i].reversed_layout,
              /*input_layout=*/TransposePlan::Striding{strides});
      if (!plan.ok()) {
        throw xla::XlaRuntimeError(plan.status().ToString());
      }
      plan.ValueOrDie()->Execute(array.data(), outputs[i]);
    }
  }
}

extern "C" void XlaPythonCpuCallback(void* output, void** inputs,
                                     XlaCustomCallStatus* status) {
  CpuCallback* callback =
      absl::bit_cast<CpuCallback*>(*static_cast<uintptr_t*>(inputs[0]));
  callback->Call(output, inputs + 1, status);
}

XLA_CPU_REGISTER_CUSTOM_CALL_TARGET_WITH_SYM("xla_python_cpu_callback",
                                             &XlaPythonCpuCallback);

}  // namespace

StatusOr<std::pair<uint64_t, pybind11::object>>
PyClient::GetEmitPythonCallbackDescriptor(
    pybind11::function callable, absl::Span<Shape const> operand_shapes,
    absl::Span<Shape const> result_shapes) {
  if (pjrt_client_->platform_id() != CpuId()) {
    return Unimplemented("EmitPythonCallback is only implemented on CPU");
  }

  std::vector<CpuCallback::Arg> callback_args(operand_shapes.size());
  static_assert(sizeof(uintptr_t) == sizeof(uint64_t),
                "Expected 64-bit pointers");
  for (int i = 0; i < operand_shapes.size(); ++i) {
    Shape shape = operand_shapes[i];

    if (shape.IsArray()) {
      Shape layout =
          (shape.has_layout() ? shape
                              : LayoutUtil::GetWithDefaultLayout(shape));
      callback_args[i].dims.resize(shape.dimensions_size());
      absl::c_copy(shape.dimensions(), callback_args[i].dims.begin());
      callback_args[i].strides = ByteStridesForShape(layout);
      callback_args[i].type = shape.element_type();
      TF_ASSIGN_OR_RETURN(callback_args[i].dtype,
                          PrimitiveTypeToDtype(shape.element_type()));
    } else if (shape.IsToken()) {
      callback_args[i].type = TOKEN;
    } else {
      return InvalidArgument(
          "Only array and token arguments to Python callbacks are supported, "
          "got %s",
          shape.ToString());
    }
  }

  std::vector<CpuCallback::Result> callback_results(result_shapes.size());
  for (int i = 0; i < result_shapes.size(); ++i) {
    if (result_shapes[i].IsArray()) {
      const Shape& shape =
          result_shapes[i].has_layout()
              ? result_shapes[i]
              : LayoutUtil::GetWithDefaultLayout(result_shapes[i]);
      callback_results[i].expected_dims.resize(shape.dimensions_size());
      absl::c_copy(shape.dimensions(),
                   callback_results[i].expected_dims.begin());
      callback_results[i].expected_strides = ByteStridesForShapeInt64(shape);
      callback_results[i].type = shape.element_type();
      callback_results[i].size_in_bytes = ShapeUtil::ByteSizeOf(shape);
      callback_results[i].reversed_layout.resize(shape.dimensions_size());
      absl::c_reverse_copy(shape.layout().minor_to_major(),
                           callback_results[i].reversed_layout.begin());
    } else if (result_shapes[i].IsToken()) {
      callback_results[i].type = TOKEN;
    } else {
      return InvalidArgument(
          "Only array and token return values from Python callbacks are "
          "supported, got %s",
          result_shapes[i].ToString());
    }
  }

  auto callback = std::make_unique<CpuCallback>(
      std::move(callable), callback_args, callback_results);
  uint64_t descriptor = absl::bit_cast<std::uint64_t>(callback.get());

  py::capsule callback_capsule(callback.release(), [](void* ptr) {
    delete reinterpret_cast<CpuCallback*>(ptr);
  });
  return std::make_pair(descriptor, py::object(std::move(callback_capsule)));
}

StatusOr<XlaOp> PyClient::EmitPythonCallbackFromDescriptor(
    XlaBuilder& builder, uint64_t descriptor, absl::Span<XlaOp const> operands,
    absl::Span<Shape const> result_shapes,
    absl::optional<std::vector<Shape>> operand_layouts, bool has_side_effect) {
  std::vector<Shape> custom_call_arg_layouts(operands.size() + 1);
  custom_call_arg_layouts[0] =
      ShapeUtil::MakeShapeWithDescendingLayout(U64, {});
  std::vector<XlaOp> custom_call_args(operands.size() + 1);
  custom_call_args[0] = ConstantR0<std::uint64_t>(&builder, descriptor);
  absl::c_copy(operands, custom_call_args.begin() + 1);

  if (operand_layouts && operand_layouts->size() != operands.size()) {
    return InvalidArgument(
        "Mismatched number of operands (%d) and operand_layouts (%d)",
        operands.size(), operand_layouts->size());
  }

  for (int i = 0; i < operands.size(); ++i) {
    TF_ASSIGN_OR_RETURN(Shape shape, builder.GetShape(operands[i]));
    Shape layout = LayoutUtil::GetWithDefaultLayout(shape);
    if (shape.IsArray() && operand_layouts) {
      if (!(*operand_layouts)[i].has_layout()) {
        return InvalidArgument(
            "operand_layout shapes for callback must have "
            "layouts, got %s",
            (*operand_layouts)[i].ToString(/*print_layout=*/true));
      }
      if (!ShapeUtil::Compatible(shape, (*operand_layouts)[i])) {
        return InvalidArgument(
            "Incompatible shapes for Python callback argument %d: %s vs %s", i,
            shape.ToString(),
            (*operand_layouts)[i].ToString(/*print_layout=*/true));
      }
      layout = (*operand_layouts)[i];
    }
    custom_call_arg_layouts[i + 1] = layout;
  }

  std::vector<Shape> result_shapes_with_layout(result_shapes.size());
  for (int i = 0; i < result_shapes.size(); ++i) {
    if (result_shapes[i].IsArray()) {
      result_shapes_with_layout[i] =
          result_shapes[i].has_layout()
              ? result_shapes[i]
              : LayoutUtil::GetWithDefaultLayout(result_shapes[i]);
    } else if (result_shapes[i].IsToken()) {
      result_shapes_with_layout[i] = result_shapes[i];
    } else {
      return InvalidArgument(
          "Only array and token return values from Python callbacks are "
          "supported, got %s",
          result_shapes[i].ToString());
    }
  }
  custom_call_args[0] = ConstantR0<std::uint64_t>(&builder, descriptor);
  Shape result_shape = ShapeUtil::MakeTupleShape(result_shapes_with_layout);
  XlaOp result = CustomCallWithLayout(
      &builder, "xla_python_cpu_callback", custom_call_args, result_shape,
      custom_call_arg_layouts,
      /*opaque=*/"", has_side_effect,
      /*output_operand_aliasing=*/{},
      /*literal=*/nullptr,
      /*schedule=*/xla::CustomCallSchedule::SCHEDULE_NONE,
      /*api_version=*/API_VERSION_STATUS_RETURNING);
  return result;
}

StatusOr<std::pair<XlaOp, pybind11::object>> PyClient::EmitPythonCallback(
    pybind11::function callable, XlaBuilder& builder,
    absl::Span<XlaOp const> operands, absl::Span<Shape const> result_shapes,
    absl::optional<std::vector<Shape>> operand_layouts, bool has_side_effect) {
  std::vector<Shape> operand_shapes(operands.size());
  for (int i = 0; i < operands.size(); ++i) {
    TF_ASSIGN_OR_RETURN(Shape shape, builder.GetShape(operands[i]));
    operand_shapes[i] =
        (operand_layouts ? (*operand_layouts)[i]
                         : LayoutUtil::GetWithDefaultLayout(shape));
  }
  StatusOr<std::pair<uint64_t, pybind11::object>> result_sor =
      GetEmitPythonCallbackDescriptor(callable, operand_shapes, result_shapes);
  TF_ASSIGN_OR_RETURN(auto result, result_sor);
  uint64_t descriptor = result.first;
  pybind11::object keepalive = result.second;
  TF_ASSIGN_OR_RETURN(XlaOp callback_op,
                      EmitPythonCallbackFromDescriptor(
                          builder, descriptor, operands, result_shapes,
                          operand_shapes, has_side_effect));
  return std::make_pair(callback_op, keepalive);
}

}  // namespace xla


The world is witnessing high growth of active FM channels, and the methods adopted to propagate in the FM band demand adequate antenna height for good coverage. So it follows that the costliest part of an FM installation is its transmitting tower.
To efficiently use tower "real estate," a broadband antenna and single feedline can be used to serve multiple FM stations. To accomplish this signal mixing, the broadcast industry uses combiners of various types.
In addition to the obvious cost savings, regulatory requirements in some countries make it compulsory to reduce the number of broadcasting sites. In India, for example, to maintain the same effective radiated power coverage for all operating channels, it is mandatory for FM operators to run their services from the same location. This necessitates combining RF signals so a single antenna and feed line serve all the FM channels. This approach has proven effective, not only using tower "real estate" economically but spreading tower costs over many users.
Though combining technology is not new — it has been used since the 1950s — in the last few decades its uses have become widespread. These days, FM combiners are an integral and crucial part of many FM broadcast setups.
Transmitting several frequencies from a single broadband antenna system requires the use of a combiner, which is composed of frequency-selecting components such as filters, stretch lines with nodes and connecting elements like directional couplers.
When more than one signal is broadcast over a single antenna, the signals may backfeed into each other's transmitters, where spurious intermodulation products or "spurs" may be generated within the final amplifier stages of the transmitters. These spurs will then be broadcast, causing interference to other FM stations, and so to other bands. Therefore, the signals must be combined in such a way that no chance exists for the signals to feed back into each other's transmitter. The closer the spacing of the frequencies between transmitters, the more filtering is required to attain the isolation. The farther the spacing, the less filtering is required.
At present, two major topologies are being used. The simpler one is known as starpoint and other is constant impedance combiner, also known as balanced combiner.
Fig. 1: A simple starpoint combiner.
Starpoint combiners consist of N number of band pass filters to combine N number of channels. Each bandpass filter is tuned to the respective channel frequency. As shown in Fig. 1, output of all the filters are connected to a common star point. Here, the isolation is limited up to the rejection of the filter, which rejects all frequencies falling outside the passband. The length of the connecting cables between filters and the star point is selected appropriately to provide very high impedance to other frequencies coming from other branches. This ensures the power only flows towards the antenna from each filter.
In this arrangement, it is very difficult to combine more than four channels because adjusting the lengths of interconnecting cables becomes more complex and impractical with the increase in channels.
These combiners are popular for combining two FM channels. They are inexpensive and don`t require huge space, but the downside is that these do not offer same level of performance as balanced impedance combiners. Fig. 2 shows a two-station combiner used by All India Radio.
A 3 dB hybrid coupler is a broadband device that is an element in more complex combiners. Fig. 3 shows a conceptual overview of the hybrid coupler.
When the signal appears at Port 1, it will come out 3 dB lower at the two output ports, with the signal at one output port lagging the other output by 90 degrees. The fourth port will have isolation typically in excess of 30 dB from the input.
The hybrid coupler can also be used to combine signals; when two signals of equal amplitude and 90-degree phase shift appear at adjacent ports, they will be combined and appear at the output port. The fourth port should receive very little energy, with typical isolation in excess of 30 dB.
The balanced combiner is based on a 3 dB hybrid ring. Each leg of the ring contains identical set of either band-pass or band-reject filters. Both the filters are tuned to have closely identical curves.
In each module, one input is narrowband (NB), corresponding to the resonant frequency of the filter. The other input is wideband (WB), which may be at any frequency outside the reject-band or pass-band of the filter and corresponding to the operating range of the 3 dB hybrid coupler.
The greatest benefit of using the balanced combiner is the extra isolation provided through 3 dB hybrid couplers. It also allows easy extension of existing combiners by adding new modules. These combiners are physically larger compared to starpoint combiners.
A notch filter balanced combiner builds on the 3 dB hybrid coupler and balanced combiner by adding two notch filters tuned to reject NB frequencies. Fig. 4 shows the conceptual signal flow through the combiner. The signal fed to NB input (Port 1) is split into two by a 3 dB hybrid coupler, reflected by notch filters, and then exits from Port 2. The WB signal entering at Port 3 is also split by a hybrid coupler, passed through notch filters with minimum loss and combines at Port 2.
The isolation of WB channel from NB frequency is the sum of isolation provided by the 3 dB hybrid coupler and notch filter. However, the isolation of NB frequency from WB frequency is only as good as the coupler, so additional notch filters tuned to the wideband frequency are used at the NB input to ensure that no spurious signals are generated in transmitter connected to Port 1 (NB).
A notch filter balanced combiner has some limitations: If the two filters within any module are not identically tuned, an imbalance will occur that reduces the isolation and a spurious signal can be generated within a transmitter. And once a spur has been generated, there are no filters within the system to reject that spur, since the filters are tuned only to the designated frequencies.
In other words, notch filters are supposed to reject the NB frequency only and all other frequencies including spur from WB port will be passed.
Another disadvantage of using notch filters is that since each module in turn has to conduct the accumulated power of all the previous modules, so each module must be larger than the previous one. This requires high-power handling capacity of notch filters and consequent increase in size of these filters.
The band-pass filter is the heart of the band-pass filter combiner that I'll discuss in a moment. The band-pass filter is composed of two or more cavity filters connected together. These filters look like metal tanks with coaxial cables attached. These form a tuned circuit consisting of a cavity with one or more loops, or probes, connected to the coaxial cable. Energy is inductively coupled by input and output coupling loops. Fig. 5 shows a simplified band-pass filter.
The cavity may be circular or rectangular. When the cavity is excited by the desired RF frequency, a tuning rod system or probe is adjusted to tune the cavity to resonance. Maximum energy is transferred at the resonant frequency. By adjusting the length of the rod, resonant frequency of the filter can be adjusted. The mechanism of a cavity resonator can be compared to a resonant inductor-capacitor (LC) circuit using small values of inductive and capacitive reactance with the internal surfaces of the cavity acting as the LC components.
Fig. 6: Adding cavities can improve frequency response, but at a cost.Fig. 7: As more cavities are added, group delay increases. Normally each filter consists of one or more identical cavities to achieve the target parameters. Adding cavities or resonators improve frequency response, which in turn increases isolation in close spaced frequencies. However, it also increases group delay (that is, the time delay of the signals), physical size, and cost of the complete filter. Fig. 6 shows the effect on frequency response when adding cavities, and Fig. 7 shows the increase in group delay when adding cavities.
The curve of frequency response becomes squarer — flatter across the pass band, with a sharper roll-off approaching towards ideal characteristic as we keep on increasing the cavities. For most applications, three-cavity band-pass filters are the optimum choice. Two-cavity filters can be used where the frequencies of interest are far enough apart to provide sufficient isolation.
Fig. 8: A band-pass filter balanced combiner.
Fig. 9: Connecting the modules to make a practical combiner. The performance of a filter is measured in terms of frequency response, insertion loss, return loss (voltage standing wave ratio, VSWR) and group delay, all of which are expressed as a function of frequency. While none of the individual parameter is optimized in and of itself, the overall performance of the filter is measured and optimized.
In this type of combiner, the feed from the Narrowband (NB) signal input is split by the input 3 dB hybrid coupler, and both signals pass through the band-pass filters to the output 3 dB coupler, then added in equal phase at output port. Fig. 8 shows the conceptual signal flow. The wideband signal applied at Port 3 is split by the output 3 dB hybrid, reflected back completely by band-pass filters, and combined at the output port.
The narrowband input is isolated from the wideband input by the 3 dB coupler. But additional isolation is provided due to the stop band attenuation of band-pass filters. However the isolation of WB signal from the NB signal is only as good as that of the 3 dB coupler.
Fig. 9 shows how we connect each filter module to make a practical combiner. By feeding the output of each module to the broadband input of next module, we can expand combiner and increase channels. The number of channels possible in a given frequency band is limited by the minimum spacing between the signals and insertion loss, which may pose practical difficulty; insertion loss increases each time the signal passes through a module. Also for consideration is the power rating of the 3 dB couplers' output.
Fig. 10: The four-station combiner at Vadodara, India, serves Radio City (91.1), Big FM (92.7), Red FM (93.5) and Radio Mirchi (98.3). Fig. 10 shows a four-station combiner in Vadodara, India; note each transmitter's output on the right side feeding its respective combiner module, and each module's output on the left is "daisy-chained" to the successive module. The four stations' frequencies are 91.1 MHz, 92.7 MHz, 93.5 MHz and 98.3 MHz.
In today's world, the combiner has become the crucial part of broadcasting chain. It is important that one be aware of its technicalities and complexities. Depending upon the merits and drawbacks of a combiner, it needs to be selected for the specific application by the system designer. A properly installed and correctly tuned combiner will pass your signals to distant listeners, whereas an un-well combiner may lead to reflections, resulting in the ill health of transmitters.
In India, especially with more cities petitioning for new FM stations, the use of a combiner has become inevitable; once our auction for the third phase of FM frequency allocation takes place, the importance of the combiner will increase rapidly.
With the Telecom Regulatory Authority of India recommendations for 400 kHz channel spacing, the number of available FM channels is likely to increase. Accordingly, the required performance specifications for combiners will be more stringent.


The best of Chinese cuisine is served in regal settings that make you feel really important. Dining here enlightens you in the Chinese zodiac and astronomy for that is the basic theme of the décor.
Contrary to expectations there is a lack of ethnicity in the décor, and instead you have a contemporary feel to the place that is in keeping with the fuss free cuisine. Come, taste and succumb to the pleasures of barely tangible sauces and herbs. The staff dressed in traditional garb adds authenticity to the place, and gives you a feel of the real Japan.
Here is your chance to partake of local cuisine seated amid typical Thai settings. You'll be enamoured by the absolute charm of the whole experience as you tuck into a variety of succulent dishes straight from the royal menu.
This is the coffee shop where they have buffet lunch and dinner for the hungry who just can't wait. For the less famished they have a wonderful a la carte menu with amazing choices.
Just sink into that deep sofa, and try not to spill that chilled beverage as you snuggle in comfort and let lethargy overtake. Give your aching feet a break and enjoy the décor, the cocktails, the short eats, and of course, the company.
This is where the action is and where you should be to enjoy some good wine, music, great food, and even try some karaoke.
Enjoy the fluffy pastries and magical cakes along with a cappuccino or a pot of fragrant herbal tea. It's places like these that remind you that you're indeed on vacation.
Get a traditional Thai massage and feel the suppleness return to your muscles. They have various packages for all parts of the body, from fragrant facials, body packs, and foot massages. Spend some time in the Sauna later on to complete the package.
The Miracle Grand fitness centre boasts of state of the art equipment that will have you fit and ready to kick�whatever you want to kick�in no time. Don't let your vacation get the better of your waistline.
A large outdoor swimming pool in keeping with the lavishness you have now come to expect of the Miracle Grand is a great place to relax and laze about.
The business centre at the Miracle Grand adequately outfitted with computers, internet, and fax machines come to your rescue in case of emergencies at work. On the other hand if you're here on business, you'll be able to just pick up where you left off and continue uninterrupted.


text:
The Municipality of North Cowichan wants the province to consider making the management of forestry a regional affair. Pictured are people who attended a recent rally in front of North Cowichan's municipal hall urging for more public input into the management of the municipality's municipal forest reserve. (File photo)
North Cowichan council suggests local control of forestry
Letter to be sent to UBCM
Robert Barron
North Cowichan wants the province to explore the feasibility of adopting a new model of regionally based forest management in B.C.
At its meeting on June 19, council decided to send a letter to the Union of B.C. Municipalities asking for its consideration of taking up the issue with the province at its next meeting.
Council will also ask in the letter for UBCM delegates to consider asking the province for the creation of a Forest Charter that includes an overall vision, sustainability principles, and standards and goals for the province's forests; and have a Forester General appointed by the province to serve as a new independent officer who would work with the regions on local land-planning processes.
Coun. Rosalie Sawrie said she'd be proud to support the motion to send the letter.
"I think we've learned in this municipality just how passionate people are about forestry," she said.
"I think people will want to have a say in forest practices."
The decision to send the letter came after Coun. Rob Douglas brought the issue up as a notice of motion at the previous council meeting.
RELATED STORY: NORTH COWICHAN COUNCILLOR WANTS MORE REGIONAL CONTROL OF B.C.'S FORESTS
Douglas argued that the moves are needed due to the fact that the forest industry in B.C. has been on a steady decline in recent decades, with regular mill closures, thousands of jobs lost, and once thriving forestry communities experiencing severe economic decline.
He said many communities across B.C. have demonstrated that when local people are empowered to manage their forests, there are significant social, economic and environmental benefits.
RELATED STORY: DEMONSTRATORS GATHER TO DEMAND A VOICE ON NORTH COWICHAN MUNICIPAL RESERVE
Mayor Al Siebring said he was opposed to the motion.
He said one has only to look at all the issues the municipality is facing with the management of its own municipal forest reserve to see how much time and energy it has taken from both staff and council just to manage a forest in which only about 20,000 cubic metres of wood is usually harvested a year.
He said the Chemainus mill processes that amount of wood in less than a week.
"There's also different attitudes about resources in different parts of the province, so we could end up with a patchwork of regulations all over B.C. I do like the idea of a forest charter though," Siebring said.
The motion to send the letter passed, with Siebring and Coun. Tek Manhas opposed.
robert.barron@cowichanvalleycitizen.com
Cowichan business notes: Motorsport Circuit steps up to support dancers
Lake Cowichan celebrates Pride Month with rainbow crosswalks at schools

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: '}' expected near '=' Program I am making a HTTP call.
local headers_value = { Content-Type = "multipart/form-data",
                        Accept = "application/json",
                        Authorization = "Basic ccccc==" }

The error I am getting is (Line 3 is the above code)

Program starting as
  '"C:\Users\idoladmin\Downloads\ZeroBraneStudio\bin\lua53_win64\lua53.exe"
  -e "io.stdout:setvbuf('no')" "C:\Code\Lua\send_calltoCM.lua"'. Program 'lua53.exe' started in 'C:\Code\Lua' (pid: 3452).
  C:\Users\idoladmin\Downloads\ZeroBraneStudio\bin\lua53_win64\lua53.exe:
  C:\Code\Lua\send_calltoCM.lua:3: '}' expected near '=' Program
  completed in 0.05 seconds (pid: 3452).

What am I missing?

A: As mentioned in comments, you can't use Content-Type directly in a table constructor because it's not an identifier.
You can use the [] syntax, like this:
local headers_value = { ['Content-Type'] = "multipart/form-data",
                        Accept = "application/json",
                        Authorization = "Basic ccccc==" }

The use of an identifier such as Accept is syntactic sugar for ['Accept'], just as headers_value.Accept is syntactic sugar for headers_value['Accept'].

redpajama_set_name: RedPajamaStackExchange


Investigation of the feasibility of relative 3D dosimetry in the Radiologic Physics Center Head and Neck IMRT phantom using presage/optical-CT.
This study presents the application of the Presage/optical-CT 3D dosimetry system for relative dosimetry in the Radiologic Physics Center (RPC) Head and Neck (H&N) IMRT phantom. Performance of the system was evaluated by comparison with the "gold-standard" RPC credentialing test. A modified Presage cylindrical insert was created that extended the capability of the RPC H&N phantom to 3D dosimetry. The RPC phantom was taken through the entire treatment planning procedure with both the standard RPC insert and the modified Presage insert. An IMRT plan was created to match the desired dose constraints of the credentialing test. This plan was delivered twice to the RPC phantom: first containing the standard insert, and then again containing the Presage insert. After irradiation, the standard insert was sent for routine credentialing analysis; including point dose measurements (TLD) and planar Gafchromic EBT film measurement. The 3D dose distribution from Presage was read out at Duke using the OCTOPUS 5X optical-CT scanner. The Presage distribution was compared with gold-standard EBT measurement (determined by the RPC) and the calculated Eclipse distribution. The agreement between the normalized EBT, Presage, and Eclipse distributions, in the central axial plane was evaluated using profiles and gamma-map comparisons (4% dose difference and 3 mm distance to agreement). Profiles showed good agreement between EBT, Presage, and Eclipse distributions. 2D gamma-map comparisons between all three modalities showed at least 98% pass rate. The excellent agreement between Presage and EBT in the central plane established Presage as a standard against which to evaluate the accuracy of the 3D calculated Eclipse distribution. A gamma comparison between normalized Presage and Eclipse 3D distributions gave an overall pass rate of approximately 94%. In conclusion, the Presage/optical-CT system was found to be feasible for relative 3D dosimetry in the RPC IMRT H&N phantom. The potential to extend the RPC IMRT credentialing procedure to 3D may be feasible provided accurate calibration to dose (Gy) and robustness to shipping stress are demonstrated.


Asking your partner to marry you is one thing, but surprising your friends and family with news of your upcoming nuptials is another. For a subtle way to announce your engagement, try showcasing your diamond by holding a champagne glass or pointing to something in the distance and waiting for someone to notice. Have fun!
Subtly reaching for an every-day item is one way to show your ring. It can be anything, like your phone or something tasty like a Donut.
Be as subtle as you want. If you want to capture your hand holding a coffee cup with the ring just off-centre, do it!
A simple shot of you and your partner holding hands can be a gorgeous way to show your unity.
Whether it's a kiss with your hand on their face or toasting with champagne glasses, be sure to have fun getting creative.
A smiley selfie with your hand resting on your face is an elegant and subtle way of sharing the big news.


text:
Edition: AUS
Three key tips for innovating products and processes
Posted on 24 Apr 2019 by Maddy White
How do you innovate products and processes in a sector that has, at its core, remained unchanged for centuries? One cheesemaker provides the perfect recipe to follow.
One of the world's oldest, most popular cheeses originates from the small village of Cheddar in Somerset and has been produced there since the 12th century.
Barber's is the world's oldest cheddar maker – image courtesy of Alex Steele Perkins.
Technology has aided cheesemaking, making the process more precise and consistent, but, at its heart it hasn't changed in decades. So, how does an industry like cheesemaking innovate?
Do you create a new type, do you try to entice markets that do not traditionally consume cheese, or do you, because of the high amount of waste (in the form of whey) created in the cheesemaking process, turn that into something else to sell? Or do you attempt all three?
To answer these questions, we visited Barber's, the world's oldest cheddar maker who produce more than 80 tonnes of cheese a day.
"The British market is more mature than many, but cheese is still a growth sector in the UK, certainly it is not on our agenda to be static," says director at AG & RG Barber, Giles Barber.
Tip 1: Grow a global presence
The UK's market for hard cheese is growing but it is saturated, and other countries like China and Japan are adapting to the idea of cheese.
Barber's, which is situated in the rural village of Ditcheat, has trebled both the size of its turnover and output since 2000. The last five years has seen a significant part of that growth, with the business now exporting to more than 30 countries.
We visited the innovative cheesemaker earlier this year – image courtesy of Alex Steele Perkins.
"Our exports, just over a decade ago, were point something of a percent of our sales, but now it is getting close to 20%," Barber says.
"The biggest markets for cheese tend to be English speaking, or cultures that have similar tastes for hard cheese.
"Our biggest export market is the US, then Australia and Canada, but also a fair amount goes to the Far East to China, Taiwan, South Korea, we have exported there for four or five years now.
"We have a good foothold in those markets for when growth really picks up, part of it is dietary and people getting used to the concept of cheese, and part of it is the retailers in those countries adopting these products."
Tip 2: Switch up your products
"There are exciting opportunities within the growth of the British cheese market, there are sectors that are growing more rapidly like goat, halloumi, continental," says Giles Barber.
"We have a process of looking at innovating cheeses, the challenge is finding the higher growth sectors of cheese and exploiting them." One example of innovating current products is the addition of fruit within cheese, using dried cranberries or apricots in Wensleydale has gained favour in recent years.
Ford Farm in Dorset is also part of the Barber group and was acquired as the business's second site in 2010, Barber explains innovation is about having the flexibility to try new things, even if they don't work out.
"We are looking at innovation in goat's cheese, as the market, and our position in it, grows. We might develop our products in Dorset, as it is a lower volume site, and then we make the cheeses here in higher volumes."
Tip 3: Optimise by-products where possible
The team at Barber's uses the entire milk fraction, the curds, whey and water. This is providing new revenue streams and utilising the factory's current resources.
Barber's uses the entire milk fraction – image courtesy of Alex Steele Perkins.
"Cheesemaking is the core of the business, all of the milk goes into that process, but about 85% of the milk is removed in the form of whey," says Barber.
"We separate any residual butterfat from the whey, which goes into making farmhouse butter. We then take the liquid and process the whey protein through a sophisticated membrane and concentrate it to the right level to be used in infant formula products."
The whey protein is then exported outside of the UK to infant formula factories in the Philippines, Thailand and Australia.
"The last part of the process is to separate the lactose. We separate this into a concentrated serum that then goes to either be fermented and distilled to make vodka, or sold to anaerobic digestion plants for energy creation."
The final by-product created is water, which is used to wash down and clean the cheesemaking areas. Once that has been done, the water is then piped a few miles underground to a purification plant where it is cleaned to a standard that allows the firm to put it back into the water system.
"It is often cleaner than the river it goes into, so it is improving the river water quality," Barber says.
Barber's: Inside the world's oldest cheddar cheese maker
From IT to dairy free, meet the leaders of 'free from' chocolate
Cheese into vodka! The benefits of a circular economy
First Ireland Spirits: The smoothest blend


text:
Wanted: State Leaders Who Care About Special-Needs Kids
Diane Morris
I have two sons with autism. There are few non-family members more important in their world than their special-education teachers. When school starts next week, both boys will go to the same self-contained autism classroom with one wonderful teacher – dedicated, experienced, and determined to figure out what works for her students. My older son had her last year, and I think he's a little in love with her. So am I.
I admire her patience and problem-solving skills. It takes a uniquely caring person to dedicate one's life to working in special education. (The IEP meetings alone would drive me over the edge.)
That could be one reason why Wake Country– North Carolina's largest school district with the largest special-education population– >>is having trouble finding special-education teachers.
… Or it could be the screwy way that the state funds special education.
The General Assembly and Governor McCrory have cut funding for teachers and teachers' assistants and increased class sizes. The >>NC Budget & Tax Center did an analysis of the new state budget and found it falls $117 million short of what is needed just to maintain—never mind improve— our education system. There have been >>numerous reports about teachers leaving the profession because >>they can't support their families on the new salary.
But special-education teachers face additional challenges. Funding for the education of exceptional children (aka EC funding) has long been inadequate. For example, North Carolina provides a monetary allotment to each school district for every exceptional child. The amount remains the same regardless of the child's needs; a district gets the same funding for a dyslexic student who sees a reading tutor once a week as it does for an autistic student who requires speech therapy, occupational therapy, and a small classroom with specially trained staff. That allotment, $3,743 last year, amounts to >>less than half the funding that experts recommend.
But this is old news. A few years ago, the state paid a lot of money to >>a consulting firm to look at its school funding system. The consultants recommended a tiered funding system for exceptional children to ensure that schools had the funds needed to provide services to these students. The legislature ignored the study.
Then there's this head-slapper: the state caps EC funding as a percentage of a district's population. A district can only get EC money for 12.5% of its students. If you take a look at >>Wake County's budget from last year (page 15), you'll see that Wake County's special education population regularly exceeds that percentage. In 2011-12, Wake County schools had 19,572 EC students – 13.3% of the district's population. Because of the cap, Wake County had to provide services for more than 1,200 EC students without any additional funding from the state.
It's even worse in other counties. >>According to the NC Department of Public Instruction's Statistical Profile database, Robeson County schools had 4,038 EC students in 2011-12— a number which amounts to 17% of the district's average daily membership. That means Robeson served more than a thousand EC students without state funding. That's a huge funding gap for a county with already dismally low resources.
Children with special needs are among the most vulnerable in our state. I know from experience that the teachers and teachers' assistants make all the difference. But in order to provide these students with their best chance at an independent and fulfilling life, the funding has to be there.
Featured in Home Middle RightFeatured-in-Home-BottomLGBTQIA
special education teachers
Insure Yourself! A Plethora of Health Plans
The Dream of NC's Immigrant Youth: In-State Tuition
There is 1 comment
Jacqui Hawkins on 21 August, 2013 at 08:41
I'm with you. As a parent, an advocate and a surrogate parent for kids in the foster care system, I can't bear to see what NC has done to education, but more importantly to kids receiving EC services. I have met only teachers and assistants that have nothing but the best intentions and are dedicated wholeheartedly to their chosen profession.


text:
http://tvtropes.org/pmwiki/pmwiki.php/Fanfic/HitList
Fanfic / Hit List
Hit List , by zestycrouton , is a Legend of Zelda High School A.U. which ends up being a good bit more... intense than the teenage drama one might expect.
The day is going pretty average for Link Hero and his little sister Aryll. Both are bored stiff at school, although Link has just run into (literally) a rather pretty New Transfer Student named Zelda Nohansen. Unfortunately, things take a turn as several bombs go off, blocking off the school exits, and a bunch of masked goons with guns take over. Run by a delinquent named Ganondorf, this group wants national attention and aren't above shooting a few hostages if that's what it takes to get it.
Link, Zelda, and their other friends aren't about to take this lying down. What follows are their attempts to save everyone they can and make it out of the school alive themselves. Oh, and also deal with some past-life stuff going on.
There is a completed sequel, From the Dust . Taking place one year after the first fic, it follows Link and his surviving classmates and teachers as they try to raise morale by taking a field trip to town for a special museum exhibit about Hyrule's history. Things go wrong very quickly as arrests are made, disappearances begin, and a rather familiar mask goes missing.
This Fan Fic contains examples of:
Action Survivor: Just about anyone who made it through the first fic counts.
Linebeck's cowardice gets justified in this setting with him being a war veteran. Phantom Hourglass players suddenly felt bad for not thinking much of him.
Abhorrent Admirer: The sequel brings Groose for Zelda and Marin for Link, while Ralph goes from Zelda to Aryll.
Adult Fear: If the entire student body and staff of a high school being taken hostage by psychos doesn't count, the fact that none of those psychos has issues with killing ought to. The teachers can't do anything to protect the students, the police can't get inside with risking a lot of lives (and the police chief's son is one of the hostages!), and it's revealed that a few of the shooters weren't evil. They were forced into their roles through loneliness, despair, or, in the case of Colin, to try to protect someone they loved.
In the sequel, students and teachers start vanishing left and right, sometimes while other people are right there and just not paying attention. Anju utterly freaks out when Kafei disappears, but can't do much because he's legally an adult and thus can't be declared a missing person yet (he was magically turned into a child and, when he's found that way, naked, by Tingle, he was terrified he'd just been caught by a pedophile). One subplot involves orphans being kidnapped and the one Zelda finds is sobbing her eyes out over being shut in a small area and left alone. Oh, and Link is framed and arrested for a crime he didn't commit.
Air-Vent Passageway: In the first story how Link, Shad, and Ashei move around to avoid the shooters. Subverted as the air vent eventually gives out under them.
All for Nothing: Two people were involved with Ganondorf's attack for different reasons than because Ganondorf was nice to them.
Colin sold out his fellow students because Ganondorf promised to let Aryll live if he did. Except Ganondorf lied to him as Aryll was connected to Link, and thus her death would hurt him, which mattered more to him than a meaningless promise that got him what he wanted.
Ganondorf offered to foot the bill for Impa's recovery in return for Sheik doing "a few things" (Sheik never says on-screen what he was asked to do, but it may have come up in his interrogation at the end) but then Impa dies before Ganondorf can make good on his word.
Baleful Polymorph: To help Link escape police custody, a mysterious "ally" turns him into a wolf, but fails to give him any way to turn back. Kafei is also briefly turned into an anthromorph Keaton.
Because Destiny Says So: Subverted. Link thinks that his bloodline was destined to carry the Triforce of Courage, but Farore tells him that it's not. The various Links keep wielding it because they all just happen to exemplify courage to such a degree that it comes to them.
Because You Were Nice to Me: Many of Ganondorf's minions in the first fic joined him because he reached his hand out to them when the other students and their cliques did not. Link calls out the latter on this during his speech in the finale.
Big Brother Instinct: While Link wants to help as many people as possible, saving Aryll is his main goal. He won't even consider leaving the school until he knows she's out.
Body Horror: Considering how the mask transformations in Majora's Mask went, it shouldn't be a surprise that Groose using the Giant's Mask was very unpleasant to witness.
Boomerang Bigot: In the sequel, it's revealed that Sheik has a lot of hatred for the Sheikah. This is lampshaded by Midna and most of the trials he face are designed to have him face this prejudice and overcome it.
Chronic Hero Syndrome: Link, natch. When he meets Farore in a dream/vision near the end, it turns out this pretty much defines him and his bloodline, since he and his ancestors wielded the Triforce of Courage because none of them would stand down and leave people in danger.
Clap Your Hands If You Believe: How magic works, at least in Termina.
Creepy Good: The Happy Mask Salesman in the sequel. He's just as unnerving as in the games and has some strange connection to the museum curator, but his appearances thus far have been visiting the characters in their pocket dimensions and giving them helpful items and advice.
The finale of the sequel reveals that they're actually one and the same.
Dark Is Not Evil: In the sequel, learning this is the key to Sheik connecting to his Sheikah birthright.
Deadpan Snarker: Quite a few characters, but Midna stands out, particularly since she spends most of the first fic forced to work alongside Linebeck and the second fic stuck with Groose.
Decomposite Character: Sheik and Zelda aren't the same person in this fic. Instead, Sheik is Impa's son, who joined up with Ganondorf when he offered to foot the bill for her treatment in the first fic, and takes over for her as Sage Of Shadow in the sequel after she dies.
"Die Hard" on an X: The first fic's basic premise is "Die Hard in a high school" with Zelda AU characters thrown in for good measure.
Dude Looks Like a Lady: Kafei has "girly hair" which he can use to cover his face. This lets him pose as a woman so he can stay in the same room as Anju when they're held hostage.
Freudian Slip: Happens when Groose tries to convince a carnival worker to go on a date with someone and Midna loses her temper:
"Do you want to be single all your life?!" Midna exploded, patience very nearly at the breaking point.
Mack looked startled, and then surprisingly ashamed.
"…No, mom- I mean, ma'am."
Get Ahold Of Yourself Man: How Midna gets Groose out of his Heroic BSoD, along with an Armor-Piercing Slap.
Gone Horribly Right: Groose's plan to bomb the moon works, but at the cost of moon chunks falling to earth and making it worse.
Great Big Book of Everything: Subverted with the Book of Mudora. It's a large tome full of all kinds of interesting information, but most of it's not very helpful to Midna or Groose. As it turns out, the only thing they need from it is the knowledge that magic runs on belief.
The Heavy: Dark Link, introduced in the Sequel Hook of the first story, abducts the Ocarina Of Time Sages and frames Link for stealing Majora's Mask from the Museum. All to set up the Evil Plan and give Link a reason to go to the museum. Ghirahim turning him into a wolf was likely to mess with Link further, make it harder for him to complete his objective, and/or for funzies.
Heroic BSoD: Groose has one in the sequel, when his plan to destroy the moon backfires in the worst possible way for Clock Town.
Colin had one first. See My God, What Have I Done? below.
Hidden Depths: Linebeck is a coward and a braggart, so it's genuinely a surprise to see him speak completely seriously when he talks about his time serving in the war and how the idea of being in a similar situation is not one he relishes. And just like that, his cowardice is justified.
The sequel shows that Groose has this going as well. He seems to be a Jerk Jock, but his time with Midna in the Termina pocket dimension shows that he is a huge physics geek and is also very good at connecting to people and spurring them into action. He uses those skills to get the townsfolk to help him build a massive catapult to launch a bomb at the moon, although it doesn't exactly work out.
Ruto and Darunia seem to be the standard airhead cheerleader and Jerk Jock, but Darunia still begs for their guard to shoot him instead of Ruto; and Ruto, in turn, pleaded for him to spared. Later, after leading a group of hostages to safety, Darunia tells the police that Link was the real hero, since he freed them all to begin with.
How Do I Shot Web?: It takes Zelda a bit of time to get the hang of her magic.
I Did What I Had to Do: Colin didn't want to help Ganondorf, but in the end, it was the only way to guarantee Aryll's safety. Crosses with I Lied when the narrative reveals that Ganondorf had no intention of keeping his word.
Inexplicable Cultural Ties: One of the final chapters of the first story goes out of its way to reveal that My Little Pony: Friendship Is Magic exists in Modern Hyrule. For no reason other than to cement that this version of the concept is basically "What if Hyrule evolved over time into the world we live in now?"
It Sucks to Be the Chosen One: The prophetic visions Zelda gets could be helpful, but she has an unfortunate tendency to get them with no context and no hints as to how to avert the tragedies she's shown. Since magic isn't an everyday thing anymore, it also means she has trouble getting people to understand and help her without coming across as crazy. Link, meanwhile, ends up having to go against Ganondorf more or less alone (Zelda is with him, but she can't do much) and gets a knife to the stomach for his efforts. He survives, but is incredibly traumatized by the experience.
Loads and Loads of Characters: The first one has about ten main characters. Hit List as MANY main and Supporting Characters.
Love Martyr: Several comments imply that Veran was a villainous example of this for Ganondorf.
Manchild: Tingle.
Fiction As Coverup: The Heroes, the Princesses Of Destiny and the King Of Thieves are real, but the last time they went through the cycle was so long ago that it's all passed into legend and the details are in question. Link and Zelda are asked by the Three Goddesses to keep it that way to maintain Hyrule's new status quo where it is not ready to be reminded of its past.
Extra-Strength Masquerade: The first story reveals that a lot of what really happened at Ordon High is being covered up by the Three Goddesses to maintain the status quo, not to mention how many people's minds would be blown to find out it's all real. Link and Zelda's comrades are initially kept in the dark at the end of the first story, but then they get themselves involved in the sequel's events, and are thenceforth in on the secret.
Status Quo Is God / The World Is Not Ready: It's agreed by everyone fully in the know (e.g. Link, Zelda, their circle of friends, the Three Goddesses) that telling people that the Ordon High Massacre and the museum incident were just the latest in an ancient cycle, at least right now, is a Bad Idea™ to say the least.
Missing Mom: Sheik's mother died of a drug overdose not long before the first fic takes place, but given how he reacts when her ghost comes to teach him the ways of the Sheikah in the sequel, she wasn't the most attentive parent before her death.
Mood Whiplash: Groose comes up with a plan to destroy the moon, which involves launching a giant bomb from a catapult. Between the silliness of that image and the hopefulness the townsfolk feel in seeing him doing something that might save them, the scene is overall very pleasant. When the bomb actually hits the moon and causes fiery rock chunks to rain down on them, it's considerably less so.
My God, What Have I Done?: Colin suffers this for most of the first fic, as does Byrne. In the sequel, Groose has this reaction when the bomb he launches causes the moon to crush the town in flaming chunks. Midna gets both of them to the past in time, but he still worries that maybe they're going between dimensions instead of simply rewinding time, in which case he just condemned Clock Town in one timeline to a terrible fate.
Nice Guy: Colin is a complete sweetheart.
Nice Job Breaking It, Hero!: Ruto and Darunia meant well, but showing Link the news footage of his broken, bloody body falling from the principal's office window really didn't do him any favors.
O.O.C. Is Serious Business: Groose crying over possibly killing countless people in alternate dimensions is so unlike him that Midna is freaked out.
Ordinary High-School Student: If they aren't teachers, cops, ancients, or playing some other role, then they're students at Ordon High School. Including incarnations of bosses like Arrghus and minor Big Bads like Zant and Byrne, who follow Ganondorf because they're outcasts among the student body.
Past-Life Memories: Link hallucinates scenes from his previous (selves'?) fights with Ganondorf during the climax of the first story, Zelda gets up to speed during the sequel as part of her role in Majora's game, and Ganondorf paid attention to the wrong stories while in Juvie.
Perky Goth: Played with for Midna. She dresses like a goth and while she isn't really perky, she's more snarky than brooding.
Possession Implies Mastery: Zig-zagged in the sequel. The characters are given various items from the games and utilize them to various degrees of success. Some of the more straightforward items, like the Skull Hammer, are easy to work with. Linebeck has an awful time with the wind pot though, and Link has to be trained in swordwork before he's allowed to try to take the Master Sword.
Redemption Equals Death: Byrne. Midna has to spend a lot of time talking Sheik out of thinking he has to apply this trope to himself.
Related in the Adaptation: One of the initial chapters of the first story reveals that Sheik's dead mother is Impa.
The sequel reveals that Her Grace, Hylia, is a younger sister to the Three Goddesses who made the Triforce.
Rescue Romance: Jolene falls for Linebeck after he (with help from Midna and Sheik) rescue her and everyone else locked in the gym. The sequel implies that while they're still together, their relationship has shifted to No Accounting for Taste.
Ripped from the Headlines: The first fic is very clearly inspired by the Columbine shootings.
Rocks Fall, Everyone Dies: One version of Clock Town as a result of Groose's "Bomb The Moon!" plan Going Horribly Right. This results in his Heroic BSoD above.
Sequel Hook: The end of the first fic reminds everyone that Ganondorf doesn't stay dead unless he's killed with the Master Sword. This is then followed by Ganondorf coming back to life and escaping the morgue.
The sequel ends with double-layer potential set-up to one of ZC's in-progress stories, but ZC states that reading it is not required, neither is the story the third entry in Hit List.
Shell-Shocked Veteran: While sometimes Played for Laughs, it's implied that some of Linebeck's cowardly behavior comes from traumatic things he saw while fighting in a war.
Shout-Out: Oh so very, very many. The author admitted to sneaking as many into the sequel as possible, but there are also plenty in the first fic.
Single Woman Seeks Good Man: In the sequel, Aryll rebuffs Ralph's attempts to woo her because she doesn't like his braggart nature. She also refuses to reconcile with Colin because she can't get over him betraying everyone to Ganondorf for her. Despite this, it's clear that Colin is the sort of guy she really wants, because of how sweet he is. Similarly, Zelda loves Link and is completely put off by Groose, and the reverse happens between Link and Marin.
The Chew Toy: Poor Kafei, in From the Dust, can't seem to catch a break. First the Skull Kid turns him into a child and then he's thrown into the Dark Realm, which turns him into a humanoid fox. He does manage to find the Moon Pearl to turn human again, but he has yet to turn back into an adult.
The Cloud Cuckoolander Was Right: Somehow, Tingle knows about magic and can recognize Zelda as a princess and the orphans as fairies.
Ultimately, this Verse's version of Agahnim, who told Ganondorf about the Triforce and unknowingly awakened his Past-Life Memories of being the King Of Thieves.
The Magic Goes Away: Implied to be what happened with Hyrule. The nonhuman characters like Midna seem to look like regular humans and magic isn't a part of everyday life anymore. In From the Dust, as Zelda explores her Past-Life Memories, she wonders just what happened to make it all disappear the way it did.
The Magic Comes Back: After Ganondorf's awakening, which set up the first fic, a lot of things from Hyrule's ancient past are coming back, whether the world is ready for them or not.
The Not-Love Interest: Cremia, for Kafei. She's the one who was able to convince him to propose to Anju.
The Sociopath: The guy holding Aryll's class hostage seems to be this. He is completely bored and watches TV while his roomful of hostages huddles in the corner and it's noted that he sounds just as emotionless when talking about how he's going to kill one of them as he does when asking Aryll to hand over her cellphone.
Too Dumb to Live: Midna's opinion on the people of Termina, although she does later realize part of their refusal to flee is a sense of hopelessness.
Midna: "I used to think [Groose was] the stupidest person I'd ever meet. I take that back now. Every person in this village has [him] beat by a long shot."
Took a Level in Badass: While Link wasn't exactly a slouch throughout the first fic, the sequel has him learning how to actually fight with the Master Sword through sparring with the Hero's Shade.
Two-Person Love Triangle: After she and Kafei reunite with their old friend, Cremia, Anju worries that Kafei finds the more outgoing Cremia to be more attractive than her. When he disappears, she can't shake the concern that he and Cremia ran off together. Actually, Cremia had urged Kafei to propose to Anju, which he'd set off to work on.
Unexpected Character: Show of hands, folks, who expected to see Fi, Demise, and Ghirahim (sorted by how unexpected they were) turn up in the sequel?
Unwitting Instigator of Doom: Ganondorf was just your average high school asshole who got in a fight with Link and wound up in Juvie as a result. Then he meets a Cloudcuckoolander therapist named Agahnim and everything goes to hell.
Waking Up at the Morgue: Ganondorf, in the Sequel Hook of the first fic.
Waking Up Elsewhere: After nearly dying fighting Ganondorf, Link wakes up in the hospital.
What the Hell, Hero?
Aryll really lays into Colin, when she finds out he cooperated with Ganondorf to save her.
Link angrily demands to know why Farore keeps condemning him and his ancestors to carry the Triforce of Courage to put their lives on the line. She assures him that someone needs to carry it and that it goes to them based on their personal qualities, not because of destiny.
Link again in the aftermath. His speech is how he can't say a few words about the incident and how he intends to go back to his life when the school reopens, but also calling out his peers for the cliques and exclusions, citing them as what brought each participant in the attack to join up with Ganondorf (minus Colin, who was trying to protect Aryll without knowing it was futile, and Sheik, who only joined in return for Ganondorf funding Impa's recovery afterward, and was in too deep to back out when Impa died before it could pay off) in the first place. He implores them all to figure out a way to make sure the Ordon High Massacre (as it's come to be called) never happens again.
When All You Have Is a Hammer...: In the sequel, Link's friends are magically banished to pocket dimensions where they must overcome situations from the video game series. To help them, they're given various item which range from helpful (the Wind Waker, the Phantom Hourglass, the Skull Hammer, etc.) to weird and unclear in how to use them (the wind jar, the slingshot, etc.) All of the characters must figure out how to use the items to get through their trails, since they're the only tools at their disposal. Bonus points to Aryll, who gets the Skull Hammer and gleefully uses it to take out her frustrations on a group of Stalfos.
Would Harm A Child: Most of the shooters are shown having no issues with shooting their hostages.
Wouldn't Hit a Girl: Groose, although he considers having to break that particular code in self-defense when Midna gets angry with him.
"You Will Be Spared" "You Said You Would Let Them Go!" "I Lied": Colin told Ganondorf where certain students would be at the time of the attack so that he would be able to save Aryll. Unfortunately, Aryll was one of these students, because they were Link and those closest to him, and thus marked for death at his personal hand in order to hurt Link, so Ganondorf had no plans on letting a target go once he didn't need her as leverage anymore.
Heroes Of The Four Sword
FanWorks/The Legend of Zelda


text:
Logan Alexander Paul () este un actor și vlogger american. A început să dobândească faimă prin videoclipurile postate în cadrul serviciului de internet Vine, apelând de cele mai multe ori la comedia de situație și o interacțiune aprofundată cu publicul.

După aceea și-a continuat activitatea în cadrul serialelor televizate. Cele mai notabile proiecte în care a  avut apariții speciale sunt Law and Order: Special Victims Unit și Weird Loners. În industria filmului a făcut parte din proiecte precum The Thinning, o producție din cadrul YouTube Red.

Canalele sale de YouTube se numesc Logan Paul Vlogs și TheOfficialLoganPaul.

Viața timpurie
Logan Alexander Paul s-a născut la 1 aprilie 1995, în Ohio. Părinții lui sunt Gregory Allan Paul și Pam Stepnick. Are și un frate mai mic pe nume Jake. Logan a început să creeze videoclipuri pentru platforma YouTube de la vârsta de 10 ani. Canalul său se numea Zoosh.

A urmat liceul Westlake, unde, după cum s-a descris ulterior, a fost un dependent de adrenalină. A făcut parte din echipa de rugby a liceului, în cadrul căreia a avut prestații notabile. De asemenea a reușit să obțină a cincea poziție în cadrul unui turneu de wrestling statal.

Până când a fost pregătit să se înscrie la facultate, canalul său de YouTube a început să crească în popularitate. A urmat Universitatea din Ohio, înainte să renunțe în 2014 pentru a urma o carieră de entertainer în cadrul rețelelor de socializare, în Los Angeles.

Cariera

Videoclipuri în cadrul rețelelor de socializare
Logan Paul a crescut în popularitate în cadrul serviciului de partajare de videoclipuri numit Vine. În februarie 2014, avea puțin peste 1.3 milioane de urmăritori pe diferite rețele de socializare. Până în aprilie 2014 el avea 105.000 de urmăritori pe Tiwtter, 361.000 de urmăritori pe Instagram, 31.000 de aprecieri pe pagina sa de Facebook, și în jur de 150,000 de persoae urmăreau canalul său de YouTube. În 2015 a fost clasat ca a 10-a cea mai influentă persoană de pe platforma Vine,câștigând sute de mii de dolari de pe urma videoclipurilor postate și din veniturile primite din anunțuri. Până în luna a octombrie aceluiași an, doar videoclipurile sale de pe Facebook aveau mai mult de 300 de milioane de vizualizări.

Paul postează zilnic câte un vlog pe YouTube, în care răspunde de cele mai multe ori anumitor provocări. Celălalt canal de Youtube îl folosește pentru a posta filmulețe scurte.

Paul a fost implicat într-o serie de campanii de publicitate, inclusiv pentru Hanes, PepsiCo și HBO.

În februarie 2017 Dwayne "The Rock" Johnson a lansat pe propriul său canal de YouTube un video intitulat: " Logan Paul has been cut from, like, all of The Rock's movies". Un videoclip in care Dwayne Johnson vorbeste despre cum Paul a fost scos din toate filmele sale, și îl consolează prin a îl denumi "ambasadorul" urmatotului sau film "Baywatch". Logan Paul a mai colaborat cu The Rock și în alte producții precum: "Logan Paul is, like, totally terrible at falling in love with Alexandra Dadario".

Film și televiziune

La începutul anului 2015, Paul a apărut în Law & Order: Special victims Unit. de asemenea, el a apărut în  serialul de televiziune  Weird Loners, unde a jucat rolul gemenilor Paul. El a jucat în două episoade din seria Slitchers. În 2016, Paul a jucat în filmul YouTubeRed The Thinning.

Din ianuarie 2016 Paul a început să colaboreze cu The Groundings si Ypright Citizens Brigade.

Paul a scris scenariul pentru un film  adult de comedie, Airplane Mode, care a fost descris ca "American Pie pentru Gen Z", și de Paul însuși ca "Expendables swith Internet stars".

Viața personală
Logan Paul locuiește în prezent în Hollywood . In anul 2018 acesta și actrița Chloe Bennet au avut o relație.

Filmografie

Discografie

Ca artist principal

Note

Nașteri în 1995
Oameni în viață
Bloggeri americani
YouTuberi

redpajama_set_name: RedPajamaWikipedia


text:
About CFA Institute
Objectives of our executive compensation program
The compensation philosophy of CFA Institute is designed to attract, reward, and retain top-level executive talent. The compensation philosophy aligns with our mission and cultural values and further reinforces our results-driven focus through differentiated performance awards that are necessary to deliver sustained high performance.
We apply the same compensation principles for our executives as we do for the rest of our employees. These principles are:
Competitive and equitable programs that support the strategic goals of our organization;
Global consistency in the design of our compensation programs while recognizing the need to reflect local practices where necessary;
Balancing the need to attract talent from the industry, while simultaneously recognizing the not-for-profit structure of our business when designing pay practices; and
Programs that are consistent, fair, and free from discrimination.
Proxy Statements and Tax Returns
FY20 Proxy Statement (PDF)
FY18 IRS Form 990 Tax Return (PDF)
Form 990 is used by tax-exempt organizations to report their activities to the United States Internal Revenue Service (IRS) and is a required annual filing.
How We Make Executive Compensation Decisions
Role of the People and Culture Committee
We are committed to having a strong and effective corporate governance framework. The People and Culture Committee (PAC) of the CFA Institute Board of Governors provides oversight on executive pay. There are four independent governors on this committee. They are free of any relationship that would interfere with their exercise of independent judgment or have fully declared any possible conflicts and have recused themselves of decisions where appropriate. The PAC meets frequently throughout the year to discuss matters related to executive pay and to provide direction.
We refer to our President and CEO and to our managing directors as "executives." The PAC determines the compensation of our CEO, including any incentive, and the group may engage independent consultants to provide necessary compensation recommendations. The PAC also approves the compensation plan for the organization for implementation by the CEO, which includes how much we spend in aggregate on salary increases and incentives for our employees. In addition to the CEO, the Chief Compliance, Risk & Ethics Officer (CCREO) reports directly to the Board, while the Chief Legal Officer (CLO) has a dual reporting relationship with the CEO and the Board Chair. The compensation for both the CCREO and CLO is reviewed and approved by the PAC.
Successful and sustainable delivery against the mission is at the forefront of our executive compensation program. As an organization, we value the development of strong goals for our executives. We focus on selecting the right metrics to measure not only progress toward these goals but also the degree to which our executives exhibit critical leadership capabilities in how they progress towards these goals. This better enables us to assess and calibrate performance in a meaningful way. Our objective is to recognize the needs of the organization while keeping in mind both financial and strategic priorities that create value for our members. At the end of the year, the PAC considers other factors as well, such as the organization's overall performance and how much progress was made towards our strategic objectives to determine the CEO's compensation.
We review and discuss any disclosures regarding our compensation plans, policies, programs, and practices with the PAC and obtain guidance on executive employment agreements and severance arrangements.
We believe it is essential to have the right people in the right place at the right time. We review succession plans for our CEO and other executives with the PAC, and periodically with the whole Board, to ensure we are prepared for the future and have leadership continuity within our organization by recruiting and/or encouraging individual employee growth and development.
Role of the CEO
The CEO makes performance and compensation decisions for all executives, with the exception of the CCREO and CLO.
The CEO looks at each executive's contribution, individually and collectively as an executive team, and takes into consideration the successful execution of the organization's annual strategic goals and progress towards our long-term strategy. The CEO also considers individual experience, individual performance, internal and external pay equity, development and succession status, time in the position, and other individual or organizational circumstances.
At the end of the performance cycle, the CEO reviews his or her assessment of each executive's individual performance and compensation recommendations with the PAC before implementing his or her decisions.
Our CEO does not play any role with respect to any matter affecting his or her own compensation.
We retained a global management consulting firm to conduct the 2019 executive market survey. The study is conducted on an independent fee basis, and the PAC provides oversight of this study.
There are a limited number of companies that closely resemble us in size, scope, and nature of business operations. The objective is to acquire a fair and relevant view of pay practices in markets where we are most likely to recruit our executive talent. As a result, for each executive position the peer group selection differs and could span different industry sectors including not-for-profit firms, investment firms, academia and higher education, and general industry.
We evaluate the relevance of benchmarks based on similar:
size and complexity,
global scale and scope,
talent profile, and
mission-driven membership/education focus.


text:
Only 1 week left to get a $30 Lifetime License of Microsoft Office 2021 for Windows or Mac
From students to professionals, Microsoft Office has always been hailed as a one-stop-shop for everyone. The Professional Plus edition comes with a wide variety of tools for professional-level data handling, documents, presentations, and more, as well as all the standard software needed to tackle your daily computing needs.
You can forgo the subscription (with a recurring fee) and get a perpetual license for Word, Excel, PowerPoint, Outlook, Teams, OneNote, Publisher, and Access for just $30 instead. This came back to the lowest price we've ever seen, and a whopping 91% off the usual price of $349. However, this deal expires in a few days, so be sure to receive your order soon.
The offer from StackSocial is valid for: windows And the mac copy of the program.
This popular Microsoft Office lifetime license offer is still available for $30. It's available for both Mac and Windows, so make sure you get the right one for the computer you use regularly.
Now, you can always choose to use a Free online version of Microsoft Office (which has far fewer features). But compared to the Internet Microsoft 365 subscription suite Costing $10 per month or $100 per year, this downloadable version is a great deal.
While the price seems too good to be true, we tried it ourselves, and it worked like a charm. (Two big caveats: You get one key for one PC, and there's no Microsoft OneDrive Cloud Storage included.) In fact, Stack has been offering a version of this deal since the beginning of 2022. But that all-time low price won't last, so take action while you're at it. you can do it.
Previous Type Arcade has announced its launch in 2023
Next Kenneth Shepherd – Hi, I'm Kotaku's new staff writer


If you've had the same car for several years, you're probably already adept at spotting and addressing any quirks it has. An experienced driver knows when to take his or her car into the shop for a tune-up. Tune-ups are required periodically, especially when you are driving an older model of car. Tune-ups are not very expensive, but they will save you a lot of money by preventing serious auto problems from developing.
A car whose owner postpones taking it in for a tune-up could eventually experience a whole slew of avoidable problems. If your vehicle develops any of the following issues, get it to your nearest auto repair center soon.
It's a pretty glaring sign that your car has some problems when it becomes habitually challenging to start the engine. One reason why it might be so difficult to start your car's engine is that the spark plugs could be misfiring or worn out. You can address this problem by replacing them, but make sure that you have fixed the entire issue by taking your car to the mechanic for a routine tune-up.
If your vehicle stalls, it's probably not just a fluke; there is likely something causing the problem. Any number of factors can cause your vehicle to stall, most of which are preventable with regular maintenance.
It is normal to hear some noises when you drive your car, and after a while of driving the same vehicle, you will become familiar with those sounds. When you start hearing strange or new noises coming from your car, you should take it to a mechanic as soon as possible. Strange noises, such as clanking or squealing, should be addressed immediately because they could be signs of impending problems.
The brakes are considered one of the most important safety features of your car because they are capable of saving your life as long as they respond as expected. When you notice that your car's braking ability is decreasing, you need to address the issue immediately. A mechanic can identify the source of the problem and give you solutions for how to solve the issue.
When the warning light on your dashboard turns on, don't ignore it. These lights serve an important function: to warn you that something is wrong with your car. Some warning lights have easy fixes that can be diagnosed using special tools at car repair shops, but others point to a systemic problem that will need the full attention of a skilled mechanic.
After driving your car for numerous years, you should have a pretty good idea how many miles you can get out of each tank. If you notice that you are consuming more fuel than normal, it is high time that you take your car in for a tune-up. Increased fuel consumption could be indicative of several problems, which include issues with your emission system or poor wheel alignment. Unless the problem is pinpointed and corrected, you will continue to put unnecessary stress on your vehicle while wasting money on gas.
As soon as you experience any of these problems, get to an auto repair shop. Better still, have your car tuned up regularly, without having to wait for the warning signs to show up.