javascript – Data can’t be Filter using Node js

I am trying to filter out empty array but its not happening

  • I was trying to compare value which are present inside my database and fileName
  • I tried arr.filter(Boolean);
  • even i tried
  • List item arr.filter((item)=>item)

PS: fileName is not an array value so I converted it into array.

function checkDoc(data, childProduct, fileName, pathName, req, res) {
  return new Promise((resolve, reject) => {
      raw: true,
      where: {
      .then((productDoc) => {
        if (productDoc.length === 0) {
          return resolve(addDocument(data, childProduct, fileName, pathName));
        } else {
          let fileArray = ();
          productDoc.forEach((singleProduct) => {
            let productValue =;
            let unMatchedValues = fileArray.filter((value) =>
            let removedBoolean = unMatchedValues.filter((item) => item);
            console.log("Document Name: ", removedBoolean);
      .catch(function (err) {
        return reject("Can't be added please try again :) " + err);

attached Output Image :

enter image description here

tokens – How can I watermark images with a taxonomy term from the node they belong to?

I’m working on a site for a business who would like to watermark all their product photos with the brand name of the product (which is a taxonomy term reference field on the product content type).

Looking into this, I found a variety of modules that will watermark images in various ways, but most expect to just put a single image or text overlay on all images of a given style, which is not what I need here.

The one exception I found was Textimage, which works with the Image Effects module and, at least in theory, supports node tokens. But when I tried out those two modules, I was unable to get any token for the taxonomy field in question to work. I tried (node:field_brand) and (node:field_brand:entity:name) without success — it just put the text of the token instead of replacing it with the brand. Other tokens, like (node:title), did work, but not the one I wanted (even though it was in the list of available tokens).

I posted to the issues queue for Textimage, but it doesn’t seem like anyone’s monitoring it regularly, and I’m on a deadline.

Does anyone know either how I can get the node replacement to work in Textimage, or alternatively any other way of doing this? I’m not at all wedded to Textimage and Image Effects — they’re just the only modules thus far that claim to be able to do what I need to do.

Problema para aparecer os dados da API com Node no Front

Estou montando um gráfico em Chart.js e preciso pegar os dados com uma API em Node, mas não está dando certo, segue o index.js:

const express = require('express')
const morgan = require('morgan')
const cors = require('cors')
const bodyParser = require('body-parser')
const routes = require('./config/routes')
const axios = require('axios')

const app = express()

app.use(bodyParser.urlencoded({extended: false}))

app.listen(21262, () => {
    console.log(`Express started at http://localhost:21262`)

o routes.js que ele faz citação é o seguinte código:

const { default: axios } = require('axios')
const express = require('express')
const routes = express.Router()

let db = (
    {memory: "(5,4,5,1,6,4,7,2.8,5,4.7,6)"},
    {xMemory: "('1','2','3','4','5','6','7','8','9','10','11')"}

routes.get('/', async(req, res) => {
    return res.json(db)
})'/add', (req, res) => {
    const body = req.body

    if (!body) {
        return res.status(400).end()

    return res.json(body)


routes.delete('/:id', (req, res) => {
    const id =

    let newDB = db.filter(item => {
            return item

    db = newDB

    return res.send(newDB)

module.exports = routes

O arquivo dos gráfico é esse, onde na função getContent() no console.log(memory, xMemory) retorna como "undefined":

const api_url = `http://localhost:21262/`

async function getContent() {
    try {
        const response = await fetch(api_url)
        const data = await response.json()
        const {memory, xMemory} = data
        console.log(memory, xMemory)
    } catch (error) {


async function chartIt() {
    await getContent();
    let memoryChart = new Chart(document.getElementById("memory-chart"), {
        type: 'line',
        data: {
            labels: xMemory,
            datasets: (
                    label: 'Memory',
                    borderColor: '#00a389',
                    cubicInterpolationMode: 'default',
                    tension: 0.4,
                    data: memory
        options: {
            maintainAspectRatio: false,
            elements: {
                line: {
                    borderWidth: 4
                point: {
                    radius: 0
            plugins: {
                legend: {
                    display: false
            scales: {
                x: {
                    display: false,
                y: {
                    display: false,

How to open lightning network channel to a selected node in Electrum?

Electrum (version 4.1.2) Open Channel dialog only contains a dropdown "Trampoline" with predefined entries. How a new channel can be opened to a specific node?

Electrum Open Channel Dialog

godot – How do I change a sprite using code from another node?

I’m trying to make a program in Godot where the player can put a bunch of images into a folder, and when the button is pressed, have the image appear as a sprite on the screen. With the current code, the directory for the image is printed when the button is pressed, but the image sprite simply does not appear. No error messages come up either, so I’m stumped as to what the problem is. Here is the code:

extends Button

func _pressed():
    var cards_order = () #creates the array
    var path = "assets/cards/" #defines a path
    var dir = #creates a directory #sets the directory to the defined path
    dir.list_dir_begin() #begins listing the directory
    while true:
        var file_name = dir.get_next() #sets the var "file_name" to the next entry in the directory
        if file_name == "":
        #break the while loop when get_next() returns ""
        elif !file_name.begins_with(".") && !file_name.ends_with(".import"):
        #get_next() returns a string so this can be used to load the images into an array. Also stops .import files from being added
            cards_order.append(load(path + file_name)) #loads the next file into the array
    randomize() #changes the randomization
    cards_order.shuffle() #shuffles the array
    var card_sprite = cards_order.front() #sets card_sprite as the first item in the array
    $"/root/CardSprite".texture = load(card_sprite.get_path())

Any help with this would be greatly appreciated!

replication – Store Elasticsearch shards in separate permissions on data node

I have an Elasticsearch cluster configured with one head node and three data nodes with the number of replicas set to 2. The data nodes are each split into three partitions called /data1 /data2 and /data3; the disk on each data node is partitioned. Elasticsearch is storing all the shards in the /data1 partition on each data node. The system has been working fine but now I want to add a new index and the /data1 partitions do not have space to store the new shards.

How can I instruct the cluster to store the new shards on different disk partition?

I looked at /etc/elasticsearch/elasticsearch.yml on the head node and is set to /var/lib/elasticsearch. How do I modify to use a different partition on the data nodes?

commerce – Using rules to Flag a Product Display Node on Checkout

Every user is supposed to purchase Particular product only once.

So i have a view to list the Product Display which by using FLAG module i can list only Unflagged Product Display nodes (Products which are yet to be purchased).

The issue now is how to use Rules to Flag the Product Display node on checkout Completion.

Note: i am using Drupal 7.

Your help will be appreciated.

Pass a webform value to a node via Rules?

I have a rule that is successfully creating a node of a content type when a webform is submitted. How do I pass a value from the webform into the created node via rules? (This is a Drupal 7 site.)

navigation – Node edit – large menu management options

I have a site with about 800 pages in the main menu.
When creating or editing a node, managing the menu item parent can be challenging with a select list containing so many options!

I am using Big Menu [] to manage the menu within the menu edit areas. Is there something similar I can do with the node edit page?
Or some other option to make selecting a node’s menu parent a little easier?

How To Solo Mine Bitcoin With a Full Node?

I have a full node running bitcoind, and I am wondering how to solo mine using BFGMiner, CGminer or similar software.

since my reputation does not allow me to post my answer to another question… I want to add my answer here to help other people in my situation.


BFGMiner supports solo mining with any GBT-compatible bitcoin node (such as
bitcoind). To use this mode, you need to specify the URL of your bitcoind node
using the usual pool options (–url, –userpass, etc), and the –generate-to
option to specify the Bitcoin address you wish to receive the block rewards
mined. When you run Bitcoin Core on the same computer as your miner, the pool
itself will be automatically configured for you (on the default goal). Please be
aware that solo mining via GBT is at this time only supported for Bitcoin.

IMPORTANT: If you are solo mining with more than one instance of BFGMiner (or
any other software) per payout address, you must also specify data using the
–coinbase-sig option to ensure each miner is working on unique work. Note
that this data will be publicly seen if your miner finds a block using any
GBT-enabled pool, even when not solo mining (such as failover).

If your bitcoin node does not support longpolling (for example, bitcoind 0.8.x),
you should consider setting up a failover pool to provide you with block
notifications. Note that solo mining does not use shares, so BFGMiner’s adjusted
hashrate (third column) may suddenly drop to zero if a block you submit is
rejected; this does not indicate that it has stopped mining.

Example solo mining usage:

bfgminer -o http://localhost:8332 -u username -p password
–generate-to 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh
–coinbase-sig “rig1: This is Joe’s block!”

If you want to solo mine on multiple GBT-compatible Bitcoin blockchains, you can
specify –generate-to multiple times with a goal name prefix followed by a
colon. Note that at this time, the coinbase sig is always shared across all

Example multi-blockchain solo mining usage:

bfgminer -o http://localhost:8332 -u username -p password
–generate-to 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh
-o http://localhost:7221 -u user2 -p password –pool-goal mychain
–generate-to mychain:1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh
–coinbase-sig “rig1: This is Joe’s block!”