Replacing a code in various pages at same time – HTML

I have a lot of pages of code on a site and one of this has a problem. I’d like to past and replace the code to another, but without having to go through each of the hundreds of pages. How can I do this? Many thanks!

list manipulation – Replacing a submatrix of a matrix

Minding the fact that

In[102]:= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}[[1 ;; 2, 1 ;; 2]]

Out[102]= {{1, 2}, {4, 5}}

is the upper left submatrix.

I would like to do the following :

> helios = {{{3, 2}, {1, 2}}, {{3, 2}, {2, 1}}, {{3, 1}, {2, 2}}, {{1, 
>     3}, {2, 2}}, {{2, 3}, {1, 2}}, {{2, 3}, {2, 1}}, {{1, 2}, {3, 
>     2}}, {{2, 2}, {3, 1}}, {{2, 1}, {3, 2}}, {{2, 1}, {2, 3}}, {{1, 
>     2}, {2, 3}}, {{2, 2}, {1, 3}}}

ReplacePart[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {1 ;; 2, 
     1 ;; 2} -> #] & /@ helios

That is, i would like to replace the upper left submatrix by a series of other matrices !
But this does not work as :

ReplacePart::pkspec1: The expression 1;;2 cannot be used as a part specification.

Does anyone have a efficient way of doing this ? with built-in functions if possible.

Thank you very much.

dnd 5e – What would be the ramifications of replacing Multiattack with Extra Attack?

The chimera (MM p. 39) can optionally use a breath weapon instead of another attack.

Some monsters can only use Multiattack for melee but not for ranged attacks, e.g. the cyclops, drow elite warrior…

The glabrezu can exchange some of its attacks for a spell.

The grick can make a second attack if its first attack hits.

The violet fungus makes 1d4 attacks.

The goblin boss can make two attacks, but only in melee and the second attack has disadvantage.

The Nycaloth can teleport as part of its Multiattack.

It seems to be even more complicated with the house rule.

The reason you want to do this is to reduce complexity. But you stated that you want to keep restrictions on specific attacks such as the one bite attack, two claw attacks of dragons which is necessary to not unbalance damage output. But if you need to supplement your rule with additional rules on when extra attacks are allowed, it seems that the change does not fulfill its purpose. Additionally, people know the original rules. Transitioning to new rules will always take time, so you should be sure that the benefit is significant.

Extra attacks and Multiattack affect different domains of the game.

Since the extra attack feature appears on player classes and Multiattack appears on monsters, there is usually not much interaction between the two, except in a few cases like a ranger companion or druid wild shape with fighter levels and similar. Therefore, it seems to be easier to just use the class and monster rules present.

python – replacing values in subclased QAbstractTableModel

I have subclassed QTable View model

with this data to displayed
self.input_data = input_data or ((None, None, None),(None, None, None))
`

I want to change the values one by one by the output of this function

  def _execute(self):
        while True:
            user_input = input("type in: ")
            self.core_signal.emit(user_input)

so the output should be

execute(self):  4
`self.input_data = input_data or ((4, None, None),(None, None, None))`


execute(self):  2
`self.input_data = input_data or ((4, 2, None),(None, None, None))`

I have implemented the function which performs the task in python code

def _execute():
    user_input = input("type in: ")
    return user_input

def insertdata(lst, get_data):
    for row in range(len(lst)):
        for column in range(len(lst(row))):
            lst(row)(column) = get_data()

    return lst

listoflist = ((None, None, None),(None, None, None))

listoflist = insertdata(listoflist, _execute)

print(listoflist)

which works as expected

type in: 1
type in: 2
type in: 3
type in: 4
type in: 5
type in: 6
(('1', '2', '3'), ('4', '5', '6'))

while re implementing this into pyqt5

    @qtc.pyqtSlot(str)
    def insert_data(self, data):
        for row in range(len(self.model.input_data)):
            for column in range(len(self.model.input_data(row))):
                self.model.input_data(row)(column) = data
                self.model.layoutChanged.emit()

       return self.model.input_data   

the outcome is different, the first value replaces all existing values of self.model.input_data

when I use a while loop instead I get the expected bevaior
what is the cause of the different behavior ?

example script




import threading
import sys
import logging

from PyQt5 import QtWidgets as qtw
from PyQt5 import QtCore as qtc
from PyQt5 import QtGui as qtg


class ViewModel(qtc.QAbstractTableModel):

    def __init__(self, input_data=None):
        super().__init__()
        self.input_data = input_data or ((None, None, None),(None, None, None))


    def data(self, index, role):

        if role == qtc.Qt.DisplayRole:
            try:
                text = self.input_data(index.row())(index.column())
            except IndexError:
                text = None

            return text

    def rowCount(self, index=qtc.QModelIndex()):
        return 0 if index.isValid() else len(self.input_data)  

    def columnCount(self, index):
        return len(self.input_data(0))



class MainWindow(qtw.QWidget):
    # Class Attribute for signal sending, type of signal needs to be declared, reason c++ static lenguage
    core_signal = qtc.pyqtSignal(str)

    def __init__(self):
        super().__init__()

        # View
        table_view = qtw.QTableView()

        self.model = ViewModel()

        table_view.setModel(self.model)


        qtRectangle = self.frameGeometry()
        centerPoint = qtw.QDesktopWidget().availableGeometry().center()
        qtRectangle.moveCenter(centerPoint)
        self.move(qtRectangle.topLeft())
        # size
        self.resize(1000, 410)


        # widgets
        self.start_thread_button = qtw.QPushButton("start Thread")
        self.test_button = qtw.QPushButton("display data")

        # layout
        qvboxlayout = qtw.QVBoxLayout()
        qvboxlayout.addWidget(table_view)

        qvboxlayout.addWidget(self.start_thread_button)
        qvboxlayout.addWidget(self.test_button)
        self.setLayout(qvboxlayout)
        self.show()



        # functions

        self.start_thread_button.clicked.connect(self.start)

    @qtc.pyqtSlot(str)
    def insert_data(self, data):
        for row in range(len(self.model.input_data)):
            for column in range(len(self.model.input_data(row))):
                self.model.input_data(row)(column) = data
                self.model.layoutChanged.emit()

        return self.model.input_data




    def start(self):
        """
        start Thread:
        Setting thread.daemon = True will allow the main program to exit before thread is killed.
        :return: sends input data from Thread to slot
        """
        threading.Thread(target=self._execute, daemon=True).start()
        self.core_signal.connect(self.insert_data)

    def _execute(self):
        while True:
            user_input = input("type in: ")
            self.core_signal.emit(user_input)  



if __name__ == '__main__':
    app = qtw.QApplication(sys.argv)
    w = MainWindow()
    sys.exit(app.exec_())

replacing a sup-partition (unordered list; multiset)

I am working on a bijection for integer partitions and would appreciate help with two steps.

First, I want to replace each occurrence of (4, 2, 1, 1) with (3, 3, 2). One complication is that the 4, 2, 1, and 1 need not be adjacent. For example, the input

{{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1}}

should lead to the output

{{4, 3, 3, 2, 2, 1}, {4, 4, 2, 2, 2, 1}}

since the first partition does include (4, 2, 1, 1), even with the extra 2, and the second does not.

Second, in a later step, I need a 2 and all ones, suppose there are $k$ of them, to be changed to the single number $k+2$, e.g., input

{{5, 2, 1, 1}, {4, 3, 1, 1}, {2, 2, 2, 1, 1, 1}}

should lead to the output

{{5, 4}, {5, 2, 2}, {4, 3, 1, 1}}.

restoration – Replacing the leather on corner parts of a camera

I’ve replaced leathers on cameras before, but I have to replace leather on cameras where the leather went around angles of the cameras.

Note how on this photo the leather goes around the angle in a way I cannot reproduce with a flat piece of leather. Or this one.

For durability reasons, I would prefer to use leather. I am very curious how these were applied back in the day.

Has anyone ever replaced the leather on this type of camera body? How would one go about it?

regex – E488 Trailing characters after searching and replacing questions

I have the following search and replace phrase where I try to format a document in one step using multiple commands separated by "|"

:% s / s {6} … d d s / / g | % s / (.Entrance. |.AIR.) / 0 false | % s / (===) / 0 #

I know the problem is that the interpreter does not understand that after the word "false" he has to start with the following command. I have tried to use parentheses and different delimiters, but that doesn't work.

Google search replacing "++" in the search box with ""

I'm trying to search __gcd implementation in c++17. But Google automatically changes it to __gcd implementation in c 17 and the results are apparently from C programming language and not of C++. It's converting + at (space).

unit – How do I get multiple string values ​​by replacing ToString ()?

I want to get multiple string values ​​(selectedNameand selectedCurrency) individually from public override string ToString()below.
How do I proceed?

    using System.Collections;
       using System.Collections.Generic;
       using UnityEngine;  

       (CreateAssetMenu(fileName = "Country", menuName = "Country/Country", order = 0))
       public class country : ScriptableObject
       {
           (System.Serializable)
           public class Item
           {
               public string Name;
               public string Currency;
               public string Capital;
               public string() City;

    public override string ToString()
    {
    string selectedName = this.name;
    string selectedCurrency = this.currency;
    return selectedName + selectedCurrency; 
    }

           }

           public Item() m_Items;
       public Item PickRandomly()
    {
        int index = Random.Range(0, m_Items.Length);
        return m_Items(index);
    }
}

I need to use the string values ​​selected in the script below.

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;

    public class GameController: MonoBehaviour
    {   public country country; //This is the scriptable object country
    public Text countryText;
    public Text currencyText;

    void Start(){
    countryText.text = country.PickRandomly().ToString(); // This is where I need the country name string to show up.
currencyText.text = country.PickRandomly().ToString(); // This is where I need the currency string to show up.
    }
    }

Right now, it just displays a random country name and currency, for example USA USD in both fields.

theming – Why doesn't replacing libraries remove assets?

My attempt to delete CSS and JS assets does not work. I have placed the following statements in my module's * .info.yml file. But after clearing the cache, I still see the assets in the head of the document. Is there a problem with my syntax:

libraries-override:
  global-styling:
    css:
      base:
        /themes/stack/css/lightbox.min.css: false
    js:
      /themes/stack/js/lightbox.min.js: false

Here is the relevant Drupal documentation:
https://www.drupal.org/docs/8/theming/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme#override-extend

I also tried these for the key:

  • overall stack / style
  • stack.global-styling

I also tried it without the full paths:

libraries-override:
  stack/global-styling:
    css:
      base:
        lightbox.min.css: false
    js:
      lightbox.min.js: false

So far, nothing works.