node.js

“npx tsc --version” reports different TypeScript version inside virtual machine

ぃ、小莉子 提交于 2021-02-09 02:57:48
问题 I want to be able to run npx tsc on my project on both my host + guest operating systems. But the guest is using a different (older) version of tsc - and I'm not sure where it's coming from. My setup: Host OS: Windows 10 Guest OS: Debian 9 I'm using VirtualBox, and the guest is mounting the host's files using VirtualBox's "shared folders" feature - so it doesn't have a separate copy of the project files - my project is accessed through shared folders at all times. I do NOT have Typescript

“npx tsc --version” reports different TypeScript version inside virtual machine

…衆ロ難τιáo~ 提交于 2021-02-09 02:56:09
问题 I want to be able to run npx tsc on my project on both my host + guest operating systems. But the guest is using a different (older) version of tsc - and I'm not sure where it's coming from. My setup: Host OS: Windows 10 Guest OS: Debian 9 I'm using VirtualBox, and the guest is mounting the host's files using VirtualBox's "shared folders" feature - so it doesn't have a separate copy of the project files - my project is accessed through shared folders at all times. I do NOT have Typescript

SQL tedious add array as parameter

爷,独闯天下 提交于 2021-02-09 02:49:07
问题 I'm running this SQL query with tedious.js using parameters: var query = "select * from table_name where id in (@ids)"; request = new sql.Request(query, function(err, rowCount) { if (err) { } }); request.on('row', function(columns) { }); var id = [1, 2, 3]; request.addParameters('ids', TYPES.Int, id); connection.execSql(request); because I am looking for items that matches the ID provided with where ... in ... clause, I need to pass in an array. However, there is no TYPES.Array. How do I this

MongoDB RangeError: attempt to write outside buffer bounds

那年仲夏 提交于 2021-02-09 01:25:25
问题 I am not receiving this error all the time but for specifics arrays. I am trying to insert a JSON object into mongodb collection using node.js mongodb native driver. This JSON object has couple of string attributes and a big string array attribute. Array could have thousands of string items. My JSON looks like this { FileName :"504-2345.txt", SIMs :["8931440400012","893144040001","4000130360507",.........] } Any idea when MongoDB throws RangeError: attempt to write outside buffer bounds?

MongoDB RangeError: attempt to write outside buffer bounds

纵饮孤独 提交于 2021-02-09 01:25:08
问题 I am not receiving this error all the time but for specifics arrays. I am trying to insert a JSON object into mongodb collection using node.js mongodb native driver. This JSON object has couple of string attributes and a big string array attribute. Array could have thousands of string items. My JSON looks like this { FileName :"504-2345.txt", SIMs :["8931440400012","893144040001","4000130360507",.........] } Any idea when MongoDB throws RangeError: attempt to write outside buffer bounds?

Pass npm script command line arguments to a specific script inside it

不打扰是莪最后的温柔 提交于 2021-02-09 00:47:31
问题 I have a scenario where I have to run three npm script to achieve some result in my application. I combined them in one npm script. This is my package.json : "scripts": { "setup": "npm install && npm run some-script && npm install", "some-script": "gulp some-other-script" } what I would like to do is to pass arguments to setup script from command line which will be passed further to the some-script script. If I run npm run script -- --abc=123 the arguments are added at the end of the script

五分钟看懂 Nginx 负载均衡

不打扰是莪最后的温柔 提交于 2021-02-09 00:08:54
👆 这是第 43 篇 不掺水的原创 ,想要了解更多 ,请戳上方蓝色字体: 政采云前端团队 关注我们吧~ 本文首发于政采云前端团队博客:五分钟看懂 Nginx 负载均衡 https://www.zoo.team/article/nginx 前言 对于电商平台而言,随着业务的不断发展壮大,网站访问量和数据量也随之急剧增长,该情况的产生给服务器带来了一定的负担。从用户体验层面而言,由于服务器端数据处理带来的时延,往往导致页面的响应速度过慢、操作流畅性受阻等问题。这在某种程度上甚至会潜在影响平台的成交量。提供高效率,高质量的服务成为亟待解决的问题。负载均衡策略的出现和发展成为缓解上述问题的有效途径。本文将带你了解基于 Nginx 实现的负载均衡。 什么是负载均衡 负载均衡(Load Balance),它在网络现有结构之上可以提供一种廉价、有效、透明的方法来扩展网络设备和服务器的带宽,并可以在一定程度上增加吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性等。用官网的话说,它充当着网络流中“交通指挥官”的角色,“站在”服务器前处理所有服务器端和客户端之间的请求,从而最大程度地提高响应速率和容量利用率,同时确保任何服务器都没有超负荷工作。如果单个服务器出现故障,负载均衡的方法会将流量重定向到其余的集群服务器,以保证服务的稳定性。当新的服务器添加到服务器组后

switch statement and scopes in ES2015

耗尽温柔 提交于 2021-02-08 23:45:47
问题 Consider this ES2015 module and the behavior when run in node v4.4.5. 'use strict' const outer = 1 switch ('foo') { case 'bar': const heyBar = 'HEY_BAR' break case 'baz': const heyBaz = 'HEY_BAZ' break default: const heyDefault = 'HEY_DEFAULT' } console.log( outer, // 1, makes sense, same top-level scope heyBar, // undefined. huh? I thought switch did NOT create a child scope heyBaz, // undefined. huh? I thought switch did NOT create a child scope heyDefault) // 'HEY_DEFAULT' makes sense This

switch statement and scopes in ES2015

£可爱£侵袭症+ 提交于 2021-02-08 23:44:52
问题 Consider this ES2015 module and the behavior when run in node v4.4.5. 'use strict' const outer = 1 switch ('foo') { case 'bar': const heyBar = 'HEY_BAR' break case 'baz': const heyBaz = 'HEY_BAZ' break default: const heyDefault = 'HEY_DEFAULT' } console.log( outer, // 1, makes sense, same top-level scope heyBar, // undefined. huh? I thought switch did NOT create a child scope heyBaz, // undefined. huh? I thought switch did NOT create a child scope heyDefault) // 'HEY_DEFAULT' makes sense This

switch statement and scopes in ES2015

☆樱花仙子☆ 提交于 2021-02-08 23:44:00
问题 Consider this ES2015 module and the behavior when run in node v4.4.5. 'use strict' const outer = 1 switch ('foo') { case 'bar': const heyBar = 'HEY_BAR' break case 'baz': const heyBaz = 'HEY_BAZ' break default: const heyDefault = 'HEY_DEFAULT' } console.log( outer, // 1, makes sense, same top-level scope heyBar, // undefined. huh? I thought switch did NOT create a child scope heyBaz, // undefined. huh? I thought switch did NOT create a child scope heyDefault) // 'HEY_DEFAULT' makes sense This