1. 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):

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!!


The records usually run horizontally instead of vertically.
Those are road numbers in the "Route" field (the "H" stands for Home).
The "||" means I turned around at that intersection.

I would like for the program to store/retrieve/sort/find these records.  It
should be able to find/sort by ride number, date, mileage, time, average
speed, or route.  I'd also like for it to (eventually) draw graphs of
various fields over different ranges, etc.  But I'm getting ahead of myself.

To begin with, it will be command line driven (DOS).  It needs to be easily
expandable so that I can add a GUI in the future.

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.

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.

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...

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.

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

Storing the records in a file would be easier in Euphoria than any other
language I know of, but I'm still not sure of the best way to go about it.

Sorry this is so lengthy.
If anyone is interested in helping me, I'd 'preciate it.

Ben

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: Need some advice on project

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 message » categorize

3. Re: Need some advice on project

I will write an autocomplete for you.
I can build it with either of two variables passed.
first variable is being_typed.
second variable can be either a sequence with the
possible mathes or the name of a file that contains
a list of possible matches.


usage:
  puts(1, auto_complete("L", {"Lucius", "Lamar", "Hilley", "III"}))

would return and display "L"

  puts(1, auto_complete("La", {"Lucius", "Lamar", "Hilley", "III"}))

would return and display "La"

  s = auto_complete_list("L", {"Lucius", "Lamar", "Hilley", "III"})
  --s = {"Lucius", "Lamar"}
  -- you could eaisly impose alphabetical order by using sort.
  -- I would suggest creating a Uppercase or Lowercase set to sort by

I could create a case insensitive sort.


        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Ben Logan <wbljr79 at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, October 02, 1999 6:34 AM
Subject: Need some advice on project


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Ben Logan <wbljr79 at HOTMAIL.COM>
> 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):
>
> 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!!
>
>
> The records usually run horizontally instead of vertically.
> Those are road numbers in the "Route" field (the "H" stands for Home).
> The "||" means I turned around at that intersection.
>
> I would like for the program to store/retrieve/sort/find these records.
It
> should be able to find/sort by ride number, date, mileage, time, average
> speed, or route.  I'd also like for it to (eventually) draw graphs of
> various fields over different ranges, etc.  But I'm getting ahead of
myself.
>
> To begin with, it will be command line driven (DOS).  It needs to be
easily
> expandable so that I can add a GUI in the future.
>
> 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.
>
> 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.
>
> 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...
>
> 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.
>
> I keep the time in minutes and seconds, but perhaps it should be kept in
> seconds and converted to minutes only when displayed.
>
> Storing the records in a file would be easier in Euphoria than any other
> language I know of, but I'm still not sure of the best way to go about it.
>
> Sorry this is so lengthy.
> If anyone is interested in helping me, I'd 'preciate it.
>
> Ben
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Need some advice on project

>From: Irv <irv at ELLIJAY.COM>
>
>....
>Hwy 52 at Fancy Gap? That sounds familiar. Where are you?
>....

The Appalachian mountains of southwestern Virginia.  (Thats right...I'm a
yellow-bellied, ridge-runnin', sap-suckin', gound-stompin', 'possum eatin'
heeelbilly blink

> > Here are some questions I have:
> >
> > What would be the best way to store the date?

>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.

I'll give it a try...

> > 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)

I get the info for my routes off a county map.  I've already written a
(crude) program for displaying the map, which allows me to click on points
on the map to calculate the distance.  I'd eventually like to incorporate
that into this program.


All sounds pretty good.  I'll give it a try.

Ben

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Need some advice on project

Hmmm...Sounds good.
Would you mind describing how it would work?

It would be good if it was case-insensitive.  Also, I think it should return
a list of possible matches.

For speed, it would only be necessary to call the auto_complete routine
every time a separator (typically a hyphen) is typed.  For example:
  If I type in
      H-608-641-
  then when I type the ending hyphen it returns a list like
      {H-608-641-648-608-H},
      {H-608-641-643-640-|647|-640-643-641-608-H},
      {H-608-641-643-|640|-643-641-608-H},
      etc.

The exceptions would be when "H-" is input, auto_complete wouldn't be called
(it would have to return every route in the list); and when "H-608-" is
typed, auto_complete wouldn't be called (I live on 608, so it would once
again have to return every route in the list).

Ben

