skysight-inc/HackerNews huggingface dataset:
For comparison, I translated it pretty directly to Python:

import sys
from math import sqrt

def string_palindrome(num):
s = str(num)
return s == s[::-1]

sys.stdin.readline() # throw away first line (number of cases)

for count, line in enumerate(sys.stdin):
found = 0
start, finish = [int(num) for num in line.split(" ")]
sqrt_start = int(sqrt(start ))
sqrt_finish = int(sqrt(finish))

for x in xrange(sqrt_start, sqrt_finish+1):
if string_palindrome(x):
square = x * x
if string_palindrome(square) and start <= square <= finish:
found += 1

print("Case #%d: %d" % (count, found))

For the first 15 test cases I get the following run times:

pypy 2.0-beta2: 1.6 seconds
pypy 1.9: 2.1 seconds
ruby 1.9.3p194: 3.7 seconds
python 3.3.0: 5.9 seconds
python 2.7.1: 6.2 seconds

The integer version for checking palindromes was also much slower in python.

Edit: Even though the interger version of _palindrome is slower in pypy, there's another optimization that works there, but is slow in cpython. It brings the run time down to 0.6 seconds!

def half_string_palindrome(num):
num_str = str(num)
num_len = len(num_str)

for i in xrange(0, num_len // 2):
if num_str[i] != num_str[num_len - i - 1]:
return False

return True
I'm terribly confused here.

"continue to run Ubuntu in a VM on the MacBook with its relaxed HDD"

Did he try with bootcamp on Ubuntu 12.04 (the LTS version)? I just tested on two macbook pros (mid 2011, early 2013) and both seem fine.
Laughter Marks a Successful Culture of Innovation
A DSLR on auto is a sad thing to behold.

I'm an amateur photographer. My DSLR is almost 7 years old now and my iPhone can keep up with it as a point-and-shoot, but nothing on the iPhone can compare to setting up the shot properly. Switching lenses for the situation is also really handy.

The dynamic range in the photos is much better from the DSLR as well.
EventMachine helps with performance critical Ruby code
I am Jack's complete lack of surprise.

I think a startup to fix voting would actually be a really cool (anyone here doing that already?), although I imagine it would be fraught with danger.

I think we need to step back to first principles here. In an ideal voting system, we need two properties:

1.) The vote must be anonymous (to remove the possibility of persecution)
2.) There has to be some way to detect if a vote has been tampered with.

Here's the thing... we can solve BOTH those problems with common cryptographic algorithms. Problem #1 can be solved with a hashed identity, problem #2 can be solved with a checksum.

Right now we try to solve that with a "paper trail". That's one solution, but it's very problematic. First, you're putting a lot of trust in the people doing the counting. Second, we can't trace those pieces of paper back to people to ask them "is this really who you voted for?"

I'm not claiming these are /easy/ problems to solve. There are a lot of considerations. But I will claim that we already have the required cryptographic toolset to make it possible, and that simple counting machines are entirely inadequate.
I agree that most of your requirements seem to have a lot in common with project planning tools that are commonly used to plan and manage software development with traditional methodologies. Microsoft project is the classic example, though industry trends seem to have made it a low priority for them.

All of these tools focus on creating gantt charts or similar, with independent subtasks that can be reliant on other tasks, broken into subtasks, group within barriers (milestones). They help enormously when you need to insert things or reorder stuff.

I've never seen one used to incorporate the actual detailed instructions for completing the task, generally because part of the task is figuring out how to do it. But I'd be surprised if you looked at a few different project management applications that there wouldn't be one or more that could be used that way. If nothing else you probably would be able to use the task description that's usually very short to include an arbitrary amount of text.

The biggest challenge might be in getting a report formatted to your liking at the end of the process with all the details nicely formatted. Most of these systems provide a great deal of extendability, so you might need to have some minimal development work done in terms of a custom report format. Or maybe not - these are enterprise systems that are usually loaded with special case features.
What's a practical example of something that can't be done with proper evented programming, and has to be implemented using web workers?

