A (Manic Depressive) Man's Best Friend - <AUTHOR> http://opinionator.blogs.nytimes.com/2015/03/05/a-manic-depressive-mans-best-friend

<comment><USER2> Beautiful piece -- whether manic or not, after one hell of a stressful day, coming home to find your dog waiting for you really brings you back to reality.

Also, while reading this anyone else here reminded of the totems (the spinning top, weighted dice, etc.) from the movie Inception? Small objects that remind you what's real and what's only a dream.

<comment><USER3> _Beautiful piece -- whether manic or not, after one hell of a stressful day, coming home to find your dog waiting for you really brings you back to reality._

Yes, this. Cats can be stabilizing too. I can't be depressed around a cat. I haven't had a manic episode for several years so I don't know if cats have anti-manic properties or if I've just been lucky. But pets are great for mental health, no question.

His experience is different from mine. For him, the dog is a neutral character (a generally innocent animal of fairly average temperament) he has intense emotions toward, and he's begun to recognize that negative feelings toward the dog indicate a deteriorating mental state. For me, I rarely feel negative emotion for any animal except humans, and cats (and, to a lesser extent, dogs) are a stabilizer, a reminder that happiness (and not that fleeting manic kind) exists in the world. I'm pretty sure that one of my cats is a Zen master (except when in the presence of boiled or fried chicken).

<comment><USER4> Been thinking about whether I should get a pet. Some logistics, but also the M.I. like the guy in the piece. Not sure that the article helps my decision, but the comments here add some solidarity.

<comment><USER5> It's definitely worth a try unless you've got a very hectic schedule, or some abusive tendencies. Pets can offer a steady, simple and pure kind of love and companionship, and it comes with relatively few downsides (not very expensive, and animals are pretty up front about what they want out of the deal). If you get a shelter animal and it doesn't work out, you can take them back.

<comment><USER6> Pets are pretty dang expensive. Potentially thousands of dollars a year in vet bills, and hundreds in food, just to start. I had friends when I was a kid who had pets die because their parents couldn't afford vet bills (not very responsible to have pets when you can't afford to take care of them, but you can't tell someone not to have a pet any more than you can tell them not to have a kid). Among the people I've known, pets are quite probably the biggest nonhuman financial stressor - bigger than cars.

Shelter pets are not for everyone either, although avoiding pet store puppymill pets is obviously desirable.

<comment><USER3> _Shelter pets are not for everyone either_

Most shelter animals are just fine. I got two cats (bonded pair) from a shelter in August 2013 and they've been a dream. Shelter life isn't easy for animals, but it doesn't typically break them (a few handle it badly, but most are psychologically normal after a couple weeks in a new home).

You're taking a bet with any kind of new pet, but you're probably getting a healthier animal, on average, with a mutt from a shelter than if you get a breed animal, even from a "responsible" (i.e. not puppy-mill) breeder. The better shelters don't do _that_ much psychiatric damage, and most of it's not long-term. This idea that shelter animals are all psychiatric/behavioral basketcases is both untrue and very damaging.

I prefer no-kill shelters for finding pets. Part of it is selfishness (I don't like feeling like not choosing an animal will condemn it to death) and some of it is ideology (I don't agree that it's "euthanasia" to kill healthy feral animals; who are we to decide that they'd be better off dead?) but I also know that NK shelters (which source from "kill"/open-admission shelters, so you're still saving a life) are staffed by people who are experts (at least, relative to me) in selecting adoptable, healthy animals who are unlikely to have behavioral problems.

</comment></comment></comment></comment></comment></comment><comment><USER7> Good friends are always honest, and few people are more honest than dogs.

I'm a proponent of total honesty, and I have always found this quote from Brad Blanton inspiring:

"If you are in an ongoing relationship with any person there will probably be times when you hurt their feelings. Probably the most often used rationalization for lying is 'I didn't want to hurt anybody's feelings.' I recommend you hurt people's feelings and stay with them past the hurt. I also recommend that you offend people. We can all get over having our feelings hurt and we can get over being offended. These are not permanent conditions; they are feelings that come and go. On the other side of that reaction is a conversation in which your mutual honesty creates an intimacy not possible if you are hiding something for the sake of someone's feelings."

<comment><USER8> That prescription strikes me as useful only in the theoretical. Honesty is well and good, but telling your girlfriend you'd like to fuck her sister is not going to be good for anyone.

<comment><USER9> People always throw these crazy thoughts out there like they'd be expressed in a vacuum where everything else is perfectly PC whenever 100% honesty comes up. The thing about honesty to others is, as you settle into it, you find that the emotions running around in your head even out and the way you express them becomes less nuts.

You might be walking down the street with your girlfriend, and see a smoking hot girl come the other way. You turn to look, your girlfriend all but expects you to, she knows the kinds of girls you like because you've talked about it a dozen times before.

She might tease you about it or mock being angry, but she's not going to fly off the handle just because you expressed a sexual interest in someone that's not her. Any more than you would on her.

<comment><USER10> The few people I've met who operate with no filter or who profess to practice 100% honesty, come across as abrasive and unpleasant.

How does 100% honesty work with people in authority over you, and what about unpopular opinions. I'd wager most of us hold at least one opinion that would make us social pariahs.

If you tell your girlfriend about all the women you're attracted to, do you tell every attractive woman you meet that you're sexually attracted to her? I can't imagine that going over very well.

<comment><USER9> There's a difference between being 100% honest and having no filter. When I meet an attractive woman, I let it be known somehow that I find her attractive. I don't just stumble up to her and say "hi, you're so hot, wanna have sex?" I've found that there's a clear difference in the way I interact with women I feel attracted to and women I don't. I'm more playful, sometimes I'll even flirt if she seems receptive.

If we're in a setting where that sort of interaction is more or less expected, like a bar, sure I'll tell her that I'm attracted to her.

With authority and work, it's something you work on. Of course you don't want to tell your CEO that he's a fucking idiot when it comes to technology, but you don't want to be a doormat either. He's relying on your expertise, you need to be able to correct his incorrect views in an appropriate fashion. You can express displeasure but not disdain. You filter the expression of whatever emotion you're feeling, but you still express it.

100% honesty makes more demands on your amygdala than not having a filter. You have to become clearer about exactly what you're expressing and why. Precision when you're communicating negative emotions is paramount. You also have to be willing to apologize whenever you miscommunicate.

<comment><USER10> It sounds like by 100% honesty you mean: don't hide your emotions and go along with everything just to keep the peace, but make sure to express negative opinions tactfully, and keep thoughts that would cause too much trouble to yourself.

To me that sounds a lot like acting like an ordinary mature adult. I don't think what you're expressing is what most people mean when they talk about 100% or radical honesty.

<comment><USER9> I don't think most adults are mature, so I wouldn't call it ordinary. But it is still 100% being honest all the time. You still have a filter, but you're being honest about all the emotions you're feeling and what is motivating you to do any given thing. You can work to start to remove the filter too, this is called self-actualization. That's something different.

I think you need to be 100% honest with yourself before you start removing your filter or it won't work and you'll end up throwing out the baby with the bathwater. 100% honesty is as much about knowing yourself as it is about not misleading others. Only once you understand yourself and your motivations can you start to experiment with just saying stuff that's on your mind without thinking about it first. The things you say will clue you in on deeper motivations that you can then work on being honest with yourself about.

</comment></comment></comment></comment></comment></comment></comment><comment><USER11> Some doctor once told me you aren't really bipolar unless you tried to write a book at least once...</comment>


Ask HN: Sharing Phonegap localstorage data between devices? - <AUTHOR>

Working on a sensitive data app. The concept is that the content can be share between users or devices.
- Initial Approach: The content can be stored in the "cloud" or on my server similarly to Dropbox; anyone who have permission can access the data - distribute down to multiple users' devices.
- Second Approach: Since the data is considered very sensitive, it is recommended to be stored on the user's mobile.
1) So a copy of the data can be stored in the primary user's device.
2) The Unique Data ID and list of users (no content) can be stored on a database table in my server as reference.
3) Next user registered, calls upon my server; find the Data ID.
4) Extracts the copy from the primary user's mobile. Sends to the next user.
Problems:
- The primary user's device can be offline / out of battery; The next user will not get a copy.
- Any additional security issues in between?
- Missing any nuances that might make this inappropriate?
- Alternative approach? <comment><USER2> If your data is so sensitive that you do not want to store it on a central server then why not consider the PGP approach?

