Better HN
topnewbestaskshowjobs
Log inSign up

tordek

11 karma · joined Aug 7, 2008 (18y ago) · 16 submissions

Submissions

comment 12y ago · link · parent

> I would like to know the reasoning behind this. It sure seems clever but what is the advantage that this provides?

Since C provides very little metaprogramming capabilities, this was the only way to obtain what I wanted: Most (if not all) other testing libraries/frameworks require some boilerplate to start testing (namely: defining your `main` function, which calls all of your tests). Additionally, every time you write a new test, you must remember to add it to your `main` function.

I decided that those two things were bothersome enough, so I wrote a proof of concept that evolved into a large project with tons of useful features beyond that.

comment 12y ago · link · parent

Additionally, how would you signal "End of List"?

comment 12y ago · link · parent

Would you mind expanding a bit on the usage of Range?

The simplest case involving items is clearly `items=10-20`, but that has its own set of problems (your set must be ordered; I assume you'd use the key you're sorting over as your `ranges-unit`).

The place where this solution seems less than ideal is when you want to start from an id, but get a certain number of items. That is, the "infinite scroll" use case: If you simply do "sort by date, discard 10, return next 10 items", then you have a race condition where you do your first request, a second agent adds a new item, and you do your second request: the last item from the previous page is now the first item from the current page.

So, ideally, I want to request: "Ordered by date, where id > <last-id>, 10 items".

If you're strict about the definitions of `Range`, this doesn't seem possible.

Maybe the best way to do this would be `Range: items=decacfb98eface89+10` or similar?

comment 14y ago · link · parent

Of note: There are several of us in #mongrel2 on Freenode, and there are periodic patches from us :).

comment 14y ago · link · parent

But that makes no sense, it is whitespace, and it has semantic significance (hence being significant). Whitespace was not significant in older versions of Fortran, and that allowed you to write

    DO30I=10,100
which was interpreted as

    DO 30 I = 10, 100

An amusing bug I saw in Expert C Programming mentioned how somebody once typed e dot instead of a comma, and

    DO 30 I = 10. 100
ended up interpreted as a simple real assignment:

    DO30I = 10.1

comment 14y ago · link · parent

In your last example, `.find('.more_stuff')` works on the value returned from `.addClass('other')` (or so it'd seem), so it behaves differently.

comment 16y ago · link · parent

As said elsewhere: "Declaration follows use".

    int *foo;
means "foo is a pointer to int". But that's explained different from how it's written. More clearly, you can say that "foo" is an int. Then, doing

    int *foo;
    foo = 50;
is obviously wrong because "foo" is not an int; however

    int *foo;
    *foo = 50;
is correct.

Similarly for arrays:

    int *foo[50];
means "foo is an array of pointers to int", or "
foo[5] is an int".

From there follows that & is the antithesis of , and they negate each other:

    int *foo; //foo is a pointer to int.
    &*foo; //the address of the contents of foo
    foo; // same as above, but shorter.

comment 16y ago · link · parent

How so?

         +-----------+
         | +-+       |
         | ^ |       |
    char *foo[10][20];
     ^   ^   |       |
     |   +---+       |
     +---------------+
* foo is

* an array of ten arrays of 20

* pointers to

* char

comment 16y ago · link · parent

> Wait are you saying I have to be content with who I am?

When did he ever tell you to stop bettering yourself?

> What do you mean I can't expect my employer to validate my passions in life?

Because your passions are yours, and yours alone. You could get miraculosuly lucky and get an employer that shares some of your passions and lets you work in them... or you could remove chance from the equation and write code on your own, and open source it.

comment 17y ago · link · parent

http://netlib.bell-labs.com/cm/cs/pearls/cto.html

Millions of numbers in a single megabyte may be interesting.

comment 18y ago · link · parent

I'm righty and can only raise my right one. But I can also jiggle my left ear...

comment 18y ago · link · parent

That's the way spanish is pronounced.

Radio is "Rradio".

I've found amusing how some people who learn english as a second language end up pronouncing spanish as "espanish", since no spanish word begis with s(consonant), except for sh.

comment 18y ago · link · parent

Argentinian here... and I'd usually extend the o, not the r, so "Estuvimos allí poor un rato."

comment 18y ago · link · parent

Anywhere I can look up on their definitions?

comment 18y ago · link · parent

So? Back in the day they were. That's his point. And IE, that people hate so much, came up with them.

Would you way wheels aren't innovations because they've been around for a long time?

comment 18y ago · link · parent

It annoyed me that he said "feel free to correct my math," yet there is no way to contact him.

There aren't 504 ways (P(9,3)), but only 84 (C(9,3)), since order is irrelevant.