Better HN
topnewbestaskshowjobs
Log inSign up

mag487

36 karma · joined Sep 7, 2011 (15y ago) · 17 submissions

Submissions

comment 12y ago · link · parent

That code is doing a lot more than just layout and styling.

comment 12y ago · link · parent

It may be a useful sanity check to simulate the experiment multiple times to see the result:

  def choose_coin
    rand < 0.001 ? 1 : 0.5
  end
   
  def flip_coin(coin)
    rand < coin ? :heads : :tails
  end
   
  def all_10_heads?(coin)
    10.times { return false if flip_coin(coin) == :tails }
    true
  end
   
  next_flip = { :heads => 0, :tails => 0 }
   
  1000000.times do
    coin = choose_coin
    next unless all_10_heads? coin
    next_flip[flip_coin(coin)] += 1
  end
   
  puts next_flip[:heads].to_f / (next_flip[:heads] + next_flip[:tails])

comment 13y ago · link · parent

It's hard to imagine that even those could total more than a small fraction of the purported 500 MLOC. The JDK is only a few million lines of code.

comment 13y ago · link · parent

I'm having a really hard time believing that figure.

comment 13y ago · link · parent

Why would having multiple cores make the event loop cycle faster? Maybe I misunderstood and he was using "Moore's law" to refer to exponential increase in processor speed rather than transistor density (which is what I understand Moore's law to be talking about). But commercial processors aren't really getting much faster anymore.

comment 13y ago · link · parent

Yes, but that doesn't give you a great way to deal with attaching and canceling multiple callbacks simultaneously. If you want to perform several independent asynchronous actions after some other operation finishes, you have to collect them into a single giant callback in one location. And as you mention, the function has to keep track of some piece of mutable state in order to decide whether it's cancelled or not before firing off those operations. So why not give the function a mutable array of asynchronous operations to perform to begin with, which you can then add to at any time? And at that point, you already have a something very close to a promise.

comment 13y ago · link · parent

That's a really good point. I hadn't been completely sold on the value of promises over callbacks before, but this seems like a very unambiguous advantage. I can't think of an obvious, clean way to do this with callbacks that doesn't go a long way toward simply re-implementing promises.

I imagine an advocate of core.async would argue that they have a good analog for canceled promises, though, namely closing channels. On the other hand, closed channels will still yield nil when read from; the procedures trying to read from a closed channel would need to check for that.

comment 13y ago · link · parent

How's that? JS is single-threaded.

comment 13y ago · link · parent

I haven't really studied algorithmic information theory, but I'd assume that Kolmogorov complexity isn't defined for uncomputable/undefinable numbers. Or maybe it's defined as "infinite," but either way, my guess is that such numbers are simply ignored. (Interestingly, the function which takes a computable number and outputs its Kolmogorov complexity is itself uncomputable!)

comment 13y ago · link · parent

There's only a countable number of formulas of ZFC. Therefore, there's only a countable number ways of writing out a formula of ZFC that uniquely specifies a real number. Therefore, only countably many real numbers exist that have such definitions. And all countable sets of reals have zero Lebesgue measure.

comment 13y ago · link · parent

The key phrases there are "almost surely" and "most irrational numbers." There are irrational numbers like pi which can be defined algorithmically, but taken together as a set they have zero Lebesgue measure. (In fact, they're countable.)

12.

The Classic Buffer Overflow Attack(blog.8thlight.com ↗)

2 points · by mag487 · 14y ago · discuss

comment 14y ago · link · parent

I wouldn't include their pricing structure as part of their marketing, though it doubtless attracts many users. (So do their algorithms, but those aren't included in their marketing, either.) And insofar as they have a reputation for giving away their services for free, that's a part of their heroic image.

comment 14y ago · link · parent

It's an awesome motto that's served them extremely well. Google's ability to frame themselves as the "good guys" is the only real marketing advantage they have.

comment 14y ago · link · parent

I don't see how he's being scapegoated. What failure is he being held personally responsible for?

comment 14y ago · link · parent

Not trying to defend the viability of FB ads here, but this analysis seems a little shallow. Falling within a certain demographic may not "make" you click an ad, but the same could be said of performing a search on Google. If circumstance Y makes one want to buy a product, then as long as falling within demographic X is correlated with being in Y, targeting X could be a good idea. It is (obviously) the reason why toy commercials air during children's shows and not during basketball games.

comment 14y ago · link · parent

I agree with the author that getting a ridiculously generous counter offer is a red flag about the company's management, and this alone constitutes a reason to reject the proposal. However, his moral indignation at the thought of being paid more to defer work on an activity he cares more about is misplaced. It's silly to frame the negotiation as the company intentionally trying to "buy off his dreams." Most people have a variety of "dreams," many of which can be better achieved by having more money. As far as the company knows, doubling the author's salary could let him achieve the alternate dreams of getting out of debt or buying the house he's always wanted.