User 2 sends a request to user 1 (who has the data) sending his or her public key and asking for the data encrypted using the public key. User 2 then decrypts the message using his private key and makes his own local copy.

How do you communicate data changes between data holders - a version control problem perhaps?

<comment><AUTHOR> ^ One researcher recommended similar approach, the data stored centrally, and give other users access keys as the means of granting them permission to read those data. However the issue here, don't I end up 'storing' that access key as well? Unless its a password-type, where user have to remember and manually enter it every time...

He also suggest taking a push model (the central storage) rather than pull model (device storage).

I am still debating, and researching. Any other thoughts?

<comment><USER2> If you read up on the PGP idea you will see that storing people's public keys is not an issue - they may be broadcast to the world. The clever bit is that they are combined with a private key (that you do not store or exchange) to encrypt and ultimately decrypt any given message or data.

</comment></comment></comment><comment><USER3> I would recommend you to use PouchDB, its a similar approach, but in this case you use CouchDB as a database, it can be used offline and it syncs [http://pouchdb.com/](http://pouchdb.com/)

<comment><AUTHOR> This looks promising! Will definitely check it out.

This sounds like an example of Path where you can Like something offline, and will sync when you have internet access.

However doesn't solve the "who stored your data" privacy concern.</comment></comment>


Flippa Virgin: My First $3000 Sale Story - <AUTHOR> https://medium.com/@moskovski/flippa-virgin-my-first-3000-sale-story-a6d46b5e40a2#.u6exk0gx4 <comment><AUTHOR> I made a Mandarin learning iOS app, and after four months I sold it on Flippa for $3000. In this article, I'm describing my experience and share a lot of numbers.</comment>


Which is the weirdest programming language? - <AUTHOR> https://www.quora.com/What-is-the-weirdest-programming-language/answer/Saquib-Rais?share=1 <comment><USER2> Weirdest? This is just a lolcode derivative, isn't it?

What I found more amusing is [https://arxiv.org/abs/1703.10242](https://arxiv.org/abs/1703.10242) They even implemented a 2d N-body solver.</comment>


Swarm of 100,000 generators will produce power on demand - <AUTHOR> http://www.grist.org/article/2009-09-09-home-power-plants-project-unveiled-in-germany/

<comment><USER2> An example of pointing to the one big measurable thing "Hey, no big ugly power plant in the countryside" and missing the sum effects of 100,000 real actual people having these in their basements.

It will "save" money, but actually each of these 100,000 people pays $7,000 to get started (and then saves some on their bills).

It's innovative and the _best-case scenario_ looks good, but the many unknowns and places it could go wrong make it likely a mistake down the road.

<comment><USER3> The unstressed win here is the cogeneration. The waste heat is captured and used for building heat and hot water. That gets them the 92% efficiency number. On a CO2/(kwhr at the house) basis you can't beat that with centralized power plants.

<comment><USER4> Also, if they provision these households with something like the WhisperGen, then there's also a gain in efficiency from the use of a Stirling engine. There would also be a benefit from economies of scale. Right now Stirling engines are expensive because they are uncommon. Increasing demand for them would make their high efficiency cheaper, and therefore more widely available.

</comment></comment></comment><comment><USER5> Why on earth would they want _less_ nuclear power? And replaced with low- efficiency gas, too. Are they sponsored by the Russians or something? Because from an ecological point of view I don't really see any reason.

<comment><AUTHOR> You only run the numbers you need at any one moment, and you can power up/down extremely quickly. This gives you fantastic control over additional power.

<comment><USER6> There's delivery and demand advantage to decentralizing power generation. There's also a huge load balancing challenge associated with it.

<comment><USER4> These things can only deliver power to the local distribution node. As for load balancing, I don't think it's an insurmountable challenge to respond to the local distribution network's load. Microprocessors excel at this sort of thing. Install a large, over-sized hot water tank to the customers with this, and it's even easier. Install larger generators at local power-hungry businesses that also use hot water, and it's even easier.

</comment></comment></comment></comment><comment><USER7> Sounds like a generator repair man's paradise...

</comment><comment><USER8> _Gas plants have an advantage over nuclear power stations in that the heat produced by the latter is wasted, the DIW energy expert said._

And by the same reasoning, they have an advantage over solar stations... Reusing the heat will boost the efficiency a little (if you define it as pollution per kW/h generated), but it'll still be nowhere near nuclear power.

</comment><comment><USER9> What happens when Russia or Ukraine cuts off their gas supply again?

David JC MacKay has some better ideas on alternatives to micro-CHP. [http://www.inference.phy.cam.ac.uk/withouthotair/c21/page_14...](http://www.inference.phy.cam.ac.uk/withouthotair/c21/page_145.shtml)

<comment><USER10> My municipal power company has already implemented multi-stage gas-fired generation in its new power plant.

Fortunately, I'm in California, where the weather is warm, so ideal here would be to use waste heat from an air conditioner to pre-heat water.

</comment></comment><comment><USER11> This does seem to bank on the fact of the big Baltic Sea pipeline Russia- Germany coming into service.

I like the idea of a small power station, but if you are going to be paying $7,000 per installation, you might as well go solar or wind power(probably wouldnt generate as much power though).

<comment><USER12> Seems likely that the gas part could be abstracted out... once the rest is working ok. Then people could have a choice of putting in a solar or a wind generator... or having all three.

Gas lets them simplify the problem. Since the power generation is more easily controlled with gas, it makes the task less risky.

It's also a multiple use thing... people already pay for heating, electricity, and for hot water, so this thing does all that for them too. So you can spread the cost over those things, plus you get paid rent, and money every year depending on how much power you generate. Finally you pay less on your electricity bills.

As a bonus they get to pump money into a car company... which governments are wanting to do now to stop them dying. I wouldn't be surprised if there are government subsides people could get to cover the $7k too. Extending a mortgage for these things would be very easy to get as well.

A very sensible approach all around... a good first step.

</comment></comment><comment><USER13> Its like EC2 for power generation.</comment>


Rare All-Female Ant Society That Reproduces By Cloning Discovered - <AUTHOR> http://news.bbc.co.uk/2/hi/science/nature/7998931.stm

<comment><USER2> Following the blogspam chain, we get to <http://news.bbc.co.uk/2/hi/science/nature/7998931.stm>, which is much more interesting and informative. I would still like to read the original paper.

</comment><comment><USER3> spam.</comment>


Why Facebook sucks - <AUTHOR> http://www.scripting.com/stories/2007/10/13/whyFacebookSucks.html

<comment><USER2> Uhhh...maybe I'm missing something, but who cares about Facebook being an address book?

"Reddit sucks -- you can't use it to reserve seats at your local movie theater! You know what else you can't do? Thwart velociraptors. When is someone going to release a social news site which allows me, the user, to outwit a raptor? Google is, as usual, our only hope."

I dunno, maybe I wouldn't be so flippant if I had invented RSS and was, apparently, in constant contact with Robert Scoble ;)

<comment><USER3> The real point is that it doesn't give you control over your data while profiting off of it.

Others have said this in different ways before but it bears repeating.

<comment><USER2> Maybe, but the thing is...Facebook is pretty awesome.

I know that probably sounds a little juvenile, but that's the attitude that most of its users have. They could care less about having control of their data. The vast majority have no clue that Facebook could give them control of their data, and even if it happened they wouldn't know what to do with it.

"Hey neat, I downloaded my Facebook. I wonder if I'm supposed to play XML files in iTunes or Powerpoint..."

The only thing that millions of people _would_ (not could) potentially do with their Facebook data is: move away from Facebook, given a better alternative. I haven't yet seen a solid argument for why Facebook should open up that data. Maybe there are decent ethical/moral/rhetorical reasons, but none which make business sense for Facebook and the majority of their customers...

<comment><USER4> If it was possible to export that data there would be apps to help people to process it further. No need to stumble around in XML piles. Your "makes no business sense" argument is not even Web 1.0 ;-) It's the ages old argument that was brought forward wrt Office file formats, pre TCP/IP network protocols and an endless list of other lock-in strategies. Even Microsoft has shed that retro attitude to some degree exactly because it does not make business sense in the long run. You need third parties to build on your stuff and that means you must set the data free.

<comment><USER5> But people only _care_ when 3rd-party tools exist that they _can't use_. Right now, the ivory tower is okay, because the rest of the landscape is flat and barren.

<comment><USER4> I think people do care a lot about moving data between applications. There is nothing that comes up more often when end users need help. Today I was asked to move emails out of Mac Mail. Last month it was watch lists from a trading site to an Access database. Data silos are a huge problem and a productivity killer.

</comment></comment></comment></comment></comment></comment><comment><USER3> I'm hoping Facebook will acquire the same stigma that AOL, an older data roach motel/walled garden, did.

<comment><USER6> I think a facebook-aim comparison is far better than a facebook-aol one

aol instant messenger is still BY FAR the most popular im network in America

Geeks and hackers can sit here and say the world would be better if everyone used Jabber or some other open protocol, but it won't catch on because...

1) people like aim 2) their friends are on aim

</comment></comment><comment><USER7> I'm convinced that people who slate facebook haven't really used it. It is currently my most effective means of communicating with friends and family. And I don't think I've ever come across such a polished application before, web-based or otherwise.

<comment><USER8> He's not arguing that facebook isn't an effective means of communication or a good web-app.

His (valid) point is that users put all their information into facebook without being able to take it back out when they want. There's an imbalance there and it does suck.

<comment><USER7> Well the article is entitled 'Why Facebook Sucks'. I personally don't agree that the point is valid. What you have in Facebook is a list of contacts for other Facebook users. It wouldn't be that useful outside of Facebook.

<comment><USER9> The author admits the title is not precise:

 _PS: When I write about it, I do it crudely, saying they suck or don't. When Doc Searls writes about it he calls it Vendor Relationship Management. Doc writes so elegantly because he is a research fellow at Harvard University._

</comment></comment></comment></comment><comment><USER10> What about the API? It wouldn't be at all hard to make a "Facebook-exporter" application using that. The question is: why would I bother doing that? Facebook is crap as an address book, it's the other bits that are useful...

Whatever other reasons there are to think Facebook sucks I don't think this is one.

<comment><USER11> It's against the TOS to export data using the API.

<comment><USER10> Ah, then ignore what I said before.

</comment></comment></comment><comment><USER12> Most college folks would celebrate if all the Winers of the world abandoned facebook.

<comment><USER13> Not clear. What do you mean?

<comment><USER12> 99.9% of facebook users don't care about how "open" facebook is--until it remains a very useful social tool.

<comment><USER14> So because a majority doesn't care, we're not allowed to critically assess Facebook's shortcomings or voice our opinions over its policies?

Winer is simply stating his opinion and pointing out the lack of openness when it comes to Facebook's data.

<comment><USER12> If Winer was stating his opinion, so was I:)

Perhaps I should have been more clear: I think facebook is pretty open, I don't think there is an immediate need for facebook to make it easy for users to move to other networks.</comment></comment></comment></comment></comment>


[Monzo] Announcing Our New Investment Round of £71M - <AUTHOR> https://monzo.com/blog/2017/11/07/investment-announcement/ <comment><USER2> While investmensts are important, I'd rather see Monzo focus on becoming sustainable and profitable, so no shadow of investor expectations would lure over them.</comment>


Iran Just Released Classified Footage Decoded From A Captured US Drone - <AUTHOR> http://www.businessinsider.com/iran-just-released-classified-footage-decoded-from-a-captured-us-drone-2013-2

<comment><USER2> Suppose it was encrypted, how hard to brake would a reasonable, in this case on board, encryption be? I find it interesting, that Wikileaks was also able do decrypt the US Military video of the killed Reuter journalists.</comment>


Want a job working on mongoDB? Your first online interview is in this post  - <AUTHOR> http://maxschireson.com/2011/04/23/want-a-job-working-on-mongodb-your-first-online-interview-is-in-this-post/ <comment><USER4> Here's a sketchy description for a possible solution.

The easy part is that we know that if x and y are the missing and duplicate indices form vector V then we have:

        |x-y| = |sum(V) - (N*(N-1))/2|

So far - constant space and linear time. From here it's either cleverly (linearly!) scanning the vector or similarly concluding something else about the vector and crossing that info with what we have ;)

<comment><USER5> This is close to the solution I had in mind, however summing lots of 64 bit integers probably yields a huge number that overflows, so some Bigints (which are comparatively slow) or clever hackery might be required to mitigate that.

<comment><USER6> That's not (EDIT:) space-constant.

<comment><USER7> The sum is guaranteed to fit into 128 bits

</comment></comment></comment></comment><comment><USER8> Pretty easy.

Compare the sum with the expected sum. Compare the sum of squares with the expected sum of squares.

Two equations, just solve them. I wrote the final equations in the blog comments.

<comment><USER9> You can't solve these equations (at least in the general case, maybe there's some clever way in this specific case I'm not getting), because the ring of 64-bit integers is not a factorial ring, meaning not every multiplication can be undone. That is, if xy = z, there might be multiple y's for a given x and z. (Edit--previously I had said it's because it's not a field, but that's a stronger condition than we need.) If the sum is 2 and the sum of squares is 0, then (1, -1) and (2^63 + 1, 2^63 - 1) are both solutions.

You could do this solution using the field of bitfields modulo a 64-bit irreducible polynomial, but I expect that's over the heads of most interviewers :P

(edit: just realized that you can do the neccesary field multiplication and addition very quickly in constant time and space. It's even linear in the number of bits you have to process. This looks very close to an ideal solution, so I posted a link on the blog. There may be a clever solution that is better.)

(edit #2: the clever solution is just to use bigints. The sum of squares is guaranteed to fit in 192 bits. This might be what the parent poster meant all along. This works because integers are a factorial ring, so the equations are guaranteed to have a unique solution.)

<comment><USER10> Simpler to do the arithmetic modulo a prime just smaller than 2^64 if you ignore the case where n is very close to 2^64 (which should be fine in real life). In case you leave your code will be easier to maintain than if you bring Galois Fields into it.

I was kinda expecting the bigint solution though.

\-- Max

</comment></comment></comment><comment><USER11> This seems to work (in Ruby):

      def find_missing_duplicate(seq)
        sum = seq.reduce(0, :+)
        corrsum = (seq.size*(seq.size+1))/2

        sumpow = seq.map{|i| i*i}.reduce(0, :+)
        corrsumpow = (1..seq.size).map{|i| i*i}.reduce(0, :+)

        diff = sum - <USER2>
        diffpow = sumpow - <USER3>

        seq.each do |i|
          miss = i-diff
          if (i*i - miss*miss == diffpow)
            return miss, i
          end
        end
      end

And here's some code to test it:

      MIN_N = 2
      MAX_N = 1000

      (MIN_N..MAX_N).each do |n|
        duplicate = missing = rand(n)+1
        duplicate = rand(n)+1 while duplicate == missing
        seq = (1..n).map{|i| i}
        seq[missing-1]=duplicate

        miss, dup = find_missing_duplicate(seq)
        if !(miss == missing and dup == duplicate)
          $stderr.puts "ERROR: expecting #{missing}:#{duplicate} got #{miss}:#{dup}"
        end
      end

</comment><comment><USER12> Here's a solution in Go.

        package main

        import (
            "fmt"
        )

        func main() {
            // a is the sample array
            a := []int{0,2, 3, 3}

            // Reorder values such that a[i] == i when i is not the missing value.
            for i := 0; i < len(a); i++ {
                j := a[i]
                k := a[j]
                a[j] = j
                a[i] = k
            }

            // Look for a[i] != i
            for i := 0; i < len(a); i++ {
                if a[i] != i {
                    fmt.Println("missing:", i, "duplicate:", a[i])
                    break
                }
            }
        }

This is a simple expression of a solution. The code can be improved.

<comment><USER12> Oops, the problem statement says that the array cannot be modified.

</comment></comment><comment><USER13> (EDIT: this doesn't work, as lisper pointed out below)

I haven't worked out the details or explicitly proven that this will work, but I think the following algorithm should do it:

1) Count up the number of even numbers in the list and compare it to the number we'd expect if the list was "right". This will either be correct (in which case both missing and dupe are even, or both are odd), high (the missing one was odd and the duped one was even), or low (the missing one was even and the duped one was odd).

If high or low, we've just pinned down the last binary digit of each of the numbers.

If even, the digit remains in an unknown state.

2) Slice off the last digit.

3) Repeat 1) and 2) for all 64 bits.