If you need to perform CPU heavy calculations or processing of video/audio it just doesn't make sense to do it on the client even with web workers.
Actually, Python is compiled (just like Java, C#, Ruby) to bytecode which is executed in a virtual machine. It is the dynamic nature of certain languages that can make them slower than languages that are statically typed.
> Python can't handle large numbers, so the mere existence of huge integer inputs for the large prime number problem blew up my code since Python could not convert numbers that large.

Beg pardon?

>>> 2**2**2**2**2
[snipped because HN does not allow 20k comments)
This video is ancient. I think it came out shortly after the 2004 election
Speculators. Slowing down exchanges drives the price of BTC down. So the plan is to start a massive DDoS, stop it, buy BTC at a lower price, and sell it again when the prices went back to their previous levels.
I prefer trusted to cheap (and I certainly hope everyone else does). Of course the government prefers cheap, but it probably prefers tamperable too :P

Good call about the disabled. What are the current systems doing for them?
I'd have to agree, the photos all looked undersaturated and flat. Good enough for your average holiday snap I suppose, but nothing compared to what a good photographer can get with a DSLR.
I'm curious, which ADHD medication and generic did you use? I'm on Ritalin myself.
Cryptography is only useful if you trust the receiving end (which I don't and you shouldn't).
I believe there isn't currently any mechanism for the U.S. FDA to restrict number of pills sold of OTC medication

There are exceptions (but I'm not sure if they're from the Law Enforcement side, or the FDA). For example, you can't buy Sudafed (whose active ingredient, pseudoephederine(?), is used to make meth) without severe restrictions: not more than a pack a day, need a valid ID, etc.
The two most obvious culprits would be:

1) People trying to make the price of bitcoins drop, so that they can buy low and sell high. (This possibility is called out in the article.)

2. Criminals trying to extract a ransom from Mt. Gox, which is losing a lot of revenue and trust every minute their site is down.
Yeah. Software can fake a lot of things, like DOF or vintage film effects - but you can't fake good glass or a wide-aperture lens.
There are less confrontational, more useful, ways to convey your point than to call people liars.

'Anecdotal evidence bubbles' are fascinating. Try posting links to research about the placebo effect instead of resorting to name calling.
Deploying with Chef - using/generating the ssh_wrapper
The UK law is stupid. My sister took her life using paracetamol. She just drove to 3 different pharmacies and bought the max amount at each. She also bought sleeping tablets so that the pain of her dying liver would not wake her.

A few days before this, my family had tried to have her sectioned as mentally ill (she was suicidal from post-natal depression). They psychiatrists kept her in for observation for 48 hours, then released her. 24 hours later she was dead, and her child an orphan.

All the law did was slow her down for maybe 15 minutes in her suicide attempt.
Well that I can understand (I have a family to consider), but I'd like to think I'd be moral/insane enough to raise the stinky pinky at the request.
There is also Flowdock[0], which wants to compete pretty aggressively here (disclaimer, I work for the company that bought Flowdock)

[0] http://www.flowdock.com
It depends on what you're doing with photography. The big selling point of a DSLR is interchangeable lenses, I have a telephoto, a macro, and a general purpose kit lens. I have macro shots of jumping spiders with amazing detail far better than any phone could possibly get, and shots of birds and wildlife that are better than any phone could possibly get. Wide angle lenses again will let you do things you can't do with a phone. In low light a DSLR will be much better - the tech. and larger sensor reduces noise. You have direct control over aperture, ISO, manual focus, shutter speed and various settings which experienced photographers use to get better photos. Also things like ring lights and speedlights can help a ton and aren't an option for phones.

Modern phones can take great photos, but the reason to opt for a DSLR are to get far better photos than a phone can manage for a lot of types of photography. No nature photographer is going to walk through the woods and be happy with a phone. Here's a photo of a bee hive I'd never try to shoot with a phone that was perfectly safe with my DSLR:

http://www.flickr.com/photos/somebachs/8639569426/

