If You're Often Angry or Irritable, You May Be Depressed - <AUTHOR> https://www.npr.org/sections/health-shots/2019/02/04/689747637/if-youre-often-angry-or-irritable-you-may-be-depressed <comment><USER2> This was precisely my wife's symptoms when we were first married. She was angry nearly all the time. She could hold it together in public, but at home it was miserable. She would go a full day at a time, alternatively not speaking, stomping around and throwing things, and yelling.

It took a long time for her to be correctly diagnosed. It wasn't clear to me that depression was the issue, because as discussed in the article, anger isn't usually associated with depression. And it wasn't clear to her either, because in her mind all of her anger was justified. Most of it was my fault.

I had to keep telling myself that, no, it wasn't my fault. I wish I had had a support group or something but I didn't know that such things existed.

Happily, she did eventually find a doctor who worked with her to get a correct diagnosis and figure out the right meds (in her case, a specific SSRI. But everyone is different). She is a thousand percent better now - she's back to being the woman I married. But without diagnosis and treatment, we would not be married today.

If you have frequent anxiety attacks accompanied by anger, violent or not, _definitely_ consider depression as a possible cause. If you are living with someone with these symptoms, get yourself some support. If your partner's anger turns to violence, for your own wellbeing, leave. Even if you are a man, abused spouse centers should help you.

<comment><USER3> One thing I learned on my own is that it's very easy to lose track of what 'normal' is. You slip slowly into different spectrum of emotions without really knowing why. When your mind is not at peace, stress/struggle will leak out in any shape be it anger, negativity, somatic onset (psoriasis, spasms) ..

I believe strongly that we ought to aim for positivity and if we recognize something's not right, acknowledge it, and don't accept it as an absolute unquestionable reality.

<comment><USER2> My layperson's understanding of depression is that it's your brain lying to you. My wife's perception of things that happened to her were often 180 degrees different from mine. She would take compliments I would give her, process them through the "depression" filter, and they would come out the other end as insults. You could actually watch it happen; there was a perceptible mental lag as the filters worked. To this day, her memory of those times is very different from mine.

It's not just that you lose track of normal, although that is certainly true. But it's also that you can't trust your own sensory perceptions. You are viewing the world through distorting lenses.

<comment><USER4> I've noticed that (warning: gross generalization incoming) women seem to communicate differently, on average, and tend to read _between_ the lines to see if there is any hidden or implied meaning in a statement (negative or positive). Basically, there's an entire side channel of deeper communication that I'm much less capable of decoding or using.

</comment></comment></comment></comment><comment><USER5> I have had to deal with inexplicable anger and irritability for a long time. It is possible this traces back to being misdiagnosed and prescribed 5 antibiotic recipes back-to-back as a child.

Long and tedious story short, when I cut milk, gluten/short carbs/whatever pesticide they use for wheat, and excess sugar from e.g. prefabbed food from my diet I gained 10kg and my life basically turned around. Turns out having your gut constantly inflamed is bad for your mental health.

I have missed so many opportunities because of this. It's not right.

ED: Apparently I need to point out that one possible cause may be that antibiotics killed the gut bacteria I needed to process milk, wheat and sugar. If so, this malady could be solved with a less revolting alternative to fecal transplants.

<comment><USER6> mental health and gut bacteria seem to be heavily correlated. Anecdotally, if I don't eat sugary "reward" food I tend to feel better. That is also why I adopted intermittent fasting. I tend to fell better mentally if I fast 24h once a week.

<comment><USER7> How exactly do you fast? Is it like the extreme fasting of muslims where you don't eat or drink anything from dawn to dusk, or is it like the hindu fasting where you only eat fruits and vegetables?

<comment><USER6> water and coffee only, from dinner to dinner

<comment><USER7> If I remember right, drinking coffee causes your body to lose water faster - so drinking coffee and water seem kind of contradictory.

<comment> Anthony-G While caffeine is a mild diuretic, it's a myth that drinking coffee (or tea) causes dehydration – something I only learned in the last year or two. The BBC has a decent article on this topic: [http://www.bbc.com/future/story/20140402-are-coffee-and- tea-...](http://www.bbc.com/future/story/20140402-are-coffee-and-tea- dehydrating)

</comment></comment></comment></comment></comment></comment><comment><USER8> The more you know about the world and tech especially, the more you will get depressed, IMO, maybe I'm wrong.

Humans in general are pretty shitty, driven mostly by self-interest. I guess there are people driven by doing good but most people are capable of doing terrible things, especially when in a group.

I do suffer from existential depression, I'm generally pretty happy, but as I learn more and live longer my outlook on the world gets worse. I did therapy, it was nice to talk about things I would not bring up with friends/SO.

I tried meds but side-effects generally suck and the whole medical industry in the US raises my blood pressure.

Edit: I would still encourage anyone feeling unhappy/depressed to try all the options meds/therapy/meditation/w.e before accepting defeat.

<comment><USER9> Your comment aligns with an old HN comment that I have saved that resonated with me:

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

I'd also recommend people feeling this way to read The Happiness Hypothesis by Jonathan Haidt. It helped me.

<comment><USER10> Thanks for sharing this comment. I do have a bit of trouble with the last paragraph. Am I understanding correctly that the author claims depression is neccessary for building a better model of the world?

I'm sure depression has caused me to think about things and get a better understanding of them, but is it neccessary? What am I currently building a better model of?

<comment><USER11> In the beginning the author of the comment said that a broken model results in a loss of confidence which then prevents us from acting on that model and forces us to figure out a better one. They're saying that's what depression is - the downtime when you're supposed to play it safe and re-analyze the data and build a better fitting model. I can see how it can be better to not act on a broken model in case it could result in some harm, but it also stops us from gathering new data that might be important.

</comment></comment></comment></comment><comment><USER12> This certainly agrees with my experience. I've had a number of cases in the past where I'm feeling low/depressed at work and tend to get more frustrated, e.g. annoyed with some policy or some design decision or some detail about the code that I'm working with. It's a bit counterintuitive that sadness and lowness would do that, but it seems to be a pretty clear pattern.

After a number of cases of expressing that frustration and regretting it later, I've set a rule for myself that I should mostly keep my mouth shut if I'm feeling depressed. If I do want to follow up, I should just write down my thoughts and talk through the issue later when I'm feeling better. Fortunately I'm pretty good these days about being aware of when I'm feeling depressed.

</comment><comment><USER13> Ya...I figured this out a while ago. I figure it's because it's easier to be angry than depressed, at least in the short term. When you're angry it feels like you're doing something, even if you're not. It takes your energy and attention away from whatever is making you depressed(likely something that can't really be changed easily) and focusses it on something tangible you can lash out at.

I've come to learn over the years it doesn't really help and you end up feeling worse after because you add on the regret about whatever you did when you were mad to the already existent depresseion and it ends up building up and continuing in a cycle that gets worse. The more angry you get, the more depressed you get which in turn makes you more angry next time.

This is what i've kind of learned over the years. I've also found I regret just about every decision i've ever made while angry.

</comment><comment><USER14> My personal challenges with anger/depression came from attempts to escape reality. It started out as a way to spend my down time (video games). Then over time it became what I looked forward to doing. I would skip outings with friends and ignore my family in favor of playing games. Then it morphed into other forms of impulsive behavior.

After about 20 years (2/3 of my life to that point) I had become an extremely selfish and self-centered person. I would feel empty, so I'd go do something selfish to make myself feel better. But it only lasted for the moment. Afterwards I'd feel upset that I wasted all my time but also not want to quit. So I'd be angry about it and the anger didn't just stay inside. I'd take it out on those who were preventing me from returning to my cave (family mostly).

The big turning point to me was my faith. My addictions (which were various) had put me into a marital and even existential crisis. I basically had to hit rock bottom (and bounce a couple times). I had to be faced with fighting for everything I loved.

Every single day is a struggle, depressed or not. I am always a few breaths away from going back down the rabbit hole. What a wretched man I am. There's no "cure" for me in this life I don't think, but giving up the fight can be deadly and hurt a lot of people I love, so I choose to fight.

