Tests for programmers Part IV: comparing routines - <AUTHOR> http://www.solipsys.co.uk/Writings/TestsForProgrammers_Part_4.html

<comment><USER3> I think there are some implications for copyright-on-code from all this analysis, it is surprising given the simplicity of the problem that there are so many unique ways to solve it.

This contradicts the statement that 'given an adequate spec two competent programmers will solve a problem in the same way except for stylistic differences'.

I've seen that tossed around quite a few times and if it doesn't hold water for such a simple problem it certainly won't be left standing if we start analyzing larger pieces of code.

On the whole I think this research is one of the most interesting things on HN as of late.

<comment><USER4> Yes, probably. But it also seems to depend on the level of your language. I.e. if your language's built-ins are close to the problem, the solutions will probably be much shorter and thus have a higher chance of being similar.

<comment><USER5> Actually, C's string handling is _very_ well-suited to this problem. (Which doesn't mean it is perfect - in fact, it's highly inconvenient for many tasks. Just not this one.)

<comment><USER4> Yes, it is. But C's other nuts and bolts are so low level that they introduce lots of variability.

In e.g. Haskell everyone would just do

      condense_by_removing :: Char -> String -> String
      condense_by_removing c = filter (/=c)

Because there's much less going on here--the loop being more or less implicit only--there's less room for variations.

Mind you, Haskell programs also show lots of variability if the tasks gets only slightly more complicated.

<comment><USER6> The Haskell snippet doesn't remove the character _in place_ though, does it? I imagine solutions would be more varied then.

<comment><USER7> No. "In place" has virtually no meaning in Haskell.

I find this very interesting -- a popular idiom in one language can't even be represented in another.

<comment><USER8> One of the biggest reservations I initially had about abstraction, when learning programming, was that I didn't consider performance a detail. As such, I didn't litter my code with objects or pure functions even when they made conceptual sense, unless I was convinced the overhead was small and the abstraction helpful.

I've found that languages like Java make assumptions about your memory, and languages like Prolog make assumptions about your data. I'm under the impression that in Haskell in-place modification is an interpreter optimization, whereas C is increasingly employed when resources are constrained and abstraction layers are deemed too costly. Consequently, C is maligned for resulting in faulty implementations behind every corner, yet it remains one of the most used languages.

<comment><USER4> The Haskell compiler is free to use in-place mutations, when it can prove that nobody can access the old object any longer.

The language Clean supports this notion explicitly in its type system (and uses it for IO, instead of, say, Monads like Haskell).

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER9> Wouldn't it be better to build a parse tree and then cluster based on the difference between the trees? I think this is called "tree distance", or sometimes "tree edit distance." There seems to be a reasonable amount of research on the subject.

<comment><AUTHOR> Much harder to do with the tools I have immediately to hand, and much harder to visualise the main results without special tools. The "fingerprint string" gives 90% of the effect with very little effort on my part.

However, I will investigate further the "tree edit distance" to see if I can bootstrap something quickly, just out of interest. Thanks for the reminder.

<comment><USER10> You should probably start with Brenda S Baker's work at Bell Labs: [http://www.cs.ucdavis.edu/~devanbu/teaching/289/Schedule_fil...](http://www.cs.ucdavis.edu/~devanbu/teaching/289/Schedule_files/baker- wcre95.pdf) references the final result.

Baker's alumni web page: <http://cm.bell-labs.com/cm/cs/who/bsb/index.html>

It's unfortunate that Baker's "dup" and "pdiff" haven't gotten the open source treatment, or at least if they have, they're not widespread. SCO could have saved themselves a lot of lawyer's fees by running "dup" over SysV and Linux sources to see what's similar.

</comment></comment></comment><comment><USER11> Pretty neat stuff. The method used for decimating representations is pretty awesome. Seeing the aligned routines makes me think that quite a few of the bioinformatics algorithms could be useful for such an analysis.

The two that spring to mind would are the MCL clustering algorithm that could be applied quite easily to the similarity matrix. As a more academic endeavor, it'd also be interesting to see what kinds of differences in similarity you'd get by applying Needleman-Wunsch.

<http://www.micans.org/mcl/> [http://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algori...](http://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm)

</comment><comment><USER12> Thanks for the explanation on your process for creating the clusters and the analysis. It cleared up a few questions I had.

What's interesting is the large clusters where either a for or while loop were used. I'm curious whether if given a (limited) choice any hiring manager would have a preference between the two implementations?

TLDR: How much does/would coding style influence the hiring process?

<comment><AUTHOR> That's something I'll be going into in the next stage - <USER2> identification. Some routines used for, some used while, some used do, and some used switch.

Yes, switch. Addmittedly not as the looping structure, but for the internal decision process of the loop.

Some of these choices are indicative that the programmer isn't a native idiomatic C programmer, but some might be genuine choices for one reason or another. That's when style choice exposes internal concepts.

More later. (On current work load - much later. It's taking about 2 weeks per article here, so it won't be quick. Sorry.)

<comment><USER12> That's fair enough. Are you still coming to the London meetup on Thursday?

<comment><USER4> Is it open for other hackers, too?

<comment><USER6> And where are these things advertised? I'd love to attend, but need a little bit more notice since I'd have to arrange a flight from Dublin and somewhere to stay for a night or two.

<comment><USER12> They're advertised as local posts here on HN. Here's the link: <http://news.ycombinator.com/item?id=1434964>

Sorry for the delay, hope I've given you enough time to sort out travel arrangements.

<comment><USER6> Well, I wouldn't have made it anyway, but I'll keep my eyes open for the next one. Maybe I'll be able to go then :)

</comment></comment></comment></comment></comment></comment></comment><comment><USER13> Just wondering, what's the solution to the riddle at the end? The test function sets up the input, calls the routine, and then compares its output to the desired output. There doesn't seem to be a place for error there.

<comment><USER5> See <http://www.joachimschipper.nl/posts/20100622/answer.txt>. (Hidden behind a hyperlink to not spoil the riddle.)

<comment><AUTHOR> I think I disagree with you. The input you mention is correctly handled by the routine you mention, and is tested correctly.

Certainly there is a bug other than the one you think you've found, and I don't think the circumstances you mention demonstrate a bug at all.

I would certainly be interested in seeing a more detailed analysis.

<comment><USER5> You're right, that answer isn't correct. I still think that particular input should be tested, though (you say it is - did you leave out that part of your testing program? It should be possible to construct a program that fails on such inputs.)

I don't think I've found a real "bug" yet. You include, but don't use, stdlib.h; you exit with status 0, even on error; but these are nitpicks, not what you mean. I'll think a bit more.

<comment><AUTHOR> I tested that case when you mentioned it. All routines submitted pass it correctly, so I haven't worried about it too much. To do so would be to stray too far from the original intention. I think it's hard to write a natural looking routine that fails that test.

I return 0 in all cases because my test succeeds, even if the routine it's testing fails. It's up to my shell to decide what to do about that error. As it stands it reports the error, but it has succeeded in doing so, so it hasn't failed.

But that's not the point, as you say.

And the real bug is still there.

<comment><USER5> Well, I'm stumped. I can think of some other "cosmetic" issues and some things you fail to test (e.g. that the function is in-place, runs in O(strlen(z_terminated)) and does not access memory beyond z_terminated[strlen(z_terminated)]), but that's it. Besides, as you mention, such issues can usually be found just by looking at the function.

Will you give out the answer at some point?

<comment><AUTHOR> Yes - in the next part of the analysis.

</comment></comment></comment></comment></comment></comment></comment><comment><USER14> Interesting analysis so far.

Are we going to see some performance data?

While pure performance should not be the overriding consideration, it would still be interesting to see how everyone's routine stacked up.

I would hazard a guess that some dissimilar looking routines will have very similar performance.

Of course, in reality, all I am looking for is the confirmation that my code did not suck too badly...

<comment><AUTHOR> What's your routine ID and I'll give you my opinion - I will discuss performance later.

</comment></comment><comment><USER15> While I was trying to figure out why my submission ended up where it did...

I realized my code has a bug.

