Binding caps-lock to a range of commands

I never use caps lock, so I’d like to use it as an addition custom modifier key. What modifier keys are there? Super, meta, hyper?

Could I turn the caps lock key into say “hyper” and then assign commands to hyper-a, hyper-b etc? How would I do that?

I’m thinking mainly of commands like beginning of line, end of line etc. Where would those commands (that are currently found to other legal so I can assign them?

What is the range of Defensive Throw?

Defensive Throw (Complete Warrior p97):

If the opponent you have chosen to use your Dodge feat against attacks you and misses, you can make an immediate trip attack against that opponent. This attempt counts against your allowed attacks of opportunity in the round.

This does not mention any range, but the name and the prerequisite (IUS) implies unarmed reach.

Can I use my Guisarme against an enemy further away?

Validate Date range in backend from in magento 2

I have added datepicker in magento2 backend form using following code.

protected function _prepareForm() { $  fieldset->addField(         'date_started',         'date',         [             'name' => 'date_started',             'label' => __('Start Time'),             'date_format' => $  dateFormat,             'class' => 'validate-date validate-date-range date-range-task_data-from',             'class' => 'required-entry',             'style' => 'width:200px'         ]     ); $  fieldset->addField(         'date_completed',         'date',         [             'name' => 'date_completed',             'label' => __('End Time'),             'date_format' => $  dateFormat,             'class' => 'validate-date validate-date-range date-range-task_data-from',             'class' => 'required-entry',             'style' => 'width:200px',         ]     ); } 

but this is not validating the date range.

I need to validate: date_started should be minimum today and the date_completed should be greater than date_started.

I have seen follwoing question Start and End Date Validation but it is for Magento 1.

I also have seen the documentation Date and Time Selector, Calendar widget but it is not useful for it.

My Form.php

<?php  namespace Vendor\Module\Block\Adminhtml\Task\Edit;   /**  * Adminhtml Add New Task Form.  */ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /**  * @var \Magento\Store\Model\System\Store  */ protected $  _systemStore;  /**  * @param \Magento\Backend\Block\Template\Context $  context  * @param \Magento\Framework\Registry             $  registry  * @param \Magento\Framework\Data\FormFactory     $  formFactory  * @param array                                   $  data  */ public function __construct(     \Magento\Backend\Block\Template\Context $  context,     \Magento\Framework\Registry $  registry,     \Magento\Framework\Data\FormFactory $  formFactory,     \Magento\Cms\Model\Wysiwyg\Config $  wysiwygConfig,     \Vendor\Module\Model\Taskstatus $  options,     array $  data = [] )  {     $  this->_options = $  options;     $  this->_wysiwygConfig = $  wysiwygConfig;     parent::__construct($  context, $  registry, $  formFactory, $  data); }  /**  * Prepare form.  *  * @return $  this  */ protected function _prepareForm() {     $  dateFormat = $  this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);     $  model = $  this->_coreRegistry->registry('task_data');      $  form = $  this->_formFactory->create(         ['data' => [                         'id' => 'edit_form',                          'enctype' => 'multipart/form-data',                          'action' => $  this->getData('action'),                          'method' => 'post'                     ]         ]     );      $  form->setHtmlIdPrefix('vmtask_');     if ($  model->getTaskId()) {         $  fieldset = $  form->addFieldset(             'base_fieldset',             ['legend' => __('Edit Task Data'), 'class' => 'fieldset-wide']         );         $  fieldset->addField('task_id', 'hidden', ['name' => 'task_id']);     } else {         $  fieldset = $  form->addFieldset(             'base_fieldset',             ['legend' => __('Add Task Data'), 'class' => 'fieldset-wide']         );     }      $  fieldset->addField(         'task_name',         'text',         [             'name' => 'task_name',             'label' => __('Task Name'),             'id' => 'task_name',             'title' => __('Task Name'),             'class' => 'required-entry',             'required' => true,         ]     );      $  wysiwygConfig = $  this->_wysiwygConfig->getConfig(['tab_id' => $  this->getTabId()]);      $  fieldset->addField(         'task_description',         'editor',         [             'name' => 'task_description',             'label' => __('Task Description'),             'style' => 'height:36em;',             'required' => true,             'config' => $  wysiwygConfig         ]     );       $  fieldset->addField(         'date_started',         'date',         [             'name' => 'date_started',             'label' => __('Start Time'),             'date_format' => $  dateFormat,             'class' => 'validate-date validate-date-range date-range-task_data-from',             'class' => 'required-entry',             'style' => 'width:200px',             'datePickerOptions'=> array(                         'maxDate'=> 'new Date()'                         )         ]     )->setAfterElementHtml("<script type=\"text/javascript\">     //<![CDATA[       require([       'jquery',       'mage/calendar'         ], function($  ){                $  ('#date_started').calendar({                           hideIfNoPrevNext: true,                minDate: new Date(),                showOn: 'button',             });         });              //]]>     </script>");     $  fieldset->addField(         'date_completed',         'date',         [             'name' => 'date_completed',             'label' => __('End Time'),             'date_format' => $  dateFormat,             'class' => 'validate-date validate-date-range date-range-task_data-from',             'class' => 'required-entry',             'style' => 'width:200px',         ]     )->setAfterElementHtml("<script type=\"text/javascript\">     //<![CDATA[       require([       'jquery',       'mage/calendar'         ], function($  ){         $  ('#date_completed').click(function(event) {             var maxD = $  ('#date_started').value();                $  ('#date_completed').calendar({                           hideIfNoPrevNext: true,                minDate: maxD,                showOn: 'button'              });    });             });     //]]>     </script>");      $  form->setValues($  model->getData());     $  form->setUseContainer(true);     $  this->setForm($  form);      return parent::_prepareForm(); } 

}

