9 – Custom token not being replaced

In my_module I have the following:

function my_module_token_info()
{
  $info = ();
  $info('types')('my_module_tokens') = (
      'name' => 'My Module Tokens',
      'description' => t('Tokens specific to my module.'),
  );
  $info('tokens')('my_module_tokens')('my_token')() = 'For my token in a node body';

  return $info;
}

function my_module_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
  $replacements = ();

  if ($type == 'my_module_tokens') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'my_token':
          $replacements($original) = 'test';
          break;

        default:
          break;
      }
    }
  }

  return $replacements;
}

In a node body I have (my_module_tokens:my_token)

Now, the token info is found and processed, and appears in the token list. The implementation of hook_tokens does not fire unless I add the following:

function my_module_preprocess_node(&$variables) {
  $token = Drupal::token();
  $token->replace("(my_module_tokens:my_token)", array('node'=>$variables('node')), array('clear' => TRUE));
  }
}

The token information and replacement text are sent off to the tokens logic, but the result is that the token in the body text is unchanged.

screen capture – What replaced the com.apple.screencapture disable-shadow in macOS Big Sur?

Prior to Big Sur, one could change the macOS window screenshot default to hide shadows by setting defaults write com.apple.screencapture -bool disable-shadow. That no longer seems to work.

Holding while taking a window screenshot in Big Sur still hides the shadow, so it appears the capability is still present.

Is there a new defaults setting in Big Sur to change the default to hide window shadows (and make holding enable them)?

7 – Autocomplete field where title is replaced with NID

I’m using Drupal 7 and I have made autocomplete function to be called on a field.

File my_module.module:

<?php    

function my_module_menu() {
        
    $items = array();

    $items('/autocomplete') = array(
        'title' => 'Autocomplete',
        'page callback' => 'companyAutocomplete',
        'access arguments' => array('autocomplete'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 1,
        'file' => 'my_module.autocomplete.inc'
    );   
       
    return $items;
}

File my_module.autocomplete.inc:

<?php

function companyAutocomplete($fieldInput) {

    $returnArray = array();

    $query = db_select('node', 'n')
        ->fields('n', array('nid', 'title'))
        ->condition('n.title', '%'.db_like($fieldInput).'%', 'LIKE')
        ->condition('n.type', 'company', '=')
        ->orderBy('n.title', 'ASC')
        ->range(0, 10);

    // print strtr((string) $query, $query->arguments());

    $results = $query->execute();

    foreach ($results as $result) {
        $returnArray($result->title) = check_plain($result->title);
    }

    drupal_json_output($returnArray);
}

File template.php:

<?php

function my_theme_preprocess_field(&$vars) {

    if ($node = menu_get_object()) {

        if ($node->type == 'company') {

            if ($vars('element')('#field_name') == 'field_company') {
                $company = entity_metadata_wrapper('node', $vars('items')('0')('#markup'));
                $vars('items')('0')('#markup') = $company->label();
            }
        }
    }
}

and I have a field company (I use this field to enter NID):

$form('field_company') = array(
    '#type' => 'textfield',
    '#default_value' => $defaultCompany,
    '#title' => 'Company',
    '#autocomplete_path' => '/autocomplete',
);

When I type something in field, autocomplete returns correct text value of the searched term and that is ok.

How can I modify companyAutocomplete() function or the field itself for autocomplete to works as it is, but to write NID instead title in $form(‘field_company’)(‘und’)(0)(‘value’)?

complexity theory – Why the measuring of characters replaced with the same character in the tape of a Turing machine doesn’t isn’t a valid measure by Blum’s axioms?

In Computational Complexity of Papademetriou, there is an exercise about Blum’s axioms where it asks to prove that several measures for the complexity of a Turing machine satisfy them.
The last one is about the number of times a character is replaced by itself in a Turing machine, where it is asked to prove that this doesn’t satisfy Blums axioms.
Why doesn’t it satisfy Blums axioms?

Magento2.3.4 Product main image gets replaced with first option

On configurable products, when the page is loading then it’s showing the main image but immediately its gets replaced with the first option on load.
I have debugged it and found that the following script in gallery.phtml is creating a problem

<script type="text/x-magento-init">
    {
        "(data-gallery-role=gallery-placeholder)": {
            "mage/gallery/gallery": {
                "mixins":("magnifier/magnify"),
                "magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>,
                "data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>,
                "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>,
                "fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>,
                "breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?>
            }
        }
    }
</script>

Is there any way to resolve it

hardware – Replaced Ambient temperature sensor in imac mid 2011 (A1314) fans still blowing at full speed

My iMac fans started blowing at full speed for sometime so I rebooted and ran diagnostics and received an ambient sensor error, image attached below.

I had been considering adding an SSD in addition to my 2TB internal HDD and so decided I would add the SSD and replace the sensor whilst I was there. The sensor I bought

After carefully replacing the sensor (I’m a PC technician by trade) at first boot the the fans were still blowing at full speed..

So I reset SMC by unplugging the iMac and waiting, same result. I then reset PRAM a few times, same result, fans still blowing at full speed. I then decided to run diagnostics again although the test just displayed ‘starting internet recovery’ for more than an hour so figured it might be hanging, and rebooted.

Booted back into OSX and fans were quiet and have been for 10 days, although today on booting up the fans were on full and have been ever since despite rebooting a few times, I can’t believe it! What is going on here??

It’s nothing to do with the SSD I cloned the existing HDD to the SSD and used the proper OWC sata cable kit, the original hard drive hasn’t be changed merely cloned then wiped.

Thanks in Advance

iMac mid 2011 diagnostic result