This Waxwing shot would be impossible as well:

http://www.flickr.com/photos/somebachs/8401678087/

And the spider photo:

http://www.flickr.com/photos/somebachs/8626752660/

Yeah, I might just be posting photos since I like photography... But still, they are ones a phone couldn't take.
Some of you are missing the point here.

There are people who buy dslr cameras to take snapshots, and they do it because they think this will magically make their photos better.

And then these cameras never leave automatic mode, and never have the kit lens removed.

The point is that you don't need an expensive camera to take perfectly good shots [for most applications]
But this dude's photos suck.
In the Facebook era, I think people have a hard time seeing the value of paying for ad-free models like App.net where free alternatives are available. Even Wikipedia has a hard time raising enough money through through their "just beg for it" revenue model, and they generate a significant amount of user ire in the process. 99% of their users would much rather see ads than put up with their invasive virtual panhandling.

While the motivation behind such models may be noble in the eyes of their developers, the whole "ads are evil" notion simply doesn't make sense to most of the general population. Accordingly, most of these models are doomed for failure. If my goal is maximum distribution, I will always choose to develop for a free platform.
Chomsky chomsky chomsky chomsky furiously
Is something like a distributed peer-to-peer bitcoin exchange in the works? Will something like that ever be released?
The following site allows you to search for people's solutions by language:

http://www.go-hero.net/jam/13/solutions

There are actually several people who solved this problem (including both large inputs) using Ruby.

And for those asking about Python, most Code Jam problems are apparently calibrated to be solvable using Python. Keep in mind that it's one of the languages Google uses internally and Guido used to work there, so they probably want to support it. From https://code.google.com/codejam/problem-preparation.html:

"Where possible, if you allow multiple programming languages, make it so that all languages are fast enough to solve the problem. Occasionally that's impossible; in Code Jam we generally calibrate by making sure a somewhat optimized Python program can solve a problem. Sometimes, though, there's just no way to have Python succeed with the best algorithm and C++ fail with a worse one. In those cases we'll typically decide that sometimes in life, you just need to use a faster programming language. We try to avoid making that decision if we can."
Claims you don't need a DSLR then produces a bunch of amateur photos as evidence.

I think computational approaches like the Lytro are the future. But right now, DSLR's still produce markedly better images thanks to faster lenses, larger sensors, shallow focus depths that create buttery soft backgrounds.

Some of those advantages, larger cameras will always have. At some point we'll probably ditch the anachronistic "reflex" part. The viewfinder gives you an inaccurate representation of the image anyway.

Smart phones are good enough for 98% of the photography that we do - vacation photos, drunk nights out with friends, that colourful homeless guy with neon tassels and a cowboy hat.

I can still easily tell a DSLR photo apart from a camera phone shot and it doesn't take pixel peeping either. Better dynamic range, sharpness, focus.

Still love my camera phone, in fact I don't even have a DSLR anymore. But I'm not going to pretend its anywhere near as good as a pro camera in pro hands.

Of course, we're geeks and love to expand our skills. One day we wake up and want to be a photographer dammit. So we buy a DSLR and take it to parties, dinner, public events. The big camera is a liability - you worry about dropping it or having it stolen. It also makes you look like a dork. Sometimes people give you flak for bringing a pro camera to no cameras allowed situations. When you do take pictures it feels like a ceremony. Of course, you have to nail the photo because you just spent 2500 on a camera. Every previously dismissible imperfection is now a bottleneck that prevents your camera and you, the ariste, from living up to their full potential. You need the external bounceable flash, the L series lenses, the filters and hoods.
I hope they weren't running any mission-critical software on her...
That's not what the author says.

> Why burden yourself with such a bulky device, not to mention the cost of it, when your good old phone can take just as good photos.
that more wounded people didn't die thanks to fantastic work by the hospital and doctors