It's too late for a resubmission, isn't it? :(

<comment><USER5> I think _all_ solutions are used, anyway. And the submissions are anonymous for exactly this reason.</comment></comment>


Why Not Feed Maggots to Pets - <AUTHOR> https://www.sciencealert.com/worried-about-your-dog-s-carbon-foot-print-maybe-you-should-feed-them-insects <comment><USER2> the word "maggot" has a disgust factor to it, i think "larva" would be free of the stigma. as an example, wasp larvae apparantly taste like scrambled eggs, and with some scrambling and frying would pass as tasty for most people not knowing. i think there are some south american cultures that depend heavily on insect protien, as a personal experience there was this grad student from Ghana in the entomology lab that loved crickets. We had to dissuade him from eating supply house crickets as they are heuristically cultured and standardized thus expensive compared to petshop feeder crickets. Anoles love maggots, and they are easier on thier gut than mealworm larvae with thier hard plates [tegmata], birds take larvae readily, i think chickens would be a more aesthetic target for marketing than dogs and cats.

</comment><comment><USER3> This just won't fly until this (western) generation changes its ideas about eating bugs.</comment>


The case of vb.ly: NIC.ly was right to shut them down - <AUTHOR> http://dot-ly.of-cour.se/the-case-of-vb-ly/

<comment><USER2> It bugs me to see people using logic to predict how Libya will handle its registrar. I have zero sympathy for vb.ly, but, for what it's worth, I'm going to have zero sympathy for bit.ly if Libya shakes them down too. You're dealing with a company that has no rule of law. Caveat emptor.

<comment><USER3> Of course they have rule of law - _Libyan_ law.

<comment><USER2> Libyan law is whatever the ruling party says it is this instant.

<comment><USER4> As with many Islam/Muslim nations (not racism. a fact. i lived there).

<comment><USER5> And the point is, that doesn't qualify as "rule of law". "Rule of law" means, very specifically, that everyone is equal before the law. This is only possible when the law is somewhat fixed, explicit, and intelligible to the people affected. What they have there is more like Roman law - i.e. everyone is subject to the law unless the leader decides otherwise.

<http://en.wikipedia.org/wiki/Rule_of_law>

</comment></comment></comment></comment></comment><comment><USER6> Don't register a domain in a country whose law and regulations you don't want to follow. Country-specific domains were meant for exactly that, country- specific sites. Did they think there was no risk to doing business in a foreign country?

<comment><USER7> I am happy to follow the rules and regulations. Would you care to point out Libyan Law to me where I can read it?

 _(I bet you cant)_

<comment><USER6> I don't need to, that is why I added regulations. Is there a law that says the U.S. can detain an 'unlawful combatant' indefinitely? No. Did it happen? Yes. Doing business in a foreign country brings inherent risk. If you want to ignore risk because you don't see it written down on a piece of paper, then you won't make it far.

<comment><USER7> Um, my point was that the .ly domain regulations include that you must follow Libyan law, so technically even the domain regulations are not explicitly stated because Libyan law seems hard to track down.

</comment></comment></comment></comment><comment><USER8> I never doubted that NIC.ly was perfectly within their rights to shut down vb.ly. The concern is that they are also perfectly within their rights to shut down -any- other domain as well. Currently, they -say- they only shut this one down because it promoted itself as 'adult friendly'. (Not 'sex friendly', just 'adult friendly', which in the end probably means the same.)

How do we know that they won't suddenly decide that bit.ly is 'adult friendly' also? Or that failing to prevent sex sites is enough for dismissal?

They could change their terms at any time to say anything they want, too. There's no stopping that. Sites like bit.ly are -built- around the domain name. To change it is to destroy the business.

The previous blog posts have been correct in their concerns. It's something that needs to be considered when choosing a domain name.

<comment><USER9> I hate to say this, but this is true of any service. Facebook, Google, Twitter is within their right to change their respective term of service at any time, to enforce those terms of service at any time, and to even revoke the usage of a service to a user. I find that this would be specially true when the doing business with a foreign based company.

Another problem I have not seen anyone bring up, and the main reason I never bought fugg.ly, is Libya's Axis of Evil status. The United States can can potentially put an embargo restricting ownership to .ly domains.

</comment></comment><comment><USER10> So is it a porn site or is it a url shortener? I'm confused.

<comment><USER5> My understanding is, it's a url shortener that predominantly links to erotically charged destinations.

</comment></comment><comment><USER11> So glad you posted this. Something about the original story just seemed fishy.

<comment><USER12> Could you explain what about this explanation you find the least bit reassuring?

<comment><USER11> The NIC.ly statement shows a clear understanding of user generated content. VB was shut down because it's purpose is expressly against the TOS. Bit.ly is safe because it's purpose is clearly not.

Also, I've heard other cases of VB trolling for publicity and assumed that they weren't giving a complete explanation. For example, the initial reports from VB focused on the arbitrary nature of the decision, which I think is contradicted by NIC.ly contacting them beforehand.

<comment><USER7> _The NIC.ly statement shows a clear understanding of user generated content._

Can you help me out with that - cos I received the statement personally (I was a co-owner) and I'm not at all clear how this doesn't preclude user generated content.

Perhaps you'd like to highlight your other issues with what has happened here. If you think we're "trolling" for interest then consider the extent and fallout of what has happened from this - Mitt Romney has removed his Mitt.ly shortener, this has been picked up by major news - we're not the only ones that are highly concerned.

Feel free to ask me here whatever you like about the situation here

<comment><USER11> I lost a lot of respect for Violet Blue in the dust up with Boing Boing.

<http://boingboing.net/2008/07/01/that-violet-blue-thi.html>

I don't see how Mitt's decision is evidence. It could just as easily mean that you've successfully created a scare story that was big enough to scare his tech team.

If there's a history here that doesn't involve you guys, I'd like to know it. But your involvement doesn't carry any credibility with me.

<comment><USER7> well, you've just slighted both Violet and kinda myself without any real substance or explanation - it comes across bit troll-ish to be honest.

It's a shame cos I quite like the Crowdvine product and being in that space I'd have thought you'd be more considerate of constructive + meaningful contribution to community discussion.

If you have something to add or ask on this original topic, vb.ly, I'm happy to participate and respond.</comment></comment></comment></comment></comment></comment>


Proof Without Words: Gregory's Theorem - <AUTHOR> https://divisbyzero.com/2018/09/28/proof-without-word-gregorys-theorem/ <comment><USER2> My favourite proof without words is the proof that the sum of the interior angles of any triangle is 180 degrees. Proof: draw an arbitrary triangle in chalk on the ground. Stand on one of the lines at one of the corners and note the direction you are facing. Now back up until you are at the corner of the triangle behind you. Rotate your self by shuffling inside the angle to the next line. Walk to the next corner, repeat. Walk (backwards this time) to the last corner, repeat. Now shuffle back to your starting position. You are facing exactly 180 degrees in the other direction!

Of course it is way better to just do this than write it down! But obviously I can't do it on HN.

<comment><USER3> Does that prove that every triangle has angles adding up to 180, or just that one?

<comment><USER4> "draw an arbitrary triangle" means this works with any triangle.

<comment><USER3> But you'd have to try an infinite number of triangles before you were convinced that it worked for all of them.

<comment><USER5> This is an interesting confusion.

OP said "draw an arbitrary triangle in chalk on the ground", and from there gave a set of instructions that showed you how to check that the interior angles of _that_ triangle added up to 180 degrees. You're right that that concrete set of instructions only proves it for that one triangle.

But that's not the whole proof. If I followed these instructions for a right triangle with angles 45,45,90, I'd only have proved that _that_ triangle's angles added up to 180 degrees.

The full proof is that if you _imagine_ doing this, for _any_ triangle, it's clear that it will always work. When I picture this in my head, it's clear that I'm going to end up having turned 180 degrees, regardless of the measurements of the triangle.

This leap: starting with a set of concrete instructions that you can do on a particular object, but then verifying that they would work no matter what object you started with, is common in proofs.

EDIT: Nevermind, totally unrelated.

<comment><USER3> Why is it clear that it will always work? It would be a proof if that part was written down. Since we all already know that the angles add up to 180, it might just be the intuition taught to us by another proof of the statement leaking backwards into the implicit step in this attempt at proving the statement. The part that's left off (the proof that it always works) is actually the bigger part of the contraption.

<comment><USER5> Because you end up back on the line you started at, facing in the opposite direction. That's a 180 degree turn.

<comment><USER3> Suppose I found a triangle whose internal angles added up to 190 degrees. If I did the experiment on it, I would end up 10 degrees away from where I was predicted to be. How can this scenario be ruled out?

<comment><USER5> Both of these things are true:

(i) Like you said, if you found a triangle whose internal angles added up to 190 degrees, and you followed the procedure, you would have turned 190 degrees, rather than 180 degrees. This is true because during the procedure, you turned three times, each by one of the angles of the triangle, so the total amount you turned was the sum of the angles.

(ii) You would end up back at the line you started with, facing in exactly the opposite direction. This is true because the last step of the instructions is to turn until you're facing in the direction of this line. Thus you have turned 180 degrees.

Now of course this is nonsense: you can't have turned 180 degrees, but also turned 190 degrees. How did we arrive at nonsense like this? The logic is sound, so it must have been one of the assumptions. Which assumption is questionable? Oh, right, the triangle whose angles added up to 190 degrees.

This is a proof by contradiction, that shows that a triangle whose angles add up to 190 degrees cannot exist.

<comment><USER3> Inside of that is the assumption that the sum of the inner angles that I rotate by as I walk around a closed loop is equal to the angle between my initial and final directions at the starting point, so that having turned 180 means that my feet have shuffled by a total of 180. That isn't true outside of Euclidean geometry, which indicates that its proof might not be as trivial as it seems.

<comment><USER5> Bah, I _almost_ talked about what would happen if you did this on a sphere. Yes, there is an assumption that rotations and translations are commutative and associative. We're so used to this that our intuitions sensibly hide it.

The fact that there are hidden assumptions doesn't invalidate the proof, though. There are _always_ hidden assumptions. Even if I give you formal axioms to reason with, you need a system in which to interpret those axioms.

<comment><USER3> Although I see the reasoning, I'm still not comfortable with the proof. It sounds to me like "plug something in to the Zeta function, observe that it isn't a nontrivial zero, conclude that there are no nontrivial zeros." Even if it seems completely intuitve to me I still wouldn't consider it proven.

<comment><USER5> Interesting. For me, there is no clear gap between intuitive proofs and formal proofs. Sure, intuition can lead you astray, but as you do mathematics, you develop your intuition so that you stop being intuitively certain of false things. Contrariwise, formal proofs are more likely to contain dumb algebraic errors, but as you do mathematics you learn to be exceedingly careful in your calculations.

But the wider point I want to make is that there's no gap between the two. _Real proofs aren't fully expanded._ If you've worked with a theorem prover like CoQ, it becomes painfully clear how many steps even the simplest proof skips. For example, the proof that the sqrt of 2 is irrational is really easy:

[https://www.math.utah.edu/~pa/math/q1.html](https://www.math.utah.edu/~pa/math/q1.html)

But look at how many steps this skips, if you want to get close to actual axioms and definitions:

\- You squared both sides of an equation. In this case, that's fine because you're only doing forward reasoning, but if you wanted to reason backwards you'd also have to check that both sides had the same sign to start.

\- You multiplied by q^2. That's only valid if q^2 is nonzero. Now intuitively we know that q^2 is nonzero, since q is nonzero. But it needs a proof.

\- You deduced that p was even from the fact that p^2 was even. How do you prove that? My first thought is to use the fundamental theorem of arithmetic. I don't know about you, but my intuition completely glossed over the fact that the proof that sqrt(2) is irrational made use of the fundamental theorem of arithmetic when I first read it. Either that, or there's another way to prove this; what is it?

Now, you could expand this proof to include all the steps. But we don't bother, because it's painstaking and not actually that likely to catch flaws in the proof, because we intuitively know these things. Likewise, I feel like the triangle proof is the same way: it skips over some things, but we intuitively know it's okay and you could expand it (to talk about commutativity of translation and rotation) but there's usually not much reason to bother.

Although it's a lot more obvious how to go about expanding the proof that sqrt(2) is irrational, I'll give you that.

<comment><USER3> There is an implicit, widely-held sense that the detail in proofs should scale with the expected training of the people who will be reading them. If your intended audience has internalized their field so well that the expansion and checking happens completely automatically and subconsciously, more power to them - but on the other end of the scale you have the proof that the square root of two is irrational, or this one about interior angles. Other than machine-aided proofs the most thoroughly expanded you ever see anything is in highschool geometry!

So, what justifies this scheme? I would say that once you have seen a technique used in full detail, you don't need to see the detail elsewhere because there's a meta-theorem in your head that applies to every case where things line up in a pattern where the technique works. Slowly this replaces your natural intuition.

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER6> I haven't previously come across the idea of trying to make wordless proofs. I guess this is the mathematical equivalent of code golf: a clever game for insiders to play, but basically the opposite of good practice from a readability perspective.

<comment><USER7> I didn't get this feeling from the proof in the article. I thought there was a kind of poetry to it. The diagram and colors make it reasonably easy to understand and they emphasize the geometrical nature of the proof, which uses only elementary math: the formula for the area of a triangle and Thales' theorem (If my memory is correct, I haven't used that name since high school!).

On the other hand, a "proof with words" would likely have derived the explicit formulas for I_n and C_n in order to prove the relationship and would have been much more clanky.

If I had to make a comparison, this felt like reading good functional code. Concise, a bit mysterious at first, but once you understand what it does you feel enlightened. (Vs eg. wading through for loops and index arithmetic, which also does the job but is more tedious to read)

<comment><USER3> I think it wasn't so much a proof as it was an image that made you realize the proof with some thought. Still, that's about what all published proofs are in the end, isn't it?

</comment></comment></comment><comment><USER8> Here is another proof without words for the Pythagorean Theorem: [https://en.wikipedia.org/wiki/Pythagorean_theorem#/media/Fil...](https://en.wikipedia.org/wiki/Pythagorean_theorem#/media/File:Pythagoras- proof-anim.svg)

<comment><USER9> Nice. I also like the proof which uses the only the first image a calculates the area of the square twice:

        c^2 + 4*a*b/2 = c^2 + 2*a*b

        (a+b)^2 = a^2 + b^2 + 2*a*b

</comment></comment><comment><USER10> Evidently Oliver Selfridge [1] said a puzzle based on deriving the radius like this once tripped Feynman up...

"Puzzles from last week" [http://web.media.mit.edu/~walter/MAS-A12/week11.html](http://web.media.mit.edu/~walter/MAS-A12/week11.html)

[1] [https://en.wikipedia.org/wiki/Oliver_Selfridge](https://en.wikipedia.org/wiki/Oliver_Selfridge)

<comment><USER11> What's the expected mistaken answer?

</comment></comment><comment><USER12> Hi there. Just a precision: the fact that the sum of the interior angles of a triangle is 180 degrees is not really provable, it is a postulate of the Euclidean geometry. It is an intuitive and accepted property, it reflects the fact that the geometric space usually considered is flat. Proving this statement would be possible provided that you change basic postulates. At that moment, it would become a proposition of these new mathematics and would certainly be provable starting from the new postulates. Changing these postulates is possible, that's how we got the parabolic and hyperbolic geometries, see wiki!

</comment><comment><USER13> great. now draw a few hundred more n. and don't forget the min-max values.</comment>


Ask HN: What is a good Silicon Valley area code? - <AUTHOR>

I'm setting up a Skype In number.  Since the service isn't available in Canada, I figure to set up an American number and I might as well go for one in the Silicon Valley area.<p>Are there any suggestions for which area code is a good one?  I don't want to inadvertently pick one that might have a negative connotation to it. <comment><USER2> Just don't get one from East Bay.

415 = San Francisco, this one is pretty good

650 = Palo Alto, also very good

408 = San Jose, which is decent

<comment><USER3> Do people consider 415 (San Francisco proper) part of Silicon Valley?

I always thought he Valley referred to the cities in the actual valley south of SF. No?

<comment><USER4> Depends where you're from, I think. People in the Bay Area make more distinctions, but I don't think people elsewhere do. When I lived in Texas, I tended to think of "Silicon Valley" as a generic term for "Bay-Area tech industry", and probably would've included not only SF, but also places like Scotts Valley (Seagate) and San Rafael (formerly Lucasarts) as edge cases.

</comment></comment></comment><comment><USER5> 212 all the way.

Oh, wait.</comment>


Data centre hosting / cloud hosting - <AUTHOR> Does anyone know the percentage of Cloud hosting infrastructure thingies against data centre hosting?<p>like, 20% of sites are now hosted in data centres, vs. 80% in the cloud or whatever it might be <comment><USER2> Not sure of those numbers, but you could possibly compute it for say the top 1000 sites by using dns to resolve hostnames to ips, then doing an asn lookup of those ips to see if they landed on something like amazon, azure, or gcp</comment>


3 Weeks of iPad: Some observations - <AUTHOR> http://logiccolony.com/2010/04/25/Three-Weeks-of-iPad.html <comment><USER2> "In fact, I am trying to migrate as much of my communications applications (twitter, mail, social web) to the iPad and leave my computer for actual, productive work."

+1 on that. At home, I basically use my iPad to do all my consumption and "light" communication. For development and highly intensive typing, I'll switch over to my laptop.

When I'm relaxing on a weekend, I find that the iPad is about 80% of my computer time. This has been a huge shift.

On the other hand, I haven't been able to effectively use the iPad at meetings. I had thought maybe I could take notes on it, but it just doesn't flow as well as when I'm typing on real keyboard. However, it does rock for demos.

<comment><USER3> Totally agree. The iPad is my "couch-surfing" computer of choice these days. You really can curl up with this sucker or lie on your back comfortably while reading.

I've been using it for most of my reading (newspapers, books, magazines). A lot of my surfing and a lot more video consumption than I had expected.

The sketching apps are great. I bought a little stylus to help out where fingers fall short. I'm doing a lot more drawing than ever b/c of the facility and convenience of drawing on the pad.

The comic book readers are great (I use comic reader mobi). I hadn't read a comic or graphic novel in years, but they just looks so gorgeous on the ipad that I've been voraciously catching up on various comics that I would have otherwise ignored.

I find myself using the iphone much less when at home and the laptop has been relegated to "work"/upright/serious stuff.

iPad, for me, is something of a leisure computer. If that makes any sense...

<comment><USER4> Makes perfect sense to me, as that is my use as well. I find myself very rarely turning to my laptop at home. iPad for web browsing, video watching when I'm not in front of the netflix enabled xbox 360, and pretty much all communication, with my iPhone picking up the slack in the text messaging department.

For me, it's definitely not a complete laptop replacement, but at home I wasn't really fully utilizing my laptop anyway, so this ends up being more than perfect.

</comment></comment></comment><comment><USER5> I haven't had an iPad for very long, but I love, love, love it for web browsing. It's like you're flying over your web pages.

However, I don't like how iPad Safari handles "tabs". I would much prefer traditional tabs where I could select or close a tab in only a single tap, instead of the three taps that are required now.

Regardless, it looks like I can finally retire my Newton.

<comment><USER6> Really? I try to love mine for browsing (on it now) but the silly thumbnail tab screen that feels like a clumsy iPhone leftover kills me. I almost feel like I'm going back to IE pre-tabs.

Copy/paste is also so much slower than a laptop... I don't know how to improve it, but it is relatively tedious.

I don't care about the lack of Flash, but broken iframes, no drag/drop, no way of bringing up the keyboard for things like javascript/canvas apps, no proper fixed positioning for CSS, no resizable or even scrollable textareas and the ocassional full page refresh when switching apps and/or "tabs" that kills form input all combine to make it a mediocre experience IMO. Granted, all this is also true on the iPhone, but it's a phone, not a 10" tablet.

I really like my iPad and I'm by no means going to return it, but browsing doesn't seem like the high point.

<comment><USER7> > Copy/paste is also so much slower than a laptop... I don't know how to > improve it, but it is relatively tedious.

On the iPhone, screen space is precious; there's pretty much no other way to do copy/paste than the way they're doing it. However, there's a lot of room on the iPad screen—it would be pretty simple to have a "fine selection input mode" where part of the screen gets overlayed with a "touchpad" and an actual selection (vertical bar or crosshair, depending on the activity) cursor moves around on the rest, controlled by it. I imagine they're only doing it the iPhone way for consistency.

</comment></comment></comment><comment><USER8> How do you guys do it? Admittedly, I returned my iPad after a week or so. But I just found it to be a lot less productive, even for consumption, than my laptop.

For example, I have about 20 total tabs open right now, on two instances of the browser. Why two? I can snap the two side x side whenever I want to compare two pages, or have them both up (this is useful, when I'm watching video, and browsing at the same time).

Do most people just browse one page at a time?

<comment><USER9> _I have about 20 total tabs open right now._

What are you doing? How focused are you on reading any one of those tabs?

<comment><USER10> I'm surprised he only has 20. I use tabs as a reading queue...usually from news aggregators like HN. If I waited till I had time to read everything that looked interesting, I'd miss most of the stuff that looked interesting. If I just queue it up, it can sit quietly in the background and wait for me to take a break from work.

I use different browsers to logically separate my groups of viewing habits. One is open for casual HN style surfing, one for a hobby I'm work on, one for work, one for school, one to isolate media apps like Pandora or Hulu, etc. Each has a queue of pages I was working on/reading/in the middle of something and had to run out to a meeting or whatever and didn't get back to it immediately. Heck I've had half-written replies in emails up for days in a separate browser with all of the related research tabs I was using while constructing the email up as well.

I tried to keeping myself to just a handful of tabs in a single window but I found I was missing so much good stuff I just gave it up.

I find this only works if you have a high abstract -> concrete learning style (sometimes called "synthesizers"). Not everybody works that way and that's fine - but other workflows drive me batty. Once I've assembled everything in a browser instance, I can even let it go for a week or two, forgetting completely about it before returning devoting my attention to the "concept" of that instance -- the semantics of what it's for are all there because everything is grouped in an instance. I can dash off a several thousand word paper in just a few hours of focused concentration because all of the research is done and sitting there for me -- left by my past self.

But if, like most people, my attention wanders after a few hours, I can switch instances and immediately context shift to a completely different semantic set and let my mind chew on the other problem unconsciously.

Even IRL, when in college, I'd have different tables setup the same way for different classes or projects. All the books and research notes in a stack next to the half-written paper.

<comment><USER7> Wouldn't it be relatively easy to create an alternative iPad browser using the Webkit component, but with the chrome more aimed at this style of surfing? It would only take a few alterations from the default: Pages wouldn't be loaded until you actually switch to them, and so all non-active tabs are really just quick, forced-order bookmarks; clicking on links would always push them onto the queue (with the option to push-front if something is important); and the primary interaction mechanism would be an "I'm done with this one, give me another" button, which deletes the current bookmark and opens the next one.

It could be called WikiWalker: <http://tvtropes.org/pmwiki/pmwiki.php/Main/WikiWalk> (Yes, I have, in fact, linked to the most degenerate case of the need for such a browser.)

Actually, upon further reflection—why doesn't this browser exist _for PCs_ yet? This is an itch that has needed scratching for a long while now; I'm surprised in its apparent non-existence (Tree Tabs doesn't count.)

<comment><USER10> Yes please! A browser built around this workflow would be fantastic. You don't have any idea how many times I've accidentally closed one of my "workspace" browsers and left another browser open and lost several hours worth of research because there's no good way to retrieve all of the tabs that were there in a simple way. Keeping the tabs as bookmarks would likewise be even better since I've brought even quad core systems with 8 GB of RAM to their knees on occasion. The only way I can get along now is by using extensions like flashblocker which helps somewhat with the performance, but still doesn't help much with the workflow.

The worst thing is that there seems to be this weird proclivity for GUI designers to put long lists of things horizontally instead of vertically, the Windows Task Bar, Tabs in browsers, diagrams in Visio, etc. Wouldn't these things just work about a billion times better as a simple list along the left or right side of the window? Especially since most screens these days are so wide, web pages never actually fill them up horizontally. (Yes, I'd tried various extensions, but none of them really seem to do what I want).

<comment><USER11> You happen to have interested an iPad developer who thinks this is an excellent idea. Please send more details on this idea to the address in my profile, and I'll see what can be done to make it a reality in a quite moment one day :OD

<comment><USER10> I'l send you something a bit later today when I get some time.

</comment></comment></comment></comment></comment></comment></comment><comment><USER12> _The screen in gorgeous. It's the first thing that strikes people when they see the device._

I am not so impressed with the screen. The dpi is ~30 dpi less than an iPhone, but it is noticeable... especially since you have to hold it at less than arm's length away. If the new iPhone dpi is really 2x what it currently is, the iPad's lower resolution will become very noticeable.

Edit: changed 4x to 2x. I wanted to convey the total pixel count going up 4x, but I guess since dpi is a linear measurement it should only be stated as a 2x increase. Either way, it will smoke the iPad's pixel density.

<comment><USER13> The DPI on the 960x640 will be doubled compared to the 480x320; only the pixel count quadruples.

</comment></comment><comment><USER14>
         iPhone apps suck on the iPad. Not because the iPhone
         simulation is bad, or the apps are bad, but because the
         moment you run an iPhone app on an iPad screen you
         realise exactly why the iPad is not just a "big iPhone".
         App design is very different for each of these devices * .

</comment><comment><USER15> iPhone apps on iPad both suck and are more awesome than I expected.

Anything text based is pretty poor. Nice that it's an option, but not something you want to use regularly unless you have to. Especially because they use the iPhone soft keyboard rather than the iPad one.

Games, on the other hand, work just fine. I usually forget I'm playing a scaled version once I start. Kind of like TV resolution: 20 minutes into my movie, I've totally forgotten whether I'm watching 720p or 1080p. (Others certainly have different experiences, though!) I've found that several iPhone games (mostly graphical adventures) that I didn't have much patience for on a tiny screen are engaging and fun on an iPad. So for me, the biggest problem with some iPhone games on iPad isn't the resolution, it's the controls: most games with a "traditional" control system (joystick on the left, buttons on the right), would be _much_ better if you could move the controls farther into the corners. Between the iPad screen bezel and the black border that gets added to iPhone apps (they're a slightly different aspect ratio than the iPad screen, so they don't entirely fill the screen), it's hard to reach my thumbs to the controls.

</comment><comment><USER10> How does Google Wave work on it?

</comment><comment><USER16> "Syncing and transferring documents is a pain. At the moment the best bet is to email documents around. Apple should buy Dropbox, or come up with a (better) solution for cloud storage. This is probably the clumsiest part of the iPad user experience."

Or maybe just have a shared directory or, even better, a microsd card, where you can get/put stuff via usb like you can do on an android device.

</comment><comment><USER17> _Digital comics on this are awesome. I think the medium is going to change for devices like this - the idea of a page feels like an artificial constraint when reading digital comics on a larger screen device._

I guess he meant "smaller screen device"? Virtually every computer monitor is larger than the iPad, after all.

<comment><AUTHOR> Should have been cleared in the post - I meant larger screen (and higher resolution) devices _including_ monitors. Reading digital comics on an iPhone or small screen is something I just dont like doing.

</comment></comment><comment><USER18> I wonder if he typed that post on an iPad.

<comment><AUTHOR> I typed up most of the individual observations in the Notes app over the past 3 weeks, hence the list-based nature of the blog post. Then I copied and pasted the notes from Mail (on my main computer) into Textmate for some editing/refinement. The whole thing was then published using Jekyll.</comment></comment>


How much is Reddit making from Reddit gold? - <AUTHOR> http://gold.reddit-stream.com/?fb_share=1 <comment><USER2> What's baffling is that Reddit is not considered a better business model than the zombie that is Twitter.

</comment><comment><USER3> So basically enough to pay 3-4 fully loaded developers in SF. Also it's interesting the 7.75% decrease in Gold after in Aug 2015, after the Victoria Taylor firing.

Given the absence of a clear uptrend in the last few months, I think it's fair to say Reddit Gold hasn't succeeded yet.

Kudos for the transparency though.

<comment><USER4> > Kudos for the transparency though.

This isn't reddit releasing numbers, this is someone scraping reddit and estimating the numbers based on gifted gold. Notice at the bottom of the page:

> These numbers only include gifted gold, and don't take into account > transaction fees etc

<comment><USER3> Ah, sorry didn't realize that. Thanks for pointing that out.

</comment></comment></comment><comment><USER5> 67000 a month. Wow. Small

<comment><USER6> Yeah, for one of the largest communities online, it's a small income.

But, they have advertising and sponsored submissions, and I do believe they make more money from that.

Gold is practically user donations as far as I see it, it doesn't provide much benefit to most users...

<comment><USER4> There are benefits it provides: [https://www.reddit.com/gold/about/](https://www.reddit.com/gold/about/) but most can be replicated with plugins

* Turn off ads

* Reddit themes

* Create a custom reddit alien avatar

* New comment highlighting

* Ad free, early access to the Upvoted podcast

* Remember what links you've visited across computers

</comment></comment></comment><comment><USER7> The yearly numbers are more impressive/important:

        2013	$235,254.39
        2014	$778,528.80
        2015	$870,000.00 (est.)

<comment><USER8> Those numbers would be impressive for a good restaurant, not a site 10's of millions of MAU.

</comment></comment><comment><USER9> There must be a bug in the tabulation, because the data I'm seeing is:

        $5,740,989,156
        last 24 hrs ($239207881.50 / hr)

        $67,463
        last month ($93.70 / hr)

        $2,506
        last week ($14.91 / hr)

Either that, or someone bought an awful lot of reddit gold in the last 24 hours.

<comment><USER10> It seems it is fixed now,.

        $2,506
        last 24 hrs ($104.41 / hr)

Seems somewhat more reasonable

</comment></comment><comment><USER11> Who know how much does Reddit help Imgur make money?

<comment><USER12> Does Imgur make more money than reddit? How?

<comment><USER11> ads

</comment></comment></comment><comment><USER13> "These numbers only include gifted gold"

</comment><comment><USER14> 5 billion dollars a day is not too shabby for a business model that consists of rewarding people for heartfelt advice, sad stories, and puns

edit: booo</comment>


E.U. Plans to Bar Most U.S. Travelers When Bloc Reopens - <AUTHOR> https://www.nytimes.com/2020/06/26/world/europe/europe-us-travel-ban.html <comment><USER2> It is astonishing that some commenters here are trying to argue that the US is experiencing anything other than an accelerating disaster right now. We are going to witness what the unrestricted spread of this virus can do to a developed nation. This is due in no small part to those who would vocally downplay the effects of the virus, its penetration into the population, and/or the necessity for drastic public health measures.

The EU makes cold hard calculations on matters such as this - I am glad they have my back.

<comment><USER3> Strange message. The actual data: [https://coronavirus.jhu.edu/data/new- cases-50-states](https://coronavirus.jhu.edu/data/new-cases-50-states) does not show any kind of "accelerating disaster".

Instead it shows that some states have completed their infection curve, and other are just starting it.

Not a single state is showing a downward trajectory that then reverses and climbs upward.

So what is your basis for saying that?

> The EU makes cold hard calculations on matters such as this - I am glad they > have my back.

You do know that the EU has more deaths than the US, yes? It's possible that could change, since it's not over yet in the US. But as of right now I see zero indication "they have your back" in any special way. Their situation is more or less the same as the US.

</comment></comment><comment><USER4> Many governments (including the one that occupies my country Switzerland) drove economies into the ditch. These governments won't admit that this was wrong from the start. Now they have to pretend the USA is too dangerous.

<comment><USER5> People from high-occurrence areas are a risk to people from low-occurrence areas.

That said, it's possible that both approaches were poor.

We'll only understand the cost of lockdown in hindsight: increased poverty, increase joblessness, increased mental health issues, etc.

Some problems don't have any good-looking solutions.

</comment></comment><comment><USER6> Article is unclear if it's passport based or based on where you've been the last 14 days. The latter approach is more sensible and the former seems punitive and retaliatory more than anything.

<comment><USER7> I really wish this would get cleared up in the media. Surely this has to be based on recent travel history and not the passport, but that's not how it's being reported.

A few weeks ago there was news that Greece would open to tourists from China on July 1, but now they're (justifiably) saying there ought to be reciprocal opening as a prerequisite. Meanwhile no airlines are flying direct flights so it's not clear how tourists would get between the countries anyway. It's leaving travelers in really awkward situations because we can't really plan for anything.

I think the truth is most countries haven't finalized their policies yet, and that's why the reporting is so fuzzy. I suspect a lot of countries don't want to be the first to take the plunge.

In my opinion we should just reopen all the borders and enforce quarantine as the default case. For countries who want a fast track lane, they can keep waffling about how to do that, but just reopening everywhere with quarantines would at least get the travel industry moving again and give the world a framework to get things back to normal.

</comment></comment><comment><USER8> My guess is that there is a _huge_ opportunity for some private entity to do Abbot-style 15 minute tests on arriving passengers (like global entry). Pay $100, check out negative, good to go. Maybe the airlines themselves could do it, seeing that people usually show up 2h in advance on intl flights.

<comment><USER9> Probably want to do the check at departure, so you're not stuck with the cost of 14 days of quarantine at the destination or repatriation.

<comment><USER8> Yup, the private entity would have to make a deal with the EU to only send OKed passengers on a plane (and crew, too).

It's not that hard. And while tests are not foolproof, it's probably "safe enough". I wonder why this hasn't been done already.

</comment></comment></comment><comment><USER10> I've been seeing more and more talk of how global opinions of the US have really taken a hit in the last year. With that in mind, do y'all think as quickly as it went down it can recover?

<comment><USER11> As a western European, most of it is associated with the current president and administration. Almost every European liked Obama and supported his international leadership.

<comment><USER12> "Almost every European liked Obama and supported his international leadership."

You are making some strong statements.

<comment><USER7> Here is brief Pew Research article that backs up the statement: [https://www.pewresearch.org/fact-tank/2020/01/08/how- people-...](https://www.pewresearch.org/fact-tank/2020/01/08/how-people- around-the-world-see-the-u-s-and-donald-trump-in-10-charts/)

I think it's fair to say that Obama was much more trusted in Europe than either Bush or Trump. When you break it down by country the story is more complex, but the poster did admit to being western European.

</comment></comment></comment></comment><comment><USER3> This line: "that the United States, which has reported more coronavirus deaths and infections than any other country"

Is so misleading that it borders on an outright lie. Per capita the US is middle of the pack, not especially great, not terrible either.

See: [https://coronavirus.jhu.edu/data/mortality](https://coronavirus.jhu.edu/data/mortality)

I also hate seeing stuff like:

"The conundrum is in some ways similar to a decision this week by New York, New Jersey and Connecticut to impose mandatory quarantines on travelers from other states where the virus is flaring, like Florida and Texas."

New York was, by far, the worst hit state. And now they are getting better. That have no place to criticize other states who are no worse than them, they are just on a later timetable.

It's identical to Europe: Europe was hit hard, and is now better. The US is simply lagging behind, but no it's "a stinging rebuke to the Trump administration's management of the coronavirus scourge."

I fully support the ban!!! Just not the language used to describe it.

This is why people say "Fake News", it's not outright fake, it's just very slanted.

<comment><AUTHOR> If you want to talk about misleading, you are the one who just changed goalposts from "most infections" to "mortality per capita." I would hope the healthcare system of the most advanced economy on earth would fare better than "middle of the pack" when it comes to mortality.

If you're arguing that figures should be adjusted for population then fine. Let's look at infections per capita, where U.S. is currently 12 out of 200-- significantly higher than any other western democracy, even those that have done more testing per capita. Hardly middle of the pack: [https://www.worldometers.info/coronavirus/#countries](https://www.worldometers.info/coronavirus/#countries)

<comment><USER3> I don't like to use infection as a standard because that depends 100% on how much testing you do. So it's easy to fake by just doing less testing.

Deaths is much harder to fake, and if you checked you would see there isn't any actual medical treatment, mortality rates aren't going to change much given basic care, so it's an excellent way to compare countries (except maybe those that are too poor to even have the basics).

<comment><AUTHOR> > I don't like to use infection as a standard because that depends 100% on how > much testing you do

As I pointed out, our infection rate is higher than European countries that have a testing rate >= ours. So that is a fair comparison. I.E. our positivity rate is higher.

<comment><USER3> Source please for testing rate? Both for the European countries, and for the individual US states (looking at the US as one lumped whole will give misleading results because different states are at different points in their infection, some are ending like NY, and some are starting like CA).

<comment><AUTHOR> [https://www.worldometers.info/coronavirus/#countries](https://www.worldometers.info/coronavirus/#countries)

You can click through to get more granular on the country, state, and county levels.</comment></comment></comment></comment></comment></comment>


EFB For iPad: Will Your Pilot Be Using This In 2012? - <AUTHOR> http://www.crunchgear.com/2011/04/18/efb-for-ipad-will-your-pilot-be-using-this-in-2012/

<comment><USER2> This pilot uses it right now; well, technically I use an app called ForeFlight that's a bit more mature than the app in the OP however it's the same exact concept.

It's wonderful; I still keep paper charts as backups but never use them anymore. ForeFlight just released a new version that meshes GPS data with the instrument procedure maps (called approach plates) as well as with airport maps (really really handy when you've landed at an airport with a ton of taxiways).

They even built in a way to further dim the iPad screen so you don't blow out your eyes at night.

The GPS antenna in the iPad is a bit weak, but there's a slick BlueTooth enabled widget that takes care of that issue.

The only downside is that there's no datalink, which means no live weather. As the OP mentions, once can download weather ahead of time but that's only sufficient for pre-flight planning. On a long cross country over varied terrain in instrument meteorological conditions (IMC) it's still handy to have at least a Garmin handheld device with XM Weather. There are still flight service stations (FSS) that can help you out with the weather but there's nothing like pulling up Nexrad data to your cockpit display while in the soup.

</comment><comment><USER3> My dad flies for American Airlines and is champing at the bit to use something like this. It will make life a great deal easier for commercial pilots.

</comment><comment><USER4> I forwarded it to a friend who is a commercial pilot. He thinks it's cool.</comment>


Startups Democratize Deep Learning So Google and Facebook Don't Own It All - <AUTHOR> http://www.forbes.com/sites/roberthof/2014/09/17/ai-for-everyone-startups-aim-to-democratize-deep-learning-so-google-and-facebook-dont-hog-it-all/ <comment><USER2> "Once you can recognize key objects in images, you can target ads not just on keywords but on objects in an image."

It is sad that so much amazing tech is being used primarily to deliver ads more effectively. Deep learning is not the first, nor will it be the last, technology for which that is the case...but, it doesn't make it any less depressing. I like free markets, but somehow our collective consciousness needs to shift from valuing making money over all other things.

And, it's alarming that many of the most valuable companies primary products are ads. Many companies that make real things (like electric cars and solar panels) are worth vastly less than many of the companies that spit ads about real things at people (like Google and Facebook). Something seems unbalanced about that. It seems so wrong, in fact, that it feels vaguely dangerous, to me, though I can't quite put my finger on why.

<comment><USER3> Yes, I agree -- seeing our best minds work on our lamest problems is distressing. Though arguably, it's an improvement from the previous condition, in in which our best technology was primarily used to produce weapons of war.

At least some of the products of the social media & web advertising era give people access to information and one another, two fundamental human drives. That's a bit better than "better technology to persuade people to buy stuff."

<comment><USER4> >seeing our best minds work on our lamest problems is distressing

I've seen this a lot, and it's probably true. But because of cuts to research and capitalism's "market failure" as Gates calls it, when it comes to research, does it really matter? The highly motivated and brilliant people will go off into research anyway.

The fault isn't the people of course, it's the markets.

</comment></comment></comment><comment><USER5> Deep learning is an awesome topic. The problem I find isn't the concept or the maths. It is the enormous amount of damn data janitorial work that I have to process everyday.

Oh data didn't come back in a clean format? 10 hours gone.

All these text need to be tagged? 2 days

What categories do these images fall under? Another 3 days spent tagging

Wanna parallelize your algorithmn? Ok, good luck learning how to deploy to multiple machines on AWS.

I will pay easily for a service that allows me to run my analysis in parallel without any sysadmin knowledge.

<comment><USER6> What would you like to do? I made deeplearning4j for this express purpose? Don't need hadoop, command line aws (just specify the number of machines), with a consistent data pipeline interface usable in either single threaded or distributed mode. Happy to take feature requests and answer questions.

</comment></comment><comment><USER7> I love deep learning and I am sympathetic to the concern that too much of it will end up patented. However, these garbage popsci tech journalist articles need to slow down. I can't imagine anyone who doesn't already love it not starting to hate deep learning after all the garbage articles about it.

</comment><comment><USER8> I think we should revisit the meaning of the word "democratic."

<comment><USER9> I think its a relevant description. Technology like deep learning shouldn't be the domain of large companies and graduate researchers.

A friend is working on DeepLearning4J ([http://deeplearning4j.org/](http://deeplearning4j.org/)) which is an open source distributed deep learning package.

<comment><USER6> Thanks for mentioning me! Admittedly a lot of work to be done. Looking forward to a stable release here soon that will hopefully allow easier access to models while not compromising on speed and ease of use. It can be hard problem to solve and I myself have learned a lot along the way.

</comment></comment></comment><comment><USER10> > AI For Everyone: Startups Democratize Deep Learning So Google And Facebook > Don't Own It All

> In particular, several companies aim to democratize deep learning by > offering it as a service or coming up with cheaper hardware to make it more > accessible to businesses.

Couldnt spot the "democratization" of AI here (unless democracy only to those that can pay?); also, given the current trends, small interesting startups get acquired by the big ones early.. and we end in big monopolies again..

The only way to runaway from this cycle is open-source.. otherwise we would still using windows XP and IE6 by now

Until good open-source initiatives can happen, we will be lock in the hands of a few forever.. I hope we still have some open-source heroes left out there..

</comment><comment><USER6> I discussed this very concept at[1]. The industry as a whole could really benefit from representation learning. There's a lot of unstructured media to analyze. What's missing I think is the proper interface to do so. I think the tools will emerge in the next few years that will allow us to do this.

[1]: [https://gigaom.com/2014/08/11/gigaom-meetup-talk-learn- and-h...](https://gigaom.com/2014/08/11/gigaom-meetup-talk-learn-and-hear- about-the-future-of-ai-and-deep-learning/)

</comment><comment><USER11> Everytime I think about deep learning, I am in awe of how important mechanical turk is.

A "turker" essentially a "probabilistic", "general purpose" classifier.

</comment><comment><USER12> Don't forget Microsoft. We are way ahead on using DNNs in speech and training those with GPUs.</comment>


JavaScript and Node performance coding tips to make applications faster - <AUTHOR> http://voidcanvas.com/javascript-performant-coding-tips/ <comment><USER2> The quality of this article is readily apparent in the first recommendation.

Global variables are slow... because of having to walk scope chains? Uh, no. Scopes are static properties (well, once the with statement was eliminated-- now you know why that doesn't exist anymore): the compiler only has to look up the scope of the variable during compilation, which means it carries no penalty by the time you get to a JIT. The reason why global variable lookups can be slow is that global variables are often properties on objects with non- trivial access costs (such as a DOM window, if you running on a webpage), as opposed to an inaccessible lexical environment where all references are statically known.

(It's also somewhat disingenuous that all of the coding tips are about keeping v8 happy, as if v8 were the only JS JIT that mattered or v8 characteristics were somehow universal in JS JITs, neither of which is the case).

Running through the some of other bits:

* I'm not sure homogeneous arrays is an optimization benefit for other JITs than v8.

* Actually, traditionally JIT compilers focus on hot loop nests as well as functions. The original TraceMonkey JIT (first JS JIT) considered loops a starting traces, for example.

* Changing shape of objects does matter for monomorphic calls. Although not all JITs are as insistent on monomorphism as v8.

* True, but isn't this obvious?

* Last I checked (admittedly quite a while ago), JITs tended to optimize based on shape, not class. So there's no difference in performance between the two cases.

* Or you could use for/of. Or you could just never use sparse arrays because no JIT likes having these holes. I thought you were giving performance tips, it seems weird not to mention one of the more universal ones here.

* Try/catch is generally free if you don't throw an exception.

I could go on, but it's not worth it at this point...

<comment><USER3> The try/catch wasn't always that case. I'm having trouble finding the blog from one of the v8 developers who went into details about it and other optimizations. It was on HN a while back.

Here is a perf test with various v8 versions (as you noted not only JIT but going going with the authors favorite).

[https://github.com/davidmarkclements/v8-perf](https://github.com/davidmarkclements/v8-perf)

<comment><USER2> My recollection is that the nonperformance of try/catch is something specific to the v8 JIT. Historically, the zero-cost exception model of try/catch has you do absolutely nothing with the data until someone throws an exception, at which point you work out how to map the return address to the appropriate catch handler.

</comment></comment></comment><comment><USER4> >The try/catch is a very costly operation. You should write your code in such a way that exceptions are not uncertain.

I believe all major JavaScript engines now optimize try/catch.

And SharedArrayBuffer is now disabled by default due to Spectre. I don't see it coming back soon either.

Also, I dislike this article because it recommends these things "always". "Always use forEach", "always avoid delete", "always...". Not to mention it's yet another v8 specific set of optimizations.

<comment><USER5> Try/catch point is an in-general thing. Irrespective of language. Always better to handle errors by yourself.

I was not aware of the browser deprecation of Shared array buffer. But this (or something like this) is a part of the ECMA proposal which is in stage 4. [https://github.com/tc39/ecmascript_sharedmem](https://github.com/tc39/ecmascript_sharedmem)

I said using forEach (or in-builts) are always a good practice. Now like you have to. For an example, if you have an array with no holes in it, for is better performant then forEach.

<comment><USER6> I find "for of" to be much more legible than "forEach". Not much difference in general but the "for" the beginning immediately tells me that there is a loop here, whereas I have to read more thoroughly to identify something as a loop in the forEach case.

      // for ... of
      for(let node of nodes){
          console.log(node);
      }

      // forEach
      nodes.forEach(node => {
          console.log(node);
      });

<comment><USER4> For...of is fantastic and I use it quite often (especially in async/await codebases as it doesn't create a new function context!)

However it is slow currently in all major browser engines. For fast-path code, you should reach for something else (like a for(;;) loop), but for most other loops I always tend to reach for for...of for it's ease of use and compatibility with iterators makes it a pleasure to use!

<comment><USER6> Are you sure about that? "for of" is something that I'd expect a js compiler to handle exactly the same way as forEach. I'd see how it might have been slower right when it came out but browser vendors are quick in optimizing their compilers.

At least [https://jsperf.com/for-vs-foreach/293](https://jsperf.com/for-vs- foreach/293) shows that there is no significant difference in for of vs forEach in my version of chrome. There is an insignificant difference acoording to which forEach is actually slower. (One forEach case in that benchmark is only faster because it does something different.)

Edit: looking at the comparison at the bottom, it seems like forEach is actually significant slower than for of since chrome 61.

<comment><USER7> Lots of work went into making the perf of for(of) fast - after the initial "make it semantically correct" bits.

There are many reasons it is faster, but it also has the nice property of working sensibly on any iterable object rather than forEach that only iterates by index, and has an annoying 'if (index in object)' in the loop.

</comment></comment></comment></comment></comment></comment><comment><USER8> This is a very mediocre article that mixes some good advice with misleading and frankly bad things.

Justifying forEach (which is several times slower than a for loop) with sparse arrays (which are an anti-pattern because they take you out of "fast elements" mode in V8 at least) is laughable in a sad way. It also has no "break" functionality , which is important if we are talking about performance (i.e. when iterating the array to find a specific member).

The advice for using array literals to insert elements is also bad for the similar reason that it makes it easy to create sparse arrays.

That and "i>arr.length" in the example means the for loop will run exactly 0 times! ;)

Using "filter", "map" and "reduce", by the way, is also slower than using a for loop, even if broken out into a separate function for purposes of chaining. This is because they call a function on each iteration and function calls (even with optimisation) are inherently more expensive. So, use them only when this difference in performance does not matter.

The closure / timer example is just so convoluted. Of course the closure will keep "bar" in scope - that's what closures do! The "foo" object doesn't somehow magically own "bar" it just has a reference to it, same as the closure. If something still references an object then GC will not touch it.

Similarly for the event listeners advice, which is also badly worded.

And if you do need to write a timeout-based loop, I respectfully suggest the following construct:

      const interval = 1000;
      var timer;

      (function loop () {
          ... do stuff ...
          timer = setTimeout(loop, interval);
      }());

Now you can even use "rewire" to control the interval during your unit tests - bonus!

The Arrays vs Objects thing is just shallow. In reality, the advice is "it depends". If you need to iterate, use an Array. If you need to access by key, use an Object (or better a Map). If you need both (and this frequently happens in my experience) then you have to decide depending on the size of your structure.

<comment><USER9> > It also has no "break" functionality , which is important if we are talking > about performance (i.e. when iterating the array to find a specific member).

The article is woefully misinformed regarding `forEach` and I agree that the array methods in general are slower [1], but `some` will bail out on the first true value returned. To be sure:

        [1,2,3,4,5].some(function(n) { console.log(n); return n>=2; });

will not run the callback function after processing the 2

[1] [https://news.ycombinator.com/item?id=7938173](https://news.ycombinator.com/item?id=7938173)

<comment><USER8> "some" !== "forEach" ;)

Also, "some" still has the performance penalty of an extra function call per iteration (as I know you know based on your linked comment) and we are talking about performance advice here.

But good point - I've never actually used "some" before, so I learn something new today - thanks :)

</comment></comment></comment><comment><USER10> While the points are correct, they are bad advice, except for the last point: prefer O(1) over O(n) because all (premature) optimizations are evil! What works in one engine for example (Firefox) might not work in Chrome, or the next version of the same engine. So write stupid simple naive code until you actually _need to_ optimize. Then go for algorithms first, changing something from O(n) to O(1) will have a bigger impact then for example creating static binaries (which most of the time will be slower because there will be no run- time optimizations)

<comment><USER11> The original premature optimization quote was specifically about spending a lot of time optimizing complicated algorithms in an environment in which computation was often business required if used so as a consequence one could count on people staying around more than insignificant amounts of time to get a response.

In the environments most of this would be used on people do not stick around long periods of time, therefore any simple optimization that one can do in the preliminary development of an application is not premature.

But this article sucks, as do most articles with a list of coding tips for a particular language/platform.

</comment></comment><comment><USER12> I'm confused about the setTimeout example; the code as presented is creating an infinite loop, so it does not surprising that the object used in the loop is not garbage collected. But I would expect references inside a timer to be collected once the timer has expired. Do they not ?

</comment><comment><USER13> > Avoid O(n), try O(1)

Be careful with this, as dictionaries are not really O(1), in the worst case, it can be actually O(n). When your code heavily evolves around the 'fact' that it's O(1) try to make a version with a simple array iteration and compare which is faster.

<comment><USER14> I believe a good rule of thumb is that looping over an array will generally be faster than using a hash map until you have around ~1,000 items.

Very approximate and dependent on the case obviously, but I always find it surprising how far you can go with just a simple array.

<comment><USER15> From experience I would say it's closer to 100 items, though this is using Go as benchmark. 100 items is also what I would expect considering CPU caches.

From 100 to 1000 items the array performance is not massively worse and shouldn't matter much but a dictionary can beat it (by a tiny bit).

If you're over 1000 definitely use a dictionary or tree.

</comment></comment></comment><comment><USER16> This article is quite incorrect. Some of these points were valid many versions ago (try/catch did have a cost with it several V8 majors ago, but that has since been resolved).

And, again, for the last time, Node.js is not actually single threaded and may whatever deity help you if you choose to start additional threads without understanding how libuv works. This isn't java, the answer isn't to throw more threads at it.

Honestly, it's this kind of stuff that really hinders javascript. So many people write "expert" articles that show fundamental misunderstandings about the core of JS (including setTimeout vs setImmediate!)

</comment><comment><USER17> > Closure & timer – a deadly combo

In practice you can avoid this problem if your function wrapping a timer is not a method and the callback of the timer is a recursive call to the very function wrapping the timer. In that case there is no object to access to get to the timer's function and secondly the this function never nullifies or removes from garbage collection until the last timer is called.

> setImmediate over setTimeout(fn,0)

Yes, agreed, but I wouldn't ever run timers in a loop to achieve parallel asynchronicity. I would use native Node methods to achieve this. I would however use timers to achieve sequential asynchronicity, also known as polling, which is where setTimeout would be beneficial. Sequential operations likely to always be slower than parallel operations, but sometimes you only just need intermittent delays.

I agree that these recommendations in the article are really good ideas.

</comment><comment><USER18> Any team with enough developers using Node should develop a handful who can understand the v8 internals and help troubleshoot real-world performance problems.

The most helpful resource I've found about v8 specific performance is the bluebird optimization killers wiki: [https://github.com/petkaantonov/bluebird/wiki/Optimization-k...](https://github.com/petkaantonov/bluebird/wiki/Optimization- killers) wiki, and the v8 bailout reasons repo: [https://github.com/vhf/v8-bailout-reasons](https://github.com/vhf/v8-bailout- reasons)

<comment><USER2> The best advice I can give about performance engineering is "all performance guidelines are bullshit." Compilers and JITs are constantly improving, which means any specific guideline like "do X to avoid a JIT bailout" isn't necessarily true going forward. Furthermore, the benchmarks that compiler writers use to assess the utility of their optimizations aren't hand-optimized unreadable kludges, it's generally typical applications.

Write readable, natural code, and compilers are more likely to eventually optimize it, even if perhaps they do a bad job today. Only contort your code to improve performance if you have profiles showing that you need to do so, and even then, see if there's natural code that works first.

<comment><USER19> Do you think adding type annotations or using typed js (typescript/flow), the optimisations could be improved? Since the types are providing more metadata about the code?

<comment><USER2> No (with an asterisk). The state-of-the-art for JS optimization already computes shape information (roughly equivalent to typing) and feeds that into optimizations.

The asterisk comes from the costs of having multiple shapes for a given variable. V8 (to my recollection, it could very well be out of date) generally has a performance cliff between monomorphic and polymorphic functions: if the added strictures of typechecking is giving you monomorphic functions, it could see a performance improvement. Other JITs (again, to my recollection) are generally happier to have polymorphic functions where the degree of divergence is still small (say, two or three shapes), although having 1000 shapes is going to be unhappy for everybody.

Note that this discussion is effectively microoptimization-level discussion: don't rearchitect your code to enforce monomorphism at the expense of clarity unless you have profiling evidence that the performance is necessary.

</comment></comment></comment></comment><comment><USER20> > Avoid try/catch

haha, async await needs that by design!

<comment><USER21> It's not required, you can use .catch since it's just normal promises:

const result = await doStuff().catch(errorHandler);

<comment><USER22> So what do you think your result variable contains in the event that the promise is rejected? Is this semantically equivalent to try/catch?

<comment><USER21> (async () => { const result = await Promise.reject(1).catch(e => e); return result; })()

// =>Promise {<resolved>: 1}

As you can see, the variable contains a promise returned by the .catch. It's not equivalent to try/catch (in that case the variable won't be defined for one thing), but it does allow for error handling without using try/catch if one is inclined to do so.

In practice, I've been using async/await extensively in Node.js/Express, and I'm yet to write a single try/catch. In Express, I simply use a wrapper function that catches promise rejections and siphons them to error handling middleware:

const asyncIt = fn => (req, res, next, ...args) => fn(req, res, next, ...args).catch(next);

</comment></comment></comment></comment><comment><USER23> These tips are all great. Thanks for the article.

My 2 cents from working over 5 years with NodeJS is to be careful when you sacrifice code readability over performance.

`.forEach`, `.map`, `.filter` are way more readable / maintainable than a 20 lines `for loop` with n+ var assignments.

As for `try..catch`, I use ( readability - again ) to follow a Promise chain.

        return new Promise( resolve => resolve( JSON.parse( req.body ) ) )
                      .then( body => db.update( body ) )
                      .catch( err => /* will catch JSON.parse as well as db.update */ )

</comment><comment><USER24> If you want to squeeze more performance out of JavaScript, at some moment you will have to deal with the gatekeepers of performance: inline caching, hidden classes, deoptimizations, garbage collection.

</comment><comment><USER21> I feel like these "N performance tips" make it onto the main page mostly because of the commenters coming up with counterpoints to each "tip".

<comment><USER25> Real performance tips are always in comments!

</comment></comment><comment><USER26> Promise.all vs sequential awaits is a good tip but Only if the results of the awaits are independent (obvious). I see that all the time. It's easier to see how inefficient that is when you're chaining .then().. await hides that and gives the impression that it's parallel.

</comment><comment><USER27> _Second point is, global variables are not cleared by the garbage collector. So if you continuously add more and more global variables (which are not of future use), it will cause a memory leak._

Errr...

<comment><USER28> It's an easy thing to do in JS, it happens if you forget the `var`.

<comment><USER4> only when not in strict mode, which is becoming more and more rare, especially in javascript codebases (as opposed to one-off scripts)

</comment></comment></comment><comment><USER29> What if I specifid the `global` scope, like `global.SOME_VAR`? Will that skip the expensive search of the parent nodes?

<comment><USER30> It cannot. It still has to check whether there is a local variable in any other scope that is above the one currently being executed, all the way to the top where it finds global.

Same with window in a browser context. You could still have a "window" variable placed between your execution context and the global context.

</comment></comment><comment><USER31> "Create class for similar kind of objects" would using ECMAScript 2015 classes be acceptable?

</comment><comment><USER32> Profiling might be a useful addition to the list,</comment>


The Gap Table: Analyzing the gender gap in equity - <AUTHOR> https://blog.carta.com/gap-table/ <comment><USER2> This study is meaningless without more data to make it an apples to apples comparison.

There is no pay gap if you control for occupation and experience. Similarly, my guess is this supposed equity gap would disappear if you control for these factors.

The section on founders is interesting, but by making the comparison about the calculated monetary value rather than the equity percentage and without looking at possible differences in the types of companies and associated valuations, it's also not very meaningful.

<comment><USER3> >There is no pay gap if you control for occupation and experience.

The old 75-80 cents on the dollar wage gap that some people still cite (including this article) drops drastically once correcting for occupation and experience, but women still earn less then men even when doing the same job at the same company. You can click through the link in the article to get that data. [1]

[1] - [https://hired.com/wage-inequality-report](https://hired.com/wage- inequality-report)

<comment><USER4> I'm not sure why you're being downvoted here.

The reported pay difference is 4% more to men than women for identical roles at identical companies. The pay difference grows to 7% for women in their mid 30s.

Wealth compounds, and the increase in the gap over time is a double whammy. Women wind up significantly less wealthy than their male peers by the time they hit 35, for the same jobs.

I don't know what's up with all the conspiratorial rejection of these basic stats. We all know very smart women, and we all know they're paid worse than their male colleagues. Surely, if it's right in front of your goddamned eyes, there's a problem!

<comment><USER5> >I don't know what's up with all the conspiratorial rejection of these basic stats.

That's an easy one. There is a massive political movement for solving the wage gap; and that political movement is overwhelming dominated by people who insist highly misleading statistics, and call out anyone who questions those statistics as sexist.

This is why you don't want to lie in politics. Once people catch on, they won't believe the kernel of truth you were basing the lie on; they'll just assume your still lieing (which is objectivly closer to the truth than believing the original claims being made).

</comment></comment></comment></comment><comment><USER6> The study doesn't compare equity held by men and women in same position, but total equity. There is a huge imbalance in equity held by founders/execs most of which are men.

</comment><comment><USER7> > In 2017, women earned 80% of what men earned, according to a Pew Research > Center analysis of median hourly earnings of both full and part-time workers > in the United States.

Second sentence tells you that you can't take this article seriously.

</comment><comment><USER8> Somewhat unrelated to the post, but I recently saw a news article about how the USA women's soccer players make less than the men's USA soccer players. The author was trying to insinuate it's inherently sexist an example of the gender biased wage gap.

Seems obvious to me why men's soccer players make more. They generate more revenue. It's basic economics and business. Unless it can be proven that the USA women's soccer and men's team bring in the same revenues for matches, advertising, etc it's an absurd thesis that it is sexist and gender wage bias. Furthermore it promotes the rampant alienation and villainization of men as a whole without being factually accurate and following the basic rules of economics and successful business.

<comment><USER9> Your assumption that they generate more revenue is sexist and incorrect. In 2015, when the complaint was made, the women's team raised _more_ revenue than the men's team: [https://www.si.com/planet-futbol/2016/04/06/uswnt-us- soccer-...](https://www.si.com/planet-futbol/2016/04/06/uswnt-us-soccer-wage- discrimination-revenue-unequal-pay)

(The reason is simple: the men's team sucks, while the women's is one of the best in the world and is the only reason why the US has ever won a World Cup. The revenue discrepancy would be even more, of course, if both World Cups received equal rewards for winning.)

You are probably correct, though, that sexist assumptions like yours are why they are paid less. You aren't helping your case about how we should assume the best of the people speaking out in support of discrimination, though.

</comment></comment><comment><USER10> in tech, if there are successful pushes for women in the companies, then the success would be seen more recently, in which case they would have less equity than existing holders which would contain less women.

this also doesn't account for how the candidates negotiate their salaries to begin with, HIRED has this data in their diversity report.

similarly, further funding rounds would dilute people even more

which takes me to some worthwhile further investigation of the female founders roles, aside from how things may be negotiated there may be a factor of needing additional funding rounds given challenges of being taken seriously? I would need to know how many separate events of dilution took place by the time of this analysis

thoughts?

</comment><comment><USER11> They're often proportional to salary, so this isn't exactly a surprise...

<comment><USER12> Equity is not proportional to salary. Perhaps only after you control for "time-to-join", andwhether you are a founder/investor/employee, but definitely not without that.

On another note, there's something about a disparity on ownership and %founders that seems more profound than the salary IMO (with the caveat that it is hard to study this controlling for the right things).

<comment><USER11> Actually it often is when allocating options by value etc. Bear in mind, I didn't say that it always is.

</comment></comment></comment><comment><USER13> This needs to be controlled by employee number to be remotely meaningful.

</comment><comment><USER14> We've updated the link from [https://www.washingtonpost.com/technology/2018/09/19/women-d...](https://www.washingtonpost.com/technology/2018/09/19/women- dont-just-face-gender-pay-gap-they-also-suffer-an-equity-pay-gap/).</comment>


How a Facial Recognition Mismatch Can Ruin Your Life - <AUTHOR> https://theintercept.com/2016/10/13/how-a-facial-recognition-mismatch-can-ruin-your-life/ <comment><USER2> > His emails to the department were angry and accusatory — deploying multiple > fonts, colors, and styles. He left several belligerent voicemails and was > often agitated on calls with officers.

Well, he was stomped on, jailed for two months, and made homeless. Frankly, I admire the restraint it must have taken him to refrain from going on a cop- killing spree.</comment>


Yelp cutting 1k jobs, furloughing others - <AUTHOR> https://www.axios.com/yelp-cutting-1000-jobs-furloughing-others-0ebcba5e-598d-47cf-92ac-a1d552e6814d.html <comment><USER2> What's the difference between "cutting" and "furloughing"?

<comment><USER3> Furlough implies they'll be hired back once this is over

<comment><USER2> Oh, ok, thanks!

</comment></comment></comment><comment><USER4> In local news, Eddie the Extortionist lays off his henchmen due to the downturn in the protection business.</comment>


Ask HN: Any hackers in Brisbane looking for a place to live? - <AUTHOR>

Hi guys,
A friend of mine (23) and I (19) share a big-ish 3 bedroom house in Fortitude Valley and are looking for a 3rd housemate, I really don't know many technical people in Brisbane other than those whom I work with - I thought this could be a great opportunity to get to know some more, also it would be really cool to live with someone who has an understanding of programming to be able to bounce ideas off, code together etc.
If you love code and are looking for a place to live close to the CBD send me an email, I'd love to have a chat!
Rent would be $200 p/w and includes unlimited ADSL2+, power, water etc. Email me at firstname.lastname@example.com
Thanks! <comment><USER2> I was just looking for a place a couple of months ago, I'm living in West End now but my lease ends early next year if you are looking by then don't hesitate to give me a shout.

</comment><comment><USER3> I've already a nice place in West End but I'm just happy to see that there are other HN users in Brisbane! It's usually just Sydney I see mentioned. Good luck finding someone!

</comment><comment><USER4> This would be kewl, shame I'm already in a similar share house. GL with your search.</comment>