Better HN
topnewbestaskshowjobs
Log inSign up

funthree

542 karma · joined Feb 12, 2010 (16y ago) · 251 submissions

[ my public key: https://keybase.io/tblobaum; my proof: https://keybase.io/tblobaum/sigs/tvAGRKG_mQAZivxjubNNBqKIInRhRxikL8D1Pz-ngFA ]
Submissions

comment 14y ago · link · parent

There are a number of ways to do this but when I first started with node I started by using some different files which hold environment variables. You can then export some environment variables based on where you are running your code (production, dev, staging, etc)

For instance you might have a .production file

    export NODE_ENV="production"
    export NODE_PORT="80"
And a .development file

    export NODE_ENV="development"
    export NODE_PORT="3000"
Before you run "node app" just link to your variables with "$ . .production" or "$ sh .production"

Again there are many ways to accomplish this same thing but this way is pretty straightforward if you are familiar with linux.

EDIT: To add to the link to configuration pkrumins posted (http://expressjs.com/guide.html#configuration)

process.env will hold all of your environment variables, and express.js will read "NODE_ENV" internally. A combination of the above, and setting up corresponding internal configuration in your node.js app will provide for a very clean setup.

comment 14y ago · link · parent

Seems eerily the same.

comment 14y ago · link · parent

It is an exact quote of what he said.

comment 14y ago · link · parent

The closest thing that might get you there is farming communities in the Midwest... with no power, or cell phones, or cars, or houses, with dangerous wild animals still roaming about, no medical treatment, no firearms, and no prior 21st-century civilization thought patterns, and you're still only sort of glimpsing it.

Seriously? And people in the Midwest are still somehow the "ignorant ones" ... Stay classy.

comment 15y ago · link · parent

Your concern is valid and you probably wouldn't want to program every DOM manipulation with nodequery, and that isnt required. Yes, you would theoretically want to limit the number of calls to the server the same as you would in any paradigm, and hopefully that would be the same as or fewer than an equivalent client-side application. Currently this is just an experiment and I dont recommend it for production.

comment 15y ago · link · parent

Also noteworthy is the new ability to treat the DOM as a resource from the server point of view. Extracting information and rendering view partials in realtime as well as placing event listeners for the DOM on the server can help get things done quite a bit faster. This is especially true since you can now work with the DOM near the scope of other server-side only resources making it easier to create prototypes and apps that have a high level of user interaction with them.

comment 15y ago · link · parent

There are a number of reasons why you might want to use jquery directly from the server. Some off the top of my head...

-You can keep your application code hidden from prying eyes

-You only serve up ~120kb of javascript to the client no matter how intense your application is

-You can get better response times for realtime games and apps since what your user is doing is tightly coupled with what actually needs to react (the server).

-You can write 3,000,000 or 10 lines of application logic and it will not affect the speed of the client's device.

One flaw is (potentially) in coming up with a new way to cache redundant requests properly.

158.

NodeQuery is a realtime server-side DOM API(github.com ↗)

104 points · by funthree · 15y ago · 24 comments

comment 15y ago · link · parent

Without going into too much detail about it your assumption is only partly true. It depends on how many API calls you make to jquery from the server, but also sending your realtime data in HTML actually doesnt suck (your server already renders html like this for http requests) and you also dont have to serve up any client-side assets -- the total number of KB transferred is likely to be less with nodequery even after x amount of time on the site because you keep everything but arbitrary strings of HTML on the server.

You could make a 10,000 loc app, and you wouldnt even have to serve up a line of it to run it (in realtime) with a browser.

EDIT: After looking through Flatiron/Plates, I'm really interested in seeing how I might be able to get them to work together.

comment 15y ago · link · parent

You are right, at first I did do it just to see if it was possible. I've been meaning to write in more detail about some of the implications, clean up some of the code, etc. I've also experimented with the API to feel out how it could work with other client side stuff in an isomorphic way, url routes, and other frameworks (https://gist.github.com/1336381), but havent released any of that.

comment 15y ago · link · parent

Speaking of backend DOM awareness, have you seen this? https://github.com/tblobaum/nodeQuery

comment 15y ago · link · parent

It is not "Google etc., multi-billion dollar corporations" it is just Google.

comment 15y ago · link · parent

What has kept me from using this is the lack of media-queries. After investigating the gh repo it looks like there is a 2.0 branch with a responsive design already being built. I'm not sure what keeps them from releasing it but it appears to work.

https://github.com/twitter/bootstrap/blob/2.0-wip/docs/index...

comment 15y ago · link · parent

This is especially true with toolkits/frameworks written in node.js. I wrote a server side version of jQuery in node.js, called nQuery, that changes the DOM paradigm by allowing you to access the DOM in real-time from the server with RPC via the $(). It turns the DOM paradigm into something quite different.

Note: Still a WIP.

https://github.com/tblobaum/nodeQuery

comment 15y ago · link · parent

Link on MDN https://developer.mozilla.org/en-US/demos/detail/plan-b-retr...

166.

What you can do without js these days(developer.mozilla.org ↗)

2 points · by funthree · 15y ago · 1 comment

comment 15y ago · link · parent

The article is actually written by a woman.

168.

Mongoose 2.0 is ready just in time for Node Knockout(mongoosejs.com ↗)

9 points · by funthree · 15y ago · 1 comment

comment 15y ago · link · parent

There is at least two cases that this doesnt explain.

http://twitter.com/#!/jonathanscard/status/10034195955777536...

http://twitter.com/#!/jonathanscard/status/10035604975584460...

edit: now at least 5, see above

comment 15y ago · link · parent

Do you mind releasing the transaction data available? The card went from $100 to $0 within moments a number of times.

comment 15y ago · link · parent

I wonder what data you could get from reading the actual barcode? Would the CSC be in there?

Edit: I just checked with an online barcode reader and this isnt the case. It resolves to 6061006913522430

comment 15y ago · link · parent

Aha, you are right. I will edit that. Any ideas?

comment 15y ago · link · parent

I think someone could have bought a SBux card with it. Looks like it has happened at least a few times now all within less than a minute or two of the balance being there. An employee or someone camping a store, perhaps... Is it possible to use the number to buy a card off their website online?

comment 15y ago · link · parent

You deserve upvotes (and I upvoted you) but someone just nabbed that entire $100 off the card within a few moments of it being there...

comment 15y ago · link · parent

Potentially abusive use shown in these tweets.

http://twitter.com/#!/jonathanscard/status/10034749918897766...

http://twitter.com/#!/jonathanscard/status/10034674284272844...

http://twitter.com/#!/jonathanscard/status/10034195955777536...

Edit: Any ideas?

Edit: It just happened again...

http://twitter.com/#!/jonathanscard/status/10035604975584460...

Edit: More...

http://twitter.com/#!/jonathanscard/status/10036286052539596...

http://twitter.com/#!/jonathanscard/status/10036486417377689...

http://twitter.com/#!/jonathanscard/status/10036536246547660...

176.

Half of European Men Share King Tut's DNA(reuters.com ↗)

1 points · by funthree · 15y ago · discuss

comment 15y ago · link · parent

SEEKING WORK.

Remote contractor accepting work in node.js. Contact info and more about me here http://blobaum.com/

1
56789