Tag: c#

用CLiondebugging节点插件

我尝试使用node-mariasql ,它是对MariaDB的C ++客户端库的绑定。 为了更好的理解,我想使用CLion来debuggingDebian上的C ++部分。 现在,node-mariasql使用node-gyp作为构build自动化工具,而CLion只支持CMake,但仍然可以debugging程序吗? 我使用CLion的JavaScriptdebugging器来进入JavaScript客户端,但是当我到达C ++插件被调用的地方( 在这里例如)时,我看不到它在做什么,因为C ++debugging没有被设置。 我在这里有什么select?

使用node-nan在一个node.js模块中设置WindowsHookEx

我正在尝试创build一个Electron node.js应用程序,它可以使用全局键绑定执行某些function。 Electron中的全局键绑定API在游戏中不起作用,所以我需要创build一个监听这些低级别键事件的本地节点模块。 所以我使用node-gyp来编译visual studio 2015和nan的项目来提供节点和c ++之间的通信。 我已经设法让这个项目的两个方面分别工作(低级别的键绑定和node.js < – > nan通信),但是我很难将它们结合起来。 我也承认我有很less的经验与c + +(我没有写一个单一的c + +程序)。 #include "node_modules/nan/nan.h" using namespace std; using namespace Nan; HHOOK _hook; KBDLLHOOKSTRUCT kbdStruct; class KeyboardEventWorker : public AsyncProgressWorker { public: KeyboardEventWorker(Callback *callback, Callback *progress) : AsyncProgressWorker(callback), progress(progress) {} ~KeyboardEventWorker() {} LRESULT CALLBACK HookCallback(int nCode,WPARAM wParam,LPARAM lParam) { executionProgress->Send(reinterpret_cast<const char*>(nCode), […]

为什么“Isolate :: GerCurrent()”在asynchronous线程中为空?

我的最终目标是解决这个问题 ,但我陷入了一些非常基本的东西。 我的整个C ++模块基本如下: void AsyncWork(void *arg) { Isolate* isolate = Isolate::GetCurrent(); // isolate is NULL if (isolate != NULL) { HandleScope scope(isolate); } else { printf("isolate is null\n"); return; } // … } void testAsync(const FunctionCallbackInfo<Value>& args) { uv_thread_t id; int data = 10; uv_thread_create(&id, AsyncWork, &data); } void init(Handle<Object> target) { NODE_SET_METHOD(target, "testAsync", […]

如何从4096字节的subprocess拆分pipe道?

我正在使用child_process.spawn从nodejs脚本调用一个c ++程序。 c ++程序使用std :: cout将数据传回到nodejs脚本。 通常,这个程序pipe道返回长度超过4096字节的JSON。 我的节点脚本(或c ++程序?)将把这个JSON分成多个4096字节的块,这样child.stdout.on('data')被多次调用以获得单个响应。 有没有办法增加这个块大小,或让subprocess告诉我更多的数据是预期的?

TCP服务器只能在localhostscheme中使用

我可以在本地主机上的TCP客户端和TCP服务器之间build立一个TCP连接,但是我不能重复同一个networking范围内的不同计算机连接的示例(发件人Windows Server 2012 x64 R2和接收器Windows 10 x64 Pro) 。 TCP服务器是C#应用程序,TCP客户端在node.js中。 我已禁用防病毒和Windows防火墙。 //SERVER C# void Receive() { //tcp_Listener = new TcpListener(IPAddress.Parse("192.168.1.62"), 212); IPAddress localAddr = IPAddress.Parse("0.0.0.0"); tcp_Listener = new TcpListener(localAddr,212); TcpClient clientSocket = default(TcpClient); tcp_Listener.Start(); print("Server Start"); while (mRunning) { // check if new connections are pending, if not, be nice and sleep 100ms if (!tcp_Listener.Pending()){ […]

在Nodejs中创buildv8arrays的性能

我正在尝试将一个JSalgorithm移植到C ++中,以查看是否可以改进性能,但是在填充v8arrays时,我正面临着巨大的性能瓶颈。 这是一个片段,重现只是数组填充。 我创build了一个800k项目的数组,每个项目是17个数字的数组。 这个algorithm需要3秒才能在我的机器上执行,这是相当巨大的。 有反正加快吗? #include <node.h> namespace demo { using namespace v8; // just for lisibility of the example void Method(const FunctionCallbackInfo<Value>& args) { Isolate* isolate = args.GetIsolate(); Local<Array> array = Array::New(isolate, 800000); for (int i = 0; i < 800000; ++i) { Local<Array> line = Array::New(isolate, 17); for (int j = 0; […]

如何通过Linux机器上的nodejs应用程序运行C#代码?

我想(某人)build立一个可以添加logging的Web应用程序。 因此,应用程序将创build一个新的logging与用户的一些手动input,但一些数据是必要从文件中检索。 但是,此文件types的parsing器是使用C#构build的。 是否有可能:在应用程序中input手动input并保存,以便在数据库中创build新logging – >通过应用程序上载文件 – >应用程序告诉C#代码运行,parsing上传的文件并插入数据到数据库 – >应用程序收到任何潜在的错误消息,或者如果C#程序成功。 或者其他一些具有相似结果的逻辑。 可以这样做吗? 有没有比创build一个Web应用程序来实现相同的结果,我缺less一个更简单的解决scheme(远程input新的logging到数据库+文件uplad + C#parsing器的这个文件,然后插入数据到数据库)? 谢谢

在运行JS函数时,如何在c#中的Edgejs中获取错误文本?

我想在控制台应用程序的c#平台中运行一些JavaScript文件,例如: using System; using System.Threading.Tasks; using EdgeJs; class Program { public static async Task Start() { var func = Edge.Func(@" return function (data, callback) { var hello = function() { // some javascript syntax error … return ' Hello ' + data; }; callback(null, hello()); } "); Console.WriteLine(await func("Word!")); } static void Main(string[] args) { […]

Unity C#将float转换为字节数组并使用节点js读取

有人可以解释我怎么可以将一个float(Vector3.x)转换为一个字节数组与c#和解码与节点js? 我在互联网上读到Vector3.x是一个单一的数据types,使用4个字节(32位)。 我使用BitConverter将其转换为一个字节数组。 用Nodejs我使用readFloatBE()。 我不知道我在做什么错,但是我用console.log()节点js得到了一个不好的结果。 Unity csharp: public static int FloatToBit(int offset, ref byte[] data, Single number) { byte[] byteArray = System.BitConverter.GetBytes(number); for (int i = 0;i<4;i++) { data[offset + i] = byteArray[i]; } return 4; } 节点js readFloat: function (offset, data) { var b = new Buffer(4); for (var i = 0; i < […]

在C ++中重新解释Node.js fii的等价物

我试图在C ++中复制这个例子,我被困在读取数据的绝对最后一步。 exports.TF_ReadTensorData = function(tensor, size, type) { var ptr = libtensorflow.TF_TensorData(tensor); ptr = ptr.reinterpret(size, 0); ptr.type = type; return ptr.deref(); } 对于C ++,我已经完成了这一点。 #include <bits/stdc++.h> #include "tf_session_helper.h" #include "tf_session_helper.cc" #include "tf_tensor_helper.cc" #include "tensorflow/core/public/tensor_c_api.h" using namespace std; main() { TF_DataType::TF_UINT16; auto status = TF_NewStatus(); auto status_ops = TF_NewSessionOptions(); auto session = TF_NewSession(status_ops, status); std::ifstream in("graph.pb"); […]