[nodejs] Re: Synchronous architecture with asynchronous repository

2015-11-08 Thread Alexey Petrushin
Use fibers, it would allow you to write plain good old Ruby / Python like 
code without callbacks & at the same time preserve non-blocking node.js 
features.

Here's an example of 
Controller 
https://github.com/sinizinairina/mono-example/blob/master/controllers/Posts.coffee
it looks like synchronous code, but it's not blocking.

On Thursday, 22 October 2015 02:01:32 UTC+11, Adam wrote:
>
> In order to keep clean architecture of my node.js microservice I have 
> controllers, services and e.g. repositories. 
>
> I want a synchronous data flow: controller -> service -> repository -> 
> service -> controller. In this flow (in simple user story) repository 
> returns data to service and service to controller. But repository should 
> process requests to external storage in a asynchronous way. All 
> asynchronous code should exist only in repository, service should obtain 
> raw data.
>
> My current implementation:
>
> UserController.js
>
> module.exports.create = function() {
> console.log("In controller: before service call");
> 
> let userDto = JSON.parse(this.request.body);
> let savedUser = userService.createUser(userDto);
> 
> console.log("In controller: after service call");
> };
>
> UserService.js
>
> module.exports.createUser = function createUser(userDto) {
> 
> let user = require('../domain/user/User');
> 
> user.login = userDto.login;
> user.password = userDto.password;
> 
> let userRepository = 
> require('../infrastructure/user/UserRepository');
> 
> Q.spawn(function* () {
> console.log("In service before promise resolve");
> 
> let savedUser = yield userRepository.createUser(user);
> 
> console.log("In service after promise resolve");
> 
> return savedUser;
> });
> 
> console.log("In service: after repository call");
> };
>
> UserRepository.js
>
> module.exports.createUser = function createUser(user) {
> console.log("In repository: before save call");
> 
> return new Q.Promise(function(resolve, reject) {
> 
> userEntity.save(function(err, savedUser) {
> 
> console.log("In repository: inside callback after save 
> call");
> 
> if (err) {
> console.log("In repository: inside callback before 
> reject");
> reject(Error('Błąd zapisu danych!'));
> } else {
> console.log("In repository: inside callback before 
> resolve");
> resolve(savedUser);
> }
> });
> });
> };
>
> Logs:
>
> - In controller: before service call
> - In service before promise resolve
> - In repository: before save call
> - In service: after repository call
> - In controller: after service call
> - In repository: inside callback after save call
> - In repository: inside callback before resolve
> - In service after promise resolve
>
> I would like to get the following sequence of logs:
>
> - In controller: before service call
> - In service before promise resolve
> - In repository: before save call
> - In repository: inside callback after save call
> - In repository: inside callback before resolve
> - In service after promise resolve
> - In controller: after service call
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/81103d7f-b85d-4031-946f-f8a54b877899%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2015-03-01 Thread Alexey Petrushin
Also, if you are interested in kinda real-life Node.js benchmarks, here's 
one more for Ruby on Rails vs Node.js

http://jslang.info/blog/2014/ruby-on-rails-vs-nodejs

3782 (node.js) vs. 2914 (ruby on rails) hits

On Thursday, 19 February 2015 08:34:57 UTC+11, Anirban Bhattacharya wrote:

 Hi,
 I am new to node. very new ..like infant.
 Either I am doing something wrong or I understood everything wrong.
 I wrote a node js simple JSON emitter which uses mysql module and query 
 (select *) from a single table haviing 100 records and outputs on page as 
 JSON (JSON.stringify..

 I wrote a PHP page which also does the same thing from same table(Apache).

 I used Siege for load test and surprisingly it shows better values for the 
 PHP than that of node .. see below the output of siege
 ==NODE=
 anirbanb2004@Anisoft-Corporation:~$ siege -c100 -d1 -t10M -lnode.log 
 http://localhost:9615/
 ** SIEGE 3.0.5
 ** Preparing 100 concurrent users for battle.
 The server is now under siege...
 Lifting the server siege...  done.

 Transactions:  119236 hits
 Availability:  100.00 %
 Elapsed time:  599.74 secs
 Data transferred:  403.00 MB
 Response time:0.00 secs
 Transaction rate:  198.81 trans/sec
 Throughput:0.67 MB/sec
 Concurrency:0.61
 Successful transactions:  119236
 Failed transactions:   0
 Longest transaction:0.05
 Shortest transaction:0.00
  
 FILE: node.log
 =PHP==
 anirbanb2004@Anisoft-Corporation:~$ siege -c100 -d1 -t10M -lphp.log 
 http://localhost/loadTest
 ** SIEGE 3.0.5
 ** Preparing 100 concurrent users for battle.
 The server is now under siege...
 Lifting the server siege...  done.

 Transactions:  119632 hits
 Availability:  100.00 %
 Elapsed time:  599.47 secs
 Data transferred:   34.58 MB
 Response time:0.00 secs
 Transaction rate:  199.56 trans/sec
 Throughput:0.06 MB/sec
 Concurrency:0.12
 Successful transactions:   59858
 Failed transactions:   0
 Longest transaction:0.03
 Shortest transaction:0.00
  
 FILE: php.log

 can anyone please help me understand what is wrong here? I understand some 
 scenario will be there where PHP will perform better. What scenario should 
 I create to test Node is better?


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/f272d221-954b-4aac-bcf6-fe3fb86f10a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: A callback hell free(ish) way to do REST...

2015-01-17 Thread Alexey Petrushin
There's also another approach, it's better showcased by example.

Here's the Demo - 10 min blog http://example.monojs.org
And here's its 
sources 
https://github.com/sinizinairina/mono-example/blob/master/controllers/Posts.coffee

Try to find callbacks there ;)

On Tuesday, 13 January 2015 16:57:33 UTC+11, Amir Yasin wrote:

 I've written a couple of large Express apps and a few smaller ones and 
 invariably anything complex starts descending into callback hell.  I'm 
 working on a solution for that and I think I'm ready at this point for some 
 community feedback.  Bear in mind that there's a fair bit of work left to 
 do and it's not a 'production' project yet.  Nevertheless there's enough 
 there to give you a sense of where I'm going with it...feedback and 
 constructive criticism would be greatly appreciated.

 The project is located at https://github.com/ayasin/frhttp

 Thanks


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/ccf459bc-262c-4fbf-a9bb-4c5e77cefa28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] which framework to use (express, meteor or koa)

2014-12-25 Thread Alexey Petrushin
Node.js isn't the best option for this app. With RoR or similar python 
framework you'll do it easier and faster.

Because there's no callbacks and most of node web frameworks are too low level.

Your app is not the case node js was created and tuned for.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/4fe83dce-8dc0-4f13-ae89-318c7e2da598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] which framework to use (express, meteor or koa)

2014-12-25 Thread Alexey Petrushin
Node.js isn't the best option for this app. With RoR or similar python 
framework you'll do it easier and faster.

Because there's no callbacks and most of node web frameworks are too low level.

Your app is not the case node js was created and tuned for.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c69f8cc9-50f4-4793-b9db-967fd07a2d7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: NodeJs e-commerce solution?

2014-09-28 Thread Alexey Petrushin
There's kind of eCommerce in node.js, very simple though, sample shop built 
with it http://robotigra.ru

It's not exactly eCommerce, but a static site generator with eCommerce 
plugin http://eviltext.com

The sample shop with its sources 

http://shop-example.eviltext.com
https://github.com/sinizinairina/eviltext-shop-example

On Friday, 26 September 2014 15:46:45 UTC+4, lin di wrote:

 any progress? after googing and testing for few hours, i finally decide to 
 use keystone  sequelizejs(or bookshelf.js to support mysql acid). 

 在 2013年9月12日星期四UTC+8下午10时07分14秒,j...@team9.com.au写道:

 I generally agree with Adam too, it's really important to have the right 
 foundation in place or you (or someone else using the project) will regret 
 it later.

 I asked about whether it would be possible to implement a robust solution 
 in mongo db because I've been working on an open source content management 
 system / web app framework built on express and mongoose. 

 The project hasn't been announced yet because I'd like to have better 
 documentation, a getting started, and examples in place before I draw too 
 much attention to it.

 That said, if anybody would like an early preview it's called Keystone JS 
 and there's a simple demo up at http://demo.keystonejs.com

 My company has used it as the foundation of a few eCommerce sites 
 (including http://www.bodymindlife.com, which we launched today) but 
 they've got fairly simple requirements - just creating customers and 
 logging purchases, there's nothing sophisticated like inventory management.

 However we're really happy with Keystone for content management and I'd 
 like to explore turning it into something of an eCommerce solution. If it 
 can be done (for example implementing a subsystem using redis or another 
 secondary database to ensure things happen safely) then having the store 
 content and customers managed with Keystone might be really good.

 Of course, it's not a good idea to use the wrong tool for the job - 
 you'll just end up fighting with it...

 Then again some people may have said that about using javascript for your 
 back-end ;-)

 The question is can we build a robust solution on top of mongo (*or* 
 alongside it with other systems) and if so, are people interested in 
 building it with me as part of Keystone?

 Cheers,
 Jed.


 On Thursday, September 12, 2013 9:54:08 PM UTC+10, klr...@gmail.com 
 wrote:

  no node expert by a long shot but I concur totally, am developing 
 international logistics solutions for others and also running them in my 
 own businesses since the 90ties and you've *got to play it safe* in this 
 area or (apart from your MD, CEO or whatnot) the first fiscal inspection 
 will pluck you to pieces as various taxes are directly affected. They just 
 *love* to detect incorrect inventory statements on your sheet so they can 
 e$timat€... You need to think very hard how to maintain the database 
 accurate in an async environment with multiusers and you have to carefully 
 design the statements or transactions that need to be executed in a certain 
 sequence if you want your app to scale correctly. Sorry for ranting and 
 raving like this but Adam is right. :-) 

 On 12/09/13 13:12, Adam Reynolds wrote:
  
 The customer will care when the last item in stock is sold twice. You 
 are right, in the initial work, it's all about the pretty stuff, but the 
 backend implementation should be scalable as the customer grows.  

  The last thing a customer wants to hear is that the solution works as 
 long as you don't have too much business.

  Seriously this ability to track stock accurately is the most important 
 thing to a business. Having spent a lot of my 13+ years in e-commerce 
 development, this stuff is absolutely critical. The 'design' is irrelevant 
 when the MD of a company wants to know precisely how much stock is in the 
 warehouse, and in your case, why we've sold 3 times as many products than 
 we have in stock, just because the site got busy after they ran an advert 
 on TV last night.

  ACID compliance has serious financial implications and is why people 
 keep harping on about it. It's really really really important.

   

 On Thu, Sep 12, 2013 at 11:56 AM, Alexey Petrushin 
 alexey.p...@gmail.com wrote:

 Customers doesn't care if there's MongoDB, CouchDB, MySQL inside this 
 e-commerce stuff. 

 Also, as soon as the goal is to build widely used open source 
 e-commerce - it won't be a huge million user a day site (nobody uses 
 simple 
 open source shops at such scale), it will be a small, simple and easy to 
 use shop. And on such a small scale - it's totally irrelevant how you 
 implement it, it probably will works fine even if you decide to not use 
 any 
 DB at all and store all stuff in plain files.

  So, this discussion about DB choice is pointless. Would be more 
 interesting to see what set of features it's supposed to have and where to 
 get a cool design (the thing that unlike DB is really

Re: [nodejs] Callback hell and how to get around it?

2014-09-23 Thread Alexey Petrushin
Ha-ha, very good example, compare this async version it with the sync 
version below, and tell me that there's no problem with 
callbacks if you know how to deal with it :D

Not saying that in even such a simple code it's extremely
easy to make small errors like missing `else` statements etc.

Also it doesn't preserve the call stack - so when you see error in console
you would have no context and no idea what happened...
And it still doesn't catch the sync errors...
And some of callbacks can be fired twice...
And with streams there are lots of events fired and should be properly 
handled...

And still many insist that it is not a problem.

CDN.use(config.CDN.baseUrl, function(req, res, next) {
if(err) return next(err);
async.waterfall([
function (cb) {
fs.lstat(config.base+/cdn+req.url, cb);
},
function (stats, cb) {
if(stats.isSymbolicLink()) {
async.waterfall([
function (cb) {
fs.readlink(config.base+/cdn+req.url, cb);
},
function (linkstr, cb) {
log.info(Redirecting request \+req.url+\ 
to \+linkstr);
fs.readFile(linkstr, cb);
},
], cb);
}
}
], function (err, data) {
if (err) return next(err);
res.writeHead(200,{Content-type:text/html});
res.end(data);
});
});

Sync version.

CDN.use(config.CDN.baseUrl, function(req, res, next) {
  var stats = fs.lstat(config.base+/cdn+req.url)
  if(stats.isSymbolicLink()) {
var linkstr = fs.readlink(config.base+/cdn+req.url);
log.info(Redirecting request \+req.url+\ to \+linkstr);
var data = fs.readFile(linkstr);
res.writeHead(200,{Content-type:text/html});
res.end(data);
  }
});

On Monday, 22 September 2014 05:18:40 UTC+4, Matt Sergeant wrote:


 On Sat, Sep 20, 2014 at 9:17 AM, Bruno Jouhier bjou...@gmail.com 
 javascript: wrote:

 How do you implement it with async?


 This is a good question, so here's an example translation (not the only 
 way to do it):


 CDN.use(config.CDN.baseUrl, function(req, res, next) {
 if(err) return next(err);
 async.waterfall([
 function (cb) {
 fs.lstat(config.base+/cdn+req.url, cb);
 },
 function (stats, cb) {
 if(stats.isSymbolicLink()) {
 async.waterfall([
 function (cb) {
 fs.readlink(config.base+/cdn+req.url, cb);
 },
 function (linkstr, cb) {
 log.info(Redirecting request \+req.url+\ 
 to \+linkstr);
 fs.readFile(linkstr, cb);
 },
 ], cb);
 }
 }
 ], function (err, data) {
 if (err) return next(err);
 res.writeHead(200,{Content-type:text/html});
 res.end(data);
 });
 });

 It's more code, but it improves the error checking. If it didn't have that 
 if statement in there it would be a lot simpler - async code doesn't deal 
 well with if statements I've found (there's no way to short-circuit).

 Matt.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/36905e32-1293-4ea3-b2d8-7015509afa31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Callback hell and how to get around it?

2014-09-23 Thread Alexey Petrushin
 http://www.ckwop.me.uk/Why-Exceptions-Suck.html

That's just another theoretical talk. You may find tons of such stuff 
explaining how J2EE
is a superior next-generation technology or whatever other nonsense.
You may even find articles insisting that explicit error checks in Go is 
the right way.

Instead of theoretical debates it is more interesting to compare the actual 
code. You can compare
the async and sync versions of code above, so you can judge by yourself 
which is simpler and easier.

 Yes, like all benchmarks this one is horribly flawed. 

That's very convenient point of view. If benchmark shows something you 
don't like just say that
it's flawed and proves nothing.

About the multicore - yes that maybe the case, but it can be run on single 
core machines - like
AWC EC2 or something similar to see how it perform on single core.

 Alexey, that's an interesting comparison. Your benchmark does almost no 
work in the node/ruby code itself.

Exactly. No work is the use case node.js is designed for - to be 
work-less network router.
So, it is the case node.js should shine. And, instead it turned out that 
webserver that is based 
on lightweight threads provides almost the same performance.

P.S. I will try to run benchmark on single core machine.

On Tuesday, 23 September 2014 23:45:34 UTC+4, Matt Sergeant wrote:


 On Tue, Sep 23, 2014 at 3:14 PM, Alexey Petrushin alexey.p...@gmail.com 
 javascript: wrote:

  I've programmed in both sync and async code, and neither is perfect. 
 Node basically 
  has trade-offs - I get better performance [1] at the expense of a 
 slightly cumbersome programming model. 

 I compared Node.js with slow Ruby on Rails and the result is that 
 node.js is only 1.3 times faster.
 (maybe there's an error in my benchmark, but I can't find it so far).

 http://alex-craft.com/blog/2014/ruby-on-rails-vs-nodejs
 sources https://github.com/alexeypetrushin/web-frameworks-benchmarks


 Yes, like all benchmarks this one is horribly flawed. The simplest reason 
 being your Rails server (using Puma) uses all cores. Your Node version is 
 using one core. But that's beside the point - minor benchmarks like this 
 show absolutely nothing of value.

 Try porting a real application. I did.
  

  Your sync version doesn't handle errors at all

 I knew that someone would point to it. But actually it does handle 
 errors. The whole request thread wrapped with try/catch (implicitly, inside 
 of web framework code) - and it does handle errors.


 http://www.ckwop.me.uk/Why-Exceptions-Suck.html

 Besides that, not all ruby functions/methods throw exceptions on errors 
 (thankfully - in fact I'd venture to say that most don't), so you have to 
 handle them locally/manually anyway, same as you do in Node.

 Matt.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/cde1c269-72b6-41b3-b599-8a0ec90aa290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Callback hell and how to get around it?

2014-09-21 Thread Alexey Petrushin
 I dislike your comment about comparison between Ruby on Rails and 
Node.JS, as Ruby is the core and Rails is the 
 framework. You can use Node.JS as the core and SailsJS as the framework.

The point in comparison with RoR was about the performance for classical 
Web Apps (not streaming or 10k). 
I doubt that if you use mount SailsJS atop of node it would improve its 
performance. 
So, the performance comparison was valid, no matter if I use bare node.js 
or higher-level construct like sails.js.

 One more thing, callbacks is not an issue by itself, it becomes an issue 
when developers mixes their code into
 spaghetti style, where no modularity used.

I'm not talking about if its an issue or not, that's highly subjective 
matter. I'm talking about the concrete
code snippets you can look at and obviously see if there's a difference. 
Async code is more complicated than sync. Could you write manageable 
programs using async code? Definitely, it is possible.

The question is - why can't you admit that it's more complicated than the 
sync code? Write async code with
some conditions and loops, proper error handling (also try to handle sync 
errors properly). Now - rewrite
this code in sync style. Compare these two snippets - does it looks the 
same?

 My opinion is, if you're going to use a framework/technology/engine you 
need to more understand how it is serving your 
 idea, not to come up with other things ideas and ask; why it is not so 
clear here as in others?!

These tools used by many as a web frameworks for creating Web Apps. So, why 
can't I compare
it in terms of performance, developer productivity, simplicity etc?