4) Now we have our missing number in the form 001001x1...xx01x (64 bits worth), where the x's represent digits where the missing number's digit matches the duped one.

5) We know the difference between the missing and duped numbers because of the triangular sum formula N(N+1)/2. Use that to solve for the xs in the missing number. That equation will _not_ be possible to solve in general, but the statement of the problem here assures us that it will have a solution; further, I'm pretty sure that as long as the duped and missing numbers are not equal, that solution will be unique (EDIT: it's not, and this method doesn't work at all :P ).

Maybe I'm missing something, though? Haven't thought this through too deeply...

<comment><USER14> That doesn't work. Consider the case where the missing and dup differ by 1.

<comment><USER13> D'oh, you're absolutely right, the solutions aren't even close to unique. Good catch.

</comment></comment></comment><comment><USER15> This is the solution I posted there:

Called the missing number m, duplicate d.

The main idea is to find m+d and m-d. Then it's trivial to find m and d.

1) Find n XOR d:

       X_array = 1;
       I_array = 1;

       for (i=2..N)

          X_array = X_array XOR A[i]; I_array = I_array XOR i;

       endfor

Then m XOR d = I_array XOR X_array

2) Find m – d

It will be a little bit more complicated. The idea is to get the sum of (1..N) subtract the sum of our array. But we have to be careful not to over or underflow the result.

       Diff = 0;

       i = j = 0; // i index I, j index A

       while (i < N) && (j < N)

         if (Diff + i < N-1)

             Diff = Diff + i;

             i++; //consume one in I

         else

             Diff = Diff – A[j];

             j++; // consume one in J

         endif

       end

// Need some corner case check here to but I will omit

3) So we have (m XOR d) and m – d. Also, note that m XOR d is basically m + d without the carry bit so it will be trivial to get m and d.

running time : 3 N <\- can be squeeze to 2N if merge the two logic

space : O(1)

<comment><USER11> >note that m XOR d is basically m + d without the carry bit

This isn't true. XOR is addition without any carry bits so there are several solutions that have the same XOR and difference

<comment><USER15> There are at most 2 solutions: if m XOR d = a then either m+d = a or m+d = a+N.

With the combination of m-d = b, you will find m and d.

If both of them satisfied ( remember m and d are bounded by 1 and N) then we actually have two solutions.

<comment><USER11> Here's a counterexample.

Sequence is [1, 2, 3, 4, 6, 6, 7, 8, 9, 10] so m = 5 and d = 6

      diff = 5-6 = -1
      xor = 5^6 = 3

      1-2 = -1
      1^2 = 3

      5-6 = -1
      5^6 = 3

      9-10 = -1
      9^10 = 3

So three different combinations, within N, that obey the two constraints

<comment><USER15> OK. I think I find a way around.

Assume d XOR m = a. Find k = position of the first bit (from MSB to LSB) in a. Then d + m can be in [a + 2^(k+1),a + 2^(k+2),...,a + 2^63].

We will have less than 63 cases. In each case, after we find d and m, make sure they are in range and then linear test.

So in the end, we may need to run at most 63+3 = 66 N. But it still linear though.

</comment></comment></comment></comment></comment><comment><USER16> Since the list consists entirely of 64-bit integers, there's a trivial linear- time solution:

      for x in [0..2^64)
        count = 0
        for i in [0..N)
          count += (array[i] == x)
        }
        number[count] = x     // 0 <= count <= 2
      }
      print "missing: ", number[0]," duplicate: ", number[2]

</comment><comment><USER15> One of my friend came up with this solution:

m is missing,d is duplicate. I is 1..N, A is input.

Step 1: Compute m XOR d by XOR all values of A and I together. let say x = m XOR d. Then x must has at least one 1 bit (or else m == d). Call the bit p. So now we can separate A into two list A0 are those with bit p == 0 and A1 are those with bit p == 1. So we have separated m and d into two different list.

Step 2: Iterate through I, maintain two number x0 and x1 as the results of XOR operations of those elements with p bit == 0 and == 1 respectively. Do the same for A to get a0 and a1. Then we know that m is either a0 XOR x0 or a1 XOR x1. One more linear test in A to confirm the missing element m.

In the end, the running time can be squeezed into 2 N. space = O(1).

</comment><comment><USER17> I wonder if a Bloom filter would allow you to (probably) identify the missing value and the duplicated value.

Create a Bloom filter on your array, one element at a time. For each element, test whether it is present in the set, and then add it to the set. By testing whether the element is already in the set, you identify the _duplicated value_. After creating your complete Bloom filter, then test integers 1 to N to see which is not in the set; this is your _missing value_. I believe this should be constant space and linear time.

Above I said "probably" because there are false positives (though not false negatives).

</comment><comment><USER12> This was a common Microsoft interview question in the 1990s. The answer is probably easy to find on the inter-tubes.

</comment><comment><USER18> Not sure if this is what's being discussed in the comments already, but it seems like you should be able to XOR all the numbers in the array, and then compare that to the XOR of all the consecutive numbers (which will xor to 0 if n mod 4 == 3).

<comment><USER19> This only works if you are simply missing one value, in this case the problem is presented that one number is missing and one is duplicated.

(xor-all data) xor (xor-all Range-1-N) = missing# xor duplicate#

Simply knowing that last xor won't let you determine the actual values of missing# and duplicate# (just as the same thing with sum will end up giving you the difference between them and not their actual values).

<comment><USER18> Interesting you should say that. What about having both the sum and the xor? Then it's two equations, two unknowns. That should be enough to solve for it...

<comment><USER19> I actually posted a reply to this above, knowing both the sum and the xor is not sufficient to determine the two variables.

Consider a situation where you know that (a xor b) = 1 and (a - b) = 1. Both a missing 2/extra 3 and missing 4/extra5 and any 2^N/2^N+1 are solutions to that equation.

Just because you have two equations and two unknowns doesn't necessarily mean you end up with a single value for each except in certain circumstances (eg they are linear equations of full rank).

</comment></comment></comment></comment><comment><USER20> Python solution. <http://pastebin.com/KyFTXpEr> O(N) / No additional arrays

</comment><comment><USER21> bitmap, one extra int and some bitfucking at the end to get the zero bit.

<comment><USER21> Hm, 2^64 bits is rather more space than I thought...

</comment></comment><comment><USER22> This site is flagged as "Sites likely to contain little of no useful content" by my Universities web filtering software.

<comment><USER10> curious what algorithm you use to determine that. i personally think my blog has useful content. maybe because i talked about a job it looks like just a job board?

\-- Max

<comment><USER22> I'm not really sure to be honest. Job boards and such things are not blocked. I've never this category before. It's not blocked; it's just flagged.

edit: just noticed it has a secondary category as: "potentially damaging content"

<comment><USER10> Is it hacker news that's potentially damaging or my blog? If its my blog I'm kinda flattered :)

(Would rather be "potentially damaging" than useless)

\-- Max</comment></comment></comment></comment>