<comment> uneasy-sausage Have you cut out some of the compulsive habits/actions such as binging video games?

<comment><USER14> Yeah, as far as video games, occasionally I will install something on my phone or whatever but I've found I either don't enjoy them anymore because they feel too much like work, or else they wreck me pretty quickly and I end up just ripping the band aid off by uninstalling.

Some of the other habits have been easier. For instance I quit drinking over 5 years ago and haven't looked back. Still other habits have proven way more difficult and I continue to battle them.

</comment></comment></comment><comment><USER15> Yup, this was me for 18 years. Doctor had me fixed in about 45 minutes.

Massive life improvement all around.

Feel dumb about waiting 18 years, so I talk about it to break down the stigma associated with mental health.

<comment><USER16> How did your doctor had you fixed in 45 minutes?

<comment><USER15> Well I took a written survey about my symptoms answered some questions. Doc said my brain did not produce enough of something and wrote me a script.

She's a funny old lady and was hilarious about how she liked these pills because it did not effect my _funny hand gestures here_.

I was sceptical, but took half a pill as she instructed. Next thing I know I am eating a sandwich at chick-fill-a not hating Chick-fil-A people thinking normal is going to be EASY.

I kept taking half pills a week longer that instructed because the positivity was a bit much to take.

I accidentally took 2 pills a couple times and I feel so positive I annoy myself.

If I forget a pill the old familiar negativity and muscle pain in my shoulders comes back.

I do still dislike Chick-fil-A people.

<comment><USER16> Make sure you educate yourself on what those pills you're taking do and follow through a treatment, not just take them indefinitely.

<comment><USER15> I recognize the good intentions of your comment.

However, I want to push back a bit. I was depressed, but not from trauma. I avoided going to the doc to avoid long term prescription drug use and therapy. I regret that decision, and it cost me career opportunities and damaged relationships.

It is a legitimate concern, but wildly overstated in my mind for 18 tough years.

</comment></comment></comment></comment></comment><comment><USER17> Assuming a product person ( e.g Steve Jobs ) is easily Angry and Irritable with crap ( Which there are lots of it ), would that considered as depressed? Where do we draw a line where some body just have very high standard to everything ( Perfectionist ) or they actually have bipolar disorder.

<comment><USER18> I've known many people who have Jobsian tendencies. They don't have depression, just a low tolerance for bullshit.

<comment><USER19> > just a low tolerance for bullshit.

How about "just a low tolerance for what they perceive as bullshit"?

It seems many such people perceive things like manners, respect for other people, and anything that doesn't push their personal current priority as "bullshit".

<comment><USER20> How you deliver unpleasant news matters. You will be shunned and bad-mouthed if you don't find amiable ways to deliver unpleasant information. The author Dale Carnegie was mostly right; I'm just the messenger. ("How to Win Friends and Influence Others.")

</comment></comment></comment></comment><comment><USER21> I'm not sure they're right. As a man at least when you get to a certain age you lose the filter. I saw it in my dad and now I see it in myself.

When you're younger bosses might BS you but you don't know it. When you get older you know it but feel helpless in doing anything about it. You reach a certain age and you call people on it. That might be one reason in tech that they don't want older employees. Being freer is tied to age, not depression.

<comment><USER22> One of the best things I've noticed about aging is no longer caring what other people think. Some of this is due to having built some financial security, but I believe there is more to it than that.

<comment><USER23> Speaking as aging dude who largely doesn't care what other people think, some of it comes from financial security.

However, I'd say some comes down to being more assured in my beliefs that my positions are reasonable places to start, if not always right. Some comes down to understanding exactly how little it matters what other people think of you in most contexts, and trying to only manage the contexts where that's not true.

All of that can go sideways in a way that you won't necessarily catch until damage done, which leads to the third realization with age: there's very little damage you can do once that can't be repaired. Most irreparable damage comes from you repeatedly convincing someone you're a jerk, assuming you don't completely turn them off on first impression.

None of which is to say you should lead by being an ass when you get old, just that I don't worry about impressions so much anymore unless it's strategic. Micromanaging them never got me anywhere, better to confidently try something reasonable then pick up the pieces if I'm off base. That's gotten me way further.

</comment></comment></comment><comment><USER24> Or tired?

Both lead to unwarranted angry outbursts IME.

<comment><USER25> Tired can be a consequence of depressed, or many other things, so this could be an indirect (even cyclical) reaction.

I'm a tad bipolar. When I have an angry manic the cause is direct, but when I have a "happy manic" that lasts for an appreciable time angry is soon to follow too, I think mainly because I can't sleep well in that state. When I'm down I sleep, in fact sometimes practically hibernate, but it often isn't useful/refreshing sleep so again anger comes from that.

</comment></comment><comment><USER26> This rings true to me. My ex was often angry, and would eventually start taking that anger out on me. Then she went on antidepressants, and became much more pleasant to live with, and easier to talk to. Then she went off them again and we broke up :)

</comment><comment><USER27> A long time ago before I was treated for bipolar disorder I found my depression was related to anger turned inward at myself. But others I have talked to didn't always relate this way as I did with depression.

<comment><USER7> If you mean inward anger = self-loathing / self-hatred, you are right as that's a common symptom of depression too.

<comment><USER27> Exactly what I had :)

</comment></comment></comment><comment><USER28> Depression expresses itself in a lot of unexpected ways. While severe depression can lead to the symptoms Hollywood has introduced us to -- total inertia, not getting out of bed, etc. -- somewhat milder but chronic versions include anxiety, low-intensity anger, disturbed sleep and appetite, among many other things.

</comment><comment><USER29> This is timely for me. I think anger is a precursor to tiredness, the eventual feeling of helplessness, and definitely an early warning.

</comment><comment><USER30> It took me years to recognize that irritability and anger were actually latent side effects of coffee consumption, and related to increased anxiety.

I'm curious, has anyone else experienced this and found success with cutting out caffeine?

<comment><USER31> Yeah, caffeine gives me a short fuse like nothing else.

As little as a coffee in the morning would basically make me prone to fly off the handle due to the most insignificant, trivial little things. Cost me and my wife many hours spent in pointless discussions and unnecessary arguments.

Don't get me wrong, I love coffee, but I have to treat it like you would a recreational drug. Only to be enjoyed when the set and the setting is right.

</comment></comment><comment><USER32> Is there any data available for those more likely to be depressed ouf of these or similar categories:

1) Atheists 2) Creationists (of all religions) 3) Non practicising creationists (of all religions)

I'm not promoting any of the above here but I would like to see if there is any correlation between those who believe in a higher purpose and whether they are less or more likely to feel existential depression as they feel there is a reason to be here vs just being here to procreate because of evolution.

<comment><USER33> Stoicism feels like the best path out for a depressed athiest. "Best of all possible worlds" but without the theism

</comment></comment><comment><USER34> > irritability — a reduced control over one's temper that results in angry > outbursts — is listed as a core symptom of depression for children and > adolescents

There are a lot of "this is me" comments ITT. Can anyone touch on their experience of anger/temper as a result of depression in their children or even in themselves as a child? I didn't realize there was established research on depression symptoms in children. I always associated it with "sadness"/darkness and feelings of worthlessness that the [adult] mind can suffer.

I have two wonderful boys. The youngest always had a bit of a tendency to overreact/outburst on little things. For example he'll lose/die in a video game and just utterly lose his mind. Since my ex and I separated when he was 5 things have been the same and I never connected that it may be due to depression. Maybe he has been carrying this for a long time.

</comment><comment><USER35> "hey, those of you with depression, did it make you angry at everything and did anti depressants help" was the question I asked the day I finally started getting help.

(I was in the middle of almost getting fired over a dress code violation as entry level retail)

I don't know if the help has really helped over the long term but recognizing that incandescent rage at people saying 'good morning' to me as a sign of an incoming down swing has at least helped me keep an eye on myself.

</comment><comment><USER36> Clinical Depression is often caused by a chemical imbalance, usually serotonin. It isn't being "sad" and doesn't usually have root cause in a certain event or direct emotion - though those things can trigger the already existing issue.