The EMTs and hospitals did marvelous work, but one nonobvious fact that helped a great deal was that the bombing was within 2 miles of FIVE DIFFERENT level 1 trauma centers. All five are world class teaching hospitals and one of them, MGH, had been recognized as the best hospital in the US at one point.

There are several states that don't have even a single level 1 trauma center....
It really depends on what sort of pictures you are taking. If you are taking photos in low light, a better sensor (whether it's a full-frame 35mm or an APS-C sensor) will allow you take photos without using a flash in certain environments where using the cell phone would be hopeless.

There are also certain things you can do playing with depth of field that aren't possible with smaller sensors such as found on a cell phone. But it's also true that for most people, and for most shots, it doesn't matter. What does matter is that you have a something to take a photo with you; using a cell phone is just another variant of the old saying, "f/8 and be there".
Sure, you can hire an "SE" (and I use the quotes deliberately) for $15/day also; but you won't get much use out of her/him. Decent grads from a good school regularly get Rs 100K/month offers, from what I've been told (which works out to about $10/hr or so).
Anyone know why such a straightforward article has eight authors? What could each of them possibly have contributed?

I have noticed in the past that bioscience articles tend to have lots of authors but always thought it was due to their inherent complexity requiring lots of different skills.

Perhaps it is really just a way to get more published papers for more people to help their academic career. This may explain some of the super long CVs these guys often have.
Your #1 is false. A single unreplicated study is much less meaningful than several successful replications, but it does have some meaning: "this result looks interesting, someone should try to replicate it and expand it".

If the the first study on any question is completely meaningless, there'd be no motivation to try to replicate it.

Regarding #2, it depends what you mean by "making a claim". A study could test a single hypothesis, validate the hypothesis, and then list 10 things that arguably could follow from that hypothesis. For example, after timing the transit of Mercury and validating relativity, a paper could then in its conclusion list other likely consequences of relativity.

I think a lot of your statements about "science is ..." are confounding a single study with the entire body of scientific progress. Science requires replication and science requires theoretical explanations. That doesn't mean that a single study always has to provide its own replication (it can't!) or theoretical explanation. An experiment that dis-confirms a theory doesn't have to provide an alternative theory in order to be part of science; the theory may come later.
A police state would be economic and political suicide, but I don't want to deprive you of your fantasy.
You can pick up used DSLR's really cheaply these days, may aswell have one, might fuel an interest in finding out about Av & Tv modes, and white balance...plus lens' are what really make the big difference....I mean a canon EF 85mm 1.2 is gonna take a hell of a shot....

DSLR's take wonderful photographs, they are not comparable to a phone camera. Sure if you are taking snaps, I can sort of relate to the point, but do not denegrate DSLR's.

And yes,don't buy a DSLR to use it in Auto mode, you at least need a passing interest in amateur photography, or a penchant for art...

Here's a snap with my canon 500D, http://www.flickr.com/photos/casa_de_shay/5941345438/lightbo..., the bouquet is just great on the camera, can only dream of owning a 5D
That's irrelevant to the topic at hand.
This is definitely a good idea. As the responses here demonstrate, there are many different and independent optimizations available for solving this problem, so it can be useful to fall back to a faster language if you are having a hard time improving your solution.
I don't want to be Mr. Negative here, but each photo in the post is a decent example of the inadequacies of a phone camera. The first is a classic low-dynamic-range night shot that would be much better served by a large sensor that can do a higher ISO; the second is a nice attempt at some depth of field but is only a fraction of the bokeh you'd get with a wide-aperture prime lens; almost all of the daytime photos have pretty middling ranges and color reproduction.

Lastly, and this is the part I hate to be a jerk about, but the author is probably right, at least for himself right now. I don't think he'd stand to gain all that much from a higher-end camera today. With practice, though, further developing a critical eye, and understanding the photographic process, in time, he might be well-served by upgrading.
Ask HN: Need for a RSS/API relay service?
On my current project, I will be pulling in many different feeds and talking to many API's. It occurred to me that it would be smart to 'launder' these requests though a relay, (AWS) so that if I accidentally do something wrong, I can just get a new IP address and keep going. I don't plan on breaking any API/RSS TOS, but it's a big risk if I do accidentally, and my main server is banned from then on.

