[nodejs] Re: How to free memory after require(JSON) ?

2017-09-20 Thread Andrey
On Wednesday, 20 September 2017 13:36:10 UTC+10, Валерий Дубчак wrote: > > Node version 8.5.0 > There are 100 JSON files of 8 mb each. > I read them in the node: > > var files = fs.readdirSync ('./ path /'); > > files.forEach (filename => { > > var data = require ('./ path /' + filename); > data

[nodejs] Re: Hot reload plugin for node.js

2017-07-31 Thread Andrey
I have very similar module - https://github.com/sidorares/hot-module-replacement The only difference is that I'm trying to use same API as webpack where possible - `module.hot.accept`, `module.hot.decline`, `dispose/addDisposeHandler` -

[nodejs] Just released AnyChart integration templates for data visualization with NodeJS and MongoDB

2016-12-23 Thread andrey . khachaturov
Hi all, We, AnyChart JS Charts , have just published 21 integration templates to help web developers even more easily create interactive

[nodejs] Re: JSON.parse(Buffer) works! Is that true?

2016-02-03 Thread Andrey
Its converted to string first, see spec at http://www.ecma-international.org/ecma-262/5.1/#sec-15.12.2 For example, this results in [1, 2, 3] array : > var qqq = {} undefined > qqq.toString = function () { return "[1, 2, 3]"; } [Function] > JSON.parse(qqq) Buffer.toString is defined here:

[nodejs] Re: How sync is require()?

2015-11-05 Thread Andrey
On Friday, 6 November 2015 08:39:12 UTC+11, Ingwie Phoenix wrote: > > Hey folks. > > While developing a function that lets me require() custom files, I took > the original JS and jSON "loaders" as examples. > > But what I saw within the JS version confused me: It didn’T return a > thing! >

Re: [nodejs] Re: Why siege test showing PHP is performing better than Node

2015-02-28 Thread Andrey
I'll outline some difference between your php and node implementation and share my results 1) Apache runs multiple workers / threads. You'll need to use cluster in your node script to match this. 2) mysql_connect in php does implicit connection pooling. Use createPool() in node script My

[nodejs] Re: Why siege test showing PHP is performing better than Node

2015-02-20 Thread Andrey
Are you sure you have 100 rows in your prod_master? try to replace query with select * from prod_master limit 100 200 rps seems to be too low for 100 rows of data On Saturday, 21 February 2015 06:29:16 UTC+11, Anirban Bhattacharya wrote: So, I made changes to code of node. 1. I removed

Re: [nodejs] Why siege test showing PHP is performing better than Node

2015-02-19 Thread Andrey
On Thursday, 19 February 2015 09:01:42 UTC+11, Aria Stewart wrote: On Feb 18, 2015, at 1:53 PM, Anirban Bhattacharya anirbanbhat...@gmail.com javascript: wrote: This is my node code var http = require('http'); var mysql = require('mysql'); var connection =

[nodejs] Re: How do you do reflection with Node.js since this object is empty?

2015-02-08 Thread Andrey
At top level this is a reference to exports object (and has nothing in common with global scope ): https://github.com/joyent/node/blob/v0.12/lib/module.js#L460 On Monday, 9 February 2015 14:34:11 UTC+11, Leo Cono wrote: How do you do reflection with Node.js since this object is empty? --

[nodejs] Re: how can i programmatically access v8 debugger variables list

2015-01-29 Thread Andrey
variables on exception: https://gist.github.com/sidorares/9181766 And example how to connect using built-in debugger: https://gist.github.com/sidorares/5bf04ccfb86aee6897fe Andrey On Friday, 30 January 2015 00:51:33 UTC+11, Leo Cono wrote: http://stackoverflow.com/questions/28216265/how-can-i

[nodejs] Re: Any way to capture errors from vm.runInNewContext?

2014-12-10 Thread Andrey
no. You are only creating context, not full sandboxed JS environment. The code is called from the same event loop and functions you have in your context are same regular functions as in the rest of the code. All possible solutions are same as for how do I handle async errors question. Use

[nodejs] Re: DNS (Get/Set)

2014-12-04 Thread Andrey
No idea about Win32 and not sure if there is cross-platform solution, but for Linux you can interface to NetworkManager or Connman using one of node dbus clients ( disclaimer: I'm author of https://github.com/sidorares/node-dbus ) On Thursday, 4 December 2014 04:01:33 UTC+11, Martin Beaudet

Re: [nodejs] child_process pause/resume

2014-12-02 Thread Andrey
I want to sep through my child_process code like a debugger. I read this as I want to have link between child and parent and control logic of the child. With child_process.fork() you already have this link, exposed as on('message')

[nodejs] Re: Pure SQLite Implementation in Nodejs?

2014-11-20 Thread Andrey Gershun
You can try Alasql (https://github.com/agershun/alasql) - it is pure JavaScript server, which works in browsers and Node.js as well. Here is an example, how to use it in Node.js: var alasql = require('alasql'); var db = new alasql.Database(); db.exec(CREATE TABLE test (one INT,

[nodejs] Re: Buffer vs String

2014-09-16 Thread Andrey
Strings are very optimized in v8, so just replacing hot path string with buffer does not always help - benchmark first, ideally at a very low level ( statistical profiler / dtrace / generated assembly / irhydra ). For example, if you do `content += chunk` in a loop you are likely not copying

[nodejs] Re: node-tick-processor problem in v0.11.13

2014-09-15 Thread Andrey
version (or use command-line switch) Also please read https://github.com/sidorares/node-tick/issues/10 Andrey On Monday, 15 September 2014 10:52:37 UTC+10, Michael Monashev wrote: Hi! After updating Node from v0.10.31 to v0.11.13 I can't effectively use --prof flag and node-tick-processor

[nodejs] Re: Node.js increase Memory

2014-08-04 Thread Andrey
If you are using same algorithm then 2x difference Java vs JS is not something surprising, I would expect this. How do you compute top 10? With built-in Array.search + slice(0,10) I get ~2500ms and if I use binary heap tree ( https://github.com/tjfontaine/node-binaryheap ) (push every element

[nodejs] Re: Node.js Domain Will Not Catch Custom Event Emitted

2014-06-11 Thread Andrey
Domains only emit error event and are not designed for intercepting all event emitters messages but a way to route exception handling code. Try to replace ee.emit('message', 1, 2, 3); with throw new Error('blah') and you'll notice it's magically appearing in app.js mainDomain 'error' handler.

Re: [nodejs] Re: when to use self instead of this

2014-04-22 Thread Andrey
On Tuesday, 22 April 2014 17:29:56 UTC+10, stagas wrote: 2014-04-22 7:44 GMT+03:00 Andrey andrey@gmail.com javascript:: In addition all previous comments: I don't like name 'self' as alias to 'this' ( I tend to interpret same way as 'this', e.i context of current function). Instead

[nodejs] Re: when to use self instead of this

2014-04-21 Thread Andrey
In addition all previous comments: I don't like name 'self' as alias to 'this' ( I tend to interpret same way as 'this', e.i context of current function). Instead, use same name you would use for your object instance. Example: Client.prototype.doStuff = function() { var client = this; //

[nodejs] Re: node and database connection pool

2014-02-26 Thread Andrey
Some databases (MySQL for example) don't allow you to send next query before receiving result of a previous one. The only way to have queries run in parallel is have each query in separate connection. Even when query is very short it's a good idea to use connection pool to overcome network

[nodejs] Re: Debugging Node programs: What tools/techniques make your list?

2014-01-20 Thread Andrey
Debugging: most often - built in cli debugger + debugger keyword (sometimes with breakOnException at first breakpoint. I also have small patch in debugger which skips all 'ENOENT' exceptions caused by modules lookup) - https://github.com/sidorares/node-vim-debugger to debug coffee/js mixed code

Re: [nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-19 Thread Andrey Sidorov
So what would be debugger status? Do you encourage users to report errors / send PR with fixes or it stays frozen until fully deprecated? On Wed, Nov 20, 2013 at 9:23 AM, Ben Noordhuis i...@bnoordhuis.nl wrote: On Wed, Nov 13, 2013 at 12:47 PM, Ben Noordhuis i...@bnoordhuis.nl wrote: On Tue,

Re: [nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-17 Thread Andrey Sidorov
I created simple script to wrap all the preparation steps for to start node-inspector: https://github.com/sidorares/ni npm install -g ni ni myScript.js On Mon, Nov 18, 2013 at 2:51 AM, Floby florent.j...@gmail.com wrote: I haven't had the need for a debugger in probably years. I recently used

Re: [nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-13 Thread Andrey
I meant client itself, not protocol, though they are very similar. Public api like client.reqScopeshttps://github.com/sidorares/v8-debugger-protocol/blob/master/lib/client.js#L190, client.reqEvalhttps://github.com/sidorares/v8-debugger-protocol/blob/master/lib/client.js#L220,

[nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-13 Thread Andrey
You can use https://github.com/sidorares/node-cli-debugger I spend something like 30 minutes on it, so it's very alpha but looks like it works the same way as built in debugger. Please report bugs or inconsistencies with node's debugger. Andrey On Thursday, 14 November 2013 11:10:19 UTC+11

Re: [nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-13 Thread Andrey
- make 'node debug' try to call this module if installed and print warning if not (internal debugger has moved to npm. Please do 'npm install some-debugger-module-name') Agreed on the 'print a warning' part, not so sure about the auto-loading part. It's easy to switch from

[nodejs] Re: [Poll/RFC] Remove the built-in debugger

2013-11-12 Thread Andrey
I use it every day and fall back to node-inspector only when I really need to walk stack a lot. At the same time, I think it should not be part of node core and exist as npm-installable script. (I'm big fan of No [1], but unfortunately other core functionality can't be removed without much

[nodejs] Re: Force http request to use a specific socket

2013-10-17 Thread Andrey
You can use agent option of http (and websocket) client. You need to create agent and override createSocket function to return your own socket. I'm having the same problem - I need to connect chrome devtools console repl [1] using stream created by adb client library [2]. I created simple

Re: [nodejs] Re: Debugging running node process

2013-09-19 Thread Andrey
current callbacks. I need to attach a breakpoint and wait, but problem is I don't know where is it waiting. So breakpoint will be blind guess. On 19-Sep-2013 4:09 AM, Andrey andrey@gmail.com javascript: wrote: You can enable debugger agent in your process by sending SIGUSR1 ( see

[nodejs] Re: Debugging running node process

2013-09-18 Thread Andrey
You can enable debugger agent in your process by sending SIGUSR1 ( see http://nodejs.org/api/debugger.html#debugger_advanced_usage ) On Wednesday, 18 September 2013 21:21:04 UTC+10, Vivek Goel wrote: Hi, I have node daemon (gearman worker). Sometime I am facing the problem that the process

[nodejs] Re: [ann] rec - A terminal recorder tool

2013-08-10 Thread Andrey
http://ascii.io/ ? On Saturday, 10 August 2013 07:57:06 UTC+10, Tim Caswell wrote: Related to js-git, I wanted a way for people to record their terminal and send me debug info, so I spent a couple hours and wrote a simple, but awesome recorder. https://github.com/creationix/rec If

Re: [nodejs] Re: what node (v8) version for nprof?

2013-07-31 Thread Andrey Sidorov
in node-profiler run tools/build-nprof On Wed, Jul 31, 2013 at 4:16 PM, linbo liao llbg...@gmail.com wrote: I cp tickprocessor.js from node source to node-profiler source, but still doesn't work, any additional step I need execute? Thanks, Linbo 在 2013年7月31日星期三UTC+8上午11时34分55秒,Andrey写道

[nodejs] Re: what node (v8) version for nprof?

2013-07-30 Thread Andrey
You can update tickprocessor.js manually from node source matching your version ( its in /deps/v8/tools/tickprocessor.js ). Unfortunately, there is no V8 version information in v8.log. I have same issue in node-tick - see discussion here: https://github.com/sidorares/node-tick/pull/3 I hope to

Re: [nodejs] Re: [ANN] ansi-canvas: Render a canvas node to your terminal

2013-06-18 Thread Andrey
added screencast gif to readme - https://github.com/sidorares/ansi-vnc/blob/master/README.md On Saturday, 15 June 2013 04:30:16 UTC+10, Nathan Rajlich wrote: Wow that's awesome, hahah. Screenshots nao! On Fri, Jun 14, 2013 at 3:39 AM, Andrey andrey@gmail.comjavascript: wrote

[nodejs] Re: Query length of event loop queue

2013-06-17 Thread Andrey
Check out https://github.com/lloyd/node-toobusy On Tuesday, 18 June 2013 01:20:50 UTC+10, Chaoran Yang wrote: Dear all, Is there any way in node.js I can query the length of event loop queue? I assume the event loop has a queue of callbacks. Checking the queue length can be useful to know

Re: [nodejs] Is it beneficial to create an asynchronous function?

2013-06-16 Thread Andrey
Do you have any numbers to proof that you need to optimise here? How much time does it usually take for makeXmlFromString to complete? Could you post first lines of processed v8.log after running with --profile? If you are sure that this function does block io loop for some significant amount

[nodejs] Re: Spawned processes as transform streams

2013-06-14 Thread Andrey
You can use https://github.com/sidorares/exec-stream var es = require('exec_stream'); var convert = es('imagemagick', ['options']); rs.pipe(convert).pipe(ws); On Friday, 14 June 2013 11:23:08 UTC+10, ryandesign wrote: I understand that a process that I spawn with

Re: [nodejs] Re: Spawned processes as transform streams

2013-06-14 Thread Andrey
, Andrey andrey@gmail.comjavascript: wrote: You can use https://github.com/sidorares/exec-stream var es = require('exec_stream'); var convert = es('imagemagick', ['options']); rs.pipe(convert).pipe(ws); This looks great. Do you have plans to upgrade it with the latest APIs? It's

[nodejs] Re: [ANN] ansi-canvas: Render a canvas node to your terminal

2013-06-14 Thread Andrey
On Wednesday, 12 June 2013 14:07:54 UTC+10, Nathan Rajlich wrote: ansi-canvas is badass: https://github.com/TooTallNate/ansi-canvas Please have fun and create awesome stuff with it. Terminal vnc client: https://github.com/sidorares/ansi-vnc :) No mouse/keyboard currently. Can anyone hint me

Re: [nodejs] Spawned processes as transform streams

2013-06-14 Thread Andrey
in node core. Thanks! This is great. I'd gotten about half of that example written before becoming confused. I haven't made my own streams before. Seeing a complete example is very helpful. On Jun 14, 2013, at 01:14, Andrey andrey@gmail.com javascript: wrote: You can use https

Re: [nodejs] Re: [ANN] ansi-canvas: Render a canvas node to your terminal

2013-06-14 Thread Andrey
Thanks! That's what I need On Friday, 14 June 2013 17:21:38 UTC+10, hacksparrow wrote: Use the keypress module, it supports mouse events too - https://github.com/TooTallNate/keypress On Fri, Jun 14, 2013 at 12:34 PM, Andrey andrey@gmail.comjavascript: wrote: On Wednesday, 12 June

[nodejs] [ANN] mysqlite.js

2013-06-01 Thread Andrey
https://github.com/sidorares/mysqlite.js Mysql server for sqlite database using emscripten-compiled sqlite (kripken/sql.js) and mysql2 as server-side protocol implementation. JS only, no mysql or sqlite required. Andrey -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https

[nodejs] [ANN] mysql-pg-proxy

2013-05-28 Thread Andrey
https://github.com/sidorares/mysql-pg-proxy Simple mysql to postgresql proxy. Allows you to make pg queries from mysql client. Andrey. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message

[nodejs] [ANN] vnc over gif

2013-05-24 Thread Andrey
https://github.com/sidorares/vnc-over-gif Friday evening project: vnc viewer based on animated gif image stream. Browser requirement: netscape 2.0+ Regards Andrey. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting

Re: [nodejs] Re: vnc over gif

2013-05-24 Thread Andrey
Tellnes chri...@tellnes.nojavascript: wrote: 2013/5/24 mscdex msc...@gmail.com javascript:: On May 24, 6:09 am, Andrey andrey.sido...@gmail.com wrote: Browser requirement: netscape 2.0+ Time to upgrade my browser :-( Time to downgrade node. -- Sincerely, Christian Vaagland Tellnes

Re: [nodejs] [ANN] mysql2, node-mysql compatible mysql driver

2013-05-21 Thread Andrey
Thanks, that makes sense. So basically node-mysql is leaving some obvious optimizations on the table? yes By the way, I noticed that you're using vm.runInNewContext(). Is there a reason for that? You could probably reduce memory usage a little by running the generated code in

Re: [nodejs] [ANN] mysql2, node-mysql compatible mysql driver

2013-05-20 Thread Andrey
: On Mon, May 20, 2013 at 3:50 AM, Andrey andrey@gmail.comjavascript: wrote: - speed. On my box I get 2M rows per second compared to 400k rows/sec with node-mysql and 800k rows/sec with mariasql drivers. Andrey, how come it's that much faster? Are you sure that you

[nodejs] [ANN] mysql2, node-mysql compatible mysql driver

2013-05-19 Thread Andrey
://github.com/sidorares/node-mysql2 It's still work in progress, feel free to report bugs/benchmarks/node-mysql incompatible behaviour. Regards, Andrey -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received

[nodejs] Question about tokens map

2013-05-16 Thread Andrey Kucherenko
Is it possible to get tokens map into javascript code, maybe something like token_get_all method in php? Thanks -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are

Re: [nodejs] tcp roundtrip time performance

2013-05-14 Thread Andrey
no, it's just one connection during whole benchmark On Tuesday, 14 May 2013 19:34:13 UTC+10, Jorge wrote: On 14/05/2013, at 04:08, Andrey wrote: Hi everyone, I'm trying to benchmark network protocol client, and profiler tells me that client spend most of the time inside uv write

[nodejs] tcp roundtrip time performance

2013-05-13 Thread Andrey
). Can anyone explain what is the limit here - libuv, TCP stack, v8, ping script, CPU or something else? [1] https://gist.github.com/sidorares/5573057 Cheers, Andrey. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting

[nodejs] Re: Forbidden response for request from Apache to node.js server

2013-04-17 Thread Andrey
You need to explicitly allow '127.0.0.1:3000/connect' to be accessed from 'localhost:8080' by serving CORS headers in your node.js application. See http://en.wikipedia.org/wiki/Cross-origin_resource_sharing On Wednesday, 17 April 2013 12:21:25 UTC+10, soewij wrote: Hello, I'm new to node.js.

[nodejs] Re: Should I use asynchronous callbacks for non-I/O tasks?

2013-04-09 Thread Andrey
Don't forget that there is thread pool in node, and some native modules provide async api for CPU-bound functions and use pool internally. For example, if you try to benchmart bcrypt[1] using synchronous api you'll get 100% CPU (one core busy), and if you run 4 bcrypt functions in parallel

[nodejs] customize local node.js ( switch to require module / .noderc.js ? )

2013-04-03 Thread Andrey
in test.js so that I can make alias mynode - `node -r myhelpers`. If no, would adding this feature be a good or bad idea? My use cases: - register custom source transformation as .js extension (`mynode test.js` executes transformed source ) - pre-populate helpers for repl and debugger Andrey

[nodejs] Re: Multi-threaded Node.js

2013-02-18 Thread Andrey
Take a look at W16 project - https://github.com/sheremetyev/w16 On Monday, 18 February 2013 11:15:48 UTC+11, RF wrote: Hi, I'm CS student who is new to Node, and I have two questions: 1. Is there currently an existing mechanism (e.g. module, core functionality) that allows Node

[nodejs] Re: Waiting for two Mysql Functions?

2012-12-26 Thread Andrey
In addition to all previous posts: Note that mysql protocol is synchronous (you can't send next query before receiving result from previous) and all mysql clients queue commands in some way. Unless you have two separate connections from pool you can safely do mysql.query(one big query);

Re: [nodejs] How do node.js handle database transactions?

2012-12-20 Thread Andrey
a) it's not true, there is no limit from node side on the number of mysql connections ( but you should have some reasonable number as mysql server creates thread for each ) Mysql protocol itself is sequential and does not allow you to send new query before receiving previous result. Common

[nodejs] Re: Detect When USB Mass Storage Device Is Plugged In

2012-11-06 Thread Andrey
Example using https://github.com/sidorares/node-dbus : https://gist.github.com/4025095 On Tuesday, 6 November 2012 02:55:44 UTC+11, Paul Spaulding wrote: Thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines

[nodejs] Re: Poll for v0.10 feature: Crypto default to 'binary' strings vs defaulting to buffers

2012-10-08 Thread Andrey
a) Go for it. This will probably affect me, but I'll be happy to change code for better On Tuesday, 9 October 2012 10:24:36 UTC+11, Isaac Schlueter wrote: Currently, the crypto module defaults to using 'binary' encoded strings everywhere as the default input and output encoding. This is

[nodejs] Re: Any X WIndows bindngs for Node.js ?

2012-07-10 Thread Andrey
. Cheers, Andrey On Tuesday, 10 July 2012 21:31:38 UTC+10, AaronNGray wrote: Are there any X WIndows bindngs for Node.js ? Many thanks in advance, Aaron -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You

[nodejs] Re: Node debug issue

2012-05-03 Thread Andrey
use repl command: debug repl Press Ctrl + C to leave debug repl 1 + 1 2 On May 4, 12:21 pm, Geronimo Diaz geroni...@gmail.com wrote: Hi everybody, i'm new in node.js world and i have a problem with node built-in debugger,  when i debug a simple test.js script with node debug test.js, i try