We have to remember that the term Depression in this sense doesn't mean what it means in the common sense. Just like words like "Theory" have different meanings in the common vernacular.

It's closer to Anxiety than it is to Sadness.

<comment><USER37> There's a lot of evidence against the industry standard "Serotonin deficiency" being the silver bullet that can be, guess what, cured by buying a pill from $BIG_PHARMA.

</comment></comment><comment><USER38> You might also have a personality disorder, but people don't want to hear that because you can't really treat those.

</comment><comment><USER39> Or people are just piling up on you.

</comment><comment><USER40> Does this new information, namely that depression can cause anger, change the advice for distinguishing between depression and burnout?

I.e.

Burnout: no energy for specific thing or things eg work, but plenty of inspiration for other things

Depression: no energy for anything?

</comment><comment><USER41> There is another aspect that may sound ludicrous, but I think also plays a role: If I go to the doctor and say I may have depression because I'm angry and vindictive, he may dismiss me not as a depressive, but as an asshole.

Mental health is hard, in part because you can diagnose[1] it even less than many physical ailments.

I have a cut on my finger and I can't stop the bleeding and OMG all the blood? Emergency room! (And please don't ask how long I pondered whether I should go, because it's not exactly a big wound).

My leg isn't looking straight and it hurts like hell? Call an ambulance!

I don't feel well? What now?

[1] I don't mean come to a definitive diagnosis what illness this is in Latin medical terms, but a simple answer to "is something wrong – and sufficiently wrong to see a doctor?"