So I'm going to build a relay that just takes my API call requests, forwards them and send me back the results. Same with XML/RSS feed requests.

Now, I'm sure I'm not the first person to do this, but it made me wonder if other developers would be interested in this type of thing as a (paid)service? I understand this might be a target for abuse, so there would need to be a lot of anti-abuse code as well (I don't intend on building something to get around terms of service, just something to reduce a developer's risk).

Thoughts?
Actually, especially given the fact that US organizations regularly step over the boundaries of the law: What would you do when a government agency orders you to rig stuff and threatens you with judicial problems for disclosure or non-compliance?
Distributed how? I don't think such a thing is possible, someone will have to deal with the banks.
Well, if that is how you feel about children, not having them is probably a good idea. I'm not criticizing him, even if it might sound like that, just pointing out that his decision might be righ for him.
It wouldn't have helped in this case.
Sounds right to me as well. But hey, isn't it much easier to blame the language and its VM? Or interpreted languages in general?
These sort of contests are not tests of speed of computation, they are tests of algorithmic knowledge. The final data sets will (usually) all be designed to make even the most optimized implementations of the wrong algorithm fail.
That's right. The impact that this has on the quality of the medication is dependent on the dose-response curve. I wouldn't expect this to be a big deal for painkillers, for instance, but it could easily cause noticeable differences elsewhere.
> but the author is probably right as far as his current photography skills go. I don't think he'd stand to gain much from a higher-end camera at this point.

Yikes! Kind of harsh, don't you think? (I am not the author.)
It's just an expression. Lawyers don't literally chase ambulances. It's illegal for lawyers to accost people in the emergency room offering their services, and it's probably illegal to literally chase an ambulance as well due to traffic laws.

The story has more to do with suing someone for the personal injury that landed the patient in the hospital in the first place, but it's meant to refer to lawyers going out of their way to recruit clients who might not have even wanted to file suit in the first place, or to unethical, enterprising lawyers in general.
What underlying theory do you have in mind? It seems like Nietzsche's eternal recurrence to me.
Of course, there is no limit to the amount of alcohol one can purchase to lower one's threshold for going from suicidal thought to suicidal action.

"Impulsivity and aggression are strongly implicated in suicidal behaviour.18–22 Impulsivity has been related to suicidal and self-destructive behaviours within different psychiatric conditions, including alcohol and substance use disorders, mood disorders, conduct disorder, impulse control disorder, antisocial personality disorder, and borderline personality disorder. Studies have consistently demonstrated that constructs related to aggression and impulsivity confer additional risk for suicidal behaviour among persons with alcohol dependence and other substance misusers.22" -- http://qjmed.oxfordjournals.org/content/99/1/57.full

Obviously alcohol causes both impulsivity and aggression. Not to mention, the negative health effects and deaths that are _directly_ attributable to it, but that's a different topic.

The reality is, no government actually cares about preventing suicide or decreasing mental illness / increasing mental health. If they did, they would focus more on treating people who are at risk of it rather than putting people on medicines that are known to increase the risk of suicide (opiates, benzodiazepines, SSRI's, SSNRI's, amphetamine (commonly in Adderrall and prescribed to young children for medical conditions (ADD, ADHD) that don't exist), etc.

These laws are not just an inconvenience, they serve a real purpose: to make legislators feel good about themselves and to make the people think the legislators are actually working. The former is self deception, the latter treason (at least as practiced here in the US).

Addiction is a very easy way to control the population and a method of control employed by governments everywhere, led by the policies of the US. Get them addicted, committed, misinformed, unarmed, and controlled.

The new opium wars are civil, use both legal (rx or otc) and illegal drugs as their ammunition, yet are still carefully perpetrated by the governments, and in the last hundred years plus, upon their own people.

Yes, we have learned a lot from history. Just enough to repeat its atrocities.