News for hackers. Stuff that matters.

tordek

> 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.

Re:18F API Standards on Tuesday August 12, 2014 @03:56PM (#8169804)
Additionally, how would you signal "End of List"?
Re:18F API Standards on Tuesday August 12, 2014 @12:15AM (#8166555)
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?

Re:A Private PaaS with Mongrel2 and ZeroMQ on Saturday January 28, 2012 @05:26PM (#3523507)
Of note: There are several of us in #mongrel2 on Freenode, and there are periodic patches from us :).
Re:Making Coffeescript’s Whitespace More Significant on Wednesday November 30, 2011 @06:18PM (#3297353)
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
Re:Making Coffeescript’s Whitespace More Significant on Wednesday November 30, 2011 @03:43PM (#3296822)
In your last example, `.find('.more_stuff')` works on the value returned from `.addClass('other')` (or so it'd seem), so it behaves differently.
Re:No more confusions on tricky C declarations on Saturday June 26, 2010 @09:45PM (#1464678)
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.
Re:No more confusions on tricky C declarations on Saturday June 26, 2010 @09:37PM (#1464669)
How so?

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

* an array of ten arrays of 20

* pointers to

* char

Re:Ask HN: Average coder at dead-end. What now? on Monday June 21, 2010 @02:07AM (#1448131)
> 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.

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

Millions of numbers in a single megabyte may be interesting.

Re:Hack your anatomy: How To Whistle Loudly on Sunday October 05, 2008 @04:58AM (#324005)
I'm righty and can only raise my right one. But I can also jiggle my left ear...
Re:Hack your anatomy: How To Whistle Loudly on Sunday October 05, 2008 @01:42AM (#323912)
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.

Re:Hack your anatomy: How To Whistle Loudly on Sunday October 05, 2008 @01:40AM (#323907)
Argentinian here... and I'd usually extend the o, not the r, so "Estuvimos allí poor un rato."
Re:Bringing Sexy (Charts) Back on Sunday September 14, 2008 @03:20AM (#303632)
Anywhere I can look up on their definitions?
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?

Re:Lemur CATTA - reading comprehension instead of CAPTCHAs on Thursday August 07, 2008 @02:26AM (#269419)
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.