A Little Story About the `yes` Unix Command - <AUTHOR> https://matthias-endler.de/2017/yes/ <comment><USER2> Just for fun:

GNU true.c: [https://github.com/coreutils/coreutils/blob/master/src/true....](https://github.com/coreutils/coreutils/blob/master/src/true.c)

OpenBSD true.c: [http://cvsweb.openbsd.org/cgi- bin/cvsweb/src/usr.bin/true/tr...](http://cvsweb.openbsd.org/cgi- bin/cvsweb/src/usr.bin/true/true.c?rev=1.1&content-type=text/x-cvsweb-markup)

<comment><USER3> I'm surprised that neither GNU yes nor GNU cat uses splice(2). Here's what I get. Note that ./rust is the final Rust program from the article modified to print stats and exit after a set byte count[1], ./splice is a simple C program that uses splice to copy the input string from a generated anonymous temporary file to stdout, and ./consume uses splice to move data from stdin to /dev/null. In all tests the default string of "y\n" is used.

      $ ./rust | cat >/dev/null
      5.220 GB/s (8589934592 bytes in 1.645 seconds)

      $ ./splice | cat >/dev/null
      14.514 GB/s (8589934592 bytes in 0.551 seconds)

      $ ./rust | ./consume
      9.312 GB/s (8589934592 bytes in 0.922 seconds)

      $ ./splice | ./consume
      25.118 GB/s (8589934592 bytes in 0.318 seconds)

As you can see, cat(1) is the real bottleneck.

splice is Linux-only. Most systems have sendfile(2), including Linux, but I didn't test it. The implementation and semantics of sendfile vary across platforms.

[1] I did this before I wrote ./consume (which takes an optional byte count limit), having assumed that GNU cat was using splice. As cat doesn't have a way to limit the number of bytes read/written, and other tools like head or tail definitely don't use splice, the simplest way to limit the benchmark without introducing a bottleneck was to have the producers themselves print stats and exit. The relevant diff is

        + let mut count = 0u64 as usize;
        + let bytes = (1u64 << 33) as usize;
        ...
        -while locked.write_all(filled).is_ok() {}
        +while locked.write_all(filled).is_ok() {
        +  count += filled.len();
        +  if count >= bytes {
        +      break;
        +  }
        +}

<comment><USER4> > I'm surprised that neither GNU yes nor GNU cat uses splice(2). ... splice is > Linux-only.

The fact that splice is Linux only is most likely why. GNU programs are portable to many different OSes, many of which no longer exist in any real form. They try to not use any 'single OS' specific feature if at all possible.

<comment><USER3> splice(2) and tee(2) were basically tailor made for cat(1) and tee(1), and for some reason I was under the impression that GNU tee was using splice(2) and/or tee(2). Using these could be trivial--just a few extra lines of code that could fall-through to the existing methods, for a huge speed-up in performance. (Performance matters because the consumers could be CPU bound, and an inefficient cat or tee might be taking away resources that could be used by the consumer.)

Regarding portability, GNU tail uses the Linux-specific inotify(2) to respond faster to writes. Like alot of OSS, coreutils uses the BSD .d_type member extension[1] of struct dirent to avoid unnecessary stat() calls. There are many other more intrusive OS-specific details baked into coreutils, but often it's the nature of the problem--in many situations you're dependent on platform-specific details or features. For the most part, these nitty-gritty platform-specific details are far more intrusive in terms of code complexity than the performance optimizations.

[1] Missing from Solaris, and probably most other SysV derivatives.

</comment></comment></comment></comment><comment><USER5> This topic comes up every now and then. I thought this post was particularly insightful,

"One thing to keep in mind when looking at GNU programs is that they're often intentionally written in an odd style to remove all questions of Unix copyright infringement at the time that they were written.

The long-standing advice when writing GNU utilities used to be that if the program you were replacing was optimized for minimizing CPU use, write yours to minimize memory use, or vice-versa. Or in this case, if the program was optimized for simplicity, optimize for throughput.

It would have been very easy for the nascent GNU project to unintentionally produce a line-by-line equivalent of BSD yes.c, which would have potentially landed them in the 80/90s equivalent of the Google v.s. Oracle case."

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

</comment><comment><USER6> That last rust example is less readable than modern template-metaprogramming variants of C++.

There is something elegant about being able to beat it out on speed with about 30 lines of C

<comment><USER7> Simply putting a comment above each function would make it bearable.

<comment><USER6> not as readable as this faster variant

      #include <sys/uio.h>

      //2048 "y\n" s
      static char __attribute__((aligned(4096))) str[] = "y\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\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ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\n";
      static struct iovec v[] = {
      	{str, 4096},			//adjust number of these to taste
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      };

      int main(int argc, char** argv) {

      	while(1) {
      		//scatter-gather write (on linux there is basically no way for write to write an odd number of characters, except EOF, so we need not check for partial writes
      		(void)writev(1, v, sizeof(v) / sizeof(*v));
      	}
      	return 0;
      }

<comment><USER8> Bah, that'll never pass code review. How about this:

      #include <sys/uio.h>

      #define str(x) #x
      #define expand(x) str(x)
      #define y1 y\n
      #define y2 expand(y1) expand(y1)
      #define y4 y2 y2
      #define y8 y4 y4
      #define y16 y8 y8
      #define y32 y16 y16
      #define y64 y32 y32
      #define y128 y64 y64
      #define y256 y128 y128
      #define y512 y256 y256
      #define y1024 y512 y512
      #define y2048 y1024 y1024

      //2048 "y\n" s
      static char __attribute__((aligned(4096))) str[] = y2048;
      static struct iovec v[] = {
      	{str, 4096},			//adjust number of these to taste
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      	{str, 4096},
      };

      int main(int argc, char** argv) {

      	while(1) {
      		//scatter-gather write (on linux there is basically no way for write to write an odd number of characters, except EOF, so we need not check for partial writes
      		(void)writev(1, v, sizeof(v) / sizeof(*v));
      	}
      	return 0;
      }

<comment><USER9> Both suffer from way to much binary bloat, for small performance hit we can shave off a whole 4Kb.

Is anyone going to take a stab at an enterprise edition?

<comment><USER10> "Enterprise edition" would be the same thing but written in Java and require an Oracle backend.

<comment><USER11> Don't forget LDAP, SAML and SNMP support. What's the OID for 'y' again?

<comment><USER12> Could reuse type from 2.16.840.1.113883.18.347. It's an extended yes/no, to account for "flavours of null". (Not even joking...)

<comment><USER11> I just died a little inside.

</comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER13> The GNU variant was discussed recently at: [https://news.ycombinator.com/item?id=14542938](https://news.ycombinator.com/item?id=14542938)

The commit that sped up GNU yes has a summary of the perf measurements: [https://github.com/coreutils/coreutils/commit/3521722](https://github.com/coreutils/coreutils/commit/3521722)

yes can be used to generate arbitrary repeated data for testing or whatever, so it is useful to be fast

</comment><comment><USER14> Interesting, but is there actually a practical benefit of having GigaBytes of the word yes being generated or is this all just optimisation porn?

<comment><USER15> Seems like it might even be better if yes was rate limited to a couple of lines per second or less. It would be more than enough for its intended use and when users inevitably run it in a shell to see what it does it wouldn't generate tons of output.

It seems like a violation of "do one thing well" to use it for generating data for testing, isn't dd and /dev/zero a better way to do that?

</comment></comment><comment><USER16> Really? You didn't even mention reducing system calls? That's basically what full_write does: try to output a whole buffer with one system call.

In your regular program, even with just a normal setvbuf call to set up block buffering would make a huge difference.

</comment><comment><USER17>
      import sys

      while True:
          sys.stdout.write("y\n" * 2**16)

gives me over 4GiB/s

<comment><USER18> Sure, but you're building strings in memory. It might not be a lot of memory, especially if you're able to run Python, but the native `yes` command can run on the smallest of embedded systems, which is why its speed is impressive.

</comment></comment><comment><USER19> The author says "no magic here" for the C version:

      for (;;)
        printf("%s\n", argc>1? argv[1]: "y");

but it's not totally obvious to me whether the argument to printf would be evaluated on every iteration of the for loop or not. Does the compiler know that those don't change, and is the answer to that question fairly basic C knowledge or not?

<comment><USER20> The compiler can assume that argc will not change within the loop so it can optimize it. I just looked up the assembly output from gcc and it pulls the argc>1 outside of the loop and replaced the printf with puts. So something like:

      if argc>1
          for (;;) puts(argv[1])
      else
          for (;;) puts("y")

The replacing of printf with puts is based on gcc having specific knowledge about the printf library function.

<comment><USER21> This is exactly the OpenBSD implementation.

</comment></comment></comment><comment><USER22> Those performance improvements make the code more complicated too. How fast does the yes command actually need to be?

<comment><USER23> I would desire the yes command to be as slow as possible while still performing its basic function of automatically confirming questions that come up during an installation.

This is because I clusterssh into 40 machines and hey I haven't formally accepted them into my known_hosts file yet so I type "yes" to acknowledge them, but whoops I had already accepted two of them so now they are spitting out the letter 'y' as fast as they possibly can and now I have to wait for all of that output to transfer over the wire onto my machine despite pressing ctrl+c a minute ago.

<comment><USER24> Then just use yes | head -50? There's no need to artificially slow it down when there are more reasonable means of capping output than relying on SIGINT.

<comment><USER25> yes | head -50 will not accept new signatures into known_hosts.

</comment></comment></comment></comment><comment><USER26> Can anybody explain to me what's this syntax? This is the first time i see anything like it, and i've been programming in C since i was a teenager.

        main(argc, argv)
        char **argv;
        {
        }

<comment><USER27> That's a K&R (Kernighan and Ritchie) style function declaration. Compilers still support it but the version you'd be more familiar with (ANSI C style) has been standard since at least the late 80s IIRC. ANSI C was standardised in 1989 but that process had been in progress for something like 5 years beforehand.

<comment><USER28> Does it have to do with how, in BCPL (one of C's ancestors), everything was basically an integer? So everything is an integer unless told otherwise?

<comment><USER29> Specifically, everything is an integer with the auto lifetime (gets discarded with the stack frame) unless otherwise specified.

I think most modern compilers will warn on encountering such short hand due to the common error of accidentally declaring integers when you meant to assign a value to a variable you forgot to declare.

</comment></comment></comment></comment><comment><USER30> all the reddit users from the linked article missed the SIGPIPE trick!

you don't need to check the return value from write() as your process will be terminated with SIGPIPE if it tries writing to a closed pipe.

saying that, none of them check the return code correctly: if the consumer only reads a byte at a time you could eventually get 'yyyyyyyyyyyyyyyyyy' (without any newlines)

quite impressive that so many implementations of "yes" have the same bug :)

<comment><USER6> please demonstrate that consumer.

on linux there is no way to do this without your consumer being a kernel driver that actually [purposefully accepts one byte at a time. all file io and pipes have basically no way to accept one byte only (except EOF)

<comment><USER30> you wouldn't see it on Linux as pipes are implemented using complete pages (always powers of 2), but there's probably some OS out there with a different implementation where you can set the buffer size to be an odd number, and then you'd see the bug with plain simple cat

I didn't say you'd likely see it in practice :)

</comment></comment></comment><comment><USER31> Not impressive at all. Basically he had to write a lot of manual buffering code to reach GNU yes throughput. I would suggest to use an infrastructure which already provides proper IO.

e.g. perl or clisp.

        $ perl -C0 -e'print "y\n" x (1024*8) while 1' | pv > /dev/null
        ^C.4GiB 0:00:11 [6.17GiB/s] [              <=>                                                     ]

        $ yes | pv > /dev/null
        ^C.3GiB 0:00:07 [6.64GiB/s] [         <=>

And with linux-only vmsplice the record stands at 123GB/s [https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes...](https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast/diua761/)

</comment><comment><USER32> I guess a stretch goal would be to make a "shouldi" command that can consume more y's per second than yes can produce. Of course at that point the shell itself would probably become the bottleneck.

<comment><USER33> The shell can't be a bottleneck. If you run `yes | shouldi`, all the shell does is setup the pipe, give one of its ends as stdin to shouldi, and the other end as stdout to yes.

</comment></comment><comment><USER34> Rust strike force is back, rewriting Unix tools in a sane language

</comment><comment><USER35>
        main(argc, argv)
        char **argv;
        {
          for (;;)
             printf("%s\n", argc>1? argv[1]: "y");
        }

Is beautiful, readable, and minimal. The "optimized" Rust version is complicated and over 50 lines of code. At what point does performance optimization go too far?

<comment><USER36> As a non-Rust developer my first thought upon seeing the optimized version was "On the other hand let's not visit Rust, 'tis a silly place."

<comment><USER37> There was a lot of things about Rust that made think it was weird before I actually gave in and tried it. Now I adore Rust. You should try it.

</comment></comment></comment><comment><USER38> Funny, I just learned about this command a couple of days ago as a simple way to max out your CPU. I was trying to drain the battery on my Macbook Pro and running 4 of these at the same time did the trick nicely. Redirected to /dev/null and run in the background: "yes > /dev/null &"

</comment><comment><USER39> Curiously, yes(1) is not standardized by POSIX.

Are there any UNIX systems that don't have it?

</comment><comment><USER40> any idea why it is so much faster on fedora 26?

$ yes | pv -r > /dev/null

[10.3GiB/s]

<comment><USER41> benchmarking is useless when comparing different conditions

ie your computer is probably faster than op's

<comment><USER40> Of course. Though 37MiB/s compared to 10Gi/s probably means that the GNU version used by Fedora has a faster implementation than Apple's version.

<comment><USER41> You're right, my mistake, I didn't check the speed of the OP's

</comment></comment></comment></comment><comment><USER42> I use the yes command to defrost my lunch. I open up a couple of tabs running

yes > /dev/null

Then place my frozen lunch on the back of my macbook. Give it an hour or so and boom, defrosted.

<comment><USER43> Hah, nice! Somewhat related, I once worked on a project that used a high reliability PC meant for extended use in "extreme" outdoor environments. One of the issues they (manufacturer) worried about was the pcb and solder joints experiencing thermal fatigue fron lots of seasonal and night/day temperature cycles.

Their ingenious solution was to always run the system towards the warmer end of its spec, and so it included a program that would monitor the temperature inside the case, and would spawn/kill a bunch of threads doing compute intensive math in order to keep the temperature constant when the users workload wasn't enough!

<comment><USER44> Couldn't they slow down the cooling fans? Or was it a passively cooled PC?

<comment><USER43> Passively cooled. The thing was originally meant for extended use in "extreme" industrial environments (eg at a power substation, inside a wind turbine, etc..), so it had no vents or moving parts at all. Everything was heatpiped to the metal case, which looked like a heatsink.

Similar looking model from same company: [https://selinc.com/products/3355/](https://selinc.com/products/3355/)

</comment></comment></comment></comment><comment><USER45> maybe it's supposed to be slow, wouldn't a faster 'yes' spam stdin much faster? you only need to hit yes occasionally and faster than a second

</comment><comment><USER46> k3

       while[1;`0:"yes\n"]

</comment><comment><USER47> tldr; watched pootie tang

</comment><comment><USER48>
      env::args().nth(1).unwrap_or("y".into());

this ridiculously complicated syntax to perform such a simple thing is why I will never accept Rust. What a clumsy, ugly language. I'll just stick with learning ANSI common LISP, that pays immediate dividends.

<comment><USER49> It's fairly idiomatic so you get used to it but if you prefer something a little more C-ish you can write it like that (as a side note the code in TFA forgets to import std::env and BufWriter):

        use std::env::args;

        fn main() {

           let expletive =
                match args().nth(1) {
                    Some(arg) => arg,
                    None => "y".into(),
                };

            loop {
                println!("{}", expletive);
            }
        }

This is the equivalent to the unoptimized C version. I would argue that it's a little more readable too, substituting "loop" instead of the idiomatic "for(;;)" and the more verbose match syntax instead of the ternary (the terser rust equivalent being the `unwrap_or` you seemed to dislike).

Personally I think I'd use the "unwrap_or" version, when you're familiar with the language it's completely transparent, easier to parse and expresses intent better I think. For an outsider I can see why it would look like a strange incantation though (but the same could be said about ternaries or CL's "do" construct for instance).

The only thing I'd deem inelegant here is the `"y".into()`. It's probably not obvious what it does and why it's necessary to somebody not familiar with Rust.

<comment><USER48> That example is indeed more readable, but it still reads like methods on objects which is a fundamental issue for me. Any non trivial program written in an object-oriented paradigm eventually becomes incomprehensible, whereas the functional approach doesn't rely on the state machine model. Two different approaches. I didn't care for objects back in 1990 and I certainly care even less for them now. I upvoted your example in appreciation for the effort you went through though.

<comment><USER49> I agree that for these types of constructs a more functional style could look better. That being said the OOP approach as the merit of reading in the proper order: you get your args, pick the 1st and then use that or the default "y" value.

If you rewrite this to use function calls instead of methods you end up with something like:

        (or (cadr (args)) "y")

Which is fine if you're used to lisp syntax but it's really a matter of taste at this point.</comment></comment></comment></comment>


Will Japan's Geisha Survive the Digital Age? [audio] - <AUTHOR> http://www.disruptingjapan.com/will-geisha-survive-the-digital-age/ <comment><USER2> Just happened to see a kerfuffle about this particular 'geisha' earlier on reddit, and the following was linked: [http://missmyloko.tumblr.com/post/149454238268/a-random- psa-...](http://missmyloko.tumblr.com/post/149454238268/a-random-psa-on-fake- geisha)

</comment><comment><USER3> I don't really see how anything there was "disruptive" and it seems like this is less a factor of technology and more just societal change.

The big factors are

1\. Tourists who don't know (or care) what a geisha really is. While the article is awkwardly vague about it, a good way to think of it is that a geisha is a combination of hostess/server with entertainer specializing in small crowds and individuals. A Geisha is not actually a prostitute (but they can be). And tourists have cared about as little as they ever did

2\. The younger generation just not caring either. A large part of this can be seen as a mixture of Japanese culture encouraging a "work hard, play hard" mentality where sitting around and having a nice quiet evening out isn't desired coupled with the same "rebellion against the elite" that we see in western nations

3\. The older generation who is interested and does appreciate it being, well, older. Family men are less likely to spend money on many evenings out and the particularly well off are either adopting the "party hard" life style or just outright hiring the more talented geishas as a mark of status.

Tech itself barely factors in to any of that and nothing seems "disruptive" in the slightest.</comment>


Show HN: OppsList – A small, but growing list of software opportunities - <AUTHOR> https://oppslist.com <comment><USER2> Really like both the idea and the implementation: the tie in to the email list is quite nice.

One possible enhancement I could see would be a followup to the person making a suggestion. Not sure if there's an easily deduced standard form but basically over a couple of days ask them a few more detailed questions (as a suggestion, maybe 3 questions 2 days later, and 4 questions 5 days later?) to try and dig into the problem and figure out how deeply they've thought about this and if there is really any substance behind it. Things like what they use/how they currently solve this problem and how much time a day does this take: if they can come up with more insight/detail then that might help spur someone to think more about the dev. Otherwise it risks becoming an Internet version of the "Oh, you make apps? I have a GREAT idea you should drop everything you're working on and build" scenario.

Another potential enhancement would be a bounty-style implementation: along with the suggestion they could actually escrow some money towards the idea, and later emails could say "5 people have paid $X towards this idea: submit your solution" as an incentive to developers to actually take the idea seriously. One could almost see this as a reversed-Patreon: instead of posting your work and waiting for people to pay, you post a workable/working solution and if enough people use it/approve you collect the pot. Significantly more thorny to ensure people don't get robbed of their money or time but would be a unique way to crowdsource specific solutions.

<comment><AUTHOR> I really like both of these ideas!

Some of these problems could use a bit of fleshing out. And, a bounty program is a good idea too.

It's really hard to find people who are willing to share their problems. I wonder if there is a place where these folks gather on the web that I'm just not aware of?

<comment><USER3> I did some research on that and turned into this. It should give you an idea of how and why.

[https://medium.com/black-n-white/the-problem-with- problems-4...](https://medium.com/black-n-white/the-problem-with- problems-47ee63bb3511)

</comment></comment></comment><comment> 52-6F-62 I had a look -- I'm curious as to how you received so many submissions already. Did you canvas or advertise? Did people just find you?

Off the top of my head, I think you'll maintain the most traffic if your service is gratis, like Craigslist but maybe collect some analytics and sell some ad space? Offer the option to pay for a "promoted" slot like Reddit and Google? Others might have more creative solutions than I do here... As far as aggregate data you collect from the site I'm in the dark.

I really like the idea of collecting some more direct software needs. It seems like a good space to crawl for project ideas if nothing else.

What library are you using for the UI? Is that Bootstrap material design? There are some more polished versions of the same sort of thing which might tie everything together a little more (particularly that app bar). But I'm just nitpicking now. It's a very clean layout.

I would add a "Home" or "List" option in your menu as well. I know the title goes back but it's typically good practice. That or add a "back to list" button of some kind on the posting template.

Again I like they idea! It is a bit different from freelance work websites where its a basically big feeding frenzy sometimes. Maybe that's only because it's quiet right now, I don't know. Anyway, it all works and its fast. Nice job.

<comment><AUTHOR> Hi there!

Thanks so much for the feedback! Adding a few of these to my trello right now :)

Yep using bootstrap material design.

I seeded the site using submissions from my other project [http://oppsdaily.com](http://oppsdaily.com), its just an archive of the daily e-mails at the moment, but if it becomes something akin to the craigslist of business problems, I'd be very happy!

</comment></comment><comment><AUTHOR> Hi guys,

I'm Cory. Thanks for checking out my project :)

I'm definitely looking for feedback on the site. And I'm also open to ideas about how to make a profitable business out of aggregating market needs.

<comment><USER4> Hello Cory, this is an excellent idea. It will take some time and percolating to get it from coarse concepts to point-of-sale events, but you're on the right track. I think if you keep aggregating things like this you'll eventually have an awesome index of pressing software needs. As time goes on, you'll be able to offer more catered service and you may be able to make a nice profit just connecting developers with people who need them. Keep doing what you're doing, as there's definitely a need for something like this. Lots of directions you could take it, like how kickstarter raises funds from many people to fund a project. This is great because the projects are suggested by people who would use the product, so if you flipped kickstarter on its head, what would it look like?

<comment><AUTHOR> Hey Sova!

Thanks for your thoughts! I hadn't thought about it in terms of kickstarter, but that's actually a really thought provoking way to look at it.

I'll keep chipping away and see what happens. I hope it becomes the go to place to find software problems to work on.

</comment></comment></comment><comment><USER5> Hmm. Looks like you might be having some SSL certificate problems -- www.oppslist.com is on the Subject Alternative Name list, but plain oppslist.com is not. Of course, the latter is the URL being pointed to by HN.

See [https://www.ssllabs.com/ssltest/analyze.html?d=www.oppslist....](https://www.ssllabs.com/ssltest/analyze.html?d=www.oppslist.com) for more information.

<comment><USER6> I have the same problem (with Firefox, latest, on Win10 and Android). In Chrome it loads without error.

PS: great project, bookmarked!

</comment></comment><comment><USER7> Looks great, I'd love to have an RSS feed though, having that in addition to the daily emails would be a great way to keep track of upcoming, popular and new opps entries.

Love it already.

</comment><comment><USER8> I recognised the dog kennel one! Anyone had success with that it sounded like a gooden.

<comment><AUTHOR> Everyone wanted to work on that one!

I remember at least one individual built software for this and was determined to own the market. I'll call that a win :)</comment></comment>


Ask HN: What book are you currently reading? - <AUTHOR>

<comment><USER2> Brendan Gregg's Systems Performance: Enterprise and the Cloud ([http://www.brendangregg.com/sysperfbook.html](http://www.brendangregg.com/sysperfbook.html))

</comment><comment><USER3> The High-Velocity Edge: How Market Leaders Leverage Operational Excellence to Beat the Competition

</comment><comment><USER4> Alexis Ohanian's "Without Their Permission".</comment>


Turn recipe websites into plain text - <AUTHOR> https://plainoldrecipe.com/ <comment><USER2> It looks like you're using the recipe-scrapers library to scrape recipes which only supports a set number of websites.

If you want to expand that, I recommend parsing JSON+LD and Microformats. Given your parsers folder [2], it looks like you've tried it, but only for specific websites. I would make that generic and check whether the metadata is available on any website. I wrote a blog post on this if you're interested [3].

source: I've built a very similar tool for my cooking app: [https://www.mysaffronapp.com/](https://www.mysaffronapp.com/)

[1] [https://github.com/hhursev/recipe- scrapers](https://github.com/hhursev/recipe-scrapers)

[2] [https://github.com/poundifdef/plainoldrecipe/blob/master/par...](https://github.com/poundifdef/plainoldrecipe/blob/master/parsers/bowlofdelicious.py)

[3] [https://www.benawad.com/scraping-recipe- websites/](https://www.benawad.com/scraping-recipe-websites/)

<comment><USER3> Howdy crap... I just created an account on your website and added one random recipe (cashew nut yoghurt) that did not work on the original post site, and it worked like a charm!

You've got a new paying customer :)

I'd been looking for something like your app for a long time.

Ough, your PayPal flow is not working :( fix that and you'll have a paying customer haha

<comment><USER2> Oops, what part of the flow isn't working?

<comment><USER3> [https://ibb.co/kQrkbJV](https://ibb.co/kQrkbJV)

(will autodelete in 30 mins) there's nothing very private but...

<comment><USER2> I'm using Paddle for payments and it looks like something wrong on their end. I'll contact them and keep you posted. Thanks for the heads up!

</comment></comment></comment></comment></comment><comment><USER4> Hi! I built this! (Surprised to see it on the front page as I didn't get much traction when i first submitted it :)

Anyway, all of you have a lot of neat suggestions! Please do take a look at the "contributing" section of the repo and let me know if you'd like to pitch in!

<comment><USER5> Hackernews is quite random - stuff that gets no upvotes will sometimes get hundreds of upvotes the next time it's posted.

That's why they explicitly allow some amount of reposting.

<comment><USER6> From what I've observed on other sites (mostly StackOverflow and Reddit) I think there are a few major components to this, namely: timing of post, luck / randomness regarding early upvotes, and other posts during that day.

The last one is a bit like when a film releases on the same weekend as some blockbuster, it is more likely to go under the radar. The middle condition is mostly luck, unless someone is prepared to manipulate the early upvotes somehow. But the first one is quite easy to time correctly - US-heavy sites tend to have a few time slots where a disproportionately large number of people check it. My guess would be morning, lunch and afternoon slots, and especially slots where different time zones overlap. E.g. an afternoon slot for Europe which overlaps with the Eastern seaboard doing a morning check of HN might work quite well, etc. This can help a fresh post break through the decaying, but highly upvoted older posts that are keeping it from more visibility.

<comment><USER7> A couple years back, there was a hackernews post that analyzed hundreds of HN submissions and determined which times were best to post.

Some days I wish I had bookmarked that link

<comment><USER8> This [0]? Or the linked article in it?

[0]: [https://chanind.github.io/2019/05/07/best-time-to-submit- to-...](https://chanind.github.io/2019/05/07/best-time-to-submit-to-hacker- news.html)

</comment></comment></comment></comment></comment><comment><USER9> I've always wondered why recipes have the ingredient list and quantity separate from the instructions. I often have to scroll up and down (even on a mostly-decent recipe site like all recipes.com) first to see what gets added next and then to see how much of it to add. Why not tell me it's one teaspoon of salt in the same place as you tell me to add the salt? Only advantage to separating them is to make the shopping list, but no reason one can't duplicate the quantities.

<comment><USER10> Same. As a result, I've been using this LaTeX package for my personal recipe collection (see example on page 5): [http://ftp.gwdg.de/pub/ctan/macros/latex/contrib/cuisine/cui...](http://ftp.gwdg.de/pub/ctan/macros/latex/contrib/cuisine/cuisine.pdf) [PDF]

(I'm in the process of abandoning LaTeX in favor of a custom Markdown → Pandoc → HTML flow with basically the same layout, though.)

<comment><USER11> Funny, after trying out all sorts of digital recipe organization methods, I've settled on plain old 4x6 index cards as the most useful.

I have all of my recipes plaintext in an org file with a very simple format...

      * Recipe title
      ** Ingredients
         - 1 tsp x
         - 2 tbsp y
      ** Directions
         1. Mix together x and y
         2. Bake at 350 for 15 minutes

I set up a simple python script using the same package as the OP's website for scraping recipe sites to org format, then I export subsections to latex with a custom class and print to index cards.

<comment><USER4> My site (the OP) uses a separate print-specific CSS to try and format recipes to a 4x6 index card. It doesn't work as well as I'd like, as in, it's hard to get what shows up on the screen to print on an odd-sized piece of paper, but if you, or someone you know, has CSS expertise then I'd love for someone to help make this work more reliably!

</comment></comment></comment></comment><comment><USER12> This is great and works, for the supported sites, remarkably well.

One major flaw: it seems like the calories and macros aren't captured. For bodybuilding and powerlifting types, and other athletics, these are the most important part of a meal.

What would make this a "killer app", in my view, is if I could request a recipe in JSON instead of just formatted plain text as you do. Then I could use the recipe (and recipe search) in my own home-brewed meal planning program.

<comment><USER13> Very nice insight. I might even go a step further and archive the entire page[1]; hard drive space is cheap, and how many recipes is one person going to save, honestly? 1-2 LOCs worth? Then you can just parse the content you want, with the ability to drop down into the original page as you first saw it.

As a person with better visual memory for certain kinds of data, having the original page content may have as much meaning as the recipe, for entirely different reasons. Food can be very personal, and recipe books doubly so. A recipe archive can be as personal as we like, or all of that can abstracted away when we don't need it.

[1] [https://www.gwern.net/Archiving-URLs](https://www.gwern.net/Archiving- URLs)

<comment><USER14> LOC? Line of Code? Surely 1-2 LOCs is significantly less than any recipe.

<comment><USER15> I'm guess it's "Library of Congress"

<comment><USER13> Yeah, that's what I meant. I was going for a visual metaphor that might be lost if I just said some number of bytes.

</comment></comment></comment></comment></comment><comment><USER16> My quick and dirty trick for finding the actual recipe in a long blog post:

Ctrl+F "print".

Probably 90+% of websites use some tool to format the actual recipe, so the actual recipe pretty consistently includes a link for printing it. Search for the word "print", and it takes you to the part of the page that has the recipe.

(You don't actually have to click the link. It's just a landmark for navigation within the page.)

</comment><comment><USER17> Neat! Now make a website that instantly electrocutes or at least painfully shocks people that publish recipes as Instagram stories! The accumulated anger I have after trying to follow those will mean a hefty donation from my side :)

As an aside: I live in a jurisdiction where recipes cannot be copyrighted, so I have collected all recipes I remotely liked on a web page with only text. All recipes except some of the very last ones "untested, potentially disgusting" headline are in Swedish though: [https://koketteriet.se/skrivet/Recept/recept.html](https://koketteriet.se/skrivet/Recept/recept.html)

<comment><USER18> Wow, your collection of recipes is a goldmine, thanks!

Didn't know that recipes couldn't be copyrighted here in Sweden.

<comment><USER17> It is due to a very old ruling saying that just listing ingredients and steps is not enough to reach a "threshold of originality" (verkshöjd).

<comment><USER19> Maybe that's why modern recipes on the web at 90,000 word behemoth life stories with one step of the recipe every 70 screens of indirection.

<comment><USER17> We can still just copy the how and what, and not the accompanying epic novel :)

I think I managed to give credit where it is due (in the intro, at least), but about 60% of the recipes are things we veganised ourselves from whatever old family recipes we have.

<comment><USER19> Plug a friends books here, all vegan from Byron Bay in New South Whales:

[http://organicpassioncatering.com/](http://organicpassioncatering.com/)

Anyway, I find, as I rapidly approach the big four-oh, I don't need recipes much anyways, so I have a sleeve-book with some recipes, some pages are just dish names, and others are flavours or ingredients that go together.

</comment></comment></comment></comment></comment></comment><comment><USER20> This is fantastic! I'd love it if I could pair this with an RSS aggregator to get new, plain-text recipes in my RSS feed every day/week, etc. Right now I get an RSS feed of my favourite recipe sites but have to get through so much junk to see the actual recipe.

I recently went down the rabbit hole of recipe websites while I built a little side project Shopify app for creating recipes on ecommerce stores[1]. Having a plaintext version has been on my backlog to-do list forever, but it seems the vast majority of store owners aren't keen on it. It's been a massive learning experience for me; and I never realized how... bad the recipe website experience was for so many people.

Question: how do you think we, as in us as the people building the current web, can improve the standard recipe display on the web? Obviously removing the 1300 word novel before recipes is a big plus, but what else do you think would improve your day-to-day recipe browsing?

[1] [https://recipekit.app/](https://recipekit.app/)

<comment><USER21> the obvious answer is to remove the insane number of enormous ads you have to scroll past or click through on your way past that novella

<comment><USER20> That's valid. I guess I haven't seen ads in a long time thanks to ublock, but makes sense for the general reader for sure.

</comment></comment></comment><comment><USER22> As this only works on certain websites, that implies you're not pulling from something consistent e.g. structured data, which the vast majority of popular / visible websites should use

e.g. [https://search.google.com/structured-data/testing- tool/u/0/#...](https://search.google.com/structured-data/testing- tool/u/0/#url=https%3A%2F%2Fwww.everydayhealthyrecipes.com%2Fauthentic-polish- bigos-stew-recipe%2F)

out of interest, did you try using structured data to scale the tool?

<comment><USER23> Yes I would have thought that handling json mark-up would be the first thing that would be implemented.

Having said that a lot of users of recipe mark-up have problems implementing it properly.

</comment></comment><comment><USER24> Now if you can add a feature to convert Cups -> Grams _correctly_ then you've got my money!

<comment><USER25> I don't know how americans manage to feed themselves, while measuring things with cups! It's such a bizarre and archaic unit. Like the english stone.

[https://en.wikipedia.org/wiki/Stone_(unit)](https://en.wikipedia.org/wiki/Stone_\(unit\))

<comment><USER26> I'm not American (Canadian living in Germany) and I have to say that I find using cups/spoons is much easier than pulling out a scale and weighing everything. Just grab a measuring cup / spoon (every house has a set of standard sized measuring cups and spoons) fill it up to the right amount and dump it in.

<comment><USER27> How do you fill a cup with apple slices?

<comment><USER16> It's quite easy to fill a cup with apple slices. You won't get an accurate, reproducible measurement this way, but the procedure itself isn't difficult. If accuracy isn't that important, then it works okay.

</comment></comment></comment></comment></comment><comment><USER28> This is awesome. But perhaps this product is better packaged as a browser extension. So when you browsed a recipe page, the product would turn the page into a plain text recipe.

<comment><USER21> I'd rather not install an extension (trust) and not all browsers I use (e.g. on mobile) support extensions. You can use a bookmarklet pretty much anywhere though:

javascript:location.href='[https://plainoldrecipe.com/recipe?url='+encodeURIComponent(l...](https://plainoldrecipe.com/recipe?url='+encodeURIComponent\(location.href\))

<comment><USER29> Thanks for the great idea. The code got broken in the comment, but was easy enough to reconstruct. Another bookmarklet I use is PrintFriendly. It uses some of it's own js, and also works well on recipe sites - giving more options for what to keep/remove.

</comment></comment></comment><comment><USER30> Recipe websites are the worst of web design. To make things even worse they are mostly used on mobile where bloat/advertisements/janky loading is even more of a pain.

<comment><USER31> Not to mention the 1200 word partial life story preceding every recipe.

I could not care less what pivotal moment in your childhood led you to like chocolate cake. I just want to make one.

<comment><USER32> >Not to mention the 1200 word partial life story preceding every recipe.

Everyone I know balks at this, yet it exists. Can some explain why? Where is this tradition coming from? Does this drive page views? I know nothing about the cooking subculture. Is it some sort of normies vs "really into this" thing (and please excuse the phrasing, I could not come up with something better). Because that would mean the page is just not targeted at me. But then again that argument will make sense if the monetization was not through advertisement and view volume.

I didn't realize how curious I was about this.

Edit: just had a thought. Can it be something to do with SEO? Does google like bigger articles with lots of personal text? If this is the reason it would blow my mind. Without knowing it google algo would have made the internet a shittier place, this is very amusing to me.

<comment><USER33> It's mostly SEO and "engagement" but also possibly copyright law (at least that's the case with cookbooks that include non-recipe fluff content)

From the US Copyright Office:

"Mere listings of ingredients as in recipes, formulas, compounds, or prescriptions are not subject to copyright protection. However, when a recipe or formula is accompanied by substantial literary expression in the form of an explanation or directions, or when there is a combination of recipes, as in a cookbook, there may be a basis for copyright protection."

<comment><USER34> Adding your life story into your recipe might make it eligible for copyright, but what's the point? Someone can simply strip out your life story and then they'll be allowed to copy it.

</comment></comment></comment></comment></comment><comment><USER35> I am eagerly awaiting for something like that can happen in coming days. There are lots of things like photos, video, ingredients, nutritional value, serving tips, recipe notes and ofcourse structure data in my [https://hassanchef.com](https://hassanchef.com)

</comment><comment><USER36> Very interesting. I'm starting now a project to organise my recipes. With [https://github.com/domchristie/turndown](https://github.com/domchristie/turndown) it transforms the html from clipboard into markdown, they result is really good and it's generic to all recipes.

Of course you don't have structure of the recipe and it does not simply work with a url.

</comment><comment><USER37> I wonder if this could work as a DuckDuckGo clip? You search for a recipe, and see the result right there on top, without all the fluff.

</comment><comment><USER38> Neat idea! The fiance and I have taken to simply printing recipes on paper. It has the benefit of eliminating a lot of the cruft that the website has - condensing the printed material to just ingredients and instructions.

And makes it really easy to reference a week or two later if we want to remake it - just pull it out of the binder.

<comment><USER39> I've tried that. After the recipe binder got to be a couple of inches thick, it would take more discipline than I have to keep it organized in some kind of effective way. Plus I don't know what way that would be. So I pretty much end up either looking at the laptop while cooking or printing out a new copy each time.

</comment></comment><comment><USER40> This is ace!

I do often wonder if many recipe sites ever really think about the user experience. It's almost always going to be on mobile and there's either got to be a simplicity to the presentation (which is what this does brilliantly) OR a really simple way to flick between ingredients and method.

The one that stands out for me is Jamie Oliver (example: [https://www.jamieoliver.com/recipes/vegetables- recipes/veggi...](https://www.jamieoliver.com/recipes/vegetables- recipes/veggie-chilli/)) - on mobile there's this super simple tab that flips you between ingredients / method. It's simple, but exactly what you want, especially when you're covered in flour / oil / etc... :-)

</comment><comment><USER41> Thank you for this. For an app the does something similar (not free): [https://www.paprikaapp.com/](https://www.paprikaapp.com/)

<comment><USER42> I've been using Paprika app for years, and I would reccomend it.

As well as importing from websites, you can enter you own recipes. And my wife and I can sync between our phones and laptops so we can follow and edit the same recipes. Very handy.

</comment></comment><comment><USER43> Very cool! Does a good job on select websites.

Next stop: the holy grail of recipe website cleanup, removing the mindless drivel about the author's.. whatever / whoever, their inane anectodes, and generally any trace of their annoying personalities (here's an offending example: [https://www.ibreatheimhungry.com/easy-roasted-pork- shoulder-...](https://www.ibreatheimhungry.com/easy-roasted-pork-shoulder-3/))

</comment><comment><USER44> I was already excited when Apple showcased an Extension for the new Safari in their keynote that did something similar.

I wonder if any of these websites will find a way to prevent these recipe scrapers from working so that people read the damn ads in their blog texts. Instapaper's article extraction gets rejected from time to time and Safari's reader mode too, but it's mostly on major news sites.

</comment><comment><USER45> Nice work! I built something very similar: [https://recipemincer.com](https://recipemincer.com)

It seems you're using the same Python scraper I am: [https://github.com/hhursev/recipe- scrapers](https://github.com/hhursev/recipe-scrapers)

</comment><comment><USER46> This is really cool, I've been building a site to help build templated recipes with markdown and javascript and I'll definitely be using this when I transcribe recipes!

[https://programmablerecipes.com](https://programmablerecipes.com)

</comment><comment><USER47> This is pretty cool! Are you open to PRs for foreign language recipe sites (German in my case)?

</comment><comment><USER48> Trim is a general purpose remover of cruft, but seems to work on recipe sites: [https://beta.trimread.com/articles/23286](https://beta.trimread.com/articles/23286)

</comment><comment><USER49> I want a tool like this for _any_ website, that intelligently extracts just the useful part as plain text. Reader view and so forth just don't work that well. Are there any tools around like this?

</comment><comment><USER50> Related: I just launched a website with a collection of easily copy-and-paste- able lists in plain text.

[https://copypastelist.com/](https://copypastelist.com/)

</comment><comment><USER51> Recipes are so common on the web that we need a <recipe> html tag along with <rs> and <ri> for steps and ingredients.

<comment><USER52> there is actually a standard using attributes :) [https://schema.org/Recipe](https://schema.org/Recipe)

</comment></comment><comment><USER53> Tried it with two websites, and neither was supported.

Is this aiming to be a domain-specific equivalent of Outline.com and reader- mode?

</comment><comment><USER54> Recently I started putting my recipes on my personal website in a minimalist way. No stories, no ads, no images.

</comment><comment><USER55> The title on the homepage is spelled wrong but otherwise nice work! :)

<comment><USER56> "Plan" instead of "Plain". No spellchecker will pick this up :) Many will see, few will notice, and typoglycemia will do the rest :)

<comment><USER57> A german synonym for typoglycemia is "Buchstabensalat" \- letter salad. So maybe it's a very subtle joke.

Otherwise there's a PR open: [https://github.com/poundifdef/plainoldrecipe/pull/1](https://github.com/poundifdef/plainoldrecipe/pull/1)

</comment></comment></comment><comment><USER58> This is awesome. Thanks !

</comment><comment><USER59> Got a certificate security error from Firefox, so didn't visit.

</comment><comment><USER60> Yes!! Thank you

</comment><comment><USER61> OH AWESOME !</comment>


CINT The C/C++ Interpreter - <AUTHOR> http://root.cern.ch/twiki/bin/view/ROOT/CINT

<comment><USER2> There used to be a lot of these things, but this one seems the only open source C interpreter with any following these days. Anyone know what ever happened to the others (Saber, eIc, small C, ...)?</comment>


Show HN: HTML5 Bitcoin Poker website - <AUTHOR>

http://playbitpoker.com
Hey, this is my first startup project and I'm pretty excited. I've got to the point where I feel I've got something solid, and I don't know what to do next. I haven't had masses of people using it and testing it with the test-network bitcoins. I have tested it a fair bit with friends and it seems there's no major problems. What should I do? Is this a minimum viable product? Should I try and promote it while it's still in testing, or should I switch over to using real bitcoins before doing that? I'd love to hear any suggestions you might have.
P.S. I had https going with a self signed certificate but the browser warnings were annoying so I turned it off. I'm waiting on a proper certificate, and I'll enable it as soon as I have it. <comment><USER2> Hey! I talked to someone at the Bitcoin Conference about something similar, I think at the Hackathon. Was that you?

Props on all your work. Since you've asked, I would say you should wait on using real bitcoins.

<comment><AUTHOR> Nah, wasn't me, but thanks!

</comment></comment><comment><USER3> I've play around with it and like it, there's a few things which I think you could improve, if you want to email me and chat, my email is in my profile.

</comment><comment><USER4> There are some real issues in handling bitcoins. I worked on a bitcoin exchange that was never finished because of security issues and that was a team of 6+.

</comment><comment><USER5> Untraceable money and gambling, you're going to be rich!

</comment><comment><USER6> Is that legal?

<comment><AUTHOR> I don't see why not, it's not real money and hey, everyone else is doing it. I'm going to talk to a lawyer if people start using it.

<comment><USER4> In America it is illegal to make a currency that competes with the USD. Congress will eventually rule that Bitcoins do compete with the USD and then yes it will be illegal.

</comment></comment></comment><comment><USER7> link for BitBargain is broken

<comment><AUTHOR> Thanks for letting me know, fixed!</comment></comment>


Show HN: Call Me Not: solving the "when to call?" problem. - <AUTHOR> http://market.android.com/details?id=com.threedot.android.callmenot

<comment><USER2> It's an interesting feature but calling it a "reverse call blocker" is (a) confusing; (b) makes it sound antagonistic.

In essence this thing is supposed to help you avoid forgetting when the bad vs. good times are to call someone... or to remember not to normally use some number you otherwise would. In other words, this tool helps users to be _considerate_ \-- a concept which the word _blocking_ doesn't suggest.

If you stop calling it _blocking_ then you don't need _reverse_ \-- some other word.

The confusing terminology did "make me look" but that's probably not a strong marketing strategy. Before I looked I couldn't imagine what in the heck "reverse blocking" was supposed to mean.

I'm afraid the name "call me not" has the same problem. I'm not sure what to suggest for a better one.

Feature-wise: seems like there could be a "social" / "groupware" kind of aspect to this. E.g., I can publish my schedule that might get abstracted down to "good times to call" for various groups of people, and the app can somehow just join those against my contacts list to automate .....

<comment><AUTHOR> Thanks for your thoughts dasht! I created this app mainly for my own uses to not call my girlfriend when she's in class, and initially when I went searching for such an app, the queries I used were similar to "reverse call blocker", and "outgoing call blocker", hence the title. That said I might change it to something else...

The "Call Me Not" app name I agree is confusing, but it sounded really catchy and a whole lot better than "Call You Not", so we stuck with it.

We did consider other groupware/google calendar approaches as well, but there was the question of implementation and the receivers' incentives to download the app and/or publish "don't call" times on their calendars. We ultimately decided on this approach for a first pass since it fit _my_ needs perfectly, at least. Completely changing the mechanics in later versions is not out of the question though, and will be based on valuable feedback we get from users like you =)

UPDATE: Title changed as per suggestion!

<comment><USER2> Best wishes and god speed. I'm glad you liked my comment. In terms of hooking it up to social/calendar stuff -- those also seem to me like the bright maybe- promising-if-the-thing-catches-on future, rather than 0.9 features, so to speak. I didn't mean to imply you need to do that right away (if that wasn't clear). (I can't give you feedback as a user since I don't have a phone on which the app can run.)

Also: "when to call" --- brilliant! perfect (imo).</comment></comment></comment>


Switzerland begins tests on the longest train tunnel in the world - <AUTHOR> http://www.railwaygazette.com/news/infrastructure/single-view/view/gotthard-base-tunnel-freight-tests-begin.html <comment><USER3> I wish the US had the transportation culture of Switzerland, in reference to a nice forward infrastructure.

All we have here are old diesel trains, crappy busses, and corrupt politicians and companies that tell us we can't have any better. And to add insult to injury, they keep raising fairs and increasing delays and down time.

<comment><USER4> In order to get shiny new trains and big public infrastructure projects like this, you need to pay a lot of tax, and this model does not go down well with the American electorate, generally speaking.

<comment><USER5> Im a dual US and Swiss Citizen. My taxes are lower in Switzerland. Of course I still have to pay the difference back to the US, but that's not the point. Switzerland has such a great infrastructure because they have been making steady, incremental investments over a long time. They accept that a project can have a very long payback period. Also, they invest to keep their infrastructure very well maintained, which keeps utility high and makes major overhauls less frequent, thus extending the duration that they benefit from their original big investment.

So I think you don't need high taxes, but rather a long term outlook and the will to execute it, across multiple election cycles. Boston's Big Dig is the most recent example of such a project from the US that I can think of.

<comment><USER6> US Taxes as a % of GDP: 26.9

Switzerland: 29.4 (or about 9% higher)

I obviously cannot comment on your particular tax situation but it is not representative of the country as a whole.

<comment><USER7> The average Swiss citizen will earn more than your average american - <USER2> swiss citizens will pay a smaller % on taxes than americans.

<comment><USER6> Um, no. 29.4 is > 26.9 no matter what the average earnings are.

<comment><USER8> Let me try to explain with a very very simple example why the average person might pay less, even though the average tax might be higher.

Person 1-10 make $10. Person 11 makes $100

Case 1, a flat tax of 30%

Person 1-10 pay $3, person 11 pays $30, for a total tax of $60 on $200 total income, that is 30%.

Case 2, a progressive tax of 1% on income up to $10, and a tax of 80% above that.

Person 1-10 pay $1, Person 11 pays 1% on $10 and pays 80% on $90 which is $72, a total tax of $82 on $200 income, a 41% tax!!!

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> This is a really cool tunnel! It's a single tunnel 57km long and the trains are all-electric. There was a nice comment thread a couple months ago: [https://news.ycombinator.com/item?id=10465597](https://news.ycombinator.com/item?id=10465597)

<comment><USER10> I wonder, what else would the train be other than electric?

<comment><USER11> Steam.

<comment><USER10> I am pretty sure you cant do that near any modern city because of the smog. Or sure you could, but not if you care about a nice city image.

<comment><USER12> [http://www.brienz-rothorn- bahn.ch/en/experience/railway.html](http://www.brienz-rothorn- bahn.ch/en/experience/railway.html)

<comment><USER10> This kind of proofs my point. This thing is a mountain train, there are not cities that could be considered big on the way at all. Its also a nice experience :)

</comment></comment></comment></comment></comment></comment><comment><USER13> I imagine such tunnel needs vertical vents every x meters or there would be funny air compression effects or rarified air issues?

<comment><USER14> They need a lot of airway and exit tunnels - and not just for compression effects - a tunnel can become a very dangerous place very quickly:

[https://en.wikipedia.org/wiki/Mont_Blanc_Tunnel#The_1999_fir...](https://en.wikipedia.org/wiki/Mont_Blanc_Tunnel#The_1999_fire)

</comment></comment><comment><USER15> 57km (35.4 miles) may sound impressive enough in isolation, but it's not until you start putting it into real-world context that you realize just how monumental a tunnel this is: Imagine driving any of these commutes _entirely underground:_

\- The Chicago Loop to Naperville (31 miles)

\- SF SOMA to Palo Alto (33 miles)

\- Midtown Manhattan to Perth Amboy (32 miles)

<comment><USER16> Living in Chicago, the Chicago Loop - Naperville comparison hit me....wow! That's quite an accomplishment.

</comment></comment><comment><USER17> The public transport in Switzerland is really superb, haven't seen anything like it anywhere else.

<comment><USER18> All neighbour countries have very similar public transport.

<comment> saiya-jin not true at all, I can attest French public transport for example is slow and basic compared to swiss one (apart from TGV trains, which covers just few main places). In Switzerland, you don't have to use car because train will get you there as fast/faster than car in most cases. good luck with that anywhere around unless you travel between train stations.

<comment><USER18> well, then _almost_ all neighbor countries.

France is a special case anyway, as it's road/railway infrastructure is very focused to connect everything with Paris as the center point.

</comment></comment></comment></comment><comment><USER19> Ah, they seem to have found a new use for the LHC tunnel :)

<comment><USER20> I guess they could use the train tunnel as particle accelerator during downtimes :-)</comment></comment>


Does Edward Snowden even exist? - <AUTHOR> http://www.washingtonpost.com/blogs/wonkblog/wp/2013/06/24/wonkbook-does-edward-snowden-even-exist/

<comment><AUTHOR> "Editor's note for the literal minded ... this column is not actually suggesting Edward Snowden isn't real. It's just a conceit to make a larger point."

<comment><USER2> Just what is that "larger point"? Is it that by revealing his identity and publicizing his movements, Snowden has shifted attention to his personal story, away from the issue of U.S. government surveillance? If so, I disagree with the point -- Snowden's story has, if anything, given the issue a more compelling narrative arc, and kept it in front of the public far longer than if he remained an anonymous whistleblower.

</comment></comment><comment><USER3> [http://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt](http://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt)

</comment><comment><USER4> > _There is, of course, only one explanation for Snowden's absence: He never > existed in the first place._

Please tell me I am not the only one who stopped reading here.

<comment><AUTHOR> If you had kept reading you would have seen "Editor's note for the literal minded: It is not, in fact, all too perfect, and this column is not actually suggesting Edward Snowden isn't real. It's just a conceit to make a larger point."

<comment><USER4> ... And that's what I get. Legitimately if I had read 3 more sentences...

</comment></comment></comment><comment><USER5> He doesn't exist as he has been portrayed.

He's a CIA burner, used to attack the increasing dominance of the NSA within the US intelligence apparatus. This is an internal battle.

The CIA is having its budget slashed, and field intelligence in general is getting cut. Meanwhile the NSA is doing a booming business (not to mention having its authority gradually increased toward military warfare, through direct intelligence and military commingling).

I think it's very arguable that next to the Department of Defense, the NSA is now the most powerful organization in the US, exceeding the power of the executive branch.

<comment><USER6> >He's a CIA burner, used to attack the increasing dominance of the NSA within the US intelligence apparatus. This is an internal battle.

Close. He's actually a stooge for the Illuminati. That's why the media is focusing on him instead of the NSA programs.

Actually he's a double agent working for Russia. That's why he wasn't on the plane.

Actually... he was slated to do this by the Bilderberg organization to create a new world order. I know this because he hasn't been apprehended yet.

How am I doing at creating baseless conspiracy theories based on circumstantial evidence?

<comment><USER5> I hope you're having as much fun with it as I did mine.

Fortunately mine is actually plausible. US Government agencies fight with each other 24/7 for funding and power.

<comment><USER7> rthomas6's is just as plausible if you believe that the Illuminati exist. And we're already talking about things that have no evidence to back them up, so why not?

<comment><USER8> I'm absolutely certain that a number of secret societies exist that call themselves Illuminati. Similar to the "Knights Templar" who surfaced in the 18th century, despite having no connection to the actual Templars.</comment></comment></comment></comment></comment>


[Nature] – AlphaGo Zero: Mastering the game of Go without human knowledge - <AUTHOR> https://www.nature.com/nature/journal/v550/n7676/full/nature24270.html <comment><AUTHOR> [https://deepmind.com/blog/alphago-zero-learning- scratch/](https://deepmind.com/blog/alphago-zero-learning-scratch/)

</comment><comment><AUTHOR> We are also doing an AMA on reddit tomorrow: [https://www.reddit.com/r/MachineLearning/comments/76xjb5/ama...](https://www.reddit.com/r/MachineLearning/comments/76xjb5/ama_we_are_david_silver_and_julian_schrittwieser/)</comment>


The Doomed Mouse Utopia That Inspired the 'Rats of NIMH' - <AUTHOR> http://www.atlasobscura.com/articles/the-doomed-mouse-utopia-that-inspired-the-rats-of-nimh <comment><USER2> "Did you know that the first Matrix was designed to be a perfect human world? Where none suffered, where everyone would be happy. It was a disaster. No one would accept the program. Entire crops were lost. Some believed we lacked the programming language to describe your perfect world. But I believe that, as a species, human beings define their reality through suffering and misery. The perfect world was a dream that your primitive cerebrum kept trying to wake up from. Which is why the Matrix was redesigned to this: the peak of your civilization." \- Agent Smith

<comment><USER3> Did you know that in the original version of the Matrix motion picture, humans were grown and plugged into the Matrix so that the AIs could use their brains for complex computation? I'm not sure why they changed the script to turn the people into rechargeable batteries instead of CPUs, but it was a really bad idea to do so.

So now I am imagining row after row of mice in little mouse chairs, wearing tiny VR helmets, organizing for a raid on the MegaMechaCat boss in the Mousecraft MMORPG.

It would be interesting to see if escapist recreation is necessary for a healthy high-density society. Purely for self-rationalization of my own gaming activity, you understand. Any scientific benefits would be purely accidental.

<comment><USER4> > Did you know that in the original version of the Matrix motion picture, > humans were grown and plugged into the Matrix so that the AIs could use > their brains for complex computation? I'm not sure why they changed the > script to turn the people into rechargeable batteries instead of CPUs, but > it was a really bad idea to do so.

They probably did it because test audiences (or maybe studio execs) didn't get the computation thing. If you watch the films, they really only changed it superficially to account for that, and lots of it only makes sense with the computation explanation, which even before I knew it was the original concept I assumed was the _real_ thing going on, and that "batteries" was a faulty conclusion reached by the free humans.

<comment><USER5> > a faulty conclusion reached by the free humans

I dislike that interpretation because it's really insulting to the intelligence of those humans. (Specifically the idea that they would conclude that as a group, with years of consideration. I'm not disparaging any individual that would find it plausible.)

<comment><USER4> Well, it was clear as far back as the first movie that the free humans were getting information from some sources that were, at least, idiosyncratic; by the end it was clear that much of their information was manipulated by the machines as a means of establishing control. So, while perhaps in some ways progressively more depressing, the "'coppertop idea' as free humans getting the fundamental nature of the situation wrong" explanation, I feel, isn't insulting, and is progressively more plausible as the series progresses.

</comment></comment></comment></comment></comment><comment><USER6> > But the public held on hard to his earlier work—as Ramsden and Adams put it, > "everyone want[ed] to hear the diagnosis, no one want[ed] to hear the cure."

 _Was_ there a "cure"? The article speaks of the fashion in which his later efforts attempted to alleviate the catastrophic social problems he'd observed in his earlier utopian designs. It is craftily silent on the subject of those efforts' results.

<comment><USER7> The paper they're citing mostly handwaves around the so-called "cure" as well, but that might really be for the best. It does have some more detail, though:

> In his early experiments in the outdoor pens, Calhoun had witnessed a > creative act by his rats that he likened to the discovery of the wheel by > man: when building a new burrow they did not simply dig out the dirt as they > went, as any normal rat would do, instead they packed it into a large ball > which they then rolled out. This innovation had not come from the socially > dominant animals but from a highly disorganized and predominantly homosexual > group of subordinates, partially withdrawn from the larger social > organization. As Calhoun saw it, the repression they had suffered at the > hands of their superiors had resulted in deviant, _creative_ , and thus > _adaptive_ behaviour. Inspired by this example, in his laboratory at NIMH, > Calhoun attempted to design rodent universes that would both _stimulate_ , > resulting in "creative deviants," and _ameliorate_ : removing the worst > excesses of crowding pathology.

Probably the most direct section is this:

> Through a variety of methods, such as operant conditioning and determining > which of the mice and rats could eat, sleep, live, with whom, he sought to > design ever more intelligent and collaborative rodent communities, capable > of withstanding ever greater degrees of density. Here, then, was the hopeful > agenda: if the wrong environment would drive us to destruction, perhaps the > correct environment would be our remedy.

> Calhoun suggested organizing scientists into a global, intercommunicating > network composed of independent but interconnected groups and sub-groups. > Only then could the necessary conceptual growth to avoid a catastrophic sink > be achieved. He claimed it was "toward a concern with science as a world > system which must be understood if the human race is to survive." He saw > these attempts to defer social pathology as the centerpiece and real import > of his work. Here was the profit, the positive signal from the noise of the > behavioral sink.

> It was in through this growth in conceptual space – enabled by the design of > new buildings, new technologies, new social and intellectual networks – that > humanity was presented with a more desirable future: what Calhoun called > "Dawnsday" in opposition to von Foerster's "Doomsday." All of mankind might > become part of a single "world brain," consisting of numerous and diverse > subsystems, each interlinked to, aware of, and dependent upon, the other.

[http://eprints.lse.ac.uk/22514/1/2308Ramadams.pdf](http://eprints.lse.ac.uk/22514/1/2308Ramadams.pdf)

<comment><USER8> > As Calhoun saw it, the repression they had suffered at the hands of their > superiors had resulted in deviant, creative, and thus adaptive behaviour.

Could it also be that the group was simply different, and suffered because it was different/non-dominant, but it was not the suffering that made them different to begin with? And getting away from the main group allowed them to do those things?

I would posit a utopia where there is such a thing as "dominant group" is not a utopia, after all.

Remember these guys? [http://www.nytimes.com/2004/04/13/science/no-time-for- bullie...](http://www.nytimes.com/2004/04/13/science/no-time-for-bullies- baboons-retool-their-culture.html?_r=0)

Groups of people interested in esoteric things who just want to be left alone... sounds familiar.

<comment><USER9> I think there always will be "dominant groups", as long as being in group is more beneficial than not being in one - simply because even an uniform random distribution is not perfectly uniform when you build it point by point.

<comment><USER8> A dominant group is not one that is merely more beneficial. If there's a rat park somewhere that has happiness level 5, and the other rat park has happiness level 6, that doesn't mean one is dominant over the other. It just means one has more happiness than the other. And in an effort to not cause too many paperclip maximizers, let's define some acceptable margin of difference at which it doesn't really matter who's happier, I don't think the world will explode and the philosophical arguments are seriously not worth it.

Dominance is something else entirely and I staunchly disagree that this strictly evolutionary construct needs to persist forever.

</comment></comment></comment></comment></comment><comment><USER10> _Most of the adolescent mice retreated even further from societal expectations, spending all their time eating, drinking, sleeping and grooming, and refusing to fight or to even attempt to mate._

Every time I read about these experiments, this is the stirring part. Individuals that appear to be the most fit just fail to mate for no apparent reason, yet they live as if they were always preparing for it.

<comment><USER11> Did anybody test the mice for physiological changes, and specifically reduced testosterone levels? In Matt Ridley's "The Red Queen", he mentions research about how low testosterone levels in both males and females cause this type of behavior.

Maybe there's an evolutionary adaptation that lowers testosterone production during times of high population, and in the artificial conditions of the experiment that adaptation exhibited itself too strongly?

That would also explain why mice taken out of the experimental environment didn't rehabilitate. There are other studies cited in "The Red Queen" that suggest that levels of testosterone are largely determined by the mother's environment and stress levels during gestation.

</comment></comment><comment><USER12> Calling it a "utopia" when there's limited space and nothing to do seems a bit inaccurate.

<comment><USER13> Rats and mice don't really do much except eating, breeding, hunting and socialising.

<comment><USER14> Interesting point but In its natural environment they do so much more. Search for the food, avoid weather, avoid predators etc. I think perhaps when those stresses are taken away it goes counter to their instincts and "wiring" causing problems.

<comment><USER15> I wonder what that could mean for us as humans. Is some degree of "strife" necessary in society for people to be happier?

Perhaps our work to eliminate many of the more primal issues that affect us (the need to hunt, survive in the wild, etc) are only making us worse off?

It would be interesting to hear more about this, as well as what the potential "cures" may be, as alluded to at the end of the article.

<comment><USER16> You'd probably be interested in the Unabomber manifesto. Most people think he was crazy, but he talked a lot about this stuff, especially his sections on "the power process," which is basically what you just described.

[http://wildism.org/rca/items/show/13](http://wildism.org/rca/items/show/13)

James Q Wilson, the guy who came up with "broken windows theory," said the manifesto was "a carefully reasoned, artfully written paper… If it is the work of a madman, then the writings of many political philosophers — Jean Jacques Rousseau, Tom Paine, Karl Marx — are scarcely more sane."

I wrote an article about the man a while back, so I'm always interested when ideas like this pop up. Here's the article: [http://dark- mountain.net/blog/ted-kaczynski-and-why-he-matte...](http://dark- mountain.net/blog/ted-kaczynski-and-why-he-matters/)

<comment><USER8> Reminds me of Dark Enlightenment. Unfortunately, in both cases, the promoters seem to need to antagonize rather large swaths of people, making it hard to sympathize with them in general, even if some of the arguments are interesting or reasonable.

<comment><USER16> There's some overlap with "dark enlightenment" stuff. Unfortunately that always tends to take on racial connotations because of the groups it originated in. Whereas the anti-modern conservatism I and others who generally agree with those kinds of arguments believe in rejects race as a modern concept made to suit modern purposes, not a basis to reject modernity.

And yeah, I used to write TK and he's hard to get along with. But I think a lot of his "antagonism" isn't personal so much as it is an attempt to stir up popular antagonisms, a propaganda of sorts. I can't ever be sure though. Guy's a mystery to me in a lot of ways. Super interesting though.

</comment></comment></comment></comment></comment></comment></comment><comment><USER17> These studies are naive in that they treat a species, mice, as a self- regulating unit. They aren't. No species exists absent other species. Mice have evolved alongside predators. Without predators, the external stimuli that has defined mice evolution, mice culture isn't sustainable.

This has direct application not only in dense populations but in our relationship with other species. Our bodies and our culture has evolved in the presence of rats, insects, dogs, cats and billions of bacterial and viruses. Isolation from these other species will doom us as it did these mice.

<comment><USER18> Of course. If in the experiment, they had simulated the effect of predators on the population and routinely culled the population to stay within some range, then probably the mice would have lived happily ever after generation after generation without any overcrowding and stressful effects. That entirely misses the point of the experiment.

Human beings in some societies are reaching the point where disease, fatal accidents, and similar stressful or population-reducing effects are minimized. For example, Silicon Valley. I'm not so sure though whether it is a utopia though. Physical living space, aka real estate, in SV is certainly at a premium.

And I've seen similar cases mirroring the study's "beautiful ones", the drinkers, and rowdy youths. There are parallels and insights to be drawn from these studies of mice and men.

<comment><USER17> I think it goes beyond population control. Simply removing the mice might not be enough. They have to see and fear the cat. Some have to be successful in avoiding the cat. They may develop behaviors and social order specifically to address the cat threat. Disappearing individuals randomly might have a radically unnatural impact.

With humans, it's also not as simple as population control. The presence of other species, even predators, is a cornerstone of our evolution and culture. We are afraid of the dark for a reason. We protect our kids from the unknown for a reason. We keep dogs as guards for a reason. A world truly without predators might result in very different culture. I'm often taken aback by how people who live in regions without large predators (UK, Japan) differ in their views on nature from those who walk beside predators every day (Canada/Australia).

Talk to a tourist on a beach about shark attacks. Then talk to a surfer. The former has strong opinions but isn't under any real threat. The later is often much more tolerant of sharks despite the increased risk (see Australia's shark cull debates). Even a slight but real risk of dangerous predators, imho, gives one a much greater respect for nature.

</comment></comment></comment><comment><USER19> This seems more like a "prison". The effects mirror incarceration perfectly.

</comment><comment><USER20> Malthusian catastrophes are one of the things that happen to communities that aren't smart and coordinated enough to banish Moloch. Whoop-de-doo.

([http://slatestarcodex.com/2014/07/30/meditations-on- moloch/](http://slatestarcodex.com/2014/07/30/meditations-on-moloch/))

<comment><USER21> Does this count as a Malthusian catastrophe even though the food was ample?

<comment><USER22> Limiting factors are the things you don't have enough of.

If food isn't constraining, it's not your limiting factor, something else is.

The general idea is expressed in Leibig's Law of the Minimum, from Justiz Leibig, a 19th century botanist.

This is why counterarguments to Malthusian philosophy based on showing that _some arbitrarily selected_ factor isn't constraining are moot. The question is, what _is_ limiting in the environment. And if growth has stopped, _something_ is constraining it.

</comment></comment></comment><comment><USER23> was just thinking about how much I despise the movie based on this book.

Possibly the best piece of children's literature that is explicitly about evolution, neuroscience and society, and they turn it into a woo-woo adventure about a MAGIC AMULET

ugh. Read the book. Buy your kids the book. Terrific book.

<comment><USER24> I have the audio book, but haven't listened to it yet. This just bumped it up to the top of my queue.

I felt the same way with Never Ending Story. And, as a kid, I loved that movie. Book was so much more, though.

Howl's Moving Castle was one where I actually had a hard time liking more than one or two scenes of the movie, because of how much I liked the book.

<comment><USER25> Oddly, DWJ really liked the Howl's Moving Castle film, apparently.

As a Miyazaki/Ghibli fan, I got into the film more than the book.

I still need to read The Never Ending Story. But yeah, the movie of Rats of NIMH was super disappointing to me.

<comment><USER24> I still overall liked Howl's. I just have a hard time rewatching it due to some odd choices. In particular, the odd "true love's kiss" for turnip head. Just, what?

<comment><USER25> If that's the only thing you thought was odd about it, you must not have been watching very closely :-).

I'm much more of fan of his other works, like Castle In The Sky, and Kiki's Delivery Service. And The Wind Rises. And the Cat Returns.

Okay, let's just pencil in that I like all of Miyazaki's work.

<comment><USER24> Ha! Fair, there are plenty of divergences. That one just struck me as particularly odd.

And I am generally a fan of Studio Ghibli. I specifically am not saying it is a bad movie.

<comment><USER25> Indeed. Although it's not as good as some of his other stuff.

</comment></comment></comment></comment></comment></comment></comment><comment><USER26> I'm actually working for a group that's talking about this problem right now. Their site's not up yet (i'm working on it) but here's a sneak peak.

They've narrowed it down to Daniel Kristoff's theory of "Genetic Rot", according to the behaviors observed.

● evolution is not perfect, each generation has good genetic mutations and bad genetic mutations

● the bad genetic mututations normally die off and are weeded out of the gene pool

● fighting for resources causes natural eugenics and the betterment of a population by only the best get food and the weak dying off

● the mouse experiment basically shows how communism caused ALL mutations to continue to the next generation both good and bad.

● untill eventually an uncontrolled pattern of defective genes plagued the mice and could no longer be weeded out. This is why mice taken out of the experiment did not recover.

● resource abundance caused individual mice who never should have reproduced to reproduce introducing their defect genes into the gene pool. (most animals get a huge decrease in population after a huge increase due to over-abundance of resources)

● the mice reproduced to a point until every single mouse had bad genes and could no longer save the population

● The mouse experiment mirrors what's happening in our society right now

Also, keep in mind this is a very sanitized version of the experiment. Somewhere out there is a complete list of behaviors observed, I can't find it but altasobscura doesn't talk about the controversial findings like "gender roles broke down" and "there was an increase of homosexuality" of the mice. Basically hinting that homosexuality, gender roles, and instinct are all heavily genetic based. And bad genes can often invert or flip instinct.

</comment><comment><USER27> It wasn't spelled out in the article, but in the movie NIMH is an acronym for National Institute of Mental Health.

</comment><comment><USER28> The bleakest and most compelling statement I have ever read comes from the "Death Squared" paper mentioned in the article:

"For an animal so complex as man, there is no logical reason why a comparable sequence of events should not also lead to species extinction. If opportunities for role fulfillment fall far short of the demand by those capable of filling roles, and having expectancies to do so, only violence and disruption of social organization can follow. Individuals born under these circumstances will be so out of touch with reality as to be incapable even of alienation."

Scary insightful, but hopefully not prophetic.

<comment><USER29> Interesting quote. Makes you think about phenomenons like young people from the developed world, highly educated, joining violent groups like ISIS.

</comment></comment><comment><USER30> No matter how grim the results are, I am amazed at the information. One tends to interact with other mammals in superficial ways. We see how sophisticated and not far from our own patterns they live.

</comment><comment><USER31> This paints a dark picture, not only for urban life, but for basic income. What wondrous creativity will be unlocked when we no longer need to work to survive? A negative amount, if you judge by the NEETs of today. Give a man food, shelter, and internet, and he'll kill himself for you.

<comment><USER32> Only because we don't take social currency as seriously as monetary currency. In a world where financial incentives don't matter, you'll have other incentives. We can see this in video games where people half-kill themselves to get some status or armor or whatever. Or how wealthy people take up charity work or compete on social status points like who holds the better parties or decorates the home better.

>if you judge by the NEETs of today.

I think its pretty obvious that NEETs are very much in denial, or have no access to, the mental healthcare they need. We also need to accept that a lot of people on the autism spectrum will end up as NEET-like and there's probably nothing to be done about it.

<comment><USER9> I would probably be a NEET (or barely E-human) if it wasn't for SSRIs, despite being a (I think) competent programmer who wrote code since being 13 years old. Medication lets me manage my disdain for what a typical human like me has to do to earn their bread - mostly pointless, mostly useless (or even socially harmful, hello ad world) stuff. I'm in tech, but I know some people who are close to being NEET and are on the more "artsy" side. I suspect some of that comes from lack of mental strength to handle the reality that you need to suck it up and waste 1/2 of your day, every day, doing stuff of dubious value, in order to stay a respectable (and fed) human being.

(In case you think this is just laziness, it's not - look at the hobby craft world. People can do a lot of hard, difficult work, as long as they have any say in what they do. It seems that a lot of people crave more _autonomy_ now.)

That's why I'm hopeful about basic income idea - it seems like a way to give more autonomy to people who do not have the grit to fight for it on the job market. A way to channel this untapped productivity.

<comment><USER8> Indeed, but I think also the mental strength tends to get sapped when the thing you're doing is pointless and/or socially harmful. Some people may delude themselves into thinking that their work is worthwhile even when it isn't. It's generally easier to live life when you think you're doing the right thing and everything makes sense.

</comment></comment></comment></comment><comment><USER33> . o O (Buzzfeed version of "The Secret of NIMH" \- learn about this one new battery Energizer and Duracell don't want you to know!)

And more seriously, it's sad that people weren't interested in his attempts to _fix_ it... which sound interesting even if they didn't work either.</comment>


Ask HN: What do we do with used electric cars batteries? - <AUTHOR> Hello HN! I am looking for information about what do we do with used electric cars batteries. Do we recycle them or we just put them on garbage dump? Thank you <comment><USER2> The first step is to fix other battery packs.

Usually when an eletric car battery goes wrong, only a module do so and you can replace the broken module and balance everything. So you can make good battery packs using bad battery packs.

Second step is to use the battery for something else that is less critical on energy density. If a battery pack holds only 50% of its original capacity, it's not very nice in a car but you can still use it for energy storage at home for example. Also if you have a 100kWh pack, you usually need 110kWh to "fill" it. But if for some reasons this battery pack deteriorates to 50kWh, you will need 55kWh to fill it. In other words, an old battery pack do not waste energy compared to a new one. It just represents a lower potential of energy. Of course you have things such as internal resistance so the efficiency may vary over time, but it's not an efficiency disaster.

Last solution is to recycle. It's not very developed because the amount of eletric car batteries to recycle isn't that high yet. Today a solution used at least in France is quite simple, you burn the batteries in a large oven and you keep the melted metals. You have to filter the fumes and the cobalt is lost. But you get lithium, that may be more expensive than lithium extracted from a mine. Another process I heard about is about crushing the batteries and filtering them instead of burning them.

</comment><comment><USER3> Sell them, People doing EV car conversions and home powerwalls generally snap them up as soon as they are listed. I doubt many go to landfill or re-cycling

<comment><USER4> Yeah they're great for grid stabilization and battery storage projects.</comment></comment>


Ask HN: Does Google decode bit.ly URLs? - <AUTHOR>

Is it a huge SEO mistake to use shortened URLs places?  I'm hoping Google is decoding the big name ones these days like bit.ly, t.co etc... But I can't find any definitive proof of this.  Does anyone know for sure? <comment><USER2> They usually use 301 redirects which all search engines follow to the destination site, passing along pagerank, link juice, etc. There is no harm in using a shortened link from the search engine's perspective, but there is a hit to branding.

<http://bit.ly/pages/help>:

 _bit.ly works by issuing a "301 redirect": a technique for making a webpage available under many URLs. When you shorten a link with bit.ly, you are redirecting a click from bit.ly to the destination URL. A 301 redirect is the most efficient and search engine-friendly method for webpage redirection, and is what bit.ly uses. Because bit.ly doesn't re-use or modify links, we consider our redirects to be permanent._</comment>