Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions

Submissions

comment 12y ago · link · parent

I don't like using var in that way, because it seems like you're declaring two distinct variables. In your example, I'd much prefer:

   function make_dot_product(dim) {
      var dot;
      if (dim === 3) {
         dot = function(a, b) {
            return a.x * b.x + a.y * b.y + a.z * b.z;
         };
      } else if (dim === 2) {
         dot = function(a, b) {
            return a.x * b.x + a.y * b.y;
         };
      }

      return dot;
   }
This also makes it clearer what happens if neither dim is neither 2 nor 3.

comment 12y ago · link · parent

Just one point:

> (3) Many psychics propose all humans radiate quasi-electromagnetic energy, and their power comes from consciously directing it. Randi could therefore be unintentionally interfering.

If they really believe that's the case, then they should make a different million dollar claim: that they can remotely detect Randi's presence or absence in the monitoring room by observing whether or not their psychic powers are currently working. It's very easy to imagine a test protocol for that.

Of course, one can invent an even more elaborate effect that would explain why that test also wouldn't work, and then I can design a test for this new idea, ad infinitum.

comment 12y ago · link · parent

> There is something faulty with that proof, or rather it proves something other than what it is assumed to, but Kolmogorov complexity itself is still valid.

Well, Kolmogorov complexity depends on language choice, there's no way around that and the invariance theorem doesn't say anything different. It's more subtle than that, so we have to be precise.

The invariance theorem shows that given languages L and M, there's a constant c such that for any string x, |K_L(x) - K_M(x)| <= c. Intuitively, that constant c is the program size of an M interpreter in L (or vice versa). It's easy to see how K_L(x) can't be larger than <an M interpreter in L> plus <the shortest M program that outputs x>.

What this means is that given sufficiently large and complex strings x, K_L(x) is very close to K_M(x), because c is constant and finite, while you can construct a string x with arbitrarily large K_L(x). This gives us confidence that K_L measures something "real", even though our measurement is relative to the (arbitrary) definition of L.

Of course, for short programs, the constant factors dominate. You won't get a shorter Ruby program for your 30 character string by implementing a full Perl interpreter. In this case, the constant difference c is so large relative to |x| that the invariance theorem, while technically correct, is basically pointless.

comment 12y ago · link · parent

An analogy: there are multiple calendar systems in widespread use. Each one of those defines a different year 0. In fact, how I define time 0 is completely arbitrary, so that for any given moment in time, I can define a calendar system that defines this moment to be exactly 00:00:00 on day 1 of year 0 in my new calendar system. From this fact, using the logic of the article, I can show that any moment is time 0 (in some calendar), and thus measuring time is completely pointless!

comment 12y ago · link · parent

I think it's entirely possible to write readable code, i.e. code that you don't have to single-step through to understand. But that takes a conscious effort, and is in any case more difficult and more work than writing code that is merely correct.

comment 12y ago · link · parent

Being pedantic: it's NOT semicolon insertion. Your actual point is correct, the {} is an empty block statement, and the +[] is a separate expression statement. It's equivalent to "{} 0".

However, semicolon insertion is only triggered when there's a newline at a position where there would otherwise be a syntax error. Here, neither is the case: blocks don't have to be terminated by semicolon (so no syntax error), and there's no newline in the source code!

comment 12y ago · link · parent

The "well prepared" part makes me wonder. What kind of infrastructure would you need to handle google.com's traffic? I don't think any of the cloud providers can scale up to that kind of traffic out of the box, and it's not like someone can just build and staff a dozen data centers in preparation of this hijack attempt.

comment 12y ago · link · parent

> I think most haskellers agree that laziness complicates things more often than not, and if we could start over we wouldn't make Haskell lazy by default.

Following Haskell's evolution somewhat from the outside, this is surprising. (And also somewhat disappointing, as laziness always seemed an important part of Haskell's elegance.) Is laziness now considered something of a failed experiment?

comment 12y ago · link · parent

What's interesting to me, and we've seen this with WhatsApp only a few weeks ago, is that being acquired by Facebook seems to destroy the public image of a product.

Positive public perception has value, and can (at least in theory) be measured in dollars. In accounting terminology, it's part of what's usually called a company's "goodwill".

If Facebook continues to so negatively effect the public's opinion of every company it acquires, this means that Facebook might get a lot less out of those acquisitions than they might have hoped.

comment 12y ago · link · parent

This is the part that stuck out for me as well. They quite plainly state that they knew this would alienate their existing audience, and that they were perfectly fine with that.

comment 12y ago · link · parent

Well, the signature itself can't be signed (obviously). But that's not a problem for many other uses of cryptographic signatures, there's something about the Bitcoin protocol that makes this an issue, and I'm trying to understand what that is.

Why is there any choice in how the signature is encoded? Why is there some sort of "script" (I'm not sure I understand this part) that's important enough to be hashed, but not important enough to be signed? This looks like a very deliberate design decision.

comment 12y ago · link · parent

This post explains the how very well. Now I wonder about the why.

Why is there extra data that's part of the transaction hash, but not part of the cryptographic signature? (This fact seems to be the source of the problem.)

This is probably not by accident, so what does this design accomplish? Why isn't every bit of the transaction signed?

comment 12y ago · link · parent

If ReactOS were "ready" right now (i.e., could run 99% of all Windows 7 software unmodified), with all the bad press that Windows 8 gets, it might even have a chance to steal some market share. However, I don't think they can catch up before Microsoft manages to release another "good" version of Windows, and then the game of catch-up will start again.

I hope I'm wrong. I'd really like to see this succeed.

comment 12y ago · link · parent

It's what's called a "dark pattern": purposefully designing the user interface to make it hard for users to do what they want to do, and easy to do the thing you want them to do.

It's cases like these that make me think there should be an ethics code for software developers.

comment 12y ago · link · parent

> The Grep Test

I fail to see the point of this criterion. Even when you implement the client code yourself, you'd surely not copy&paste identical HTTP calls everywhere just so you can search for them. You'd use some form of encapsulation (modules, classes, subroutines). And those calls are just as hard (or just as easy) to grep for as calls to an external library.

comment 12y ago · link · parent

Displaying a 3D image in a 2D space also requires sacrifices. Obviously to a lesser extent, because you only lose one dimension, but the principles are the same. Reconstructing a 3D scene from photographs is an insanely tricky problem, and it only looks simple to us because our brains have specialized circuits for that task.

comment 12y ago · link · parent

I didn't mean that the AGPL gives any specific person control of your server. What I meant is that you're forced (by the license) to configure your server in such a way that you "prominently" (exact word from the license) offer a way to download the source.

In essence, the way I understand it: Say you're running your homepage on "GNUpache", a hypothetical AGPL Apache clone. Then you must have a "download source" button somewhere on your homepage. (This button might point to the official distribution if the version you're running is entirely unpatched and only uses standard plugins. If you have any custom plugin, for example to integrate with your in-house authentication server, you must offer the code for that plugin as well.)

You might disagree on whether that violates your freedoms. But note that previously (with the standard GPL, and also standard copyright law), you were not even required to advertise what kind of webserver you're running.

comment 12y ago · link · parent

> I'm not sure why that use-case wasn't included in the original GPL, come to think of it. My guess is just that it wasn't in practice possible to do what Stallman objected to at a large scale, given technology of the day.

Stallman isn't exactly known for letting practicality and feasibility compromise his ideals. Given that, as you said, the usecase was widespread when the FSF was founded, I consider it much more likely that he considered this case and didn't include it on purpose.

However, if you or anyone else has a good (older) quote from RMS on whether he considers it evil to connect your free browser to a proprietary HTTP server, I'd be very interested to see it.

