HNHacker News
TopNewBestAskShowJobs

theoretical

17 karma · joined January 20, 2011

submissionscomments
theoretical··on 1 Database Containing 35,000,000 Google Profiles. Implications?
I contacted Google about this issue in November of 2008 - I only received an automated response. (Matthijs mentioned that was why he posted the previous post[1] on the topic prematurely)

Perhaps with the increasing awareness of this issue, Google will be forced to act.

[1] http://blog.cyberwar.nl/2011/05/google-profiles-exposes-mill...

theoretical··on Ask HN: Would you attend a Hacker News Conference?
You do indeed. For me that page says: "Sorry, you need 20 karma to create a poll."
theoretical··on Xcode now costs US$ 4.99
I develop iOS apps on a hackintosh. It's of equivalent spec of a recent Mac Pro, apart from it's an i7 instead of a Xeon.
theoretical··on New string search algorithm
x^2 is quadratic, 2^x (for example) is exponential.

Have a look at http://en.wikipedia.org/wiki/Time_complexity , it's pretty comprehensive.

theoretical··on Ask HN: Do you know Photoshop?
I use Fireworks. I find it so much easier for doing web design/photo editing/anything than Photoshop.
theoretical··on Google search and search engine spam
I'd be interested in a further explanation of "Google absolutely takes action on sites that violate our quality guidelines [...]".

Does that mean that Google manually decrease rankings of spammy sites that their algorithms haven't caught? Does this entail decreasing the rank of the entire domain, the IP? Does blacklisting ever happen?

I ask since Google have previously[1] said they don't wish to manually interfere with search results.

[1] "The second reason we have a principle against manually adjusting our results is that often a broken query is just a symptom of a potential improvement to be made to our ranking algorithm" - http://googleblog.blogspot.com/2008/07/introduction-to-googl...

theoretical··on JavaScript Interview Question
They seem like good questions. As an addendum to the final question in second link, it might also be worthwhile checking the interviewee's understanding of "this" in other contexts too.
theoretical··on JavaScript Interview Question
Well yes, the function is called with a MouseEvent as one of the arguments, so you could use the "arguments" object to access it.

What I was thinking of, was something along the lines of:

  // From http://ejohn.org/blog/partial-functions-in-javascript/
  Function.prototype.curry = function() {
    var fn = this, args = Array.prototype.slice.call(arguments);
    return function() {
      return fn.apply(this, args.concat(
        Array.prototype.slice.call(arguments)));
    };
  };

  els = document.getElementsByTagName('li');
  for(i=0; i < els.length; i++){
    els[i].addEventListener('click', function(x){
        alert(x);
    }.curry(i), false);
  }
theoretical··on JavaScript Interview Question
That won't quite work, as you're still just copying the value of i when that function is executed, which will be 4.

You could make the function take a parameter, then return a function which uses that parameter, or use currying.

Edit: I've posted a working version in my comment further down, http://news.ycombinator.com/item?id=2124559

theoretical··on JavaScript Interview Question
It won't alert quite what you want - when you click on each element in the list, it will alert "4".

This is because the function assigned to the click event of each li is bound to the "i" variable used in the loop by a closure. Variable i is incremented to 4 before the loop ends, so that is what each will print.

You could use make the function used in the click handler take a parameter, then use partial function application (or currying) to fix the value of the parameter.