terminology – How can I efficiently search the bitcoin-dev mailing list for discussion of a specific term?

The simplest way to do this is use a search engine e.g. Google and enter:

"bip37 site:lists.linuxfoundation.org"

(This is also useful for searching GitHub issues, pull requests as a Google search is often more effective than the github.com search functionality.)

Alternatively you can go to https://lists.linuxfoundation.org/pipermail/bitcoin-dev/ and download all the gzip mboxes (the URL scheme is simple, so you write a shell one-liner with curl), ungzip them, cat them together, and then use mutt -f combined.mbox.

This question was answered by various individuals on IRC.

plotting – How to extract data from the solution of NDsolve with specific parameter range

I’ll use the Lotka-Volterra model as an example since I can’t copy your code.

First way:
Use Show to get the forward t>0 and backward t<0 solutions to be different colors.

{xsol, ysol} = NDSolveValue({
   x'(t) == x(t) - 2 x(t) y(t),
   y'(t) == x(t) y(t) - y(t),
   x(0) == y(0) == 1},
  {x, y}, {t, -20, 20})


Show({
  ParametricPlot({xsol(t), ysol(t)}, {t, -4, 0}, PlotStyle -> Red, 
   PlotRange -> {{0, 2.5}, {0, 1.5}},
   Prolog -> {PointSize(Large), Blue, Point({1, 1})}),
  ParametricPlot({xsol(t), ysol(t)}, {t, 0, 4}, PlotStyle -> Green)})

Using Show

Second way:
Have a forward and a backward NDSolve.

Forward solution

{xsolf, ysolf} = NDSolveValue({
   x'(t) == x(t) - 2 x(t) y(t),
   y'(t) == x(t) y(t) - y(t),
   x(0) == y(0) == 1},
  {x, y}, {t, 0, 20})

Backward solution

{xsolb, ysolb} = NDSolveValue({
   x'(t) == -(x(t) - 2 x(t) y(t)),
   y'(t) == -(x(t) y(t) - y(t)),
   x(0) == y(0) == 1},
  {x, y}, {t, 0, 20})

Notice that the backward solve has the same initial conditions and time range as the forward solve, but that the equations are negated.

This lets you use only a single ParametricPlot for both forward and backward solutions.

ParametricPlot({{xsolf(t), ysolf(t)}, {xsolb(t), ysolb(t)}}, {t, 0, 4}, 
  PlotStyle -> {Red, Green}, 
  Prolog -> {PointSize(Large), Blue, Point({1, 1})})

enter image description here

I’ve also gone with NDSolveValue instead of the regular NDSolve since you asked to store the data in a table which you can do pretty easily with

xfData = Table(xsolf(t), {t, 0, 5, .1})

If you use the second way, remember that for the backward solve time is “negative time” so you might need to do something like

xbData = Table(xsolb(t), {t, 10, 0, -.1})

AppleScript to prompt for url input, open url in safari, then open bookmark with specific name

I have a bookmark that runs some JavaScript code on the website the user has open at the time of running the bookmark – I’m aware there is a way using AppleScript to execute JavaScript on a Safari page but this requires ‘Allow JavaScript from Apple Events’ which I’m trying to avoid.

I’d like the script to ask for the user to enter a url, it will then open a new window with this page and then it will click the bookmark which will itself run some JavaScript on the open page.

So far, by looking at existing posts here on StackExchange, I’ve been able to get it to open bookmarks in different tabs, but I’m struggling to amend it to open a specific named bookmark on the page the script has opened.

Would appreciate any help anyone can give!

EDIT: My current code that I’m amending is from here:
In Safari, can a set of bookmarks in a folder be opened programmatically (e.g. using AppleScript)?

set bookmarksFolder to "test_folder"

tell application "Safari" to activate

delay 1

tell application "System Events" to ¬
    click menu item "Open in New Tabs" of ¬
        menu 1 of ¬
        menu item bookmarksFolder of ¬
        menu 1 of ¬
        menu bar item "Bookmarks" of ¬
        menu bar 1 of ¬
        application process "Safari"

k3s – Why is MetalLB automatically routing node ip to an specific service ip?

I’m trying to run PiHole on a k3s cluster inside my Raspberry Pi.