Ask HN: How not to be pessimistic, helpless, and more - <AUTHOR> What has worked for you:
I've noticed that it's mostly the base feeling that dictates your logic and not logic dictating the emotion. Basically if you are feeling a certain way, i.e. helpless, your brain will find dozens of examples and create a very logically convincing story that would reaffirm your feelings by cherry picking certain events/facts from the past and concerns about the future. It's like a fog you can't see past at all until you are not feeling that way.
stuff like: avoid carbs to get used to low state, Write few gratitudes daily forcing good facts into emotion driven equation and messing it.
Qualities I'd like..
1. Be less pessimistic - or be more excited about things. I'm really considering fasting and dopamine fast. Maybe I've been overly stimulated that I no longer find anything exciting/worth it.
2. Be driven by the plan - not how i'm feeling. Omg seriously why the heck can't I just do what I think should do. It's like dealing with a baby who wont listen. But baby is also in control of your energy levels and focus.
3. Conquer myself - I feel I have violated every goal and promise I've made to myself. Like a ship with Math.random() inside a while loop, I've no control.
4. Stop being sorry all the time - I've gotten better in this category, basically it's reminiscing the past all day while completely ignoring good things now & not utilizing the opportunities now.
5. Not be afraid of doing - infinite ways things can go wrong. Paranoia has been helpful at times, but I'm sure it has also prevented me from even attempting many things due to stress of having to make something foolproof. It's not loss aversion more like aversion to being regretful, thinking requires time and I'm always backed up on thinking part.
6. Be excited about something for more than few hours - I get an idea, next day I don't give a shit. Facts hasn't changed. I'd rather just watch 20 episodes of something..
continued.. <comment><AUTHOR> Things that have helped me..

\- sleeping consistently at the same time, with air circulation and no noise.

\- walking daily

\- being in a social group where everyone is working toward the same thing. i.e. Startupschool, not the build sprint.

\- not eating after 6-7pm -> sleep better.

\- brushing teeth twice, surprisingly I feel way more positive, might be something to do with gums inflammation, I read a study linking gum disease with Alzheimer so this could be a thing too.

\- Not being on reddit, linkedin, hackernews... news in general. Not because they are negative, because you're always in consuming state, never in thinking stage. State of distraction.

\- audio books don't help.

\- reading doesn't help.

\- writing seems to help a bit.

\- I read a tip in book saying that motivation comes from a fact that you are in control. So do things daily that take low effort and have an impact. It slowly builds up solid belief in you that yes you are in control.

\- Traveling by a car to somewhere for at least few days.

\- Watching or listening to a good long story till end.</comment>


Without Dennis Ritchie, there would be no Jobs - <AUTHOR> http://www.zdnet.com/article/without-dennis-ritchie-there-would-be-no-jobs/ <comment><USER2> I love the comment that says w/o Dennis Ritchie's mom there would be no Dennis Ritchie. Without Grace Hopper... Without Ada Lovelace...</comment>


Nasa wants to land astronauts on Mars by 2033 - <AUTHOR> https://www.cnn.com/2019/04/03/us/nasa-mars-mission-2033-scn-trnd/index.html <comment><USER2> And I want to be 35 again. Both of those things are not going to happen.

The technology, funding, and skills required no longer exist. The US would have to move the whole defense budget to NASA to secure enough funding, and there is not the reservoir of skills in manufacturing or piloting that once existed.

As proof, I give you the fact that the US has not been able to send astronauts to the ISS without Russian assistance in the last 8 years since the space- shuttle was discarded. (Plenty of time to build a new, temporary space-shuttle if the ability still existed.)

As well, there is not enough time available between now and 2033 to build the entire space-technology industries from scratch to full production.</comment>


Ask HN: Company 'monoculture'? - <AUTHOR>

In this post http://news.ycombinator.com/item?id=3670014 , the commenter described Google as having a 'certain monoculture'.
Do developers within big companies (or I guess within units of big companies) have such a 'monoculture', i.e. people are  pretty similar in some respect?
As someone who works at a small company, I'd be interested in what types of cultures exist.
Any ideas how cultures become defined? (I would guess at hiring similar people, working on similar technologies, office environment...) <comment><USER2> This is a very interesting topic. It involves a crucial question about the impact of 'the company culture' in its success or failure. We usually hear that X company has X kind of culture, and the usual advise is something like 'setup the right culture or you will be dead'. However, when I hear 'monoculture' I cannot avoid imagining dystopic landscapes (as in Philip K. Dick's stories or Huxley's Brave New World). Because uniformity kills creativity and is counter-human. But usually, companies try to foster the right attitudes and key values towards work, what, I think, is radically different than a monoculture. In that aspect, the recruitment job is the main filter in order to avoid what you don't want in your company and set the 'right culture'. But also established processes, rules and etiquette set the company's 'culture', besides people's previous bagagge. In the worst scenario, you have no shared culture at all, which may impact in your performance, given the lack of tunning between different teams or within a team. That was my experience in one of the big names of the PC industry. The culture was some kind of random result of inherited practices, new hirings and a bit of wilderness due to the lack of real policies towards a positive culture. And I think this is in some way inherent to big companies, as it is very hard to reach every employee and it's also hard to find so many people that shares their core values (aside of their professional skills). So, in a few words, I just saw different subcultures struggling to make their point of view stand. Which sounds much like 'survival of the fittest'. Even though, I must say, I made there some really true and great friends.

I hope the answer contributes to the discussion.</comment>


Volvo Promises Uber Fleet of 24,000 Self-Driving Taxis by 2019 - <AUTHOR> https://www.wsj.com/articles/volvo-promises-uber-fleet-of-self-driving-taxis-by-2019-1511184730 <comment><USER2> Volvo has promised to sell uber cars. That's pretty much the gist of it.

Uber got a fleet quote, attached the words self-driving car to it, then issued a press release.

Volvo's part in the self-driving car is that their cars meet the minimum specs for uber's program, which are probably more stringent than "must have 4 wheels" and yet still falls far short of "must have a lidar system accessible through an api".

<comment><USER3> > falls far short of "must have a lidar system accessible through an api".

Source?

<comment><USER2> > which are probably

<comment><USER4> That probably only applies to the words until _and_.

<comment><USER2> I'm friends with the guy who wrote that sentence. He says that my interpretation is correct.

</comment></comment></comment></comment></comment><comment><USER5> We'll probably see more and more fluff pieces as Uber heads closer to its IPO date. Last week, there was flying cars

<comment><USER6> Any bets on the next sharks they'll jump?

\- Uber phone OS

\- Uber IoT platform for cities

\- Uber edge computing on smart cars

<comment><USER7> Uber to buy 24,000 self-jumping sharks.

<comment><USER8> I like that one!

</comment></comment></comment></comment><comment><USER9> _Beginning_ in 2019, and not _by_ 2019\. Big difference.

</comment><comment><USER10> I'm won't be surprised to see self driving ubers within a few years, however I'll be amazed if I see _driverless_ Ubers.

This is why I think at launch these will have non-drivers at the drivers seat smiling and ready to take over if the AI refuses. These drivers will have to drive less and less, and will eventually be remote operators. How they will get any economy in that I don't know - I'm cynically thinking they will be doing telemarketing while idling behind the wheel.

<comment><USER11> Why not have the passenger be the one in the driver's seat ready to take over in an emergency?

<comment><USER12> If you need to have someone with a driver's license in the driver's seat at all times this seems more like a replacement for zipcar, not uber.

</comment></comment></comment><comment> Digit-Al Has anyone considered the possibility that people won't want to trust their lives to self driving cars? We've had self checkouts at the supermarket for ages now and they still give problems with unusual situations. When people think of the infamous "please put your item in the bagging area" might they not get nervous about trusting their life to soemthing else autonomous?

<comment><USER13> Those damn things give me problems in totally usual situations, let alone unusual ones.

<comment><USER14> Most of those kinds of bagging systems have gotten much better about the whole "detection of bagging."

However, most of the time, the issue with self-checkout is the _HUMAN_ , not the machine. Several extremely busy grocery stores near me ripped out self- checkout systems because it affected throughput too much. They went back to cashiers because the cashiers are A) faster and B) capable of judging situations for throughput ("Um, grandma, really, we don't need you to take 5 minutes to find two pennies for that $20.02 grocery bill. Have a nice day. NEXT!")