Thanks

Algorithm for dividing a range into ranges and then finding which range a number belongs to

Having

  • a minimum
  • a maximum
  • number of ranges
  • a value between minimum and maximum

I’m trying to come up with a method, or two, which would calculate which range the provided value belongs to.

For min=1, max = 10, number of ranges=5 the ranges would be [1,2],[3,4],[5,6],[7,8],[9-10]

The other method would behave like shown below:

  • method(1)->[1-2]
  • method(2)->[1-2]
  • method(3)->[3-4]
  • method(4)->[3-4]
  • method(5)->[5-6]
  • method(6)->[5-6]
  • method(7)->[7-8]
  • method(8)->[7-8]
  • method(9)->[9-10]
  • method(10)->[9-10]

This would be used for generating a legend for a map where the size of the marker depends on the range a value belongs to.

I wonder if there is a nice algorithmic solution for this.

The numbers I work with are integers.

Edit:

Another example:

For min=1, max = 3, number of ranges=2 the ranges would be

a) [1-2],[3-3]

or

b) [1-1],[2-3]

The other method would behave like shown below:

a)

  • method(1)->[1-2]
  • method(2)->[1-2]
  • method(3)->[3-3]

or b)

  • method(1)->[1-1]
  • method(2)->[2-3]
  • method(3)->[2-3]

I don’t have a preference for a) or b).

Nodes in a binary search tree that span a range

I have a binary search tree of height $ h$ with an integer in each leaf. I also have a range $ [\ell,u]$ . I want to find a set of nodes that span the range $ [\ell,u]$ , i.e., a set $ S$ of nodes such that the leaves under $ S$ form all (and only) those leaves containing integers in the range $ [\ell,u]$ . How large does $ S$ need to be, in the worst case, as a function of the height $ h$ ? How do I find such a set explicitly?

IndexError: list index out of range em python

inserir a descrição da imagem aqui

Com o input da configuração da comoda e output o numero de gavetas inacessíveis .

Eu tenho este codigo agora

configuração = [] lista = [] aberto = 0  gavetas = int(input('Quantas Gavetas ? -->  ')) print('Configuração das gavetas :') for c in range(0,gavetas ):     z = input()     configuração.append(z)  for a in configuração :     if a == 'o':         lista.append('aberta')     if a == '#':         lista.append('fechada') if not 'aberta' in lista:     print(gavetas, 'todas estão fechadas ') else:     if not 'fechada' in lista:         print(0,'Todas abertas')     else:         while len(lista) > 0:             if lista[0] == 'fechada':                 while lista[0] == 'fechada':                     del lista[0]              if lista[0] == 'aberta':                 if len(lista) == 1:                     print(gavetas-1)                 else:                     if lista[1] == 'fechada':                         del lista[0]                         del lista[0]                         aberto = aberto + 2                     elif lista[1] =='aberta':                         del lista[0]                         del lista[0]                         aberto = aberto + 2   print(gavetas-aberto) 

O codigo pode parecer meio estranho é porque já o refiz tantas fezes … Todas as vezes que rodo o programa começando por aberto ‘o’ ele dá o erro de

while lista[0] == 'fechada': IndexError: list index out of range 

Já tentei fazer de varias formas mas não estou mesmo a conseguir resolver este problema !

exemplo de input

o # # # 

Output esperado

2 

output

while lista[0] == 'fechada': IndexError: list index out of range 

Is a house-rule to increase crit range via the Bless spell balanced?

Here’s the situation. In the campaign that I am DMing, I have ruled that if a blessed creature (via the Bless spell) gets a total of 20 (or more) on the sum of the d20 and the d4 on an attack roll, that counts as a critical hit. My question is essentially, does this house-rule allow bless to remain balanced against other spells of a similar level?

I did the math and this increases your odds of critting from 5% to 17.5% and from 9.75% to 31.625%(!) with 5e’s advantage. This rule would also mean that a blessed creature cannot crit fail.

Things to consider: (note, none of these have come up yet in the campaign but I would rule this way if/when they do)

  • Bardic Inspiration: Bardic inspiration would also increase your chance of critting

  • Bane: Bane would make it impossible to crit (unless also blessed, or inspired)

  • Any other ability that lets you add dice to an attack roll that I am forgetting.

Is this balanced? Are their any consequences of this that I am not seeing?

Item Update “Value does not fall within the expected range”

If I run each line individually, it works. But If I try to run the script with the for each loop, I get: Exception calling “Update” with “0” argument(s): “Value does not fall within the expected range.”

Code:

 $  listItems = $  list.GetItems($  query)    $  query.ListItemCollectionPosition = $  listItems.ListItemCollectionPosition   foreach($  item in $  listItems)        {                # DeleteItems              # UpdateItems              # CancelWorkflows              $  reason = $  item["Reason"] + "  -- This Exception was open more than 30 days and will be closed by the administrator"              $  item["Reason"] = $  reason              $  item.Update()              Write-Host "Added Reason Code - $  ($  item.ID)"               $  reason = $  null               $  count = $  count+1        } 

Do I need to update a different way? When I break and check the variables, $ item[“Reason”] is empty so it makes sense that I have 0 arguments.