[4/26/98] Critique of Assignment 5:
[2/20/98] Critique of Assignment 2 Part I:
play_file
:
play_file
system
.
fgets
to read and write. The audio file is not an ascii
file. You have no control over where the zero bytes are in this file.
#if DEBUG ... #endif
play_file
was working.
play_file
rather than returning an error.
[2/17/98]Question
Just so I am sure what it is I am seeing, can you give a brief description of what each of the performance monitors is?
Answer:
Actually the performance meter has a man page under perfmeter which you may want to look at.... here is an excerpt:
cpu Percent of CPU being utilized. pkts Ethernet packets per second. page Paging activity in pages per second. swap Jobs swapped per second. intr Number of device interrupts per second. disk Disk traffic in transfers per second. cntxt Number of context switches per second. load Average number of runnable processes over the last minute. colls Collisions per second detected on the ethernet. errs Errors per second on receiving packets.P.S. Paging here does mean faults [2/11/98]Question
Can "system" be used in our programs to "cat" the audio files? Can "system" be used to call audioconvert? I was unable to find an audioconvert library function.
Answer:
This is a lab on device independent I/O. You may not use "system" in your program. By the way, "system" forks a child to run the program. In real life this is a very high-overhead approach.
You should use audioconvert as follows. Initially you can use it to remove the headers from your recorded digit files so that you can play them. (You will save the raw files to disk and use those as input.)
Once you get that working, you should compare the raw file and the file with the header to see what you have to do to take off the header yourself.
[2/10/98] Question:
In the assignment due on Wednesday, one of the functions we must write is supposed to remove the "audio header" from a file before sending it to the audio device in a write. I have looked through the book, man pages, and answerbook to find out what the audio header is. I looked at the first few lines of an audio file and found a .snd string before everything became giberish. Can you point me in a direction on this header.
Answer:
Do a man on audioconvert. With the -raw option this filter will remove the header.
stat
:
stat
to detect NEW files. To do this, you must actually read the
stat
structure and see whether the file has been modified since
it was last read.
stat
. (This means they closed standard input
if stat
returned a success.) BTW on some systems,
close
causes a core dump if you try to close a non-existent or
already closed file.
The problem of how big a buffer to allocate to hold path names is a problematic. Members of the class allocated buffers ranging in size from 18 bytes to 32K. (This is a little bit like Carter's Liver Pills isn't?) Many people put an actual number in the declaration instead of defining a constant at the top. Some people just defined a pointer to char for their buffer without allocating any space at all. (This shows up in the lint as "variable used before set".)
There are two acceptable approaches to this issue:
_POSIX_PATH_MAX
.
(In this case you should really make sure it is defined and set a default
value if it isn't).
Among the mistakes made by people who used this approach were:
getopt
:
getopt
can return ? Some people didn't include that as an
option in their switch.
Some people thought putting a statement of the form "I tried a lot of values and it seemed to work" was sufficient.
I would recommend that you make a table of test cases:
Command line MAIL MAILCHECK MAILPATH Resultand organize your testing in a table. You should have your table prepared in advance of sitting down at the terminal or your testing won't be systematic.
I was also curious about how some testers distinguished between taking the time interval from the default, command line or MAILCHECK when they set each instant to 10 or something close to 10.
There wasn't much. You should at least have each function and main program identified with a brief header.
[1/21/98] Question: I copyed the program 2.10 and changed "oshacker" to my name. No matter what, it beeps every 10 seconds. Even if I do not have any incoming mail. Could you please tell me why?
Answer: The mybiff program in the text beeps as long as your mail inbox is not empty. I recommend that you use mailx to read your mail. When you save a message (s) or reply to a message (r) or explicitly delete a message (d) or read the message and then quit from mail (q) rather than exit from (x), the message is removed from your inbox. If you x from mailx or don't read the message, it is still there the next and the file still exists.
[1/20/98] Question: The lint output on my code keeps generating messages about some external variables that are not initialized or used. The -m and -u options are not turning these messages off. I tries the -x option and it did turn them off; however, this is not in line with the specs on the assignment. Also, the lint output includes messages regarding return values for fprintf, close, and sleep (obviously, I failed to error trap those statements). Questions: Should we not get the external variable messages with the -m option; and, if not and we still do, can we use -x? What else does -x do? Are we to error trap the fprintf, close, and sleep statements?
Answer: You may also use the -x option. You do not have to trap errors for fclose and fprintf but you must for fscanf and you probably should for sleep.
Answer: Program 2.10 hardcodes in the path (/var/mail) and the user (oshacker). These are used to get the username to replace oshacker.
[1/20/98] Question: I have tried printing a "New mail for:" message; however, since the process is running in the background, you do not get a new prompt after the message. It can really be irritating and confusing. I suppose the process could fork() and have the child write the message. Or there could be another option flag that allows the user to choose whether to have the message written to the screen.
Answer: Well forking a child isn't a bad strategy, but you shouldn't be printing a message unless you are guaranteed that you are starting mybiff from the console window. This isn't in the spec which is to just ring the bell.