Amazon, unusually, has this one right. A self-checkout system _CANNOT_ rely on the customer doing anything right.

<comment><USER15> Having a few self-checkout stations in a grocery store is generally OK if they're effectively for people who have dashed into the store to pick up one of two barcoded items. They're horrible when the store has used them to replace most of their cashiers because they're slow to use for a lot of items, are very slow to use for produce, etc.

I still find detection of bagging is often a pain with self-checkout. I expect things are set up to err on the side of falsely detecting potentially unpaid items.

Perhaps, at some point, vision systems will make it easier to not require cashiers but it doesn't work all that well today for large supermarkets.

</comment></comment></comment></comment><comment><USER16> The XC90 comes with a pretty good LKAS and ACC system, having recently test driven every car in that class, I can say it's the best one for under $60k (Highlander is pretty good too). But there's no way that Uber is going to be using the stock system for self-driving.

<comment><USER17> Spinning lidar on the roof doing live around-corner mapping being primary visible addition at least

</comment></comment><comment><USER18> tl;dr:

Volvo :"We'll be happy to sell you 24,000 of this particular model that happens to be drive by wire"

Uber: "thank you for selling us 24,000 self driving capable cars"

</comment><comment><USER19> Here's a link that doesn't hit the paywall: [https://www.wsj.com/articles/volvo-promises-uber-fleet-of- se...](https://www.wsj.com/articles/volvo-promises-uber-fleet-of-self-driving- taxis- by-2019-1511184730?shareToken=st3e601f5e2bd046d39f234492ca5ce5c5&reflink=article_email_share)

For anyone sharing from the WSJ, you can "email" an article to yourself from the left rail on desktop and use the emailed link to share with friends.

<comment><USER3> FYI I can't read the link above

<comment><USER20> Try [https://www.facebook.com/flx/warn/?u=https%3A%2F%2Fwww.wsj.c...](https://www.facebook.com/flx/warn/?u=https%3A%2F%2Fwww.wsj.com%2Farticles%2Fvolvo- promises-uber-fleet-of-self-driving-taxis- by-2019-1511184730%3FshareToken%3Dst3e601f5e2bd046d39f234492ca5ce5c5%26reflink%3Darticle_email_share&h=ATMNIDevY8qlJeHJZw1DZpWqU32sHbVZtgc6xsA- HuU2vtvQmkjAJzR_n3iFpBy0_9FLSlghipuhmAQqI6NvBM5DvXZf-dSxwyLzqqI&_rdr)

(facebook link)

</comment></comment></comment><comment><USER21> Wonder how well they will do with flooded roads. Will they turn around and not drown.

My significant other is a lyft driver, the other night she had a drunk rider and he became unresponsive. And fell on the flood of the van. She had to stop and check him. Get back back into his seat and at his destination go knock on the door for people to come get him. Would the driverless car do all that?

How well are the on snow covered roads as well? Anyone road in one is heavy snow like conditions?

<comment><USER22> I don't get in an Uber with the assumption that the driver will be able to tell if I've suddenly died and take me to safety.

<comment><USER23> Okay, but making that assumption is maybe marginally better than driving drunk?

</comment></comment></comment><comment><USER24> Hidden behind a paywall, is it possible to get a mirror? I'm curious to see if it will be self-drive or assisted driving. Volvo thinks they can create the tech and mass produce 24,000 in the next 2 years, so how's their progress so far?

<comment><USER25> By William Boston Updated Nov. 20, 2017 12:22 p.m. ET 71 COMMENTS

Volvo Cars said it has agreed to supply Uber Technologies Inc. with a fleet of 24,000 self-driving taxis beginning in 2019—one of the first and biggest commercial orders for such vehicles.

The deal between Volvo, owned by China's Zhejiang Geely Holding Group Co., and Uber was disclosed Monday as a framework agreement without financial terms. Such an order, though, would account for about 4.5% of Volvo's current total sales, based on 2016 figures, and is estimated to be worth just over $1 billion, a person familiar with the situation said.

The automobile industry and many big tech firms have promised broad deployment of robot cars in the near future, but all of the technology, regulation and legal framework needed for the practical use of such vehicles aren't yet in place. Still, industry executives have predicted with more and more confidence that companies could have such cars on the road in a matter of years, not decades.

Other car makers have inked smaller, less specific deals to develop and produce autonomous cars, but Monday's agreement represents one of the most concrete deals between two big players in the field for the production of a large number of real cars. The promised delivery date--as little as two years away--is also one of the first hard, deadlines that a significant automaker has set for rolling out a working model.

Volvo has had a long-running partnership with Uber to develop self-driving cars, though it hit a setback earlier this year. Pilot projects around the U.S. were temporarily halted after an early version of a Volvo-Uber-developed vehicle flipped on its side after an accident in Tempe, Arizona. Police said the incident was caused by a human driver of another vehicle, not the Uber self-driving car.

"We believe this is a new segment, a new business," said Volvo Cars Chief Executive Hakan Samuelsson. Jeff Miller, Uber's head of auto alliances, said the agreement "puts us on a path towards mass produced self-driving vehicles at scale."

Under the agreement, Volvo will supply Uber with what Mr. Samuelsson called a "base car," based on Volvo's popular XC90, a luxury sport-utility vehicle that seats up to seven passengers. Delivery of the vehicles is set to begin in 2019, with Uber calling up vehicles each month through 2021.

"The base vehicles incorporate all necessary safety, redundancy and core autonomous driving technologies that are required for Uber to add its own self-driving technology," Mr. Samuelsson said. "Uber will adapt the software to make it ride-hailing."

The first taxis from the deal will be built in Volvo's factory in Sweden. But the company plans to produce the vehicles in the U.S. as well, where Volvo is building a new factory just outside Charleston, South Carolina.

The current version of the XC90, which is available for sale today, already includes advance autonomous features, such as systems to keep the car in its lane and maintain the proper distance to another vehicle traveling ahead. It also features collision avoidance that helps prevent low-speed fender benders in stop-and-go traffic.

Other car manufacturers are racing to develop their own models of self-driving vehicles, often in ventures with parts suppliers and big technology companies.

Why Your Next Car May Look Like a Living Room With driverless cars moving closer to reality, car makers and designers are imagining a future where car interiors look more like a high-tech living room. Photo: Morgan Anderson/Yanfeng Daimler AG, which makes Mercedes-Benz luxury cars, and auto supplier Bosch GmbH, for instance, said in April that they would jointly develop their own robot taxi. Daimler has said the vehicle would become available at the beginning of the next decade.

Daimler and Uber said in January they would join forces, with the German company agreeing to introduce self-driving cars compatible with Uber. Waymo, the self-driving tech unit of Google-parent Alphabet Inc., has agreed to take several hundred minivans from Fiat Chrysler Automobiles NV, part of its autonomous driving program.

Nutonomy Inc., a Cambridge, Mass. startup, has said it wants to put a fleet of robot taxis on the street by next year. It first began testing Renault and Mitsubishi vehicles, in Singapore. In May, it agreed to work with Peugeot maker Groupe PSA of France, to integrate its software into a Peugeot SUV.

Volvo and Uber agreed in 2016 to jointly develop more advanced self-driving car systems. The accident in Arizona was a blow to public perception of the pace of development of the program and such vehicles generally. But police said at the time that the Volvo-Uber car was not at fault. The accident occurred when the driver of another vehicle committed a moving violation, ramming the self-driving car and causing it to flip on its side.

There were no injuries, but Uber temporarily halted its three robot taxi tests in San Francisco, Tempe, and Pittsburgh. Those pilot programs have resumed.

—Tim Higgins in San Francisco contributed to this article.

Write to William Boston at email@example.com

<comment><USER26> does that mean that if your software is 'hidden behind a paywall' i am allowed to distribute it freely once i get to it?

<comment><USER25> I don't write software.

But if I owned the WSJ (or any publication) and a subscriber shared an article here-and-there on a forum I personally wouldn't be mad. Perhaps doing so would even lead to more subscribers.

<comment><USER27> That is probably why you don't own WSJ.

<comment><USER25> You can disagree with my stance, but your comment here is pretty rude in my opinion.

<comment><USER28> Maybe they were a little rude, but they have a point ... you just went and infringed on the WSJ's copyright just to score internet points.

Just my own opinion, but I wish mods would delete posts that did such things.

</comment></comment></comment></comment></comment></comment></comment><comment><USER29> Volvo is very, very serious about safety. I'm amazed they're this confident.

<comment><USER15> They're not. It appears that they've made a deal (without specific commitments) to sell Uber vehicles that Uber can turn into fully self-driving vehicles if it can. There would still appear to be some reputational risk but Volvo isn't making claims that the cars will be self-driving out of the factory.

<comment><USER29> Thanks for RTFA for me >.<

</comment></comment></comment><comment><USER30> Self-driving of 2019 is the new "4G" of 2011.

Don't expect these things to be even as good as Waymo's from day one...or first five years. And I don't even believe the reports that Waymo has gotten good enough for full autonomous driving in all environments.

<comment><USER31> was there a showdown with experts rating each company? I get that Google has a much better PR machine

<comment><USER32> Fwiw there was [https://www.wired.com/2017/04/detroit-stomping-silicon- valle...](https://www.wired.com/2017/04/detroit-stomping-silicon-valley-self- driving-car-race/)

But who knows what to make of that

</comment></comment></comment><comment><USER33> TechCrunch article with no paywall: [https://techcrunch.com/2017/11/20/uber- orders-24000-volvo-xc...](https://techcrunch.com/2017/11/20/uber- orders-24000-volvo-xc90s-for-driverless-fleet/)

<comment><USER34> and Bloomberg [https://www.bloomberg.com/news/articles/2017-11-20/uber- step...](https://www.bloomberg.com/news/articles/2017-11-20/uber-steps-up- driverless-cars-push-with-deal-for-24-000-volvos)

</comment></comment><comment><USER35> Why Uber's pursuing a driverless model just baffles me. This quote is for 24,000 cars for around $1.4 billion, or around $58,000 per vehicle. Even if we assume 0 financing cost the car would need to earn over $58,000 in its lifetime to be more profitable for Uber to buy one of these than to continue to pay a driver. Current Uber drivers estimate their profit to be around $0.40 per mile[1] which means each driverless vehicle would need to drive about 150,000 miles just to break even.

Let's guess driving that much that takes about 2 years[2]--if you assume a conservative 1 technician per 50 vehicles[3] to maintain these you also have 2% of their salary * 2 years (say another $3K). Throw in another $1000 for tabs etc, $1500 for the labor for a couple hundred car washes[4], $1000+ for losses related to crashes[5], $500 for parts and maintenance[6] and we're easily at another $7K+ in costs that have to come out of Uber's existing share.

[1] [https://therideshareguy.com/how-to-calculate-per-mile- earnin...](https://therideshareguy.com/how-to-calculate-per-mile-earnings- instead-of-per-hour/) (This is for a 43MPG Prius, with ~$0.06/mile of depreciation. I exclude the depreciation for the calculation above, but need to add back in a similar amount for the difference in MPG.)

[2] [https://bizfluent.com/info-8446407-many-cab-driver-drive- yea...](https://bizfluent.com/info-8446407-many-cab-driver-drive-yearly.html) Estimates of how many miles per year a single taxi gets driven range here from ~40,000 to ~90,000, so 75K/year seems plausible for a fully autonomous vehicle.

[3] [http://www.government- fleet.com/channel/maintenance/article/...](http://www.government- fleet.com/channel/maintenance/article/story/2011/01/how-to-calculate- technician-to-vehicle-ratios.aspx) (This seems very conservative to me, consider for example that Hertz has about 1 employee per 13 cars.)

[4] [https://uberpeople.net/threads/how-often-do-you-have-to- wash...](https://uberpeople.net/threads/how-often-do-you-have-to-wash-your- uber-car.152854/)

[5] Estimated from average of 1 claim per 18 years per driver and $7500 in cost per accident [https://www.forbes.com/sites/moneybuilder/2011/07/27/how- man...](https://www.forbes.com/sites/moneybuilder/2011/07/27/how-many-times- will-you-crash-your-car/#6a1805644e62) [http://www.tavss.com/library/va-nc- lawyer-economic-and-compr...](http://www.tavss.com/library/va-nc-lawyer- economic-and-comprehensive-auto-accident-costs.cfm)

[6] [https://www.yourmechanic.com/estimates/volvo](https://www.yourmechanic.com/estimates/volvo)

<comment><USER32> Nice references! Might be better to start with the cost paid by the customer to Uber rather than just the driver's cut of it?

"In San Francisco the fare is $2.20 plus $0.26 per minute plus $1.30 per mile. In New York City the fare is $3 plus $0.40 per minute plus $2.15 per mile."

<comment><USER35> That's not relevant because it doesn't change under a driverless system. Uber already gets "their" cut. The change is that Uber gains as costs what the driver would have paid to own, maintain, and operate the vehicle, and gains as an income what it would have paid the driver. The "driver profit per mile" nicely factors those things together.

</comment></comment></comment><comment><USER36> I am not convinced self driving cars will ever be a thing we see in our lifetimes that just drive around the city unmanned. Sure, I can see a fully custom Uber navigational system built in with systems that make getting passengers and dropping them off much more predictable.

However, what should be relatively simple as that fails to address the human component.

1\. Some people like talking to a driver, it's one of those small interactions that make getting from point A to point B an experience. Some people don't and that's fine too, not arguing against that.

2\. People left alone will be much less careful, graffiti, spillage, throwing- up, drug deals, etc. Fully expect these to become little crime bubbles.

3\. Not all cars will be fully utilized all day long, so what is a car sitting around unmanned? Will the insurance to cover vandalism and having the vehicle repaired raise higher than the value of paying someone to sit in the car?

<comment><USER37> 1\. The vast majority of people don't want getting to point A to point B to be an experience, they want it to happen as quickly and conveniently as possible for a good price. This isn't going to be any sort of real barrier to adoption especially when people have the option to pay $15 for a manned car with a driver or $3 for one that is self-driving.

2\. Cameras and you sign an agreement on signup that you're liable for the behavior of any passengers on your trip. Hotels are also private spaces, they don't seem to have a problem with graffiti, rooms getting destroyed, etc. To the extent they do it's not an existential problem and is covered by the fact that they have your ID and Credit Card on file.

3\. Many hundreds of thousands of people park their cars overnight in parking garages or on streets. Nobody pays people to sit inside inside of their cars overnight as far as I know.

<comment><USER15> Yeah. It's reasonable to be skeptical about the timeframe for fully-autonomous general purpose vehicles. IMO, the last 10 percent (or whatever) is tougher than a lot of people are assuming. Some of the assumptions about the economics of the vehicles are also overly optimistic.

That said, if people can get driven around for a reasonable price--either in their own vehicle or one they hail through an app-- _many_ people will forgo driving themselves.</comment></comment></comment>


Here's what happiness at work looks like - <AUTHOR> http://positivesharing.com/2007/10/heres-what-happiness-at-work-looks-like/

<comment><USER2> That's not happiness... that's smiling.

Ever had your boss come in to work with a camera? What do you do? You smile.

</comment><comment><USER3> That's what I feel like when I get something cool working for the first time. It's better than sex (whatever that's like).

<comment><USER4> ...</comment></comment>


Why the 13″ Air Is Better Than the 13″ Pro - <AUTHOR> http://brooksreview.net/2011/05/13-air-pro/ <comment><USER2> Or do what I did, drop a shiny new SSD and more RAM in your 15" MacBook Pro 2007. Yeah, I'm cheap, but I also know there will be shinier things in the next 6-12 months. For ~$300 I get the performance of a brand new MacBook Air (same C2D chip, but faster, actually) without breaking the bank. Granted, its not as portable and all that jazz, but it works for my immediate needs.

<comment><USER3> I dropped 4Gb of RAM and a 128GB OCZ SSD into my 2008 15" Macbook Pro (2.4GHz core 2 duo).

Didn't stop me replacing it with a 13" Macbook Air and not looking back. The MBA has the same RAM, double the SSD capacity (I went large), same pixel count, and weighs about half as much. It also has about 50% greater battery life and feels screamingly faster.

I surmise that enough of the GUI is running on the GPU that the significantly higher core count in the GeForce 320M is responsible for a chunk of the speed- up -- and the MBA's SATA-II bus running at up to 3gbps seems to be just a _little_ nippier than the 2008 MBP with a 1.5gbps SATA-I controller and an older SSD.

</comment></comment><comment><USER4> The Air lacks the all-important keyboard backlight. That alone makes the MBP the winner in my book. There's also the fact that if you want to do something requiring more RAM and/or CPU, it also has a performance edge.

<comment><USER5> I thought I would miss my backlit keyboard, but after 6 months... It only occasionally crosses my mind. Life goes on.

</comment></comment><comment><USER6> Let's look at the specs:

        Air 13" $1,299.00
        1.86GHz Intel Core 2 Duo processor
        2GB memory
        128GB flash storage1
        NVIDIA GeForce 320M graphics

        Pro 13" $1,299.00 ($1,449.00 with SSD)
        2.3GHz dual-core
        Intel Core i5
        4GB 1333MHz
        320GB 5400-rpm
        Intel HD Graphics 3000

The Pro has more memory, a better CPU, a DVD drive and an SD card slot.

<comment><USER7> The Air also has an SD card slot, and I never knew that was a make-or-break feature on a laptop.

Here's the one spec that makes a noticeable difference to me every single day, the one that was even bigger of a deal than upgrading to an SSD for the first time (and living through double digit SSD failures in the span of less than two years):

MacBook Air 13" Weight: 2.9 pounds (1.32 kg)

MacBook Pro 13" Weight: 4.5 pounds (2.04 kg)

</comment></comment><comment><USER8> I bought a 13" max spec air right after the new Pro came out, really happy with it thus far. I will say it's not as much of a desktop replacement as the pro might be but it gets the job done. The higher resolution is very noticeable when you step down to 1280.

</comment><comment><USER9> The macbook air has an 800MHz frontside bus, which isn't even fast enough to take advantage of last-generation SSD performance.

You would get better performance from the unibody macbook and a 3rd party SSD (1066MHz fsb), and even better performance with the macbook pro and the latest generation of SSD (2.5GT/s Intel DMI).

And there's also no ethernet jack on the air, you're not going to get the same performance out of the usb ethernet adapter.

<comment><USER7> From the post:

> It's not about performance specs, it about user experience and how people > use their computers — most people just don't do that many CPU intensive > tasks on anything but an occasional basis.

That is me. I care about the fact that my 13" Air is thinner and lighter than the 13" MBP, which makes a noticeable difference over any kind of day no matter the ergonomically designed bag or purse I might be using. I care that my 13" Air can run everything I need at acceptable or better performance, be it Xcode 4 or raiding with 24 other people in WoW. I don't care that I can't get the best performance possible or that there is no ethernet port or optical drive as those are edge cases at best and workarounds exist. It does what I want and feels incredible in every way that matters to me at the same time, and the MBP can't. It's as simple as that.

<comment><USER9> I guess it depends on how you're using it - I don't really notice the weight in my backpack, and I don't walk around with my laptop otherwise.

Also from the post:

      While at the same time forgoing things that you will notice
      every time you use the computer (screen resolution and the
      performance of an SSD).

If the performance of the SSD is a main feature, why would it not also be an important feature if you could quadruple the MBA SSD speed with the MBP + latest SSD?

<comment><USER7> I suppose if you are one to consider that and other performance boosts a main feature, the MBP makes a lot more sense to purchase. I'm not saying that the Air works for all people for all reasons. It definitely shows when it's struggling with something, and this is why I have other machines to offload things to. I don't use the Air as a desktop replacement although I do about 80% of my work on it, and that might be key to this discussion. Performance trivialities are no big deal when I can easily just head home or to my office and use a cheaper-priced desktop that still blows any MBP out of the water.

> I guess it depends on how you're using it - I don't really notice the weight > in my backpack, and I don't walk around with my laptop otherwise.

If there is one thing I really hate about being female, it's the inability to get away with walking around dressed nicely with a backpack on. But even when I do use backpacks, it's usually the case that 1.5lb and a slimmer laptop is nicer to have and I definitely notice the added weight and subsequent strain when I'm lugging around a work laptop or my 13" or 15" MBPs instead of the Air.</comment></comment></comment></comment>


Show HN: Shadowsocks-rust – A fast SOCKSv5 proxy in Rust - <AUTHOR> https://github.com/loggerhead/shadowsocks-rust <comment><USER2> Hello from the other shadowsocks-rust implementation :P

[https://github.com/zonyitoo/shadowsocks- rust](https://github.com/zonyitoo/shadowsocks-rust)

Glad to see we have two shadowsocks implementation in Rust!

</comment><comment><USER3> I just wanted to say that this is a very important project for many people, I won't go into the details but Google Shadowsocks you will know what I mean. Thank you everyone who keeps pushing the project forward.

</comment><comment><USER4> Cool!

I currently use the Python version of the server (installed using pip) and it works well. Would I gain anything by using this implementation instead? Does 'async udp' do anything to improve throughput or latency, assuming I'm still using the same clients (e.g. Potatso on iOS and Shadowsocks one Android)?

<comment><AUTHOR> The Python version is a great implementation with extremely fast speed, and the Rust version has no advantage in speed or functionality. But the Rust version has more possibilities, it don't need OpenSSL to support multiple encryption methods, so it would be easier to cross-platform.

</comment></comment><comment><USER5> Good, more alternatives. I use shadowsocks-libev version written in c, [https://github.com/shadowsocks/shadowsocks- libev](https://github.com/shadowsocks/shadowsocks-libev) . But I can see how this might be nice.

</comment><comment><USER6> Always cool to see new implementations of SOCKS.</comment>


Pitfalls of Object Oriented Programming (2009) [pdf] - <AUTHOR> http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf

<comment><USER2> Context! Context! Context!

This is about game programming, and how to optimize your data to be cache- and prefetch-friendly.

If your data doesn't look like game data, or isn't accessed like game data, it won't help and the "pitfalls" aren't.

<comment><USER3> I work more on the enterprise side of things, doing information analysis harrumphitywhatnot. My data tends to look a lot like the example in those slides, my performance drags look a lot like what those slides warned about, and a lot of the tricks I've come up with for keeping performance up look a lot like what was shown in the slides.

Far from concluding that this doesn't apply to me because I don't work in C++ and I'm not a game developer, I think I need to take some more time to read the game development literature to see what else I can learn.

</comment></comment><comment><USER4> I've really enjoyed reading [http://bitsquid.blogspot.com/](http://bitsquid.blogspot.com/) . It runs right from the birth of their game engine right up to the recent acquisition by Autodesk. They are heavy proponents of data-centric design with flat layouts (no pointer graphs jumping all over memory). The result is a game engine where almost anything (from rendering pipelines to physics models to ai) can be changed, compiled and live-updated on a nearby console in under a second.

EDIT: [http://bitsquid.blogspot.com/2011/12/pragmatic-approach- to-p...](http://bitsquid.blogspot.com/2011/12/pragmatic-approach-to- performance.html) is a particularly good overview

</comment><comment> def- Related: [http://www.dataorienteddesign.com/dodmain/dodmain.html](http://www.dataorienteddesign.com/dodmain/dodmain.html)

</comment><comment><USER5> We might also think of this as modern architectures being very badly suited for supporting these mechanisms for abstraction. This may indicate an opportunity.

</comment><comment><USER6> I wouldn't say these are pitfalls of OO. They are merely antipatterns in OO game programming (I might add, with any high-throughput data programming).

<comment><USER7> A more accurate title might be something along the lines of "Optimizing Bottlenecks Improves Performance".</comment></comment>