Re: [nodejs] Re: process.env - documentation?

2012-11-01 Thread Tim Caswell
, I'm developing on Windows. Thanks for the understanding! Yes a link would have avoided all confusion. On 1 November 2012 17:42, Tim Caswell t...@creationix.com wrote: I've been using since before it was popular. Back in the early days, the docs for node were full of references to linux man

Re: [nodejs] Server-to-Server Communication

2012-10-29 Thread Tim Caswell
Internally at cloud9, we use the smith protocol. It's based on the same idea of dnode, but has restricted abilities so that it can be leak-proof using normal javascript (dnode requires --harmony to prevent leaks) and very fast. We usually use the protocol over msgpack + tcp between servers (or

Re: [nodejs] Re: Forever with ssh

2012-10-19 Thread Tim Caswell
I run all my sites using upstart. http://creationix.com/ http://howtonode.org/ http://nodebits.org/ http://luvit.io/ The sites themselves are mostly static content, so I don't need cluster or anything. The auto-restart directive in upstart keeps them running between crashes and server reboots

Re: [nodejs] peeves current best practices?

2012-10-10 Thread Tim Caswell
Great writeup! Most these points are right on. I take issue with a couple of them and have a different opinion. (That's right, this is my opinion, not saying you're wrong) ## Inconsistent sync/async When functions are sometimes sync and sometimes async lead to hard to use apis, subtle bugs

Re: [nodejs] Serving static files to slow clients

2012-10-10 Thread Tim Caswell
I find that using a simple Stream.prototype.pipe from the file stream to the response stream works equally great for fast and slow clients. What really speeds things up is making sure to implement conditional and partial requests. (If-Modified-Since, If-No-Match, Range, ...) Node's stream pipe

Re: [nodejs] Any resources to help one brush up...?

2012-10-08 Thread Tim Caswell
The official nodejs API docs are great. My experience with most people learning nodejs is that they didn't know javascript as well as they had thought. Node makes heavy use of callbacks and closures. This means that more often the weird aspects of js scoping creep out. There are many nodejs

Re: [nodejs] How to: Convert C libraries to gyp

2012-10-02 Thread Tim Caswell
Oh right. I'll forward that to my people who have been complaining. Thanks again for all the awesome writeups. On Tue, Oct 2, 2012 at 9:44 AM, Nathan Rajlich nat...@tootallnate.net wrote: Tim, have you read http://n8.io/cross-compiling-nodejs-v0.8/ ? On Tue, Oct 2, 2012 at 7:22 AM, Tim

Re: [nodejs] Re: How to for beginners

2012-10-02 Thread Tim Caswell
While it's not super organized and some of the content it quite old, http://howtonode.org/ has some popular content in it. I use the object-graph series heavily when I'm doing my programming classes. Also http://nodebits.org/ is another site I work on that is inspiring examples. Not exactly

Re: [nodejs] [ANN] Tetris in color

2012-09-27 Thread Tim Caswell
Very awesome! Would you like to write up a small article on building command-line games for nodebits.org (or mind if I write one about this app when I get time)? This is perfect for people learning to program. Most GUI platforms are too complicated for beginners, but tetris is a great task. On

Re: [nodejs] Re: What Editor / OS / Dev enviroment do you use?

2012-09-24 Thread Tim Caswell
On Sep 24, 2012 8:42 AM, Alexey Petrushin alexey.petrus...@gmail.com wrote: Mac OS + Textmate / Sublime As for Ubuntu - while on vacation temporarily switched to Ubuntu from Mac OS - only to discover that after all those Years Ubuntu even doesn't have Cntr+C/V (You has to press

Re: [nodejs] Re: What Editor / OS / Dev enviroment do you use?

2012-09-21 Thread Tim Caswell
For the longest time time I used Gedit on linux, Textmate on OSX, and Vim on headless boxes. Then sublime2 came out and I used that for a short while since it runs on windows, linux, and osx. Now I mostly use the hosted cloud9 because I work from several machines and having my dev environment

Re: [nodejs] Re: What Editor / OS / Dev enviroment do you use?

2012-09-21 Thread Tim Caswell
On Fri, Sep 21, 2012 at 1:12 PM, William Oliveira sudowill...@gmail.com wrote: @Tim Caswell I'm going to try Cloud9, heard so much about it. Any tips for new users? Disclaimer: I'm employed at cloud9. That said, the editor is finally something that I enjoy using now that I have a real tty

Re: [nodejs] Re: What Editor / OS / Dev enviroment do you use?

