[nodejs] NodeJS PPTP VPN server

2014-01-16 Thread Marcel Laverdet
I wrote an experimental PPTP VPN server in Node. Why? We may never know. Anyway this was part of a larger personal project and I ultimately decided to swap this component out for a solution involving routing tables and tun/tap instead. Figured there was a small chance someone would get some use

Re: [nodejs] Is it possible to break v8's memory limitation?

2013-08-22 Thread Marcel Laverdet
Why hasn't anyone posted --max-old-space-size=size in MB yet? Just do that w/ 8192 for instance, for 8gb. On Thu, Aug 22, 2013 at 1:48 AM, NStal Loit nstalm...@gmail.com wrote: Thank you peter, C++ binding is another choice I would consider, if I make sure it's hard to remove v8 heap limit

Re: [nodejs] Re: Callbacks as our Generations' Go To Statement - Miguel de Icaza

2013-08-19 Thread Marcel Laverdet
Even the current generator/yield implementations are essentially accomplished via CPS transforms. This is untrue. Fibers uses a new stack and a long jump. Haven't looked at the implementation for generators in v8 but I'd be surprised if it was anything more exotic than a stack frame allocated on

Re: [nodejs] Re: Future of asynchronous programming in node

2013-08-12 Thread Marcel Laverdet
We were running it in callbacks mode before and we switched to fibers-fast mode recently. It made a big difference: the application is now 5 times faster and it uses 2 or 3 times less memory!! Niice. I had a strong feeling that would be the case. Sometimes powerful tools have to be dangerous

Re: [nodejs] Future of asynchronous programming in node

2013-08-05 Thread Marcel Laverdet
Mikeal correct me if I'm wrong as I haven't thought about it that much, but even with ES6 generators a function *must* run to completion before a turn of the event loop unless it's explicitly marked as a generator itself (function*). This isn't a guideline but a technical limitation as generators

Re: [nodejs] Retrieving values asynchroniously

2013-04-28 Thread Marcel Laverdet
I think the distinction between *doing* node and *using* is good call. I wrote a tampering HTTP proxy server in node; I used streams and callbacks. I wrote a web application with lots of waiting on database and filesystem chatter; I used fibers w/ futures. On Sun, Apr 28, 2013 at 11:22 PM, Bruno

Re: [nodejs] Retrieving values asynchroniously

2013-04-27 Thread Marcel Laverdet
I'm rolling in my grave. On Wednesday, April 24, 2013, greelgorke wrote: where's the fibers guy? :D Am Dienstag, 23. April 2013 22:31:57 UTC+2 schrieb azer: I wrote a guide for defining async values previously; https://github.com/azer/**declarative-jshttps://github.com/azer/declarative-js

Re: [nodejs] How to copy Value in different thread?

2013-04-12 Thread Marcel Laverdet
You need to grab a Persistent handle, not a Local one. Local handles are only valid in the current scope, once the current HandleScope unwinds the handle is invalid. In the case of threads, this is what you are running into. Your problem can be fixed as easily as doing: PersistentValue handle =

Re: [nodejs] Re: V8 team will start working on generators

2013-03-30 Thread Marcel Laverdet
https://github.com/laverdet/node-fibers (only slightly trolling) On Sat, Mar 30, 2013 at 3:49 PM, Mark Hahn m...@hahnca.com wrote: node has had generators since early 2011 Reference please? On Fri, Mar 29, 2013 at 9:22 PM, Marcel Laverdet mar...@laverdet.comwrote: ?_? node has had

Re: [nodejs] Re: V8 team will start working on generators

2013-03-29 Thread Marcel Laverdet
?_? node has had generators since early 2011. ;) ;) ;) On Fri, Mar 29, 2013 at 9:53 PM, Bruno Jouhier bjouh...@gmail.com wrote: Good news! For us the migration be a one line code change! Will be interesting to compare the performance between generators and callbacks. Bruno On

Re: [nodejs] Immediately-Invoked Function Expressions Demystified