</comment><comment><USER42> [https://en.wikipedia.org/wiki/Contentment](https://en.wikipedia.org/wiki/Contentment)

</comment><comment><USER43> That's how I discovered my own depression.

</comment><comment><USER44> TIL that my irritablness/brashness is rooted in my depression. Feck.

</comment><comment><USER45> It is really helpful.

</comment><comment><USER46> Isn't there a pos correlation between intelligence and depresssion

</comment><comment><USER47> Social media's are a catalyst to depression!

</comment><comment><USER48> Could also be too much coffee.

</comment><comment><USER49> Whilw the gdpr text version is an applaudable step by npr, I wish they didnt link to their frontpage.

Can someone link it?

<comment><USER50> [https://text.npr.org/s.php?sId=689747637](https://text.npr.org/s.php?sId=689747637)

The URL is [https://text.npr.org/s.php?sId=<SID>](https://text.npr.org/s.php?sId=<SID>), where <SID> is in the original URL here: www.npr.org/sections/health- shots/<YEAR>/<MONTH>/<DAY>/<SID>/<SLUG>

</comment></comment><comment><USER51> I am not depressed, but I am often annoyed by the idiots that won't stop staring at their phones when getting onto or off of the elevator. I can be annoyed without being depressed. I am not related to these ding-dongs, so it's only their progeny that should be depressed.

<comment><USER52> I definitely get that, too. I pull up at the stoplight next to a lady in the other car, she's on facebook, looking at pictures and videos of other people. I want to shout, "hey, what the fuck? Wake up." And then I think about her as a person. With needs, desires, fears. A complete person, just as much as I'm a complete person. The initial reaction softens and I have compassion for her because we're the same.

<comment><USER51> My personality is a bit different than yours. For right or wrong, I used to think like that, then I realized I was allowing people to walk all over me. I no longer allow such shenanigans and I feel 500% better for it.

<comment><USER52> Yeah, I have a suspicious streak (paranoid? I don't know, maybe?), too. That comes with a deep fear of being taken advantage of, a fear of being a sucker, a mark, a rube, whatever. I am mistrustful of other people's motives, and assume the worst.

What has counteracted that tendency, which I think may be partly innate, partly learned (a paranoia spectrum?), is two things: 1) the only reason anybody _ever_ wants to tear me down is to build themselves up, and having been guilty of that myself, I can have compassion for them, and 2) I have found that I can put _faith_ in the universe that, so long as I do the right thing, I go to bed with a sense of dignity and am not so afraid. That's not to say I don't have boundaries. I can have boundaries without taking it personally when others cross them, though.</comment></comment></comment></comment>


500,000 Requests/Sec – Modern HTTP Servers Are Fast - <AUTHOR> http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast/

<comment><USER2> Sigh, another completely synthetic benchmark with big iron: A dual Intel Xeon X5670 with 24GB of RAM from SoftLayer. The X5670 has 6 cores @ 2.93 GHz, 2 threads per core, /proc/cpuinfo shows 24 CPUs.

Serving a plain HTML page over _localhost_ via nginx. A medium length blog post with pretty much no real-world information.

<comment><USER3> Still, for comparison a huge site like reddit is serving around 1000 pageviews per second. The hardware in this post isn't that good, nowadays you can do quite a bit better. If you could get even 0.02% of these pageviews per second out of more modern hardware that's already 100 pageviews per second. Only a handful of sites need more than that. For example HN certainly does not. And AFAIK HN runs single core on a language (Arc) that compiles to Scheme, not the fastest in town. Since reddit is only about 70x larger than HN, we are probably close to the point where with a lot of optimization a site like reddit could be run on a single large box (if we're not there already).

<comment><USER4> Dude... I am sorry, but your reply does not make sense on many levels:

I don't know if reddit could run on a single server, but this benchmark does nothing to prove it. A pageview on reddit consist of several http requests. A http requests translates into several requests into a database backend. In this syntactic benchmark he is requesting the same static file over and over again, so nginx and/or linux can cache it in memory (or CPU cache).

Also even if they could put reddit on a single server, it would require a lot of optimization and engineering time is more expensive than hardware. It would also make adding new futures in the future a pain in ass, because you would have to be very greedy with CPU time (and other resources like memory, bandwidth, etc...). Also you want a multi-server setup for redundancy and handling extra capacity.

EDIT: I don't if you also planning to put the database on the same server? Web servers are basically stateless so they are easy to scale. It would be interesting to calculate how much disks that server would need just to handle the IO throughput.

Full disclosure: This is some speaking who used to work for social network with 9M users and 3,000 servers.

<comment><USER3> This benchmark does not, but the fact that Hacker News which is just 70x smaller but conceptually similar runs on a single core on a slow language _does_. I completely agree that it's probably not be a good idea, but the fact that it's possible or almost possible is still interesting in my opinion. If nothing else the power of modern hardware puts the obsession with horizontal scalability into perspective, since most sites are nowhere near the size of reddit.

Even though a pageview on reddit translates to several HTTP requests, only one of those requests has to serve dynamic HTML. The requests that get the JS, CSS and images can go to a content delivery network (and they probably already do). You'd probably indeed want to put the database on the same server, with the vast majority of DB accesses hitting main memory (as you can easily get a server with hundreds of gigabytes or even terabytes of RAM nowadays -- it helps that reddit's access pattern is very heavily concentrated on new posts). Of course you have to replicate to multiple servers to prevent data loss.

9M users and 3,000 servers sounds like a lot. What kind of servers are these? What is the size of the database, roughly?

</comment></comment></comment></comment><comment><USER5> My toy web server can achieve similar performance using a much more modest hardware (Core i7 2640 laptop), using way less RAM (a few dozen kilobytes).

Granted this is also being tested on localhost with static content (no disk I/O) -- but shows that event-driven servers are not that novel or difficult to write: my code weighs around 1700 LOC of (might I say) readable C.

Static file serving is also fast (using sendfile(), etc), but needs an overhaul to achieve usable concurrency. Currently there's a ~4x performance drop while serving files, but I'm working on this.

(The sources are at <http://github.com/lpereira/lwan> by the way.)

</comment><comment><USER6> nginx saturates at ~18k req/sec / core with a latency of ~24ms. This saturation is not coming from nginx in particular but from OS limits (mode switching, stack copying etc.. for read/write system calls).

There is nothing new in "modern HTTP servers". They are event-driven programs and this has existed for a long time.

<comment><USER7> As you rightly said - the key limit if you get to such high I/O levels is first with OS processing - the implementation of the network stack on the iron - with performance above 50k the limit comes from the "pipes" moving the data up from the network card to the OS layer where the web server sits (and providing the layer 4 / TCP services).

Hence in telcom environments where you get such requirements the TCP/IP stack is processed closer to the card - but no out-of-the-box web servers could handle such streams - most of that is handled with e.g. C-libs closely bound to the networking HW.

With such specialized NW cards (16 core card) plus libs you get to > 1'500'000 teardowns p.s. / connections established and roughly 15Gbps - there are now 100Gbps solutions on the market on the top-end - your actual throughput depends mostly what kind of processing you're doing. That kind of equipment is of course not normally used for web serving - more for (transparent) proxying and inspection / traffic shaping, etc as more-and-more telcom cores are completely TCP/IP based.

<comment><USER6> I think using a generic OS for IO operations is not a good idea in general. We all do it but there got to be a better solution. We don't need kernel/userland isolation that introduces mode switching, stack copying, copying arguments etc... In such an OS, the environment is under our supervision and processes are trusted.

<comment><USER7> With the telcom example I've provided above there is no generic OS used for that - the protocol (e.g. TCP, IP or even HTTP) is (pre-)processed within the hardware and not further up in the OS.

Generally Linux / Unix (carrier grade / HA) is used within such environments as the OS. Context switches (user land / kernel) are some of the most expensive operations so they are to be avoided as often as possible.

What you're pointing to are features you generally find in RTOS (real-time OS) solutions - and these kind of cards / platforms allow using them. Look up the Trillium platform from CCPU for example how such a stack / system is layered - they use Wind River PNE-LE (Linux edition for network equipment) for the HA & non-HA protocols.

</comment></comment></comment></comment><comment><USER8> In a real world app, I think you'd be considered lucky if the web-server is your bottleneck, rather than your DB or network connection.

<comment><USER9> As someone who has only worked on extremely small sites, I've never had to deal with scaling/bottlenecks. Do you have any recommended reads on handling DB bottlenecks and the like so I can be prepared when that day comes? Thanks!

<comment><USER10> Gregg Pollock made a series of videos (underwritten by RPM (<https://rpm.newrelic.com/)>), called Scaling Rails (<http://railslab.newrelic.com/scaling-rails>). It's _phenomenal_. That link shows the "contents" on the left-hand sidebar. Start at the bottom and work your way up the list.

<comment><USER11> That looks phenomenal. Is it equally-applicable to, say, Django development? Or is there a sister-series?

<comment><USER12> Jacob Kaplan-Moss did a talk on 'Django Deployment' which is really more about scalability (reverse proxies in front of your webapp) and reliability (multiple database backends etc).

[http://ontwik.com/python/django-deployment-workshop-by- jacob...](http://ontwik.com/python/django-deployment-workshop-by-jacob-kaplan- moss/)

</comment></comment></comment></comment></comment><comment><USER13> Quickly looking over SoftLayer's price sheet, it looks to be a little over $1k a month for Intel 5670 with 24GB of RAM

<comment><USER14> I'm not really familiar with CPUs, but I got a hyperthreaded, quad core Xeon with 24 GB RAM, 750 2xRAID1 disks and 10 TB bandwidth from Hetzner for 60 euros a month... Isn't that comparable to what you mention, apart from being many times cheaper?

<http://www.hetzner.de/en/hosting/produkte_rootserver/ex5>

<comment><USER15> Not quite. Check this out

<http://ark.intel.com/compare/47920,37147>

The Softlayer server is a Xeon, the Hetzner is a desktop grade processor.

Key differences for me

* Cache

* QPI (especially in a 2P config that makes a difference)

* Max TDP ... that's a HUGE one.

* ECC memory. See [http://perspectives.mvdirona.com/2012/02/26/ObservationsOnEr...](http://perspectives.mvdirona.com/2012/02/26/ObservationsOnErrorsCorrectionsTrustOfDependentSystems.aspx) for why this is important

So, you're not comparing apples to apples

<comment><USER14> Ah, yes, sorry, it's an i7, not a Xeon. Still, you could get around 40 of these machines for one of those, so I'd take these.

</comment></comment></comment></comment><comment><USER16> Since this is almost pure sendfile() work (aside from the headers), it really doesn't seem like a very useful example... there isn't much static content left on the web.

<comment><USER17> Just to give a different point of view: I'm sure you're right per request, which I guess is what matters here. But per _volume_ , most content on the web is static.

</comment></comment><comment><USER18> The flipside is that as time goes on, this benchmark becomes less impressive. The server in question had 24GB of RAM and two CPUs with 12 cores each.

</comment><comment><USER19> A comparison with older hardware would have been nice. Also using localhost is not a very good indicator of real-world performance.

</comment><comment><USER20> The ironic part is that his blog is hosted on wordpress.

</comment><comment><USER21> I'm interested in more info on your linux TCP tuning, especially how you decided to tcp_tw_recycle and tcp_fin_timeout (and how you decided setting the former to 1 is safe)</comment>


A JavaScript key/value store based on localStorage - <AUTHOR> http://code.google.com/p/realstorage/

<comment><USER2> Hacking key/value localStorage to allow database-like collections:

<http://mylittlehacks.appspot.com/localstorage>

(Firefox only)</comment>


Data normalization reconsidered, Part 1 - <AUTHOR> http://www.ibm.com/developerworks/data/library/techarticle/dm-1112normalization/ <comment><USER2> Decent history but I disagree with the basic premise that normalization is less necessary because computers are more powerful. It implies normalization was for storage conservation instead of logical reasons.

<comment><USER3> Absolutely this. While reduced data storage may have been a beneficial side effect the real driver was update consistency.

</comment></comment><comment><USER4> Part 2

[http://www.ibm.com/developerworks/data/library/techarticle/d...](http://www.ibm.com/developerworks/data/library/techarticle/dm-1201normalizationpart2/index.html)

</comment><comment><USER5> Date: 2011.</comment>


Should Twitter and Facebook Be Regulated as Utilities? - <AUTHOR> http://blog.dilbert.com/post/156377416856/should-twitter-and-facebook-be-regulated-as <comment><USER2> >Realistically, can I quit Twitter and be a successful media personality without it? Not in today's world.

Total nonsequitor here. The constitution doesn't guarantee the right to be famous.

Congress can't silence you, but it doesn't have to give you a megaphone.

The Open Internet was supposed to be the megaphone.

</comment><comment> norea-armozel Seriously? No. It doesn't take much skull sweat to figure out why this doesn't make any sense. First, social media sites are not monopolies nor utilities in the proper sense. Facebook bans don't affect you ability to get on Twitter. Twitter bans don't affect your ability to host a Wordpress site. And so on. Now, if Scott Adams has evidence of blackballing then he has a case for censorship but I haven't seen him make that case and I think he's not making that case because he knows he's not being blackballed (and that would show up under examination of any evidence presented).

</comment><comment><USER3> So, deregulate ISPs, but regulate some sites on the internet? Sure, tha will lead to good outcomes for everyone.

</comment><comment><USER4> No. Better to let them fail.

</comment><comment><USER5> Poor guy thinks a follower saying they don't see his tweets is an indicator of a vast conspiracy against him by a large corporation.</comment>


Software Bugs - <AUTHOR> http://www.youtube.com/watch?feature=player_embedded&v=4Mz1estA4MA <comment><USER2> OMG, this is hilarious! Nicely done Atlassian, I'm looking forward to more videos like this.

</comment><comment><USER3> Ha. Bugs finding bugs. Brilliant.

</comment><comment><USER4> Funny!</comment>


Recommend learning resources on 3g/LTE/5g - <AUTHOR> Basically I want to go beyond the classic business-like knowledge on this cell phone networks matter. Most things I've read are too superficial. I really want to understand things like Channels, Scrambling codes, etc.<p>Thank you!! <comment><USER2> [https://www.sharetechnote.com](https://www.sharetechnote.com)

I'm not familiar with the lower layers but found the website above helpful to get an introduction.</comment>


Pentium? Core i5? Core i7? Making sense of Intel's convoluted CPU lineup - <AUTHOR> http://arstechnica.com/gadgets/2016/02/pentium-core-i5-core-i7-making-sense-of-intels-convoluted-cpu-lineup/ <comment><USER2> Intel is just hurting itself with the naming scheme. I've lost count how many times I've heard people say "Oh, it has only i5/i7. I've had i5 already for X years. No point to upgrade."

I guess Nvidia / AMD graphics card style naming might work the best. Product name (Xeon, Pentium, whatever), #generation digit, 1-3 digits of entry/mid/premium level. Like Celeron 120 (generation 1, premium level 2(0)).

Right now non-technical people seem to be still expecting i6 and i8 CPUs.

<comment><USER3> When Intel's iX series was first released, the numbering scheme they had is almost exactly what you described.

i7-720: "7" was the performance tier, "20" the generation

So an i7-820 was the same generation, but a higher performance tier, and the i7-940 was yet another higher performance tier and a later generation.

They've later switched to a 4 digit numbering scheme which is decipherable, but not nearly as clear as the 3 digit scheme. The introduction of quadcore i5s and dual core i7s really muddled the waters.

<comment><USER4> What? The "20" was never the generation.

The i7-720, i7-820, and i7-940 are all Nehalem (ie first generation) core parts.

The numbering more or less makes sense if you prepend a 0 to the "720". Now your generations make perfect sense.

Current desktop product codes still more or less make sense. Mobile is a complete clusterfuck though.

<comment><USER3> I guess "generation" may have been the wrong word. "Age" or "iteration" may have been more appropriate. The 720 was launched Q3'09 and the 740 was Q3'10.

</comment></comment></comment></comment><comment><USER5> The practical end of Moore's law is quite evident from this.

</comment><comment><USER6> > _And if you're building a PC now after having been out of the game for a few > years, it can be exceptionally confusing._

No kidding. I've been out of the "hardware game" for quite a few years now, having not built a PC in probably 15 years (and pretty much exclusively buying laptops for the last 10 or so). That was very apparent when I decided a few months ago to build myself a new server and began investigating options.

I was surprised by one thing in particular, though. According to TFA, the 4000-series (Haswell) are "the _old_ chips". My primary machine for almost the last four years (until I bought a shiny new MacBook Pro back in mid-September) was a Lenovo Thinkpad W530 with an i7-3740QM chip. That is, AFAICT, one generation _OLDER_ than "the _old_ chips".

Nearly four years after I bought it, however, it remains the most powerful machine I own and still has better specs than most of the brand new laptops I see for sale at a quick glance. It has four cores at 2.70 GHz, 32 GB of RAM, and a pair of Samsung 850 PRO 256 GB SSDs (just installed within the last two weeks). The screen is nice and pretty, too, with full HD (1920x1080 resolution). It's still a monster of a laptop today. I opted for the biggest battery I could get in it and, at a guess, it's still probably at 75-80% (capacity-wise) of what it was on day one (battery life isn't one of FreeBSD's strengths, but it's acceptable).

Compare that to the 15" MacBook Pro I bought in September which has a quad- core i7 at 2.20 GHz, 16 GB of RAM, and 256 GB of whatever newfangled storage technology (PCIe, I think?) Apple shoved in it. The screen resolution (2880x1800 vs 1920x1080) is higher although the difference isn't _that_ noticeable unless you're really looking.

I am confused by one thing in TFA, though. It states, under the "Core i5" heading:

> _These are all quad-core CPUs ..._

I'm not sure if the article is wrong, I'm "misremembering" or what, but ISTR seeing plenty of i5 CPUs that are only dual core.

One thing is for sure, though, the identifying/labeling and marketing of CPUs is confusing as hell (and will probably only get worse). Fortunately, when building my new server recently, I found some posts online by others who were building very similar machines and was able to benefit from their knowledge. I considered myself very lucky when I managed to buy components that all worked together perfectly the first time and didn't have to return or exchange anything.

If you're going to be putting a new machine together anytime soon, definitely spend some time doing some research and make sure you purchase components that are compatible. It's amazing how much difference there can be between two similar pieces of hardware whose model numbers differ by only one digit or letter.

<comment><USER7> The only difference between those machines is the CPU. While the clock speed is lower, I wouldn't be surprised if the current quad i7 is much faster than the 4 year old quad.

Which really only adds to the confusion - its really not easy to tell how much faster this years i7 is against last year's i7, since clock speed doesn't really matter anymore when comparing across architectures.

</comment></comment><comment><USER8> Honestly the one thing you need to know is if your processor is a celron or not.</comment>


Gtk3 on a HTML5 backend - <AUTHOR> http://blogs.gnome.org/alexl/2010/11/23/gtk3-vs-html5/ <comment><USER2> Does anyone else remember the X11 browser plugin? It was an X server that ran as a plugin in Netscape and IE, with a little bit of magic ("xrx") to handle authentication to the web server. So you could visit a web page and start running, say, FrameMaker in your browser.

There's a guide to getting it set up still alive at <http://www.csn.ul.ie/~caolan/TechTexts/Broadway.html>

This was in 1996, in the X11R6.3 release ("Broadway"), the same release they came out with LBX, the low-bandwidth extension to X, so that you could run your X11 apps over a modem with reasonable throughput.

It never got much adoption. I don't really know why. My guess, though, is that it didn't address the real reasons people were moving from X11 to browser apps: server load, security, ease of administration, latency-tolerance, and ease of development.

Today, server load and latency tolerance are a lot less important than they were in 1996, because computers are a hundred times faster and hundreds of millions of people have ping times under 20 milliseconds, ten times faster than you'd get on a modem.

But security, ease of administration, and ease of development are a lot more important now than they were in 1996.

So, I suspect this won't get widely adopted, but it could go either way. I hope it does!

<comment><USER3> Notice the dropdown menu when he types in the address: it says "Broadway 2.0".

<comment><USER2> I just read the post; I didn't watch the video.

</comment></comment></comment><comment><USER4> (re-posting my comment from the blog because I want to hear people's opinion)

This is extremely useful for getting apps written for the desktop to run on the browser for remote access and virtualization.

I don't know if there are any companies with GTK3 desktop apps that need this right now, but for the past six months I've been working on doing exactly the same thing for JazzScheme (<http://jazzscheme.org/>). JazzScheme has its own widget set and UI library that runs on top of Cairo. Instead of sending bitmap data across I'm providing a thin indirection layer on top of Cairo surface and HTML 5 canvas (they're almost identical in terms of drawing commands).

We're using it for a pretty involved business app that needs a desktop version. Doing a web version any other way would have been a complete nightmare.

</comment><comment><USER5> The technical description:

 _Each toplevel window is mapped to a canvas element, and the content in the windows is updated by streaming commands over a multipart/x-mixed-replace XMLHttpRequest that uses gzip Content-Encoding to compress the data. Window data is pushed as region copies (for scrolling) and image diffs. Images are sent as data: uris of uncompressed png data.

Input is gathered via dom events and sent to the server using websockets._

This doesn't really sound that impressive. It's kind of cool and you could also do the same and port some RDP or VNC client over which would be even cooler. But I don't really feel that this is the way to go. It would be much nicer if the native HTML widgets would be used.

<comment><USER6> There is not a 1-to-1 mapping between all Gtk+ widgets and all HTML widgets.

<comment><USER7> HTML5 allows making any element focusable and supports ARIA that exposes custom elements to accessibility API, so you can make pretty good custom widgets using DHTML.

</comment></comment></comment><comment><USER8> If this turns into a complete and mature implementation, I won't miss anything when Ubuntu drops X11 next year, quite the opposite!

</comment><comment><USER9> Now this is getting serious. I was considering porting xul for web apps (with the default and obvious coffeescript dsl, so that no xml verbosity would be needed), but gtk3 is even more outstanding. Any idea when it will be out?

<comment><USER10> It's not a product, it's a demo he hacked up to see if it was worth pursuing.

</comment></comment><comment><USER11> How come is the UI so responsive (much more than what I'm used to with remote X sessions)? Is it because both the app and the HTTP server run on the same machine?

</comment><comment><USER12> The Qt guys have a similar thing. It however needs the Google native client plugin.

[http://labs.qt.nokia.com/2010/06/25/qt-for-google-native- cli...](http://labs.qt.nokia.com/2010/06/25/qt-for-google-native-client- preview/)

There's also the QWebClient which does not need a plugin, but also does not look very beautiful or native.

[http://labs.qt.nokia.com/2009/09/18/qt-in-the-cloud-with- qwe...](http://labs.qt.nokia.com/2009/09/18/qt-in-the-cloud-with-qwebclient/)

</comment><comment><USER13> The biggest gotcha with these kinds of demos is, and always will be, keyboard input. Unless browser vendors are willing to relinquish all keyboard controls for a special kind of popup window, HTML5 VNC type solutions are dead in the water.

</comment><comment><USER14> The GTK ports on Mac are pretty bad looking. This would make them awesomer again!

<comment><USER15> Does it just use the default GTK+ theme, or are there rendering issues?

</comment></comment><comment><USER16> This actually makes some sense (if I understand it correctly), vs. a VNC client solution in a browser.

You can, in theory, use the higher-level hints given at the toolkit level to optimize the bits sent for each toolkit API invocation.

</comment><comment><USER17> It looks cool, but (and please forgive my ignorance in this subject)...

Isn't this the sort of thing X was built for? Client rendering, but the underlying app in a remote server? How is rendering this in the browser more useful/cool?

(edit: typo)

<comment><USER18> Browsers exist in more places than X clients.

</comment></comment><comment><USER19> I can think of potential use cases similar to what 280 North are doing with Atlas and Cappuccino.

Check out <http://280atlas.com/>

<comment><USER20> Yep, in the sense of cocoa vs gtk. But rather than a port to js, it's a port to canvas.

</comment></comment><comment><USER21> "Each toplevel window is mapped to a canvas element" Does this means it's not crawl-able, or is it?

<comment><USER22> I'm not an expert, but I believe this to be correct - the contents of the canvas elements are created/managed by javascript, so they would likely appear empty to most spiders.

Additionally, I don't believe there is any good way to crawl the contents of a canvas element - the best you can get from it is an image representation as a data uri, so no text or html elements with semantic meaning.

</comment></comment><comment><USER23> Didn't some people do this with VNC a few months back? Either way, this is damn cool.

</comment><comment><USER24> Related work: the Rich Ajax Platform, an implementation of Eclipse's SWT using the Qooxdoo Javascript framework.

</comment><comment><USER25> Thats awesome, I'm more than a little jealous I didn't think of that.

</comment><comment><USER26> I was _just_ lying on the couch thinking about this idea. Well, I have much larger, grander idea that is a mix of Palm/HP's new Mocha platform and some play at ubiquitous interfaces and data powering apps on many devices simultaneously. I was thinking though, that some of the frontends for rtorrent look neat, but still fail to look native.

What if the browser exposed the GTK resources and allowed web applications to render using the same visual components as native applications on the platform. That'd be sweeet.</comment>


Returning http 200 OK with error within response body - <AUTHOR> https://stackoverflow.com/questions/27921537/returning-http-200-ok-with-error-within-response-body#27922900 <comment><AUTHOR> I am curious what peoples opinions are on this. There are two conflicting answers on SO both with decent reasons. Personally I don't like it, but it seems pretty common.</comment>


Show HN: airsocial.co – meet the people on your flight - <AUTHOR> https://airsocial.co

<comment><USER2> Interesting. There was a Paul graham video some time back where he did office hours with someone who was pitching the exact same idea. I cant seem to find it. Have you seen it? Are you the same person? He didnt seem to buy into it too much in the video

<comment><AUTHOR> I'd love to see that video.

<comment><USER2> found it... here it is [http://techcrunch.com/2011/05/25/absolute-must-watch- office-...](http://techcrunch.com/2011/05/25/absolute-must-watch-office-hours- with-paul-graham-at-tc-disrupt/)

the one with the airport thingie starts at the 35th minute

</comment></comment></comment><comment><USER3> Do people want to meet people on their flight?

<comment><AUTHOR> A reasonable part of them does. Sure, there's a huge group of people who treat flights as getting from A to B (I'm looking a business travelers here), but a decent portion of them says they'd use an app like this if they had more control over who gets to see them.</comment></comment>


Next Generation Wind Turbine Breaks $1/Watt Barrier - <AUTHOR> http://solveclimate.com/blog/20080606/broadstar-wind-crosses-1-watt-barrier-watch-out-solar

<comment><USER2> Does anyone know what the "$1/Watt" figure is supposed to mean?

"And it will make wind cheap – $1 per watt, installed – for the first time ever, with the 250,000 kWh machine to be priced at $250,000."

\- kWh are a measure of _energy_ , not power. (1 kW sustained over 1 hour) Are they saying the turbine's lifetime is limited generating that much energy?

\- The paragraph above implies that the cost is $1/kWh - somewhat more reasonable than $1/Wh. Although that's still more (~3x) than I'm paying for my electricity right now.

Alternative theory: what they mean is the turbine generates up to 250kW under ideal conditions, and costs $250k to set up. That would mean the $1/Watt figure is about setup costs. (depends on the amount of required maintenence whether that's an interesting number)

<comment><USER3> Your alternative theory is right. What they mean is that the turbine costs $250k retails, setup costs excluded. And these will add 10% easily - foundation, electrical network link etc. And the turbine generates 250kW of peak power under ideal (right wind) conditions. So the $1/W figure is, as you say, a one-time cost. Maintenance should be pretty low however.

</comment></comment><comment><USER4> This is mostly likely garbage.

There are innumerable companies with prototype systems that claim theirs will be cheaper than all others. There's no evidence that this turbine will be particularly cheap, and there's plenty of evidence (the kW / kWh confusion, the mention of "surface-wind energy") that the author is unfamiliar with renewable energy and likely unable to determine whether a new wind turbine is better or worse than existing turbines.</comment>


First human head transplant could be achieved by 2030 - <AUTHOR> https://www.independent.co.uk/news/science/human-head-transplant-spinal-cord-nhs-chrysalis-bruce-mathew-canavero-neurosurgeon-a9256841.html <comment><USER2> Would have happened already, but the transplant receiver backed out.</comment>


Ask HN: Would you pay for a code similarity detection tool? - <AUTHOR> I've been working on a proof-of-concept code similarity detection tool.
The tool is based on matching semantically equivalent code fragments, i.e. it detects similarities across inlined or lifted functions, reordered but equivalent expressions and so on.
Check out the attached screenshot [1].
The idea is to mine the publicly available npm repos, and provide a payed service for detecting similar code fragments already implemented in npm libraries -- basically an open REST service and one or two plugins for the most popular editors (vim, Sublime, Atom?)
If this proves successful, I would extend the service to other languages and services, where applicable.
Would you pay for such a service? What kind of features would you expect?
[1] https://dl.dropboxusercontent.com/u/30225560/ase.png <comment><USER2> Commercial consumption of this idea is around verifying licensing. My employer runs a tool against our internal repositories looking for code it's aware of on the internet. When it flags a match, a human looks at our use of the publicly available code and verifies our compliance with the license that came with the code.

I, a software developer, wouldn't buy such a thing, but there's certainly enterprise/corporate demand for it.

<comment><AUTHOR> I haven't thought about enterprise, it may be direction worth pursuing, thanks!

</comment></comment><comment><USER3> Some exist already:

[http://www.harukizaemon.com/simian/](http://www.harukizaemon.com/simian/) [http://dickgrune.com/Programs/similarity_tester/](http://dickgrune.com/Programs/similarity_tester/) [https://github.com/silviocesare/Clonewise](https://github.com/silviocesare/Clonewise)

<comment><USER4> I agree -- here's another: [https://www.blackducksoftware.com/products/black- duck-suite/...](https://www.blackducksoftware.com/products/black-duck- suite/protex)

</comment></comment><comment><USER5> Well there are plagiarism detection tools that education institutions use to detect cheating in CS classes.

There are several machine learning solutions that can look for your IP in either source code or binary form even on an abstract (algorithm) level.

Many tools exist like that, the real question is what exactly your target audience is?

If you are scanning public repo's what service does the tool actually provides, and no detecting code similarity isn't the answer here.

Selling something isn't really an issue as long as it has a clear purpose which i don't think your idea has at this moment in time.

<comment><AUTHOR> Many of the plagiarism detection tools don't work on a semantic level. There are some, I haven't found an easy, it-just-works online solution.

Could you share links to the IP detection ML tools?

And to answer your question, please read my answer here [1].

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

<comment><USER5> Been demoed those solutions by some consultancy firms will have to dig them up.

But still what is the use case?

I mean if i wrote code which is functioning why would i replace it with some one elses code?

Taking in raw code even (especially from) OSS repo's is a huge huge can of worms.

Say you are developing a product if you use an OSS library which is distributed as is you can bundle it with your product under most licenses unless you modify it without having worry about anything.

If you copy paste code form that library into your own code base well than what is it? a copyright violation? derivative work? I can easily bundle OpenSSL with their Apache license and just make a remark about it some where during the installation, i don't have to distribute my software or source code under that license or under any other OSS license.

But if i take the raw source code say their ASN.1 parser and implement it in my own program? what now? I'm not an IP lawyer but I'm pretty sure this either violates the license outright or my software now just became some derivative work which means the terms (or some of them) of the original license now apply.

Even if my software was meant to be OSS it's still an issue maybe i don't want to use Apache or BSD maybe it want GPLv2 or V3 or my own license or what ever.

The other issue that stands out to me is that I already wrote functioning code, it works, it's mine, i know it i understand it i can maintain it, why should i on-board someone elses code that i won't know, won't understand, wont be able to maintain as easily? Where is the benefit in that if I've already written all / most of my code for your similarity score to trigger a suggestion?

</comment></comment></comment><comment><USER6> Personally no.

Sometimes I deliberately choose not to abstract away simple logic (as in your screenshot) for performance reasons, or just to reduce a complex dependency chain (I'm all for code reuse, but I do also believe in a balance when writing portable code). And the instances where the required logic is more complex, I'd know to be looking for a module before writing my own code.

Because of these reasons, I couldn't even see myself using this tool if it was free.

However, this does sound an interesting project and I think you should still proceed with it regardless of my feedback as, even if it doesn't because a profitable exercise, I could see this becoming a future must-have feature for IDEs - eg for code refactoring. In fact maybe you could extend this tool to analyse repeated code within a project and suggest abstracting that out to a function (that's a tool I probably _would_ use on larger code bases!)

</comment><comment><USER7> Would you pay for it yourself? I'm struggling to see what a normal developer would use it for. I think your main customer will be high schools, colleges and universities. Not so much professional developers.

<comment><AUTHOR> I would, yes - it's a form of scratching my own itch.

I don't know about you, but I find myself writing boilerplate code very often. Converting between timezones, reading config files, making HTTP requests (+error handling), UI idioms (click & disable), etc.

Often the code handling such things is spread over a bigger function, like open a file on line 5, loop over lines and read into array on lines 24, 25, 26, close file in finally {} clause.

What I want is a tool telling me "hey, you can replace these lines by function X in open-source package Y." Maybe I overestimate its universal usefulness though :)

</comment></comment><comment><USER8> There's a YC company doing something very much like this, but against compiled binaries.

<comment><AUTHOR> Would you mind sharing which, or haven't they gone public yet?

<comment><USER9> I'm the founder of SourceDNA, which tptacek is referring to.

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

<comment><USER10> You've got YC investment now? Congratulations!

</comment></comment></comment></comment><comment><USER11> Mirror, in case the OP's Dropbox account hits its bandwidth limit: [http://i.imgur.com/ciEUQth.png](http://i.imgur.com/ciEUQth.png)

</comment><comment><USER12> Your lefthand example works on "i" as a global variable - it has additional effects compared to the example on the right.

Tools like this are common within Java as Java and similar are easier to this kind of analysis on.

IntelliJ IDEA is long reigning champ in this area. (Which is a product I would pay for.)

<comment><AUTHOR> You are right - sorry about that. The example was put together in 5mins and was meant to just convey the general idea.

I'll have to check out IDEA again, thanks!

</comment></comment><comment><USER13> (I work mostly on Python, so this is my opinion based on that)

Most of the code that I write that would be duplicating the functionality in a library would be doing so because we don't need the extra functionality. For example, I need to pluralise a small set of words, so I write 3-4 clause if- statement and append some "s" characters because I don't see the need to use python-inflection. The latter is massively more complex, so unlikely to be detected as the same thing.

Sure, there might be a few matches, but I suspect they will mostly be helper functions within libraries, rather than the public API of libraries.

I would prefer not to send code to a web service for detection, although not totally against it. In many companies this would not be allowed, either through policy, firewalls, exfiltration detection systems, or lack of internet on development machines (I know people who work, or have worked myself, in all of these situations).

Something I think would be far more valuable, and possibly more realistic as well, is local detection that highlights possibly duplicated code in a codebase. I find little snippets (1-2 lines) that have been duplicated on a fairly regular basis, and if I could identify those to be extracted out into re-usable methods, that would be amazing.

Would I pay money for it? Probably not, it's not that much of a problem, and all those sorts of tools are usually open source anyway. Unfortunately that's my expectation now.

<comment><AUTHOR> All valid concerns.

I guess the best way to address the usefulness issue is to run it against popular frameworks, like React or Angular, and see what happens.

If it proves useful (like say 10% of code could be replaced by existing functions), would you change your mind?

</comment></comment><comment><USER14> Tools are very hard to sell. Especially very specialized tools. And tools for programmers often come with the end-user price of 0, so justifying anything above that is hard.

For me personally, I don't see the need to even use such a tool, let alone paying for it. Many programmers seem to focus on code, but in my experience, that's usually not the problem you have when things go bad.

</comment><comment><USER15> Your example looks similar to what ReSharper does: [http://blog.jetbrains.com/dotnet/2009/12/11/resharper-50-pre...](http://blog.jetbrains.com/dotnet/2009/12/11/resharper-50-preview- loops-2-linq/)

<comment><USER16> I think Visual Studio does it too with its Analyse Solution for Code Clones. It's an Ultimate edition feature though.

</comment></comment><comment><AUTHOR> Clickable link for the image: [https://dl.dropboxusercontent.com/u/30225560/ase.png](https://dl.dropboxusercontent.com/u/30225560/ase.png)

</comment><comment><USER17> I was just reading about plagiarism detection recently [http://theory.stanford.edu/~aiken/moss/](http://theory.stanford.edu/~aiken/moss/)

How does your techniques compare to Winnowing? [http://theory.stanford.edu/~aiken/publications/papers/sigmod...](http://theory.stanford.edu/~aiken/publications/papers/sigmod03.pdf)

<comment><AUTHOR> It works on a semantic level (i.e. what the code actually means), rather than fingerprinting strings. This means that reordering code segments, renaming variables, inlining or lifting functions wouldn't affect a match, if the code is semantically equivalent.

<comment><USER17> cool. Sounds more robust.

</comment></comment></comment><comment><USER18> > basically an open REST service

Be careful with that, it restricts your customers to a certain lightmillisecond distance from your server - if the plugin is intended to be real-time.

<comment><USER19> If it turns out to be at all useful with regard to maintaining revenue- generating code in production, $25 per year is a laughably low ask, even if it's only useful some of the time for some of the people.

Figuring out which people and when is, generically, a matter of doing your homework with customer development and targeted marketing, and then further improving your marketing surface as you learn more about who is a customer and how to find them.

Going from "this might be useful" to a working business model is, of course, a deeply nontrivial problem...but it's one that many people have solved before, and it's a heck of a lot easier if you don't start with "maybe $25 per year."

<comment><USER18> For some reason my brain added in an estimated cost to the OP. You're right: it's outside the scope of what is being asked. Removed the pricing stuff.

</comment></comment></comment><comment><USER20> There is a project called jsinspect which does what you are talking about. I dont know if yours would be a bit more robust than this one.. But just wanted to provide this - so you know what you are competing with.

[https://github.com/danielstjules/jsinspect](https://github.com/danielstjules/jsinspect)

<comment><AUTHOR> Thanks, I've seen jsinspect. It works by comparing ASTs, which is probably than matching strings, but I guess it wouldn't be able to deal with inlined functions or reordered code segments etc.

</comment></comment><comment><USER21> Would love to see this integrated into an IDE such that it is capable of detecting whether or not what you're typing (or something close to it) already exists. For companies with large codebases this is a major enough problem that a decent solution would have a compelling enough ROI to shell out some cash.

</comment><comment><USER22> I'm not sure if I would buy it, but it could be a very nice way of introducing to a new language/framework. When learning a new environment, one doesn't know all the functions and it's very easy to write code that is already implemented.

So, maybe try asking someone who is into programming training programs.

</comment><comment><USER23> McCabe software has a tool that's supposed to find duplicate code within a code base (e.g. cut-n-pasted functions), using path analysis. They have been around for ages, but I've never used them since they're rather expensive.

</comment><comment><USER24> As a professor, I always missed an easy-to-use and modern tool for that. I didn't research this topic much, but not finding anything easy and ready to use is probably a market opportunity (if there _is_ a market).

</comment><comment><USER25> Have you looked at Code Climate?

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

<comment><AUTHOR> No, thanks for the link!

Code Climate looks more like a linter though?

</comment></comment><comment><USER26> How did you choose to work on this idea?

<comment><AUTHOR> Basically by wanting to make my life easier when working on bigger, hard-to- maintain codebases :)

</comment></comment><comment><USER27> How do you determine semantically equivalent code fragments? Is it a dynamic solution or a static solution?

</comment><comment><USER28> Personally, no. Even if it was an IDE feature, I would rather just learn it if I use it frequently.

</comment><comment><USER29> I would not stuff like that exist for free and I rarely use that kind of tools.

</comment><comment><USER30> Generally, no. There is no money to be made making tools.</comment>


Mozilla Foundation Chair Explains SOPA/PIPA in Plain English - <AUTHOR> http://blog.lizardwrangler.com/2012/01/17/pipasopa-and-why-you-should-care/

<comment><AUTHOR> I've submitted this because many non-tech people have been asking me for a layman's version of SOPA/PIPA explanation, and I think this has been effective. Our tech advocacy spilling into the mainstream is good. If other people have good links for laymen, please share them here so we can pass them on.</comment>


Now Is The Time To Haggle - <AUTHOR> http://www.time.com/time/magazine/article/0,9171,1913774,00.html

<comment><USER2> It's incredible what you can get if you just ask. Nota Bene, my friends, /many/ wealthy people use these strategies to help get ahead.</comment>


Politicians in favor of upload filtering get channel deleted by upload filtering - <AUTHOR> https://www.privateinternetaccess.com/blog/2018/06/politicians-about-to-vote-in-favor-of-mandatory-upload-filtering-in-europe-get-channel-deleted-by-youtubes-upload-filtering/ <comment><USER2> I think at some point the EU market might become something similar to China, where you don't offer your services at first, and once your service already becomes successful in the rest of the world you consider porting it over, if a clone hasn't popped up and grabbed market share in the meantime.

Which might not necessarily be a huge negative for the users inside the EU, aside from people being unable to access things they want to access because of where they live. Which I'm hugely opposed to, in several ways.

Either way, I'm conflicted about all the stuff going on in the EU. I haven't made up my mind as to which side I fall on, but I do hope they tread carefully.

<comment><USER3> As a EU citizen, I sure hope so.

edit: my message seems to be confusing. I was answering the last sentence of the parent comment, saying that I hope as well that EU doesn't screw up.

<comment><USER4> I'm not sure if it would we a screw up. I mean, I actually liked early 2000-s, when Internet was kind of place of reigning anarchy as if there was no government and evil corporations, but let's just face it: it's long gone. Maybe there will be something else to offer the same kind of experience in the future, but it will never be the Web again, it's dead, taken by the enemy. Parents are home again. So, speaking about the least evil, you know, I would be actually glad, if Facebook (as it is now) would never enter the EU — and maybe somewhere across the ocean whole nations would be enslaved by it, I wouldn't care, because I don't have to use it, since my friends, local businesses and events don't force me to.

In fact, it seems that it's finally the case when people around might have to be "protected", since they cannot make the right choice themselves, and push me to it, as a consequence. So, being quite a libertarian myself, given the imperfect situation I find myself in, I'm not sure I mind some government interference.

I actually hate all these pop-up banners warning me about the cookie usage, and I'm not sure if GDPR (being vague and undefinitive it is) will turn out to be a good thing, and I sure hate this copyright filters thing. But I kind of like EU trying to force Internet-businesses to behave.

<comment><USER3> Oh, it seems I was unclear again ;)

I _will_ pay attention to the decision the EU takes, as a citizen. And I hope that I agree with them — "screwing up" essentially meant doing something I disagree with.

Just like you, I don't know if GDPR will be a good thing; but at least it seems to be written with the citizens' well-being in mind, and that's a big change.

> I would be actually glad, if Facebook (as it is now) would never enter the > EU

So would I.

</comment></comment></comment></comment><comment><USER5> These guys basically want to recreate their own version of Chinese internet.

I wish this were feasible - Uber's approach of geofencing authorities to filter the internet for authorities - let them see what they want to see. And let the rest of us have a free internet.

<comment><USER6> I've got to believe that European people as a whole don't understand the implications of this. It's a really horrible thing - they should be protesting in the street about it.

<comment><USER7> We've been fighting these recurrent ideas time and again, mostly winning on technical grounds. This is pretty weak. Freedom is not a good argument against a torpedo that is "think of the children".

We start by educating how expensive, impractical, unenforceable and ineffective such things are.

</comment></comment></comment><comment><USER5> An uncensorable internet is sorely needed.

Easy to setup and join - install an app and that's it.

The current Internet's not anonymous. With sufficient motive and resource, anyone can be tracked. Thus, anonymity shouldn't be a priority here.

Just make it fast, easy to use, and very difficult to take down (censor) stuff.

<comment><USER8> >An uncensorable internet is sorely needed.

Governments don't need to censor the internet via technical measures to impose their will. They just need impose large fines on the companies that violate censorship laws.

Facebook has a version of their site hosted on Tor. That doesn't mean facebook can violate EU laws.

<comment><USER9> Even without companies, there might still be services. Consider SciHub.

(But who hosts SciHub?)

</comment></comment></comment><comment><USER10> I don't think anyone honestly believes that this was "coincidental".

<comment><USER11> why not? They admit they uploaded copyrighted content... they just say they had a right to broadcast it. Content ID doesn't magically get a copy of all legal contracts you've signed.. it'll flag copyrighted content if the original author registered it.

<comment><USER12> This happens with humans sometimes, too. Previous employer got a C&D letter from a client who had forgotten they had asked us to make and release an app for them with their logo and content. (No I will not say who).

</comment></comment></comment><comment><USER13> Blocking EU users is completely beside the point. Youtube is already filtering this content because of US laws, not EU laws. There's no point blocking EU users to avoid EU copyright laws when complying with the DCMA is just as bad.

</comment><comment><USER14> Good!

</comment><comment><USER15> Url changed from [https://boingboing.net/2018/06/17/three-days- left.html](https://boingboing.net/2018/06/17/three-days-left.html), which points to this.</comment>


Ask HN: What are the rarest books in your bookshelf? - <AUTHOR>

<comment><USER2> I have a history book that my great-grandmother used in the early 1900s. It's nice to look at when you need a reminder of how far we've come as a people.

</comment><comment><USER3> I have an original print copy of the Hobbit.

</comment><comment><AUTHOR> Mystical Experience by Ben-Ami Scharfstein</comment>


Rubymotion is now free - <AUTHOR> http://www.rubymotion.com/download/starter/ <comment><USER2> Eh, they kept the price so high for all this time and now that Xamarin has become free they decided to offer it free, (but still: "Non-customizable splash screen. iOS and Android stable versions only.Support for OS X, watchOS and tvOS not included").

Probably a bit too late guys?</comment>