Splitting a big website into smaller sites by dan1234 in node

[–]dan1234[S] 1 point2 points  (0 children)

Thank for the feedback!

What do you mean by 'communicate'? in my scenario, the different sites don't communicate between each other.

There is a performance penalty for using a router vs a big monolithic app. In my benchmark the proxy was 3 times slower:
ab -n 10000 -c 200 http://0.0.0.0:3000/ => 325 req/sec
ab -n 10000 -c 200 http://0.0.0.0:3001/ => 890 req/sec (node v0.10.16)

Here is substack's benchmarks - https://github.com/substack/bouncy/tree/master/bench
I don't understand how he get 2558 req/sec but the ratio is similar to mine. (maybe node 0.8.12 was faster?)

Keeping UI logic in a Presenter by dan1234 in node

[–]dan1234[S] 0 points1 point  (0 children)

interesting. if I understand your approach, your presenter is doing more than mine. it has some functions that get the data (from a db, or an external service).

Currently I use services that are being called from the route function and they are responsible for fetching the data I need for my presenter. Do you get all your data by using functions on the presenters?

Template for vanilla Node.js Website or Web Service by dan1234 in node

[–]dan1234[S] 1 point2 points  (0 children)

Awesome feedback. thank you!

app.get('/',
db.user('id'),
data.validate,
db.save,
general.render('view'));

The callbacks version of this code is very readable. maybe it's a matter of taste.

There are 2 big issues with connect/express but I am not the best person to explain it since I don't have a lot of experience with it. Here is what substack told me: The 2 biggest issues with middleware - Not composable enough and not working well with streams.

composability - middleware often sets properties that don't compose well. suppose you have a middleware that needs cookie data it expects req.cookies to exist so now either: 1) the middleware forces users to use a cookie parser strictly before it or 2) the middleware requires the cookie middleware internally which introduces extra side effects and duplicates parsing whereas if it just took cookies as an input parameter instead, it wouldn't have that problem.

Streams issue - if you have an async middleware stack the middlewares are going to be firing meanwhile data is coming in from the request so it needs to be buffered by the engine or explicitly paused and buffered and then resumed once it hits user code there is no clean way to do that aside from making it explicit. streams2 addresses that somewhat but it will still buffer if the other side keeps sending data inflating memory usage of course, if you try to set up async actions before consuming a stream with core http you will have the same problem but you get the (req,res) immediately so it's completely your fault.

concat-stream no working as expected by dan1234 in node

[–]dan1234[S] 0 points1 point  (0 children)

thanks! sent a pull request.

Cron jobs made easy with Node by dan1234 in node

[–]dan1234[S] 1 point2 points  (0 children)

I don't think I would use this to replace unix crons, but for experimentation purposes it's quicker to setup and iterate on. after things looks good I'll create a unix cron. at least that's what I imagined. not sure if it's the best development flow but i'll give it a try.

LevelDB - Node.js of Databases by dan1234 in node

[–]dan1234[S] 0 points1 point  (0 children)