>From: "Lucius L. Hilley III" <lhilley at CDC.NET>
>
>I will write an autocomplete for you.
>I can build it with either of two variables passed.
>first variable is being_typed.
>second variable can be either a sequence with the
>possible mathes or the name of a file that contains
>a list of possible matches.
>
>
>usage:
>   puts(1, auto_complete("L", {"Lucius", "Lamar", "Hilley", "III"}))
>
>would return and display "L"
>
>   puts(1, auto_complete("La", {"Lucius", "Lamar", "Hilley", "III"}))
>
>would return and display "La"
>
>   s = auto_complete_list("L", {"Lucius", "Lamar", "Hilley", "III"})
>   --s = {"Lucius", "Lamar"}
>   -- you could eaisly impose alphabetical order by using sort.
>   -- I would suggest creating a Uppercase or Lowercase set to sort by
>
>I could create a case insensitive sort.
>
>
>         Lucius L. Hilley III
>         lhilley at cdc.net   lucius at ComputerCafeUSA.com
>+----------+--------------+--------------+----------+
>| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
>|  Horse   +--------------+--------------+  Cafe'   |
>| Software | http://www.cdc.net/~lhilley |  USA     |
>+----------+-------+---------------------+----------+
>                    | http://www.ComputerCafeUSA.com |
>                    +--------------------------------+


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

6. Re: Need some advice on project

From: Ben Logan <wbljr79 at HOTMAIL.COM>


> >From: Irv <irv at ELLIJAY.COM>
> >Hwy 52 at Fancy Gap? That sounds familiar. Where are you?