On Sunday, 21 September 2014 11:38:22 UTC+4, Ahmed Eldosoukey wrote:

 ​I dislike your comment about comparison between Ruby on Rails and 
 Node.JS, as Ruby is the core and Rails is the framework. You can use 
 Node.JS as the core and SailsJS as the framework.

 One more thing, callbacks is not an issue by itself, it becomes an issue 
 when developers mixes their code into spaghetti style, where no modularity 
 used.

 My opinion is, if you're going to use a framework/technology/engine you 
 need to more understand how it is serving your idea, not to come up with 
 other things ideas and ask; why it is not so clear here as in others?!

 My Regards,
 Ahmed

 On Fri, Sep 19, 2014 at 11:23 PM, Alexey Petrushin alexey.p...@gmail.com 
 javascript: wrote:

  if you understand plain old callbacks, you won't have any trouble 
 reading 
  code written with the async module.

 Ha-ha, yea, you don't like callbacks because you don't understand how to 
 work with it!. 

 You may want callbacks in network layer, but definitely not in the 
 business logic.
 The funny thing is - in most web project 90% of code base is business 
 logic when you don't need callbacks at all :)

 What even more funny - it seems that node.js doesn't give you significant 
 speedup compared to Ruby on Rails in classical Web App (classical 
 request/response apps, without realtime or 10k connections).  So, you get 
 extra complexities with callbacks in return for nothing (a very little 
 performance boost).

 P.S. I'm not against the node, I'm against accepting bad thing as if it's 
 a good thing. Callback is a bad thing (for most of the projects, you don't 
 write network optimised stuff everyday, usually you work more or less with 
 plain old classical webapps), sadly, there's no better ways currently, and 
 we have to use it, but we shouldn't fool ourselves into believing that it's 
 a good thing.

 On Friday, 19 September 2014 00:22:46 UTC+4, Tom Boutell wrote:

 The async module is used pretty heavily; I would suggest that if you 
 understand plain old callbacks, you won't have any trouble reading 
 code written with the async module. It's just a way to do the common 
 async patterns more consistently and not get lost. 

 Promises is a much bigger cognitive shift than the async module. 

 More importantly though, if your module successfully implements its 
 advertised API, it doesn't matter what you use internally to implement 
 it. 

 The API you advertise to the rest of the world is a more important 
 question. Generally you should be exporting methods like: 

 doSomething(arg1, arg2, ..., callback) 

 Where the callback expects to receive: 

 err, ... 

 And if err is falsey, nothing is wrong and the other arguments (if 
 any) can be safely examined. 

 That much at least is extremely consistent in node. The only common 
 exception is streams, which are a viable option if you'll be inputting 
 or outputting a lot of data gradually over time. 


 On Thu, Sep 18, 2014 at 8:19 AM, Axel Kittenberger axk...@gmail.com 
 wrote: 
  As you can see this has always been and is still a controversial 
 issue. 
  
  The gospel is, callbacks are fine and you are wrong. Somethings are 
 still 
  going to be fixed with domains etc. 
  
  I think the misunderstandings is due to the fact on the level of 
  complication of stuff being

Re: [nodejs] Callback hell and how to get around it?

2014-09-19 Thread Alexey Petrushin
The problem with sublime snippets is that most of the time you reading code 
or thinking and sadly there's no sublime snippets that helps you 
effectively read callback-heavy code :)

On Friday, 19 September 2014 00:22:46 UTC+4, Tom Boutell wrote:

 (I don't disagree that use callbacks to do five simple things 
 consecutively is a lot to ask and can be offputting and bug-prone. It 
 absolutely is. I use sublimetext snippets to stay out of trouble, 
 which means I'm effectively coding in a higher-level language with a 
 really, really crude compiler (: ) 

 On Thu, Sep 18, 2014 at 3:35 PM, Tom Boutell t...@punkave.com 
 javascript: wrote: 
  The async module is used pretty heavily; I would suggest that if you 
  understand plain old callbacks, you won't have any trouble reading 
  code written with the async module. It's just a way to do the common 
  async patterns more consistently and not get lost. 
  
  Promises is a much bigger cognitive shift than the async module. 
  
  More importantly though, if your module successfully implements its 
  advertised API, it doesn't matter what you use internally to implement 
  it. 
  
  The API you advertise to the rest of the world is a more important 
  question. Generally you should be exporting methods like: 
  
  doSomething(arg1, arg2, ..., callback) 
  
  Where the callback expects to receive: 
  
  err, ... 
  
  And if err is falsey, nothing is wrong and the other arguments (if 
  any) can be safely examined. 
  
  That much at least is extremely consistent in node. The only common 
  exception is streams, which are a viable option if you'll be inputting 
  or outputting a lot of data gradually over time. 
  
  
  On Thu, Sep 18, 2014 at 8:19 AM, Axel Kittenberger axk...@gmail.com 
 javascript: wrote: 
  As you can see this has always been and is still a controversial issue. 
  
  The gospel is, callbacks are fine and you are wrong. Somethings are 
 still 
  going to be fixed with domains etc. 
  
  I think the misunderstandings is due to the fact on the level of 
  complication of stuff being handled. Some people just push some streams 
  through and need high effectiveness others do stuff that is already 
  complicated enough by itself. 
  
  My first larger project I did with node was scientific analysis of data 
  collected in a mongodb database -- controlled by a user via a web 
 interface. 
  Thus I personally never bought into that gospel. Things were 
 complicated 
  enough without having to wrap my head around callback issues, and being 
 able 
  to request several items at the same time from database could speed up 
  stuff, it didn't really matter that much. I changed the project on the 
 fly 
  to Bruno's streamline which rescued it (otherwise I'd had to redo it 
 with 
  something completely different, it wasn't manageable anymore) 
  
  I also know of friends whom I tried to convince how awesome node is of 
 which 
  I know that turned it down due to callbacks. 
  
  Node has recently lost one of its main contributors due to callback 
 issues. 
  And no, promises and flow control libraries didn't cut it. His main 
 point I 
  understood was, bugs caused by misbehaving libraries that fail to call 
 a 
  callback or even worse, call it twice, are extremely hard to debug. 
  
  Right now I'm using suspend, 
  https://github.com/jmar777/suspend 
  which takes advantage of harmony generators. 
  
  I like it, since it is the most reliable on getting backtraces in case 
 of an 
  error. Bruno's stuff should generate backtraces too, but I had issues 
 in 
  case of rethrowing catched errors. On the other hand, suspend and 
 generators 
  are little more try on when to put a * and when not, and result into 
 hangups 
  if you do it wrongly, while Brunos preprocessor proofed to be very 
 reliable 
  in pointing out a variety of coding errors. 
  
  My advice is, if you do a library that is to be used by others, you 
 ought to 
  use simple callbacks, as this is still the lingua franca in node world. 
  
  What you do inside is up to you and if you do an application or 
 anything 
  that is not a library to be used by others, there is no definitive 
 answer, 
  do not listen to the gospel, try things out, look what works best for 
 you. 
  
  -- 
  Job board: http://jobs.nodejs.org/ 
  New group rules: 
  https://gist.github.com/othiym23/9886289#file-moderation-policy-md 
  Old group rules: 
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  --- 
  You received this message because you are subscribed to a topic in the 
  Google Groups nodejs group. 
  To unsubscribe from this topic, visit 
  https://groups.google.com/d/topic/nodejs/wBAJhYOzjqQ/unsubscribe. 
  To unsubscribe from this group and all its topics, send an email to 
  nodejs+un...@googlegroups.com javascript:. 
  To post to this group, send email to nod...@googlegroups.com 
 javascript:. 
  To view this discussion on the web visit 
  
 

Re: [nodejs] Callback hell and how to get around it?

2014-09-19 Thread Alexey Petrushin
 if you understand plain old callbacks, you won't have any trouble reading 
 code written with the async module.

Ha-ha, yea, you don't like callbacks because you don't understand how to 
work with it!. 

You may want callbacks in network layer, but definitely not in the business 
logic.
The funny thing is - in most web project 90% of code base is business logic 
when you don't need callbacks at all :)

What even more funny - it seems that node.js doesn't give you significant 
speedup compared to Ruby on Rails in classical Web App (classical 
request/response apps, without realtime or 10k connections).  So, you get 
extra complexities with callbacks in return for nothing (a very little 
performance boost).

P.S. I'm not against the node, I'm against accepting bad thing as if it's a 
good thing. Callback is a bad thing (for most of the projects, you don't 
write network optimised stuff everyday, usually you work more or less with 
plain old classical webapps), sadly, there's no better ways currently, and 
we have to use it, but we shouldn't fool ourselves into believing that it's 
a good thing.

On Friday, 19 September 2014 00:22:46 UTC+4, Tom Boutell wrote:

 The async module is used pretty heavily; I would suggest that if you 
 understand plain old callbacks, you won't have any trouble reading 
 code written with the async module. It's just a way to do the common 
 async patterns more consistently and not get lost. 

 Promises is a much bigger cognitive shift than the async module. 

 More importantly though, if your module successfully implements its 
 advertised API, it doesn't matter what you use internally to implement 
 it. 

 The API you advertise to the rest of the world is a more important 
 question. Generally you should be exporting methods like: 

 doSomething(arg1, arg2, ..., callback) 

 Where the callback expects to receive: 

 err, ... 

 And if err is falsey, nothing is wrong and the other arguments (if 
 any) can be safely examined. 

 That much at least is extremely consistent in node. The only common 
 exception is streams, which are a viable option if you'll be inputting 
 or outputting a lot of data gradually over time. 


 On Thu, Sep 18, 2014 at 8:19 AM, Axel Kittenberger axk...@gmail.com 
 javascript: wrote: 
  As you can see this has always been and is still a controversial issue. 
  
  The gospel is, callbacks are fine and you are wrong. Somethings are 
 still 
  going to be fixed with domains etc. 
  
  I think the misunderstandings is due to the fact on the level of 
  complication of stuff being handled. Some people just push some streams 
  through and need high effectiveness others do stuff that is already 
  complicated enough by itself. 
  
  My first larger project I did with node was scientific analysis of data 
  collected in a mongodb database -- controlled by a user via a web 
 interface. 
  Thus I personally never bought into that gospel. Things were complicated 
  enough without having to wrap my head around callback issues, and being 
 able 
  to request several items at the same time from database could speed up 
  stuff, it didn't really matter that much. I changed the project on the 
 fly 
  to Bruno's streamline which rescued it (otherwise I'd had to redo it 
 with 
  something completely different, it wasn't manageable anymore) 
  
  I also know of friends whom I tried to convince how awesome node is of 
 which 
  I know that turned it down due to callbacks. 
  
  Node has recently lost one of its main contributors due to callback 
 issues. 
  And no, promises and flow control libraries didn't cut it. His main 
 point I 
  understood was, bugs caused by misbehaving libraries that fail to call a 
  callback or even worse, call it twice, are extremely hard to debug. 
  
  Right now I'm using suspend, 
  https://github.com/jmar777/suspend 
  which takes advantage of harmony generators. 
  
  I like it, since it is the most reliable on getting backtraces in case 
 of an 
  error. Bruno's stuff should generate backtraces too, but I had issues in 
  case of rethrowing catched errors. On the other hand, suspend and 
 generators 
  are little more try on when to put a * and when not, and result into 
 hangups 
  if you do it wrongly, while Brunos preprocessor proofed to be very 
 reliable 
  in pointing out a variety of coding errors. 
  
  My advice is, if you do a library that is to be used by others, you 
 ought to 
  use simple callbacks, as this is still the lingua franca in node world. 
  
  What you do inside is up to you and if you do an application or anything 
  that is not a library to be used by others, there is no definitive 
 answer, 
  do not listen to the gospel, try things out, look what works best for 
 you. 
  
  -- 
  Job board: http://jobs.nodejs.org/ 
  New group rules: 
  https://gist.github.com/othiym23/9886289#file-moderation-policy-md 
  Old group rules: 
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  --- 
  You 

Re: [nodejs] Re: Callback hell and how to get around it?

2014-09-16 Thread Alexey Petrushin
 I think you just reinvented node.js core function named 
`domain.intercept`. :)

Domains are still experimental (and doesn't have support in browser). Also, 
I believe that if you decide to use the dark side of the Force - it's 
better to use it at the full potential with the Fibers.

 Reads much nicer even if it is more lines of code. 

Nicer? :) Don't know, for me the nice version is the synchronous one (with 
generators, code generators, yields, fibers etc.), but I believe the 
version with fork is still shorter and simpler.


On Tuesday, 16 September 2014 04:38:53 UTC+4, Alex Kocharin wrote:

  
 I think you just reinvented node.js core function named 
 `domain.intercept`. :)
  
  
 16.09.2014, 01:34, Alexey Petrushin alexey.p...@gmail.com javascript:
 :

 I wrote short article 
 http://jslang.info/blog/2014/escape-from-callback-hell
  
 about simple approach that turn this
  
 var printCommentsForUser = function(login, password, cb){
   authenticateUser(login, password, function(err, user){
 if(err) return cb(err)
 getComments(user.id, function(err, comments){
   if(err) return cb(err)
   renderComments(user, comments, cb)
 })
   })
 }
 
 Into this
  
 var printCommentsForUserWithFork = function(login, password, ecb, cb){
   authenticateUser(login, password, ecb, function(user){
 getComments(user.id, ecb, function(comments){
   renderComments(user, comments, ecb, cb)
 })
   })
 }
 
 Or this
  
 var printCommentsForUserWithTwoCallbacks = function(login, password, 
 ecb, cb){
   authenticateUser(login, password, ecb, function(user){
 getComments(user.id, ecb, function(comments){
   renderComments(user, comments, ecb, cb)
 })
   })
 }

 On Monday, 15 September 2014 20:28:28 UTC+4, Ingwie Phoenix wrote:

 Hai, everyone. 

 So I just figured out that Connect’s static file servers dont work well 
 with symlinks…so I had tow rite myself a little workaround, a fallback 
 router, per-se. But whilst I did so, I had a nice meeting with the callback 
 hell. Here’s my code: 

 CDN.use(config.CDN.baseUrl, function(req, res, next){ 
 if(err) { next(); throw err; } 
 fs.lstat(config.base+/cdn+req.url, function(err,stats){ 
 if(stats.isSymbolicLink()) { 
 fs.readlink(config.base+/cdn+req.url, 
 function(err, linkstr){ 
 if(err) throw err; 
 log.info(Redirecting request \+req.url+\ 
 to \+linkstr); 
 fs.readFile(linkstr, function(err, data){ 
 if(err) throw err; 
 
 res.writeHead(200,{Content-type:text/html}); 
 res.end(data); 
 }); 
 }); 
 } 
 }); 
 }); 
 }); 

 Okay…thats lots. And how does one get around this and into a bit of nicer 
 code? It almost looks like a little pyramid there… 

 Kind regards, Ingwie.

  
 -- 
 Job board: http://jobs.nodejs.org/
 New group rules: 
 https://gist.github.com/othiym23/9886289#file-moderation-policy-md
 Old group rules: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 To post to this group, send email to nod...@googlegroups.com javascript:
 .
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/nodejs/32603590-e433-43a9-860a-8c12fdbac3f9%40googlegroups.com
  
 https://groups.google.com/d/msgid/nodejs/32603590-e433-43a9-860a-8c12fdbac3f9%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.



-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/30d59dad-1844-41a2-b3e7-910941667055%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Callback hell and how to get around it?

2014-09-15 Thread Alexey Petrushin
I wrote short article http://jslang.info/blog/2014/escape-from-callback-hell

about simple approach that turn this

var printCommentsForUser = function(login, password, cb){
  authenticateUser(login, password, function(err, user){
if(err) return cb(err)
getComments(user.id, function(err, comments){
  if(err) return cb(err)
  renderComments(user, comments, cb)
})
  })
}

Into this

var printCommentsForUserWithFork = function(login, password, ecb, cb){
  authenticateUser(login, password, ecb, function(user){
getComments(user.id, ecb, function(comments){
  renderComments(user, comments, ecb, cb)
})
  })
}

Or this

var printCommentsForUserWithTwoCallbacks = function(login, password, 
ecb, cb){
  authenticateUser(login, password, ecb, function(user){
getComments(user.id, ecb, function(comments){
  renderComments(user, comments, ecb, cb)
})
  })
}

On Monday, 15 September 2014 20:28:28 UTC+4, Ingwie Phoenix wrote:

 Hai, everyone. 

 So I just figured out that Connect’s static file servers dont work well 
 with symlinks…so I had tow rite myself a little workaround, a fallback 
 router, per-se. But whilst I did so, I had a nice meeting with the callback 
 hell. Here’s my code: 

 CDN.use(config.CDN.baseUrl, function(req, res, next){ 
 if(err) { next(); throw err; } 
 fs.lstat(config.base+/cdn+req.url, function(err,stats){ 
 if(stats.isSymbolicLink()) { 
 fs.readlink(config.base+/cdn+req.url, 
 function(err, linkstr){ 
 if(err) throw err; 
 log.info(Redirecting request \+req.url+\ 
 to \+linkstr); 
 fs.readFile(linkstr, function(err, data){ 
 if(err) throw err; 
 
 res.writeHead(200,{Content-type:text/html}); 
 res.end(data); 
 }); 
 }); 
 } 
 }); 
 }); 
 }); 

 Okay…thats lots. And how does one get around this and into a bit of nicer 
 code? It almost looks like a little pyramid there… 

 Kind regards, Ingwie.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/32603590-e433-43a9-860a-8c12fdbac3f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: javascript callback guard - prevents a callback to be called twice

2014-08-25 Thread Alexey Petrushin
Usually such errors are tiny and non critical, unless you can start to see 
it when you need to build something complex that works reliably.

I didn't experienced any problem with node.js for couple of projects (also, 
I use Fibers and don't have any problems with asynchronous issues at all). 

