Node.js

110

Solutions

216

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 node that contains (america-germany) and  another node contain (america‐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(‐) in both node it say Equal,why can anyone help me
0
On-Demand: Securing Your Wi-Fi for Summer Travel
LVL 1
On-Demand: Securing Your Wi-Fi for Summer Travel

Traveling this summer?Check out our on-demand webinar to learn about the importance of Wi-Fi security and 3 easy measures you can start taking immediately to protect your private data while using public Wi-Fi. Follow us today to learn more!

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
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
Ultimate Tool Kit for Technology Solution Provider
Ultimate Tool Kit for Technology Solution Provider

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

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
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
Network Scalability - Handle Complex Environments
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

I am having an Angular build error.  This is the error I get.

ERROR in Error during template compile of 'AppModule'
  Function expressions are not supported in decorators in 'ɵ0'
    'ɵ0' contains the error at app\app.module.ts(35,23)
      Consider changing the function expression into an exported function.


Here is my app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormioAppConfig } from 'angular-formio';
import { FormioAuthService, FormioAuthConfig } from 'angular-formio/auth';
import { AuthConfig, AppConfig } from '../config';
import { AuthModule } from './auth/auth.module';

import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { HeaderComponent } from './header/header.component';
import { ApplicationModule } from './application/application.module';


@NgModule({
  declarations: [
    AppComponent,
    HomeComponent,
    HeaderComponent
  ],
  imports: [
    BrowserModule,
    RouterModule.forRoot([
      {
        path: '',
        redirectTo: '/home',
        pathMatch: 'full'
      },
      {
        path: 'home',
        component: HomeComponent
      },
      {
        path: 'auth',
        loadChildren: () => AuthModule
      },
      {
        path: 'application',
        loadChildren: () => ApplicationModule
      }
    ])
  ],
  providers: [
    FormioAuthService,

Open in new window

0
How can I remove an xml node from an XmlDocument object in c#?  For example, I want to remove <LastName> tag.....


Input:
<DataSet>
	<Person>
		<FirstName>Bob</FirstName>
		<LastName>Smith</LastName>
	</Person>
	<Person>
		<FirstName>Gina</FirstName>
		<LastName>Davis</LastName>
	</Person>
</DataSet>

Open in new window


Desired Result:

<DataSet>
	<Person>
		<FirstName>Bob</FirstName>
	</Person>
	<Person>
		<FirstName>Gina</FirstName>
	</Person>
</DataSet>

Open in new window



I'm using .NET Framework 3.5
0
I am using xml. query on the following xml

This node is the child of /PCRDATA/Activity
<Procedures>
      <Procedure>
        <EnteredBy ID="586807">XXXXXXXXXX</EnteredBy>
        <MedicationDosage>100</MedicationDosage>
        <MedicationDosageUnit ID="2835">MG</MedicationDosageUnit>
        <MedicationName ID="92">Ketamine</MedicationName>
        <MedicationRoute ID="2">IV - Push</MedicationRoute>
        <Procedure ID="Medication">Medication</Procedure>
        <ProcedureResponse ID="2">Unchanged</ProcedureResponse>
        <Comments>Ketamine, 100 MG via IV - Push given by xxxxxxxxxxxxxxxxxxxxxx). Pt. Response: Unchanged. </Comments>
        <ConsultEventID>xxxxxxxx</ConsultEventID>
        <EventID>2xxxxxxx</EventID>
        <ProcedureAuthorization>XXXXXXXXXX</ProcedureAuthorization>
        <ProcedureCrew>XXXXXXXXX</ProcedureCrew>
        <ProcedureDate>2018-01-17T19:53:00</ProcedureDate>
      </Procedure>

Open in new window


my query is as follows

value of @MedicationNameID1="92"


exec( 'declare @xml xml 
set @xml=(
  SELECT *
  FROM OPENROWSET(BULK'+ ''''+@FILENAME+''''+', SINGLE_BLOB) AS data
)
select 
@xml.query(''/PCRDATA/General/Outcome[@ID="'+@Disposition+'"]'').value(''.'', ''varchar(50)'') as DispDesc,
@xml.query(''/PCRDATA/General/DispatchedAs[@ID="'+@Nature+'"]'').value(''.'', ''varchar(50)'') as NatureDesc ,
@xml.query(''/PCRDATA/General/MedicalCategory[@ID="'+@MedCat+'"]'').value(''.'', ''varchar(50)'') as MedCatDesc,
@xml.query(''/PCRDATA/Actvity/Procedures/Procedure[1]/MedicationName[@ID="'+@MedicationNameID1+'"]'').value(''.'', ''varchar(50)'') as MedicationName1
' )

Open in new window


The value of MedicationName1 is blank.  I am expecting ketamine

Can someone point me in the right direction,  I am baffled.

Thank you
0
Hello. I am working on a node application.  I'm trying to use Passport for the log in.   I found an example online of what I want to do.  However I cannot get it to work.  I am running into an issue with my routes.  I get a compiler error that I have not seen before.  I tried to attached the project to this question, but it won't accept zip files so I will just attach my index.js and AuthController.js.  This is the error I get on index.js when it tries to do my first route.
 
var auth = require("../controllers/AuthController.js");

// restrict index for logged in user only
router.get('/', auth.home);

Open in new window

I get this error:  
index.js:349
throw new mongoose.Error.OverwriteModelError(name);
OverwriteModelError: Cannot overwrite `User` model once compiled.
at MongooseError.OverwriteModelError (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\node_modules\mongoose\lib\error\overwriteModel.js:18:11)
    at Mongoose.model (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\node_modules\mongoose\lib\index.js:349:13)
    at Object.<anonymous> (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\models\user.js:12:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require …
0
How do we have a completely clean DEV environment to write an application in Node / Angular / Bootstrap / ...? I am having trouble with CLI's and updates each time. Does anyone have a real Best Practice? I would like to take an environment that I have been hacking around in and clean it up, ready for a new project easily.  Ideally, I would love to see a script to run that will clean it all up in one shot.
0
I would like to have a list of all backup / archive of a node with its size.
I have a 30-day retention, I should have a list with the last 30 backup / archive done and their size
0

Node.js

110

Solutions

216

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
>