2012-09-21 Thread Tim Caswell
/c66284221143c175fc889418d499da6f37492a7c Try it out and see. -- Diogo Resende On Friday, September 21, 2012 at 19:28 , Tim Caswell wrote: On Fri, Sep 21, 2012 at 1:12 PM, William Oliveira sudowill...@gmail.com wrote: @Tim Caswell I'm going to try Cloud9, heard so much about it. Any tips for new users

Re: [nodejs] Re: How to open interactive terminal apps with child_process?

2012-09-21 Thread Tim Caswell
execFile is for buffering the output and storing it in a single value in the callback. spawn is for streaming the results. My guess is execFile ignores the custom stdio pipes. On Fri, Sep 21, 2012 at 4:22 PM, James Coglan jcog...@gmail.com wrote: On 21 September 2012 12:40, James Coglan

Re: [nodejs] use nodejs as streaming server

2012-09-20 Thread Tim Caswell
I would start by reading up on audio encoding formats. This alone is a pretty complex topic. Also, what is you client, what capabilities does it have? If the client is a browser that's very different than say a native mobile client on iOS. As far as the node part, building a simple data proxy

Re: [nodejs] Re: Keeping semantics in your version numbers, i.e. please don't release major version zero

2012-09-20 Thread Tim Caswell
My experience with the node community has been that we love semver, but have a slightly different definition than what's on the website. If an npm module release is a bug-fix then the last digit is incremented. If it's a API breaking change, then the middle digit is incremented and the last

Re: [nodejs] Re: Keeping semantics in your version numbers, i.e. please don't release major version zero

2012-09-20 Thread Tim Caswell
On Thu, Sep 20, 2012 at 2:25 PM, Austin William Wright diamondma...@users.sourceforge.net wrote: If more than a dozen people are using your package, then next time you make a breaking change, release 1.0.0. Continue to clearly identify when you make breaking changes, when you release new

Re: [nodejs] Re: Crockford : Ynode : I would fork node.js

2012-09-18 Thread Tim Caswell
On Wed, Sep 19, 2012 at 2:52 AM, Isaac Schlueter i...@izs.me wrote: Rick, That's nice. I've been told that Yahoo does have an internal version of Node that you can get via `yinst install ynode`, and they use it a lot. They also pull in changes from the upstream project, and have sent pull

Re: [nodejs] Node.js on embedded platform

2012-09-17 Thread Tim Caswell
Yes, you can most likely get node on there but there won't be much left at all. I created a lua version of node for exactly cases like this at luvit.io. It's an order of magnitude more efficient on both ram and disk space with comparable performance and semantics, but at the cost of a much less

Re: [nodejs] Feature poll: Do you use the clientError event?

