小编Mit*_*tul的帖子

如何在Windows上的Node.js中运行hello.js文件?

我试图在一个名为hello.js的单独文件中运行用javascript编写的hello world程序

目前正在运行node.js的windows版本.

代码在控制台窗口中运行完美,但如何在Windows环境中引用该路径.

C:\abc\zyx\hello.js
Run Code Online (Sandbox Code Playgroud)

在Unix中我猜它显示$ node hello.js

我是Node.js的新手.如果我做错了,请纠正我.

我试过了

> node C:\abc\zyx\hello.js ----没用

> C:\abc\zyx\hello.js - 不行

UPDATE1:

将node.exe添加到hello.js文件所在的文件夹中.
添加了文件夹c:\ abc\zyx \的路径点,我收到一条错误消息

ReferenceError:未定义hello

看到hello.js的内容

setTimeout(function() {
console.log('World!');
}, 2000);
console.log('Hello');
Run Code Online (Sandbox Code Playgroud)

更新2:

到目前为止,我已经尝试了所有这些版本,但它们似乎都没有用.可能是我做错了.

>node hello.js
>$ node hello.js
>node.exe hello.js
>node /hello.js
>node \hello.js
> \node \hello.js
> /node /hello.js
> C:\abc\xyz\node.exe C:\abc\xyz\hello.js
> C:\abc\xyz\node.exe C:/abc/xyz/hello.js
> hello.js
> /hello.js
> \hello.js
>node hello
Run Code Online (Sandbox Code Playgroud)

请参阅我的文件结构

在此输入图像描述

已解决:请 尝试使用以下选项在命令提示符下运行,而不是运行node.exe.

c:\>node c:\abc\hello.js
Hello
World! (after 2 secs)
Run Code Online (Sandbox Code Playgroud)

windows node.js

295
推荐指数
5
解决办法
79万
查看次数

如何在事件中使用RxJs和Socket.IO

我想在我的内部使用RxJS socket.on('sense',function(data){});.我很困惑并且很少使用可用的文档和我对RxJS缺乏了解.这是我的问题.

我有一个distSensor.js函数pingEnd()

function pingEnd(x){
socket.emit("sense", dist); //pingEnd is fired when an Interrupt is generated.
}
Run Code Online (Sandbox Code Playgroud)

我的App.js里面有

io.on('connection', function (socket) {
    socket.on('sense', function (data) {
        //console.log('sense from App4 was called ' + data);
    });
});
Run Code Online (Sandbox Code Playgroud)

感知功能获取了大量我想用RxJS过滤的传感器数据,我不知道接下来我应该怎么做才能使用RxJs.任何指向正确文档或示例的指针都会有所帮助.

javascript sockets rxjs

16
推荐指数
3
解决办法
1万
查看次数

为什么使用QueueClient和MessageFactory?

在Azure Service Bus中,您可以使用QueueClient和发送代理消息MessageFactory.我想知道你为什么要用一个而不是另一个.

azure azureservicebus azure-servicebus-queues

13
推荐指数
1
解决办法
3817
查看次数

如何为Azure RM订阅设置默认存储帐户

我想Azure的认购室(组Get-AzureRMSubscription)CurrentStorageAccount到特定的手臂存储账户(Get-AzureRmStorageAccount),我无法找到一个cmdlet时做到这一点.

使用常规的旧azure cmdlet,我可以执行以下操作来将CurrentStorageAccount设置为

$subscription = Get-AzureSubscription
Set-AzureSubscription -SubscriptionName $subscription.SubscriptionName -CurrentStorageAccountName "somestorageaccount"

Get-AzureSubscription | select * 
Run Code Online (Sandbox Code Playgroud)

这套就是它.但我不能在手臂cmdlet内做这个.

令人困惑的另一件事是我使用相同的订阅,例如.Visual Studio Enterprise.使用arm和常规cmdlet get-azuresubscription我得到相同的订阅,但为什么一个显示-CurrentStorageAccount而另一个订阅没有显示-CurrentStorageAccount.

powershell azure azure-powershell azure-resource-manager azure-storage-account

11
推荐指数
2
解决办法
6405
查看次数

在用于python的visual studio工具中点击ctrl + F5后,控制台窗口立即关闭

我已经为Visual Studio安装了Python工具,当我按下以下快捷键时,在visual studio中运行C#控制台应用程序时,我看不到控制台窗口中的输出,就像我看到输出一样.

F5 - 开始调试程序并在c#和Python中关闭控制台窗口
Ctrl + F5 - 在没有调试的情况下启动,在C#中按预期工作,但在Python程序中没有.它始终在两个选项下退出控制台窗口.

Python应用程序有第三个选项" Python Interactive中的Execute Project ".此选项有时会产生输出,有时则不会.

在运行程序后,我该怎么做才能看到控制台窗口中的输出和窗口不应该关闭?对于python控制台应用程序,这甚至是可能的还是一些概念上的差

我在这里做错了吗?

python visual-studio-2010 ptvs

7
推荐指数
1
解决办法
5226
查看次数

我可以从PowerShell访问My Custom .NET Class吗?

关于PowerShell和.NET类,我有几个疑问和疑问.

我正在尝试写一个类'foo',它将调用Rest Web服务并执行一些任务.如果我在GAC中部署该类,那么我可以从PowerShell调用它吗?

.net c# powershell web-services

6
推荐指数
1
解决办法
5147
查看次数

为什么我在PowerShell sort -unique Count中获得此输出

我键入以下命令来找出有多少独特的对象,它给了我5.我不知道为什么这给了5.

> $var = @(2,4,2,5,3,6,34,6,3,6,4,6,3,5,5,353,5343,5,3,56,34)  
>$var | sort -Unique  
2  
3  
4  
5  
6  
34  
56  
353  
5343  
>$var | sort -Unique Count  
5
Run Code Online (Sandbox Code Playgroud)

powershell

4
推荐指数
1
解决办法
6807
查看次数

Get-AzureRMVmImage cmdlet未列出所有可用的vm映像

我正在尝试使用AzureRM获取所有可用的VM映像Get-AzureRMVMImage,它不会列出任何图像,如命令Get-AzureVMImage

如果我按照帮助中给出的示例,Get-AzureRMVmImage那么它不会列出该Ubuntu VM.下面是我试图获取Windows 2012 R2 Datacenter Image.

PS C:\> Get-AzureRMVMImage -location "Central us" -publisherName "Microsoft" -offer "Windows Server 2012 R2 DataCenter"
Get-AzureRmVMImage : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-AzureRMVMImage -location "Central us" -publisherName "Microsoft"  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzureRmVMImage], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.Compute.GetAzureVMImageCommand
Run Code Online (Sandbox Code Playgroud)

使用参数列出可用的RM vm图像的正确cmdlet是什么?

azure azure-virtual-machine azure-powershell azure-resource-manager

4
推荐指数
1
解决办法
3289
查看次数

Azure 应用服务中的授权规则不起作用

我按照此博客文章中的说明尝试启用主页的匿名访问,并在使用此 authorization.json 访问 /Admin 页面时重定向到 Google。

{
  "routes": [
    {
      "path_prefix": "/",
      "policies": { "unauthenticated_action": "AllowAnonymous" }
    },
    {
      "path_prefix": "/Admin",
      "policies": { "unauthenticated_action": "RedirectToLoginPage" }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

当我访问主页 @ http://mysite.azurewebsites.net/ 时,它总是将我导航到登录页面。在我登录然后发布重定向后,我在日志流中遇到以下错误。

2016-12-02T04:30:44  PID[11016] Verbose     [Routes(Preview)] Attempting to load configuration from 'D:\home\site\wwwroot\authorization.json'.
2016-12-02T04:30:44  PID[11016] Critical    System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type Microsoft.Azure.AppService.Routes.RoutesConfig. Encountered unexpected character 'ï'. ---> System.Xml.XmlException: Encountered unexpected character 'ï'.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
   at System.Runtime.Serialization.Json.XmlJsonReader.ReadAttributes()
   at System.Runtime.Serialization.Json.XmlJsonReader.ReadNonExistentElementName(StringHandleConstStringType elementName) …
Run Code Online (Sandbox Code Playgroud)

json azure azure-web-app-service

3
推荐指数
1
解决办法
1220
查看次数

如何处理不同版本的源代码?

最初我们没有使用任何源代码控制软件.现在我们使用TFS 2010进行版本控制.目前,我们面临的问题涉及如何使用正在开发的生产代码和代码处理更改.

假设我们使用带有源代码x的visual studio 2010发布了1.0版本的Web.现在我们继续研究源代码以实现更多功能.Noow源代码已更改为x.something.

在此期间,我们收到用户报告的错误.现在如何处理这种情况,因为必须在源代码版本x中修复错误.我们不想使用x.something版本,因为它几乎没有未完成的功能,我们不想在生产中发布.

这时建议的做法是什么.

是否有两个存储库用于不同版本的源代码?如果是,那么当然后如何修复错误 - 首先更新当前版本或发布的代码,因为我们不希望这些错误存在于当前的开发版本中.

version-control visual-studio-2010 tfs2010

2
推荐指数
1
解决办法
764
查看次数