Better HN
topnewbestaskshowjobs
Log inSign up

panic

29,749 karma · joined Sep 16, 2009 (17y ago) · 3,593 submissions

Submissions

comment 15y ago · link · parent

Why can't we do all this NAND controller magic in our filesystems? Two layers of abstraction trying to cleverly allocate the same resource seems like a recipe for pain in general (c.f. TCP over TCP).

comment 15y ago · link · parent

Check p before using it. The issue is when you have code like the following, where the behavior of the first statement is only defined when the condition in the second is false:

    int x = *p;
    if (p == NULL) {
      // p can't be NULL without having triggered
      // undefined behavior in the first line, so
      // this code is removed by the compiler.
      return;
    }
    // ...
The fix is to stop dereferencing p before you know whether it's NULL or not:

    if (p == NULL) {
      // Moving the check before the dereference
      // avoids undefined behavior and resolves
      // the issue.
      return;
    }
    int x = *p;
    // ...

comment 15y ago · link · parent

No.

comment 15y ago · link · parent

A proof is not a program.

The Curry–Howard isomorphism[1] would beg to differ. I think programming is much closer to math than this comment gives it credit for. In some sense, programming is even stricter than math. When doing math, you just have to satisfy your instructor or your reader. When programming, your program must run on a real computer -- there's no room for hand waving or imprecise arguments.

[1] http://en.wikipedia.org/wiki/Curry–Howard_correspondence

3455.

On Salvation(somethingaboutmaps.wordpress.com ↗)

1 points · by panic · 15y ago · discuss

comment 15y ago · link · parent

It may be true that github focuses on the author (after all, projects are github.com/AUTHOR/project), but I'd say that focus is secondary to the code. Compare a project page on sourceforge (e.g. http://sourceforge.net/projects/azureus/) with one on github (like https://github.com/jquery/jquery). A sourceforge project page is just a vague arrangement of links, while github shows you the source and README right away. The author is given about the same amount of space on the page in both cases.

comment 15y ago · link · parent

Yes, I haven't read the other comments but that is a terrible terrible explanation. OP had a genuine question about the nature of things and the person answered bringing up paper and arrows. This is the stuff that made Feynmann mad when they asked him about magnets.

Have you ever read the book QED? It's Feynman's best effort to explain Quantum Electrodynamics to a layman. In the book, he takes a genuine question about the nature of things (how does light work?) and answers it by "bringing up paper and arrows!" (I encourage you to read the book to see what I mean). Feynman disliked "explaining" nature with inaccurate and irresponsible metaphors. But arrows are the way it really is!

comment 15y ago · link · parent

The higher planes were added in 2001 with Unicode 3.1: http://unicode.org/reports/tr27/tr27-4.html

comment 15y ago · link · parent

You may be asked about using Unicode strings. What the interviewer is usually looking for is:

    - each character will be two bytes (so, for example, char
      lookup table you may have allocated needs to be
      expanded from 256 to 256 x 256 = 65536 elements)
    - that you would need to use wide char types (wchar_t
      instead of char)
    - that you would need to use wide string functions (like
      wprintf instead of printf)

Unicode support involves more than just the minimum number of bits used per character.

Say you're writing a method to truncate a string to a certain length. What if your text contains a code point outside the basic multilingual plane, and each character can't be represented in just 16 bits? If you truncate in the middle of a character, the result will be an invalid string. What about combining characters? If you truncate in the middle of a combining character sequence, you'll end up with half-formed output (e.g., letters missing a diacritic). If you work with text, you should know this stuff!

comment 15y ago · link · parent

Google Maps should be on that list. Can you remember the sort of maps we used to put up with on the web?

comment 15y ago · link · parent

Why would you want to do that?

comment 15y ago · link · parent

What is it? An initiative to know the creators of the website. A TXT file that contains the information about the different people who have contributed to the web building.

Robots.txt specifies a set of URLs that automated crawlers are not supposed to access. I'm not sure how this is "like robots.txt, but for humans".

comment 15y ago · link · parent

There isn't any semantic ambiguity. The phrase "pass by reference" has a specific meaning. Java does not support pass by reference. Here's a quick test to see if your language uses pass by reference (when translated into Java, it will output "pass by value"):

    function f(x, y) { x = y }
    a = new A()
    b = new A()
    assert(a != b)
    f(a, b)
    if (a == b) {
        print('pass by reference')
    } else {
        print('pass by value')
    }

comment 15y ago · link · parent

This article seems out of date given the existence of llvm.

comment 15y ago · link · parent

In 2001, there was a contest to see who could name the biggest number using a C program:

The object of the BIGNUM BAKEOFF is to write a C program of 512 characters or less (excluding whitespace) that returns as large a number as possible from main(), assuming C to have integral types that can hold arbitrarily large integers.

See the third line of http://djm.cc/dmoews.html for more, including the (quite interesting, IMO) results.

comment 15y ago · link · parent

It's drawn using a canvas element.

comment 16y ago · link · parent

You may be able to create them, but as a server, how would you receive incoming connections?

comment 16y ago · link · parent

I believe dizm was referring to the header and class interface, not the source. The header is more or less ripped directly from UIKit, with some puzzling additions. What is the point of adding a "vulture" without also adding an "obstacle", for example? It seems like these methods should be private, not exposed in the public header.

comment 16y ago · link · parent

People blur to maintain the general look of the original image. Having black boxes everywhere is jarring.

In that case, why not erase the numbers and replace them with random digits?

3470.

Optogenetics - New Light on The Brain(stanfordalumni.org ↗)

1 points · by panic · 16y ago · discuss

comment 16y ago · link · parent

Do the app reviewers use Radar?

comment 16y ago · link · parent

"The Flea's Knees" is another great tiny font: http://typophile.com/node/61920

comment 16y ago · link · parent

I can't find the article I was thinking of, but http://sheol.org/throopw/tachyon-pistols.html gives the general idea.

comment 16y ago · link · parent

There's no known way to transfer information faster than the speed of light (and if there were, there are some relativistic tricks you can play to actually send information backwards in time).

comment 16y ago · link · parent

There's always the classic, 'Snakes ⊂ ℝ²'.

comment 16y ago · link · parent

In that case, why not spend the subsidies on reducing taxes for those poorest people, or on giving them benefits in other ways?

comment 16y ago · link · parent

It depends on which side of the dollar sign you click. If your click falls to the left, you'll end up with the dollar sign in the wrong position.

comment 16y ago · link · parent

First of all, it's not clear to me that priority inversion is an issue with semaphores as normally used. If a high-priority consumer thread is waiting on a low-priority producer thread, there may just be no data ready to be consumed. There's no reason to raise the priority of the producer thread if, for example, it's just waiting for some external input.

Second, how would you solve priority inversion for general semaphores? With mutexes, you know what thread is holding the mutex, and can bump its priority correspondingly. With semaphores, there's no guarantee that the same thread that incremented the semaphore will decrement it later.

1
115116117
120