2012-08-30 Thread Tim Caswell
4 On Thu, Aug 30, 2012 at 12:12 AM, Shigeki Ohtsu oh...@iij.ad.jp wrote: clientError on http.Server 2.5(I've never used before) clientError on https.Server 2(I sometimes used for debug) I think that clientError on https.Server is valuable to check SSL errors as $node https_server2.js

Re: [nodejs] Re: How to debug a read-line app

2012-08-27 Thread Tim Caswell
If you pause the v8 thread using the debug protocol, then no javascript code can run in the v8 thread (this includes the stdin reading code in the readline module). It's not possible to introspect and evaluate expressions in a node repl while node itself is paused. This kind of introspection

Re: [nodejs] How to debug memory leaks in node.js app?

2012-08-27 Thread Tim Caswell
I have one automated test that looks for memory leaks. Basically I do some operation a *lot* of times and record the memory usage over time. I then analyse the results and calculate the relative standard deviation to decide it it's a leak or not.

Re: [nodejs] HuJS is here

2012-08-25 Thread Tim Caswell
Thanks Glen for all your efforts organizing this! I'm sure it's been a ton of work. On Sat, Aug 25, 2012 at 4:44 AM, Glenn Block glenn.bl...@gmail.com wrote: Nodesters We're bringing the node.js and JavaScript love to Shanghai (my temporary home for the past few months) with our first

Re: [nodejs] shrouding the javascript source via encryption

2012-08-23 Thread Tim Caswell
If you bundled node itself in your binary and disabled the debugger protocol, then it would somewhat secure from amateur hackers. But even then, all the user has to do is take a heap snapshot using some OS level tool and see your plain-text source. V8 keeps the original source in memory so that

Re: [nodejs] Re: Am I understand it right

2012-08-23 Thread Tim Caswell
Ket, what are you trying to do? It sounds like you have a concrete problem to solve here and not just looking for a way to use both php and nodejs in the same app. There are a million ways to integrate the two code bases together, but it all depends on what you're trying to do and why you have

Re: [nodejs] Re: Am I understand it right

2012-08-23 Thread Tim Caswell
So what is the PHP side doing? Is it just serving static html (or php templated html)? Sounds like the node server is doing the bulk of the work. It would probably be easiest to port the php code to node. Also you can configure node to be a cgi or fcgi server (using a third-party module) and

Re: [nodejs] Interprocess Communications between Node.js and other programs (non-node.js) spawned as child_processes

2012-08-22 Thread Tim Caswell
On Tuesday, August 21, 2012 9:20:31 PM UTC+8, Tim Caswell wrote: I implement my own protocols over stdio all the time. Node doesn't wait till 8k of data is queued before sending. You just need to treat the same as a TCP stream and not assume anything about the chunk sizes. The simplest framing

Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Tim Caswell
On Wed, Aug 22, 2012 at 12:54 PM, Alexey Petrushin alexey.petrus...@gmail.com wrote: By the way, why checking for existence is 'anti-pattern'? Can You please give a link to the detailed description of such case? Because if you're going to do anything with the file after checking for it, why not

Re: [nodejs] Interprocess Communications between Node.js and other programs (non-node.js) spawned as child_processes

2012-08-21 Thread Tim Caswell
I implement my own protocols over stdio all the time. Node doesn't wait till 8k of data is queued before sending. You just need to treat the same as a TCP stream and not assume anything about the chunk sizes. The simplest framing protocol for binary data is to send a 4byte length header before

Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-20 Thread Tim Caswell
How about removing it from the docs and making it non-enumerable in the fs module. Then any new developers won't know it's there unless they are reading someone else's code. Or maybe in the docs simply say that it shouldn't be used and is only left there so as to not break old code. Also, how

Re: [nodejs] Looping and creating divs

2012-08-16 Thread Tim Caswell
It depends on what you're doing. If you're writing an http web server and want to serve generated html using jade in node, then use jade's loop constructs to generate the appropriate html. On Thu, Aug 16, 2012 at 12:13 PM, Bob Wohl bob.w...@gmail.com wrote: Hello all, I'm new to Jade and

Re: [nodejs] Looping and creating divs

2012-08-16 Thread Tim Caswell
is probably to online a style tag into each of your divs and use absolute width and height. But it's not always the best solution for many reasons. B. On Thu, Aug 16, 2012 at 1:18 PM, Tim Caswell t...@creationix.com wrote: It depends on what you're doing. If you're writing an http web server and want

Re: [nodejs] Looping and creating divs

2012-08-16 Thread Tim Caswell
with node libraries as best we can. This is the node users list after all. I just wasn't sure what you were asking. Also, I'm not sure if there is a dedicated jade mailing list. You can also try #node.js, and #express on freenode irc. On Thu, Aug 16, 2012 at 1:56 PM, Tim Caswell t

Re: [nodejs] Re: JavaScript editor that might be great for node development

2012-08-15 Thread Tim Caswell
Actually a keyboard driven version of something like this might be neat. When I do word processing I love using the lyx editor. It's a GUI front-end for latex and so your content has to be highly structured. You can't hit enter 5 times to increase the number of lines between paragraphs. What I

Re: [nodejs] I have no idea what I'm doing, and I would like some guidance.

2012-08-15 Thread Tim Caswell
Node can be used for about any programming task just like any turing complete programming language coupled with system primitives. The think that makes node standout if the great balance between abstraction and power. It's especially useful for web development because JavaScript is already used

Re: [nodejs] Being both event-driven servers, why node.js needs async code where Nginx doesn't?

2012-08-15 Thread Tim Caswell
Both answers so far have been great. If you're programming an extension for nginx, yes it is async. It is fairly difficult because async in C is a lot harder than async in javascript. But if you're writing your application logic in some blocking system written in ruby, php, python or even

Re: [nodejs] organizing functions into modules

2012-08-14 Thread Tim Caswell
On Tue, Aug 14, 2012 at 10:40 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: I know there are many opinions on the best way to organize functions into Node modules. I'd like to throw out an example and see what people think. Suppose you are writing a module that performs basic statistics.

Re: [nodejs] [ANN] Node Cookbook

2012-08-10 Thread Tim Caswell
Congrats Dave! Achievement Unlocked - Finished writing a tech book. On Fri, Aug 10, 2012 at 12:53 PM, Dave Clements huperekch...@googlemail.com wrote: Hello Everyone I was looking for a good practical book about Node about 10 months ago, but I couldn't really find anything beyond the

Re: [nodejs] Best practice for SSL termination with Socket.io

2012-08-10 Thread Tim Caswell
We're using Amazon's ELB in SSL-TCP mode. We then forward this to a cluster of stateless node http proxies (using node-http-proxy) that do the host and path based routing to the right app servers. This works great except we lose the remote client's IP address. On Fri, Aug 10, 2012 at 2:53 PM,

Re: [nodejs] Best practice for SSL termination with Socket.io

2012-08-10 Thread Tim Caswell
On Fri, Aug 10, 2012 at 3:35 PM, Guillermo Rauch rau...@gmail.com wrote: Until ELB adds WebSocket support. The TCP level ELB does, not the HTTP one. But that's why we lose the client's IP because TCP proxy can't set http headers. -- Guillermo Rauch LearnBoost CTO http://devthought.com

Re: [nodejs] Current Directory Change/Parent Exec?

2012-08-09 Thread Tim Caswell
When your node script first starts, get the cwd by calling `process.cwd()`. Then on process exit process.chdir() back to it. Note this is only needed on windows as far as I know. Unix systems do this automatically for child processes. On Thu, Aug 9, 2012 at 8:20 AM, Ben Evans

Re: [nodejs] Re: [ANN] New release of node-webkit - run node.js apps on desktop

2012-08-09 Thread Tim Caswell
I don't know it this was mentioned before, but could you summarize how this project differs in goals and maturity to other similar projects like appjs? I'm not trying to discourage you, this work is fantastic! I just know that it's not obvious to everyone what the differences are. On Thu, Aug

Re: [nodejs] Re: How do you handle if/else with async inside

2012-08-08 Thread Tim Caswell
of its control flow functions helpful for the if/else problem? Thanks, danmilon. On 08/08/2012 05:56 AM, Tim Caswell wrote: If there really are only two functions that have the same callback signature, then it's super easy taking advantage of named function value hoisting. if (cond

Re: [nodejs] Re: Node.js-net socket - Sending frame

2012-08-08 Thread Tim Caswell
NodeJS is great for sending binary data over a TCP socket. I do it all the time. Only use strings if you want one of the string encodings of your data. The default is utf8 which disallows several bit patterns. Buffers act somewhat like arrays of integers and let you send exact bytes with full

Re: [nodejs] Re: Introducting Mule - A worker process pool for CPU intensive tasks

2012-08-07 Thread Tim Caswell
, August 6, 2012 8:45:07 PM UTC-7, Tim Caswell wrote: I use console.log. I override the function when I want to redirect the output. On Mon, Aug 6, 2012 at 3:08 PM, kuhnza david.s.k...@gmail.com wrote: One thing I am keen to know right off the bat is what's the standard practice for logging

Re: [nodejs] RedHat/Fedora/CentOS Package Manager Update

2012-08-07 Thread Tim Caswell
I develop on linux and deploy to linux. I just use nvm to manage my node versions. It's easy enough to get a compiler on all my production boxes. Also I've heard rumors that nodejs.org will start distributing node binaries for linux some time in the future. On Tue, Aug 7, 2012 at 9:28 AM, Rob

Re: [nodejs] Re: Introducting Mule - A worker process pool for CPU intensive tasks

2012-08-07 Thread Tim Caswell
On Tue, Aug 7, 2012 at 9:54 AM, Matt hel...@gmail.com wrote: I prefer if you at least have a level of indirection away from console.log, so that I can override it (or pass in a log function to a constructor of some sort) without having to stomp on console.log. The thing is, what is the purpose

Re: [nodejs] Re: Introducting Mule - A worker process pool for CPU intensive tasks

2012-08-07 Thread Tim Caswell
I should mention that I only leave console.log statements in production code for rare cases (like noting an http server was created and is listening). I try to never do it in libraries I publish because my users might not care about that information. I like the idea of

Re: [nodejs] RedHat/Fedora/CentOS Package Manager Update

2012-08-07 Thread Tim Caswell
On Tuesday, August 7, 2012 9:25:29 AM UTC-6, Tim Caswell wrote: I develop on linux and deploy to linux. I just use nvm to manage my node versions. It's easy enough to get a compiler on all my production boxes. Also I've heard rumors that nodejs.org will start distributing node binaries

Re: [nodejs] What's different of requiring json or js?

2012-08-06 Thread Tim Caswell
On Sun, Aug 5, 2012 at 3:31 PM, Joshua Gross joshua.gr...@gmail.com wrote: There may be a better answer for this, but JSON is actually more rigidly structured than standard JavaScript. So, it makes sense to me that a more specialized parser would need more memory than just sending JavaScript

Re: [nodejs] Looking for inspitarion ...

2012-08-06 Thread Tim Caswell
Closure variables are bound lexically to functions. // Create a local variable named name that points to the primitive string Tim var name = Tim // Create a function who's [scope] inherits from the current scope. function printName() { console.log(name); } // Call

Re: [nodejs] where are the developer simple frameworks?

2012-08-06 Thread Tim Caswell
Have you seen web frameworks like express, strata, geddy, etc..? In most of those a simple memory/cookie based session in a 1-liner. Routes are dead simple. Form parsing is a one-liner. On Mon, Aug 6, 2012 at 10:16 AM, Mihamina Rakotomandimby miham...@rktmb.org wrote: Hi all Lurking here for

Re: [nodejs] UUID's in javascript

2012-08-06 Thread Tim Caswell
Depending on how strict your requirements are, I often just use: Date.now.toString(36) + - + (Math.random() * 0x1000).toString(36) Date.now is unique every ms and Math.random has a keyspace of 2^32, so collisions are statistically impossible in most practical applications. On Mon, Aug 6,

Re: [nodejs] Re: Introducting Mule - A worker process pool for CPU intensive tasks

2012-08-06 Thread Tim Caswell
I use console.log. I override the function when I want to redirect the output. On Mon, Aug 6, 2012 at 3:08 PM, kuhnza david.s.k...@gmail.com wrote: One thing I am keen to know right off the bat is what's the standard practice for logging within node libraries? Right now mule simply uses

Re: [nodejs] UUID's in javascript

2012-08-06 Thread Tim Caswell
with, but I became suspicious that it was too easy somehow. Maybe I'll switch back to that if file-size/performance becomes an issue (which it won't). Ted On Aug 6, 2012, at 8:27 PM, Tim Caswell t...@creationix.com wrote: Depending on how strict your requirements are, I often just

Re: [nodejs] Serving static files, but not from public directory?

2012-08-03 Thread Tim Caswell
What kind of caching do you want? This is a complicated issue. And are you also talking about conditional http requests (Etag, timestamps, 304 responses)? What about range request support? A simple filter in front of any off-the-shelf static file server should five you 95% of what you want.

Re: [nodejs] I can't understand why this happen, it's a simple code

2012-07-30 Thread Tim Caswell
http://howtonode.org/object-graphs - basic explanation about object references http://dmitrysoshnikov.com/ecmascript/javascript-the-core/ - more correct, but harder to understand explanation. On Mon, Jul 30, 2012 at 9:10 AM, Roly Fentanes roly...@gmail.com wrote: That's how javascript works. If

Re: [nodejs] what's the best way to has a position property for Buffer object

2012-07-28 Thread Tim Caswell
buf.readUInt32BE, we have to do BufHelper.readUInt32(buf) Regards, ty 2012/7/27 Tim Caswell t...@creationix.com If you're talking about a protocol parser, I find state machines work best. Do you need a streaming parser or one that first deframes messages and then parses pre-buffered

Re: [nodejs] NodeConf SummerCamp

2012-07-25 Thread Tim Caswell
I hope we play ultimate frisbee again. Where can I get tournament weighted disks as node themed schwag? On Wed, Jul 25, 2012 at 12:28 PM, Mikeal Rogers mikeal.rog...@gmail.com wrote: Marin County.