Until the recent project - web crawler distribute over bunch of machines. 
In my cases it happened in the following scenario - everything works nice, 
and you deploy it. And after half a day half of machines becomes zombie. 
And you start to searching for this sort of tiny problems (also another 
pain in the ass - if sometimes, rarely, some vendor library throws 
unhandled exception you can't intercept and properly destroy something). 

It's very hard to deal with, such bugs can easily take 30% of development 
time, it's especially complex because it's very hard to reproduce.

On Friday, 22 August 2014 12:35:29 UTC+4, Alisson Cavalcante Agiani wrote:

 How do people stumble upon this kind of error?


 On Thu, Aug 21, 2014 at 3:24 PM, Alexey Petrushin alexey.p...@gmail.com 
 javascript: wrote:

 In my understanding the problem is not that it's not possible to prevent 
 callback from being called twice, with underscore it's as simple as `cb = 
 _(cb).once()` - but the problem is that it's cumbersome to do it everywhere.

 On Wednesday, 20 August 2014 00:18:30 UTC+4, Simon Doodkin wrote:

 Not long ago, T.J. complained in an article that he doesn't likes that 
 in node.js sometimes callbacks are called more than once.
 i have a simple solution for this if you need it. also i can suggest 
 that if you have callback problems you could use https://github.com/
 mattinsler/longjohn module to trace the problem. id did it several 
 times.

 cbguard:  https://gist.github.com/shimondoodkin/a6762d8ab29ea497e245

 // cbguard by Shimon Doodkin - license: public domain
  
 function cbguard(cb,printerr){ //kind of filter for callbacks. it prevents 
 a callback to be called twice
  var cb1=cb;
  return function() {
   if(cb1) { var cb2=cb1; cb1=false; return cb2.apply(this,arguments); }
   else if(printerr)console.log(new Error('cb called twice').stack);
  }
 }
  
 // usage example:
 //function myfunction(cb)
 //{
 //  cb=cbguard(cb);  // usage example
 // // or
 // // cb=cbguard(cb,true);  // good when developing, it will protect and 
 also tell you you have a problem, here a callback is called twice here.
 //
 // things that are based on event emitteres are usually have problems with 
 multiple callbacks.
  

  -- 
 Job board: http://jobs.nodejs.org/
 New group rules: 
 https://gist.github.com/othiym23/9886289#file-moderation-policy-md
 Old group rules: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 To post to this group, send email to nod...@googlegroups.com 
 javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/nodejs/0bfddd86-2dfd-4e35-a3a4-72c323e739b7%40googlegroups.com
  
 https://groups.google.com/d/msgid/nodejs/0bfddd86-2dfd-4e35-a3a4-72c323e739b7%40googlegroups.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/1faa6313-be18-4e6c-9dd1-d2419426ded5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: javascript callback guard - prevents a callback to be called twice

2014-08-21 Thread Alexey Petrushin
In my understanding the problem is not that it's not possible to prevent 
callback from being called twice, with underscore it's as simple as `cb = 
_(cb).once()` - but the problem is that it's cumbersome to do it everywhere.

On Wednesday, 20 August 2014 00:18:30 UTC+4, Simon Doodkin wrote:

 Not long ago, T.J. complained in an article that he doesn't likes that in 
 node.js sometimes callbacks are called more than once.
 i have a simple solution for this if you need it. also i can suggest that 
 if you have callback problems you could use 
 https://github.com/mattinsler/longjohn module to trace the problem. id 
 did it several times.

 cbguard:  https://gist.github.com/shimondoodkin/a6762d8ab29ea497e245

 // cbguard by Shimon Doodkin - license: public domain
  
 function cbguard(cb,printerr){ //kind of filter for callbacks. it prevents a 
 callback to be called twice
  var cb1=cb;
  return function() {
   if(cb1) { var cb2=cb1; cb1=false; return cb2.apply(this,arguments); }
   else if(printerr)console.log(new Error('cb called twice').stack);
  }
 }
  
 // usage example:
 //function myfunction(cb)
 //{
 //  cb=cbguard(cb);  // usage example
 // // or
 // // cb=cbguard(cb,true);  // good when developing, it will protect and also 
 tell you you have a problem, here a callback is called twice here.
 //
 // things that are based on event emitteres are usually have problems with 
 multiple callbacks.
  



-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/0bfddd86-2dfd-4e35-a3a4-72c323e739b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Does `node --harmony` works stable on all platforms?

2014-08-14 Thread Alexey Petrushin
Want to try generators `node --harmony` but worried a little about:

- if it works on all platforms?
- does the API stable and won't be changed in future?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/8b38197f-f99b-49cc-872b-793727b90598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: What should I read to master node.js?

2014-08-04 Thread Alexey Petrushin
To master something you should do it, not read it or learn it.

On Monday, 4 August 2014 09:35:29 UTC+4, Martin Ransome wrote:

 What should I read to master node.js?


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/0e9069a5-82fc-4695-9fad-40095730e271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Callbacks vs Fibers Memory Consumption Benchmark

2014-08-02 Thread Alexey Petrushin
There where talk about disadvantage of using Fibers because it has huge 
stack and consumes more memory.

I wanted to know exactly how much more memory it consumes and created 
simple test - it creates 8000 callbacks  8000 fibers and you can measure 
how much memory each version consumes.

8000 Callbacks - 13 MB
8000 Fibers - 90 MB

1. Seems like huge difference? I don't think so. In most web projects 
(practically all classical web apps, like express.js etc.) you don't deal 
with huge amount of requests, maybe couple tens or hundreds per second. 

3. Even in 10k apps - node can serve maybe 1-4000 on one machine, so, the 
difference would be much less, something around 12Mb vs. 40Mb.

3. It's an empty sample, in most cases you use some data inside it - it 
takes memory - and the results would be more even.

The test https://gist.github.com/alexeypetrushin/f2fc65c6e9f4a10ac3cc

Would be interesting to know what do you think about it? Maybe there are 
points I missed?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/76985c32-2420-4744-baef-976398aadcba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Async iterators. What do you think?

2014-07-22 Thread Alexey Petrushin
I'm not sure that your iterator is async - there's no way to stop and 
continue on demand. You may also try something like this

collection.asyncEach(function(err, chunk, next){
  if(err) throw err
  console.log(chunk)
  next()
})

On Tuesday, 22 July 2014 21:11:34 UTC+4, Santiago Basulto wrote:

 Hello guys. I've been doning some experiments with Async iterators. You 
 can find more details in the repo I created[1] but I'll explain my 
 rationale behind it quickly: I'm a heavy python user and I love iterators. 
 They provide a nice and clean interface. When I started to get into node.js 
 I noticed the lack (or the lower use, to be precise) of them and started 
 doing some research. The problem I found was that, for async architectures, 
 blocking/regular iterators doesn't look like a good fit. Well, that's just 
 something I think, maybe I'm wrong. Please share your thoughts.

 [1] https://github.com/santiagobasulto/async-iterators


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/35643bf0-9e12-4b26-9648-c316bda312bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: TJ Holowaychuk is leaving the community and now

2014-07-20 Thread Alexey Petrushin
Streams for example aren't part of v8.

On Sunday, 20 July 2014 06:19:49 UTC+4, Phoscur wrote:

  Aren't we just speeding on the work of the V8 team? NodeJS just leverages 
 a low level API to that beast (and that's why there are callbacks, they are 
 low level function blocks in javascript.
 So it's not about performance and Callbacks..

 Where exactly are the usability leaks?

 TJ thank you for your great frameworks like express, socket.io  co!

 Ph

 Am 07.07.2014 06:28, schrieb tjholowaychuk:
  
 Weird apparently what I posted didn't work. Anyway I think it's a very odd 
 choice for a JavaScript platform to strive for performance over usability, 
 usability is the *only* reason you would ever go with JavaScript, because 
 people know it. It's a terrible choice of a language if you're shooting for 
 raw performance, and even worse is that you really shouldn't scale your 
 application based on raw performance. If you have to serve tons of requests 
 then you also have the money to spawn an machine or two, look at YouTube 
 even it uses Python and it's much larger than anything node has been used 
 for, it's really just not a concern these days. Startups should be 
 concerned with robustness, not raw performance that they don't even need.

 On Sunday, 6 July 2014 20:04:43 UTC-7, Chaoran Yang wrote: 

 I think what TJ complained about Nodejs are valid points. However I also 
 think Nodejs preference of performance over usability is not wrong. We need 
 to understand the Nodejs is not the best choice for all web applications, 
 just like C is not the best choice for programs. There are already loads of 
 languages that favors usability, and Nodejs should not become one of them. 
 Nodejs exists because it is different. It provides an alternative for those 
 who cares about performance, and doesn't bother to get their hands dirty in 
 low level details. 

  I do agree with TJ with the fact that Streams are broken in Nodejs is 
 becoming a problem. It should be a major help for simplifying asynchronous 
 programming but it is still in unstable state now.

  Chaoran

 On Friday, July 4, 2014 10:40:25 AM UTC-5, vitor.sh...@gmail.com wrote: 

 TJ is leaving node as he posted here 
 https://medium.com/code-adventures/4ba9e7f3e52b  

  What do you think about it and what projects are you using that came 
 from him?
  
   -- 
 Job board: http://jobs.nodejs.org/
 New group rules: 
 https://gist.github.com/othiym23/9886289#file-moderation-policy-md
 Old group rules: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 To post to this group, send email to nod...@googlegroups.com javascript:
 .
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/nodejs/8bfb84c3-60ae-4848-8fce-deae4f6367d8%40googlegroups.com
  
 https://groups.google.com/d/msgid/nodejs/8bfb84c3-60ae-4848-8fce-deae4f6367d8%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


  

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/228e5b61-2c35-490e-afff-bb8e5b32a474%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: how to manage functionality and ui/templates using nodejs

2014-06-20 Thread Alexey Petrushin
We use browserify to assemble our application. It also handles things like 
pre-compiling Templates, CoffeeScript etc.

In the end the application assembled very much like any server-side node.js 
app.

On Thursday, 19 June 2014 22:27:47 UTC+4, MC wrote:

 Hello,
 I'm working on a project that provides multiple services/views as part of 
 one online experience. For example the system provides a list of products 
 (catalog) as one service, and a shopping cart as another. Both can be 
 rendered for web/desktop and web/mobile. In case of mobile experience some 
 components visible on the web/desktop site can be removed.
 Currently the company is developing a large monolithic application which 
 is supposed to handle everything. The thing is that system is non-standard 
 (house built), buggy and very complex. At the moment I'm spending more time 
 on trying to integrate with it than on adding new features.

 I was wondering if it would be possible to share both functionality and ui 
 (e.g. dust templates) as nodejs modules? So that final application (e.g. 
 shopping cart for web/mobile) can include the modules needed and only 
 assemble them in app.js with some modification?

 Current project structure for nodejs keeps client/browser data in 'public' 
 folder, and server/service code ends up in views/libs/modules, etc. I 
 experimented with storing dust templates inside modules and it looks like 
 it can be done, but haven't tried it with client side js.

 I'd like to see if anyone has encountered similar issues when integrating 
 vertically separated nodejs applications into one online experience. If so 
 I'd appreciate it if you could share your thoughts/findings on the subject. 
 I'd like to find a more modular approach, something more natural for 
 nodejs, as a replacement for the monolithic app I'm working with today.
 Thanks,

 M




-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c4f99cfd-00d0-42b9-98a5-425fc18657e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Node.js NPM on a multi-user-machine

2014-06-17 Thread Alexey Petrushin
Had similar problem while setting up Jenkins CI with Node.js. Ended up 
installing it locally for every user that needs it and altering path env 
variable.

Maybe there's better way, but in our case it was sufficient.

On Friday, 13 June 2014 18:06:57 UTC+4, Sebastian Sester wrote:

 Dear all,

 I'm trying to set up Node.js and NPM on a multi-user-machine so it can be 
 used for all users without requiring sudo.
 I followed the instructions for backporting Node to Wheezy [0] and am now 
 able to run nodejs (and node) for all users.
 Since I do need npm, too, I did as recommended and used the install script 
 given on the website.

 But since npm gets installed to /usr/local, I can't execute it without 
 sudo. Also, changing the ownership of /usr/local/… to my user (as often 
 suggested) won't help, since other users need to access it, too.

 Is there any documentation on how to do this correctly?

 Thanks in advance,
 Sebastian

 [0] 
 https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#backports


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/81892c6b-6634-4c41-a656-028008c6b402%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: How to make Transfer-Encoding: chunked work?

2014-06-10 Thread Alexey Petrushin
Does anyone managed to get it work in Chrome?

It works with curl, but it doesn't work with Chrome.

On Sunday, 18 July 2010 19:46:02 UTC+5, Eric Fong wrote:

 Hi 

 I have a stupid question. I have following code and hoping the data 
 chunks render one by one. 
 But my chrome wait 3 second and render everything all in one. Anyway 
 to make it works? 

 var http = require('http'); 
 http.createServer(function (request, response) { 
   response.writeHead(200, { 
   'Content-Type': 'text/plain', 
   'Transfer-Encoding': 'chunked' 
   }); 
   setTimeout(function(){ 
   response.write('25\n'); 
   response.write('This is the data in the first chunk\n\n'); 
   }, 1000); 
   setTimeout(function(){ 
   response.write('1C\n'); 
   response.write('and this is the second one\n\n'); 
   }, 2000); 
   setTimeout(function(){ 
   response.end('0'); 
   }, 3000); 
 }).listen(8124); 
 console.log('Server running at http://127.0.0.1:8124/'); 

 Thanks

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/5bf23582-a482-48b3-af11-2d2fc08b4bba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Get stream from executing `tail -f app.log | grep error`?

2014-06-10 Thread Alexey Petrushin
Hi, I'd like to provide administrative app with a page when you can see 
live logs. To do so I need to execute `tail -f app.log | grep error` and 
get the output chunk by chunk (streaming) as it get added to log file. But 
the problem is:

1. child_process.exec doesn't have streaming, it return only when the child 
process is terminated
2. child_process.spawn does have streaming, but it can execute only 
commands, it can't execute complex expressions like `tail -f app.log | grep 
error`

Is there an easy way to solve it?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/1440f34a-efb2-4613-af51-b3b5778bfbff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: node js and html

2014-06-10 Thread Alexey Petrushin
button function ha-ha, remind me times of Borland Delphi :)

On Tuesday, 10 June 2014 18:13:33 UTC+4, alan Horman wrote:

 Hi there,

 I wanna know how is possible to make a button function in html using 
 node js.
 maybe is simple but I have no Ideas how it works or how i can beginn 
 I need help and if it´s possible to get a source code , let me know please.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/844581d0-a0b1-42fe-a7bb-fb196fb51f7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Alternative to DNode (RPC)?

2014-06-09 Thread Alexey Petrushin
DNode is very cool library (especially with Fibers - magically your remote 
calls looks like usual local calls), but I have two issues with it:

- Sometimes its client can't connect to remote server (don't know why, 
happens randomly, sometimes connect sometimes just hands and waits for 
something).
- Seems like it's abandoned.

Is there any alternative?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/5b69ccc0-b838-435e-8876-dbf9284cdcef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Database with streaming blob support

2014-05-21 Thread Alexey Petrushin
s3? Distributed file systems?

On Tuesday, 20 May 2014 18:00:29 UTC+4, Matt Sergeant wrote:

 What options are out there currently for streaming blob support in Node.js 
 databases?

 I know that MongoDB has GridFS which seems to support streams. Are there 
 any others?


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/86c8ae31-e5f2-4a67-bdb2-f0a6b5a0b761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: porting a library to node.js

2014-05-12 Thread Alexey Petrushin
1. No, but there are Fibers
2. Yes, with Fibers.

But you should know that this approach is considered as heresy by righteous 
node.js developers ;)

On Sunday, 11 May 2014 16:21:54 UTC+4, Massimiliano Tomassoli wrote:

 Hi everyone,
 I'd like to port a Dart library to node.js (
 https://github.com/mtomassoli/golib) but I don't know much about node.js.
 I have some questions:

1. Do you already have goroutines and channels in node.js?
2. Can I use *yield*?
3. How can I add a function to the event loop? (I'll need to emulate 
Dart's completers)
4. What's the structure of a node.js library/module? Any links?

 Thanks.




-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/86d11921-d1bc-421b-b20f-651d5ff3dbe8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Visual modelling design tools for node and web dev in general?

2014-05-05 Thread Alexey Petrushin
I remember those good old times back in 2006, when grass was green and we 
use Rational Rose doing respectable JEE businesses.

Why whould you want it? Rational Rose is s ha-ha, let's say it a 
serious tool :). It's so serious that in 99% of project it's just too 
serious to be usefull.

There are paper and pen - just draw it and take a picture with phone, or 
use virtual pen, there are also drawings in google docs. Usually it's 
ennough.

On Monday, 5 May 2014 15:25:28 UTC+4, Andrew Willshire wrote:

 Hi All,

 I'm somewhat new to the paradigm of node development.  I come from a C++ 
 background, and have traditionally used tools like Rational Rose for UML 
 modelling.

 What I'm wondering (and I've google a bit plus searched this group), are 
 there any visual tools used for modelling web apps in general and node in 
 particular.  I'm not after fancy round-trip software engineering tools. 
  Just something that readily lends itself to the process of modelling a web 
 app, so I can collect my thoughts as I design.

 Maybe such a tool isn't around, and people have a different workflow when 
 doing web development.  Or maybe it's just standard to use Visio or a 
 whiteboard.

 I've studied a number of texts on node, and while all good with the hands 
 on use of the various frameworks, I'm yet to see one that covers the 
 analysis  design approach.

 However, if anybody does have any suggestions about how you approach the 
 design/modelling stage I would be keen to hear them.  

 Thanks,
 Andrew.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/dd7970e3-646c-45a9-ad48-affb6ff82fd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: CMS Websites Services in USA | UK | SINGAPORE | CANADA | Malaysia | India

2014-05-01 Thread Alexey Petrushin
Doesn't Google Groups to just ban spammers? I believe it should be possible.

On Thursday, 1 May 2014 12:41:33 UTC+4, avein...@gmail.com wrote:

 Ave Infosys is a leading professional in Web Designing Company in 
 Hyderabad India for the E-Business Industry.Ave Infosys 

 are providing Best Website Development and Design Services in 
 Hyderabad.Our company offers the Best *CMS Websites Services 
 http://aveinfosys.com/cms-websites*, 

 Web Design  Development services, Web Hosting services. We have intensive 
 web design and web skills merging with the 

 quality essence of expertise should have component to help you to 
 ascertain your internet presence or take it to the next 

 level.we are the Best Web Design Company in Hyderabad.

 For More Details :

 Please contact: (+91) 40 40275321

 Email : in...@aveinfosys.com javascript:

 web : http://aveinfosys.com/cms-websites


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: NodeJS Application Design Architecture

2014-05-01 Thread Alexey Petrushin
Why not just use direct access to queue (or database), as proposed before? 
Why do you want do to extra work with REST/SOAP stuff?

Node.js - Queue (Redis, Rabbit, MongoDB, ) - NET

On Thursday, 1 May 2014 14:47:02 UTC+4, Joseph Baiden wrote:

 Thanks John, I have just had a discussion and the flow is actually 
 expected to be as follows:
  
 1. Request is entered on NodeJS/Express webpage
 2. Request is put in MongodB?
  2. Batch process that runs every 15 mins  Calls Soap/REST Service 
 from NodeJS (collecting the data from MongodB?)
  3. Soap/REST Response: List of items entered via NodeJS website (in 
 MongodB)

  4. Goes through REST service
  5. SOAP/Rest service takes information, formats them and send to AGM
via a receiver service in AGM.
  
 Any thoughts on this or any other suggestions?
  
 regards,
 John


 On 29 April 2014 04:46, John Teague jcte...@gmail.com javascript:wrote:

 You've got a couple of options.  Edge.js would definitely work but you 
 may not need it.  Assuming the front end is web based, choose your favorite 
 nodejs web framework http://nodeframework.com/ and then put the result 
 on some kind of queue (redis,msmq, azure, etc..) for your .net code to pick 
 up and get imported into AGM. 


 On Sun, Apr 27, 2014 at 3:07 PM, Joseph Baiden 
 joseph@gmail.comjavascript:
  wrote:

 a collegue has done it through sharepont, will discuss with him 
 tomorrow. All data is captured through sharepoint and they appear in AGM



 On 27 April 2014 17:45, Kevin Ingwersen 
 ingwi...@googlemail.comjavascript:
  wrote:

 How would you be able to interface HP AM? That is quite important. Do 
 you use sockets, HTTP requests, actual C++ bindings?
 Am 27.04.2014 um 14:48 schrieb Joseph Baiden 
 joseph@gmail.comjavascript:
 :

 OK. Is there any way I can develop the application on Node.js to 
 interact with HP AgileManager, so that data entered via Node.js 
 application 
 will populate in AgileManager?

 What I would like to see now is the application design just for the 
 Nde.js application, the relevant modules, etc


 On 27 April 2014 10:30, Bruno Jouhier bjou...@gmail.com 
 javascript:wrote:

 Did you look at edge.js?

 http://www.infoq.com/articles/the_edge_of_net_and_node


 On Sunday, April 27, 2014 10:10:44 AM UTC+2, Joseph Baiden wrote:

 Hi All,

 I have a work-related project to develop an application using NodeJS. 
 This application needs to capture data and use wrapper classes developed 
 in 
 C# to send the captured data to HP AGM. The first part of the project is 
 to 
 come up with the design- the architectural layout of the application. 
 Any 
 ideas?


 -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups nodejs group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/nodejs/XlV_cC6gw5o/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.



 -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --- 
 You received this message because you are subscribed to the Google 
 Groups nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to nodejs+un...@googlegroups.com javascript:.

 For more options, visit https://groups.google.com/d/optout.


  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups nodejs group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/nodejs/XlV_cC6gw5o/unsubscribe.
 To unsubscribe 

Re: [nodejs] node.js cluster multiprocess logging solution

2014-04-29 Thread Alexey Petrushin
Adam Wiggins, one of creator of Heroky wrote interested post about logging, 
you may find it interesting
http://adam.heroku.com/past/2011/4/1/logs_are_streams_not_files/

On Monday, 28 April 2014 14:48:46 UTC+4, Jose Luis Rivas wrote:

 I would suggest you to not write directly but redirect output to a file. 

 node app.js  file.log 

 keep it simple. 

 On 4/28/14, 5:45 AM, gen chen wrote: 
  I am now working on a node.js project based on cluster.  I got stuck on 
  the logging.  After doing some research, I worked out a solution. here 
  is it. i don't know if it is a good idea.  The idea is like this.  only 
  master process can wirte to the log file, if the current process is a 
  worker, then it send a log message to the master and then write to the 
  log file while the master can directly write to the log file. this can 
  avoid multiple process open and write to a same file. 
  
  var util = require('util'); 
  var fs = require('fs'); 
  var cluster = require('cluster'); 
  
  var logger = module.exports; 
  
  var levels  = ['debug', 'info', 'warn', 'error', 'fatal']; 
  var logLevel = 'debug'; 
  
  var logfile = null; 
  var errorLogfile  = null; 
  
  
  if(cluster.isMaster){ 
  
  logfile = fs.createWriteStream('debug.log', {flags:'a'}); 
  errorLogfile = fs.createWriteStream('error.log', {flags:'a'}); 
  
  cluster.on('online', function(worker){ 
  //collect log message from child and write to logfile. 
  worker.on('message', function(msg){ 
  if(msg.type == 'logging') { 
  var level = msg.data.level; 
  var logStr = msg.data.msg; 
  if(levels.indexOf(level) = levels.indexOf('error')){ 
  errorLogfile.write(logStr + '\n'); 
  }else{ 
  logfile.write(logStr + '\n'); 
  } 
  } 
  }); 
  }); 
  } 
  
  
  function log(level, args){ 
  
  if(levels.indexOf(level)  levels.indexOf(logLevel)) return; 
  
  var args = Array.prototype.slice.call(args); 
  
  args = args.map(function(a){ 
  if(typeof a !== 'string') 
  return JSON.stringify(a); 
  else return a; 
  }); 
  var msg = util.format.apply(null, args); 
  
  var out = []; 
  out.push(new Date()); 
  out.push('[' + level.toUpperCase() + ']'); 
  out.push(msg); 
  
  
  if(cluster.isMaster){ 
  
  //write directly to the log file 
  if(levels.indexOf(level) = levels.indexOf('error')){ 
  errorLogfile.write(out.join(' ') + '\n'); 
  }else{ 
  logfile.write(out.join(' ') + '\n'); 
  } 
  
  }else{ 
  
  //send to master 
  cluster.worker.process.send({ 
  type : 'logging', 
  data : { 
  level : level, 
  msg : out.join(' ') 
  } 
  }); 
  } 
  
  } 
  
  
  logger.debug = function(){log('debug', arguments);} 
  logger.info = function(){log('info', arguments);} 
  logger.warn = function(){log('warn', arguments);} 
  logger.error = function(){log('error', arguments);} 
  logger.fatal = function(){log('fatal', arguments);} 
  
  
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
  an email to nodejs+un...@googlegroups.com javascript: 
  mailto:nodejs+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 

 -- 
 Jose Luis Rivas - http://joseluisrivas.net 
 Venezuela - GPG: 0xB9AC8C43 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-04-27 Thread Alexey Petrushin
Yes, it is true, and thanks for your work. I don't meant it to sounded like 
complains, just mentioned that it's right now not very stable.

And, also it seems that the cause of bugs not in the bindings but in 
phantom.js itself, seems like it doesn't support such non standard way to 
communicate very well.

On Sunday, 27 April 2014 08:56:52 UTC+4, Matt Sergeant wrote:


 On Sat, Apr 26, 2014 at 1:00 PM, Alexey Petrushin 
 alexey.p...@gmail.comjavascript:
  wrote:

 - pahntom.js is incompatible with node.js, there are some non-standard 
 bindings, I tried 3 such bindings but for me all of them worked very 
 unstable, so I just given up at the end.


 You know - the authors of said bindings (myself in particular) are very 
 open to bug reports and fixing any issues. I've done many updates to 
 node-phantom-simple in the last year based on bugs reported.

 I will say that it's unfortunate that there are so many broken bindings on 
 npm, especially given they grabbed the big names (I'm looking at you, 
 phantom and node-phantom on npm). But node-phantom-simple follows the 
 node style (error first), and has been battle tested at a large scale user. 
 If you find bugs it helps everyone if you report them.

 Matt. 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-04-26 Thread Alexey Petrushin
In my case phantom.js had issues like: 

- sometimes site uses broken HTML and jQuery gives different result in 
phantom than in the Chrome
- there was cases when I can't trigger 'click' event by phantom, when the 
site uses some strange ways to register onclick function.
- pahntom.js is incompatible with node.js, there are some non-standard 
bindings, I tried 3 such bindings but for me all of them worked very 
unstable, so I just given up at the end.

import.io - an interesting idea, seems like usefull service. But, sadly in 
our case it was a little more complicated, there are lots of complex 
interactions (like click here wait till something appears there if it 
appears next go here if it not appears go there etc.). I doubth you can 
program such behavior using GUI or some sort of DSL. 

Also, we use it heavily and it consumes huge amount of resources (99% 
consumes Selenium + Browser Emulators), it costly even if you pay only for 
the physical servers. If on the other hands you use services provided by 
other company and pay twice - for the servers and for their service - it 
would cost us even more. In our case it was cheaper to spend one month in 
developing such service by ourselves.

On Saturday, 26 April 2014 17:29:56 UTC+4, Duy Nguyen wrote:

 I did a scraper with phantomjs before, it works great but I think you 
 should take a look at https://import.io/




 On Sat, Apr 26, 2014 at 7:42 AM, Alexey Petrushin 
 alexey.p...@gmail.comjavascript:
  wrote:

 I finished such project recently - Crawler for JavaScript Sites, with 
 Browser Emulator (Selenium). 

 It's a private project, but I wrote some details about it and how it 
 works, maybe it will be interested for someone.

 http://alex-craft.com/blog/2014/crawling-javascript-sites

 On Thursday, 16 January 2014 06:09:48 UTC+4, Victor Hooi wrote:

 Hi,

 I'm wondering if anybody knows of any web-scraping frameworks in Node.JS?

 Previously, there was node.io (https://github.com/chriso/node.io), 
 however, the project was recently discontinued.

 Googling for Node.JS and web scraping, most of the guides online just 
 talk about using requests and cheerio - it works, but you need to handle a 
 whole bunch of things yourself (throttling, distributing jobs, 
 configuration, managing jobs etc.).

 On the Python side, I know of Scrapy (https://github.com/scrapy/scrapy), 
 which is using Twisted for asynchronicity

 On the Ruby side, Nokogiri (http://nokogiri.org/) is meant to be good, 
 although I haven't dived into it much.

 Is there anything equivalent in the Node world? Or what approaches are 
 people using to tackle this problem?

 Cheers,
 Victor

  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Nguyen Hai Duy
 Mobile : 0914 72 1900
 Skype: nguyenhd2107
 Yahoo: nguyenhd_lucky
  

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: NodeJs e-commerce solution?

2014-04-26 Thread Alexey Petrushin
Couple of months ago I did a Cart Widget that can be embedded into site and 
kind of turn it into Shop. 

Here it is http://salejs.com sources 
https://github.com/alexeypetrushin/salejs

Here's how it looks embedded in site http://robotigra.ru (top right angle)

Also, while creating it I recorded every step and if you are interesting in 
learning JS, maybe it can be useful http://jslang.info/projects/salejs

On Thursday, 10 May 2012 22:55:51 UTC+4, guzelgoz wrote:

 Hi all,

 I've been searching and searching but couldn't find any project/open 
 source node e-commerce platform. As I am running some e-commerce websites 
 using the PhP prestashop solution, I was really hoping to find some sort of 
 e-commerce project but Nada!

 Ideally, I would like to use Expressjs and MongoDB. Do you know any 
 e-commerce project that I could participate?

 If not, I would like to invite anybody to start a project. I think it 
 would have great interest and at least I would participate to it - as a 
 novice node programmer ;) but a serious user that may help on what is 
 needed.

 Looking forward to your feedbacks!
 Thanks,
 Hakan


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-04-25 Thread Alexey Petrushin
I finished such project recently - Crawler for JavaScript Sites, with 
Browser Emulator (Selenium). 

It's a private project, but I wrote some details about it and how it works, 
maybe it will be interested for someone.

http://alex-craft.com/blog/2014/crawling-javascript-sites

On Thursday, 16 January 2014 06:09:48 UTC+4, Victor Hooi wrote:

 Hi,

 I'm wondering if anybody knows of any web-scraping frameworks in Node.JS?

 Previously, there was node.io (https://github.com/chriso/node.io), 
 however, the project was recently discontinued.

 Googling for Node.JS and web scraping, most of the guides online just talk 
 about using requests and cheerio - it works, but you need to handle a whole 
 bunch of things yourself (throttling, distributing jobs, configuration, 
 managing jobs etc.).

 On the Python side, I know of Scrapy (https://github.com/scrapy/scrapy), 
 which is using Twisted for asynchronicity

 On the Ruby side, Nokogiri (http://nokogiri.org/) is meant to be good, 
 although I haven't dived into it much.

 Is there anything equivalent in the Node world? Or what approaches are 
 people using to tackle this problem?

 Cheers,
 Victor


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Looking for Node JS- Lead Developer-(Perm Hire) in Pune------------------------------------------------------------------------------

2014-04-23 Thread Alexey Petrushin
http://alex-craft.com/documents/about

On Monday, 21 April 2014 23:52:16 UTC+4, Daniel Peters wrote:

 Node JS- Lead Developer-(Perm Hire)

 --

  

 *Experience- *3-5 Yrs years.

  

 *Position Qty *– 4

  

 *Salary Range*-(should be the expected CTC's of the candidates)

  

 2 – 3 Yrs: 5.Lpa – 6Lpa 

 3 – 4 Yrs: 6 Lpa – 7.5Lpa 

 4 – 5 Yrs: 7.5Lpa – 10Lpa

 Need*- Immediate Joiners to max 90 Days Joiners.

  

 First round will be telephonic followed by other F2F or Skype rounds.

  

 *Skills Required-*

  

  Excellent communication skills (Verbal  Written)*

  

 Excellent hands-on programming experience of Node.js
 minimum 6 months of NodeJS experience 

 Excellent in JavaScript

  

 Good understanding of Angular JS

 Good understanding of RESTful API development

 Good knowledge of TDD (Test Driven Development)

 Good knowledge of deploying app on Heroku, Amazon

  

 Good in HTML5, CSS3, LESS CSS and Responsive web development.

 Good understanding of jQuery, Bootstrap

  

 Good understanding of AGILE - SCRUM

 Good understanding of GitHUB, SVN

  

 Good understanding of third party API integration such as Linkedin, 
 Salesforce, Quickbooks

  

 Added advantage - MongoDB, Backbone.js, Mustache templates, MemCache.



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: OT: Bootstrap alternative

2014-04-23 Thread Alexey Petrushin
http://foundation.zurb.com

Also, you can set filters CSS in github search sort projects by count of 
stars (google how to do it) and investigate first 10 pages of results.

On Wednesday, 23 April 2014 21:05:15 UTC+4, Alejandro Paciotti Iacchelli 
wrote:

 What alternative would you recommend me to bootstrap as front-end 
 framework?


 Thanks!

 Ale Paciotti.

  

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Node/Javascript alternative to Graphite?

2014-04-20 Thread Alexey Petrushin
+1 also interested, and yes counters are important.

On Sunday, 20 April 2014 06:20:32 UTC+4, // ravi wrote:

 On Apr 19, 2014, at 9:19 PM, // ravi ravi-...@g8o.net javascript: 
 wrote:


 Anyone know of a NodeJS based (JavaScript) equivalent of Graphite (
 http://graphite.wikidot.com) the metric/stats collection engine/server? 
 I’d prefer a Node/JS version simply because I know I’ll end up hacking the 
 server a month into usage and I’d prefer to stick to JS for now.


 I did find Cube+Cubism, both of which are very neat, but Cubism’s 
 visualisation seems to be limited to horizontal time-series graphs (horizon 
 charts) and ideally I’d like some counters, etc.

 —ravi




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] How to kill callback by timeout?

2014-04-18 Thread Alexey Petrushin
Separate process is too costly. Well, it seems the way to go is to just 
ignore resource leaks (it should be small), and periodically restart the 
master process.

On Thursday, 17 April 2014 18:11:18 UTC+4, Alex Kocharin wrote:

  
 ... and if it doesn't, you can run it in the separate process, and kill 
 the entire process in case of failure. This way OS will clean up all 
 resources automatically.
  
  
 17.04.2014, 15:33, Francesco Mari mari.fr...@gmail.com javascript::

 Maybe you can check if the client has a timeout parameter or other 
 fallback strategies. If it does, you should trust the client that it 
 performs the appropriate cleanup of the resources it uses.
 Il 17/apr/2014 12:50 Alexey Petrushin alexey.p...@gmail.comjavascript: 
 ha scritto:

 I use wd.js (RESTful client to Selenium WebDriver) to connect to remote 
 server with running Selenium WebDriver controlling Chrome Browser. 
 It's used for web crawling and sometimes there are sites with bugs that 
 take too much memory or somehow other crush running Chrome Browser Process.
  
 In such cases (when Selenium Node stop responding) - there are background 
 processes that will kill whole Selenium  Chrome processes and restart it.
  
 The crawler itself don't know about all this stuff, it only knows list of 
 IP addresses with Selenium Nodes and uses it. And when it hangs - it can do 
 nothing about by himself, only wait until such hanging Selenium Node will 
 be discovered by other processes and rebooted.


 On Thursday, 17 April 2014 12:42:06 UTC+4, Francesco Mari wrote:

 I think that most of your answer depends on what 
 unsafeCallToSomeRemoteService does, and why the remote service is 
 unreliable. Can you provide more information about it? 

 2014-04-17 10:30 GMT+02:00 Alexey Petrushin alexey.p...@gmail.com: 
  Yes, I'm agree with your notes about the code and preventing callback 
 from 
  being called twice. 
  
  But what about memory and descriptors leaks, is there a way to terminate 
  hanging callback and clear it? Or I can just safely ignore those issues 
 and 
  node.js somehow will clear it internally? 
  
  
  On Thursday, 17 April 2014 12:21:56 UTC+4, Francesco Mari wrote: 
  
  Maybe you also want to prevent callback to execute twice if the timer 
  triggers and the remote service sends a response after the time limit. 
  
  function safeCallToSomeRemoteService(callback) { 
var done = callback; 
  
var timer = setTimeout(function() { 
  var temp = done; 
  done = function () {}; 
  temp(new Error('Remote service timed out!')); 
}, 3000); 
  
unsafeCallToSomeRemoteService(function(err, data){ 
  clearTimeout(timer); 
  done(err, data); 
}); 
  } 
  
  2014-04-17 2:06 GMT+02:00 Ryan Graham r.m.g...@gmail.com: 
   
   On Wed, Apr 16, 2014 at 11:17 AM, Alexey Petrushin 
   alexey.p...@gmail.com wrote: 
   
   Is it possible to do something like this? 
   
   function safeCallToSomeRemoteService(callback){ 
 var remoteServiceResponded = false 
 unsafeCallToSomeRemoteService(function(err, data){ 
   remoteServiceResponded = true 
   callback(err, data) 
 }) 
   
 setTimeout(function(){ 
   if(!remoteServiceResponded){ 
 somehow kill callback waiting for remote service 
 callback(new Error(Remote service hanged!)) 
   } 
 }, 3000) 
   } 
   
   Or, if it's not possible, is it safe to just ignore such hanged 
   callbacks, 
   call callback on timeout and move on (while leaving hanging callback 
   active)? 
   
   
   Ignoring whether there are better options available through the API 
 you 
   are 
   using, the generic timeout code would look something like this: 
   
   function safeCallToSomeRemoteService(callback) { 
 var timer = setTimeout(function() { 
   callback(new Error('Remote service timed out!')); 
 }, 3000); 
   
 unsafeCallToSomeRemoteService(function(err, data){ 
   clearTimeout(timer); 
   callback(err, data); 
 }); 
   } 
   
   ~Ryan 
   
   -- 
   http://twitter.com/rmgraham 
   
   -- 
   -- 
   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 subscribed to the Google 
   Groups nodejs group. 
   To post to this group, send email to nod...@googlegroups.com 
   To unsubscribe from this group, send email to 
   nodejs+un...@googlegroups.com 
   For more options, visit this group at 
   http://groups.google.com/group/nodejs?hl=en?hl=en 
   
   --- 
   You received this message because you are subscribed to the Google 
   Groups 
   nodejs group. 
   To unsubscribe from this group and stop receiving emails from it, 
 send 
   an 
   email to nodejs+un...@googlegroups.com. 
   For more options, visit https://groups.google.com/d/optout. 
  
  -- 
  -- 
  Job Board: http

[nodejs] Re: Synchronous?

2014-04-18 Thread Alexey Petrushin
Actually you can, with Fibers. Making asynchronous function to behave like 
synchronous is as simple as

fn = sync(fn)

More details http://alexeypetrushin.github.io/synchronize

On Friday, 18 April 2014 19:24:47 UTC+4, Kevin Burton wrote:

 I notice that simply leaving off the callback or making a callback null 
 doesn't always make a node function synchronous. What is a good general 
 pattern for making a node method synchronous (assuming the source for the 
 method is available)?



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Synchronous?

2014-04-18 Thread Alexey Petrushin
There are following solutions to fight callbacks (my personal opinion in 
brackets):

0. callback hell (simple and good to for working with concurrency, but too 
verbose to be usable in day to day work when in 99% of cases you work with 
plain sequential logic)
1. statemachine hell (when you trade callbacks hell to bunch states  named 
functions, just a little better than callback hell, most frequently advised 
approach, a little better than callback hell)
2. async helpers (just a little better, but still far from being simple)
2. generators (simple, and seems to be good one, although, seems there are 
some gotchas with robust error handling)
3. code generation (some tools are good, but most are not, also there may 
be gotchas with error handling).
4. fibers (resulting code is simplest, it is exactly the same as plain 
synchronous, works in 99.99% of cases, handles errors almost perfectly, 
but, in 0.01% you need to be careful and know what you are doing).

On Saturday, 19 April 2014 03:47:10 UTC+4, Alex Kocharin wrote:

  
 It's someone trying to sell another javascript-like language as an answer 
 to this simple problem. :)
  
 If you have 20 subsequent functions, you can use generators, that's what 
 they are good at.
  
  
 19.04.2014, 01:46, Kevin Burton ronald.ke...@gmail.com javascript::

 What is the '_' is that some special character to get it to run 
 synchronously?

 On Friday, April 18, 2014 4:31:59 PM UTC-5, Bruno Jouhier wrote:

 a(_);
 b(_);
 c(_);

 Bruno

 On Friday, April 18, 2014 8:52:16 PM UTC+2, Kevin Burton wrote:

 Alex, I think in this case I need to. I have about 20 functions to 
 execute, each of which depends on the side-effects of the previous 
 function. I can basically make it synchronous by making what looks like a 
 big 'V'
  
 a(function(err) {
if(err) {
. . . . .
} else {
   b(function(err) {
   if(err) {
   } else {
   c(function(err) {
   if(err) {
   } else {
  
   }
   });
   }
   });
   }
 });

 On Friday, April 18, 2014 11:34:41 AM UTC-5, Alex Kocharin wrote:

  
 18.04.2014, 19:24, Kevin Burton ronald.ke...@gmail.com:

 I notice that simply leaving off the callback or making a callback null 
 doesn't always make a node function synchronous. What is a good general 
 pattern for making a node method synchronous (assuming the source for the 
 method is available)?
  

  
 A usual advice about making a node method synchronous is don't do that.
  



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] How to kill callback by timeout?

2014-04-17 Thread Alexey Petrushin
Yes, I'm agree with your notes about the code and preventing callback from 
being called twice. 

But what about memory and descriptors leaks, is there a way to terminate 
hanging callback and clear it? Or I can just safely ignore those issues and 
node.js somehow will clear it internally?

On Thursday, 17 April 2014 12:21:56 UTC+4, Francesco Mari wrote:

 Maybe you also want to prevent callback to execute twice if the timer 
 triggers and the remote service sends a response after the time limit. 

 function safeCallToSomeRemoteService(callback) { 
   var done = callback; 

   var timer = setTimeout(function() { 
 var temp = done; 
 done = function () {}; 
 temp(new Error('Remote service timed out!')); 
   }, 3000); 

   unsafeCallToSomeRemoteService(function(err, data){ 
 clearTimeout(timer); 
 done(err, data); 
   }); 
 } 

 2014-04-17 2:06 GMT+02:00 Ryan Graham r.m.g...@gmail.com javascript:: 
  
  On Wed, Apr 16, 2014 at 11:17 AM, Alexey Petrushin 
  alexey.p...@gmail.com javascript: wrote: 
  
  Is it possible to do something like this? 
  
  function safeCallToSomeRemoteService(callback){ 
var remoteServiceResponded = false 
unsafeCallToSomeRemoteService(function(err, data){ 
  remoteServiceResponded = true 
  callback(err, data) 
}) 
  
setTimeout(function(){ 
  if(!remoteServiceResponded){ 
somehow kill callback waiting for remote service 
callback(new Error(Remote service hanged!)) 
  } 
}, 3000) 
  } 
  
  Or, if it's not possible, is it safe to just ignore such hanged 
 callbacks, 
  call callback on timeout and move on (while leaving hanging callback 
  active)? 
  
  
  Ignoring whether there are better options available through the API you 
 are 
  using, the generic timeout code would look something like this: 
  
  function safeCallToSomeRemoteService(callback) { 
var timer = setTimeout(function() { 
  callback(new Error('Remote service timed out!')); 
}, 3000); 
  
unsafeCallToSomeRemoteService(function(err, data){ 
  clearTimeout(timer); 
  callback(err, data); 
}); 
  } 
  
  ~Ryan 
  
  -- 
  http://twitter.com/rmgraham 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to nodejs+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] How to kill callback by timeout?

2014-04-17 Thread Alexey Petrushin
I use wd.js (RESTful client to Selenium WebDriver) to connect to remote 
server with running Selenium WebDriver controlling Chrome Browser. 
It's used for web crawling and sometimes there are sites with bugs that 
take too much memory or somehow other crush running Chrome Browser Process.

In such cases (when Selenium Node stop responding) - there are background 
processes that will kill whole Selenium  Chrome processes and restart it.

The crawler itself don't know about all this stuff, it only knows list of 
IP addresses with Selenium Nodes and uses it. And when it hangs - it can do 
nothing about by himself, only wait until such hanging Selenium Node will 
be discovered by other processes and rebooted.


On Thursday, 17 April 2014 12:42:06 UTC+4, Francesco Mari wrote:

 I think that most of your answer depends on what 
 unsafeCallToSomeRemoteService does, and why the remote service is 
 unreliable. Can you provide more information about it? 

 2014-04-17 10:30 GMT+02:00 Alexey Petrushin 
 alexey.p...@gmail.comjavascript:: 

  Yes, I'm agree with your notes about the code and preventing callback 
 from 
  being called twice. 
  
  But what about memory and descriptors leaks, is there a way to terminate 
  hanging callback and clear it? Or I can just safely ignore those issues 
 and 
  node.js somehow will clear it internally? 
  
  
  On Thursday, 17 April 2014 12:21:56 UTC+4, Francesco Mari wrote: 
  
  Maybe you also want to prevent callback to execute twice if the timer 
  triggers and the remote service sends a response after the time limit. 
  
  function safeCallToSomeRemoteService(callback) { 
var done = callback; 
  
var timer = setTimeout(function() { 
  var temp = done; 
  done = function () {}; 
  temp(new Error('Remote service timed out!')); 
}, 3000); 
  
unsafeCallToSomeRemoteService(function(err, data){ 
  clearTimeout(timer); 
  done(err, data); 
}); 
  } 
  
  2014-04-17 2:06 GMT+02:00 Ryan Graham r.m.g...@gmail.com: 
   
   On Wed, Apr 16, 2014 at 11:17 AM, Alexey Petrushin 
   alexey.p...@gmail.com wrote: 
   
   Is it possible to do something like this? 
   
   function safeCallToSomeRemoteService(callback){ 
 var remoteServiceResponded = false 
 unsafeCallToSomeRemoteService(function(err, data){ 
   remoteServiceResponded = true 
   callback(err, data) 
 }) 
   
 setTimeout(function(){ 
   if(!remoteServiceResponded){ 
 somehow kill callback waiting for remote service 
 callback(new Error(Remote service hanged!)) 
   } 
 }, 3000) 
   } 
   
   Or, if it's not possible, is it safe to just ignore such hanged 
   callbacks, 
   call callback on timeout and move on (while leaving hanging callback 
   active)? 
   
   
   Ignoring whether there are better options available through the API 
 you 
   are 
   using, the generic timeout code would look something like this: 
   
   function safeCallToSomeRemoteService(callback) { 
 var timer = setTimeout(function() { 
   callback(new Error('Remote service timed out!')); 
 }, 3000); 
   
 unsafeCallToSomeRemoteService(function(err, data){ 
   clearTimeout(timer); 
   callback(err, data); 
 }); 
   } 
   
   ~Ryan 
   
   -- 
   http://twitter.com/rmgraham 
   
   -- 
   -- 
   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 subscribed to the Google 
   Groups nodejs group. 
   To post to this group, send email to nod...@googlegroups.com 
   To unsubscribe from this group, send email to 
   nodejs+un...@googlegroups.com 
   For more options, visit this group at 
   http://groups.google.com/group/nodejs?hl=en?hl=en 
   
   --- 
   You received this message because you are subscribed to the Google 
   Groups 
   nodejs group. 
   To unsubscribe from this group and stop receiving emails from it, 
 send 
   an 
   email to nodejs+un...@googlegroups.com. 
   For more options, visit https://groups.google.com/d/optout. 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to nodejs+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout

[nodejs] How to kill callback by timeout?

2014-04-16 Thread Alexey Petrushin
There are N Workers and one Master. 
Workers are unstable and frequently can hang up or die. 
If worker dies - it's ok because there will be error in callback in master. 
But if worker hangs - there's a problem - callback in master also will 
hangs indefinitely.

And this is a problem, I need to kill those hanging callbacks in master.

Is it possible to do something like this?

function safeCallToSomeRemoteService(callback){
  var remoteServiceResponded = false  
  unsafeCallToSomeRemoteService(function(err, data){
remoteServiceResponded = true
callback(err, data)
  })
  
  setTimeout(function(){
if(!remoteServiceResponded){
  somehow kill callback waiting for remote service
  callback(new Error(Remote service hanged!))
}
  }, 3000)
}

Or, if it's not possible, is it safe to just ignore such hanged callbacks, 
call callback on timeout and move on (while leaving hanging callback 
active)?


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] How to kill callback by timeout?

2014-04-16 Thread Alexey Petrushin
Thanks for reply. A little more about the project - it's a web crawler that 
uses lots of selenium nodes. Selenium nodes are very unstable and hangs 
frequently.

Yes you are right my code isnt finished and need to ensure that callback will 
be called only once. But, my primary concern is memory leeks (maybe also 
descriptors leeks as it won't be released also). Is there a way to prevent 
those leaks and terminate hanging callbacks and release allocated resources?

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: Write nodejs in java

2014-04-15 Thread Alexey Petrushin
There are NIO  Netty in Java, use it.

On Monday, 14 April 2014 08:35:45 UTC+4, upuldi wrote:

 Nodejs is great, there is no doubt about that. But what I feel is (I am 
 not a nodejs expert anyway) the most of the issues with nodejs is due to 
 the fact that developers have to write javascripts. If there is a way to 
 write nodejs apps with java (like GWT) it will allow many people to write 
 nodejs applications with clean and elegant manner. But I haven't seen any 
 mature framework allows this. Is this a valid point ? Can't we make this a 
 nodejs feature request ?


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: What is the difference between dependency file and injections?

2014-03-26 Thread Alexey Petrushin
Add browserify and jquery node.js package will be available on the client 
too.

On Saturday, 22 March 2014 19:38:54 UTC+4, Bob Spero wrote:

 Not sure I worded this correctly, forgive me I have only been at this for 
 about two weeks. So I want to begin my client side development and I have 
 seen some cool stuff with JQuery widgets. In my package file I added jquery 
 ran npm install and now I have jquery in my node modules. So when I go to 
 my ejs form and put in a script and check if jquery is loaded, it is not. 

 So really what I want to know is what does the node module jquery do for 
 me?   


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] Healthcare needs the help of the Node.js Community

2014-03-04 Thread Alexey Petrushin
I wrote small lib that turns async code into synchronous code (using 
Fibers) http://alexeypetrushin.github.io/synchronize

Also, there's Mono.js a Ruby on Rails like web framework that uses plain 
synchronous code (also with Fibers) monojs.org

On Tuesday, 4 March 2014 18:21:25 UTC+4, rtweed wrote:

  Yes I see from the fibers documentation that it looks like it's now been 
 ported to Windows - as I say when I last looked (about a year ago maybe) it 
 was still Linux only.  Just testing it out now against the synchronous 
 Node.js interface to GT.M and it works beautifully, and seems to provide a 
 nice way of catering for chunks of code that include blocking I/O whilst 
 letting the main thread continue on its merry way - just what's needed!

 I foresee a major rewrite coming up! Damn! :-)

 Thanks for bringing this to my attention!

 Rob


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: advice on a newcomer, how's the market for nodejs devs? Is it a good field to find remote type jobs/contract?

2014-03-04 Thread Alexey Petrushin
I'm from Java  RoR too. No you don't need Front End experience (although I 
had it).

+ There are more opportunities for remote jobs.
- Usually companies that use Node.js are small or small departments in big 
companies, and it's harder to get h1b visas than with let's say Java 
because of the small size they can't afford it, especially long waiting 
time for approval.

So, for remote and interesting work - definitely RoR  Node.js
For more reliable and relocation - good old boring Java would be better 
choice.

On Wednesday, 5 March 2014 01:53:53 UTC+4, gitted wrote:

 Hi,

 I am looking for some advice from you guys, how's the market right now for 
 nodejs developers?

 Any inspirational stories where someone jumped in and was able to break 
 into the freelance market?

 I'm into Rails, Java (yes java!) and I have watched a few vids on nodejs 
 and I really like the concept so far.

 Is it a tough market to crack b/c you have to be a master of javascript 
 both front end and backend?  I'm not the greatest at frontend type work, I 
 mean I know javascript/jquery but I wouldn't call myself a master who can 
 hackup a single-page gmail type app with ease :)




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Bundle it all into one single js file

2014-02-28 Thread Alexey Petrushin
Browserify

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] printing thread id

2014-02-13 Thread Alexey Petrushin
You can have fibers instead. They are close to threads, and you can assign id 
to it or use fiber local storage

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-02-12 Thread Alexey Petrushin
After working one with https://github.com/sgentle/phantomjs-node 
 https://github.com/sgentle/node-phantomjs must say it's unstable and hard 
to work with, don't recommend it.

On Thursday, 16 January 2014 06:09:48 UTC+4, Victor Hooi wrote:

 Hi,

 I'm wondering if anybody knows of any web-scraping frameworks in Node.JS?

 Previously, there was node.io (https://github.com/chriso/node.io), 
 however, the project was recently discontinued.

 Googling for Node.JS and web scraping, most of the guides online just talk 
 about using requests and cheerio - it works, but you need to handle a whole 
 bunch of things yourself (throttling, distributing jobs, configuration, 
 managing jobs etc.).

 On the Python side, I know of Scrapy (https://github.com/scrapy/scrapy), 
 which is using Twisted for asynchronicity

 On the Ruby side, Nokogiri (http://nokogiri.org/) is meant to be good, 
 although I haven't dived into it much.

 Is there anything equivalent in the Node world? Or what approaches are 
 people using to tackle this problem?

 Cheers,
 Victor


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-02-12 Thread Alexey Petrushin
Tried it, it's really simpler. But still have same problem - works fine on my 
Mac OS but wen I try to deploy it to EC2 Ubuntu Server phantomjs crushes 
without even being able to log a dump. If I run it standalone it works ok. 
Phantomjs v 1.9

Anyone tried to deploy to EC2 what OS do yo use? Maybe crash happens on Ibunty 
only?

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: callback hell on steroid

2014-02-11 Thread Alexey Petrushin
Yep, you should learn how to use state machine hell instead of callback 
hell.

On Tuesday, 11 February 2014 22:42:18 UTC+4, Reza Razavipour wrote:

 I have a node.js, express really, app that needs to make SOAP calls, 
 asynchronously of course.

 In this case, I make a soap call and I get a count. Once i have the count, 
 I have to loop and make a series of SOAP calls for each, this part you can 
 think of this as async.series calls.

 I have used async waterfall, series, parallel and Q promises; somewhat 
 comfortable with them. 

 How do you suggest I set this up to avoid callback hell and have control 
 over exceptions and the rest. I can not see how this should be laid out.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Non-US based jobs.nodejs.org?

2014-02-08 Thread Alexey Petrushin
GitHub Jobs / Stack Overflow Career

On Friday, 7 February 2014 19:34:06 UTC+4, Matt Sergeant wrote:

 Is there a place to post non-US jobs for Node? I've posted in the Toronto 
 meetup group already, but wondered if there was a place people are using 
 here.

 Currently jobs.nodejs.org is US-only. If you search for Toronto you need 
 to select one of the Toronto's in the US for your search.

 Matt.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-31 Thread Alexey Petrushin
Maybe there's some other resource limit that prevents node to work in full 
power? Node.js process uses only 50% of CPU but if I raise concurrency over 
100 it starts to generate connection errors. 

What maybe the cause?

On Tuesday, 28 January 2014 00:07:10 UTC+4, Alexey Petrushin wrote:

 Update, after tuning the Rails with Puma Server ( thanks to 
 https://github.com/antage ) its speed increased in ten times and is 
 almost the same as Node (it uses only one process and it seems only one 
 core).

 Updated benchmark 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks

 Rails

 Transactions:   2258 hits
 Longest transaction:0.52

 Express

 Transactions:   3158 hits
 Longest transaction:0.34

 On Thursday, 23 January 2014 13:57:58 UTC+4, Alexey Petrushin wrote:

 I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
 Express for some reason performed worse than Rails.

 How benchmark works - application query some text from remote HTTP 
 service (service delays each
 request for 200ms) and render HTML page using that text.

 *Results*

 - transactions rate are the same (already strange, I expected node.js to 
 outperform rails by at least a couple of times)
 - average response time in rails is 0.8s and in express 4s (siege doesn't 
 show average time it in the report, but it can be seen from its logs).

 *Details*

 The remote service with delay (sipmle node.js server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js

 Express.js 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js

 Rails (with Puma server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb

 Siege command `siege -b -t10s -c100 http://localhost:3000`

 Full code and instructions how to run 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks
 All application has been run in production mode.

 How is that possible and where is the bug in this benchmark, what's I'm 
 doing wrong?



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: CrowdProcess - Node.js Module

2014-01-30 Thread Alexey Petrushin
Create distributed MMO and use browsers as computation unit? I know it's a 
stupid idea, but I like it :).