> The Appalachian mountains of southwestern Virginia.  (Thats right...I'm a
> yellow-bellied, ridge-runnin', sap-suckin', gound-stompin', 'possum eatin'
> heeelbilly blink

Yep. Been there, it's a nice area. I'm at the other end of the Blue Ridge, a
few miles from the southern end of the Appalachian Trail.

> I get the info for my routes off a county map.  I've already written a
> (crude) program for displaying the map, which allows me to click on points
> on the map to calculate the distance.  I'd eventually like to incorporate
> that into this program.

Sounds useful. By the way, the 911 agencies in your area may be interested
in your help. We have something like that here, which displays the streets,
buildings, and fireplugs [important] for any given area. The program was
written by the 911 director. I don't know if there is a commercial version
available, or whether each agency is on their own when it comes to this sort
of thing.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

7. Re: Need some advice on project

On Sun, 3 Oct 1999 07:51:08 EDT, Ben Logan <wbljr79 at HOTMAIL.COM> wrote:

>Hmmm...Sounds good.
>Would you mind describing how it would work?

Better than that, here's the code. I'll leave it up to you to decide
how to skip over the case where it returns the _complete_ list of routes.
Hint: if length(found) = length(routes) then...


include get.e
include wildcard.e

sequence routes,found, result

constant ID = 1, ROUTE = 2 -- refer to fields of structure below:
routes ={{1,"H604-H440",0,0,0}, -- naturally, this should really
         {2,"H043-H433",0,1,0}, -- be loaded from a file
         {3,"604-443",1,0,1}}

function select(sequence list, sequence  pattern)
object temp
 temp = {}
 pattern = upper(pattern & '*')
 for i = 1 to length(list) do
   if wildcard_match(pattern,upper(list[i][ROUTE])) > 0 then
      temp = append(temp,list[i])
   end if
 end for
 return temp
end function

procedure display(object list)
clear_screen()
for i = 1 to length(list) do
  printf(1,"%d %s %d %d %d\n",list[i])
end for
end procedure

function get_input()
object search, key, found

 search = ""
 found = {}
 while 1 do
    key = wait_key()
    if key = 27 then exit -- escape
    else search = search & key
         found = select(routes,search)
         display(found)
    end if
 end while
return found
end function


puts(1,"Enter your route code, or ESC to quit\n")
result = get_input()

new topic     » goto parent     » topic index » view message » categorize

8. Re: Need some advice on project

The program below is a bit overdone but I believe it gets the point
across.
If I where to use it I would modify it to my particular taste.

---begin program---

global function auto_complete_list(sequence str, sequence list)
  sequence ret, Lstr, Llist

  --Use Lstr & Llist for case insensitive
  Lstr = str + ((str >= 'A' and 'Z' >= str) * 32)
  Llist = list + ((list >= 'A' and 'Z' >= list) * 32)

  ret = {}
  for A = 1 to length(list) do
    if length(str) then
      if (match(str, list[A]) = 1) then
        ret = append(ret, list[A])
      end if
    end if
  end for

  return ret
end function

global function auto_complete(sequence str, sequence list)
  integer found
  sequence ret, Lstr, Llist

  --Use Lstr & Llist for case insensitive
  Lstr = str + ((str >= 'A' and 'Z' >= str) * 32)
  Llist = list + ((list >= 'A' and 'Z' >= list) * 32)

  ret = {}
  found = 0
  for A = 1 to length(list) do
    if length(str) then
      if (match(str, list[A]) = 1) then --
        if (not found) then
          ret = append(ret, list[A])
          found = 1
        else
          ret = str
          exit
        end if
      end if
    end if
  end for

  return ret
end function

integer c, l
sequence s, list

list = {"Lucius", "Lamar", "Hilley", "III"}

position(2, 1)
for A = 1 to length(list) do
  puts(1, list[A]) puts(1, 32)
end for

c = -1
s = {}
while c != 13 do
  position(1, 1)
  puts(1, repeat(32, 79))
  position(1, 1)
  puts(1, auto_complete(s, list))
  position(1, 1)
  puts(1, s)

  c = get_key()
  while c = -1 do
    c = get_key()
  end while
  if    (c = 8) then
    l = length(s)
    if l then
      s = s[1..l - 1]
    end if
  elsif (c = 13) then
  else
    s &= c
  end if

end while

position(3, 1)
s = auto_complete_list(s, list)
for A = 1 to length(s) do
  puts(1, s[A]) puts(1, 10)
end for


while get_key() = -1 do end while
---end program---

        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Ben Logan <wbljr79 at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, October 03, 1999 7:51 AM
Subject: Re: Need some advice on project


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Ben Logan <wbljr79 at HOTMAIL.COM>
> Subject:      Re: Need some advice on project
> --------------------------------------------------------------------------
-----
>
> Hmmm...Sounds good.
> Would you mind describing how it would work?
>
> It would be good if it was case-insensitive.  Also, I think it should
return
> a list of possible matches.
>
> For speed, it would only be necessary to call the auto_complete routine
> every time a separator (typically a hyphen) is typed.  For example:
>   If I type in
>       H-608-641-
>   then when I type the ending hyphen it returns a list like
>       {H-608-641-648-608-H},
>       {H-608-641-643-640-|647|-640-643-641-608-H},
>       {H-608-641-643-|640|-643-641-608-H},
>       etc.
>
> The exceptions would be when "H-" is input, auto_complete wouldn't be
called
> (it would have to return every route in the list); and when "H-608-" is
> typed, auto_complete wouldn't be called (I live on 608, so it would once
> again have to return every route in the list).
>
> Ben
>
> >From: "Lucius L. Hilley III" <lhilley at CDC.NET>
> >
> >I will write an autocomplete for you.
> >I can build it with either of two variables passed.
> >first variable is being_typed.
> >second variable can be either a sequence with the
> >possible mathes or the name of a file that contains
> >a list of possible matches.
> >
> >
> >usage:
> >   puts(1, auto_complete("L", {"Lucius", "Lamar", "Hilley", "III"}))
> >
> >would return and display "L"
> >
> >   puts(1, auto_complete("La", {"Lucius", "Lamar", "Hilley", "III"}))
> >
> >would return and display "La"
> >
> >   s = auto_complete_list("L", {"Lucius", "Lamar", "Hilley", "III"})
> >   --s = {"Lucius", "Lamar"}
> >   -- you could eaisly impose alphabetical order by using sort.
> >   -- I would suggest creating a Uppercase or Lowercase set to sort by
> >
> >I could create a case insensitive sort.
> >
> >
> >         Lucius L. Hilley III
> >         lhilley at cdc.net   lucius at ComputerCafeUSA.com
> >+----------+--------------+--------------+----------+
> >| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
> >|  Horse   +--------------+--------------+  Cafe'   |
> >| Software | http://www.cdc.net/~lhilley |  USA     |
> >+----------+-------+---------------------+----------+
> >                    | http://www.ComputerCafeUSA.com |
> >                    +--------------------------------+
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>

