lightning network – What parameters should I provide to make a direct payment with RPC?

I’m trying to send a direct payment on testnet from my node A to my node B. Both have only channels with public nodes, not between themselves, so that a route contains multiple hops.

I followed the Bidirectional-streaming RPC example from

//var dest_pubkey = <RECEIVER_ID_PUBKEY>;
var dest_pubkey = '03b4e78b999c4ff29508c5889f51852d9d5f04eae1e829e54010d26b49628b953f';

var dest_pubkey_bytes = ByteBuffer.fromHex(dest_pubkey);

var call = lightning.sendPayment();
call.on('data', function(payment) {
  console.log("Payment sent:");

call.write({ dest: dest_pubkey_bytes, amt: 11 });

I get the response

Payment sent:
  payment_error: 'invalid key length',
  payment_preimage: <Buffer >,
  payment_route: null,
  payment_hash: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>

from which I get the impression that I am providing the wrong pub key. Is my nodes public identifier which can be obtained by the identity_pubkey property from getinfo command?

When I use a Buffer instead of ByteBuffer:

var dest_pubkey_bytes = Buffer.from(dest_pubkey, 'hex');

instead of

var dest_pubkey_bytes = ByteBuffer.fromHex(dest_pubkey);

I don’t get the invalid_key_length error but an incorrect_payment_details error:

Payment sent:
  payment_error: 'incorrect_payment_details',
  payment_preimage: <Buffer >,
  payment_route: null,
  payment_hash: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>

from which I get the impression that I need provide other data in the request besides dest and amt. Do I need to add something more to the request? e.g. a keysend flag or something similar to lncli sendpayment —keysend

sending direct payment via cli works:

tlncli2 sendpayment --keysend --dest 033d4933c29885ab84cc5eacbcf3cd3bc87d3c36b36e81d9b09a0691946dfa3493 --amt 11


Amount + fee:   11 + 2.001 sat
Payment hash:   644beaa4aafbaa2c1c4bace2735c038446bfdaae6942e4900f511f1a0fbec1b1
Payment status: SUCCEEDED, preimage: 92a304c1c5b47afe887faf3e0e137d618c014a9d27edd6897b49411121c5d2e9

My nodes have version

lnd version 0.10.0-beta commit=v0.10.0-beta

How render view with programmatically passed parameters of contextual filter

I am using Drupal 8. Added new view My Vocabulary and created a contextual filter with paragraph ID. Now I need to render the view with passed parameters to contextual filter. What hook to use to solve my problem. Thanks.

list manipulation – Evaluate parameters before function uses them

I want to construct a power series:

LP(s_) := With({x = 1, R = 10, n = 1},
Sum(cc(i + n, n, x, R) s^i, {i, 0, 20}))

but it kinda takes a long time to compute the coefficients cc(…) although they depend on very quickly evaluated parameters b(…) (even for large i, n within 1s)

LoI(n_) := Array(k, n)
IB(r_, x_, R_) := {r, x, R}
cc(l_, n_, x_, R_) := 
Sum(Product(b(i, n, x, R)/i!, {i, LoI(n)}) 
KroneckerDelta(l, Sum(j, {j, LoI(n)})), 
Evaluate( Apply(Sequence, (IB(#, 0, l) & /@ LoI(n)))))


b(l_, n_, x_, R_) := 
With({a = 0.000001, m = 1}, 
NIntegrate(4 Pi r^2  m(a r Cos(r))^l, {r, x, R}))

and V() is an elementary function of a single variable so the integral is quickly evaluated.

Can I somehow make Mathematica compute the b()’s beforehand and then use them to compute the cc()’s? Or does it just take a long time because the combinatorics of the multidimensional sum are complicated (theres a multinomial coefficient)?

It seems like the computational costs for cc(l,n) comes from larger n (small n and large l also goes very easily) so maybe its more about the combinatorics in the sum.

Does this function constantly re-evaluate the b()’s and waste time?

dynamic – Estimation of parameters of limit cycles for systems of high-order differential equations (n> = 3)

There is a system of differential equations:

enter image description here

Then, call the limit cycle the projection of the phase trajectory onto the plane in a pairwise combination of state variables ($x-y,y-z,x-z$).

where $x,y,z$ – state variables, $a,b,c$ – constants.

Is it possible to use Mathematica to estimate the amplitude and frequency of the limit cycle? (it is possible by approximate numerical methods, most importantly, not graphical).

What is the correct way to call a PHP Function with multiple parameters from the AJAX Handler?

Q: What is the correct way to call a PHP Function with multiple parameters from the AJAX Handler?

Q: Am I calling the php function correctly?

Page Element
The user clicks a button.

The click should connect to an external server using the following params:

  1. User Name 2. IP Address 3. Port 4. Public Key 5. Service

Send an vote string (from host A) to an external Gaming server (host B).
I do not need to update any wordpress content.

WordPress Version: 5.4.1
I put my custom php code into “/wp-contents/plugins/my-plugin/votifier.php”

I made sure the custom plugin is activated.

I have WordPress in Debug mode. i.e. Debug mode is true.

The Button

<div id="frm_field_61_container">
<button type="button">Try it</button>

WordPress JQuery with AJAX

jQuery(document).ready( function($) {


         type : "post",

         dataType : "json",

         url : myAjax.ajaxurl,

         data : {    action: "my_vote_count"
                    ,username: $('input(name="item_meta(59)")').val()
                    ,key: $.trim($("#field_yjr62").val())
                    ,ip: $('input(name="item_meta(40)")').val()
                    ,port: $('input(name="item_meta(42)")').val()
                    ,service: "Votifier"

        success:    function(data,status,xhr){
                    alert("Data: " + data);
                    alert("Status: " + status);
                    alert("xhr: " + xhr);

My Custom PHP Script


function mainVotifier($username, $public_key, $server_ip, $port, $service_name) {

define( 'VOTE_FORMAT', 'VOTEn%sn%sn%sn%dn' );
define( 'PUBLIC_KEY_FORMAT', '-----BEGIN PUBLIC KEY-----n%sn-----END PUBLIC KEY-----' );

$key    = wordwrap($public_key, 65, "n", true);
$key    = sprintf(PUBLIC_KEY_FORMAT, $key);

  if (php_sapi_name() !== 'cli') {
            //Detect proxy and use correct IP.
            $address = isset($_SERVER('HTTP_X_FORWARDED_FOR')) ? $_SERVER('HTTP_X_FORWARDED_FOR') : $_SERVER('REMOTE_ADDR');
        } else {
            //Script is run via CLI, use server name.
            $address = $_SERVER('SERVER_NAME');

    $data = sprintf(VOTE_FORMAT, $service_name, $username, $address, time());
    openssl_public_encrypt($data, $crypted, $key);
    $socket = @fsockopen($server_ip, $port);

    if ($socket) {
        if (fwrite($socket, $crypted)) {
            return true;



/* ===== WP_ENQUEUE SCRIPTS ==== */

/* ===== JQuery Ajax Script to call votifier.php ==== */
add_action( 'wp_enqueue_scripts', 'my_script_enqueuer' );
function my_script_enqueuer() {

   wp_enqueue_script( 'my_voter_script',  plugins_url('sendvote.js', __FILE__), array( 'jquery'),   '1.0', true);

   wp_localize_script( 'my_voter_script', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));


/* ===== My AJAX Handler ==== */

/* add_action( 'wp_ajax_nopriv_my_vote_count', 'my_ajax_handler' ); */ 
add_action( 'wp_ajax_my_vote_count', 'my_ajax_handler');
function my_ajax_handler() {

/*  check_ajax_referer('votifier_response_key'); */

    $username       = $_POST("username");
    $public_key     = $_POST('key');
    $server_ip      = $_POST("ip");
    $port           = $_POST("port");   
    $service_name   = $_POST("service");

   echo "mainVotifier("" . $username . "", "" . $public_key . "", "" . $server_ip . "", "" . $port . "", "" . $service_name . "");";

    wp_die(); // All ajax handlers die when finished


Console Results

The console results are good, but the other server is not responding.
I tested the PHP code locally from my personal computer and Server B is responding.

Request URL:
Request Method:POST
Remote Address:
Status Code:

plotting – How to graph power law normalized for specific parameters?

I’m trying to plot the type-II superconductors power law for different values of its parameters. I’m currently using the next code. But I want specific values for n, not an iteration, for example, n=1,3,5,15,25,50. Also I want to plot as: J/J0 vs E/E0, but can’t manage to do it. I know it’s kinda silly, but I can’t find a way of doing it, having a little trouble with “:=” and “=” for plotting functions. Thanks in advance!

E0 = 4*10^-4;
  J0 = 1*10^3; 
  Elec(n_) := E0 (J/J0)^n

 Plot(Evaluate@Table(Elec(n), {n, 1, 25, 4}), {J, 0, J0}, 
 PlotRange -> All, 
 PlotLegends -> {"n=1", "n=5", "n=9", "n=13", "n=17", "n=21"}, 
 PlotStyle -> {Thick}, Frame -> True, GridLines -> Automatic)

An example of the graph i’m looking:
enter image description here

Could these URL tracking parameters be causing data discrepency between Facebook Ads and Google Analytics?


  • We’re seeing a lot of traffic from (direct) / (none) in GA whenever a Facebook Ads campaign is launched — it’s always the top source/medium pair.

  • In second place, there’s some fb / Facebook_Mobile_Feed etc. showing up, so it’s definitely registering. The direct drops a lot as soon as campaigns are paused.

We’ve tried: fixing GTM/pixel bugs, checking the URLs for redirects, or if something weird is going on our WordPress-SPA subdomain combo etc.

Could the following UTM template that’s been set up in Facebook be affecting this?


I typically set the utm_source as facebook, and medium as cpc, but that shouldn’t cause a data discrepancy like this, no?

plotting – How to plot multicolor phase daigram with three parameters?

enter image description here

I am trying to plot like the diagram given above. I have two nonlinear equations that I have separated in imaginary and complex forms (u1,v1, and x1,y1). As shown in the figure in the x-axis I want ‘p0’ which varies from (0,2.5*10^3) and in the y-axis, I want ‘del0’ which varies from (0,3) and inside the plot where rectangular color region box it is ‘NL=u1^2+v1^2’which varies from (0,6*10^7). I am trying this but unable to plot this type of diagram and gives me an error: “solve was unable to solve the system with inexact coefficients. The
the answer was obtained by solving a corresponding exact system and
numericizing the result. >>” Should I give another command to get this type of plot or anything else? If anyone can short it out will be appreciated.

A1 = 1;
B1 = 0;
delta = -1.5;(*Subscript((CapitalDelta), L) ; Laser-Lower polariton 
g0 = .315; (* Subscript(g, 0) ; vacuum optomechanical strength *)
ome = 3.014; (* (CapitalOmega) ; Rabi splitting *)
ome1 = .125; (* Subscript((CapitalOmega), m) ; mechanical 
resonator's frequency *)
kexc = 0.002;  (* Subscript((Kappa), exc  ;  )exciton decay rate*)
kk = .2;   (* (Kappa); cavity decay rate *)
gma = 0.00001;  (* (CapitalGamma) ; phonon dcay rate *)
ka = (kk + kexc)/2 - del0*(kk - kexc)/(2*ome);
Sol = NSolve({-delta*v1 - ka*u1/2 - (kk - kexc)*B1*g0*x1*u1/ome == 0, 
    delta*u1 + g0*(1 - del0/ome)*A1*x1*u1 + 
      p0*(1 - del0/(2*ome))/Sqrt(2) + p0*g0*B1*x1/(Sqrt(2)*ome) - 
      ka*v1/2 - (kk - kexc)*g0*x1*B1*v1/ome == 0, 
    ome1*y1 - gma*x1/2 == 
     0, -ome1*x1 + g0/2*(1 - del0/ome)*A1*(u1^2 + v1^2) + 
      p0*g0*u1*B1/(Sqrt(2)*ome) - gma*y1/2 == 0}, {u1, v1, x1, y1}, 
ContourPlot({Evaluate((u1^2 + v1^2)) /. Sol}, {p0, 0, 5}, {del0, 0, 
  3}, PlotLegends -> BarLegend({"LakeColors", {0, 6}}))

After running this code I am getting the plot. Which is not the same as above. I don't know what the problem with it?

settings – Initial battery parameters file location

Some while ago I was given a cheap android phone of “oriental” heritage that I decided to use to “teach” myself about the Android OS. I have over 20 years experience as a Linux systems admin so have a reasonable clear understanding of how things are put together. My initial schoolboy error was to delete the nvram without a backup, but with persistence and the judicial use of search engines I’ve got most things working again.

My current problem is with the battery. I am unable to get a full charge into the battery, and whatever charge I can get into the unit doesn’t last very long, at best perhaps half a day. I have looked at battery management and optimisers (batterystats.bin etc) but nothing seems to help. Now logic tells me that there must be some initial parameters stored somewhere in the filesystem that sets things such as battery capacity, charge rates and other such settings specific to that model, but I am unable to find anything that appears relevant. Assuming my logic to be correct, would anybody know the location of these files and what they might be named? Failing that, is there a way of tracing/logging the boot sequence so that I might be able to extrapolate these file locations. I would also appreciate if anyone could recommend some in depth documentation I could read how on the lower level functions of android operate, things like boot, device drivers, etc. As I have said, I’m reasonably competent with linux, the kernel, shell and such. Java? well I might be on a steep learning curve, but I do like a challenge.

Picking up parameters passed to aspx page in SharePoint Online

Using custom column formatting on a SharePoint Online list, I have dynamically built a URL that links to an aspx SitePage on the same SharePoint Online site.

However, I can’t find a way of picking up from the URL the parameters I included.

To provide some context, the target aspx page is a Web Part Page that currently displays a RADAR chart built using random numbers.

Instead of random numbers, I want it to receive the data from the selected list row and create the chart from those.

Is there a way of picking up these parameters, or is there a better approach to achieve this?

Many thanks