[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Node.js

131

Solutions

260

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 Nutanix / Dell 3 node environment, I have managed to change the host Ip addresses to a new subnet and I have also change the CVM ip addresses, but I am having problems finding a way to either change the Cluster IP address from the CLI or break the cluster and rebuild with new IP and name.   Can anyone help?  I am not that conversant with Linux so a simple explanation if possible to get this done.

Many thanks

E.
0
Acronis True Image 2019 just released!
LVL 1
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

I am trying to subtract time now() with data from mysql.
Over here, M_Start = "08:15:00"
Example Current = "22:02:39"
My intention is to get total seconds of the different.
While using moment function : error message : "ReferenceError: moment is not defined (line 22, col 9)"

var ST_Target;
var Shift_Target;

var M_Start = flow.get('Morning_start');
var M_Stop =flow.get('Morning_end');
var M_sec = flow.get('Morning_sec');

var M_cycle = flow.get("Cycle_Time");

var dt = new Date();
var hour = dt.getHours();
hour = ("0" + hour).slice(-2);

var minute = dt.getMinutes();
minute=("0" +minute).slice(-2);

var sec = dt.getSeconds();
sec=("0" + sec).slice(-2);

var current = hour+":" +minute+":"+sec;

var d = moment.duration(current.diff(M_Start[0]));

Open in new window

0
I'm trying to install PhoneGap CLI. When I run this
npm install -g phonegap@latest

Open in new window


I get this
phonegap CLI install error
I have reinstalled Node.js
The versions I have are
Node 10.11.0
npm 5.4.2 (installed when installing Node, I believe)

Can anybody help please?
0
2016 clustered environment . Nodes A crashed after a Ms path so it was rebuilt from an image of node B. I did make sure my ip's are correct.  Now im not able to Ping the private Network. Able to Ping one way only. Can ping from no B to node a. Cannot ping from node a two node be. This is after a crash where I had to rebuild node a from an image of node be. I have reset all settings but this one still has me confused any ideas.
Pings x.x.0.2 on nobe b to node a x.x.0.3 works.
Not working
Ping x.x.0.3  to x.x.0.2
Even isolated ping by typing.
Ping X.x.0.3 -S x.x.0.2
Still not pinging private network (heartbeat)
1
Hi,

In node red, while i insert the - timestamp datatype its work perfectly. while try to select data with the time stamp, its display different time.

Data insert in mariadb ----> 2018-09-19 23:47:26

While select data
if (Device > 0)
    msg.topic ="Select DeviceId, Line, outPIN, count,Time FROM mytab LIMIT 1";

return msg;

Open in new window


While try pull data out of mariadb the data timestamp show --> 2018-09-19 00:20:00
1
Hi I am selecting data from mysql database in node red: -

my database value are as follows:-
dbtime.png
Code in node red as follows: -
 msg.topic ="Select DeviceId, Line, outPIN, count,Time FROM mytab LIMIT 1"

Open in new window


In debug node i do get the time in different format and unable to store in different location of database.

9/17/2018, 4:59:29 PMnode: 4f250b1.97196f4
INSERT INTO mytable1 (DeviceId,Line,outPIN,count,Time) VALUES (?,?,?,?,?) : msg.payload : array[5]
[ 2, 1, "7", 1, "2018-09-16T13:28:24.000Z" ]
9/17/2018, 4:59:29 PMnode: d00874f1.76f388
msg : error
"Error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2018-09-16T13:28:24.000Z' for column 'Time' at row 1"

Open in new window



How i can format the time back to normal 'yyyy-mm-dd hh:mm:ss'
0
Hi,

I wanted to develop print solution for my web app : Web app to Desktop print appl using microsoft stack.

when someone press print button on web app, web app may send something like push notification as COMMAND to desktop application (User specific) and upon receipt of command Desktop print app can print the documents. If case of failure Desktop Print Application can send back information to web app about print failure.

To send push notification from web app to Desktop app,
can i use SignalR for sending user specific push notification ?

Please suggest :

1.Am i going in right direction.Whether the industry standards use same process like Google Print or PrintNode.

If not what technology/Process i can use for such application.
Initialy developing for one customer but need for multiple users.

regards,
0
Error message:  Node 'server' failed to form a cluster. This was because the witness was not accessible. Please ensure that the witness resource is online and available.

The virtual server is up and running and doesn't seem to have any problems but it will not become a part of the cluster.   The server node shows as being down and both the ISCSI connection and Public connections are down
0
Windows Cluster 2016 error , Node 1 unavailable after a restart (after installing Patch 1 for SQL cluster.) Pinged the IP and the IP is available , able to RDP to the server. Also all disk are up and running only issue is with NODE1 network its showing unavailable.
Please Advise.
0
Hello expert,

In UML (Unified Modeling Language) Activity Diagrams there are elements called fork
and join nodes. They are simply a black lozenge shapes  (see attached GIF) where several
parallel process merge (join) or split (fork).
This makes it necessary to have several arrows point to the fork or join node.
The node is created with a rounded rectangle.

The problem is the arrows only want to point to the rounded rectangle at the vertical and
horizontal mid points of the rounded rectangle. But the process arrows coming into the
join or fork could be a half dozen on each side.

Is there a way to make the fork or join node look like a comb on each side?
Join_node.jpg
0
OWASP: Threats Fundamentals
LVL 12
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

I know there's a ton of questions around date/time storage and formatting, but I'm struggling to get the right approach. My app is a Node.js app with Express using mongoose with a MongoDB backend. I'm using moment.js to format my date/times.

The schema in question looks like:

const stateSchema = new mongoose.Schema({
  changed: {
    type: Date,
    default: new Date()
  }
});

Open in new window

Based on the docs, I was expecting the date to be stored in UTC by default, but instead I see this:
changed: 2018-08-15 17:26:14.499

Open in new window

I'm displaying the date/time with something like (pug):

p= `Changed: ${moment(state.changed).format('MMMM Do YYYY, h:mm:ss a')}`

Open in new window

On localhost, the app shows "August 15th 2018, 5:26:14 pm" but on the hosted Heroku app I get "August 15th 2018, 10:26:14 pm." I am expecting "August 15th 2018, 5:26:14 pm" because I'm opening the Heroku app in the same timezone, but it looks like it's giving me the server timezone.

What should I do to make sure the date/time shows up in the client's local timezone?
0
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
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
Firewall Management 201 with Professor Wool
Firewall Management 201 with Professor Wool

In this whiteboard video, Professor Wool highlights the challenges, benefits and trade-offs of utilizing zero-touch automation for security policy change management. Watch and Learn!

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
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

Node.js

131

Solutions

260

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.