HNHacker News
TopNewBestAskShowJobs

porphyry3

32 karma · joined April 8, 2013

submissionscomments
porphyry3··on Booting Modern Intel CPUs
> ...reprograms the CPU into a sensible mode (ie, one without all this segmentation bullshit)...

Protected mode still has segmentation except that segment registers now index into either a global or local descriptor table (DT). Linux tries to make this transparent by setting up descriptors where logical addresses coincide with linear addresses (at least for CS and DS).

porphyry3··on Managing Node.js Callback Hell with Promises, Generators and Other Approaches
There is another nice feature of ES6 that helps a lot with callbacks and promises: proxies. Check out this article I wrote on Flippin Awesome (http://flippinawesome.org/2013/11/18/taming-asynchronous-jav...). The following is some sample code to show how code can be simplified with ES6 proxies, making async functions chainable (example in coffeescript):

    getUser = (user) ->
        _("https://npmjs.org/~#{user}")
          .get()
          .extractLinks()
          .filter( -> /package/.test(arguments[0]) )
          .map( -> "https://npmjs.org#{arguments[0]}" )
          .log()
    
    getUser("foo")
where `get` is THE jQuery get for Ajax requests returning a promise and is chained with the rest of the functions in a pipeline fashion. I've found that these techniques can work very well for form validation, as [you can check here](http://www.vittoriozaccaria.net/chained/demo.html) — Firefox required.

Edit: I wrote in markdown but it seems that only verbatim is supported. Edit2: some clarification