## How to replace a list/array of variables in the result?

All,

I want to know how to replace multiple variables in the result expression. To be specific, all those variables are inside the array I defined.

For a simple example, if I define input

mm5 = {a, b, c, d};

mm7 = {2, 3, 9, 8};

mm7a = mm7.mm5

Out: 2 a + 3 b + 9 c + 8 d

After that, if I define a new array

mm6 = {3, 4, 5, 7}

And I want to replace every unknown component in mm5 to be values in mm6, and to let final result of mm7a to be 23+34+95+87=119. How should I do that?

I was thinking is there anyway similar to

mm7a /. {mm5[[i]] -> mm6[[i]],{i,1,4}}

Of course, what I wrote is wrong. But is there any simple way to use /. to help me achieve this effect?? And after substituting, I want symbols in mm5 be reserved, for example, when I out put mm5 result, it is still {a, b, c, d}

I searched the whole web but I didn’t find a simple way to do it. Maybe I didn’t search it right. So I post my question here and hopefully to get some answer.

Thank you

## Replace or Update a Table Row – based on the presence of a matching row item

Unfortunately I know next to nothing about php coding that contains some sql code. The examples I have seen online do not seem to match the same syntax that I inherited with this code, which is making this task confusing for me.

I have a database table called "effort" that contains two columns:

Column 1 = ad  Column 2 = theEffort 

This line of code below works, and it will populate the table with the proper values for both the "ad" and "theEffort"