I have created a k3s cluster inside the RaspBerry Pi with only 1 node (the RaspBerry Pi itself). I also created a PiHole pod and a loadbalancer service. The loadbalancer uses MetalLB to create an external IP(192.168.68.11) with a Layer 2 Protocol.

So, as of now my set up has:

  1. Windows PC with an IP of 192.168.0.11
  2. Raspberry Pi with an IP of 192.168.0.16
  3. PiHole Load Balancer with an External IP of 192.168.68.11

Then:

  1. Pinging from the Raspberry to 192.168.68.11:8000 works as expected
  2. Pinging from the Windows PC to 192.168.68.11:8000 fails.
  3. Pinging from the Windows PC to 192.168.0.16:8000 works and it connects me to the PiHole Ui.

So my question is:

  1. How does MetalILB knows it has to route packages from the Node IP (192.168.0.16) to the Load Balancer that connects to the PiHole Service on 8000 port?

java – Daily coding problem: Job scheduler invoking a function after specific time

This is a problem from Daily Coding Problem. I have implemented it in Java.
For a function f I have used Runnable interface.

Problem:

This problem was asked by Apple.

Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.

Solution:

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

class Ideone {

    interface JobScheduler {
        void schedule(final Runnable f, int n);
    }

    static class JobSchedulerImpl implements JobScheduler {
        private final AtomicInteger idValue = new AtomicInteger(0);
        private final Map<Integer, Thread> jobs = new ConcurrentHashMap<>();

        private int getNextId() {
            return idValue.incrementAndGet();
        }