Re: [nodejs] header for response.writeHead() - best way to remove?

2012-07-16 Thread Tim Caswell
The place where I avoid delete in node code is in class instances. (where class means a constructor and the instance is the result of using `new`) From my understanding of the VM, delete causes V8 to bail out of the hidden classes optimizations making all property lookups much slower forever on

Re: [nodejs] [off] how to convince my boss to invest on realtime technologies

2012-07-12 Thread Tim Caswell
Just as a data point, we depend heavily on websockets for c9.io. It's an online IDE written in node. We need realtime feedback for breakpoint debugging sessions, terminal emulators in the browser, pushing various events to the browser (file change events) and collaborative editing. While the

Re: [nodejs] remoteable events

2012-07-12 Thread Tim Caswell
If you want multi-transport, freestyle rpc (with callbacks), then dnode-protocol (by substack) or smith (by me) are nice. https://github.com/substack/dnode-protocol/ https://github.com/c9/smith On Thu, Jul 12, 2012 at 7:07 PM, Oliver Leics oliver.le...@gmail.com wrote:

Re: [nodejs] Inherit Versus Pipe

2012-07-11 Thread Tim Caswell
If there are errors and the child process crashes, then using child.stderr.pipe(process.stderr, {end:false}) won't always show the stack trace that blew up the child. However, sharing the parent's stderr using customFds will since stderr in the child is then sync. On Wed, Jul 11, 2012 at 1:02

Re: [nodejs] Bug with mocha + Step + node.js?

2012-07-11 Thread Tim Caswell
As I responded on github, step catches exceptions and routes them to the next step as an err argument. It's your responsibility to check this argument in all steps and handle it. On Tue, Jul 10, 2012 at 4:03 PM, Thijs Vermeir thijsverm...@gmail.com wrote: Hi, I think I run into a bug with

Re: [nodejs] nodejs.tchol.org YUM repo out of date?

2012-07-09 Thread Tim Caswell
I almost always build node from source on linux using nvm. Getting the build tools in linux is almost trivial. That said, there is a PPA for ubuntu that's usually up to date. Also the archlinux-arm repo keeps their node version very up to date (which is nice since building on arm is a bit

Re: [nodejs] Is there an Apache module for connecting node.js similar to mod_jk?

2012-07-09 Thread Tim Caswell
NodeJS *is* the http server. I'm not sure how it would run inside apache. I guess you could run node as a cgi program or implement the wsgi interface or something, but that kinda defeats the purpose of node's architecture. On Fri, Jul 6, 2012 at 8:41 AM, Andrew Leer leean...@gmail.com wrote:

Re: [nodejs] why is node server easier for maintaining state between requests?

2012-07-09 Thread Tim Caswell
Yes, any long-running script can store state inside the script. In node servers these are available through closures or other means (properties on shared modules). Don't store gigabytes of data here. If you have any serious storage requirements, it's probably best kept in something better

Re: [nodejs] Re: Unbelievable Request...

2012-07-03 Thread Tim Caswell
http://nodemanual.org/, http://docs.nodejitsu.com/, http://nodetuts.com/ On Sat, Jun 30, 2012 at 10:59 PM, hasanyasin hasanya...@gmail.com wrote: Thank you very much. howtonode is a blog so it is kind of different than what I am doing. I will probably do it on a separate website designed for

Re: [nodejs] Default interfaces

2012-07-03 Thread Tim Caswell
I am working on such a file system interface. See it at http://github.com/c9/vfs. We use it internally in the new cloud9 version. On Sat, Jun 30, 2012 at 4:50 AM, Felix Böhm felixboeh...@googlemail.comwrote: Hello, after reading the Database API

Re: [nodejs] NodeJS Keystrokes

2012-06-27 Thread Tim Caswell
if you set raw mode on the stdin stream, then you'll get a data event for each keystroke using the normal stream API. On Wed, Jun 27, 2012 at 5:06 AM, Sebi sebastian.tild...@googlemail.comwrote: Hello, In older versions of Node you could track keystrokes the user made with the following: ...

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

2012-06-27 Thread Tim Caswell
I use it (minimum versions) for libraries that require the user to upgrade their node version. For example, vfs-local requires node 0.6.16 because of the uid/gid fix that went into that version is essential or there are huge security holes. On Wed, Jun 27, 2012 at 2:56 AM, Vitaly Puzrin

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

2012-06-27 Thread Tim Caswell
Isaac, so, in strict mode, do we still have the funky fallback logic where it tries to get the next best version of the package to satisfy the current environment? If so, I think we should change it to only attempt the preferred version and either warn or throw depending on the strict flag. For

Re: [node-dev] ARM support

2012-06-26 Thread Tim Caswell
I also have a pi, but I mostly use it for luvit development. I can test things if needed. On Jun 26, 2012 2:32 PM, AJ ONeal coola...@gmail.com wrote: Hey Nate, that sounds great! If you'd like some wonderfully failing test cases, send me an e-mail when you get your Pis. AJ ONeal On Tue,

Re: [node-dev] ARM support

2012-06-26 Thread Tim Caswell
it out. AJ ONeal On Tue, Jun 26, 2012 at 5:34 PM, Tim Caswell t...@creationix.com wrote: I also have a pi, but I mostly use it for luvit development. I can test things if needed. On Jun 26, 2012 2:32 PM, AJ ONeal coola...@gmail.com wrote: Hey Nate, that sounds great! If you'd like some

Re: [nodejs] Addon: Native vs JS?

2012-06-26 Thread Tim Caswell
I would recommend doing minimal work in C++, especially if you're more comfortable in JS. As far as performance, keep in mind that crossing the JS - C++ boundary is very expensive. The less calls into C++, the faster you'll be. Even for people experienced in C++, the recommendation I often hear

Re: [nodejs] Re: Node.js Guide?

