Created
May 21, 2014 01:16
-
-
Save wogsland/b2da5c4e93b739c6dc41 to your computer and use it in GitHub Desktop.
1999 - a trip down memory lane . . . here's a CS assignment where we were basically finding mp3s to rip off around the internet. Kind of hilarious in context. This was 2 months before Napster came out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Class p1info.java -- an information file for assignment 1 | |
* in CS4812. This file is formatted as a .java file, with | |
* extensive comment fields, so that it might be harmlessly | |
* added to a project file in most popular IDEs. This allows | |
* for more convenient consultation of the assignment | |
* specifications during development. | |
* | |
* @author <A HREF="mailto:[email protected]">David Dagon</A> | |
* @version 1.1 | |
*/ | |
public class P1Info extends Object implements java.io.Serializable { | |
public static void main (String arg[]) | |
{ | |
System.err.println ("This class is not meant to be run"); | |
System.exit(0); | |
} | |
/*****************************************************************/ | |
/* | |
P1Info.java | |
CS 4812: "Stealth" JAVA! Programming Assignment 1 | |
- Spring Quarter, 1999. | |
Program Title: A Java Refresher | |
Assigned: April 6, 1999 | |
Design Doc Due: N/A, though recommended | |
Program Due: TBA | |
I. FILE PROVIDED | |
=================== | |
You are given two files for this assignment: | |
o P1Info.java - this file. | |
o MP3.java - a data class file | |
o P1Constants.java - an interface of constants | |
II. DELIVERABLES (what you need to turn in) | |
============================================== | |
o All source files created for this program, or modified by you | |
(Once again, please do NOT modify the gtPage.java file.) | |
o Turn materials in using e-mail, or some other means that | |
provides a time-stamp. | |
PLEASE NOTE: You may only turnin jar files. No other | |
format will be accepted. Please see the directions | |
below for turnin details. | |
III. LEARNING GOALS | |
======================= | |
o Brush up on basic Java syntax. | |
o Get real good at creating console-based programs | |
o Familiarity with Java IO Package. | |
o Gaining some comfort with basic networking | |
o Gaining exposure to simple RMI | |
IV. HEADER FILE | |
=================== | |
o Before beginning work, please create a header for your | |
source files. You might find it convenient to use the | |
file provided to CS1502 students. If you don't have a | |
copy of this file, it is reprinted below: | |
*/ | |
/** | |
* CS4812: Program #1 | |
* | |
* <PRE> | |
* Enter a brief description here | |
* | |
* Revisions: 1.0 DATE, 1999 | |
* Created class XXXXX | |
* </PRE> | |
* | |
* @author <A HREF="mailto:YOUR EMAIL HERE"> | |
* YOUR NAME GOES HERE </A> | |
* | |
* @version Version 1.0, DATE, 1999 | |
* | |
*/ | |
/* | |
V. GENERAL OVERVIEW: CONSTRUCTING A SIMPLE MENU-DRIVEN IO PROGRAM | |
==================================================================== | |
There's nothing more upsetting than the suffering large multi- | |
national record companies must endure at the hands of MP3 pirates. | |
As many of you know, mp3 is a format for encoding CD-quality music | |
in a ditigal format. Many people use mp3s to illegally trade copies | |
of music CDs and other copywritten materials. Since this practice | |
is often illegal, web sites are constantly popping up on the net, | |
offering illegal mp3s for download. Often, these sites are taken | |
down by the ISP provider, but only after they receive news of the | |
illegal activities. | |
Many record companies keep vigil over their intellectual | |
property by patroling the internet, looking for sites that | |
offer mp3s for download. By contacting the site owners or | |
ISP providers, they hope to stem the tide of illegal mp3 | |
distribution. | |
This makes searching for mp3s difficult. Many of the links | |
one finds are no longer valid--removed at the request of a | |
large record company. Since sites are created and shutdown | |
so quickly, search results for mp3s are riddled with bad links. | |
Your job is to help the record companies search the internet | |
for mp3s. You will write a search robot that locates and validates | |
mp3 links. I must stress that in the course of this assignment, | |
you might be tempted to download mp3s for your own use. Please | |
note that this may constitute of a violation of Title 19, United | |
States Code. Let's be clear on this: your software merely searches | |
the interent for mp3s, for later use by a record company in | |
protecting its intellectual property. Please use you program | |
only for the good of mankind, and large multinational record | |
companies. | |
In short, your program will do the following: | |
1) search the internet using any number of common | |
portals or search engines. You will be given | |
an interface file that will help with this. | |
2) After obtaining a search result from, say, | |
Alta Vista, you will recursively load all | |
of the links in the returned pages up to a certain | |
depth. (The depth of the search must be user | |
selected.) Thus, if the first link returned | |
from your Alta Vista query points to "http:// | |
plunderphonic.warez.org/mp3.html", you must | |
load that page and: | |
a) search for mp3 files linked from | |
the page, identified by the ".mp3" | |
file extension. | |
b) validate any mp3 links (checking for | |
java.lang.HttpURLConnection.HTTP_BAD_REQUEST, | |
or some other indication that the | |
link is 'dead') | |
c) save the URL of the valid mp3 link | |
in a special object (MP3.java; see | |
discussion below), | |
d) recursively load all links found on | |
the referencing web page. | |
3) Your program merely needs to recursively load | |
and parse web pages. You need not worry about | |
bad HTML. You may assume that all pages you | |
will encounter use valid hyperlinks, thus: | |
<a href="Maria_Carey_Sings_Opera.mp3> Maria </a> | |
Thus, your HTML parser does not have to be | |
very robust. However, you should write it in such a | |
manner that facilitates later revision and | |
improvements. (E.g., abstract out the parsing | |
functions into another class.) | |
4) Your program also does not need to verify that | |
the linked file is *actually* an mp3 file. You | |
merely need to check whether or not any links | |
ending with ".mp3" have valid object references. | |
Please DO NOT download the mp3 files. (This will | |
take quite a bit of time, and may constitute a | |
violation of applicable copyright protections.) | |
Thus, if a link to: | |
<a href="Cool_Sounds.mp3"> Check this out </a> | |
Merely links to an image or other object, you | |
still record the reference as valid. | |
5) Once you have located and validated the existence | |
of an mp3 file, you must submit the URL to a | |
server using Java RMI--remote method invocation. | |
Shortly, you will be given a policy file, skeleton | |
stubs, and an API. | |
6) Your program should also allow the user to save | |
the URL to disk as a serialized object. | |
VI. RESTRICTIONS | |
==================================================================== | |
The follow restrictions apply to your program: | |
1) You may not use your program to download MP3 files. | |
2) You may not use util.java, or any other utility | |
file from CS1502. All keyboard input must be | |
handled by your own I/O class. You may consult | |
util.java for advice about creating stream | |
readers; however, all code must be your own. | |
3) You may not modify the MP3.java file. If all | |
of the students use the same common record file, | |
search results can be compared and shared with | |
other students in the class. Please do not | |
share the actual MP3 files, of course. | |
4) You must use the file "P1Constants.java". You | |
can modify this interface to suit your needs; | |
however, it must remain an interface, and it | |
must be implemented by some class in your | |
program. | |
The P1Constants file contains essential | |
features and menu options your program must | |
support. You add to them, create additional | |
sub-menu options, and like. You can delete | |
all of the contents of the interface; however, | |
part of your program must impelements an | |
interface called "P1Constants" | |
5) Your program must be submitted as a jar file. | |
You can learn about creating jar files at: | |
http://www.javasoft.com/products/jdk/1.2/docs/tooldocs | |
/win32/jar.html | |
Extra credit will be awarded for files that | |
contain a manifest, with proper executable | |
settings. | |
6) Further information about the RMI capabilities | |
of your program will be released shortly. I | |
am investigating the possibility of installing | |
a full-time server for p1 on College of Computing | |
machines. There are security issues. If this is | |
not feasible, you will given a copy of the server | |
code to run locally. | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment