macos – Text-filtering Automator workflows fail to replace selected text with their output in Safari 14

After updating from Safari 13 to Safari 14 (on macOS 10.15.6),
I have noticed that all text-filtering Automator workflows no
longer work correctly in Safari.

For an example of such workflow, see the screenshot below. It shows
a simple workflow that takes the current text selection from any app,
pipes it through the fmt command, and replaces the original
selection with that command’s output:

fmt: an example of text-filtering workflow

I have a few workflows of this construction, i.e., consisting of
a single Run Shell Script action running a command that takes
the text selection on its stdin and outputs the text to replace
the selection with on its stdout. I have been using them without
any issues for quite a long time (at least, for the last two major
releases of macOS).

However, when a workflow like that is run from the newly updated
Safari 14, it fails to replace the text selection with the output
of the workflow. Instead, it simply deletes the selected text.
The issue is clearly specific to Safari 14 only, because the same
workflows still work correctly (i.e., replace the selection with
the command’s output) in all other apps (e.g., TextEdit).

Is this caused by some security-related change in Safari 14, or
is it simply a bug that has been accidentally introduced in this
update? In the former case, how this behavior can be reverted?
In the latter case, how and where should we report the bug?

Replace Condition in Replacement Rules

In finding an answer to my other question, I’m finding myself needing to manipulate the conditions imposed on replacement rules, but this is proving to be a little difficult. In particular, how should I go about removing instances of Condition and PatternTest?

Using the code from my other answer (slightly adjusted):

f(x_?InexactNumberQ) := x^2;
g(x_) /; FooQ(x) := x^3;

Attributes(ExpandValues) = {HoldAll};
ExpandValues(symbol_) := Join @@ Through(
  {OwnValues, DownValues, UpValues, SubValues, DefaultValues, NValues}(symbol)
);
ExpandValues(symbol_, symbols__) := Join(ExpandValues(symbol), ExpandValues(symbols));

then the replacement rules that need to be modified are:

{
  HoldPattern(f((x_)?InexactNumberQ)) :> x^2,
  HoldPattern(g(x_) /; FooQ(x)) :> x^3
}

I would like these to be modified to not have any conditions on the arguments, but trying to replace the condition and pattern test is proving difficult. This for example does not work:

{
  HoldPattern(Condition(p_, q_)) :> p,
  HoldPattern(PatternTest(p_, q_)) :> p
}

I’ve also tried using Verbatim which the documentation suggests is useful to transform other transformation rules, but I have not gotten them to work. I’m also thinking that the use of Verbatim won’t work generally because it is too literal.

I’ve had partial success with

{
  Condition -> (#1 &),
  Patterntest -> (#1 &)
}

but when the replacement appears within a HoldPattern, the resulting rule after replacement does not work.

Replace word and add style Javascript snippet in Elementor: Hello WordPress Theme

I’d like to replace the word "Product" for the word "Ingredients" and make it red in this page (https://shop.echemco.com/product/product-test-01/). I’m using Elementor with wordpress theme Hello and this is the code I’m using. I tried putting that code in an HTML module and also in the functions.php file (none of them worked):

$('h3').each(function() {
   var text = $(this).text();
   $(this).html(text.replace('Product', '<span style="color: red;">Ingredients</span>')); 
});
<h3>Product Information</h3>

Thank you in advance!!!

magento2.3 – Replace the QTY of the product in the cart on “add to cart” rather than increment

How to replace the quantity of the product in the cart instead of increment?

Current behaviour:
From the product page:

  • Add 5 qty of product A
  • Add 2 qty of product A (add product again)
  • The cart qty of product A is now 7

Desired behaviour:
From the product page:

  • Add 5 qty of product A
  • Add 2 qty of product A (add product again)
  • The cart qty of product A is now 2

r – Is there a way to replace the texts in the textInput without clicking and using tabs?

Good day all,

I have created a dashboard for the scanning station whereby the operator is able to observe the details of the item after he or she scanned it with a barcode scanner. The issue I am currently facing is that I am unable to scan the barcode of the item without clicking on the textbox. Ideally, what I want to do is:

  1. To allow the operator to scan the barcode straight away on the textbox without clicking on the textbox.
  2. Automatically highlight the barcode number in the textbox so the next barcode number can be scanned and the details of the second item can be rendered.

Reproducible example:

library(shiny)
library(shinydashboard)
library(shinyBarcode)
library(shinyjs)

dashboardPage(
    dashboardHeader(title = "Barcode System"),
    dashboardSidebar(collapsed = T),
    dashboardBody(
 
        useShinyjs(),
        box(width = 4, height = 880,
            shinyBarcode::includeJsBarcode(cdn = TRUE),
                textInput("barcode_no", h3("Scan Barcode No")),
                shinyBarcode::barcodeOutput("scanned_barcode")
        )
library(shiny)
library(shinydashboard)
library(shinyBarcode)
library(shinyjs)

shinyServer(function(input, output, session) {
# Rendering barcode
    output$scanned_barcode<- shinyBarcode::renderBarcode(
        paste("0",input$barcode_no, sep="") # Need to add "0" to all barcode at the front
    )
}

Note: Here is how to install shinyBarcode

# install.packages("devtools")
devtools::install_github("CannaData/shinyBarcode")

If you are still unable to install, download the ZIP file from Github.

Next, openup the zip file and install using the following command:

devtools::install("C:\Users\dave\Downloads\shinyBarcode-master") # Edit to your download directory

Preview

enter image description here

replace by fee – How many wallets allow the user to change outputs for RBF transaction?

I have not tried this option but read about it on twitter: https://twitter.com/bluewalletio/status/1304358287123648513

Not sure maybe this is the code that creates a transaction with different outputs which replaces an unconfirmed RBF transaction: https://github.com/BlueWallet/BlueWallet/blob/73961471571cba764745c6e64754f13e86e51640/class/hd-segwit-bech32-transaction.js#L243

How many other wallets do you know that allow the users to cancel an unconfirmed transaction in a similar way?

Creates an RBF transaction that can replace previous one and basically cancel it (rewrite output to the one our wallet controls). Note, this cannot add more utxo in RBF transaction if newFeerate is too high

I didn’t understand the last part. Why can’t it add more utxo if newFeerate is too high?

@param newFeerate {number} Sat/byte. Should be greater than previous tx feerate

BIP 125 mentions that fee rate and fees both should be higher. So, is higher fee rate enough for replacement tx even if absolute fees is less?

dplyr – how to replace only NAs by matching ids from another dataframe in r

My df1 looks like

PID End_record_date
123 NA
123 15-08-2020
234 NA
234 19-07-2020
345 NA

my df2 has matched ids

PID Record_date
123 13-10-2018
234 14-07-2019
345 20-08-2020

Expected result i need

PID End_record_date
123 13-10-2018
123 15-08-2020
234 14-07-2019
234 19-07-2020
345 20-08-2020

I need only NAs to be filled without disturbing other values

Thanks

How to Create Find and Replace Function for Google Drive File Names with Google Scripts

Basically, I have a bunch of files in a shared google drive, let’s say:

AA123_1.jpg
AA123_2.jpg
AA123_3.jpg

I am trying to get rid of all of the “123”‘s and replace them with an empty space, or just replace “123_” with “_”. I am not particularly familiar with google scripts (I do understand basic programming logic though), but yeah, basically I was wondering if anyone knows how I could make a script for this as there is a very large amount of files. Thanks ever so much.