dnd 4e – Can a hybrid character replace his only encounter attack power belonging to one of his classes?

Assume a Paladin|Swordmage with Cha and Con dumping Int or a SwarmDriud|Runepriest with Wis and Con dumping Str.
As the relevant ability is very low, it would make sense not to pick any power from the secondary class. However, hybrid rules say you must.
Is there a way around this?

I do not think Reserve Maneuver or multiclass power swaps work, but I am not sure.

php – How to replace file_get_contents() with a WordPress Filesystem call

I’m using the PHP file_get_contents() function to retrieve and echo the contents of an SVG-file.

<?php echo file_get_contents( get_stylesheet_directory_uri() . '/assets/images/Search_Glyph.svg' ); ?>

I checked the theme with a theme checker and I am currently resolving all the issues. One of the issues is the use of file_get_contents.

It gives me the following warning:

WARNING: file_get_contents was found in the file header.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

I tried finding information about the $wp_filesystem thing, but there is very little information available and even less examples (to be honest, I’m not totally sure if that’s the correct function to use).

How can I use a WordPress function to retrieve a file and echo the contents of it in a PHP-file?

I’m really at loss what I should do with this. All help is very much appreciated!

How to replace the particular value in array object of nested object with another array object in javascript

I have two objects obj1 and obj2, if obj1 property info has keys id and code,

If the array object info of obj1 keys code and id matches with obj2, then replace the nos of obj2 with obj1. if not matches, change it to 0

How to replace the value in array object of nested array object if id and code matched with another array object in javscript.

