Changes

Jump to: navigation, search

This Music: Prohibited

8,514 bytes added, 02:01, 4 June 2010
no edit summary
==Technical Description==
I was thinking about perhaps having an input of a fake preset "radio" songs connecting through an Arduino to the computer in which the computer would display an accepting or rejecting image in reaction to the song that arises caused by the knobs on the fake radio. My arduino, however, might be broken, so I am still thinking of other ways of taking in input. I am researching if there's a way that I could utilize song recognition applications so that the user could sing or play something and the computer image would either reject it. The third method of input I am considering is taking in a Twitter RSS feed based on the a search with "concert" or "konzert" as the key word. I'm not sure what is feasible yet.
 
What I chose in the end to do was use YouTube as the source of music. Previously, everyone listened to the radio for news and music. Today, however, many utilize YouTube as a way to listen to songs and vlogs dealing with news.
 
I used the Netbeans IDE to use html, java, javascript and css to build a faux-YouTube. If one entered keywords that did not adhere to the standards of any of the countries, the blocking image would appear. For example, if one typed, "mein hut der hat drei ecken," images of US's Roosevelt and Britain's Churchill would appear to stop the site from going to and searching for the phrase on YouTube. Identically, the same would happen if one typed something like "god bless america." An SS officer would appear to stop the website. If the phrase clears both of these restrictions, it will go ahead and allow the user to search for it on YouTube.
==Functional Diagrams==
==Visual Concept==
 
==Documentation==
[[Image:doc1.jpg]]
[[Image:doc2.jpg]]
[[Image:doc3.jpg]]
[[Image:doc4.jpg]]
 
==Source Code==
HTML:
<pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YouTuber: Be Censored</title>
<script type="text/javascript" src="youtuber2.js"></script>
<link rel="stylesheet" type="text/css" href="tinyStillman.css" />
</head>
<body>
<form name ="youtubeForm">
<input type="text" id="inputBoxer" name="inputBox" value="" size="80"/>
<input type="button" value="Search" onclick="searchYoutube()"/>
</form>
</body>
</html>
</pre>
 
JAVASCRIPT:
<pre>
// global
var request;
// function for updating the url
function searchYoutube() {
var inputBox = document.getElementById("inputBoxer").value;
inputBox = (inputBox.trim()).toString();
//searchQuery = inputBox2;
//searchQuery = "form";
var url = "http://localhost:8080/Sessions2/tinyStillman?inputBox=" + inputBox;
//url = "inputBox=" + searchQuery;
//if (microsoftBrowser) { // special treatment for Microsoft IE
// request = new ActiveXObject("Microsoft.XMLHTTP");
//} else { // must be one of the other browsers
request = new XMLHttpRequest();
//}
//alert ("what");
request.open("GET", url, true);
request.onreadystatechange = ajaxCallback;
request.send(null);
}
function ajaxCallback() {
if (request.readyState == 4) {
if (request.status == 200) {
var searchAnswer = request.responseText;
//searchAnswer = searchAnswer.getElementById("url");
//searchAnswer = searchAnswer.toString();
//window.location = searchAnswer;
//document.location = searchAnswer;
location.replace(searchAnswer);
//out.println("got here");
}
}
}
window.onload = function() {
//body = document.getElementsByTagName("body");
//body[0].style.backgroundColor = "#ffffff";
}
</pre>
 
CSS:
<pre>
/* Document : tinyStillman
Created on : Jun 2, 2010, 12:52:26 AM
Author : Kelley
Description:
Purpose of the stylesheet follows.
*/
root {
display: block;
}
body {
background-image: url("http://farm5.static.flickr.com/4014/4665007323_788ac24b36_b.jpg");
background-repeat: no-repeat;
background-position: top center;
background-attachment: fixed;
}
form
{
float: left;
margin-left: 16.7%;
margin-top: 6.5px;
position:relative;
}
input[type=text]{
width:225px;
height:18px;
}
input[type=button]{
border: 1px outset gray;
background-color:white;
}
background-image{
position:relative;
}
</pre>
 
JAVA:
<pre>
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
package edu.ucsd.visarts.session;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.*;
public class tinyStillman extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
String message = null;
String [] germanArticles = {"deutschen","deutschland","deutsch","deutsche",
"bundesrepublik",
"der","das","die","den","dem","des",
"dessen","deren","wessen",
"mein","meinen","meiner","meines", "meine",
"ich", "du","dich","sie","er","ihr","wir",
"sind", "bin","ist","bist","sein",
"auf","von","bei","an","liebe"};
String [] englishIsh = {"english","queen","united kingdom","british","united kingdom",
"states","united states","american", "america","god",
"i","you","yours","me","my","she","he","her","him",
"hers","his",
"is","are","am","in","out","the", "a","love","at"};
try {
// declare some local vars
String [] search;
String searchFinal = "you've got a knack to vivify";
String colorArg = request.getParameter("inputBox"); // will return null if none
search = new String [10];
search = colorArg.split(" ");
searchFinal = "";
int germanNumber = 0;
int englishNumber = 0;
for (int g = 0; g < germanArticles.length; g++){
for (int s = 0; s < search.length; s++){
if (search[s].equalsIgnoreCase(germanArticles[g])){
germanNumber++;
}
}
}
for (int g = 0; g < englishIsh.length; g++){
for (int s = 0; s < search.length; s++){
if (search[s].equalsIgnoreCase(englishIsh[g])){
englishNumber++;
}
}
}
if (germanNumber > englishNumber){
searchFinal = "h ttp://farm5.static.flickr.com/4032/4666513039_22c4f4d02a_b.jpg";
message = searchFinal;
}
else if (englishNumber > germanNumber){
searchFinal = "h ttp://farm5.static.flickr.com/4040/4667136438_5b9b33a396_b.jpg";
message = searchFinal;
}
else {
for (int i = 0; i < search.length; i ++){
searchFinal = searchFinal + search [i] + "+";
}
searchFinal = "http://www.youtube.com/results?search_query=" +
searchFinal + "&aq=f";
message = searchFinal;
}
out.println(searchFinal);
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response<math>Insert formula here</math>
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Tiny Stillman";
}// </editor-fold>
}
</pre>
57
edits

Navigation menu