pageIndex is 1-based?

Posts   
 
    
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 05-Jun-2007 20:48:07   

Now, which genious decided to make paging pageIndex parameter 1-based. stuck_out_tongue_winking_eye Cccccc.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 06-Jun-2007 09:31:10   

raises hand

stuck_out_tongue_winking_eye

I made it 1-based, because you'd normally say "I want the first page" or "the 3rd page", so it's natural to then go for a 1-based paging mechanism.

Frans Bouma | Lead developer LLBLGen Pro
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 06-Jun-2007 09:34:10   

Otis wrote:

raises hand

stuck_out_tongue_winking_eye

I made it 1-based, because you'd normally say "I want the first page" or "the 3rd page", so it's natural to then go for a 1-based paging mechanism.

.net is all 0-based. You are confusing 0-based C# brains. For redemption you should write ".net is 0-based, 1-base is bad" 100x times. wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 06-Jun-2007 11:20:06   

mihies wrote:

Otis wrote:

raises hand

stuck_out_tongue_winking_eye

I made it 1-based, because you'd normally say "I want the first page" or "the 3rd page", so it's natural to then go for a 1-based paging mechanism.

.net is all 0-based. You are confusing 0-based C# brains. For redemption you should write ".net is 0-based, 1-base is bad" 100x times. wink

haha simple_smile Let me write a 0-based routine for that. wink

So you're refering to the FIRST page as the ZERO-th page ? simple_smile

Frans Bouma | Lead developer LLBLGen Pro
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 06-Jun-2007 11:23:25   

Otis wrote:

haha simple_smile Let me write a 0-based routine for that. wink

LOL, right.

Otis wrote:

So you're refering to the FIRST page as the ZERO-th page ? simple_smile

Yep, there is no better thing than zero-th page, zero-th element, zero-th index, etc.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 06-Jun-2007 11:27:26   

mihies wrote:

Otis wrote:

So you're refering to the FIRST page as the ZERO-th page ? simple_smile

Yep, there is no better thing than zero-th page, zero-th element, zero-th index, etc.

Normally I would (I'm raised with pointers and asm, 0 is king! wink ) but with this I never realized that the first page should have the index 0. You ran into a bug with your code where you looped through stuff and you forgot to add 1 to the index ? wink

Frans Bouma | Lead developer LLBLGen Pro
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 06-Jun-2007 11:31:19   

You ran into a bug with your code where you looped through stuff and you forgot to add 1 to the index ?

Indeed. Acutally I didn't forgot, I assumed it is zero based. Anyway, this is a consistency issue but I guess even if you want to change it you would have hard time because of code that relies on it.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 06-Jun-2007 11:37:59   

Yes, changing is out of the question. I did think this through though (stuck_out_tongue_winking_eye ), and 1-based seemed more logical to me, and it did create bugs for me as well (as page index calculations have to take into account it's 1 based but indexes are 0 based sometimes in db's (not always, sqlserver numbers start with 1)).

Frans Bouma | Lead developer LLBLGen Pro
jelling
User
Posts: 22
Joined: 26-Oct-2007
# Posted on: 15-May-2008 22:44:14   

Otis wrote:

Yes, changing is out of the question. I did think this through though (stuck_out_tongue_winking_eye ), and 1-based seemed more logical to me, and it did create bugs for me as well (as page index calculations have to take into account it's 1 based but indexes are 0 based sometimes in db's (not always, sqlserver numbers start with 1)).

Is this in the manual somewhere? I had the same issue but couldn't find anything about it in the manual.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 18-May-2008 11:47:00   

jelling wrote:

Otis wrote:

Yes, changing is out of the question. I did think this through though (stuck_out_tongue_winking_eye ), and 1-based seemed more logical to me, and it did create bugs for me as well (as page index calculations have to take into account it's 1 based but indexes are 0 based sometimes in db's (not always, sqlserver numbers start with 1)).

Is this in the manual somewhere? I had the same issue but couldn't find anything about it in the manual.

Reference manual -> routine you're calling. It has documentation on pageNumber and pageSize. If either one is 0 -> paging is disabled.

Frans Bouma | Lead developer LLBLGen Pro