Node.js

117

Solutions

240

Contributors

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a Button within a react component that has five values tied to the "Survey" component state.  Within the button I have a property called "triggerSurveyUpdate" that when the user clicks the button it triggers the property in parent component App so that I can change conditional rendering with the App component.  Also when the user clicks the button I want to call a function "handleClick" which in turn calls a function named "surveysIn". "surveyIn" in turn then does an axios post to post  my values from the 'Survey' component to my Node back end. The problem is that if I put both "this.props.triggerSurveyUpdate" and "this.handleClick.bind(this)" within the Button tag then the first "this.props.triggerSurveyUpdate" gets called but then "this.handleClick.bind(this) does not fire.  If I put both "this.props.triggerSurveyUpdate and "this.handleClick.bind(this)" within the handleClick(e) function then the "this.props.triggerSurveyUpdate" does not fire.  How can do I get react to fire both "this.props.triggerSurveyUpdate and "surveysIn" such that I am able to post values from the "Survey" component state to my back end and then also trigger the property "this.props.triggerSurveyUpdate" so that I can do my conditional rendering in my "App" component.  Below is my code for my Survey component.

import React, { Component } from 'react';
import {Slider} from 'primereact/components/slider/Slider';
import {Button} from 'primereact/components/button/Button';
import surveysIn 

Open in new window

0
KuppingerCole Reviews AlgoSec in Executive Report
KuppingerCole Reviews AlgoSec in Executive Report

Leading analyst firm, KuppingerCole reviews AlgoSec's Security Policy Management Solution, and the security challenges faced by companies today in their Executive View report.

HEllo,

I have an xml wihich i am try to extract data from.  It looks like this:

declare @xmlData xml = '
<BPSD-registret><Measurement2018>
<naza_bpsd><CarePlan>Hi</CarePlan>'+
  '<Actions>'+
    '<Current>'+
      '<Action>'+
        '<id>124</id>'+
        '<msr_id>405397</msr_id>'+
        '<activity>qdq</activity>'+
        '<when>d</when>'+
        '<where>qdw</where>'+
        '<how>dsf</how>'+
        '<whom>sdfsdf</whom>'+
        '<duration>sdfsdf</duration>'+
        '<estimations>'+
        '<estimation>2</estimation>'+
        '</estimations>'+
        '<measures/>'+
      '</Action>'+
      '<Action>'+
        '<id>125</id>'+
        '<msr_id>405397</msr_id>'+
        '<activity>Aaaa</activity>'+
        '<when>jklj</when>'+
        '<where>lk</where>'+
        '<how>jlk</how>'+
        '<whom>j</whom>'+
        '<duration>lkj</duration>'+
        '<estimations>'+
          '<estimation>1</estimation>'+
        '</estimations>'+
        '<measures>'+
          '<measure>1</measure>'+
          '<measure>2</measure>'+
          '<measure>3</measure>'+
        '</measures>'+
      '</Action>'+
    '</Current>'+
    '<Previous/>'+
  '</Actions>'+
'</naza_bpsd>'+
'</Measurement2018></BPSD-registret>' ;

Open in new window


I can extract and save the content of each <action> node using the following code:

insert into BPSD_MeasurementActions
select
a.value('(activity)[1]', 'nvarchar(500)' ) as act_Activity,
a.value('(when)[1]', 'nvarchar(500)' ) as act_When,
a.value('(where)[1]', 'nvarchar(500)' ) as act_Where,
a.value('(how)[1]', 'nvarchar(500)' ) as act_How,
a.value('(whom)[1]', 'nvarchar(500)' ) as act_With,
a.value('(duration)[1]', 'nvarchar(500)' ) as act_HowLong
from @xmlData.nodes('/BPSD-registret/Measurement2018/naza_bpsd/Actions/Current/Action') Actions(a)

Open in new window


The table BPSD_MeasurementActions has an identity column called Id (Integer).  