2012-06-26 Thread Tim Caswell
Hmm, that's my snippet server. I know there were DNS changes for today's c9.io release. I'll look into it. On Jun 26, 2012 4:04 PM, Eric S e...@geekzilla.org wrote: On Tuesday, June 26, 2012 12:06:09 PM UTC-7, Jim Byrnes wrote: On [1] I see Imagine this piece of code: but nothing follows

Re: [nodejs] Re: Node.js Guide?

2012-06-26 Thread Tim Caswell
Yep, it was a DNS issue. If you add this to your /etc/hosts file you can see the snippets while we wait for the dns to fix: 66.228.52.36 snippets.c9.io On Tue, Jun 26, 2012 at 6:42 PM, Tim Caswell t...@creationix.com wrote: Hmm, that's my snippet server. I know there were DNS changes

Re: [nodejs] NodObjC and iOS or Mac App Store distribution

2012-06-25 Thread Tim Caswell
for their javascript engine. Only Safari gets full jit enabled JSC. There are several articles about this when this restriction was discovered in 4.3. Ted On Jun 23, 2012, at 10:35 PM, Tim Caswell wrote: The difference between V8 and most other scripting languages is that V8 does not have an interpreter

Re: [nodejs] Re: Node version 0.8.0

2012-06-25 Thread Tim Caswell
https://twitter.com/creationix/status/217306462265946112 There are many, n, nvm, nave, use whatever you feel comfortable with. On Mon, Jun 25, 2012 at 12:53 PM, Mark Hahn m...@hahnca.com wrote: I'll switch to n github issues now but my latest problem is that I canceled the 0.6.18 install and

Re: [nodejs] Re: Node and developing on multiple machines

2012-06-23 Thread Tim Caswell
This is where the package.json file shines. Simply define your app's dependencies in it's package.json. Then on whatever machine you're working, getting the right dependencies is a simple `npm install` away. This also has the added benifit of avoiding dependency issues where project A depends

Re: [nodejs] Re: NodObjC and iOS or Mac App Store distribution

2012-06-23 Thread Tim Caswell
I don't think there is a way to get nodejs using V8 running in an app-store friendly format. But I would love to get libuv and some scripting engine running there. I may try my luvit project first (luajit + libuv) or luvmonkey (spidermonkey + libuv). Another combination would be JSC + libuv.

Re: [nodejs] Re: NodObjC and iOS or Mac App Store distribution

2012-06-23 Thread Tim Caswell
, at 19:43, Tim Caswell wrote: I don't think there is a way to get nodejs using V8 running in an app-store friendly format. Again, why? Is it the same concerns Jorge expressed above? But I would love to get libuv and some scripting engine running there. I may try my luvit project first (luajit

Re: [nodejs] Unable to compile node v0.8 RC7 on ARM (Beaglebone)

2012-06-22 Thread Tim Caswell
Also, I've recently noticed that archlinux ARM has nodejs in their repository. It's usually quite up to date. They support many arm devices including the beaglebone and the raspberry pi. Even if you don't want to switch to archlinux or just want a newer node than the one they are packaging,

Re: [nodejs] Re: Reading a unsigned 64bit integer from a buffer.

2012-06-21 Thread Tim Caswell
Keep in mind that you'll lose precision when converting it to a native javascript number. JS numbers are defined to be double floats. (though I head long type is coming in future JS) On Thu, Jun 21, 2012 at 2:48 PM, Ben Short b...@benshort.co.uk wrote: After searching this group I got it to

Re: [nodejs] readdir vs ls using childprocess

2012-06-21 Thread Tim Caswell
What you want to do is readdir, and then stat each entry. Once you have the file stats, you can sort the list in JavaScript. The control-flow can be tricky the first time you do this since stat is an async function. There are many examples on the web of readdir with stat. There might even be

Re: [node-dev] Changing the Port for sending

2012-06-20 Thread Tim Caswell
Node supports duplex tcp streams just fine. There is no need to have two servers and two clients like in your example. On Wed, Jun 20, 2012 at 10:23 AM, Fabian Korak fabian...@googlemail.comwrote: Hello, sorry for the double-post, google-mail interface decided to post before I was finished...

Re: [nodejs] [ANN] redis-lock: An implementation of locks using redis

2012-06-18 Thread Tim Caswell
Nice work. Though I wonder why a simple out-of-process node instance wouldn't be enough. (it could even live in-process for one of the node processes) Node is single threaded and such locks are trivial to write. hald of the code would the protocol used to talk to the node process. I would

Re: [nodejs] Getting unique tick Id