The only thing I could find (actually rather recent, 2010's The JavaScript Trap [1]) only argues that a free browser shouldn't run proprietary JavaScript on your own computer, because that would violate your software freedom. It says nothing to suggest that the HTTP download of data from a proprietary server is considered a problem.

[1] https://www.gnu.org/philosophy/javascript-trap.html

comment 12y ago · link · parent

The FSF's FAQ on the Affero GPL explains it best: http://www.gnu.org/licenses/why-affero-gpl.html

Quote: If some program on this server is released under the GNU Affero GPL, the server is required to offer the users the corresponding source of that program.

comment 12y ago · link · parent

I'm still quite convinced by the idea of software freedom, as explained in Stallman's earlier writings: https://www.gnu.org/philosophy/free-sw.html

Having said that, I find Stallman's war rhetoric increasingly disturbing:

> The only code that helps us and not our adversaries is copylefted code. Free software released under a pushover license is available for us to use, but available to our adversaries just as well.

This is the language of war propaganda, and shouldn't have any place in rational discussions.

> If that enables GCC to "win", the victory would be hollow, because it would not be a victory for what really matters: users' freedom.

All while endorsing the Affero GPL, a license that doesn't even allow users full control over their own servers.

Maybe if someone is that convinced of a cause, the ends seem to justify every means. I'm not sure what's going on at the FSF, but it seems that they've lost sight of some of their original principles.

comment 12y ago · link · parent

I'm stupid. Of course, thanks.

comment 12y ago · link · parent

It's partly a question of definitions. There's an astrological phenomenon that occurs when large masses collapse, and we believe there is one of those at the center of the Milky Way. This exists in nature, we just haven't definitely figured out how they work yet. We currently call those "black holes". If a new theory suggests that these holes are not so black, but really rather "grey holes" or something, we might adopt a new word for those things, or we might change our definition of black hole to match the current theory.

comment 12y ago · link · parent

Is it easier to think about point masses held together by invisible springs? The point masses being atoms, and the springs being electric fields. Not a perfect analogy, but it should work to visualize a lot of the macroscopic effects of gravity.

BTW, it's not hard to convince yourself that masses and springs in a centrifuge behave exactly like those near a large body. (In Newtonian mechanics even.) How are you sure you know the difference?

comment 12y ago · link · parent

To state that point in another way, the key here is time dilation. (Please correct me if that's wrong.) Let's assume that your feet send a periodic signal to the brain, a "tingling" that let's you know your feet are still there. As your feet approach the event horizon, the tingling will get slower and slower, because time passes much faster for your head than for your feet. As your feet pass the event horizon, the tingling has become infinitely slow (relative to your head). But there's no sharp line where suddenly something happens as your feet touch the event horizon. (All of this of course only in principle and under the premise that you're not smashed to bits at that point.)

comment 12y ago · link · parent

I think we can all agree that what's happening with bananas is not a healthy state of affairs. I was just trying to clarify that asexual reproduction doesn't exclude natural selection, and was using bacteria as an (admittedly not perfect) analogy.

I guess if you had simply said that there's virtually no selection pressure, you wouldn't have triggered my nitpick reaction. :)

comment 12y ago · link · parent

I was replying specifically to "since bananas are clones, there's nothing for the selection pressure to act on." That's not correct reasoning, since the DNA in plant clones can mutate, and thus, plant clones are susceptible to selection pressure.

comment 12y ago · link · parent

Not quite true, if I understand you correctly. Clones are a form of asexual reproduction, not that different in principle from what is observed in bacteria. So plant clones do undergo mutation and natural selection.

comment 12y ago · link · parent

I'm only arguing about naming conventions here -- I probably wasn't clear enough about that. I know what the IO type constructor does. My point was merely that if no one ever says "getChar is an IO", then maybe its type shouldn't be called IO.

For all of Haskell's beautiful concepts, it does have some flaws. I think that overly cute (and, as I explained, sometimes inconsistent) names are one of them, because that's at often odds with readability. Haskell's identifiers are not Perl-level bad, but they are not shining examples of clarity either.

I hope I didn't offend you with this. I don't actually think we'd disagree much if we had discussed this face-to-face.

1
464748
51