        @Override
        public void schedule(final Runnable f, final int n) throws IllegalArgumentException {
            if (n < 0) {
                throw new IllegalArgumentException("n cannot be nagative");
            }
            int id = getNextId();
            Thread job = new Thread() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(n);
                        f.run();
                        jobs.remove(id);
                    } catch (InterruptedException e) {
                        jobs.remove(id);
                    }
                }
            };
            jobs.put(id, job);
            job.start();
        }
    }

    public static void main(String() args) {
        JobScheduler jobScheduler = new JobSchedulerImpl();
        jobScheduler.schedule(new Runnable() {
            @Override
            public void run() {
                System.out.println("Job1 launched at: " + System.currentTimeMillis());
            }
        }, 10000);
        jobScheduler.schedule(new Runnable() {
            @Override
            public void run() {
                System.out.println("Job2 launched at: " + System.currentTimeMillis());
            }
        }, 1000);
    }
}
```

Optimization problem where the variables have to sum to a specific value

I have been working with an optimization problem with some convex function $f$ which is supposed to be minimized w.r.t. some variables $z_1, dots, z_d in (0,1)$. The additional restriction here is that $$sum_{k=1}^d z_k = 1.$$

I have been trying to find a good algorithm to solve such a minimization problem but couldn’t think of one. For example, I have tried the algorithms from NLOpt such as COBYLA but they do not work (even though COBYLA is supposed to support equality constraints). The reason is that with this problem, whenever we make a step in one direction (in some dimension) then we have to make the opposite step in another dimension.

However, when the COBYLA algorithm tries to deviate in one dimension it only notices that the resulting point is not feasible anymore. As this even happens when taking a single step in a single direction which is less than the tolerance, the algorithm terminates rather quickly with the original guess.

Are there algorithms/approaches that are commonly used to solve this problem? I would assume that it is much simpler than regular convex optimization.

theming – Using TWIG in views global custom text to test for a specific content type

I am filtering for two custom content types to display on a page in Drupal 9 Views: “Artwork Page” and “Cover Page”. I want to apply special html tags to “Cover Page”. I have researched and tried many field names for “Content Type” but to no avail. In this instance, Views’ replacement pattern for Content Type is {{ type }} but using this in the TWIG if statement doesn’t work. I’ve tried both the machine name (cover_page) and value (Cover Page).

{% if type == 'cover_page' %}
  <h1>THIS IS THE BEGINNING</h1>
{% endif %}

{% if type == 'Cover Page' %}
  <h1>THIS IS THE BEGINNING</h1>
{% endif %}

Neither of these worked.

magento2.4 – How to show a footer link for only specific language store view? – Magento2

How can I make a footer link show only a specific store language view?

For example, I want to show this custom footer link only for English store view, not other language store view. So I can setup different footer links for each store view.

<referenceBlock name="footer_links">
    <block class="MagentoFrameworkViewElementHtmlLinkCurrent" name="custom-link-1">
        <arguments>
            <argument name="label" xsi:type="string">My new footer title</argument>
            <argument name="path" xsi:type="string">path-link</argument>
        </arguments>
    </block>
</referenceBlock>

javascript – How to assign rating to specific picture?

while ($row = mysqli_fetch_array($result)) { echo “”;

echo "<div id='img_div'>";
echo "<i class='fas fa-times'></i>";
    echo "<img class='photoDeGallery' src="https://stackoverflow.com/image/".$row("image')."'>";
   
         echo "<div class='dropdown'>";
             echo "<span>Details</span> ";

                 echo "<div class='dropdown-content'>";
                     echo "<p>".$row('text')."</p>";
                 echo "</div>";

         echo "</div>";
    
         echo "<div class='feedback'>";

         echo "<input type='radio' name='star' id='loveIt' checked='checked'>";
         echo "<label for='loveIt'>";
         echo "<img class='imag' src='love_it.png'>";
         echo "<h4>love it</h4>";
         echo "</label>";

         echo "<input type='radio' name='star' id='likeIt'>";
         echo "<label for='likeIt'>";
         echo "<img class='imag' src='liked_it.png'>";
         echo "<h4>like it</h4>";
         echo "</label>";

         echo "<input type='radio' name='star' id='applause'>";
         echo "<label for='applause'>";
         echo "<img class='imag' src='applause.png'>";
         echo "<h4>applaus</h4>";
         echo "</label>";

         echo "<input type='radio' name='star' id='laugh'>";
         echo "<label for='laugh'>";
         echo "<img class='imag' src='laugh.png'>";
         echo "<h4>laugh</h4>";
         echo "</label>";

         echo "<input type='radio' name='star' id='boring'>";
         echo "<label for='boring'>";
         echo "<img class='imag' src='boring.png'>";
         echo "<h4>boring</h4>";
         echo "</label>";
         

             

         echo "</div>";

echo "</div>";

echo “”;
}

Hallo, I provided the code above.

Onclick a button runs the code above. The code insert pictures on database and show them on the website. Under each photo inside an img_div also been created details to the pic and rating. The rating-system I created using radio input (as it is to see in the code). The rating-system appears under every picture, which has been uploaded to the database and shown on the website. The problem is:

when i rate a picture, all other pictures get the same rating.

How can i keep for each picture the own rating, so that rating been assigned 1:1 rating1:photo1, rating2:photo2 etc. ?

I will be grateful if someone could help me and Modos wouldn’t close my thread?
Best regards
Reda

numerical integration – How can I isolate a specific variable to one side in an equation?

Firstly, I will integrate the equation using Simpson’s 3/8 Rule since it is quite long to do analytically. All the variables
(x, y, r, n, ps, k) are unknowns. I want to make r as the subject.
I tried exploring Collect(UMCAP,r) however it does not collect r but just giving the same answer. Is there any way how to ask Wolfram Alpha to “Collect r” (not solve) equation. I just want it to collect r for simplicity because after that I need to integrate the variable r and substitute into other equation. Thank you.

UMCAP=the long expressions

Here is the example:

Collect (ps^n (-(1/(24 ps))
    n (-k + r) y (((-k^2 + x (x + y/ps))/k)^(-1 + 
        n) + ((-r^2 + x (x + y/ps))/r)^(-1 + n) + 
       3 ((-(k + 1/9 (-k + r))^2 + x (x + y/ps))/(
         k + 1/9 (-k + r)))^(-1 + n) + 
       3 ((-(k + 2/9 (-k + r))^2 + x (x + y/ps))/(
         k + 2/9 (-k + r)))^(-1 + n) + 
       2 ((-(k + 1/3 (-k + r))^2 + x (x + y/ps))/(
         k + 1/3 (-k + r)))^(-1 + n) + 
       3 ((-(k + 4/9 (-k + r))^2 + x (x + y/ps))/(
         k + 4/9 (-k + r)))^(-1 + n) + 
       3 ((-(k + 5/9 (-k + r))^2 + x (x + y/ps))/(
         k + 5/9 (-k + r)))^(-1 + n) + 
       2 ((-(k + 2/3 (-k + r))^2 + x (x + y/ps))/(
         k + 2/3 (-k + r)))^(-1 + n) + 
       3 ((-(k + 7/9 (-k + r))^2 + x (x + y/ps))/(
         k + 7/9 (-k + r)))^(-1 + n) + 
       3 ((-(k + 8/9 (-k + r))^2 + x (x + y/ps))/(
         k + 8/9 (-k + r)))^(-1 + n)) + 
   1/24 (-k + r) (((-k^2 + x (x + y/ps))/k)^
      n + ((-r^2 + x (x + y/ps))/r)^n + 
      3 ((-(k + 1/9 (-k + r))^2 + x (x + y/ps))/(k + 1/9 (-k + r)))^
       n + 3 ((-(k + 2/9 (-k + r))^2 + x (x + y/ps))/(
        k + 2/9 (-k + r)))^n + 
      2 ((-(k + 1/3 (-k + r))^2 + x (x + y/ps))/(k + 1/3 (-k + r)))^n 
      + 3 ((-(k + 4/9 (-k + r))^2 + x (x + y/ps))/(k + 4/9 (-k + r)))^
       n + 3 ((-(k + 5/9 (-k + r))^2 + x (x + y/ps))/(
        k + 5/9 (-k + r)))^n + 
      2 ((-(k + 2/3 (-k + r))^2 + x (x + y/ps))/(k + 2/3 (-k + r)))^
       n + 3 ((-(k + 7/9 (-k + r))^2 + x (x + y/ps))/(
        k + 7/9 (-k + r)))^n + 
      3 ((-(k + 8/9 (-k + r))^2 + x (x + y/ps))/(k + 8/9 (-k + r)))^
       n)),r)

after I used Simplify, it become like this not that long comparing with the previous:

Collect (1/24 ps^(-1 + 
  n) (k - r) (n y (2 (-((2 k)/3) - r/3 + (3 x (ps x + y))/(
         ps (2 k + r)))^(-1 + n) + 
      3 (-((8 k)/9) - r/9 + (9 x (ps x + y))/(ps (8 k + r)))^(-1 + 
        n) + 2 (-(k/3) - (2 r)/3 + (3 x (ps x + y))/(
         ps (k + 2 r)))^(-1 + n) + 
      3 (-((7 k)/9) - (2 r)/9 + (9 x (ps x + y))/(
         ps (7 k + 2 r)))^(-1 + n) + 
      3 (-((5 k)/9) - (4 r)/9 + (9 x (ps x + y))/(
         ps (5 k + 4 r)))^(-1 + n) + 
      3 (-((4 k)/9) - (5 r)/9 + (9 x (ps x + y))/(
         ps (4 k + 5 r)))^(-1 + n) + 
      3 (-((2 k)/9) - (7 r)/9 + (9 x (ps x + y))/(
         ps (2 k + 7 r)))^(-1 + n) + 
      3 (-(k/9) - (8 r)/9 + (9 x (ps x + y))/(ps (k + 8 r)))^(-1 + 
        n) + (-k + (x (x + y/ps))/k)^(-1 + 
       n) + (-r + (x (x + y/ps))/r)^(-1 + n)) - 
   ps (2 (-((2 k)/3) - r/3 + (3 x (ps x + y))/(ps (2 k + r)))^n + 
      3 (-((8 k)/9) - r/9 + (9 x (ps x + y))/(ps (8 k + r)))^n + 
      2 (-(k/3) - (2 r)/3 + (3 x (ps x + y))/(ps (k + 2 r)))^n + 
      3 (-((7 k)/9) - (2 r)/9 + (9 x (ps x + y))/(ps (7 k + 2 r)))^
       n + 3 (-((5 k)/9) - (4 r)/9 + (9 x (ps x + y))/(
         ps (5 k + 4 r)))^n + 
      3 (-((4 k)/9) - (5 r)/9 + (9 x (ps x + y))/(ps (4 k + 5 r)))^
       n + 3 (-((2 k)/9) - (7 r)/9 + (9 x (ps x + y))/(
         ps (2 k + 7 r)))^n + 
      3 (-(k/9) - (8 r)/9 + (9 x (ps x + y))/(ps (k + 8 r)))^
       n + (-k + (x (x + y/ps))/k)^n + (-r + (x (x + y/ps))/r)^n)),r)