mjschultz

Joined 16 years ago

Karma
585
Submissions
101
Member since
Jul 16
I am a perpetual computer science student that has the simple goal of making the software world a better place!

http://www.beyond-syntax.com/

View on Hacker News

Recent submissions

Comment · 10 years ago
Both my cats get up on the refrigerator easily.
Comment · 11 years ago
Comment · 12 years ago
Comment · 12 years ago
In a chapter about deconstructing someone else's book, your own book also does dangerous things according to yourself:

> The problem is, as with every book with code ever in the universe, beginners will copy that code out and use it somewhere else and then the function is wrong.

Yet, if a beginner copied some of the code in this chapter they'd have the exact bug you are talking about here (using the NULL pointer returned from malloc()).

I think you should probably expand that into the safer checks (don't forget to free(line) if longest is NULL too!).

Comment · 12 years ago
I seem to get a 500 error page whenever I search for something along the lines of "NOT label:css". I was hoping to be able to find issues that are not labeled as something.

Other than that this seems like a great improvement!

Comment · 12 years ago
Comment · 12 years ago
Comment · 12 years ago
That code should only create the dict/namedtuple instance once, then access it many, many times.

The creation occurs in the --setup portion. The field accesses occur in the actual looping portion of the timeit code.

Comment · 12 years ago
The --setup code (creating the namedtuple and dict) is only executed once.

The timed portion is simply the field accesses.

Comment · 12 years ago
Comment · 12 years ago
I'm probably doing it wrong but I measured exactly this yesterday and the dict version was faster:

    $ python -m timeit --setup "from collections import namedtuple; Point = namedtuple('Point', ['x', 'y']); p = Point(x=0, y=0)" "p.x + p.y"
    1000000 loops, best of 3: 0.284 usec per loop
vs.

    $ python -m timeit --setup "p = {'x': 0, 'y': 0}" "p['x'] + p['y']"
    10000000 loops, best of 3: 0.0737 usec per loop
Maybe the use isn't right because I agree with your belief that namedtuple is suppose to be more performant.
Comment · 13 years ago
To answer your question directly, no I don't think so (perhaps some updated theories, but nothing concrete).

But the article does cover more than just the incident, I found the whole thing fairly interesting.

Beyond the passing knowledge I have from growing up in Chicago-land around the time and the Wikipedia article on the subject, I thought it contextualized the FCC policies around the time of the incident and how the hack worked (from a high level). It also pointed out other signal intrusions from the same period and the FCC/FBI's methods to track down the perpetrators.

Comment · 13 years ago

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton