[thelist] Back in the Aeron again

Luther, Ron Ron.Luther at hp.com
Fri Sep 27 14:48:01 CDT 2002


Hi Steve,

Yeah - I know where you are coming from.  ;-)

I think it's probably a complaint that can be leveled against most
any profession. {e.g. Possibly exemplified by the recent German court
case where a janitor was convicted for setting himself up as a dentist
because he was "bored" sweeping up after the real dentists. Ouch.}

But while we're talking about photography [1], let me hijaak the thread.
Let's start with these two items:

(1) Isaac has talked a few times about putting a 'stock photography
@ evolt' together.

(2) A number of evolters have worked on various 'voting' applications.

Now with the proliferation of digital cameras in so many hands, it
shouldn't be too tough to put together a 'digital competition' site
using categories and rules similar to the film competitions.

Might have some interesting possibilities!

[Tip Below]

RonL.
[1] (a) I've competed in enough photo contests and talked to enough
"A" photographers to know that even though I do get a decent shot
once in a while I'm firmly a "B" photographer.  (b) I just bought a
Coolpix 4500 - so I *must* be good now! Ha!   ;-)


<tip type="modulo logic for loading arrays" author="RonL.">

Once in a while, (possibly but not necessarily due to poorly
designed databases), you may need to select data from several
fields on each row of your result set and load them into a
single dimensional array for processing.

Where did I run into this?  I was playing with the GD library in
PHP to dynamically create a graph of my bowling scores:
http://members.evolt.org/ronl/RLPHP/BowlChart2002.html

{No - I'm not done with it yet.}

Anyway, some idiot, (me), set up the database with the three game scores
for an evening in different columns.

Let's use that case where we're using values from three different
fields from a data table with a structure like this:

09/25/02    179     204    152

In PHP, (Yes, I know 'select star' is evil), your code might look
something like this:

$query = "select * from table";
$result = mysql_query($query);

The following loop uses 'modulo logic' to load the values into
the array:

for ($i = 0; $i < mysql_num_rows($result); $i++) {
   $row_array = mysql_fetch_row($result);
   for ($j = 0; $j < mysql_num_fields($result); $j++) {
   		$data[$i * 3 + 0] = $row_array[1];
   		$data[$i * 3 + 1] = $row_array[2];
   		$data[$i * 3 + 2] = $row_array[3];
   }
}

The technique is easily extensible for a different number of columns.

</tip>


-----Original Message-----
From: Steve Thomas [mailto:s.thomas at har.mrc.ac.uk]

It is a bit of a double edged sword, every designer with a coolpix (insert
any other digital camera here) is now a dyed in the wool pro....nut

I don't know if all that made much sense but I am sure somebody will know
where I am coming from (I just wish I did ;-) )



More information about the thelist mailing list