new topic     » goto parent     » topic index » view message » categorize

9. Re: Need some advice on project

Sorry to butt into this discussion but..

>>....
>>Hwy 52 at Fancy Gap? That sounds familiar. Where are you?
>>....
>
>The Appalachian mountains of southwestern Virginia.  (Thats right...I'm a
>yellow-bellied, ridge-runnin', sap-suckin', gound-stompin', 'possum eatin'
>heeelbilly blink

Heh, I never thought of anyone east of Kentucky being
a hillbilly. blink  I'm from southwestern Missouri (Ozark
mountains).

Lewis Townsend

PS. I've never ate a possum but my dad has, ugh!
    He says they're greasy.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

10. Re: Need some advice on project

LOL!
I wouldn't eat an opposum if it was the *last* food on earth!  They're so
ugly...nothing but great big rats.

We actually did eat a groundhog once though.  It was pretty good.  Tasted a
lot like turkey.

Ben

>From: Lewis Townsend <keroltarr at HOTMAIL.COM>
...
>
>PS. I've never ate a possum but my dad has, ugh!
>    He says they're greasy.


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

11. Re: Need some advice on project

Thanks, Irv and Lucius, for your code.  I'm hammering out the details.

What would be the most efficient way to scan the leading and trailing spaces
off a string?  When I prompt the user for a filename, I'd like to make sure
there are no leading/trailing spaces.  I could create a loop in several
different ways, but I saw a better way to do it one time and can't remember
where I saw it (maybe I was hallucinating).

Another thing: when programming in other languages, I created a phantom
cursor (highlight) by getting the char/attribute pairs for the area I wanted
to highlight (usually by calling BIOS int 10h service 8), xor-ing the
attribute with some number, and writing the attribute back to video.  That
way, when I wanted to remove the phantom cursor, I could simply call the
same routine again.  How should I create a phantom cursor in Euphoria?
Would it be fast enough to use the predefined functions for saving and
restoring areas of the screen?

Thanks,

Ben

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

12. Re: Need some advice on project

You can still make those BIOS calls in Euphoria.
and some white-space routines are provided below.  They
scan then return a cut value instead of continually
trimming until the desired cut is achieved.


-------------Lucius L. Hilley III
-------------  of  Hollow Horse

--         Created for use with
-- Lucius L. Hilley's Macro preprocessor

global function whitespc_leading(sequence string)
  integer ls

  ls = 1
  while string[ls] = ' ' do
    ls = ls + 1
  end while

  return string[ls..length(string)]
end function

global function whitespc_trailing(sequence string)
  integer le

  le = length(string)
  while string[le] = ' ' do
    le = le - 1
  end while

  return string[1..le]
end function

global function whitespc_ends(sequence string)
  integer ls, le

  ls = 1
  le = length(string)

  while string[ls] = ' ' and string[le] = ' ' do
    ls = ls + 1
    le = le - 1
  end while

  while string[ls] = ' ' do
    ls = ls + 1
  end while

  while string[le] = ' ' do
    le = le - 1
  end while

  return string[ls..le]
end function

        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
----- Original Message -----
From: Ben Logan <wbljr79 at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, October 05, 1999 6:51 AM
Subject: Re: Need some advice on project


> ---------------------- Information from the mail
header -----------------------
> Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster:       Ben Logan <wbljr79 at HOTMAIL.COM>
> Subject:      Re: Need some advice on project
> --------------------------------------------------------------------------
-----
>
> Thanks, Irv and Lucius, for your code.  I'm hammering out the details.
>
> What would be the most efficient way to scan the leading and trailing
spaces
> off a string?  When I prompt the user for a filename, I'd like to make
sure
> there are no leading/trailing spaces.  I could create a loop in several
> different ways, but I saw a better way to do it one time and can't
remember
> where I saw it (maybe I was hallucinating).
>
> Another thing: when programming in other languages, I created a phantom
> cursor (highlight) by getting the char/attribute pairs for the area I
wanted
> to highlight (usually by calling BIOS int 10h service 8), xor-ing the
> attribute with some number, and writing the attribute back to video.  That
> way, when I wanted to remove the phantom cursor, I could simply call the
> same routine again.  How should I create a phantom cursor in Euphoria?
> Would it be fast enough to use the predefined functions for saving and
> restoring areas of the screen?
>
> Thanks,
>
> Ben
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu