Spitter on 13/4/2006 at 21:38
Quote Posted by RarRar
When I read some articles that talk about mediocre or bad programmers, how many of them there are out there, etc., I know they're talking about me. I don't mind. I manage to get the job done it seems.
I'm probably using your programs. :thumb:
ZylonBane on 13/4/2006 at 21:44
Quote Posted by RarRar
But stare as I might I can't translate this into a working formula in terms of currentRow and ROWS_PER_RECORD.
This is possibly the most vague problem description I've ever read. A "working formula" to do
what? If row-per-record is known and fixed across the entire table, it seems like you're describing a simple division, so your question can't possibly be that trivial.
RarRar on 13/4/2006 at 21:51
Quote Posted by ZylonBane
... it seems like you're describing a simple division, so your question can't possibly be that trivial.
Did I say I was a lousy programmer? What I meant to say was I'm a bad programmer. A REALLY bad one. It's probably just as trivial as you suspect.
But then again I'm really tired lately from playing Oblivion too much.
SithLord2001 on 13/4/2006 at 22:03
Quote Posted by RarRar
Did I say I was a lousy programmer? What I meant to say was I'm a bad programmer. A REALLY bad one. It's probably just as trivial as you suspect.
I suck at programming too man don't worry, although I don't have a job as one, and I am majoring in IT not Comp Science sooo I supposse I don't really have to be that good
dvrabel on 13/4/2006 at 22:40
Sounds like you suck more at grade 7/8 school maths than programming.
record = trunc( (row + 1) / rows_per_record )
Edit: use trunc not floor. Or just do the maths using integers to get the implicit trunc.
RarRar on 13/4/2006 at 22:45
Heh, ZylonBane is right, damn him to hell.
It all works if you use a 0-based row index, like an array. Row 1 is actually row 0, etc.
var recordNo = ((currentRow - 1) / ROWS_PER_RECORD) + 1;
So a simple division after all, like ZB said, with a +1 at the end to convert it backed to 1-based.
Without going 0-based I was getting all these troublesome remainders when I tried to figure out a division scheme.
Thanks Z!
I bet there's an even more clever solution. Something involving bit-shifting and such, and the ^ operator. Those kinds of solutions always impress the hell out of me, but I'm still happy with this one.
Swiss Mercenary on 13/4/2006 at 23:17
...
Bitshifting is only relevant if the number of rows is a multiple of 2. And there's not going to be a noticeable speedup, at all, for your kind of program.
Wyclef on 13/4/2006 at 23:57
Quote:
When I read some articles that talk about mediocre or bad programmers, how many of them there are out there, etc., I know they're talking about me.
You, too, could work in scientific computing
RarRar on 14/4/2006 at 00:00
Quote Posted by Wyclef
You, too, could work in scientific computing
Seems to me scientific computing is where the good programmers have to be. I do a lot of web, database, and xml programming. Strings WAY more than numbers. Seems to me for the types of things I do I have a lot of company. IT and web stuff, where terrible programmers flourish.