Recent submissions

Comment · 13 years ago
Until the day a man feels equally comfortable telling a sex-related joke to a woman as to another man, all such jokes are, by definition, sexist. We as a society are not open towards sex and the real sexist men feel that it is to their advantage that women should feel more embarrassed about sex jokes, even a woman have no reason whatsoever to feel that way.
Comment · 14 years ago
Wow!
Comment · 14 years ago
There are two kind of "technical" people. The "Science" kind, and the "engineering" kind. If you appreciate the "beauty" of an mathematical equation, or the "elegance" of a proof, you are the "Science" kind. If you appreciate the preciseness of a tool, or speed to achieve a task, you are the "Engineering" kind. Science provide the backbone behind engineering, but engineering re-invigorates science. Unfortunately, programming can fall into either categories. Argument like this is mostly pointless without a specific context. As a programmer, it is a life long effort to find the "zen" of the two.
Comment · 14 years ago
Because city and local officials make huge profits with these development. Remember, land is owned by the government. And no one is accountable for failed investment. Cheapest materials are used, getting done fast is important because the developer wants to get out of it as quickly as possible. It fits the prevalent theme in China right now: get rich quick and leave the country fast.
Comment · 14 years ago
For one, it will be useful to catch cheating program homework that simply renames variable names and re-arranges function definitions.
Comment · 14 years ago
Memoized version:

  class Factorial(object):
    def __init__(self):
        self.n = 0
        self.fact_n = 1

    def next_fact(self):
        self.fact_n *= (self.n + 1)
        self.n += 1

    def prev_fact(self):
        self.fact_n /= self.n
        self.n -= 1

    def fact(self, n):
        if n == self.n:
            return self.fact_n
        elif n > self.n:
            # start from self.n working forward
            self.next_fact()
            return self.fact(n)
        else:
            # start from fact_n working backwards
            self.prev_fact()
            return self.fact(n)


  fobj = Factorial()
  print fobj.fact(6)
  print fobj.fact(8)
  print fobj.fact(3)
Comment · 14 years ago
This is essentially what I have been doing for the last 6 months and it works great for me. But it only works great because 1) I go to bed at 9 pm - I am literally falling asleep with 5 minutes. 2) Coffee is only allowed before 9am.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton