I volunteered to write a program for someone to calculate Wagner trees.
(A Wagner tree is a phylogenetic tree made by comparing lists of traits,
which are coded as integers, and for which the basal or most primitive value
is known).
It took 2-3 hours to get a tree right, based on this input.
typedef struct
{
int ntraits; /* number of traits */
int nspecies; /* no species (excluding ancestor) */
int *ancestor; /* traits for ancestor */
int **traits; /* traits for species */
char **names; /* names of species */
} WAG_INPUT;
Now of course the user can't fill up this structure directly, so I wondered
if it might be nice to define a file format.
Example file
Wagner Tree file
Version 1.0
Traits
No digits
Tail length
Skin Colour = Grey, Dark Grey, Black, Brown
Species
Oinkus woinkus, 2, 4, Black
Equus geegee, 1, 10, Dark Grey
Moocow 2, 8, Brown
Ancestor 5, 1, Grey
Now coding this up is proving to be a complete nightmare, because of course
input is hostile and you have to deal with anything the user throws at you.
I wonder if I am missing a trick (I hardly ever use text input files).
Otherwise it looks like the imput parser is going to be substantially bigger
than the rest of the program. 2 1549
Malcolm wrote: I volunteered to write a program for someone to calculate Wagner trees. (A Wagner tree is a phylogenetic tree made by comparing lists of traits, which are coded as integers, and for which the basal or most primitive value is known). It took 2-3 hours to get a tree right, based on this input. typedef struct { int ntraits; /* number of traits */ int nspecies; /* no species (excluding ancestor) */ int *ancestor; /* traits for ancestor */ int **traits; /* traits for species */ char **names; /* names of species */ } WAG_INPUT; Now of course the user can't fill up this structure directly, so I wondered if it might be nice to define a file format. Example file Wagner Tree file Version 1.0 Traits No digits Tail length Skin Colour = Grey, Dark Grey, Black, Brown Species Oinkus woinkus, 2, 4, Black Equus geegee, 1, 10, Dark Grey Moocow 2, 8, Brown Ancestor 5, 1, Grey Now coding this up is proving to be a complete nightmare, because of course input is hostile and you have to deal with anything the user throws at you. I wonder if I am missing a trick (I hardly ever use text input files). Otherwise it looks like the imput parser is going to be substantially bigger than the rest of the program.
Yes, this is grunt work and not as much fun.
<OT>
To save you the time, see if there's a Freeware or
PD XML parser available to you. I hear that
you could define a data schema in it and
have it read the data. But, on second thought,
having to have an unsophisticated user write
XML is ... never mind.
</OT>
--
Ñ
"It is impossible to make anything foolproof because fools are so
ingenious" - A. Bloch
Malcolm wrote: I volunteered to write a program for someone to calculate Wagner trees. (A Wagner tree is a phylogenetic tree made by comparing lists of traits, which are coded as integers, and for which the basal or most primitive value is known). It took 2-3 hours to get a tree right, based on this input.
typedef struct { int ntraits; /* number of traits */ int nspecies; /* no species (excluding ancestor) */ int *ancestor; /* traits for ancestor */ int **traits; /* traits for species */ char **names; /* names of species */ } WAG_INPUT;
Now of course the user can't fill up this structure directly, so I wondered if it might be nice to define a file format.
Example file
Wagner Tree file Version 1.0
Traits No digits Tail length Skin Colour = Grey, Dark Grey, Black, Brown
Species Oinkus woinkus, 2, 4, Black Equus geegee, 1, 10, Dark Grey Moocow 2, 8, Brown Ancestor 5, 1, Grey
Now coding this up is proving to be a complete nightmare, because of course input is hostile and you have to deal with anything the user throws at you. I wonder if I am missing a trick (I hardly ever use text input files). Otherwise it looks like the imput parser is going to be substantially bigger than the rest of the program.
It doesn't sound that bad, but the overriding consideration in any
input coding is that IT IS GOING TO CHANGE. So you want to build
something that is easily configured. It looks like you want to
convert name into an index value, and that may be limiting. A
hash table may handle that conveniently. Then you need some sort
of list of allowable fields, and default values for missing
fields. Then you need lists of allowable entries to go with
fields. This can probably be handled with enums and range limits,
but that is awkward (in C) for configuration by an input file.
You will probably need some sort of input order restriction, i.e.
an entry without all ancestors defined is faulty.
--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve Jenkins |
last post by:
Hi,
Wonder if someone could help me. I'm looking for a PHP/MySQL based
search engine that can search flat files i.e. build it's own index
from flat files. I've used Apaches' Lucene before...
|
by: Gregg |
last post by:
Hello all,
I have been banging my head over a problem that I am having reading a
comma seperated file (CSV) that can contain from 1 to 10,000 records.
My code snipit is as follows:
**Start...
|
by: MJ |
last post by:
I have a form that won't allow me to enter data. The sub-forms work
fine, but the main one won't allow input or a new record. What am I
overlooking?
|
by: Alan Searle |
last post by:
Hi Everyone,
I have a number of users who need to regularly create reports and so,
instead of having them run the reports themelves, I want to install
MS-Access on a dedicated PC and have that...
|
by: Tristan |
last post by:
Hi,
In my application I need to store pen objects in a file so they can be
read in at a latter stage from the file to recreate the pen objects in
memory. I'm currently doing this by hand,...
| |
by: Nathan |
last post by:
I have an aspx page with a data grid, some textboxes, and an update button.
This page also has one html input element with type=file (not inside the data
grid and runat=server).
The update...
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using an API function, which takes file path as an input.
When file path contains special characters (@,#,$,%,&,^, etc), API function
gives an error as "Unable to open input file"....
|
by: Tarique |
last post by:
I have tried to restrict the no. of columns in a line oriented user
input.Can anyone please point out
potential flaws in this method?
btw..
1.I have not used dynamic memory allocation because...
|
by: =?Utf-8?B?anAybXNmdA==?= |
last post by:
I've got an application that takes input from a handheld scanner: Once the
incoming text meets the RegEx format and is the correct length, the command
is accepted.
The scanner that plugs in on...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |