data structures – Given a binary min-heap, find the $k$-th element

data structures – Given a binary min-heap, find the $k$-th element – Computer Science Stack Exchange

optics – What shutter can fit a lens element with large glass?

I am building a camera using a very large front glass element for the lens (diameter is 70mm).

At first, I thought I should try to find a shutter that is 70mm in diameter as well, one that can function like older cameras (set the speed and aperture, push a lever, release shutter).

But now I wonder if I really have to use a shutter that is 70mm in diameter or larger, or if I can I use a smaller one?
I am assuming that if I use a shutter of a smaller diameter than the lens, the properties of the lens will change (for example, it will become less fast), because of the smaller aperture ring behind it?

That said, are there shutters that are 70mm in diameter?

complexity theory – Constant-time adding an element?

Is a computer with infinite memory and infinite word size a Truing machine equivalent (in the sense that polynomial time remains polynomial time and exponential time remains exponential time) if we allow constant-time linked link element insertion (at the beginning of the list)?

I doubt this because element insertion requires memory allocation and allocation is usually not a constant-time operation.

database – How to access array element?

I have the following array:
Array
(
(1) => DrupalnodeEntityNode Object
(
(in_preview) =>
(values:protected) => Array
(
(nid) => Array
(
(x-default) => 1
)
(vid) => Array
(
(x-default) => 19
)
(type) => Array
(
(x-default) => mak
)
(uuid) => Array
(
(x-default) => d3129b72-d115-458e-9a5e-28f23ce5d9a4
)
…….

How can I access nid from this?

sobolev spaces – why is completion important for the finite element method?

Can anyone explain why the Sobolev spaces based on completion are important for the finite element method?

In the lecture we discussed the Sobolev spaces $W^m(Omega)$ defined as the set of all $L^2$ functions for which all the $alpha$-derivative with $|alpha| leq m$ exists. And then we discussed the spaces $H^m$ based on completion.
We showed that they are the same. I guess I do not understand what this equality means for the FE method.

Thank you in advance!

8 – Token replacement in webform custom element (webform_score module)

I use the module webform_score for my project but the webform element RadiosQuiz doesn’t handle the tokens replacement.

enter image description here

I’d like to use tokens in title and options text. I look on the RadioQuiz.php but I don’t know how I can do this. Here is the code of the RadiosQuiz.php.

<?php

namespace Drupalwebform_scorePluginWebformElement;

use DrupalCoreConfigConfigFactoryInterface;
use DrupalCoreEntityEntityTypeManagerInterface;
use DrupalCoreRenderElementInfoManagerInterface;
use DrupalCoreSessionAccountInterface;
use DrupalCoreTypedDataTypedDataManagerInterface;
use DrupalwebformPluginWebformElementRadios;
use DrupalwebformPluginWebformElementManagerInterface;
use DrupalwebformWebformLibrariesManagerInterface;
use DrupalwebformWebformSubmissionInterface;
use DrupalwebformWebformTokenManagerInterface;
use Drupalwebform_scorePluginWebformScoreManagerInterface;
use Drupalwebform_scoreQuizInterface;
use PsrLogLoggerInterface;
use SymfonyComponentDependencyInjectionContainerInterface;

/**
 * Provides a 'radios' quiz element.
 *
 * @WebformElement(
 *   id = "webform_score_radios",
 *   label = @Translation("Radios"),
 *   description = @Translation("Provides a form element for a set of radio buttons."),
 *   category = @Translation("Quiz"),
 * )
 */
class RadiosQuiz extends Radios implements QuizInterface {

  use QuizTrait;

  /**
   * RadiosQuiz constructor.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param PsrLogLoggerInterface $logger
   *   A logger instance.
   * @param DrupalCoreConfigConfigFactoryInterface $config_factory
   *   The configuration factory.
   * @param DrupalCoreSessionAccountInterface $current_user
   *   The current user.
   * @param DrupalCoreEntityEntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param DrupalCoreRenderElementInfoManagerInterface $element_info
   *   The element info manager.
   * @param DrupalCoreTypedDataTypedDataManagerInterface $typed_data_manager
   *   Typed data manager.
   * @param DrupalwebformPluginWebformElementManagerInterface $element_manager
   *   The webform element manager.
   * @param DrupalwebformWebformTokenManagerInterface $token_manager
   *   The webform token manager.
   * @param DrupalwebformWebformLibrariesManagerInterface $libraries_manager
   *   The webform libraries manager.
   * @param Drupalwebform_scorePluginWebformScoreManagerInterface $webform_score_manager
   *   Webform score plugin manager.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, LoggerInterface $logger, ConfigFactoryInterface $config_factory, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, ElementInfoManagerInterface $element_info, TypedDataManagerInterface $typed_data_manager, WebformElementManagerInterface $element_manager, WebformTokenManagerInterface $token_manager, WebformLibrariesManagerInterface $libraries_manager, WebformScoreManagerInterface $webform_score_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $logger, $config_factory, $current_user, $entity_type_manager, $element_info, $element_manager, $token_manager, $libraries_manager);

    $this->typedDataManager = $typed_data_manager;
    $this->webformScoreManager = $webform_score_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('logger.factory')->get('webform'),
      $container->get('config.factory'),
      $container->get('current_user'),
      $container->get('entity_type.manager'),
      $container->get('plugin.manager.element_info'),
      $container->get('typed_data_manager'),
      $container->get('plugin.manager.webform.element'),
      $container->get('webform.token_manager'),
      $container->get('webform.libraries_manager'),
      $container->get('plugin.manager.webform_score')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getAnswerDataTypeId() {
    return 'string';
  }

  /**
   * {@inheritdoc}
   */
  protected function getAnswer($element, WebformSubmissionInterface $webform_submission) {
    $answer = $webform_submission->getElementData($element('#webform_key'));
    dd($answer);
    if (isset($element('#options')($answer))) {
      $answer = $element('#options')($answer);
    }
    return $this->typedDataManager->create($this->typedDataManager->createDataDefinition($this->getAnswerDataTypeId()), $answer);
  }

}

Thanks in advance for anyone who can help me.

lo.logic – Can $mathsf{RCA}_0$ prove that every nonempty c.e. set $A subseteq mathbb{N}$ has a least element?

In other words, can $mathsf{RCA}_0$ prove that for every function $fcolon mathbb{N} to mathbb{N}$, there is $b in mathbb{N}$ such that

$$ exists k in mathbb{N}, f(k) = bquad landquad forall j in mathbb{N}, f(j) geq b $$

If so, is there a reference to this result? If not, is this result known to be provable/equivalent over $mathsf{RCA}_0$ to another subsystem of SOA, and is there a reference for this?


More generally (this is more than I need, but out of interest), we could consider the principles $mathsf{L}Sigma^i_n$, $mathsf{L}Pi^i_n$, $mathsf{L}Delta^i_n$ which say that every $Sigma^i_n$ / $Pi^i_n$ / $Delta^i_n$ definable subset of $mathbb{N}$ has a least element. Where do these fall in the reverse mathematical hierarchy? Is anything known (even for $i=0$)?

views – field widget form element not updating #attributes via #ajax callback

I am trying to do a simple update to a form element in my field widget,

I have a start and a end dates in the field widget and I need the start date to be the min date of the end date,

so I call an ajax call back function to edit the $form array and return the element updated but it’s not working or updating the widget elements

can someone help me

use DrupalCoreFieldFieldItemListInterface;
use DrupalCoreFieldWidgetBase;
use DrupalCoreFormFormStateInterface;
use DrupalCoreDatetimeDrupalDateTime;
use DrupalComponentUtilityNestedArray;

/**
 * Plugin implementation of the 'work_slot_widget' widget.
 *
 * @FieldWidget(
 *   id = "work_slot_widget",
 *   module = "gag_work_slot",
 *   label = @Translation("Work slot widget"),
 *   field_types = {
 *     "work_slot_field"
 *   }
 * )
 */
class WorkSlotWidget extends WidgetBase
{

  /**
   * {@inheritdoc}
   */
  public static function defaultSettings()
  {
    return (
      'increment' => '15',
      'date_order' => 'DMY',
      'time_order' => '24',
    ) + parent::defaultSettings();
  }

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state)
  {
    $element = parent::settingsForm($form, $form_state);

    $element('date_order') = (
      '#type' => 'select',
      '#title' => t('Date part order'),
      '#default_value' => $this->getSetting('date_order'),
      '#options' => ('MDY' => t('Month/Day/Year'), 'DMY' => t('Day/Month/Year'), 'YMD' => t('Year/Month/Day')),
    );

    $element('time_order') = (
      '#type' => 'select',
      '#title' => t('Time type'),
      '#default_value' => $this->getSetting('time_order'),
      '#options' => ('24' => t('24 hour time'), '12' => t('12 hour time')),
    );

    $element('increment') = (
      '#type' => 'select',
      '#title' => t('Time increments'),
      '#default_value' => $this->getSetting('increment'),
      '#options' => (
        1 => t('1 minute'),
        5 => t('5 minute'),
        10 => t('10 minute'),
        15 => t('15 minute'),
        30 => t('30 minute'),
      ),
    );

    return $element;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsSummary()
  {
    $summary = ();
    $summary() = t('Date part order: @order', ('@order' => $this->getSetting('date_order')));
    $summary() = t('Time order: @time_order', ('@time_order' => $this->getSetting('time_order')));
    $summary() = t('Time increments: @increment', ('@increment' => $this->getSetting('increment')));
    return $summary;
  }

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
  {
    $field_name = $this->fieldDefinition->getName();
    $field_values = $form_state->getValue($field_name);
    $element('#theme_wrappers')() = 'fieldset';
    $element('work_slot_type') = (
      '#type' => 'select',
      '#title' => t('Work slot type'),
      '#description' => t('Select whether the work slot is single day or on going job'),
      '#default_value' =>  isset($field_values($delta)('work_slot_type')) ? $field_values($delta)('work_slot_type') : '',
      '#options' => (
        '' => t('Please select type of work slot'),
        'Single day' => t('Single day'),
        'On going' => t('On going job')
      ),
    );


    $date_order = $this->getSetting('date_order');
    $time_order = $this->getSetting('time_order');
    $increment = $this->getSetting('increment');
    // Set up the date part order array.
    switch ($date_order) {
      case 'YMD':
        $date_format = ('year', 'month', 'day');
        break;

      case 'MDY':
        $date_format = ('month', 'day', 'year');
        break;

      case 'DMY':
        $date_format = ('day', 'month', 'year');
        break;
    }

    switch ($time_order) {
      case '24':
        $time_format = ('hour', 'minute');
        break;

      case '12':
        $time_format =  ('hour', 'minute', 'ampm');
        break;

      case 'none':
        break;
    }
    $min_date = new DrupalDateTime('now');
    $min_date_str = $min_date->format('Y-m-d');
    $max_date = new DrupalDateTime('now');
    $max_date->modify('+1 year');
    $max_date_str =  $max_date->format('Y-m-d');
    $element('start_date') = (
      '#type' => 'date',
      '#title' => t('Start date'),
      '#date_date_format' => $date_format,
      '#date_date_element' => 'date',
      '#date_date_callbacks' => (),
      '#ajax' => (
        'callback' => ($this, 'startDateCallback'),
        'disable-refocus' => FALSE,
        'event' => 'change',
        'wrapper' => 'edit-start-dates',
        'progress' => (
          'type' => 'throbber',
          'message' => $this->t('updating...'),
        ),
      ),
      '#attributes' =>  ('min' => $min_date_str, 'max' => $max_date_str),
      '#states' => (
        'visible' =>
        (':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('!value' => ''),)
      ),
    );



    $end_min_date_str =  (isset($field_values($delta)('start_date'))) ?  $field_values($delta)('start_date') : $min_date_str;
    $element('end_date') = (
      '#type' => 'date',
      '#title' => t('End date'),
      '#date_date_format' => $date_format,
      '#date_date_element' => 'date',
      '#date_date_callbacks' => (),
      '#attributes' =>  ('min' => $end_min_date_str, 'max' => $max_date_str),
      '#states' => (
        'visible' =>
        (
          ':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('value' => 'On going'),
          'and',
          ':input(name="field_work_slot(' . $delta . ')(start_date)")' => ('!value' => '')
        )
      )
    );

    $element('times_container') = (
      '#type' => 'container',
      '#attributes' => (
        'id' => ('times_container'),
      ),
      '#states' => (
        'visible' =>
        (':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('!value' => ''),)
      ),
    );

    $element('times_container')('start_time') = (
      '#type' => 'datetime',
      '#title' => t('Start time'),
      '#date_date_element' => 'none',
      '#date_time_format' => $time_format,
      '#date_time_element' => 'time',
      '#date_time_callbacks' => (),
      '#states' => (
        'visible' =>
        (':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('!value' => ''),)
      ),
    );

    $element('times_container')('end_time') = (
      '#type' => 'datetime',
      '#title' => t('End time'),
      '#date_date_element' => 'none',
      '#date_time_format' => $time_format,
      '#date_time_element' => 'time',
      '#date_time_callbacks' => (),
      '#states' => (
        'visible' =>
        (':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('!value' => ''),)
      ),
    );

    $element('working_days') = (
      '#type' => 'select',
      '#title' => t('Working Days'),
      '#multiple' => TRUE,
      '#default_value' => 'All',
      '#states' => (
        'visible' =>
        (':input(name="field_work_slot(' . $delta . ')(work_slot_type)")' => ('value' => 'On going'),)
      ),
      '#options' => (
        'All' => t('All'),
        'Monday' => t('Monday'),
        'Tuesday' => t('Tuesday'),
        'Wednesday' => t('Wednesday'),
        'Thursday' => t('Thursday'),
        'Friday' => t('Friday'),
        'Saturday' => t('Saturday'),
        'Sunday' => t('Sunday'),
      ),
    );


    return $element;
  }
  /**
   * start date callback to set attributes for end date
   *
   * @param array $form
   * @param FormStateInterface $form_state
   * @return void
   */
  public function startDateCallback(array $form, FormStateInterface $form_state)
  {
    $triggered = $form_state->getTriggeringElement();
    $element = NestedArray::getValue($form, array_slice($triggered('#array_parents'), 0, -1));


    $element('start_date')('#attributes')('max') = $element('start_date')('#value');
    $element('end_date')('#attributes')('min') = $element('start_date')('#value');
    $element('end_date')('#value') = $element('start_date')('#value');
    return $element;
  }

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123