function newArray (obj1,obj2){
 return obj2.map(e=>{
   nos = obj1.filter(i=>i.info.some(x=>x.id === e.id && x.code === i.code)
   return nos ? {...e, nos} : e;

var obj1 =(
 {tot: 4, info: ({id:1, code:"x1",nos:2},{id:2, code:"x2",nos:2}) }
 {tot: 2, info: ({id:3, code:"x3",nos:2},{id:5, code:"x5",nos:3}})}

var obj2 = (
 {id:1, code: "x1", nos:1, name:"sample1"},
 {id:2, code: "x2", nos:2, name:"sample2"},
 {id:3, code:"x3",nos:3, name:"sample3"},
 {id:4, code: "x1", nos:0},
 {id:5, code: "x5", nos:3, name:"sample5"},

Expected Output:

{id:1, code: "x1", nos:2, name:"sample1"},
{id:2, code: "x2", nos:2, name:"sample2"},
{id:3, code:"x3",nos:2, name:"sample3"},
{id:4, code: "x1", nos:0},
{id:5, code:"x5",nos:3, name"sample5"}

postgresql – postgres how to safely replace the old table with its cleaned copy?

I have created a table_cleaned like table and inserted unique values from table into table_cleaned. Now I want to replace table with table_cleaned with

ALTER TABLE table_cleaned rename to table;

but the first statement gives cannot drop table cals_status because other objects depend on it.

I definitely don’t want to use cascade as it would delete all the dependent rows.

How can I safely replace the old table with its cleaned copy?

How do you replace commands in the terminal?

I want to be able to type a short command and have that be replaced with a longer one. For example, typing vscode could run something like open -a "Visual Studio Code". I know this is possible in Linux, but is there any way to do this in MacOS?

Thanks in advance!

Dilema com replace em Python

Estou desenvolvendo um jogo da forca em Python, e para realizar a ocultação da palavra uso este pequeno código:

if u1 in e: # Se u1 (Variável que armazena a letra do usuário)
    for c in str(e.strip()):  # Para cada letra na palavra fatiada
        if c.lower() not in lista:  # Se a letra não estiver na lista de letras que o usuário digitou até agora
            d = d.replace(str(c), ' _')  # Troque ela por ' _'
            # Assim o objetivo seria que só as letras que o user acertou ficassem a mostra

Porém, esse código só funciona na primeira entrada de letra do usuário, pois na segunda entrada ele já é inutilizável devido todas as letras da váriavel que armazena a palavra agora estarem com ‘ _’ no lugar.
Alguém sabe o que posso fazer?

forms – Drupal 8 form_alter Ajax suffix replace

I’m trying to rewrite a form item’s suffix on an AJAX callback and it keeps prepending the first choice and then doing nothing else. My code:

function my_dashboard_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id){
  if($form_id == 'node_job_listing_owner_job_form_form'){
    $tid = $form_state->getValue('field_job_description')(0)('target_id');
      $tid = $form('field_job_description')('widget')('#default_value')(0);
    $link = null;
      $link_url = DrupalCoreUrl::fromRoute('entity.taxonomy_term.canonical', (
        'taxonomy_term' => $tid
      ), (
        'attributes' => (
          'class' => ('use-ajax'),
          'data-dialog-type' => 'dialog',
          'data-dialog-options' => DrupalComponentSerializationJson::encode(('width' => 420)),
          'data-dialog-renderer' => 'off_canvas',
      $link = Drupal::l('Preview Job Description...'.$tid, $link_url);

    $form('field_job_description')('#suffix') = $link;
    $form('field_job_description')('widget')('#ajax') = (
      'callback' => 'updateJobDescriptionPreviewLink',
      'wrapper' => 'edit-field-job-description-wrapper',
      'event' => 'change',

function updateJobDescriptionPreviewLink(&$form, DrupalCoreFormFormStateInterface $form_state){
  return $form('field_job_description');

Basically, I’m trying to put a link below the “Job Description” drop down to preview the description of that term. I have the term id appended to the link text temporarily so I can see what happens. When I edit an existing node, it renders the link correctly the first time (i.e. “Preview Job Description…102”). But then, if I select a different option, it prepends another link to the existing suffix (i.e. “Preview Job Description…99 Preview Job Description…102”). Both links work correctly, but obviously two links aren’t what I want. And also after that, it won’t change anymore no matter what I select.

I feel like there’s something simple I’m overlooking, but I confess Drupal AJAX has always confused me somewhat. Any ideas? Thanks!

javascript – Replace icon element after click

I am beginner in web development.

I have this script in jQuery:

$('.data-table').on('click', 'td', function () {
                var row = table.row(this).data();
                let mainProduct = {{ $id }}; 

                $.get("{{ route('related.product.add') }}" + '/' + mainProduct + '/' + row.id, function (data, status) {

                $.get("{{ route('related.product.destroyAjax') }}" + '/' + mainProduct + '/' + row.id, function (data, status) {


This code add / remove item from my DB (script post to php / Laravel).

I have span to remove item:

<i id="1" class="fas fa-minus removeItem"></I>

and to add item:

<i id="1" class="fas fa-plus addItem"></I>

ID numbers vary depending on the product.

I would like to click on “removeItem” (minus ico) to add “addItem” (plus ico).

After clicking on “addItem” (plus ico) there would appear an element for “removeItem” (minus ico).

So if I clicked add element – then we replace the icon n and delete the element and vice versa. So if I click the icon to delete the item – it should appear for adding.

In my code I have 2 methods to add and delete. I know they can’t be at the same time. I just don’t know how to assign them to individual buttons.

Please help me.

list manipulation – Inverting replace direction

When we have a long list of rules it would be resonable choosing a functional approach, which is much faster than rule based one. In such cases consider e.g.

Reverse /@ rep

Sometimes it would be more efficient using Transpose twice than Map once, e.g.

Rule @@@ Transpose @ Reverse @ Transpose[ List @@@ rep]

Nonetheless ususally we need not to play with long lists and a simple pattern matching is quite sufficient, and so another approach might be e.g.

rep /. Rule[a_, b_] :> Rule[b, a]
 {b1 -> a1, b2 -> a2, b3 -> a3}

Mind using RuleDelayed in cases when it matters instead of Rule.

dnd 5e – Does a multiclassed Hexblade warlock/paladin’s Cha modifier stack with their Str or Dex modifier for attack rolls? Or does it replace Str/Dex mods?

I’m creating a fun villainous figure for my campaign. The choice has fallen on a Paladin-Warlock hybrid. The general idea is to take 2 levels in Paladin for Divine Smite, and then pound 4-5 levels into Hexblade Warlock. Blade-summoning for the flavour, good at all distances, quite mobile, and pretty tanky due to allowed armour-class.

Since Hexblade warlock can use his Cha for attack rolls, will it stack with his Str or Dex modifier depending on the weapon? Or will I have to add my Cha mod instead of those stats?