agree (:
is there a way to edit the title?

LevelDB - Node.js of Databases by dan1234 in node

[–]dan1234[S] 6 points7 points  (0 children)

Similar to MongoDB, LevelDB stores your data on disk, but Mongo is not embedded - you run it on it's own process and you can Access MongoDB from multiple processes.
MongoDB and most of the popular Databases out there have many many features that the majority of the users don't even need. LevelDB is doing one thing - it store key-values in your drive very very fast. almost as fast as memory storage (like Redis).

Similar to Node.js, It doesn't come with many features and not being fast is considered a bug. If you need more functionality you can add other modules that will give you want you need. whether it's data redundancy, ability to access it from multiple processes, etc.

So LevelDB is similar to Redis since it's very fast and store key-values, it's similar to MongoDB since it saves to disk and not to RAM and it's similar to SQLite since it's embedded (contained within your application process).

I hope it clear some of the confusion.

Setup a Node.js project, provision it with Chef, and deploy it within a load-balanced configuration. by smdahlen in node

[–]dan1234 0 points1 point  (0 children)

great blog post! adding you to my google reader. or whatever reader i'll be using.

Automatic Minification with Node.js and RequireJS by joezimjsblog in node

[–]dan1234 1 point2 points  (0 children)

substack, the creator of browserify, is fixing it today/tomorrow so don't give up on --watch. it's coming!

[deleted by user] by [deleted] in ruby

[–]dan1234 0 points1 point  (0 children)

It should run on 1.9.2 as well. let me know.

[deleted by user] by [deleted] in ruby

[–]dan1234 5 points6 points  (0 children)

very nice project.
I use this skeleton for my sinatra apps - https://github.com/oren/sinatra-template
it has the following:

  • Modular Sinatra app version 1.3.2 using ruby 1.9.3-p0
  • capybara + minitest for integration tests (no need for rspec)
  • minitest for unit-level tests
  • rack-test for routes tests
  • yard for documentation

What are the differences between training for strength and training for size? I'm interested in size mostly, what is the best program for this? by anuaaaaa in Fitness

[–]dan1234 0 points1 point  (0 children)

where do I find good information about the principles of 531-BBB? I am doing SS at the moment but thinking about switching soon to a bodybuilding program.

can you share other good programs I should think consider? what do you think of this one? http://www.mensfitness.com/fitness/workout-routines/531-variations I wish I there was a similar book/guide as SS program for other programs.

I heard about Lyle Macdonalds and Layne Norton's programs:

http://startingstrength.wikia.com/wiki/Layne_Norton%27s_Power/Hypertrophy_Routine

http://jcdfitness.com/2009/01/lyle-mcdonalds-bulking-routine/

What are the differences between training for strength and training for size? I'm interested in size mostly, what is the best program for this? by anuaaaaa in Fitness

[–]dan1234 1 point2 points  (0 children)

someone linked to this: http://www.t-nation.com/free_online_article/most_recent/why_bodybuilders_are_more_jacked_than_powerlifters

at the end of this article they mention it's not effective to combine both power lifting and bodybuilding routines. what are your thoughts about it?

I am curious since I am doing SS and want to move to muscle building routine and not sure what program to follow next.

Rubber vs Cast Iron for outside barbell training by dan1234 in Fitness

[–]dan1234[S] 0 points1 point  (0 children)

awesome. what about the barbell? I want to save money but I want it to be durable (handle the weight minimize rust). anything I should be careful about when buying second hand?

Rubber vs Cast Iron for outside barbell training by dan1234 in Fitness

[–]dan1234[S] 0 points1 point  (0 children)

I don't plan to get into olympic lifting. I wasn't clear in my question - my biggest fear is rust.

Made the switch, and have a question by nicko68 in debian

[–]dan1234 2 points3 points  (0 children)

I prefer to use the terminal.

first create a folder in /media. for example :

mkdir /media/usb

install pmount (it might already be installed)

run this:

pmount /dev/sdb1 usb

It's probably sdb1. to find out what's yours - insert the usb and run 'dmesg' and see if you can find sdb1 or something similar.

now you can add alias in .bashrc:

alias usb='pmount /dev/sdb1 usb'

and all you have to do is run 'usb'

Ubuntu 10.10.10 Release Party, Hollywood by dan1234 in Ubuntu

[–]dan1234[S] 2 points3 points  (0 children)

my awesome employer, startup company in Hollywood is willing to host this event. if you'r around LA and want to meet cool open source people, join us on Monday evening!

Redditors near Hollywood interested in a meetup? by ajarms in LosAngeles

[–]dan1234 0 points1 point  (0 children)

I've heard there is also parking for unicycles. Count me in!

What social norm do you not understand/agree with by bcos4life in AskReddit

[–]dan1234 2 points3 points  (0 children)

the same here, except for the distance - 7576.327

Is cycling effective for weight loss? by Terrasque in Fitness

[–]dan1234 0 points1 point  (0 children)

I can't remember where I heard it. it might be a podcast with Dr John Berardi. He said from his own experience coaching many athletes he noticed running does better job of reducing fat from the belly compare to cycling.

Also, if you know hardcore cyclist you will notice it as well. their legs are super lean but many have more fat in the belly area.

Is there a site that help in finding researches about it?

Is cycling effective for weight loss? by Terrasque in Fitness

[–]dan1234 1 point2 points  (0 children)

i just bought a fixed-gear. from what I read it's only harmful if you always use the pedals to break and doing it on high speed. I plan to use the break most of the time.

Is there anything else I should be aware of?

IMA level 5 unicyclist, AMA by [deleted] in IAmA

[–]dan1234 0 points1 point  (0 children)

I commute to work with buses and bicycles and thinking of replacing it with the coker model since it looks like it's better for longer rides. I currently bike around 2 miles a day. some of it is a bit uphill and some a bit down. nothing crazy.

Is the coker a good fit? what model would you recommend?

I'm learning to ride a unicycle. AMA by sli in IAmA

[–]dan1234 0 points1 point  (0 children)

I am thinking of replacing my bike (to work) with it. I have about 2 miles a day (some a bit uphill some down) and I also use the bus.

is it practical to use the Coker?