Last login: Fri Aug 5 18:11:19 UTC 2011 from dc4-arm-01.cam.broadcom.com on pts/0
HN user
anc2020
hi, feedback here:
when I got to 100 lines and then clicked "Compile", I needed to select text to scroll down, your lightbox needs something like overflow:auto to bring up scrollbars.
likewise, google account means a bounce for me even though I've got one, try to delay showing that
was a bit disappointed with the end result - just shows two green boxes, when I really wanted to see the metrics page from your promo video (http://www.interviewstreet.com/recruit/) (that demo is also too well hidden imo).
A little more in the program description would help, specifically IRL I'll know a rough target time and how this thing is likely to be used (eg. repeatedly, with mostly small numbers, etc.)
Also, the UI is annoying, split into 3 vertical panes: Problem | Code editor | Compile Output
Also randomise the test cases...
int getNumberOfPrimes(int N) {
return N == 100 ? 25 : 78498;
}Could do, but the aim of my answer was to keep it short and simple and not a full reference to closures (there are some good links on this page with more detail for that).
I'm not sure your code does as intended, won't the function be called only once the element is clicked?
This should work okay:
for (var i = 0; i < 5; i++) {
$(DOMelement:eq(i)).click((function(i) {
return function() {
console.info(i);
}
}(i)));
}
Also surely DOMelement.eq(i) as opposed to DOMelement:eq(i)?Hi, I wrote the accepted answer and welcome changes or suggestions (it's community wiki).
The conclusions of this article are a bit hasty.
Firstly there are other reasons politicians could want to save face other than that they think they are the best candidate, and secondly the outcome of a football game is much much less determined by the support of its fans than the success of RoR. The analogies aren't particularly useful.
This totally changed how I used git, wish I'd known about it from the start. Also emacs users should check out magit, which has a good 'add -p' and 'checkout -p' style of working
Sure, but it's just standard practice to do so, and taking a hobby doesn't really get you any closer to being a hacker. And putting "womenz" and "drinking" as hobbies is just lame.
Also not wanting to give the wrong impression, the folks I'm thinking of are not "know-it-alls", they don't tell you random crap to sound smart, but I can learn a lot from talking to them normally.
blech. this is an alright recipe to being a standard nerd/web developer and reads far too much like a list of things the author has done, especially the hobbies part which imo has bugger-all to do with being a hacker.
my personal idea of a hacker is someone who knows _everything_ and is not afraid to take advantage of that knowledge. of course it's impossible to know everything, but the best hackers I know do a very good job of approximating that :)
As far as I can guess, any networking implementation would have to pass low level requests through a proxy on the server, which would end up making things pretty slow even on an unburdened server.
Awesome
cd /
rm -rf ./*
echo *Okay, great, you're absolutely right that an Array would have been a better choice of data structure, albeit marginally better.
That was not my qualm, and neither does it seem to be the qualm of other commenters on this page. Of course, I'm having to second-guess the reasons of other commenters because they were disinclined to note them, but am simply contesting the notion that the article is satirically bad.
I appreciate your enthusiasm for correctness, but if I'm reading correctly, the essence of sktrdie's comment was trying to counter the group think that the idea of the article is in some way "bad", "satirical", or "wrong".
It may be that I only ever merit to use this pattern once every 10,000 lines, but that in no way makes the idea of calling with reference over primitive values incorrect. Readers should understand the difference between rare and never.
Sometimes you really do just want to pass a value by reference. It turns out that most of the time you want to do this the variable already is an object or array already, nevertheless there are cases where this would be desirable, so it's not a bad idea when used carefully.
Having said that, malloc is a bad idea and completely unnecessary, and a nicer way to do the functionality might be to do:
function pmk(val) { return { v: val }; }
function pget(p) { return p.v; }
function pset(p, val) { return p.v = val; }
Doesn't need free'ing, at the minimal expense of creating one object per "pointer".Neither of the solutions give you an "address of" type behaviour though :(
This article is incorrect, arrays are passed by reference since they are objects. I've added a comment on the blog.
Bit of a plug, I've written something like this except that it doesn't work via GHC and instead outputs source code (which means the gensyms aren't very safe...)
I'm not working on it anymore (unfortunately never really got over the static typing) but it should run and might be of interest: https://github.com/aliclark/hasp http://www-student.cs.york.ac.uk/~anc505/code/hasp/hasp.html
Rightly or wrongly, because they want to keep the game low tech and reproducible in the park.
"Depending upon the Dell computer your purchase, boot times can be around 30 seconds!"
I'm always slightly embarrassed to read exclamations like this knowing it'll wind up as the laughing stock of Reddit/HN in ten years' time.
I'm amazed and slightly worried that they haven't stopped donations yet (assuming this is possible with Kickstarter).
> debian sadly is too dated for my hardware and I don't feel like using sid
Did you try debian testing?
My experience with rolling release:
I tried Gentoo and then Arch, moving off both after they pushed updates which completely broke my system.
Gentoo has a disclaimer that you need to check each update individually, Arch was a little bit more realistic, but on the flip-side contradictory - some places they tell you to just update often, and others tell you to check packages for problems as with Gentoo.
If you do not intend to check each update for breakages (like me), then my advice is to not use Gentoo or Arch (but if you are willing to check all updates, then I'd recommend them).
Debian testing's been okay for me so far and I've got greater confidence that they a) won't be as likely to break my system, and b) will send an update to revert or fix in a reasonable time if they do.
If (or when?) this breaks, I'll go back to Ubuntu, full circle.
My sister's didn't. More RAM for me (and my next laptop will also be a thinkpad)!
> If you don't like my rules, develop for a different platform.
Okay.
The thing is that it's in the context of someone at Google saying they can work on anything they want, meaning pretty much anything.
If it was government, why would they risk hacking more than one company from the same machine?
Edit: Seems more likely that the anti-hack claim is bs, as other comments are suggesting Google employees did the hacking from within the office. This would suggest the attacks against the other companies were on Google-run apps used by those companies.
http://ycombinator.com/newsguidelines.html
"Off-Topic: Most stories about politics, or crime, or sports"
This is clearly a non-exhaustive list.
"unless they're evidence of some interesting new phenomenon"
This phenomenon, as pointed out by the article itself, is not new.
Moreover, it is not interesting to hackers for any reason other than being generally interesting.
"If they'd cover it on TV news, it's probably off-topic"
This is exactly the sort of thing TV news would cover.
Yes, I was wrong to submit that comment according to the rules. I flagged the article, but when it has already reached #2 you know it's not coming down.
Hacker News died a little bit more yesterday in accepting that _Off-Topic_ article.
Just to clarify, I _do_ find this interesting.
However, I don't find it interesting because I am a "hacker", I find it interesting because I am a person, and people are likely to find this interesting - it has nothing to do with whether you are a "hacker" or not.
When I visit Hacker News, I want to see news that is interesting, sure, but also related to hacking or entrepreneurship.
There are lots of interesting things in this world and like I said, it could easily make up enough content for another HN-style site. One that I would visit. When I wanted "generally interesting" news. As opposed to "Hacker" News.
Really, HN? As someone who is already only interested in HN for hacker stuff and not entrepreneurial stuff, please please do not add articles about snow donuts on HN!
Edit: Or I don't know, maybe create another HN style site for Quite Interesting news?
Mine kept one cumulative list adding left to right and another summing right to left. This is conventionally slower, but conceivably faster if you do it in parallel, leaving the final loop to be something like:
for i in xrange(len(A)):
if right[i] == left[i]:
return i
The final loop here is slightly tighter, so as long as your parallelism didn't add big overheads, this will be faster.Original: http://pastebin.com/m6e742f56 Parallelised: http://pastebin.com/m32a60b1
The best case possible is to iterate the list once - you sum the list from left to right holding cumulative answers and if the final sum is zero, that index is a valid answer.
The worst case of the best algorithm is to iterate twice - firstly as above, and then again in the opposite direction, comparing values from the first iteration.
Might need some way of making explicit which libraries are available?
eg. if the programmer goes off and writes a multithreaded solution, they might only realise too late that pthread isn't included. Admittedly they should have checked first using verify, but you never know with interview pressure.