python – find out all the neighbor nodes of each node in a list and add edge if those neighbors have distance greater than a certain value

I have a graph G=(V,E). A list of nodes NODE subset of V. I want to find out all the neighbor nodes of each node in NODE and add edge if those neighbors have distance greater than 2. Is there any other efficient way of writing those loops to reduce the time complexity of this code so that complexity becomes quadratic time or less.

import networkx as nx
import random

G = nx.erdos_renyi_graph(30, 0.05)

node=()
for j in range(5): 
        node.append(random.randint(1,30))

for i in node:
    lst=list(G.neighbors(i))
    if(len(lst)>1):
         for j in range(len(lst)):
             for k in range(j+1,len(lst)):
                 if(len(nx.shortest_path(G,lst(j),lst(k)))>2):
                     G.add_edge(lst(j),lst(k))

bitcoin core – How do I get old blocks while running a pruned node?

Hello I’m trying to build a NodeJS app that fetches Bitcoin blocks, potentially old ones, and I’m running into issues. I’ve downloaded Bitcoin Core but I don’t have enough space to run a full node and so I opted to run a pruned one. However, when I go to query an old block it tells me that the block isn’t available in pruned mode. So my question is, why doesn’t Bitcoin Core query the block on the fly from another node if it doesn’t find it on disk? It clearly has the ability to do this, else how would it sync the blocks in the first place? If this is not possible with Bitcoin Core, could I build my own JS app that mimics the network calls used in the IBD to get blocks on demand, instead of saving them to disk? Also, I can’t use a 3rd party block explorer API because they don’t have all the features I want and they are less reliable.

8 – How to re-order node fields in views generated from ID?

I have a content type with fields: title, hours_worked, work_done.

I’ve created a view that gets the node ID from URL and outputs the fields of the target node: hours_worked and work_done. How do I introduce the ability to re-order which of the fields comes first in a drag and drop manner?

It’s similar to the functionality you get in Draggableviews/sortableiews/weight modules which are for re-ordering list of nodes but this requirement is for fields of specific node.

linux – can’t able to run node from wsl bash

I run linux Ubuntu on windows using “Windows Subsystem for Linux”.

I try to run node from wsl bash.

I get this error:

Command 'node' not found, but can be installed with:

sudo apt install nodejs

I have installed node on my windows 10.

But when I typing node.exe is works.

This is a problem since npm is not working (npm.cmd) and binary files like lerna run node without the ext.

So how to solve this problem?

enter image description here

8 – Re-order node fields in views generated from ID

Say my content type has fields: title, hours_worked, work_done. I want to be able to click a button that presents a views of the target node’s some of the fileds: hours_worked and work_done fields with the ability to re-order which comes first in a drag and drop manner. Drupal 7 has this in the field_weight module but it has no D8 version.

It’s similar to the functionality you get in Draggableviews/sortableiews/weight modules which are for re-ordering list of nodes but this requirement is for fields of specific node.

javascript – Node, Electron, ExcelJS, leer un archivo CSV dentro de una funcion

Intento leer un archivo CSV con node, electron y exceljs, este es el codigo:

var workbook = new Excel.Workbook();

let button = document.getElementById('button')
button.addEventListener('click', read, false)

async function read(){
    await workbook.csv.readFile("Excel.csv")
   .then(val => console.log(val))
}

Pero la consola no muestra ninguna respuesta, que ocurre?
Muchas gracias por las respuestas.

7 – How to pre-populate a text field when creating a new node?

I am using Drupal 7. I have a Content Type called Request. I have two fields “Manager Name” (type Text) and “Manager Email Address” (type Email). When the user creates a new node of type Request, I want to pre-fill these fields with “Hello World” and “nobody@yahoo.com”. Here is what I have tried so far (This is all in mymodule_form_node_form_alter):

$form('field_manager_name')('und')('#default_value') = "Hello World";
$form('field_manager_name')('und')('#suffix') = "Enter in the name of your immediate supervisor.";
$form('field_manager_email_address')('und')('#default_value') = "nobody@yahoo.com";
$form('field_manager_email_address')('und')('#suffix') = "Enter in the email address of your immediate supervisor.";

The two suffixes are working. When I create a new node of type Request, the suffix text appears under the field name, as expected. But the “default_value” fields are not working. What am I doing wrong?