2013-03-20 Thread Marcel Laverdet
Dude. Type `function () {} ()` into a browser console and hit enter. That's my point. It's an error. That's why I say it's not equivalent. You MUST have the parens. I hate to be that guy but you really need to read the spec. It's not just a joke that people say, it's actually really quite

Re: [nodejs] Immediately-Invoked Function Expressions Demystified

2013-03-20 Thread Marcel Laverdet
It is fairly tricky, all things considered. It's one of two syntactic ambiguities in the language that are, rather unconventionally, resolved with a one-off rule. Basically the rule here is that no statement may begin with a FunctionExpression. Consider that: This works: foo(); function foo(){};

Re: [nodejs] Immediately-Invoked Function Expressions Demystified

2013-03-19 Thread Marcel Laverdet
This doesn't do too much to demystify anything, imo. Now how that works... I have no idea, but I do believe that it's more aesthetic and so that's how I write my code. I won't argue if you feel differently. It works because (foo)() is identical to foo(). The only reason that that even works

Re: [nodejs] Re: why fallocate is not exposed?

2013-02-24 Thread Marcel Laverdet
Sorry if I was unclear but I'm asking about specific use cases, i.e. what are _you_ going to use it for? I think this is one of those cases where the potential uses are actually fairly clear and non-theoretical. For instance, I built a quick dirty version of Facebook's Haystack service in Node,

Re: [nodejs] Re: advice on try/catch implementation

2013-02-03 Thread Marcel Laverdet
My race condition would like to have a talk with you. On Sat, Feb 2, 2013 at 9:37 PM, Paul Vencill paul.venc...@gmail.com wrote: I wouldn't do the try..catch at all, I'd just do a fs.exists(..) call to see if the files were there before requiring them. On Wednesday, January 30, 2013 5:45:01

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

2013-01-28 Thread Marcel Laverdet
I've not heard of Harmony proxies but I'll take a look and see what you're suggesting. You really should. They basically give you catch all methods on objects which would let you make an API that more closely resembles the simplicity of Mumps that you're going for. Here's the operations you

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

2013-01-28 Thread Marcel Laverdet
I can't say your suggested Harmony proxies look any more natural to me than the APIs I've suggested - maybe I'm missing something. Well, this: var desc = patient.$('conditions').$(0).$('description')._value; Could just be this: var desc = patient.conditions[0].description; And the whole

Re: [nodejs] Coping with invalid http headers

2013-01-09 Thread Marcel Laverdet
('curl', [url]) over the monkey patch. On Tue, Jan 8, 2013 at 7:34 PM, Matt hel...@gmail.com wrote: On Tue, Jan 8, 2013 at 5:24 PM, Marcel Laverdet mar...@laverdet.comwrote: By heavy load I'm talking about network traffic, either on your end, their end, or any hop in between. In the first

Re: [nodejs] Coping with invalid http headers

2013-01-08 Thread Marcel Laverdet
Apply this patch: https://gist.github.com/4487528 Node shouldn't be barfing on anything a browser can display and should really be more tolerant of these failures. I should submit a PR.. but not sure if this will cause other issues down the road. On Tue, Jan 8, 2013 at 12:42 PM, Matt

Re: [nodejs] Coping with invalid http headers

2013-01-08 Thread Marcel Laverdet
and a bit nasty, but works, at least with node 0.6 (have to check if the same process applies on 0.8). On Tue, Jan 8, 2013 at 3:18 PM, Marcel Laverdet mar...@laverdet.comwrote: Apply this patch: https://gist.github.com/4487528 Node shouldn't be barfing on anything a browser can display

Re: [nodejs] Coping with invalid http headers

2013-01-08 Thread Marcel Laverdet
this in JS code than to have to remember to patch node every time we upgrade. Not sure what you're thinking about with under heavy load - I can't imagine why that would affect anything. Got some way to elaborate on that? On Tue, Jan 8, 2013 at 4:42 PM, Marcel Laverdet mar

Re: [nodejs] Inconsistent method names?

2012-12-27 Thread Marcel Laverdet
As for readdir (and many other functions in the fs module) they are named to match the underlying POSIX function name. For instance: http://linux.die.net/man/3/readdir readFile is an abstraction created by Node so it adheres to naming standards. On Thu, Dec 27, 2012 at 12:02 PM, David Habereder

Re: [nodejs] One complicated SQL query or many smaller ones

2012-12-27 Thread Marcel Laverdet
This is not always true. It's much easier to add more database clients than it is to add database servers. Offloading work from a hot database server to a web cluster can be just as good of an idea.. it depends a lot on your infrastructure and there's no golden bullet for this guy. On Wed, Dec

Re: [nodejs] this and that

2012-12-13 Thread Marcel Laverdet
var myobj = require( the-file ); eval( 'myobjs.' + file-name = myobj;'); How has no one commented on the fact that you're doing numeric arithmetic on a bunch of strings? All this is going to do is give you a parse error, and when you fix that you're just doing require(NaN). With all due

Re: [nodejs] where is interval id in 0.8.14?

2012-11-21 Thread Marcel Laverdet
Seems that this /could/ create issues if you did something like this: var timers = {}; var timer = setTimeout(function() { ... }, 100); timers[timer] = timer; for (var ii in timers) { clearTimeout(ii); unset(timers[ii]); } The spec does specify that it must be a number, however this was

Re: [nodejs] Re: fibers 0.5; say no callbacks (when it makes sense in your application)

2012-11-11 Thread Marcel Laverdet
When things get complex, issues like race conditions and deadlocks sometimes become really hard to debug. Race conditions and deadlocks are not a pitfall of cooperative multitasking. There are plenty of legit reasons to not use Fibers but I don't think this is one of them. On Fri, Nov 9, 2012

Re: [nodejs] How to properly pass LocalObject as function param?

2012-11-11 Thread Marcel Laverdet
You should probably just be using Handle in most of your function parameters. The only reason to specify Local or Persistent instead of the more generic superclass Handle is when you need to manage the lifetime of the object. It's generally not the callee's job to manage the memory of the

Re: [nodejs] ANN: Spoon

2012-10-01 Thread Marcel Laverdet
You have no idea what you've done. On Mon, Oct 1, 2012 at 2:11 PM, Fedor Indutny fe...@indutny.com wrote: Hey people, Let me introduce you The Spoon: https://github.com/indutny/spoon It's a JavaScript to CFG (Control-Flow Graph) transpiler and additionally a CPS (Continuation Passing

Re: [nodejs] Listing all Pads + full text search

2012-09-30 Thread Marcel Laverdet
Is this about NodeJS? Am I the only one who has no idea what's going on? On Saturday, September 29, 2012, Dan wrote: Hi, first of all I want to thank you all for that amazing project :) I'm really missing an index or a list of all available pads. I think that can be achieved quite easily

Re: [nodejs] nodejs memcached client

2012-09-21 Thread Marcel Laverdet
I use node-memcache, it's perfect. The `node-memcache` cant reconnect the memcache, if memcache service restarted. Why can't you manually reconnect? It's not the library's responsibility to try and clean up errors that you may want to handle some other way. On Tue, Aug 21, 2012 at 4:35 AM,

Re: [nodejs] psutil library for node

2012-09-07 Thread Marcel Laverdet
Never never never never never never never put using namespace in a header file. Or before *any* #include. On Thu, Sep 6, 2012 at 8:36 AM, christkv chris...@gmail.com wrote: I'm slowly working on rewriting the python lib psutil for node but I'm running into a problem on linux. It builds

Re: [nodejs] Unload entire module

2012-09-03 Thread Marcel Laverdet
we have some very long running apps we are trying to reduce the footprint on and unloading certain modules seems to be a good start To be honest, that doesn't sound like a very good start. If your long applications have a growing footprint then you are leaking memory somewhere. Cleaning up

Re: [nodejs] [Ann] UglifyJS 2.0

2012-09-01 Thread Marcel Laverdet
, danmilon. On 08/30/2012 12:27 AM, Marcel Laverdet wrote: Just curious why you need the comments in the AST at all? If you've got the start position length of every token in the AST (much easier to do) you implicitly have the comments as well. The fiber engine in Streamline ( https

Re: [nodejs] [Ann] UglifyJS 2.0

2012-08-30 Thread Marcel Laverdet
translations sometimes you want to keep them in (for instance a header with copyright notice when compressing or *all* of them in a case like mine) Best Scott On Aug 29, 2012, at 2:27 PM, Marcel Laverdet mar...@laverdet.com wrote: Just curious why you need the comments in the AST at all

Re: [nodejs] [Ann] UglifyJS 2.0

2012-08-29 Thread Marcel Laverdet
Just curious why you need the comments in the AST at all? If you've got the start position length of every token in the AST (much easier to do) you implicitly have the comments as well. The fiber engine in Streamline ( https://github.com/Sage/streamlinejs/blob/master/lib/fibers/transform.js) does

[nodejs] What the hell is travis4all?

2012-08-23 Thread Marcel Laverdet
Did anyone just get a kind of spammy pull request on github from travis4all? https://github.com/travis4all 1,334 repos and counting. Is this just a bot that is going through github and issuing automatic pull requests for all nodejs projects or what? -- Job Board: http://jobs.nodejs.org/ Posting

Re: [nodejs] Node.js for small in-house app (should not need much maintenance)

2012-08-19 Thread Marcel Laverdet
Definitely a job for Google Docs. Not to say NodeJS isn't suitable it's just going to take a lot longer. On Sun, Aug 19, 2012 at 9:53 AM, Felix E. Klee felix.k...@inka.de wrote: A friend asked me to write a guest-list app for a club, something like A-LIST [1]. Guests (VIP) are maintained in a

Re: [nodejs] Wind.js : An elegant approach to asynchronies JavaScript

2012-08-18 Thread Marcel Laverdet
As far as I can tell, the differences between Jsex/Wind and Streamline (and for that matter IcedCoffeeScript and TameJS) are largely superficial. The tough part is the compiler, which you can only do so many ways; all other features are just bells and whistles which could be implemented by a user

Re: [nodejs] A method to get memory profiles that works?

2012-08-04 Thread Marcel Laverdet
RES stands for resident, not reserved. Reserved sounds closer to virtual memory. RSS/RES should be meaningful representations of the physical amount of memory your application needs. On Sat, Aug 4, 2012 at 3:37 PM, Axel Kittenberger axk...@gmail.com wrote: Can somebody explain me the

Re: [nodejs] --max-old-space-size v8 options not working with sizes1900 in v0.8.x

2012-08-03 Thread Marcel Laverdet
I am definately on a x86_64 machine. So higher limits should work. Are you running 64 bit node? What does `process.arch` return for you? On Fri, Aug 3, 2012 at 9:36 AM, Thomas Fritz fritz...@gmail.com wrote: Hi, I just tried to increase the heap size of v8. code node

Re: [nodejs] Re: Simple Memcached server in Javascript with 100 lines of code

2012-08-03 Thread Marcel Laverdet
Yes adding --nouse-idle-notification to your node flags is definitely the first thing you should try. You may also try avoiding objects with large numbers of keys (like a million seems to be my ceiling). On Fri, Aug 3, 2012 at 8:35 PM, Jimb Esser wastel...@gmail.com wrote: Best thing to try,

Re: [nodejs] Compiling JS for Safe vm.runInNewContext()

2012-07-11 Thread Marcel Laverdet
Look at Google Caja, this does exactly what you describe. It's a very complicated problem. On Wednesday, July 11, 2012, Angel Java Lopez wrote: I presented a project (idea, no code yet) that needs that feature, too. Game server (as a service?) that accepts logic code from game tenants.

Re: [nodejs] Compiling JS for Safe vm.runInNewContext()

2012-07-11 Thread Marcel Laverdet
Too robust is not a thing. This is a problem that is very complex. As mentioned in later replies by the Caja team and others since node is using a very modern version of v8 you can run Caja with minimal translations that are all done in pure-JS. With regards to infinite loops you've got another

Re: [nodejs] Sandboxing using 'vm' module wrapping require()/process.binding()

2012-07-02 Thread Marcel Laverdet
With all do respect you are in over your head :) If you want to take a stab at this for real take a peek at google-caja On Mon, Jul 2, 2012 at 9:27 PM, Will Riley hapticf...@gmail.com wrote: Hi, Right now I'm working on a sandbox library for node.js. I'd most likely be using

Re: [nodejs] Re: remove engines from package.json?

2012-06-30 Thread Marcel Laverdet
In that case wouldn't it also be possible to just change all instances of 0.6.x to =0.6.0 within npm itself and then throw an error if you try to publish with 0.6.x? The problem here never was a bad feature, it was bad metadata. All the metadata is in one central repository for the most part.. On

Re: [nodejs] Re: remove engines from package.json?

2012-06-28 Thread Marcel Laverdet
not upgrading everything or doing new work. This is not a real concern, and if it ever becomes one, it won't be all that hard to address. On Wed, Jun 27, 2012 at 7:26 PM, Marcel Laverdet mar...@laverdet.com wrote: If this is a bad problem I feel the correct solution would be to add a flag

Re: [nodejs] Re: remove engines from package.json?

2012-06-27 Thread Marcel Laverdet
Broken metadata is just broken metadata This hits the nail on the head. This fix to me feels very short-sighted and PHP-y to me. If this is a bad problem I feel the correct solution would be to add a flag to npm install such that you could skip the engines check: `npm install --force

Re: [nodejs] best practices for debugging a c++ add-in

2012-06-27 Thread Marcel Laverdet
GetPort() needs a HandleScope and you need to pass the return value through scope.Close(...). This is false. v8 builds a HandleScope for you automatically when a function or accessor is called through JS. You only need to use HandleScope at the very very top level (node.cc, or stuff like fibers

Re: [nodejs] Re: Algorithm help

2012-06-16 Thread Marcel Laverdet
Please keep in mind that getting the size of an object like this is NOT a constant time operation, as it would be with an array. If you are using the size frequently you should consider keeping a separate variable with the length yourself, instead of doing Object.keys(table).length every time.

Re: [nodejs] Algorithm help

2012-06-15 Thread Marcel Laverdet
Sorry that's your job man.. On Fri, Jun 15, 2012 at 9:30 PM, vitoa vitor.moinho...@gmail.com wrote: Tanks a lot for quick reply Could you help me implemnet that on my posted algorithm? Regards, Vitor -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

Re: [nodejs] Object as hash with 7 million entries slows V8

2012-05-11 Thread Marcel Laverdet
There is an issue in v8 where idle tick GC does not pick up where the old GC left off and leads to lots of time wasted. See v8 issue #1458. This is fixed in bleeding_edge, but hasn't landed in node yet, not even 0.7.x. Try Jeremy's suggestion or you could also try using bleeding_edge v8 on node

Re: [nodejs] BeagleBone with node.js - getting started.

2012-05-09 Thread Marcel Laverdet
. The question is how were they installed? Paul Hi Paul, I think libcoro can't run on an ARM, but you should better ask Marcel Laverdet (https://github.com/laverdet/node-fibers), or perhaps Marc Lehmann (http://software.schmorp.de/pkg/libcoro.html) cc -Wall -Wno-deprecated-declarations -I/usr

[nodejs] Fibers: now with Windows support, binary distribution, and gyp

2012-05-09 Thread Marcel Laverdet
Hey all just a quick note about some news on node-fibers. Thanks to the work of @japj, node-fibers is now runnable under Windows. Now you can use fibers on pretty much any platform. Semi-related: node-fibers now includes a binary for Windows, OS X, and Linux in both 32 and 64-bit x86

Re: [nodejs] BeagleBone with node.js - getting started.

2012-05-09 Thread Marcel Laverdet
the latest version of node running on it but didn't get very far before moving on to other things. On Wed, May 9, 2012 at 2:29 PM, Jorge jo...@jorgechamorro.com wrote: @Marcel Cool! @Paul what does `cc -v` give you ? On May 9, 2012, at 9:18 PM, Marcel Laverdet wrote: libcoro runs fine

Re: [nodejs] BeagleBone with node.js - getting started.

2012-05-09 Thread Marcel Laverdet
, Marcel Laverdet wrote: gcc version shouldn't matter. The pthread version of libcoro will run on anything with POSIX-pthreads, it's a very very robust implementation. That's not to say that node-fibers will run on everything.. the build process will need to accomodate that. I got access

Re: [nodejs] Re: Is it legit to distribute binaries via npm?

2012-05-06 Thread Marcel Laverdet
For several hundred meg libraries the answer is much less obvious.. But even with a sophisticated or integrated build system, you still can't make assumptions about their environment? I think Node developers on Windows without a compiler even installed are quite common. Does node-gyp solve that?

[nodejs] Is it legit to distribute binaries via npm?

2012-05-04 Thread Marcel Laverdet
Title says it all. It seems that modules with a compile stage can sometimes be difficult for users to get installed. Ubuntu users may not have their node headers installed, Windows users may not have any compiler at all, Linux users may have broken build environments, there's just lots of issues

Re: [nodejs] Odd evalution of instanceof regexp in sandboxed module

2012-05-01 Thread Marcel Laverdet
for asking again. If I got yours explanation right the new context has his own copy of the source objects, but they are Javascript RegExp isn't? why instanceof fails? Thanks again, Eric On Monday, April 30, 2012 6:22:04 PM UTC-3, Ben Noordhuis wrote: On Mon, Apr 30, 2012 at 23:14, Marcel

Re: [nodejs] Odd evalution of instanceof regexp in sandboxed module

2012-04-30 Thread Marcel Laverdet
The new context gets its own RegExp and set of built-ins. You'll run into the same issue with [] and Array, {} and Object, and function(){} and Function. On Mon, Apr 30, 2012 at 1:28 PM, Eric e...@craftti.com.br wrote: Hi guys, I have a code that check if a certain object is a regexp by

Re: [nodejs] Re: How to avoid callback hell?

2012-04-17 Thread Marcel Laverdet
idk man my advice has always been to first learn callbacks and what's going on behind the scenes, and then to give something like fibers a try if you want. It's more like OP said that he knew how to swim but was having problems crossing the English Channel. In this case it doesn't matter whether

Re: [nodejs] Re: How to avoid callback hell?

2012-04-15 Thread Marcel Laverdet
PS: I just recently heard about node's past ability to froze stack with promise.wait(). It's sad that this ability was removed just because some guys used it wrong. It's useful and needed feature for right hands. While I personally wasn't part of the community when that went down I did a lot of

Re: [nodejs] Re: How to avoid callback hell?

2012-04-10 Thread Marcel Laverdet
Joe your stubbornness speaks volumes. If you'd have quit everything in life after spending 10 minutes and messing up once you wouldn't get anywhere. There's an ever-growing number of supporters of this kind of technology (435 followers on github for fibers, 222 for streamline) and to not even

Re: [nodejs] garbage collection, patterns: classical/prototypal inheritance and ValueObject

2012-03-10 Thread Marcel Laverdet
If you can write it in JS, v8 can garbage collect it. On Sat, Mar 10, 2012 at 2:46 PM, Phoscur phos...@pheelgood.net wrote: Short Question: Do V8 and Jägermonkey garbage collect prototype chains at some point? Let code speak: https://gist.github.com/e83c353f7f16e14e4333 Actually, while

Re: [nodejs] Merging a layout document with a database record

2012-03-04 Thread Marcel Laverdet
*hijack* xml-literals is plates but without the need to use strings everywhere: https://github.com/laverdet/js-xml-literal On Sun, Mar 4, 2012 at 5:33 PM, Tito Ciuro tci...@gmail.com wrote: Hi Jann, Having read both options, I would say that plates matches our workflow better. Based on the

Re: [nodejs] Re: Thinking asynchronously

2012-02-26 Thread Marcel Laverdet
Yeah fibers as a crutch isn't recommended. It should be a tool, but not until you can do it without the tool :) On Sun, Feb 26, 2012 at 4:19 PM, Oliver Leics oliver.le...@gmail.comwrote: On Sun, Feb 26, 2012 at 11:07 PM, Chris Scribner scr...@gmail.com wrote: If you have a lot of logic like

Re: [nodejs] Re: Thinking asynchronously

2012-02-26 Thread Marcel Laverdet
Well you need to understand what's going on under the hood at least to some degree, or someone on your team does to enforce best practices and so you'll have someone to go when things go wrong. When things go wrong and Fibers are involved, if you don't know what's going on then you're up a shit

Re: [nodejs] Re: parseInt bug

2012-02-24 Thread Marcel Laverdet
...@jorgechamorro.com wrote: On Feb 24, 2012, at 8:37 PM, Marcel Laverdet wrote: You could extend String.prototype if you wanted to but it's probably one of the less common ways to do this kind of thing. It has disadvantages like portability, and it will ONLY works on strings. Using Number

Re: [nodejs] Re: JSLint or not?

2012-02-23 Thread Marcel Laverdet
Doesn't every modern JS-minifier kill trailing commas? On Thu, Feb 23, 2012 at 3:27 AM, cole gillespie mcg42...@gmail.com wrote: one thing that i use it for mainly is to catch trailing commas of death -- IE is a bitch. JSHint helps with checking for simple human errors. I agree with TJ 100%

Re: [nodejs] parseInt bug

2012-02-21 Thread Marcel Laverdet
Yeah it's identical to prefix +, just more english and doesn't blend in with string concatenation. It's totally a matter of preference. I personally find that while writing software I'm rarely blocked by raw typing speed so I use Number() because it makes +'s less ambiguous when I'm reading my

Re: [nodejs] Re: How to continuously read a file while the file is been writing

2012-02-09 Thread Marcel Laverdet
, Shin Suzuki shinout...@gmail.com wrote: Sorry, I mistook it. It went fine. In some programs, they replace a file instead of appending... 2012/2/9 Marcel Laverdet mar...@laverdet.com You certainly can do this without reopening the file. I'm using very similar code to tail MySQL's binlogs

Re: [nodejs] Re: How to continuously read a file while the file is been writing

2012-02-08 Thread Marcel Laverdet
Matt keeps screaming race condition because conditions stated to not be handled are not handled. On Wed, Feb 8, 2012 at 5:09 PM, Mark Hahn m...@hahnca.com wrote: That's not really a race, just a condition not covered. On Wed, Feb 8, 2012 at 3:08 PM, Matt hel...@gmail.com wrote: There's a

Re: [nodejs] Re: How to continuously read a file while the file is been writing

2012-02-08 Thread Marcel Laverdet
, Considering the overhead of opening the file in each change event, just spawning tail -f would be better as Matt says. What's difficult is that we cannot know at which line the child process of tail -f starts to read when the file is growing. 2012/2/9 Marcel Laverdet mar...@laverdet.com

Re: [nodejs] Re: How to continuously read a file while the file is been writing

2012-02-06 Thread Marcel Laverdet
Shin, I commented on your gist with code you can use. You just need to modify it to catchup with existing data. Please treat this only as a proof of concept, and be aware you need to handle error unexpected errors like truncated files, deleted files, and so on. Also keep in mind that on OS X