If you're a node.js user, install the command line JSON pretty printer `sudo npm install -g json` and then you can do this:
`curl -s random-inc5000.herokuapp.com | json`
232 karma · joined November 19, 2010
If you're a node.js user, install the command line JSON pretty printer `sudo npm install -g json` and then you can do this:
`curl -s random-inc5000.herokuapp.com | json`
At one stage I had the same train of thought that you have (http://chris6f.com/synchronous-nodejs / https://github.com/chriso/synchronous/blob/master/lib/protot...) - it would be nice to have the option of fibers, but it's not going to happen.
IMO async code isn't as difficult or ugly as you make it out to be. Is async code as easy to write and follow as sync code? No. Is it worth the benefits I've mentioned? For me, yes.
You obviously haven't written a lot of async code so not sure why you're so against the idea.
There are plenty of async idioms that make callbacks a breeze.
..although it's not run by Google.
Maybe they'll end up getting gpl.us
See klein (https://github.com/chriso/klein.php) for a real PHP express port..
Redback gives you the same power/flexibility but hides the complexity. You call `hash = redback.createHash(hash_key)` and then call something like `hash.set({key1:value1, key2: value2});`
It's more than just convenience though. I had a few goals with the library:
- Make Redis more accessible
- Create some useful derivative/hybrid structures (SocialGraph, etc.)
- Expose useful atomic constructs such as auto-incrementing keys
- Make it as easy as possible for users to create their own structures (e.g. see the Queue example in the README)
jsdom: 1
external_resources: 1
Watch this space: https://github.com/chriso/node.io/blob/master/lib/node.io/do...1. JS selectors make scraping _very_ easy.
2. Asynchronous is fast as it is, but the page is actually parsed as it's received - contrast this with other scraping solutions where you need to download a page and parse it once it's complete.
3. With asynchronous scraping it's trivial to handle failures, timeouts, retries, nested requests, recursing similar URLs, concurrent requests, etc. - just add one of the many options (https://github.com/chriso/node.io/wiki/API---Job-Options)
The main thing I'd like to point out is that I built it primarily as a command line tool. "By implementing an input method there’s no way to specify a search term from the command line" - so leave/comment the input method out! The default input method is to read lines from STDIN, just like the default output method is to write to STDOUT
Try commenting out the input line on that google example and running it with a list of words in a file:
node.io google_keywords < input.txt
Or you could feed the results in to another node.io job: cat input.txt | node.io google_keywords | node.io someotherjobSure, you could do the same thing with other frameworks, but most of the other frameworks are full of bloat and not particularly fast. I think it's better to have a few components that do one thing really well rather than a monolithic framework that tries to handle every aspect.