Forum: Ruby Help with the following program please

Posted by Wayne E. (wayne_e)
on 2013-02-07 17:30
Can anyone help me put this program together. It is crucial.

If anyone can help me with these it would help me out greatly because I
am deeply struggling with these and would love to finish the big program
after these are completed.

PROGRAM #1

Write a simple web server log analysis program that will read the
provided apache.log file and use a case statement to print the HTTP
method used by each web transaction in the log. Each line of the log
file is a single file transaction and has a clearly displayed HTTP verb.
Since this is a good
web server, it only accepts HEAD, GET, POST, and OPTIONS. There are
other methods like TRACE, if these are encountered 'invalid' should be
displayed. For the provided log file, your output
should look something like:
Request 1 used GET.
Request 2 used GET.
Request 3 used GET.
Request 4 used GET.
Request 5 used POST.
Request 6 used an invalid verb/method.
Request 7 used HEAD.

There is no need to write code to read the file. Use the gets method to
read from standard input
(STDIN). When running the program, use I/O redirection to redirect the
file to standard input like
this:
$ ruby inf_name_1.rb < apache.log



PROGRAM #2

A program that will print a two-column ASCII table for both lowercase
and uppercase letters
and the digits 0-9. Your output should look something like the
following:
Character   ASCII Value
A               65
B               66
C               67
D               68
[snip]


.ord may be helpful, it will convert a single-character string (or
character literal) into the ASCII value.


If anyone can solve either one of these then it would be very helpful
and I would admire you forever  =)

Thanks
Posted by Joel Pearson (virtuoso)
on 2013-02-07 17:35
It would be much better for you to learn how to do this yourself. Have 
you considered doing some research?
Posted by Wayne E. (wayne_e)
on 2013-02-07 17:37
Joel Pearson wrote in post #1095791:
> It would be much better for you to learn how to do this yourself. Have
> you considered doing some research?

I have been trying to learn it by myself but to no avail, I am cracking 
under the pressures of the deadline, these are just pieces to a larger 
program that I am struggling with. I am trying to put together these 
pieces so I can construct the larger program  =/
Posted by Ryan Victory (Guest)
on 2013-02-07 17:41
(Received via mailing list)
Your tasks look like homework assignments...if this is the case, have
you talked to your professor?

-Ryan
Posted by Robert Klemme (robert_k78)
on 2013-02-07 17:43
(Received via mailing list)
On Thu, Feb 7, 2013 at 5:30 PM, Wayne E. <lists@ruby-forum.com> wrote:
> Can anyone help me put this program together. It is crucial.

What for?

> If anyone can help me with these it would help me out greatly because I
> am deeply struggling with these and would love to finish the big program
> after these are completed.

How are you going to write "the big program" if you do not finish the
small programs yourself?

> If anyone can solve either one of these then it would be very helpful
> and I would admire you forever  =)

By doing your homework / whatever assignment yourself you'll learn
much more.  This is not a coding service (even though it may look like
it at times).

Regards

robert
Posted by Wayne E. (wayne_e)
on 2013-02-07 18:02
I was trying to see if I could get some help on a few of the smaller 
parts because I was worried that I will not have time to finish these 
for the class and still have time to finish some of the other smaller 
parts and then piece it all together.


Robert Klemme wrote in post #1095797:
> On Thu, Feb 7, 2013 at 5:30 PM, Wayne E. <lists@ruby-forum.com> wrote:
>> Can anyone help me put this program together. It is crucial.
>
> What for?
>
>> If anyone can help me with these it would help me out greatly because I
>> am deeply struggling with these and would love to finish the big program
>> after these are completed.
>
> How are you going to write "the big program" if you do not finish the
> small programs yourself?
>
>> If anyone can solve either one of these then it would be very helpful
>> and I would admire you forever  =)
>
> By doing your homework / whatever assignment yourself you'll learn
> much more.  This is not a coding service (even though it may look like
> it at times).
>
> Regards
>
> robert
Posted by Robert Klemme (robert_k78)
on 2013-02-07 18:21
(Received via mailing list)
On Thu, Feb 7, 2013 at 6:03 PM, Wayne E. <lists@ruby-forum.com> wrote:
> I was trying to see if I could get some help on a few of the smaller
> parts because I was worried that I will not have time to finish these
> for the class and still have time to finish some of the other smaller
> parts and then piece it all together.

Getting help is something different than asking others to write a
program for you.  Also, I hope you are aware that by having others do
the work you'll learn exactly zero.

Cheers

robert
Posted by Ryan Victory (Guest)
on 2013-02-07 18:24
(Received via mailing list)
Not only will you learn nothing, I'd think about the chances that your
prof. is on this list...if it's a Ruby class I'd say the chances are
very good. Just something to think about, especially with cheating being
grounds for expulsion at least in many U.S. universities.

-Ryan
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.