6,245 questions
427
votes
13
answers
461k
views
What is the difference between depth and height in a tree?
This is a simple question from algorithms theory.
The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concrete ...
109
votes
14
answers
103k
views
How to delete/create databases in Neo4j?
Is it possible to create/delete different databases in the graph database Neo4j like in MySQL? Or, at least, how to delete all nodes and relationships of an existing graph to get a clean setup for ...
108
votes
5
answers
247k
views
Why is NULL undeclared?
I have a problem with this struct contructor when I try to compile this code:
typedef struct Node
{
Node( int data ) //
{
this->data = data;
previous = NULL; // Compiler ...
84
votes
7
answers
338k
views
How to restart kubernetes nodes?
The status of nodes is reported as unknown
"conditions": [
{
"type": "Ready",
"status": "Unknown",
"lastHeartbeatTime": "2015-11-12T06:03:19Z",
...
83
votes
2
answers
189k
views
Node.js server that accepts POST requests
I'm trying to allow javascript to communicate with a Node.js server.
POST request (web browser)
var http = new XMLHttpRequest();
var params = "text=stuff";
http.open("POST", "...
80
votes
6
answers
52k
views
Graph auto-layout algorithm
To simplify the problem, I have a graph that contains nodes and edges which are on a 2D plane.
What I want to be able to do is click a button and it make the automatically layout the graph to look ...
70
votes
12
answers
62k
views
How to swap DOM child nodes in JavaScript?
What is the easiest way to swap the order of child nodes?
For example I want childNode[3] to be childNode[4] and vice-versa.
61
votes
5
answers
33k
views
What is the difference between a node and a vertex?
What is the difference (if any) between a node and a vertex? I can't find the answer after looking at countless sites! Even my book doesn't specify it so I am kind of lost!
It is worth mentioning ...
55
votes
2
answers
57k
views
How get Environment Variables from lambda (nodejs aws-sdk)
We can set up Environment Variables in aws-lambda for example via AWS SAM:
Environment:
Variables:
TABLE_NAME: !Ref Table
How can I get this variables from current lambda via Node JS AWS-...
39
votes
1
answer
28k
views
Which is correct Node.js architecture?
I am little bit confused about the architecture of Node.js
First one is correct or second ?
Because in second diagram each call passes through V8 first and then Node.js Bindings, But in first one it's ...
39
votes
1
answer
24k
views
What is the difference between node.nextSibling and ChildNode.nextElementSibling?
<div id="div-01">Here is div-01</div>
<div id="div-02">Here is div-02</div>
Aren't they the same thing ?
Both returning the immediately followed node. I read a lot of ...
38
votes
4
answers
67k
views
What is a node in Javascript?
I was wondering what exactly a node is in JavaScript?
As in the functions:
element.nodeType
row.parentNode.removeChild(row);
35
votes
3
answers
20k
views
NPM run parallel task, but wait until resource is available to run second task
In npm, how can I run two or more parallel tasks, but waiting for the resource that the first task will create to be available to the second task to use it, and so forth?
example (conceptual):
npm ...
34
votes
4
answers
25k
views
How can one modify the outline color of a node In networkx?
I am relatively new to networkx and plotting using matplotlib.pyplot and would like to know how to modify the color (or other attributes such as weight) of a node's outline. By "outline" I don't mean ...
33
votes
5
answers
50k
views
Typescript - Cannot find module 'http' on Visual Studio Code
i'm using Visual Studio Code for NodeJS and Typescript development.
If I'm writing this code:
import * as http from 'http';
The compile says error TS2307: Cannot find module 'http'.
How to handle ...
31
votes
10
answers
71k
views
Running Jenkins job simultaneously on all nodes
TLDR: I want to be able to run job simultaneously on multiple nodes in Jenkins pipeline. [ for example - build application x on nodes dev, test & staging nodes based on aws ]
I have a large group ...
30
votes
2
answers
52k
views
How to replace the text of a node using DOMDocument
This is my code that loads an existing XML file or string into a DOMDocument object:
$doc = new DOMDocument();
$doc->formatOutput = true;
// the content actually comes from an external file
$doc-&...
29
votes
6
answers
34k
views
Nodejs, express routes as es6 classes
I want to clean up my project a bit and now i try to use es6 classes for my routes. My problem is that this is always undefined.
var express = require('express');
var app = express();
class Routes {
...
28
votes
3
answers
84k
views
In-order iterator for binary tree [closed]
How can I write a Java iterator (i.e. needs the next and hasNext methods) that takes the root of a binary tree and iterates through the nodes of the binary tree in in-order fashion?
27
votes
5
answers
35k
views
Jenkins node connection troubles
Hi i have got the following error but my node is up and in jenkins logs everything is ok but on some of my jobs which are going on the nodes i've got the following trouble
12:59:29 [EnvInject] - ...
26
votes
6
answers
40k
views
js find object in nodeList?
Fallback is irrelevant. No libraries, please.
We have an dom object reference, we'll call obj. It's actually an event.target.
We have a node list, we'll call nodes, which we've gotten with ...
26
votes
7
answers
14k
views
Mix CommonJS and ES6 modules in same project
I am working in NodeJS. I have a great deal of legacy code including several packages that are used in many places. This code is all CommonJS, Node require() module structures.
Node now supports ES6. ...
25
votes
1
answer
3k
views
How to reshape a networkx graph in Python?
So I created a really naive (probably inefficient) way of generating hasse diagrams.
Question:
I have 4 dimensions... p q r s .
I want to display it uniformly (tesseract) but I have no idea how ...
24
votes
2
answers
80k
views
Getting the parent node attributes in XSL
In my XML I have the following:
<a>
<b>
<c something="false">
<d>
<e>
<f>someResult</f>
</e>
</d>
...
23
votes
6
answers
59k
views
Drawing graphs on java [closed]
I want to draw graphs (nodes and edges) in Java. However, since I don't know how to go about it, I would like to have some advice before starting.
How should I do this?
use Graphics2D package, right?...
23
votes
1
answer
57k
views
How do you create XML nodes using Java DOM?
How can I create the below XML using Java DOM, I want to create it from scratch. Is there any way?
I don't want to read it and clone it, I just want to create it by DOM methods.
Java Example:
Node ...
22
votes
5
answers
139k
views
How can I find a specific node in my XML?
I have to read the xml node "name" from the following XML, but I don't know how to do it.
Here is the XML:
<?xml version="1.0" standalone="yes" ?>
<games>
<game>
<...
22
votes
6
answers
45k
views
failed to garbage collect required amount of images. Wanted to free 6283487641 bytes, but freed 0 bytes
I have searched many websites and articles but not found any perfect answer. I am using eks version 1.18. I can see a few of the pods are "Evicted", but when trying to check the node I can ...
22
votes
2
answers
11k
views
label nodes outside with minimum overlap with other nodes/edges in networkx
I am trying to create a graph with node labels printed outside of nodes. I am able to generate 'offset' as shown below that solve the purpose. However, Sometimes the labels overlaps with edges (Which ...
21
votes
3
answers
18k
views
excluding nodes from qsub command under sge
I have more than 200 jobs I need to submit to and sge cluster. I'll be submitting them into two ques. One of the ques have a machine that I don't want to submit jobs to. How can I exclude that machine?...
20
votes
8
answers
20k
views
How can I remove all nodes from a scenekit scene?
Hi I am trying to remove all nodes from my Scenekit scene but I cannot for the life of me figure out a way.
It seems logical to me that there must be a function for doing this automatically but I ...
20
votes
6
answers
19k
views
Speeding up xpath
I have a 1000 entry document whose format is something like:
<Example>
<Entry>
<n1></n1>
<n2></n2>
</Entry>
<Entry>
...
19
votes
4
answers
60k
views
Add new attributes to an existing XML node in java?
I want to add an attribute to an existing xml node.I don't want to add new elements (new nodes) to my xml file, I just want to add a new attribute. How can I do this?
In particular I've tried this ...
19
votes
1
answer
44k
views
Show d3 node text only on hover
I'm trying to only show the node text on mouseover. When I mouseover the node, I have the opacity for the svg circle changing, but only the text for the first node showing up. I've figured out that ...
18
votes
6
answers
25k
views
Create node list from a single node in JavaScript
This is one of those it seems so simple, but I cannot come up with a good way to go about it.
I have a node, maybe nodelist = document.getElementById("mydiv"); - I need to normalize this to a node ...
18
votes
1
answer
6k
views
Get graphviz to draw nodes above edges
Is there any way to force graphviz to always draw the nodes above edges even if the edge is drawn over (or preferably under) the node?
So far I have tried ordering them and different layer options ...
17
votes
6
answers
39k
views
hadoop/hdfs/name is in an inconsistent state: storage directory(hadoop/hdfs/data/) does not exist or is not accessible
I have tried all the different solutions provided at stackoverflow on this topic, but of no help
Asking again with the specific log and the details
Any help is appreciated
I have one master node ...
17
votes
7
answers
13k
views
Apollo GraphQL Server + TypeScript
I've been working on a project lately, which has node.js + express + typescript + Apollo server stack. And while researching on Apollo client, I've stumbled upon TypeScript section. But nothing like ...
17
votes
6
answers
5k
views
How To Develop A Database Schema For A Tree Structure(Directed acyclic graph)
I'm using below tree structure and planning to develop a db schema for the below.
What I have development up to now is below,
The problem I'm having is if I search for Y, below tree should be ...
16
votes
3
answers
9k
views
How to use user-defined class object as a networkx node?
Class point is defined as (there are also some methods, atributes, and stuff in it, but this is minimal part):
class point():
def ___init___(self, x, y):
self.x = x
self.y = y
So, ...
15
votes
3
answers
34k
views
Is there a way to take away focus in javafx?
I know that your can give focus to a node in javafx by doing node.requestFocus(); but is there a way to take away focus from a node in javafx or prevent focus on an object?
15
votes
3
answers
355
views
How to keep Nil from reverting container to its default value?
I'm implementing a simple linked list and to denote the fact that there is no next node, I'm using the value Nil. The thing is that when assigned to a container, Nil will attempt to revert the ...
15
votes
1
answer
7k
views
Distribute nodes on the same rank of a wide graph to different lines
I have a graph (organigram) how this:
digraph G {
nodesep=0.3;
ranksep=0.2;
margin=0.1;
node [shape=rectangle];
edge [arrowsize=0.8];
1 -> 2;
1 -> 3;
1 -> 4;
1 -> 5;
1 -> 6;
1 -> 7;
...
15
votes
4
answers
3k
views
Algorithm for finding all of the shared substrings of any length between 2 strings, and then counting occurrences in string 2?
I've run into an unusual challenge and so far I'm unable to determine the most efficient algorithm to attack this.
Given the following 2 strings as an example, find all commonly shared substrings ...
14
votes
2
answers
33k
views
Mongoose/Mongo find in array of objectIds
I have this item in mongo:
[
{
title: 'Product Name',
_id: 5052843e023273693300013c,
description: 'This is a fake description',
categories: [ 5052843e023273693300010a ],
}
]
I ...
14
votes
1
answer
36k
views
different between "getDocumentElement" and "getFirstChild"
I have the following Document object - Document myDoc.
myDoc holds an XML file by...
myDoc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(file);
Now I want to get the ...
14
votes
1
answer
129k
views
Creating a node class in Java
So I'm fairly new to Java and programming and I was wondering how to create a node class?
So far I have:
public class ItemInfoNode{
private ItemInfoNode next;
private ItemInfoNode prev;
...
14
votes
1
answer
11k
views
How to make kubernetes work with dynamic ip address
I have created a kubernetes cluster where I have a master node and two worker nodes. I initialised master node using below command
sudo kubeadm init --token-ttl=0 --apiserver-advertise-address=192....
13
votes
3
answers
47k
views
The non-generic type 'System.Collections.IEnumerable' cannot be used with type arguments
using System.Collections.Generic;
public sealed class LoLQueue<T> where T: class
{
private SingleLinkNode<T> mHe;
private SingleLinkNode<T> mTa;
public LoLQueue()
{
...
13
votes
4
answers
9k
views
nvm use fails in windows with a user name containing space
My issue is related to this problem from 3 years ago.
nvm-windows fails when the user path contains a space
However, none of these solution help me. My user folder name is Sunita Dahal.
I ...