2012-06-14 Thread Tim Caswell
I doubt something like this would go into core, but if core had a supported API for wrapping event sources, it would be trivial to implement as a third-party module. On Thu, Jun 14, 2012 at 6:11 PM, Mark Hahn m...@hahnca.com wrote: I can't imagine any situation where it would be a good code

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Tim Caswell
that assumes the last arg is a callback. Now there will be an optional argument after the callback that can be anything (including another function) On Fri, Jun 8, 2012 at 1:18 PM, AJ ONeal coola...@gmail.com wrote: Yes, That's what I am suggesting. AJ ONeal On Fri, Jun 8, 2012 at 12:17 PM, Tim

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Tim Caswell
On Fri, Jun 8, 2012 at 12:17 PM, Tim Caswell t...@creationix.com wrote: So this proposal is to modify the API of all async functions to have an extra thisp argument after the callback argument (like done in Array.prototype.forEach)? On Fri, Jun 8, 2012 at 1:06 PM, AJ ONeal coola

Re: [nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Tim Caswell
your mind. AJ ONeal On Fri, Jun 8, 2012 at 2:22 PM, George Stagas gsta...@gmail.comwrote: No need to change the API, we have .bind() - use the language features, don't reinvent them. 2012/6/8 Tim Caswell t...@creationix.com: On Fri, Jun 8, 2012 at 2:10 PM, tjholowaychuk tjholoway

Re: [nodejs] nodejs to handle images

2012-06-07 Thread Tim Caswell
Node is great at anything that is I/O bound, especially if it needs to stream. It doesn't matter what the bits are. On Thu, Jun 7, 2012 at 2:59 AM, Amit Kumar Maurya a...@igidr.ac.in wrote: Can anybody tell if nodejs perfoms as well when used for uploading and downloading images (500kb to 5mb)

Re: [nodejs] value of _this_ within callback function ?

2012-06-06 Thread Tim Caswell
A simple one-line session in the repl gives you the answer right away: require('fs').stat(., function (err, stat) { console.log(this, this, this.__proto__ === Object.prototype, this.oncomplete === arguments.callee) }) // OUTPUTS: this { oncomplete: [Function] } true true As you can see, the

Re: [nodejs] process.nextTick in a callback

2012-06-06 Thread Tim Caswell
Here is a slightly cleaned up version of the code with comments as to why it's doing what it does. (the `this.result` code didn't affect the output and was a distraction since it was polluting the global scope) function addasync(no1, no2, callback) { res = no1 + no2; callback(false, res); //

Re: [nodejs] process.nextTick in a callback

2012-06-06 Thread Tim Caswell
Anand, it appears some fundamentals about closures, scope, and callbacks are confusing you. Some tips that may help. 1. Always use `var` when creating a new local variable or it will be declared global and clobber existing variables. 2. Your `result` argument is a function. Every time you call

Re: [nodejs] Re: Event loop blocking. How to detect?

2012-06-06 Thread Tim Caswell
It would be hard to preempt the thread since node is single threaded, but you could wrap the event sources and measure how long a tick took to run. Then if it took longer than a threshold you could log a warning or throw an error. Sadly there is no node api for easy wrapping of the event sources

Re: [nodejs] Detect if path is writable

2012-06-05 Thread Tim Caswell
Using the canWrite function from vfs-local, you can do it with a simple stat. https://github.com/c9/vfs/blob/master/local/localfs.js#L19-23 function canWrite(owner, inGroup, mode) { return owner (mode 00200) || // User is owner and owner can write. inGroup (mode 00020) || // User

Re: [nodejs] Re: Detect if path is writable

2012-06-05 Thread Tim Caswell
if you can write to it? Best to just try to do whatever you're trying to do and watch for possible errors. On Tue, Jun 5, 2012 at 9:49 AM, Bert Belder bertbel...@gmail.com wrote: On Jun 5, 4:31 pm, Tim Caswell t...@creationix.com wrote: Using the canWrite function from vfs-local, you can do

Re: [nodejs] require(), Object.Create and Inheritance

2012-06-05 Thread Tim Caswell
in your john.js file: var Client = require(./client); Client is a function. You then try to inherit from said function Object.create(Client, ... On Tue, Jun 5, 2012 at 11:15 AM, howdoicodethis howdoicodet...@gmail.comwrote: Hi everyone. Glad to be here. I'm still struggling

Re: [nodejs] Redirecting from naked domain to www with node/express?

2012-06-04 Thread Tim Caswell
I will mention that most browsers send the port as part of the host header. So if you're testing locally using a custom /etc/hosts on port 8080 (or just using port 8080 on the production machine), you'll need to account for that in the host routing. On Mon, Jun 4, 2012 at 10:02 AM, Oliver Leics

<    1   2   3   4   >