On Wednesday, 29 January 2014 23:41:12 UTC+4, João Menano wrote:

 I work at CrowdProcess http://crowdprocess.

 Any ideas about what to run on top of 2000+ browsers?

 Ideas and suggestions are very welcomed. Bit Coin mining does not count. 
 Thank you


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-27 Thread Alexey Petrushin
Update, after tuning the Rails with Puma Server ( thanks 
to https://github.com/antage ) its speed increased in ten times and is 
almost the same as Node (it uses only one process and it seems only one 
core).

Updated 
benchmark https://github.com/alexeypetrushin/web-frameworks-benchmarks

Rails

Transactions:   2258 hits
Longest transaction:0.52

Express

Transactions:   3158 hits
Longest transaction:0.34

On Thursday, 23 January 2014 13:57:58 UTC+4, Alexey Petrushin wrote:

 I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
 Express for some reason performed worse than Rails.

 How benchmark works - application query some text from remote HTTP service 
 (service delays each
 request for 200ms) and render HTML page using that text.

 *Results*

 - transactions rate are the same (already strange, I expected node.js to 
 outperform rails by at least a couple of times)
 - average response time in rails is 0.8s and in express 4s (siege doesn't 
 show average time it in the report, but it can be seen from its logs).

 *Details*

 The remote service with delay (sipmle node.js server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js

 Express.js 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js

 Rails (with Puma server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb

 Siege command `siege -b -t10s -c100 http://localhost:3000`

 Full code and instructions how to run 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks
 All application has been run in production mode.

 How is that possible and where is the bug in this benchmark, what's I'm 
 doing wrong?


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-01-24 Thread Alexey Petrushin
Let's start with simpler question - what browser emulator works with 
node.js? (I meant full emulation, not just HTML processor like cheerio)

I know two options:

- Zombie.js - a nice thing, simple and fast but not very stable.
- Selenium - have all possible features but slow and complex to use (can be 
used from node.js via adapter)

Any other? I heard Fantom.js also may work with node.js but not sure about 
it.

On Thursday, 16 January 2014 06:09:48 UTC+4, Victor Hooi wrote:

 Hi,

 I'm wondering if anybody knows of any web-scraping frameworks in Node.JS?

 Previously, there was node.io (https://github.com/chriso/node.io), 
 however, the project was recently discontinued.

 Googling for Node.JS and web scraping, most of the guides online just talk 
 about using requests and cheerio - it works, but you need to handle a whole 
 bunch of things yourself (throttling, distributing jobs, configuration, 
 managing jobs etc.).

 On the Python side, I know of Scrapy (https://github.com/scrapy/scrapy), 
 which is using Twisted for asynchronicity

 On the Ruby side, Nokogiri (http://nokogiri.org/) is meant to be good, 
 although I haven't dived into it much.

 Is there anything equivalent in the Node world? Or what approaches are 
 people using to tackle this problem?

 Cheers,
 Victor


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-24 Thread Alexey Petrushin
by the way, 100 connections work the same and give the same numbers, I set 
1000 just in case :)

On Friday, 24 January 2014 18:36:32 UTC+4, Paul Vencill wrote:

 I didn't know about this either, good info.  Is there a good method for 
 determining what the optimum # max connections should be? I assume there's 
 some practical limit, or way of figuring out the point of diminishing 
 returns for a given app?  for example, if you open up (as the OP did) 1000 
 concurrent connections, but your db connection pool is only 10, then you're 
 probably going to run into issues.  Other than dependencies like that, any 
 good rubrics y'all can think of?

 On Thursday, January 23, 2014 5:15:19 AM UTC-5, Fedor Indutny wrote:

 I think you could be hitting this: 
 http://nodejs.org/api/http.html#http_agent_maxsockets 

 On Thu, Jan 23, 2014 at 1:57 PM, Alexey Petrushin 
 alexey.p...@gmail.com wrote: 
  I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
  Express for some reason performed worse than Rails. 
  
  How benchmark works - application query some text from remote HTTP 
 service 
  (service delays each 
  request for 200ms) and render HTML page using that text. 
  
  Results 
  
  - transactions rate are the same (already strange, I expected node.js 
 to 
  outperform rails by at least a couple of times) 
  - average response time in rails is 0.8s and in express 4s (siege 
 doesn't 
  show average time it in the report, but it can be seen from its logs). 
  
  Details 
  
  The remote service with delay (sipmle node.js server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js
  
  
  Express.js 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js
  
  
  Rails (with Puma server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb
  
  
  Siege command `siege -b -t10s -c100 http://localhost:3000` 
  
  Full code and instructions how to run 
  https://github.com/alexeypetrushin/web-frameworks-benchmarks 
  All application has been run in production mode. 
  
  How is that possible and where is the bug in this benchmark, what's I'm 
  doing wrong? 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.com 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to nodejs+un...@googlegroups.com. 
  For more options, visit https://groups.google.com/groups/opt_out. 



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: A decent client for a node backend...

2014-01-24 Thread Alexey Petrushin
Nice.

On Wednesday, 22 January 2014 17:28:16 UTC+4, Dennis Kane wrote:

 It has been kind of an obsession for me to create the kind of end-user 
 experience that will really allow node to start actually being put to use. 
  I've spent pretty much an entire year of full time coding getting this 
 thing ready for prime time.  The only caveat is that you need a Chrome 
 browser, as it crucially depends on the filesystem API.  I won't get into 
 the details of how to user it.  For now, just go there and start clicking 
 around.  As people show interest, I'll start giving instructions.

 Where is there?

 HERE -- http://urdesk.net

 urdesk means: yoUR DESK and Uniform Resource DESK.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-01-24 Thread Alexey Petrushin
 PhantomJS ...

But does it works with node.js? I heard it needs to maintain its own 
control over the loop.

On Friday, 24 January 2014 18:26:17 UTC+4, Matt Sergeant wrote:

 PhantomJS works extremely well if you can deal with the occasional random 
 segfaults, and is much faster than Selenium.


 On Fri, Jan 24, 2014 at 5:02 AM, Alexey Petrushin 
 alexey.p...@gmail.comjavascript:
  wrote:

 Let's start with simpler question - what browser emulator works with 
 node.js? (I meant full emulation, not just HTML processor like cheerio)

 I know two options:

 - Zombie.js - a nice thing, simple and fast but not very stable.
 - Selenium - have all possible features but slow and complex to use (can 
 be used from node.js via adapter)

 Any other? I heard Fantom.js also may work with node.js but not sure 
 about it.


 On Thursday, 16 January 2014 06:09:48 UTC+4, Victor Hooi wrote:

 Hi,

 I'm wondering if anybody knows of any web-scraping frameworks in Node.JS?

 Previously, there was node.io (https://github.com/chriso/node.io), 
 however, the project was recently discontinued.

 Googling for Node.JS and web scraping, most of the guides online just 
 talk about using requests and cheerio - it works, but you need to handle a 
 whole bunch of things yourself (throttling, distributing jobs, 
 configuration, managing jobs etc.).

 On the Python side, I know of Scrapy (https://github.com/scrapy/scrapy), 
 which is using Twisted for asynchronicity

 On the Ruby side, Nokogiri (http://nokogiri.org/) is meant to be good, 
 although I haven't dived into it much.

 Is there anything equivalent in the Node world? Or what approaches are 
 people using to tackle this problem?

 Cheers,
 Victor

  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-01-24 Thread Alexey Petrushin
 I have no problem using phantom as a child process ...

How do you control it? Does it support commands issued via stout or somehow 
else?

On Saturday, 25 January 2014 00:11:47 UTC+4, Mark Hahn wrote:

 I have no problem using phantom as a child process. You can communicate 
 with it while it is running.  I would imagine one could write a module to 
 make the interaction quite transparent.


 On Fri, Jan 24, 2014 at 9:02 AM, // ravi ravi-...@g8o.net 
 javascript:wrote:

 On Jan 24, 2014, at 11:30 AM, Alexey Petrushin 
 alexey.p...@gmail.comjavascript: 
 wrote:

  PhantomJS ...

 But does it works with node.js? I heard it needs to maintain its own 
 control over the loop.



 IIUC it does not integrate with NodeJS for the reason you mention: 
 control over the loop. Here’s the section from the FAQ:

 http://phantomjs.org/faq.html

 Q: Why is PhantomJS not written as Node.js module?

 A: The short answer: No one can serve two masters.

 A longer explanation is as follows.

 As of now, it is technically very challenging to do so.

 Every Node.js module is essentially a slave to the core of Node.js, 
 i.e. the master. In its current state, PhantomJS (and its included 
 WebKit) needs to have the full control (in a synchronous matter) over 
 everything: event loop, network stack, and JavaScript execution.

 If the intention is just about using PhantomJS right from a script 
 running within Node.js, such a loose binding can be achieved by launching 
 a PhantomJS process and interact with it.



 —ravi


  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Web Scraping Frameworks for Node.JS? (e.g. like Python's Scrapy)

2014-01-24 Thread Alexey Petrushin
I meant interactive control of phantom.js via child_process (not issuing 
just one command by supplying argv when it start) is it possible?

On Saturday, 25 January 2014 02:14:49 UTC+4, Alexey Petrushin wrote:

  I have no problem using phantom as a child process ...

 How do you control it? Does it support commands issued via stout or 
 somehow else?

 On Saturday, 25 January 2014 00:11:47 UTC+4, Mark Hahn wrote:

 I have no problem using phantom as a child process. You can communicate 
 with it while it is running.  I would imagine one could write a module to 
 make the interaction quite transparent.


 On Fri, Jan 24, 2014 at 9:02 AM, // ravi ravi-...@g8o.net wrote:

 On Jan 24, 2014, at 11:30 AM, Alexey Petrushin alexey.p...@gmail.com 
 wrote:

  PhantomJS ...

 But does it works with node.js? I heard it needs to maintain its own 
 control over the loop.



 IIUC it does not integrate with NodeJS for the reason you mention: 
 control over the loop. Here’s the section from the FAQ:

 http://phantomjs.org/faq.html

 Q: Why is PhantomJS not written as Node.js module?

 A: The short answer: No one can serve two masters.

 A longer explanation is as follows.

 As of now, it is technically very challenging to do so.

 Every Node.js module is essentially a slave to the core of Node.js, 
 i.e. the master. In its current state, PhantomJS (and its included 
 WebKit) needs to have the full control (in a synchronous matter) over 
 everything: event loop, network stack, and JavaScript execution.

 If the intention is just about using PhantomJS right from a script 
 running within Node.js, such a loose binding can be achieved by launching 
 a PhantomJS process and interact with it.



 —ravi


  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google 
 Groups nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to nodejs+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-23 Thread Alexey Petrushin
I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
Express for some reason performed worse than Rails.

How benchmark works - application query some text from remote HTTP service 
(service delays each
request for 200ms) and render HTML page using that text.

*Results*

- transactions rate are the same (already strange, I expected node.js to 
outperform rails by at least a couple of times)
- average response time in rails is 0.8s and in express 4s (siege doesn't 
show average time it in the report, but it can be seen from its logs).

*Details*

The remote service with delay (sipmle node.js server) 
https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js

Express.js 
https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js

Rails (with Puma server) 
https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb

Siege command `siege -b -t10s -c100 http://localhost:3000`

Full code and instructions how to run 
https://github.com/alexeypetrushin/web-frameworks-benchmarks
All application has been run in production mode.

How is that possible and where is the bug in this benchmark, what's I'm 
doing wrong?

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-23 Thread Alexey Petrushin
Single core shouldn't be a problem as far as I know ruby also uses only one
CPU it doesn't have real threads.

On Thursday, January 23, 2014, Matt hel...@gmail.com wrote:

 Also important that your node code is only using one CPU. See
 http://nodejs.org/docs/v0.10.22/api/cluster.html


 On Thu, Jan 23, 2014 at 5:15 AM, Fedor Indutny 
 fe...@indutny.comjavascript:_e({}, 'cvml', 'fe...@indutny.com');
  wrote:

 I think you could be hitting this:
 http://nodejs.org/api/http.html#http_agent_maxsockets

 On Thu, Jan 23, 2014 at 1:57 PM, Alexey Petrushin
 alexey.petrus...@gmail.com javascript:_e({}, 'cvml',
 'alexey.petrus...@gmail.com'); wrote:
  I ran a benchmark for Ruby on Rails and Express.js using `siege` - and
  Express for some reason performed worse than Rails.
 
  How benchmark works - application query some text from remote HTTP
 service
  (service delays each
  request for 200ms) and render HTML page using that text.
 
  Results
 
  - transactions rate are the same (already strange, I expected node.js to
  outperform rails by at least a couple of times)
  - average response time in rails is 0.8s and in express 4s (siege
 doesn't
  show average time it in the report, but it can be seen from its logs).
 
  Details
 
  The remote service with delay (sipmle node.js server)
 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js
 
  Express.js
 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js
 
  Rails (with Puma server)
 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb
 
  Siege command `siege -b -t10s -c100 http://localhost:3000`
 
  Full code and instructions how to run
  https://github.com/alexeypetrushin/web-frameworks-benchmarks
  All application has been run in production mode.
 
  How is that possible and where is the bug in this benchmark, what's I'm
  doing wrong?
 
  --
  --
  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 subscribed to the Google
  Groups nodejs group.
  To post to this group, send email to 
  nodejs@googlegroups.comjavascript:_e({}, 'cvml', 
  'nodejs@googlegroups.com');
  To unsubscribe from this group, send email to
  nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'nodejs%2bunsubscr...@googlegroups.com');
  For more options, visit this group at
  http://groups.google.com/group/nodejs?hl=en?hl=en
 
  ---
  You received this message because you are subscribed to the Google
 Groups
  nodejs group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to nodejs+unsubscr...@googlegroups.com javascript:_e({},
 'cvml', 'nodejs%2bunsubscr...@googlegroups.com');.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 --
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to 
 nodejs@googlegroups.comjavascript:_e({}, 'cvml', 
 'nodejs@googlegroups.com');
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'nodejs%2bunsubscr...@googlegroups.com');
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 ---
 You received this message because you are subscribed to the Google Groups
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'nodejs%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 --
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to 
 nodejs@googlegroups.comjavascript:_e({}, 'cvml', 'nodejs@googlegroups.com');
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'nodejs%2bunsubscr...@googlegroups.com');
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups nodejs group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/nodejs/tgATyqF-HIc/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'nodejs%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
Best regards, Alex.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https

Re: [nodejs] Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-23 Thread Alexey Petrushin
Fedor, you are right, thanks. That was the problem, after fixing it node 
became more than 10 times faster.

Issue resolved.

On Thursday, 23 January 2014 14:15:19 UTC+4, Fedor Indutny wrote:

 I think you could be hitting this: 
 http://nodejs.org/api/http.html#http_agent_maxsockets 

 On Thu, Jan 23, 2014 at 1:57 PM, Alexey Petrushin 
 alexey.p...@gmail.com javascript: wrote: 
  I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
  Express for some reason performed worse than Rails. 
  
  How benchmark works - application query some text from remote HTTP 
 service 
  (service delays each 
  request for 200ms) and render HTML page using that text. 
  
  Results 
  
  - transactions rate are the same (already strange, I expected node.js to 
  outperform rails by at least a couple of times) 
  - average response time in rails is 0.8s and in express 4s (siege 
 doesn't 
  show average time it in the report, but it can be seen from its logs). 
  
  Details 
  
  The remote service with delay (sipmle node.js server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js
  
  
  Express.js 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js
  
  
  Rails (with Puma server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb
  
  
  Siege command `siege -b -t10s -c100 http://localhost:3000` 
  
  Full code and instructions how to run 
  https://github.com/alexeypetrushin/web-frameworks-benchmarks 
  All application has been run in production mode. 
  
  How is that possible and where is the bug in this benchmark, what's I'm 
  doing wrong? 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to nodejs+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-23 Thread Alexey Petrushin
I've changed agent.maxSockets

https://github.com/alexeypetrushin/web-frameworks-benchmarks/commit/bac85d4485809d7dca59d9a1ea64445c37af71de

On Thursday, 23 January 2014 20:35:18 UTC+4, Reza Razavipour wrote:

 what was the fix? You changed the 5 to what?

 On Thursday, January 23, 2014 7:19:06 AM UTC-8, Alexey Petrushin wrote:

 Fedor, you are right, thanks. That was the problem, after fixing it node 
 became more than 10 times faster.

 Issue resolved.

 On Thursday, 23 January 2014 14:15:19 UTC+4, Fedor Indutny wrote:

 I think you could be hitting this: 
 http://nodejs.org/api/http.html#http_agent_maxsockets 

 On Thu, Jan 23, 2014 at 1:57 PM, Alexey Petrushin 
 alexey.p...@gmail.com wrote: 
  I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
  Express for some reason performed worse than Rails. 
  
  How benchmark works - application query some text from remote HTTP 
 service 
  (service delays each 
  request for 200ms) and render HTML page using that text. 
  
  Results 
  
  - transactions rate are the same (already strange, I expected node.js 
 to 
  outperform rails by at least a couple of times) 
  - average response time in rails is 0.8s and in express 4s (siege 
 doesn't 
  show average time it in the report, but it can be seen from its logs). 
  
  Details 
  
  The remote service with delay (sipmle node.js server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js
  
  
  Express.js 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js
  
  
  Rails (with Puma server) 
  
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb
  
  
  Siege command `siege -b -t10s -c100 http://localhost:3000` 
  
  Full code and instructions how to run 
  https://github.com/alexeypetrushin/web-frameworks-benchmarks 
  All application has been run in production mode. 
  
  How is that possible and where is the bug in this benchmark, what's 
 I'm 
  doing wrong? 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.com 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to nodejs+un...@googlegroups.com. 
  For more options, visit https://groups.google.com/groups/opt_out. 



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Strange bug in benchmark, Express.js is slower than Ruby on Rails

2014-01-23 Thread Alexey Petrushin
Yes, but I wanted to see a test that more or less close to what's used in 
real projects. Express usually don't work in isolation, usually it uses 
some sort of database. And request seems like a good approximation for DB 
connection.

On Friday, 24 January 2014 07:33:59 UTC+4, tjholowaychuk wrote:

 plus this benchmark doesn't really test express, it tests outbound 
 requests AND express :p so that's really misleading 


 On Thursday, 23 January 2014 01:57:58 UTC-8, Alexey Petrushin wrote:

 I ran a benchmark for Ruby on Rails and Express.js using `siege` - and 
 Express for some reason performed worse than Rails.

 How benchmark works - application query some text from remote HTTP 
 service (service delays each
 request for 200ms) and render HTML page using that text.

 *Results*

 - transactions rate are the same (already strange, I expected node.js to 
 outperform rails by at least a couple of times)
 - average response time in rails is 0.8s and in express 4s (siege doesn't 
 show average time it in the report, but it can be seen from its logs).

 *Details*

 The remote service with delay (sipmle node.js server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/lorem-ipsum.js

 Express.js 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/expressjs/app.js

 Rails (with Puma server) 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks/blob/master/rails/app/controllers/posts_controller.rb

 Siege command `siege -b -t10s -c100 http://localhost:3000`

 Full code and instructions how to run 
 https://github.com/alexeypetrushin/web-frameworks-benchmarks
 All application has been run in production mode.

 How is that possible and where is the bug in this benchmark, what's I'm 
 doing wrong?



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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

2014-01-20 Thread Alexey Petrushin
Binary search - if something goes wrong and you don't understand it - 
comment out half of the code, then half of the half and so on until you 
locate the line with problem :)

On Sunday, 19 January 2014 20:37:02 UTC+4, wavded wrote:

 Hey everybody, doing a bit of research here and wondering if you can help 
 me out!

 I personally have benefitted the most from logging, node-webkit-agent 
 module (perf/memleaks), heapdump module (for prod memleaks), and strace (on 
 linux) when it comes to debugging Node applications.  However, I'm sure 
 there are tools I haven't used much or had use cases for personally that 
 are dynamite (like dtrace for instance).  I'm curious as to what 
 tools/techniques you have used AND for what situations were they helpful. 
  No bad answers here so don't be shy :)

 Thanks much!
 Marc


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Dependency injection (DI) framework feedback

2014-01-20 Thread Alexey Petrushin
Also use DI, in my case it does:

- Autoloading and reloading code (kinda like Ruby on Rails).

app.requireDirectory #{__dirname}/controllers, watch: true, onDemand: 
true

The actual code 
https://github.com/sinizinairina/mono-example/blob/master/app.coffee#L21

- Assembling application and lazy loading things like DB to speedup server 
start time.

- Injection - automatically injects all needed objects in places where they 
needed. No need to 
pass `(req, res)` everywhere anymore. Just use `this.req` it also 
automatically creates and manages 
related things like `this.user`:

function(){
  this.post = new app.Post(this.params)
  ...
}

instead of:

function(req, res){
  this.post = new app.Post(req.params)
  ...
}

The actual code 
https://github.com/sinizinairina/mono-example/blob/master/controllers/Posts.coffee#L21

- Hook up before/after handlers - for example to do something before or 
after DB is loaded.

It's used in Ruby on Rails clone for Node.JS for example - definitions of 
different internal components
of that framework 
https://github.com/sinizinairina/mono/blob/master/mono.coffee

And, this is the only place when you have to tell DI what to do, after that 
all those components 
will be created and wired automatically and you don't have to see DI 
specific code in your application anymore. 

The best thing - no DI specific code in the application - You have the milk 
and don't have to care for the Cow :).

The IoC itself https://github.com/alexeypetrushin/miconjs

On Monday, 20 January 2014 19:54:27 UTC+4, Christoph Rust wrote:

 I know there are already quite a few DI frameworks available for NodeJS.
 Inject and dependable both offer a nice feature set...
 However I tried to combine the (from my perspective) most desirable 
 features into one framework - dips https://github.com/devcrust/node-dips
 .

 I'm curious about your feedback and suggestions on features you would like 
 to find in a DI framework.

 Github: https://github.com/devcrust/node-dips


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Mongo vs. Couch vs. LevelDB ?

2014-01-20 Thread Alexey Petrushin
Didn't know about _update, thanks. Yea, would be nice to have sharding 
merged.

 Poor support  I don't see why not using Github as an authority means poor 
user support.

On GitHub users are just a click away (everyone have a GitHub account now) 
- it's easy, users will participate and report bugs and suggestions.

On Monday, 20 January 2014 15:00:36 UTC+4, Benoit Chesneau wrote:




 On Tue, Sep 17, 2013 at 4:10 AM, Alexey Petrushin 
 alexey.p...@gmail.comjavascript:
  wrote:

 I wrote small article with my subjective view about how CouchDB differs 
 from MongoDB

 http://petrush.in/blog/2013/a-little-about-cochudb-and-comparison-with-mongodb/show



 subjective indeed.

 Saying it's harder because of using M/R in secondary indexes is 
 subjective. Most people will see maps as a way to match documents and emit 
 values they need to query later / keys. Which at the end especially for 
 javascript is user give a lot of flexibility. (some should also ask himself 
 why mpngodb added this feature later).

 M/R chaining: there are some nodejs project that does that. Waiting for 
 this feature in couchdb that will probably come soon in a way or another.

 no in/place update. Well such things could be done using _update functions 
 if you really need it while still having an append-only database. If you 
 really care about your data you don't want to update in place except in a 
 cache database maybe.

 no sharding/scale: true for now. But actually the code coming fonm 
 cloudant.con is actually in the process to be merged.


 Popularity. true . This is true for all db backed with a lot of money 
 anyway:

 http://db-engines.com/en/ranking


 Poor support  I don't see why not using Github as an authority means poor 
 user support. You can use Jira, you can use the mailing-lists open to every 
 one. You have an open documentation that you can patch. And support of PR 
 from github has been considerably improved. Couchdb is also backed by one 
 of the oldest organisation in the world.


 About the  high-availability, scalability, high-load , you're saying 
 they are not here. It all depends
 what you mean when using these terms. It all depends on your usage. also. 
 A lot of usages around will contradict your feeling.

 - benoit


  

 On Wednesday, August 28, 2013 5:35:40 PM UTC+4, Dylan Hassinger wrote:

 Hi everybody - I am a Node newb building my first app, and trying to 
 figure out which database system to use. Can anybody shed some light on 
 what the major differences are between Mongo, Couch and LevelDB - and when 
 is the right time to to use them?

 Specifically, is the syntax similar between them / is it easy to switch 
 after-the-fact?

 Also wondering if anybody has suggestions for hosted 
 database-as-a-service options? I've heard good things about MongoHQ, but 
 not sure if there's hosted options for Couch or LevelDB. Thanks for any 
 help!!

 dylan

  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: State of the art for request isolation in http servers?

2014-01-15 Thread Alexey Petrushin
 the sane thing to do when your Node process encounters an error is to 
shut down and restart the process

So, let's suppose we create some app, let's say google forum, like this. 
There are important, frequently used and well tested stuff like showing 
list of topics and post reply. 

And rarely used things like some section deep in the settings screen. We 
don't care about that section on setting screen - we don't test it very 
well because who cares if it doesn't works, it's low important stuff anyway.

And then - surprise - when someone goes to that low important section of 
setting - suddenly all the application crashes.

On Wednesday, 15 January 2014 10:15:10 UTC+4, Forrest L Norvell wrote:

 As I see it, there are a few paths open to you that don't require you to 
 do a total rewrite using a different framework:

 1. This is pretty much the exact problem that domains were designed to 
 solve. It's up to you to decide whether you want to recover from errors or 
 to shut down the process (gracefully, in a way that lets it finish handling 
 all the requests you have in flight), but they will at least let you put 
 the error-handling closer to where the errors are coming from and allow you 
 to deal with them and not just crash. Domains are still a part of the 
 platform, they're proven at this point, and while they're not perfect, 
 they're a fairly easy incremental step for you.

 2. If you're using Express or Restify, it's pretty easy to write a 
 middleware that will make your middleware chain domains-aware:

 var domain = require('domain');
 function domainsify(request, response, next) {
   var d = domain.create();
   // ourHandler could stop the HTTP server, preventing any new requests 
 from
   // being handled while still allowing in-flight requests to finish
   d.on('error', ourHandler);

   // make sure that any error events on these streams are handled by the 
 domain
   d.add(request);
   d.add(response);

   // make sure that asynchronous calls within the scope of the middleware 
 chain are pulled into the domain
   d.run(next);
 }

 3. If you want something more strongly biased towards keeping your node 
 processes up and running, Adam Crabtree's trycatch (
 https://github.com/CrabDude/trycatch) takes a similar approach to domains 
 while even more tightly binding code that can fail to an error handler. At 
 this point, domains and trycatch to me feel like similar flavors of the 
 same strategy, but the trycatch API is dead simple and that might appeal to 
 you more than domains, which do have some complexity to them. Adam also has 
 a very different philosophy than the Node core team, where he wants to keep 
 Node processes running and actually recover from errors more often than 
 not, and trycatch reflects that philosophy.

 4. In addition to the control flow alternatives others have mentioned, 
 some people like the way that promises compose for error-handling. I 
 personally find using streams with promises a little awkward, but if your 
 web service has any sort of pipeline (pull some data - do something with 
 the data - cache it in e.g. redis - render a template - shove it out the 
 response), promises might be a way to DRY up your error-handling in a way 
 that allows you to confine the consequences of exceptions. Also, if you use 
 Bluebird, you probably won't even pay that much of a performance penalty.

 Just trying to be extra-careful is probably not going to ever feel very 
 satisfying. There's a lot that can go wrong, and as much as the core tries 
 to be consistent about *either* throwing synchronously *or* emitting 
 'error' events / passing Error objects to callbacks, there are a lot of 
 gotchas that only time, experience, and production crashes will make clear. 
 Domains are core's general solution to this problem, along with the 
 philosophy (that's been articulated here and elsewhere many times) that the 
 sane thing to do when your Node process encounters an error is to shut down 
 and restart the process.

 Another piece of this is to partition your services such that you don't 
 have the problem of 10,000 clients being at risk if one request crashes. 
 Think about scaling your app horizontally (using cluster or something 
 similar) to keep each process dealing with a smaller number of clients if 
 you can. PHP handles this better (in terms of your problem -- there are 
 always tradeoffs!) because each PHP script is being run in its own context 
 (which for all intents and purposes is a process -- if one PHP handler, it 
 has no effect on the others), which is just a fundamentally different model 
 from Node.

  
 On Tue, Jan 14, 2014 at 9:43 PM, Gregg Caines cai...@gmail.comjavascript:
  wrote:

 Well even though all the responses so far would require some pretty 
 non-standard solutions (and therefore major changes to our current app), I 
 really do appreciate them.  We have logging, metrics and alerts on server 
 restarts, so we know about and fix restarts as 

[nodejs] Re: State of the art for request isolation in http servers?

2014-01-14 Thread Alexey Petrushin
+1 for Fibers

On Wednesday, 15 January 2014 00:28:52 UTC+4, Gregg Caines wrote:

 Hey all... I'm wondering if anyone can point me to the current 
 best-practice for isolating requests in a web app.  In general I'm trying 
 to solve the problem of keeping the server running despite bad code in a 
 particular request.  Are domains my only shot?  Do they completely solve 
 it?  Does anyone have existing code?

 I'm on a somewhat large team, working on a somewhat large codebase, and 
 until now I've been just logging restarts and combing logs for these types 
 of errors, then fixing them (which I'll always do), but I'm starting to 
 feel a bit silly with PHP having solved this 10 years ago.  ;)  When a bug 
 does get through, it would be nice to not lose the whole server and the 
 possible 10,000+ customer requests attached to it, while I scramble to fix 
 it.

 Thanks for any ideas or pointers!

 G


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: State of the art for request isolation in http servers?

2014-01-14 Thread Alexey Petrushin
I've heard that generators helps to catch errors but didn't seen any good 
explanation how to do that, if anyone knows such an article please post 
link here

On Wednesday, 15 January 2014 07:48:38 UTC+4, Alexey Petrushin wrote:

 +1 for Fibers

 On Wednesday, 15 January 2014 00:28:52 UTC+4, Gregg Caines wrote:

 Hey all... I'm wondering if anyone can point me to the current 
 best-practice for isolating requests in a web app.  In general I'm trying 
 to solve the problem of keeping the server running despite bad code in a 
 particular request.  Are domains my only shot?  Do they completely solve 
 it?  Does anyone have existing code?

 I'm on a somewhat large team, working on a somewhat large codebase, and 
 until now I've been just logging restarts and combing logs for these types 
 of errors, then fixing them (which I'll always do), but I'm starting to 
 feel a bit silly with PHP having solved this 10 years ago.  ;)  When a bug 
 does get through, it would be nice to not lose the whole server and the 
 possible 10,000+ customer requests attached to it, while I scramble to fix 
 it.

 Thanks for any ideas or pointers!

 G



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Would you like to have RoR clone in NodeJS?

2014-01-13 Thread Alexey Petrushin
 Anyway it's cool to see projects like this and I'd love to take a poke at 
it if you decide to document and publish it.

Thanks, it's published (but without full documentation), you can see blog 
example here https://github.com/sinizinairina/mono-example there are also 
instructions how to run it.

On Sunday, 12 January 2014 04:08:55 UTC+4, Simon wrote:

 That is very cool. I started down a similar path using Fibers in 2012 but 
 ended up diverging from a RoR clone and becoming much lighter weight, yet 
 still heavily inspired by Rails. Originally it was going to be RailsJS (
 railsjs.com) but I ended up calling it Drift (will be putting something 
 up at driftjs.com when I get to it).

 I went went with a layered abstraction approach and a custom module system 
 in order to support deployment to other JS platforms like Vert.x or v8cgi. 
 The adapter layer for these platforms didn't really materialize (yet), but 
 it's not out of the question.

 Anyway it's cool to see projects like this and I'd love to take a poke at 
 it if you decide to document and publish it.


 On Friday, January 10, 2014 6:44:10 AM UTC-8, Alexey Petrushin wrote:

 It's basically done and used for private projects, but it's not polished 
 and there's no documentation, 
 only some examples. MonoJS http://monojs.org - RoR clone in NodeJS. 

 Examples to play:

 - Classical RoR 10 Blog http://example.monojs.org
 - Simple CMS
   Blog http://jslang.gitsites.com
   Editing http://jslang.gitsites.com/edit
   (Register here http://gitsites.com to play with it and see it in 
 action)

 Would you be interested in such framework? I need to know it to decide -
 create documentations and polishing it or just keep it as it is for 
 internal usage.

 # What's the same as in RoR

 - Looks and feels like working with RoR. Uses same API, naming and 
 conventions.
 - Forget about asynchronous code, use plain and simple synchronous code 
 (without 
 blocking the node, thanks to Fibers).
 - More robust error handling (thanks to Fibers).
 - Full support for RoR AJAX techniques for Classical Web2.0 AJAX - remote 
 links, JS responses, 
 js-helpers, Turbolinks.
 - Controller with before / after callbacks.
 - RESTful routing.
 - AssetPipeline (based on Browserify, support CoffeeScript, ClientSide 
 Templates, minifying, etc.)
 - Code Reload
 - Pluralize and localize helpers.
 - Modular, create many applications and combine it as you wish (similar 
 to how it's done in express).
 - Request format recognition and automatically use correct ContentType 
 for response and Template extension.
 - Full support for CoffeeScript, use it for server code, server 
 templates, client code (Backbone.js for
 example) client templates. All will be assembled automatically and in 
 case of client stuff also 
 transpiled to JS packed and delivered to Browser.
 - Use mocha.js to create tests similar to RoR RSpec

 # What's different from RoR

 - Unlike RoR its internal structure is modular, every of its Core 
 Component can be replaced. So, you 
 don't need things like RoR Engines, it's already there out of the box.
 - Small code size, basically it does nothing by itself, it's just a 
 gluecode 
 delegating all actual work to other well known and established Node.js 
 libraries.
 - No enforcement on project structure, you can use folder structure like 
 RoR or whatever other 
 your like.



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Would you like to have RoR clone in NodeJS?

2014-01-12 Thread Alexey Petrushin
 Mono as in monorail? Instead of rails plural?
Actually no, it's a shortcut from monolith, and monojs sound nicely, it's 
also 'mono' in npm, I didn't thought that net framework used with node.

 Also, maybe you shouldn't bundle the synchronous/fibers thing with the 
framework. It seems like a separate concern that should 
 be an independent plugin perhaps. Some people might like the framework 
but don't care for fibers -- they may prefer another 
 synchronous implementation. (Sorry I sent other response too soon.)

Relying on fibers allowed significantly simplify code for end users.

It doesn't meant though that you has to use only synchronous code. The 
framework itself is compatible
with other node.js libraries - you can plug in other libraries or it itself 
can be distributed for example via npm and mounted as a module or 
middleware in express.js. Synchronous code also can be mixed with 
asynchronous.

I usually do complex things like streams and parallel queries with 
asynchronous code. 
It's ok to have asynchronous code here and there. What's not ok - it's when 
it's everywhere.

On Sunday, 12 January 2014 06:35:45 UTC+4, Alex wrote:

 Also, maybe you shouldn't bundle the synchronous/fibers thing with the 
 framework. It seems like a separate concern that should be an independent 
 plugin perhaps. Some people might like the framework but don't care for 
 fibers -- they may prefer another synchronous implementation. (Sorry I sent 
 other response too soon.)

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: node application hangs sometimes, how to track down problem?

2014-01-12 Thread Alexey Petrushin
If someone else also have strange hanging problems - seems like it was 
caused by official Amazon AWS S3 library for Node.js - at the end I was 
able to repeat it locally after hitting local server with heavy benchmark.

Don't know the reason though, I just switched to another 
library https://github.com/LearnBoost/knox - all works.

On Sunday, 22 September 2013 02:44:07 UTC+4, Alexey Petrushin wrote:

 Most of the time it works well, but sometimes - it hangs - server continue 
 to accept connections but don't reply back.

 And, its hard to reproduce the problem, seems like it occurs rarely and 
 randomly, so I can't reproduce it on my machine.

 Maybe it's possible to see all descriptors for opened IO connections? Or 
 collect some other metrics? I've checked RAM and CPU usage when problem 
 occured - seems like normal, no anomaly there.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Test suite recommendations

2014-01-12 Thread Alexey Petrushin
For Capybara I guess you can use https://github.com/MatthewMueller/cheerio 
but you probably need to write some minimalistic hepers/wrappers around it, 
but it should be easy.

There's also full browser emulators like zombie.js, phantom.js. But you 
probably don't need it they usually needed for Client Side JS testing, for 
things like backbone.js.

As for factory, you also can quickly create something 
similar 
https://github.com/sinizinairina/mono-example/blob/master/test/factory.coffee

On Sunday, 12 January 2014 22:46:33 UTC+4, Scott Whitman wrote:

 I am just getting started with node and express. In ruby/rails my test 
 suite was test.unit/minitest, rspec, factory girl, and capybara.

 For node, I have found mocha and chai that look promising. Is there 
 anything like factory girl and capybara that works on node/express? Is 
 there any other software i should check out?

 Thanks,
 Scott 



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Learning about Node.js Development

2014-01-12 Thread Alexey Petrushin
Better start with express.js

On Monday, 13 January 2014 01:01:58 UTC+4, chenst...@gmail.com wrote:

 Hi,

 I'm trying to get into app development with Node. To structure my learning 
 schedule, I'm wondering if it is necessary to learn and read over the 
 Manual  Docs on Node.js?

 Are any of those classes even used at a production level? Because if they 
 are not, I rather jump on to other Docs for different frameworks and 
 libraries that I will be using such as Connect, Express and etc..

 Or is it actually valuable and recommended to learn the fundamentals of 
 Node.js?

 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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Parser

2014-01-10 Thread Alexey Petrushin
 How to call my_custome_metod via HTTP?

You can't, at least in browser :). That's one of the reason RESTful has 
been created, as a hack to overcome it.

On Friday, 10 January 2014 01:45:58 UTC+4, Michael Monashev wrote:

 On Thursday, January 9, 2014 10:59:01 PM UTC+4, Sam Roberts wrote:

 It really does sound exactly like HTTP what you describe 


 HTTP gives us only GET, POST, PUT, DELETE, CONNECT, TRACE, PATCH, OPTIONS 
 and HEAD. WebDAV add PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK and 
 UNLOCK.
 How to call my_custome_metod via HTTP?

  

 On Thu, Jan 9, 2014 at 9:16 AM, Michael Monashev softs...@gmail.com 
 wrote: 
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.40 - 
 trailer 
  don`t work with not chunked request. :-( 

 So always use chunked, why not? You only need one chunk, if you want. 


 Good idea. 3-4 bytes + CRLF will be shoter than Content-length: 12345 in 
 headers.

  

  And HTTP is not so compact. 

 You want a text human-readable protocol that is also more compact 
 than minimal http? I doubt that what you want exists, but check out 
 BEEP. Also, FTP, though it splits the binary and text channels (for 
 maximal compactness). 


 Sam 


 Thank you. Sounds interesting.

 P.S.
 memcached protocol is more compact than HTTP.  


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Parser

2014-01-10 Thread Alexey Petrushin
I don't need to read about it because I use it for a couple of years :), 
nice as it is it's exactly a hack. Invented to deal with limitations of 
HTTP, that originally wasn't designed for todays use cases.

On Friday, 10 January 2014 13:07:19 UTC+4, Floby wrote:

 RESTful is hardly hack. read up.

 On Thursday, 9 January 2014 10:51:01 UTC+1, Michael Monashev wrote:

 Do you know some parser/packer for text human-readable protocol, that can 
 send text heades, very big binary body and text trailers. And body can be 
 chunked and read/write from/to file?



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Would you like to have RoR clone in NodeJS?

2014-01-10 Thread Alexey Petrushin
It's basically done and used for private projects, but it's not polished 
and there's no documentation, 
only some examples. MonoJS http://monojs.org - RoR clone in NodeJS. 

Examples to play:

- Classical RoR 10 Blog http://example.monojs.org
- Simple CMS
  Blog http://jslang.gitsites.com
  Editing http://jslang.gitsites.com/edit
  (Register here http://gitsites.com to play with it and see it in action)

Would you be interested in such framework? I need to know it to decide -
create documentations and polishing it or just keep it as it is for 
internal usage.

# What's the same as in RoR

- Looks and feels like working with RoR. Uses same API, naming and 
conventions.
- Forget about asynchronous code, use plain and simple synchronous code 
(without 
blocking the node, thanks to Fibers).
- More robust error handling (thanks to Fibers).
- Full support for RoR AJAX techniques for Classical Web2.0 AJAX - remote 
links, JS responses, 
js-helpers, Turbolinks.
- Controller with before / after callbacks.
- RESTful routing.
- AssetPipeline (based on Browserify, support CoffeeScript, ClientSide 
Templates, minifying, etc.)
- Code Reload
- Pluralize and localize helpers.
- Modular, create many applications and combine it as you wish (similar to 
how it's done in express).
- Request format recognition and automatically use correct ContentType for 
response and Template extension.
- Full support for CoffeeScript, use it for server code, server templates, 
client code (Backbone.js for
example) client templates. All will be assembled automatically and in case 
of client stuff also 
transpiled to JS packed and delivered to Browser.
- Use mocha.js to create tests similar to RoR RSpec

# What's different from RoR

- Unlike RoR its internal structure is modular, every of its Core Component 
can be replaced. So, you 
don't need things like RoR Engines, it's already there out of the box.
- Small code size, basically it does nothing by itself, it's just a 
gluecode 
delegating all actual work to other well known and established Node.js 
libraries.
- No enforcement on project structure, you can use folder structure like 
RoR or whatever other 
your like.

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Would you like to have RoR clone in NodeJS?

2014-01-10 Thread Alexey Petrushin
Forgot to mention - it's totally compatible with other node.js projects 
like connect and express. In fact it can be distributed as npm module and 
mounted inside of express application.

Synchronous code (with fibers) also compatible with usual asynchronous code 
and can be mixed as you wish.

On Friday, 10 January 2014 18:44:10 UTC+4, Alexey Petrushin wrote:

 It's basically done and used for private projects, but it's not polished 
 and there's no documentation, 
 only some examples. MonoJS http://monojs.org - RoR clone in NodeJS. 

 Examples to play:

 - Classical RoR 10 Blog http://example.monojs.org
 - Simple CMS
   Blog http://jslang.gitsites.com
   Editing http://jslang.gitsites.com/edit
   (Register here http://gitsites.com to play with it and see it in action)

 Would you be interested in such framework? I need to know it to decide -
 create documentations and polishing it or just keep it as it is for 
 internal usage.

 # What's the same as in RoR

 - Looks and feels like working with RoR. Uses same API, naming and 
 conventions.
 - Forget about asynchronous code, use plain and simple synchronous code 
 (without 
 blocking the node, thanks to Fibers).
 - More robust error handling (thanks to Fibers).
 - Full support for RoR AJAX techniques for Classical Web2.0 AJAX - remote 
 links, JS responses, 
 js-helpers, Turbolinks.
 - Controller with before / after callbacks.
 - RESTful routing.
 - AssetPipeline (based on Browserify, support CoffeeScript, ClientSide 
 Templates, minifying, etc.)
 - Code Reload
 - Pluralize and localize helpers.
 - Modular, create many applications and combine it as you wish (similar to 
 how it's done in express).
 - Request format recognition and automatically use correct ContentType for 
 response and Template extension.
 - Full support for CoffeeScript, use it for server code, server templates, 
 client code (Backbone.js for
 example) client templates. All will be assembled automatically and in case 
 of client stuff also 
 transpiled to JS packed and delivered to Browser.
 - Use mocha.js to create tests similar to RoR RSpec

 # What's different from RoR

 - Unlike RoR its internal structure is modular, every of its Core 
 Component can be replaced. So, you 
 don't need things like RoR Engines, it's already there out of the box.
 - Small code size, basically it does nothing by itself, it's just a 
 gluecode 
 delegating all actual work to other well known and established Node.js 
 libraries.
 - No enforcement on project structure, you can use folder structure like 
 RoR or whatever other 
 your like.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Dependency injection for Node.js. What do you think?

2014-01-10 Thread Alexey Petrushin
At last I can show concrete example proving that IoC may be useful, even in 
dynamic languages.

I always liked the simplicity of IoC concept - You don't have to know 
anything about environment, you'll be called by someone when needed

But all IoC implementations I saw did exactly the opposite - they clutter 
the code with even more things than without it. So, I created my own IoC 
that works as I'd like it to be - it stays hidden and invisible 90% of time.

It works like this - register component once in config:

app.register('db', function(){
  return require('mongodb').connect(config.dbPath)
})
  
And use it anywhere in application

app.db.findSomething()

You can see the full component definition code (with DB Connection and 
other stuff) here 
https://github.com/sinizinairina/mono/blob/master/mono.coffee

This is the only place when you have to tell IoC what to do, after that all 
those components will be created and wired automatically and you don't have 
to see IoC specific code in your application anymore.

P.S. 

It may seems stupid - use IoC when you can easily wrote something like 

app.db = require('mongodb').connect(config.dbPath)

But actually it's not - one thing - in code from above your application 
startup will take more time because it will wait until connection to
db has been created. With IoC it will be lazy initialisation - app started 
instantly, and db initialised only when needed.

Another thing, it start to pay more when there are different configuration 
environments like (dev, prod, test) and when code getting bigger and also 
dynamic components (that can be created and destroyed dynamically according 
to some rules) added to play, take look at this 

app.register('controller', {scope: 'request'}, function(){new 
Controller()})

A new controller will be initialised for every request scope and destroyed 
when request will be finished. You can also add multiple components to this 
scope and all of them will be automatically created and destroyed when 
scope started and ended.

On Friday, 27 July 2012 18:45:48 UTC+4, Eldar wrote:

 Do we need this in Node?

 My answer is yes we need some (simple) way to specify the app level 
 dependencies  at runtime. Here is my take on 
 thishttps://github.com/eldargab/node-runtime. 
 Please checkout and let me know how do you feel about.

 But the idea is very simple:

 // inside any index.jsvar R = require('runtime').patchNative()var use = 
 R(module).use
 use('fs', 'node_modules/third/party', require('./smart-fs'))

 That's it. Third party module just uses our smart file system


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: node.js for server-side ?

2013-12-30 Thread Alexey Petrushin
 if i have 1 concurrent users

If you'll have 1 concurrent users on a payment gateway you will 
have enough money to hire developers that will solve any problem no matter 
is it node.js, php or even cobol :)

On Sunday, 29 December 2013 12:44:32 UTC+4, Raf Roger wrote:

 Hi,

 i'm new to node.js so sorry if this question has been already answered 
 before.
 someone told me that node.js works on server-side and can replace PHP for 
 example.

 i learned that javascript is not secured enough to be used on server side 
 to retrieve,save and update data in database. So what makes node.js so 
 different ?
 is it really safe to use it on server-side for database actions ?

 i want to create a web portal with payment gateway and i would like to be 
 sure that if i have 1 concurrent users there is no risk for them and 
 personal data.
 thx


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: we need a new mongodb driver for node

2013-12-30 Thread Alexey Petrushin
Also had problems with verbosity of mongodb-native driver and created 
simplified version http://alexeypetrushin.github.io/mongo-lite

My reasons for creating it was - in most of the cases I usually need only 
about 20% of functionality of MongoDB and don't need rest of it, so, I 
tried to make those 20% easy to use.

Another reason was that I use fibers to eliminate callbacks in my node.js 
applications and needed MongoDB driver that supported such mode (see 
Synchronous mode section in docs).

On Monday, 30 December 2013 19:18:04 UTC+4, Jason.桂林(Gui Lin) wrote:

 node-mongodb-native is the most popular node mongodb driver. But it is 
 not easy to use. I think a mongodb driver should exports the db instance 
 and collection instance synchronized or promised. So I wrote mongoskin, a 
 wrapper layer of node-mongodb-native.

 But I personally don't like mongoskin. Why wrap node-mongdb-native, 
 why not write a new mongodb driver?

 I think node_redis API is good, just return the redisClient instance 
 but not callback, so I can inject the redisClient instance into my service 
 object, and initial my service.

 The bson library is OK,  so the protocol of mongodb can be handled.

 Anyone have interesting to write one?

 

 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Ben Noordhuis's Departure

2013-12-09 Thread Alexey Petrushin
 and they are each responsible for their own words and behavior ... we 
should minimize a company's involvement ...

Bryan's post published on official Joyent blog, not on the Bryan's personal 
blog. So, Joyent is directly involved and should be responsible for it. 

On Monday, 9 December 2013 09:46:51 UTC+4, Mikeal Rogers wrote:

 I don't work for Joyent. 

 I'll continue to speak for myself and I'll continue to laugh about 
 comments as absurd as equality nazi. You have to laugh at the trolls, 
 otherwise they win. 

 If you want to take comments out of context to support some kind of Joyent 
 vs. StrongLoop world view it would be more effective to leave mine out of 
 it since I don't work for either. The reality here is that there was some 
 negative behavior by a contributor and a reaction to it, both of which have 
 had consequences. The majority of the participants are acting on their own 
 behalf and you should address your complaints with them, as individuals, 
 rather than their company. Bryan, Ben, Isaac, everyone has a long history 
 in open source much longer than their current employment and they are each 
 responsible for their own words and behavior. 

 To the extent we can we should minimize a company's involvement in the 
 project. By attributing the actions of long time contributors to their 
 current employer you are forcing those companies to involve themselves more 
 directly, that is not a good thing, let's stop it. 

 -Mikeal 

 On Dec 8, 2013, at 8:59PM, Darren DeRidder drder...@gmail.comjavascript: 
 wrote: 

  Mikeal, the fact that your comment appeared on Twitter makes it no less 
 distasteful, or somehow irrelevant. You took the fact that someone referred 
 to you as an equality nazi as an indication that you were fully in the 
 right regarding this very particular matter, and proceeded to call Isaac 
 The Hitler of equality which he retweeted and seemed to concur with. This 
 disgusts me, and to be honest the level of immaturity and poor judgement 
 I've seen coming from Joyent is completely beyond my ability to comprehend. 
 If I were an investor, I'd be running for the hills. Your comments among 
 others have and will cause damage to the Joyent brand unless I've read this 
 completely wrong. I've emailed Henri and I expect there will be some people 
 answering some hard questions this week. 
  
  To be fair, I agree with some of your early assessments of StrongLoops 
 PR strategy and think your concerns were well voiced and justified. Your 
 sentiments and those of Joyent are understandable given some of the 
 rhetoric coming in the wake of their major investment announcement. 
 Nevertheless I think some amount of retraction on your parts would be 
 beneficial to all parties. Or at least, some judicious restraint. 
  
  -- 
  -- 
  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 subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups nodejs group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an email to nodejs+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: node.js needs a new home

2013-12-05 Thread Alexey Petrushin
Just wondering. I originally thought that node.js license is something like 
MIT and I only today noticed that it's actually not. There's no clear 
license of node.js (at least it's not clear for me) - part from here, part 
from there and all mixed.

Someone mentioned that in case of troubles the fork can be made - is this 
true? I understand that with MIT and similar licenses it can be made 
easily, but is it also true for node.js license?

On Tuesday, 3 December 2013 21:24:02 UTC+4, Darren DeRidder wrote:

 Be it proposed that the community of Node.JS users and supporters will be 
 better served by moving the Node.JS project and its affiliated trade marks 
 and copyrights under the control of the Apache Software Foundation.

 Refer to http://gigaom.com/2013/12/02/slap-fight-in-node-js-land/ and to 
 the mixed reaction to Ryan's original announcement on Joyent  Node, where 
 you'll see several prescient comments from names you recognize. 
 https://groups.google.com/forum/#!topic/nodejs/lWo0MbHZ6Tc
 https://groups.google.com/forum/#!topic/nodejs/lWo0MbHZ6Tc


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: Java APi for Node.js

2013-10-28 Thread Alexey Petrushin
vert.x, rhino and so on may have good java integration, but it also very 
exotic way to use JS, it has very little usage in wild - and so you taking 
high risk by using it.

On Monday, 28 October 2013 19:44:31 UTC+4, Matthew Dalrymple wrote:

 Hmmm.. that is unfortunate. I was hoping to have a nice easy way to do 
 pub/sub with Tibco EMS

 On Thursday, July 25, 2013 2:48:06 PM UTC-4, Stephen Belanger wrote:

 There's also some attempts at a node compatibility layer over vertx.io, 
 like nodyn.io.
  
 On Thursday, 25 July, 2013 at 11:43 AM, Mikkel Wilson wrote:

 If you're not married to node.js specifically, http://vertx.io/ is a 
 fast, asynchronous polyglot container that supports java and javascript 
 running in the same context. It runs in the JVM and can actually be faster 
 than node for some operations.

 -Mikkel

 On Thursday, July 12, 2012 11:28:16 PM UTC-8, pushpinder rattan wrote:

 Folks,


 Is there any integration of Java and  NodeJs?? Can we invoke nodejs using 
 Java?


 thanks
 Pushpinder

  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  
  
  
  

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Error handling: current state of affairs?

2013-10-28 Thread Alexey Petrushin
I use fibers and forget about async errors problems.

On Saturday, 6 July 2013 15:17:28 UTC+4, Tony Mobily wrote:

 Hi,

 I have been writing a bit of code with nodejs, and am sort of going back 
 to brush things up, checking that I am doing things the right way.
 I recently read this:

 http://geoff.greer.fm/2012/06/10/nodejs-dealing-with-errors/

 After a bit of research, I got to this article:

 http://benno.id.au/blog/2011/08/08/nodejs-exceptions

 And to this SO answer:


 http://stackoverflow.com/questions/7310521/node-js-best-practice-exception-handling

 At the moment, I am only ever throwing() if:

 1) I am enclosing _async_ code with try/catch, like this:

  // Get the messages from Json, safely
   try {
 if( ! req.body.messages )
   throw( new Error(req.body.messages not there) );
 var messages = JSON.parse(req.body.messages);
   } catch(e) {
 var messages = [];
   }

 2) Something rlllyyy bad happens in terms of how 
 my module was used. For example a class constructor is missing a necessary 
 parameter, etc.

 In any other case, I am using next( err ). If something really bad 
 happens, for example mongodb dies and calls to the db start failing, I 
 handle it with an error manager in express:

 app.use(  function( err, req, res, next){
  // ...
 });

 But... does this mean that if my application uses a library that has a 
 random throw(), my app will effectively die?
 What's the current state of affairs?

 Looking at existing code, well, I seem to have gotten it right: nodejs 
 libraries tend to only throw when things really aren't supposed to happen. 
 For example in qs/lib/querystring.js:

 function stringifyString(str, prefix) {
   if (!prefix) throw new TypeError('stringify expects an object');
   return prefix + '=' + encodeURIComponent(str);
 }

 But... am I missing something?
 Would this be correct:

 * throw() when the program really deserves to die, and not for external 
 causes (see: the db server goes down, etc.)
 * Always use next( err ) if anything goes wrong (business as usual)
 * Figure out if some libraries emit events, and listen to them if necessary

 Bye,

 Merc.


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: How to prevent disasters caused by the callback getting called multiple times?

2013-10-03 Thread Alexey Petrushin
var _ = require(underscore)

someFn(_(cb).once())

Also, you can use some metaprogramming wrap third party functions directly

ensureCallbackCalledOnce = function(fn){extract callback from args and wrap 
it}
someFn = ensureCallbackCalledOnce someFn
someFn(cb)

On Tuesday, October 1, 2013 9:17:11 AM UTC+4, jeevan kk wrote:

 I am using different 3rd party modules in my project. I have seen, in some 
 odd situations the 3rd party module which I am using is calling the 
 callback multiple times. 

 Is there any general approach which I can follow so avoid such situations. 


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] node application hangs sometimes, how to track down problem?

2013-09-21 Thread Alexey Petrushin
Most of the time it works well, but sometimes - it hangs - server continue 
to accept connections but don't reply back.

And, its hard to reproduce the problem, seems like it occurs rarely and 
randomly, so I can't reproduce it on my machine.

Maybe it's possible to see all descriptors for opened IO connections? Or 
collect some other metrics? I've checked RAM and CPU usage when problem 
occured - seems like normal, no anomaly there.

-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Debugging running node process

2013-09-19 Thread Alexey Petrushin
But such approach applicable only if you can reproduce the problem, it's 
not always possible though ...

On Thursday, September 19, 2013 3:06:18 PM UTC+4, Alexey Petrushin wrote:

 node.js is extremely hard to debug, one method I found is - binary search 
 - cut app in half and see in which half the problem is - and continue 
 cutting in half until you found the source :).

 On Wednesday, September 18, 2013 3:21:04 PM UTC+4, Vivek Goel wrote:

 Hi, 
 I have node daemon (gearman worker). Sometime I am facing the problem 
 that the process don't respond to some particular requests (gearman jobs). 

 I am using following modules 

- gearman
- mysql
- redis
- aws sdk
- node-gcm
- node-apn

 I don't know in which module the program is hanging. Is it hanging in my 
 code or some of third party code. 

 Is there a way to find out in which module it is hanged  (while process 
 is in running state) ?


 What are the methods used for debugging already running process in node ?






-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Mongo vs. Couch vs. LevelDB ?

2013-09-16 Thread Alexey Petrushin
I wrote small article with my subjective view about how CouchDB differs 
from MongoDB
http://petrush.in/blog/2013/a-little-about-cochudb-and-comparison-with-mongodb/show

On Wednesday, August 28, 2013 5:35:40 PM UTC+4, Dylan Hassinger wrote:

 Hi everybody - I am a Node newb building my first app, and trying to 
 figure out which database system to use. Can anybody shed some light on 
 what the major differences are between Mongo, Couch and LevelDB - and when 
 is the right time to to use them?

 Specifically, is the syntax similar between them / is it easy to switch 
 after-the-fact?

 Also wondering if anybody has suggestions for hosted database-as-a-service 
 options? I've heard good things about MongoHQ, but not sure if there's 
 hosted options for Couch or LevelDB. Thanks for any help!!

 dylan


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: NodeJs e-commerce solution?

2013-09-12 Thread Alexey Petrushin
Customers doesn't care if there's MongoDB, CouchDB, MySQL inside this 
e-commerce stuff.

Also, as soon as the goal is to build widely used open source e-commerce - 
it won't be a huge million user a day site (nobody uses simple open source 
shops at such scale), it will be a small, simple and easy to use shop. And 
on such a small scale - it's totally irrelevant how you implement it, it 
probably will works fine even if you decide to not use any DB at all and 
store all stuff in plain files.

So, this discussion about DB choice is pointless. Would be more interesting 
to see what set of features it's supposed to have and where to get a cool 
design (the thing that unlike DB is really important) for it.

On Thursday, September 12, 2013 2:38:19 PM UTC+4, Adam Reynolds wrote:

 Lol SQL is boring 

 Think you're doing it wrong :)


 On Thu, Sep 12, 2013 at 11:04 AM, klrumpf klr...@gmail.com 
 javascript:wrote:

  if you do go sql because of the ACID issues there's also non blocking 
 MariaDB  https://npmjs.org/package/mariasql
 for node and see 
 https://mariadb.com/blog/mariadb-non-blocking-client-api-and-nodejs 

 Karl-L. rumpfklr...@gmail.com javascript:
 Málaga, Spain

 On 12/09/13 00:19, Lucas Schmidt wrote:
  
 I think it should be fine using MongoDB if you use something like REDIS 
 and their lua scripts as transactions. 

  Or, if Mongo + Lua is not the best option, I would use Neo4j, since its 
 ACID but has the plus of being a graph. (Actually, I would still use Neo4j, 
 even if I were using Mongo + Redis)

  SQL is boring, and if you are really going to develop using SQL, just 
 do it in Java or some other language that can provide you a lot of 
 transactions support. You could still develop all your e-commerce using 
 Node, but a few specific Micro Services using a Java Spring as a Restful 
 Webservice.

  But good luck ... e-commerce is crazy difficult I would say. 

 Em quinta-feira, 10 de maio de 2012 15h55min51s UTC-3, guzelgoz escreveu: 

 Hi all, 

  I've been searching and searching but couldn't find any project/open 
 source node e-commerce platform. As I am running some e-commerce websites 
 using the PhP prestashop solution, I was really hoping to find some sort of 
 e-commerce project but Nada!

  Ideally, I would like to use Expressjs and MongoDB. Do you know any 
 e-commerce project that I could participate?

  If not, I would like to invite anybody to start a project. I think it 
 would have great interest and at least I would participate to it - as a 
 novice node programmer ;) but a serious user that may help on what is 
 needed.

  Looking forward to your feedbacks!
 Thanks,
 Hakan

  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.


  -- 
 -- 
 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 subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nod...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 nodejs+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: How to signal to a readable stream to stop reading (and close)?

2013-08-30 Thread Alexey Petrushin
Spend a lot of time trying to solve similar issue (terminate nod needed 
anymore reading stream in case of app error), seems like there's no 
`destroy` method in Stream's Documentation, would be nice to have it there.
Or is it deprecated?

On Friday, June 28, 2013 11:01:46 AM UTC+4, Michael Hart wrote:

 Hi all,

 I'm struggling with a fairly basic problem to do with limiting (ie, 
 truncating) streams and signalling to the source readable to stop reading 
 and close.

 Here's a simple example that hopefully illustrates what I mean:

 fs.createReadStream('myHugeFile')
   .pipe(someTransform)
   .pipe(someTruncatingStream)
   .pipe(process.stdout)

 Where someTruncatingStream wants to only take the first n bytes of the 
 transformed stream, and then signal hey, I'm done (ie, no need to keep 
 reading the massive file).

 Is there a way to do this from someTruncatingStream without it having 
 direct access to the source read stream? ie, some way to signal up the pipe 
 to stop reading and close everything down (ie, not just pause)?

 In my case it's actually not a file stream that I want to do this for - I 
 just figured that was the easiest illustration. Mine is an object stream I 
 want to create in front of a DB which is being queried a page at a time - I 
 want to expose a stream for this that can continue paging behind the scenes 
 and spitting out data, but that knows to stop paging when the consumers 
 have consumed all the data they want. ie:

 db.createReadStream({some: 
 query}).pipe(someOtherFilter).pipe(stringify).pipe(take100).pipe(process.stdout)

 I could use another paradigm for this, a lazy collection for example - but 
 it seems to me that streams should support this and are more of a lingua 
 franca to expose from a module API (and indeed can be transformed into lazy 
 collections themselves, a la lazy.js/node-lazy)

 Cheers,

 Michael


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Mongo vs. Couch vs. LevelDB ?

2013-08-30 Thread Alexey Petrushin
MongoDB similar to traditional RDBMS in terms that it's also an universal 
database applicable to lots of use cases.

CouchDB has some unique features, but, it's a specialised database, it may 
be a good fit for some special use cases, but it's not universal DB, and 
it's not a good fit for general web app. 

LevelDB - also specialised and high performant low-level DB, not for 
general usage.

On Wednesday, August 28, 2013 5:35:40 PM UTC+4, Dylan Hassinger wrote:

 Hi everybody - I am a Node newb building my first app, and trying to 
 figure out which database system to use. Can anybody shed some light on 
 what the major differences are between Mongo, Couch and LevelDB - and when 
 is the right time to to use them?

 Specifically, is the syntax similar between them / is it easy to switch 
 after-the-fact?

 Also wondering if anybody has suggestions for hosted database-as-a-service 
 options? I've heard good things about MongoHQ, but not sure if there's 
 hosted options for Couch or LevelDB. Thanks for any help!!

 dylan


-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Mongo vs. Couch vs. LevelDB ?

2013-08-30 Thread Alexey Petrushin
If you want to use specialised things like CouchDB or LevelDB - you need to 
know how it works and why you choose it.

On Friday, August 30, 2013 11:30:47 PM UTC+4, Alexey Petrushin wrote:

 MongoDB similar to traditional RDBMS in terms that it's also an universal 
 database applicable to lots of use cases.

 CouchDB has some unique features, but, it's a specialised database, it may 
 be a good fit for some special use cases, but it's not universal DB, and 
 it's not a good fit for general web app. 

 LevelDB - also specialised and high performant low-level DB, not for 
 general usage.

 On Wednesday, August 28, 2013 5:35:40 PM UTC+4, Dylan Hassinger wrote:

 Hi everybody - I am a Node newb building my first app, and trying to 
 figure out which database system to use. Can anybody shed some light on 
 what the major differences are between Mongo, Couch and LevelDB - and when 
 is the right time to to use them?

 Specifically, is the syntax similar between them / is it easy to switch 
 after-the-fact?

 Also wondering if anybody has suggestions for hosted 
 database-as-a-service options? I've heard good things about MongoHQ, but 
 not sure if there's hosted options for Couch or LevelDB. Thanks for any 
 help!!

 dylan



-- 
-- 
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 subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   3   >