$sql = "INSERT INTO effort SET ad='$  ad', theEffort='$theEffort'";  But I do not want the table to grow over time and contain redundant rows pertaining to the same ad. Each "ad" in this table should be unique. But each "ad" could have 5 different effort values, e.g., "theEffort" can be "easy", "medium", "difficult", "impossible". The "ad" is 13 digit number, i.e. SFAD_000001234 Does anybody know how to modify my code above using similar syntax so that it would first check to see if the "ad" exists in the database table called "effort". And if so, instead of entering a new row it would update "theEffort" to the new value. And if the "ad" did not exist in any table row within the "effort" database then it would execute the INSERT INTO function, i.e., insert both the "ad" and "theEffort" as a new table row. Thank you in advance, -Jeff ## Can an Aberrant Mind and Clockwork Soul Sorcerer replace two spells at level up? All sorcerers are allowed to replace one spell they known when they level up: Additionally, when you gain a level in this class, you can choose one of the Sorcerer Spells you know and replace it with another spell from the Sorcerer spell list, which also must be of a level for which you have Spell Slots. Moreover, the Clockwork Magic feature let the Clockwork Soul Sorcerer replace one of their spell known at level up: Whenever you gain a sorcerer level, you can replace one spell you gained from this feature with another spell of the same level. The new spell must be an abjuration or a transmutation spell from the sorcerer, warlock, or wizard spell list. Same for the Psionic Spells feature of the Aberrant Mind Sorcerer: Whenever you gain a sorcerer level, you can replace one spell you gained from this feature with another spell of the same level. The new spell must be a divination or an enchantment spell from the sorcerer, warlock, or wizard spell list. My question: can the Clockwork Soul Sorcerer and the Aberrant Mind Sorcerer swap two of their spells at level up, as long as one is from their "normal" list and one is from their origin? Or, do these Sorcerers have to pick to either replace a single one of their Sorcerer spells using the general rule, or replace a single of their origin list using the special Clockwork Magic / Psionic Spells rules? ## What class archetypes can replace a Witch’s spellcasting ability? One of our players does not enjoy the metagame of spell memorization / resource management that comes with spellcasting. Our GM has allowed us to retcon her archetype to replace or scale back the spellcasting aspect of a Witch so that she can focus more on Hexes and possibly countermagic. Our characters are currently 5th level and I don’t think she’s cast anything other than Cure Light Wounds once or twice. Neither of us is exceptionally familiar with Pathfinder and haven’t been able to find any options on our own. According to our GM homebrews that are well balanced might be acceptable. Some additional info about the character: L5 Gnome Jinx-Eater Witch with a Goat Familiar (Black Philip) and the Decadence patron. What the player would love: For her Goat to be more powerful or hearty so that it can play a bigger role in our adventures. ## If a fighter multiclasses into sorcerer, when they cast spells do they also replace material components with somatic? From the Sorcerer class page, Because you’re a sorcerer, you can usually replace material components with somatic components, so you don’t need to use a material component pouch. I interpret this to mean that whenever a sorcerer casts a spell that requires a material component (without a cost), then they can choose to replace that component with a somatic one. From the listing on spell components, this means that the spell would keep the manipulate trait, but one important thing would change: the spell no longer requires you to have a hand free to retrieve and manipulate the material component. Now, if a fighter takes the sorcerer dedication, then from the dedication page, You cast spells like a sorcerer. I interpet this to mean that the fighter also gains the ability to replace any material component with a somatic component, and that as a consequence the fighter can cast sorcerer spells without needing a hand free. Is my interpretation correct? ## How can I find the name of a function and replace with another name in a plugin? I would like to replace a button name "CV Manager" with "Upload Resume". The button is part of a list of menu buttons in a user dashboard. It function is to direct candidates to upload their resumes and I would like the button to say just that. Can anyone please tell me where in the plugin database I can find that button and replace it by using the "plugin editor" in wordpress? Thank you ## MariaDB views: I want to replace repeated multi-table joins in my queries with a view – are there any issues to watch out for? Rather than SELECT a.pk, b.pk, c.pk, d.name FROM a JOIN b on b.pk = a.fk JOIN c on c.pk = b.fk JOIN d on d.pk = c.fk  I can do SELECT a_pk, b_pk, c_pk, d_name FROM view_a_b_c_d  I have a lot of this sort of thing through my code. I’ve done a performance test, and the differences seem to be negligible, and I feel it would greatly tidy my codebase up and remove a lot of repetition. But before I commit to that (as it’d be a big change with a lot of work and testing), I want to check that this IS a good thing to do. I didn’t study computer science and have no formal DBA training. I’m also a sole dev working on my own closed-source product. So I don’t get much input from the outside world, unless I strike out and ask for it. Thank you – any opinions/experience appreciated. ## How can i find wrong word in search box and replace with correct word I have a search form and Many site users search for the wrong words, I want to replace these wrong words with the right ones so that users can get results faster. I have been searching for this for several days but unfortunately I did not find any results. I’m looking for a way if a user types wrong words like this i love axqple i love vaple i love aple i love applle i love aplle  Replace the wrong text with Apple. I have already checked things like the this tutorial and this topic but have not reached a conclusion I also looked at these cases: function str replace find word in variable and replace with another search string for specific word and replace it And many more… Given this explanation, does anyone have a solution, educational content or any tips Thanks for any help ## Need to replace Currency Shortforms I want to replace the currency shorten alphabet, it is currently in M, L and So on. I want to change to indian currency number format like K, L and CR below is code: if(!function_exists(‘houzez_number_shorten’)) { function houzez_number_shorten($ number, $precision = 0,$ divisors = null) { $number = houzez_clean_price_20($ number);

    if (!isset($divisors)) {$  divisors = array(             pow(1000, 0) => '', // 1000^0 == 1             pow(1000, 1) => 'K', // Thousand             pow(1000, 2) => 'M', // Million             pow(1000, 3) => 'B', // Billion             pow(1000, 4) => 'T', // Trillion             pow(1000, 5) => 'Qa', // Quadrillion             pow(1000, 6) => 'Qi', // Quintillion         );         }          foreach ($divisors as$  divisor => $shorthand) { if (abs($  number) < ($divisor * 1000)) { // Match found break; } } //Match found or not found use the last defined value for divisor$  price = number_format($number /$  divisor, 1);     $price = str_replace(".0","",$  price);     return $price .$  shorthand; } 

I am not good at coding, so any help will be appreciated

## ReplaceAll doesn’t replace all, factor out negative sign first

I have this matrix:$$\left( \begin{array}{ccccc} \{\{0\},\{0,0,0\}\} & \{\{1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{-1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,z,-y\}\} & \{\{0\},\{-z,0,x\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,-z,y\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{y,-x,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{z,0,-x\}\} & \{\{0\},\{-y,x,0\}\} & \{\{0\},\{0,0,0\}\} \ \end{array} \right)$$

When I run ReplaceAll (/.) on it using this$$\left\{\{\{1\},\{0,0,0\}\}\to X_1,\left\{\{t\},\left\{\frac{2 x}{3},\frac{2 y}{3},\frac{2 z}{3}\right\}\right\}\to X_2,\{\{0\},\{y,-x,0\}\}\to X_3,\{\{0\},\{z,0,-x\}\}\to X_4,\{\{0\},\{0,z,-y\}\}\to X_5,\{\{0\},\{0,0,0\}\}\to 0\right\}$$

it doesn’t replace everything:

$$\left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ \{\{-1\},\{0,0,0\}\} & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & \{\{0\},\{-z,0,x\}\} \ 0 & 0 & \{\{0\},\{0,-z,y\}\} & 0 & X_3 \ 0 & 0 & X_4 & \{\{0\},\{-y,x,0\}\} & 0 \ \end{array} \right)$$

I expect:$$\left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ -X_1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & -X_4 \ 0 & 0 & -X_5 & 0 & X_3 \ 0 & 0 & X_4 & -X_3 & 0 \ \end{array} \right)$$

Is there an automated way of doing these replacements?