l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
April 21: Google Glass
Next Installfest:
TBD
Latest News:
Mar. 18: Google Glass at LUGOD's April meeting
Page last updated:
2001 Dec 30 16:57

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] web question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] web question


  • Subject: Re: [vox-tech] web question
  • From: William Kendrick <nbsMAPS@sonic.net>
  • Date: Thu, 05 Oct 2000 16:24:04 -0700
  • References: Pine.LNX.4.21.0010051612380.32347-100000@satan

> 1. put up a graphical image of some state, determined by a CGI script i
>               wrote.

Simple..  I assume you'd have a collection of, say, 50 GIFs.
Say the CGI expects to receive a state abbreviation (like "CA" or "TX"),
you could name the GIFs "CA.gif" or "ca.gif", and so on...


> 2. allow a user to click a point on the screen and have a dot appear at the
>               click point

You'd do this via an imagemap.

The coordinates in which the user click will be sent to the CGI as
two values, one labelled "x" and one "y". :)


> 3. save the click point "coordinates" to a file

Each user would need their own session.  One way of assigning a session
ID (when the user first begins using the map program) is to give assign
them an ID based on the CGI's PID.

In C, it'd be something like:

  pid = atoi(SOME_FUNC_TO_GET_CGI_VARIABLE("pid"));

  if (pid == 0)
  {
    pid = getpid() % REASONABLE_NUMBER_OF_FILES;  /* avoid having
                                                     32000 files! */
  }


Then you could have a world-writable directory where little state (no pun
intended) files go.  ("state" as in "to keep the state of the session",
since CGI's are stateless)

You could also set the PID via a cookie, but why bother when you can store
it as part of a form and/or URL-encoded.


To save-to or read-from a particular user's file, you could do:

  snprintf(fname, sizeof(fname), "sessions/%d.points", pid);

and then "fopen" that filename for read or write.



> later, i would like to display all the states put together, with the dots in
> the right place within the state.
> 
> in rough general terms, can someone outline how something like this might be
> accomplished?

Hope this helps!  Admittedly, I've only used image maps once or twice. :)
(I used it to make a demo map program... zoom in/out, scroll around..)

-bill!


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.