Re: Need some advice on project

new topic     » goto parent     » topic index » view thread      » older message » newer message

From: Ben Logan wrote on Saturday, October 02, 1999 6:34 AM
Subject: Need some advice on project


> Howdy ya'll.
>
> I would like to write a program, but I need help with some of the details.
> If someone could help me every once and a while I'd appreciate it.
>
> Here's what the program should do:
> I ride a bicycle a good bit and I keep records of all my rides.  For a
while
> I kept them in Lotus 123, but transferred them to paper when my old
computer
> died.  Here's an example record (yesterday's):

Sounds like a nice project - not overly complex, but useful.

> Ride # 395
> Date 10-1-99
> Route H-608-648-640-608-|hwy 52 @ Fancy Gap|-608-640-648-608-H
> Miles 24.60
> Time 94' 58"
> Average Speed 15.54
> Total Mileage since 6-27-97  4670.65
> Description Windy
....
Hwy 52 at Fancy Gap? That sounds familiar. Where are you?
....
> Here are some questions I have:
>
> What would be the best way to store the date?  It needs to be able search
> for things like "all the records with dates between 6-9-98 and 8-23-99".
> For this purpose, it seems like storing the date in a numerical format
would
> be best; but I'm not sure how to do that.

You could store it as a sequence {yyyy,mm,dd} and it would be easy to sort
with custom_sort() as well as compare for less-than, equal, or greater-than.

> As you can see, the "Route" field is long compared to the others (and that
> example is a short one).  There's a lot of repetition between records
(i.e.,
> I travel the same routes over and over again).  In order to make the field
> more searchable, and to conserve space, I was thinking that it might be
good
> to let each route be represented by an integer.  The integer would be
stored
> in the file with all of the records, and a separate file would store a
table
> relating each integer with a specific route.

A reasonable choice, especially if you might want to keep additional data
about the routes (a map, perhaps, or terrain measurements)

> Another feature I'd like for it to have is a kind a auto-completion.  By
> "auto-completion" I mean that, as you're typing the route, the next
matching
> route appears.  If it's not the right one, then you simply keep typing.
> (Similar to the location box auto-completion feature of Internet
Explorer.)
> I don't know how do this either...needs to search through the table of
> integers and records as you type...

Build your route description byte by byte (as it is typed in) and after each
character, do a wildcard_match() against the route file using the
description & "*".
Probably you'd want to display a list of matching routes, and either select
the correct one from the list, or continue typing if it is a new one.

> I can't decide whether to store the average speed and total mileage or let
> the program calculate them each time the database is run.  Seems like the
> latter method would take a lot of time, and complicate the searching and
> sorting processes.

Average speed won't change from run to run, as it's based on fixed values:
miles and time. So compute it once (at input time) and store it. Total
mileage might better be computed. Don't be concerned about computation time,
it won't be significant.

> I keep the time in minutes and seconds, but perhaps it should be kept in
> seconds and converted to minutes only when displayed.

I would keep it as a sequence {hh,mm,ss} and do the conversions to and from
seconds as needed with a couple of short functions. That would make the
display or printout formatting simpler.

Regards,
Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu