RarRar on 13/4/2006 at 20:39
I'm a programmer by profession. They pay me to write programs. I don't have a degree in it (I took one course in Pascal in college) and I'm the first to admit I'm mediocre. 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. Though my solutions may not be the most elegant or efficient or the fastest, for the job I do it turns out it doesn't matter that much. Anyway, I don't program 100% of the time. I also have to do a lot of writing for my job as well as analysis, both things I'm pretty good at so things balance out.
But here's why I'm a bad programmer. I'm decomposing a problem and I can see a pattern in it. Patterns that just scream Look at me!!! But my math sense is just not good enough that I can do what good programmers do and pull out a solution almost without conscious thought. Right now I'm doing some Javascript. I rarely have to program in Javascript and I'm not very good at it because I do it so infrequently but the language doesn't matter in this case because it's the underlying pattern I can't discern.
I have an HTML table with rows. Rows represent records in a database. But sometimes for visual design reasons, each record may occupy two rows, or three rows. But the first row of each "set" is the only one I'm interested in and for programming purposes I want to ignore any "extra" rows used for design purposes. Pretend they don't even exist. So if I click on a record I want to know that it's the fourth record even though it's the seventh row.
Here are the known quantities:
var ROWS_PER_RECORD is the number of rows which comprise a record. Right now it's 2. That is every odd row is the significant one. But it could very well expand to 3 or more as the web design evolves.
var currentRow is the number of the row in the table as a whole. That is, if each record consists of 2 rows and I click on the 7th row, currentRow is set to 7, but I need to calculate that it's actually the 4th record.
Assuming ROWS_PER_RECORD is 2, here's the pattern I see:
Row 1 = Record 1 (1-0)
Row 3 = Record 2 (3-1)
Row 5 = Record 3 (5-2)
Row 7 = Record 4 (7-3)
Row 9 = Record 5 (9-4)
The subtrahend begins at 0 and increases by 1's.
If we assume ROWS_PER_RECORD is 3, here's that pattern:
Row 1 = Record 1 (1-0)
Row 4 = Record 2 (4-2)
Row 7 = Record 3 (7-4)
Row 10 = Record 4 (10-6)
The subtrahend begins at 0 and increases by 2's.
We can predict that for ROWS_PER_RECORD = 4 the subtrahend will begin at zero and increase by 3's.
I understand this much of the pattern. The subtrahend always starts at 0 and increases by ROWS_PER_RECORD - 1.
But stare as I might I can't translate this into a working formula in terms of currentRow and ROWS_PER_RECORD.
OnionBob on 13/4/2006 at 21:02
ummmm
Sneaky Acolyte on 13/4/2006 at 21:06
In on legendary thread (hopefully) *
*Will edit contents of this post as per thread quality.
RarRar on 13/4/2006 at 21:09
Quote Posted by Sneaky Acolyte
In on legendary thread (hopefully) *
Uh oh. I don't like the sound of that. Am I in for a hard time? Is the question THAT stupid? Oh no. Is it too late to delete the thread???? Wah!
piln on 13/4/2006 at 21:12
<img src="http://img9.picsplace.to/img9/10/tfgumby.gif" alt="Image Hosting by PicsPlace.to" >
Sneaky Acolyte on 13/4/2006 at 21:12
What, are you kidding, Rar? You don't have to worry about that sort of thing. This is CommChat. It's :cool:
Malygris on 13/4/2006 at 21:22
Yeah, don't sweat it man, it's all good.
i missed the html thread, i sure as shit ain't missing this one
RarRar on 13/4/2006 at 21:26
Are you guys just setting me up?
Sneaky Acolyte on 13/4/2006 at 21:29
Quote Posted by RarRar
Are you guys just setting me up?
The only thing up in this thread is my post count. :cool:
Also, something else, but that converstation is reserved for the late night crowd.
RarRar on 13/4/2006 at 21:33
I'm going to have to look for this html thread alluded to. Find out what I'm in for.
A crude prototype of what I'm working on is here:
(
http://sunsite3.berkeley.edu/ead/tools/moron) Hierarchical grid thingy
Doesn't look good in MSIE yet. May not ever, who knows. Firefox for now. Designed for 1024 x 768 at least. Would be nice to come up with something for all of the 800 x 600 users we have around here but may never happen.