The problem is that the node <measures> has now been added to the xml.  I need to save the values of each <measure> node.   Therefore there is a one to many relationship with the <action> node and i need to save these values in a details table.  The value of Id from BPSD_MeasurementActions will be the foreign key.

Any sugestions on how i can traverse this xml and do the appropriate insertions?
0
Why use AngularJS instead of NodeJs

I would like to know why you should use AngularJS instead of NodeJS seeing that NodeJS can  fetch the Data from the Database server and present it to end user browser. I have seen some AngularJs videos where they use arrays and some code to present data on the browser, I have not seen any example where the Angular connect to the Database...
I thought probably NodeJs can do the same thing Angular does, with easier code.

Reading online, I see Angular is described as Framework ,whereas NodeJs is a Library...but do they achieve the same thing ?

Thank you
0
Hi

After researching heavily on why the delete query was failing in MS Access FE/SQl Server BE over the net and reading other IT books, it seems like the foreign key is cantered on the issues below:
INSERT and UPDATE Specification Category
I expanded the node to show information for the Delete Rule and the Update Rule for the relationship.
Delete Rule
It says specify what happens if a user tries to delete a row with data that is involved in a foreign key relationship:
•      No Action An error message tells the user that the deletion is not allowed and the DELETE is rolled back.
•      Cascade Deletes all rows containing data involved in the foreign key relationship. Do not specify CASCADE if the table will be included in a merge publication that uses logical records.
•      Set Null Sets the value to null if all foreign key columns for the table can accept null values.
•      Set Default Sets the value to the default value defined for the column if all foreign key columns for the table have defaults defined for them.
Update Rule
It says specify what occurs if a user tries to update a row with data that is involved in a foreign key relationship:
•      No Action An error message tells the user that the update is not allowed and the UPDATE is rolled back.
•      Cascade Updates all rows that contain data involved in the foreign key relationship. Do not specify CASCADE if the table will be included in a merge publication that uses logical records.
•      Set Null Sets the value to null if all …
0
Guys,

I need Help i am trying to add my failed Exchange Server 2010 to a DAG but when i ran the command in the image and getting the error. Please for your assistance.Adding-to-Cluster.JPG
0
i have a node that contains (america-germany) and  another node contain (america&#x02010;germany),when i check for this node are equals or not it say it is not Equal, i am using java with dom parser ,but when i put entity value(&#x02010;) in both node it say Equal,why can anyone help me
0
I have glassfish app on my Linux red hat 6.
I cant start my glassfish node it gives me next error :

There is a process already using the admin port 5858 -- it probably is another instance of a GlassFish server.Command start-domain failed.

But when i run comman in linux " netstat -tulnp | grep 5858 " It shows me:

tcp :::5858 LISTEN 47256/java

Port used by java app. But i cant log in to my glassfish interface.

How can i solve this issue, any expierenced specialist with glassfish maybe can help.
0
sir i have a list :that contain some value : after i am geeting node content value: and cheak that node content value contains list value or not:but i am getting exception because list not converted to charsequence : my code is List<String> xx = new ArrayList<String>(); xx.add("Van"); xx.add("Von"); xx.add("Le"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document d = builder.parse(file); d.getDocumentElement().normalize(); String[] s = xx.toArray(new String[xx.size()]); NodeList ndlist = d.getElementsByTagName("personName"); for (int i = 0; i < ndlist.getLength(); i++) { Node node = ndlist.item(i); NodeList nl = node.getChildNodes(); for (int j = 0; j < nl.getLength(); j++) { Node node1 = nl.item(j); if (node1.getNodeName().equals("givenNames")) { Element element = (Element) node1; String str = element.getTextContent().toUpperCase(); if(str.contains(xx))//error list cannot convert to charsequence { //some opration } } }
0
I'm currently doing a small from which only contains a html5 pages .. index.html.

Currently I am adding the javascript code to the actual page between script tags.

What I want to do is to create an ES6 module and import it to to this index.html page.

But I want to do this without having to use node, angular or react in a project.

What is the easiest ay to do this with my layout?
0
I have xml  as clob in table request_detail where xml is stored in column detail :

<?xml version="1.0" encoding="UTF-8"?><ns2:OrderServiceRequest xmlns:ns2="ca/abc/com/integration" xmlns="ca/abc/oms/autotype/omscommonrequest" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cil="http://cil.int.abc.ca" xmlns:io="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:io10="ca/abc/com/integration" xmlns:io11="http://www.w3.org/2005/08/addressing" xmlns:io12="ca/abc/oms/autotype/productavailability" xmlns:io13="ca/abc/oms/autotype/cancelorder" xmlns:io14="ca/abc/oms/autotype/submitrequest" xmlns:io15="ca/abc/oms/autotype/omscommonresponse" xmlns:io16="ca/abc/oms/autotype/billingRetrieve" xmlns:io17="ca/abc/oms/autotype/locationmanagement" xmlns:io18="http://www.w3.org/2003/05/soap-envelope" xmlns:io19="ca/abc/oms/autotype/productconfiguration" xmlns:io2="http://www.ibm.com/websphere/sibx/smo/v6.0.1" xmlns:io20="ca/abc/oms/autotype/omscommonrequest" xmlns:io21="wsdl.http://cil.int.abc.ca" xmlns:io22="ca/abc/oms/orderretrieval" xmlns:io3="http://www.ibm.com/xmlns/prod/websphere/mq/sca/6.0.0" xmlns:io4="ca/abc/oms/autotype/omscommon" xmlns:io5="ca/abc/oms/autotype/qualification" xmlns:io6="ca/abc/oms/customerprofile" xmlns:io7="http://cil.int.abc.ca" xmlns:io8="http://CILNBOMFCustomerOrderMod" xmlns:io9="http://www.ibm.com/xmlns/prod/websphere/http/sca/6.1.0" xmlns:ns0="wsdl.http://cil.int.abc.ca" xmlns:ns3="ca/abc/oms/autotype/omscommon" 

Open in new window

0
Powerful Yet Easy-to-Use Network Monitoring
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

I'm having trouble with some odd routing behavior when I build my angular app in preparation for deployment. When I run the app locally using 'ng serve', navigation works just fine and everything seems to be ready for deployment. However after I run 'ng build --prod' and the dist folder is generated, if I launch the index.html navigation is broken in the following ways:

If I refresh the page, it fails to load (resulting in 404)

If I attempt to navigate to a page that uses a different component than the landing page it fails to load (404)


I have tried these suggested solutions:
Change the base href in index.html to <base href = "./">
Change AppModule providers to include {provide: LocationStrategy, useClass: HashLocationStrategy}
Change App.Routing to include RouterModule.forRoot(routes, {useHash: true})
0
I am using Nodejs in an electron project.

This question is about Nodejs and the request module

My question is, how do I post a file to a url using this module?
0
I tried to npm uninstall -g is not working.

First I had tried npm ls -g --depth=0 it produced the following results

  /usr/local/lib
  ├── UNMET PEER DEPENDENCY @babel/core@7.0.0-beta.4
  ├── @babel/node@7.0.0-beta.44
  ├── aws-cli@0.0.2
  ├── babel-core@6.26.0
  ├── babel-loader@7.1.4
  ├── babel-plugin-transform-decorators-legacy@1.3.4
  ├── babel-plugin-transform-object-rest-spread@6.26.0
  ├── babel-plugin-transform-optional-chaining@7.0.0-beta.3
  ├── babel-preset-react@6.24.1
  ├── babel-preset-stage-3@6.24.1
  ├── babel-register@7.0.0-beta.3
  ├── coffeescript@2.2.4
  ├── graceful-fs@4.1.11
  ├── minimatch@3.0.4
  ├── n@2.1.8
  ├── npm@5.8.0
  ├── ntdl@1.0.2
  ├── pdf-compress@1.0.0 -> /home/ubuntu/workarea/sourcecode/pdf-optimise
  ├── virtualenv@0.3.1
  ├── UNMET PEER DEPENDENCY webpack@2 || 3 || 4
  └── yarn@1.5.1

  npm ERR! peer dep missing: @babel/core@7.0.0-beta.44, required by
  @babel/node@7.0.0-beta.44
  npm ERR! peer dep missing: webpack@2 || 3 || 4, required by babel-
  loader@7.1.4
  npm ERR! peer dep missing: @babel/core@7.0.0-beta.44, required by
  @babel/register@7.0.0-beta.44
  npm ERR! peer dep missing: webpack@>=0.9 <2 || ^2.1.0-beta || ^2.2.0,
  required by worker-loader@0.8.1
  }
Then I had tried uninstalling it didn't succeeded

  root@ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/ntdl# sudo npm
  uninstall -g @babel/node@7.0.0-beta.44
  up to date in 0.063s

  …
0
Hi Experts,

I get the following error when I run babel-node

Please see the error below


root@ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/ntdl# babel-node node/react-render.jsx

/usr/local/lib/node_modules/@babel/core/node_modules/@babel/template/lib/builder.js:86
      throw err;
      ^

Error: Unknown substitution "BODY" given
    at /usr/local/lib/node_modules/@babel/core/node_modules/@babel/template/lib/populate.js:22:15
    at Array.forEach (<anonymous>)
    at populatePlaceholders (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/template/lib/populate.js:20:31)
    at /usr/local/lib/node_modules/@babel/core/node_modules/@babel/template/lib/string.js:20:51
    at /usr/local/lib/node_modules/@babel/core/node_modules/@babel/template/lib/builder.js:83:14
    at spec (/home/ubuntu/workarea/sourcecode/ntdl/node_modules/babel-plugin-transform-es2015-for-of/lib/index.js:159:20)
    at PluginPass.ForOfStatement (/home/ubuntu/workarea/sourcecode/ntdl/node_modules/babel-plugin-transform-es2015-for-of/lib/index.js:72:21)
    at newFn (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:223:21)
    at NodePath._call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:64:19)
    at NodePath.call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:38:17)
    =============
    at exports.default …
0
I want to get the DOM code from a web page in a given url.

Right now I have been trying jQuery:

$.get( "http://localhost/test.html", function( data ) {
  console.log(data);
});

Open in new window


But it's just giving me the actual source code and not the code given after the page is executed in the browser.

There are some variable values that are only displayed when in the DOM and not shown in the source code so I need to get the code in the DOM.

How can I do this?
0
I am using this code for submitting a file using jQuery:

$(document).ready(function() {
    $('form').submit( function() {
        $.ajax({
            type: 'post',
            url: 'http://localhost/test/upload.html',
            data:{file},
            success: function (data) {
                alert("done")
            }
        })
    })
})

Open in new window


The problem I am facing is that I am not getting the messages (either successful or error messages) given by the page.

How can I change this code so that it returns error or successful messages given by the upload.html page?
0
Hi,
I have code in angular i want to modify it improve it is it possible to find some freelancer to first look at that code and tell me the cost to modify it.


Thanks
1
I am trying to write some code where I have the ParentPage.html and ChildPage.html

On ChildPage.html I have a form:

<form>
  First name:<br>
  <input type="text" name="firstname" value="">
  <br>
  Name:<br>
 
  <input type="submit" value="Submit">
</form> 

Open in new window



Both pages are on my localhost.

I need to add some code on ParentPage.html that with hit the submit button on ChildPage.html

Can this be done using NodeJs? If so how?
0
Hello.

I am learning Node JS with Visual Studio Code from Microsoft. Here is the Javascript file:

«test3.js»:

const express = require('express')
const app = express()
const port = 9999

app.get('/', function (request, response) {
  response.send('Allo de Express!')
})

app.listen(port, function (err) {
  if (err) {
    return console.log('Oups! Une erreur est survenue', err)
  }

  console.log(`À l'écoute sur le port ${port}`)
})

I had installed «express» with this command:

PS C:\Users\jean\Documents> npm -g install express
+ express@4.16.3
added 1 package, updated 2 packages and moved 2 packages in 11.24s

PS C:\Users\jean\Documents> cd node_modules
PS C:\Users\jean\Documents\node_modules> ls


    Répertoire : C:\Users\jean\Documents\node_modules


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       29/03/2018     14:59                bytes

There no directory for the module «express». Where is it?

When I execute the Javascript file, I get an error:

PS C:\Users\jean\Documents> node test3.js
module.js:549
    throw err;
    ^
Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\jean\Documents\test3.js:1:79)
    at Module._compile …
0
The Ultimate Tool Kit for Technolgy Solution Provi
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

I'm having trouble wrapping my head around a clients DAG config.  They have a 5 Node DAG, 3 MBX servers in Primary Site and 2 MBX in Secondary site, no FSW.  Cluster Quorum is Node Majority.  When Primary site goes down, DAG copied in Secondary site goes Offline as Quorum is lost. What can I configure to have the DAG Copies in the Secondary site to stay operational?  Even if I put a FSW in the Secondary Site, the Cluster will ignore is because it's a 5 node cluster.
0
Hi Experts,

      I had tried installing Canvas with NPM.  Installation is not succeeding.  I get the following error

c:\...\node_modules\canvas\src\Canvas.h(19): fatal error C1083: Cannot open include  file: 'cairo.h': No such file or directory (compiling source file ..\src\CanvasGradient.cc)
 [C:\...\pdf-optimise\node_modules\canvas\build\canvas.vcxproj]

I had followed the steps mention at this url  https://github.com/benjamind/delarre.docpad/blob/master/src/documents/posts/installing-node-canvas-for-windows.html.md

Please help me in resolving this. issue

With Many Thanks,

Bharath AK
0
We have a 2 node Server 2012 R2 cluster with a number of file server clustered roles installed and balanced across the nodes

On one of these network drives if anyone tries to open an office file that is in use then we get a message saying the file cannot be opened.  Nothing further.  No option to open read only or anything like that.  Just bam. Can't open.

We have failed the role over to the other node, rebooted the node... nothing.

The other roles are fine.  Office files can be opened as read only if someone else has it open.

Any help would be greatly appreciated.
0
what happens at every step of our network model, when a node on one network establishes a TCP connection with a node on another network. You can assume that the two networks are both connected to the same router...... how it works?
0
I'm interested to know what languages are the best to learn or learn more of.  
I have a pretty good understanding of PHP.  I also know some Javascript and am taking a course through Udemy to further understand it.  Right now I have time to learn/study a little.  What would be the best things to know and understand? Node, API, advanced CSS???  What are your thoughts?
0
Hi Experts,

       I am working on an web application (wagtail cms) like django-cms, which is in aws ubuntu.  Its backend is postgres, with elastic search few modules reactjs and nodejs.
The application is deployed in docker containers.  uwsgi is the upstream server for nginx.

      I get lots of errors with npm build, i am not able to run the application.  sometimes ports are not accessible. postgres is using 5432, elasticsearch is 9200. react is rendering on 9009. I get lots of dependencies error.    At what situation I have to use dockers?  sometimes I get errors in nginx configuration. could please tell what is good practice for npm build, run deploy.  

    What is the best way to architect the development and test environment?

    Will I be able access the postgresql, elastic search and nginx in linux ubuntu on aws with cms source code and contents on windows local pc?   or having the copy of postgresql, elastic search, cms contents and nginx all on a windows pc as development environment environment.   Elastic search has huge data.  and how to deploy the application on dockers in linux environment.

    What is the best way to have a development environment?  what is best test environment

   could you please tell me on how elastic search data is stored on postgres and what is network host setting in elastic search how it accessed from outside application.

    Could you please throw light on how to create development and test environment.

with …
0

Node.js

117

Solutions

240

Contributors

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Top Experts In
Node.js
<
Monthly
>