Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added new terminal servlet using current visualization methods and a new one: a processing (processing.org) applet. the new servlet can be found at http://localhost:8080/terminal_p.html ..to be enhanced..
orbiter58830e9b2881
diff --git a/.classpath b/.classpathindex c93b44b06..16e62545a 100644--- a/.classpath+++ b/.classpath@@ -1,6 +1,6 @@<?xml version="1.0" encoding="UTF-8"?><classpath>- <classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/" kind="src" path="htroot"/>+ <classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/" kind="src" path="htroot"/><classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/><classpathentry kind="src" path="htroot/env"/><classpathentry kind="src" path="source"/>diff --git a/build.xml b/build.xmlindex a27634265..ed6396fb8 100644--- a/build.xml+++ b/build.xml@@ -215,6 +215,7 @@<!-- compiling htroot, htroot/yacy and htroot/htdocsdefault --><javac srcdir="${htroot}/"+ excludes="processing/**"classpathref="project.class.path"debug="true" debuglevel="lines,vars,source"source="${javacSource}" target="${javacTarget}"/>diff --git a/htroot/env/terminal.css b/htroot/env/terminal.cssnew file mode 100755index 000000000..4b80b53fd--- /dev/null+++ b/htroot/env/terminal.css@@ -0,0 +1,174 @@+/* Hack for IE to display the margin on #right properly */+* html #right {width:597px;}++/* Body Styles */++body+{+margin: 0px;+background: #3d3d3d;+font-size: 11px;+color: #ffffff;+line-height: 1.5em;+font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif+}++p+{+margin: 5px 0 5px;+padding: 0;+}++h1+{+margin: 1px 0 0 0;+padding-bottom: 2px;+color: #239AFF;+font-size: 10px;+border-bottom: 1px solid #239AFF;+background: inherit;+}++a{color: #fff; text-decoration: none; background: inherit;}+a:hover {color: #EA672E; text-decoration: none; background: inherit;}++ul+{+color: #fff;+list-style-type: none;+padding-left: 10px;+margin: 0 0 5px;+background: inherit;+}++li+{+font-weight: normal;+text-transform: lowercase;+padding: 0;+}++blockquote+{+width: 30em;+margin: 0 0 0 10px;+padding: 5px;+border-left: 1px solid #666+}++/* Main box surrounding everything*/++#outer+{+margin: 0 auto;+width: auto;+overflow:auto;+background-color: #000;+color: #fff;+}++/* Below is everything inside of #outer*/++/* The path box e.g. /root/path */++#location+{+margin: 5px 5px 0;+padding: 0 2px 0 2px;+background: inherit;+color:#666;+font-size: 10px;+}++/* The left column (nav) */++#left+{+margin: 5px 5px 0;+padding: 0 2px 0 2px;+background: inherit;+float: left;+width: 468px;+}++/* The right column (content) */++#right+{+margin: 5px 5px 0;+padding: 0 2px 0 2px;+float: right;+width: 680px;+}++#right a{color: #EA672E; text-decoration: none; background-color:inherit;}++/* Div classes Styles */++div .bars /* These are the bars that are on top of the main box and navs */+{+height: 3px;+background-color: #239AFF;+margin-top: 3px;+margin-bottom: 3px;+color: inherit;+font-size: 0;+}++.navouter+{+width: auto;+margin: 0;+background-color: #000;+border: 1px dotted #666;+color: inherit;+margin-bottom: 10px;+}++.navheader+{+background-color: #666;+color: inherit;+width: auto;+padding: 2px;+margin-bottom: 5px;+text-align: center;+font-weight: bold;+}++.navcontent+{+padding: 5px;+margin:0 0 0 3px;+color: #fff;+font-size:11px;+font-weight:bold;+background-color: #000;+overflow: hidden;+}++/* This is for inserting code */+.code+{+margin: 0 0 0 0;+padding: 3px;+width: 326px;+font-family: helvetica, monospace;+font-size: 10px;+line-height: 90%;+text-transform: lowercase;+background-color: #333;+color: inherit;+border: 1px dotted #666;+}++.htimeauth+{+display:block;+margin: 0;+padding: 0;+text-align:left;+font-size: 10px;+color: #666;+background-color: inherit;+}\ No newline at end of filediff --git a/htroot/processing/domaingraph/applet/domaingraph.jar b/htroot/processing/domaingraph/applet/domaingraph.jarnew file mode 100755index 000000000..9cb521ca7Binary files /dev/null and b/htroot/processing/domaingraph/applet/domaingraph.jar differdiff --git a/htroot/processing/domaingraph/applet/domaingraph.java b/htroot/processing/domaingraph/applet/domaingraph.javanew file mode 100755index 000000000..98f521cf2--- /dev/null+++ b/htroot/processing/domaingraph/applet/domaingraph.java@@ -0,0 +1,229 @@+import processing.core.*; import traer.physics.*; import traer.animation.*; import processing.net.*; import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; import javax.sound.midi.*; import javax.sound.midi.spi.*; import javax.sound.sampled.*; import javax.sound.sampled.spi.*; import java.util.regex.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import org.xml.sax.*; import org.xml.sax.ext.*; import org.xml.sax.helpers.*; public class domaingraph extends PApplet {// Domain visualization graph for YaCy+// by Michael Christen+//+// this applet uses code and the physics engine from+// http://www.cs.princeton.edu/~traer/physics/+// from Jeffrey Traer Bernstein+// redistribution is granted according to forum posting in+// http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1139193613++++++final float NODE_SIZE = 6;+final float EDGE_LENGTH = 50;+final float EDGE_STRENGTH = 0.01f;+final float SPACER_STRENGTH = 10;++ParticleSystem physics;+Smoother3D centroid;+PFont font;+Client myClient;+Particle center0, center1; // two gravity centers to support object ordering for non-quadratic fields+String parsingHostName = "";+String parsingHostID = "";+HashMap nodes = new HashMap(); // map that holds host objects++public void setup() {++ String[] fontList = PFont.list();+ //println(fontList);+ font = createFont(fontList[0], 32); //just take any, should be mostly Arial+ textFont(font, 12);++ size(660, 400);+ smooth();+ frameRate( 24 );+ strokeWeight( 2 );+ ellipseMode( CENTER );++ physics = new ParticleSystem( 0, 0.25f );+ centroid = new Smoother3D( 0.8f );++ initializePhysics();+ initRequest();+}++public void initRequest() {+ myClient = new Client(this, "localhost", 8080);+ myClient.write("GET /xml/webstructure.xml HTTP/1.1\n");+ myClient.write("Host: localhost\n\n");+}++public void processRequestResponse() {+ if (myClient.available() > 0) {+ String line = myClient.readStringUntil((byte) 10);+ //println("Line: " + line);+ if (line == null) line = ""; else line = line.trim();+ if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim()));+ if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim()));+ }+}++public HashMap parseProps(String s) {+ String[] l = s.split(" ");+ HashMap map = new HashMap();+ int p;+ String z;+ for (int i = 0; i < l.length; i++) {+ p = l[i].indexOf("=");+ if (p > 0) {+ z = l[i].substring(p + 1).trim();+ if (z.charAt(0) == '"') z = z.substring(1);+ if (z.charAt(z.length() - 1) == '"') z = z.substring(0, z.length() - 1);+ map.put(l[i].substring(0, p), z);+ }+ }+ return map;+}++public void processDomain(HashMap props) {+ //println("Domain: " + props.toString());+ parsingHostName = (String) props.get("host"); if (parsingHostName == null) parsingHostName = "";+ parsingHostID = (String) props.get("id"); if (parsingHostID == null) parsingHostID = "";+ host h = new host(parsingHostName, physics.makeParticle(1.0f, random(0, EDGE_LENGTH * 30), random(- EDGE_LENGTH * 2, EDGE_LENGTH * 2), 0));+ nodes.put(parsingHostID, h);+ addAttraction(h.node);+}++public void processCitation(HashMap props) {+ //println("Citation: " + props.toString());+ String host = (String) props.get("host"); if (host == null) host = "";+ String id = (String) props.get("id"); if (id == null) id = "";+ int count = 0;+ try {+ String counts = (String) props.get("count"); if (counts != null) count = Integer.parseInt(counts);+ } catch (NumberFormatException e) {}+ // find the two nodes that have a relation+ host h = (host) nodes.get(id);+ if (h == null) return; // host is not known TODO: store these and create relation later+ host p = (host) nodes.get(parsingHostID); // this should be successful+ addRelation(h.node, p.node);+}++public void draw() {+ processRequestResponse();++ physics.tick( 1.0f );+ if (physics.numberOfParticles() > 1) updateCentroid();+ centroid.tick();++ background( 0 );+ translate( width/2 , height/2 );+ scale( centroid.z() );+ translate( -centroid.x(), -centroid.y() );++ drawNetwork();+}++public void drawNetwork() {+ fill( 100, 255, 100 );++ // draw vertices+ noStroke();+ String name;+ Iterator j = nodes.values().iterator();+ host h;+ while (j.hasNext()) {+ h = (host) j.next();+ Particle v = h.node;+ ellipse(v.position().x(), v.position().y(), NODE_SIZE, NODE_SIZE);+ name = h.name;+ text(name, v.position().x() - (name.length() * 26 / 10), v.position().y() + 14);+ }++ // draw center+ /*+ ellipse( center0.position().x(), center0.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center0";+ text(name, center0.position().x() - (name.length() * 26 / 10), center0.position().y() + 14);+ ellipse( center1.position().x(), center1.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center1";+ text(name, center1.position().x() - (name.length() * 26 / 10), center1.position().y() + 14);+ */++ // draw edges+ stroke( 160 );+ beginShape( LINES );+ for ( int i = 0; i < physics.numberOfSprings(); ++i ) {+ Spring e = physics.getSpring( i );+ Particle a = e.getOneEnd();+ Particle b = e.getTheOtherEnd();+ vertex( a.position().x(), a.position().y() );+ vertex( b.position().x(), b.position().y() );+ }+ endShape();+}++public void keyPressed() {+ if ( key == 'c' ) {+ initializePhysics();+ return;+ }++ if ( key == ' ' ) {+ Particle p = physics.makeParticle();+ addRelation(p, physics.getParticle( (int) random( 0, physics.numberOfParticles()-1) ));+ addAttraction(p);+ return;+ }+}++public void updateCentroid() {+ float+ xMax = Float.NEGATIVE_INFINITY,+ xMin = Float.POSITIVE_INFINITY,+ yMin = Float.POSITIVE_INFINITY,+ yMax = Float.NEGATIVE_INFINITY;++ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle p = physics.getParticle( i );+ xMax = max( xMax, p.position().x() );+ xMin = min( xMin, p.position().x() );+ yMin = min( yMin, p.position().y() );+ yMax = max( yMax, p.position().y() );+ }+ float deltaX = xMax-xMin;+ float deltaY = yMax-yMin;+ if ( deltaY > deltaX )+ centroid.setTarget( xMin + 0.5f*deltaX, yMin +0.5f*deltaY, height/(deltaY+50) );+ else+ centroid.setTarget( xMin + 0.5f*deltaX, yMin +0.5f*deltaY, width/(deltaX+50) );+}++public void initializePhysics() {+ physics.clear();+ center0 = physics.makeParticle(1.0f, 0, 0, 0);+ center0.makeFixed();+ center1 = physics.makeParticle(1.0f, EDGE_LENGTH * 30, 0, 0);+ center1.makeFixed();+ centroid.setValue( 0, 0, 1.0f );+}++public void addAttraction(Particle p) {+ physics.makeAttraction(center0, p, 5000.0f, 3 * EDGE_LENGTH);+ physics.makeAttraction(center1, p, 5000.0f, 3 * EDGE_LENGTH);++ // spacers+ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle q = physics.getParticle( i );+ if (p != q) physics.makeAttraction( p, q, -SPACER_STRENGTH, 20);+ }+}++public void addRelation(Particle p, Particle other) {+ physics.makeSpring( p, other, EDGE_STRENGTH, EDGE_STRENGTH, EDGE_LENGTH );+ //p.moveTo( q.position().x() + random( -1, 1 ), q.position().y() + random( -1, 1 ), 0 );+}++static class host {+ String name;+ Particle node;+ public host(String name, Particle node) {+ this.name = name;+ this.node = node;+ }+}++ static public void main(String args[]) { PApplet.main(new String[] { "domaingraph" }); }}\ No newline at end of filediff --git a/htroot/processing/domaingraph/applet/domaingraph.pde b/htroot/processing/domaingraph/applet/domaingraph.pdenew file mode 100755index 000000000..e79f083e7--- /dev/null+++ b/htroot/processing/domaingraph/applet/domaingraph.pde@@ -0,0 +1,227 @@+// Domain visualization graph for YaCy+// by Michael Christen+//+// this applet uses code and the physics engine from+// http://www.cs.princeton.edu/~traer/physics/+// from Jeffrey Traer Bernstein+// redistribution is granted according to forum posting in+// http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1139193613++import traer.physics.*;+import traer.animation.*;+import processing.net.*;++final float NODE_SIZE = 6;+final float EDGE_LENGTH = 50;+final float EDGE_STRENGTH = 0.01;+final float SPACER_STRENGTH = 10;++ParticleSystem physics;+Smoother3D centroid;+PFont font;+Client myClient;+Particle center0, center1; // two gravity centers to support object ordering for non-quadratic fields+String parsingHostName = "";+String parsingHostID = "";+HashMap nodes = new HashMap(); // map that holds host objects++void setup() {++ String[] fontList = PFont.list();+ //println(fontList);+ font = createFont(fontList[0], 32); //just take any, should be mostly Arial+ textFont(font, 12);++ size(660, 400);+ smooth();+ frameRate( 24 );+ strokeWeight( 2 );+ ellipseMode( CENTER );++ physics = new ParticleSystem( 0, 0.25 );+ centroid = new Smoother3D( 0.8 );++ initializePhysics();+ initRequest();+}++void initRequest() {+ myClient = new Client(this, "localhost", 8080);+ myClient.write("GET /xml/webstructure.xml HTTP/1.1\n");+ myClient.write("Host: localhost\n\n");+}++void processRequestResponse() {+ if (myClient.available() > 0) {+ String line = myClient.readStringUntil((byte) 10);+ //println("Line: " + line);+ if (line == null) line = ""; else line = line.trim();+ if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim()));+ if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim()));+ }+}++HashMap parseProps(String s) {+ String[] l = s.split(" ");+ HashMap map = new HashMap();+ int p;+ String z;+ for (int i = 0; i < l.length; i++) {+ p = l[i].indexOf("=");+ if (p > 0) {+ z = l[i].substring(p + 1).trim();+ if (z.charAt(0) == '"') z = z.substring(1);+ if (z.charAt(z.length() - 1) == '"') z = z.substring(0, z.length() - 1);+ map.put(l[i].substring(0, p), z);+ }+ }+ return map;+}++void processDomain(HashMap props) {+ //println("Domain: " + props.toString());+ parsingHostName = (String) props.get("host"); if (parsingHostName == null) parsingHostName = "";+ parsingHostID = (String) props.get("id"); if (parsingHostID == null) parsingHostID = "";+ host h = new host(parsingHostName, physics.makeParticle(1.0, random(0, EDGE_LENGTH * 30), random(- EDGE_LENGTH * 2, EDGE_LENGTH * 2), 0));+ nodes.put(parsingHostID, h);+ addAttraction(h.node);+}++void processCitation(HashMap props) {+ //println("Citation: " + props.toString());+ String host = (String) props.get("host"); if (host == null) host = "";+ String id = (String) props.get("id"); if (id == null) id = "";+ int count = 0;+ try {+ String counts = (String) props.get("count"); if (counts != null) count = Integer.parseInt(counts);+ } catch (NumberFormatException e) {}+ // find the two nodes that have a relation+ host h = (host) nodes.get(id);+ if (h == null) return; // host is not known TODO: store these and create relation later+ host p = (host) nodes.get(parsingHostID); // this should be successful+ addRelation(h.node, p.node);+}++void draw() {+ processRequestResponse();++ physics.tick( 1.0 );+ if (physics.numberOfParticles() > 1) updateCentroid();+ centroid.tick();++ background( 0 );+ translate( width/2 , height/2 );+ scale( centroid.z() );+ translate( -centroid.x(), -centroid.y() );++ drawNetwork();+}++void drawNetwork() {+ fill( 100, 255, 100 );++ // draw vertices+ noStroke();+ String name;+ Iterator j = nodes.values().iterator();+ host h;+ while (j.hasNext()) {+ h = (host) j.next();+ Particle v = h.node;+ ellipse(v.position().x(), v.position().y(), NODE_SIZE, NODE_SIZE);+ name = h.name;+ text(name, v.position().x() - (name.length() * 26 / 10), v.position().y() + 14);+ }++ // draw center+ /*+ ellipse( center0.position().x(), center0.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center0";+ text(name, center0.position().x() - (name.length() * 26 / 10), center0.position().y() + 14);+ ellipse( center1.position().x(), center1.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center1";+ text(name, center1.position().x() - (name.length() * 26 / 10), center1.position().y() + 14);+ */++ // draw edges+ stroke( 160 );+ beginShape( LINES );+ for ( int i = 0; i < physics.numberOfSprings(); ++i ) {+ Spring e = physics.getSpring( i );+ Particle a = e.getOneEnd();+ Particle b = e.getTheOtherEnd();+ vertex( a.position().x(), a.position().y() );+ vertex( b.position().x(), b.position().y() );+ }+ endShape();+}++void keyPressed() {+ if ( key == 'c' ) {+ initializePhysics();+ return;+ }++ if ( key == ' ' ) {+ Particle p = physics.makeParticle();+ addRelation(p, physics.getParticle( (int) random( 0, physics.numberOfParticles()-1) ));+ addAttraction(p);+ return;+ }+}++void updateCentroid() {+ float+ xMax = Float.NEGATIVE_INFINITY,+ xMin = Float.POSITIVE_INFINITY,+ yMin = Float.POSITIVE_INFINITY,+ yMax = Float.NEGATIVE_INFINITY;++ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle p = physics.getParticle( i );+ xMax = max( xMax, p.position().x() );+ xMin = min( xMin, p.position().x() );+ yMin = min( yMin, p.position().y() );+ yMax = max( yMax, p.position().y() );+ }+ float deltaX = xMax-xMin;+ float deltaY = yMax-yMin;+ if ( deltaY > deltaX )+ centroid.setTarget( xMin + 0.5*deltaX, yMin +0.5*deltaY, height/(deltaY+50) );+ else+ centroid.setTarget( xMin + 0.5*deltaX, yMin +0.5*deltaY, width/(deltaX+50) );+}++void initializePhysics() {+ physics.clear();+ center0 = physics.makeParticle(1.0, 0, 0, 0);+ center0.makeFixed();+ center1 = physics.makeParticle(1.0, EDGE_LENGTH * 30, 0, 0);+ center1.makeFixed();+ centroid.setValue( 0, 0, 1.0 );+}++void addAttraction(Particle p) {+ physics.makeAttraction(center0, p, 5000.0, 3 * EDGE_LENGTH);+ physics.makeAttraction(center1, p, 5000.0, 3 * EDGE_LENGTH);++ // spacers+ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle q = physics.getParticle( i );+ if (p != q) physics.makeAttraction( p, q, -SPACER_STRENGTH, 20);+ }+}++void addRelation(Particle p, Particle other) {+ physics.makeSpring( p, other, EDGE_STRENGTH, EDGE_STRENGTH, EDGE_LENGTH );+ //p.moveTo( q.position().x() + random( -1, 1 ), q.position().y() + random( -1, 1 ), 0 );+}++static class host {+ String name;+ Particle node;+ public host(String name, Particle node) {+ this.name = name;+ this.node = node;+ }+}diff --git a/htroot/processing/domaingraph/applet/index.html b/htroot/processing/domaingraph/applet/index.htmlnew file mode 100755index 000000000..6aac5de48--- /dev/null+++ b/htroot/processing/domaingraph/applet/index.html@@ -0,0 +1,104 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">+ <head>+ <!-- charset must remain utf-8 to be handled properly by Processing -->+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />++ <title>domaingraph : Built with Processing</title>++ <style type="text/css">+ /* <![CDATA[ */++ body {+ margin: 60px 0px 0px 55px;+ font-family: verdana, geneva, arial, helvetica, sans-serif;+ font-size: 11px;+ background-color: #ddddcc;+ text-decoration: none;+ font-weight: normal;+ line-height: normal;+ }++ a { color: #3399cc; }+ a:link { color: #3399cc; text-decoration: underline; }+ a:visited { color: #3399cc; text-decoration: underline; }+ a:active { color: #3399cc; text-decoration: underline; }+ a:hover { color: #3399cc; text-decoration: underline; }++ /* ]]> */+ </style>++ </head>+ <body>+ <div id="content">+ <div id="domaingraph_container">++ <!--[if !IE]> -->+ <object classid="java:domaingraph.class"+ type="application/x-java-applet"+ archive="domaingraph.jar"+ width="660" height="400"+ standby="Loading Processing software..." >++ <param name="archive" value="domaingraph.jar" />++ <param name="mayscript" value="true" />+ <param name="scriptable" value="true" />++ <param name="image" value="loading.gif" />+ <param name="boxmessage" value="Loading Processing software..." />+ <param name="boxbgcolor" value="#FFFFFF" />++ <param name="test_string" value="outer" />+ <!--<![endif]-->++ <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"+ codebase="http://java.sun.com/update/1.4.2/jinstall-1_4_2_12-windows-i586.cab"+ width="660" height="400"+ standby="Loading Processing software..." >++ <param name="code" value="domaingraph" />+ <param name="archive" value="domaingraph.jar" />++ <param name="mayscript" value="true" />+ <param name="scriptable" value="true" />++ <param name="image" value="loading.gif" />+ <param name="boxmessage" value="Loading Processing software..." />+ <param name="boxbgcolor" value="#FFFFFF" />++ <param name="test_string" value="inner" />++ <p>+ <strong>+ This browser does not have a Java Plug-in.+ <br />+ <a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in">+ Get the latest Java Plug-in here.+ </a>+ </strong>+ </p>++ </object>++ <!--[if !IE]> -->+ </object>+ <!--<![endif]-->++ </div>++ <p>++ </p>++ <p>+ Source code: <a href="domaingraph.pde">domaingraph</a>+ </p>++ <p>+ Built with <a href="http://processing.org" title="Processing.org">Processing</a>+ </p>+ </div>+ </body>+</html>diff --git a/htroot/processing/domaingraph/applet/loading.gif b/htroot/processing/domaingraph/applet/loading.gifnew file mode 100755index 000000000..1ddae5089Binary files /dev/null and b/htroot/processing/domaingraph/applet/loading.gif differdiff --git a/htroot/processing/domaingraph/domaingraph.pde b/htroot/processing/domaingraph/domaingraph.pdenew file mode 100755index 000000000..e79f083e7--- /dev/null+++ b/htroot/processing/domaingraph/domaingraph.pde@@ -0,0 +1,227 @@+// Domain visualization graph for YaCy+// by Michael Christen+//+// this applet uses code and the physics engine from+// http://www.cs.princeton.edu/~traer/physics/+// from Jeffrey Traer Bernstein+// redistribution is granted according to forum posting in+// http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1139193613++import traer.physics.*;+import traer.animation.*;+import processing.net.*;++final float NODE_SIZE = 6;+final float EDGE_LENGTH = 50;+final float EDGE_STRENGTH = 0.01;+final float SPACER_STRENGTH = 10;++ParticleSystem physics;+Smoother3D centroid;+PFont font;+Client myClient;+Particle center0, center1; // two gravity centers to support object ordering for non-quadratic fields+String parsingHostName = "";+String parsingHostID = "";+HashMap nodes = new HashMap(); // map that holds host objects++void setup() {++ String[] fontList = PFont.list();+ //println(fontList);+ font = createFont(fontList[0], 32); //just take any, should be mostly Arial+ textFont(font, 12);++ size(660, 400);+ smooth();+ frameRate( 24 );+ strokeWeight( 2 );+ ellipseMode( CENTER );++ physics = new ParticleSystem( 0, 0.25 );+ centroid = new Smoother3D( 0.8 );++ initializePhysics();+ initRequest();+}++void initRequest() {+ myClient = new Client(this, "localhost", 8080);+ myClient.write("GET /xml/webstructure.xml HTTP/1.1\n");+ myClient.write("Host: localhost\n\n");+}++void processRequestResponse() {+ if (myClient.available() > 0) {+ String line = myClient.readStringUntil((byte) 10);+ //println("Line: " + line);+ if (line == null) line = ""; else line = line.trim();+ if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim()));+ if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim()));+ }+}++HashMap parseProps(String s) {+ String[] l = s.split(" ");+ HashMap map = new HashMap();+ int p;+ String z;+ for (int i = 0; i < l.length; i++) {+ p = l[i].indexOf("=");+ if (p > 0) {+ z = l[i].substring(p + 1).trim();+ if (z.charAt(0) == '"') z = z.substring(1);+ if (z.charAt(z.length() - 1) == '"') z = z.substring(0, z.length() - 1);+ map.put(l[i].substring(0, p), z);+ }+ }+ return map;+}++void processDomain(HashMap props) {+ //println("Domain: " + props.toString());+ parsingHostName = (String) props.get("host"); if (parsingHostName == null) parsingHostName = "";+ parsingHostID = (String) props.get("id"); if (parsingHostID == null) parsingHostID = "";+ host h = new host(parsingHostName, physics.makeParticle(1.0, random(0, EDGE_LENGTH * 30), random(- EDGE_LENGTH * 2, EDGE_LENGTH * 2), 0));+ nodes.put(parsingHostID, h);+ addAttraction(h.node);+}++void processCitation(HashMap props) {+ //println("Citation: " + props.toString());+ String host = (String) props.get("host"); if (host == null) host = "";+ String id = (String) props.get("id"); if (id == null) id = "";+ int count = 0;+ try {+ String counts = (String) props.get("count"); if (counts != null) count = Integer.parseInt(counts);+ } catch (NumberFormatException e) {}+ // find the two nodes that have a relation+ host h = (host) nodes.get(id);+ if (h == null) return; // host is not known TODO: store these and create relation later+ host p = (host) nodes.get(parsingHostID); // this should be successful+ addRelation(h.node, p.node);+}++void draw() {+ processRequestResponse();++ physics.tick( 1.0 );+ if (physics.numberOfParticles() > 1) updateCentroid();+ centroid.tick();++ background( 0 );+ translate( width/2 , height/2 );+ scale( centroid.z() );+ translate( -centroid.x(), -centroid.y() );++ drawNetwork();+}++void drawNetwork() {+ fill( 100, 255, 100 );++ // draw vertices+ noStroke();+ String name;+ Iterator j = nodes.values().iterator();+ host h;+ while (j.hasNext()) {+ h = (host) j.next();+ Particle v = h.node;+ ellipse(v.position().x(), v.position().y(), NODE_SIZE, NODE_SIZE);+ name = h.name;+ text(name, v.position().x() - (name.length() * 26 / 10), v.position().y() + 14);+ }++ // draw center+ /*+ ellipse( center0.position().x(), center0.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center0";+ text(name, center0.position().x() - (name.length() * 26 / 10), center0.position().y() + 14);+ ellipse( center1.position().x(), center1.position().y(), NODE_SIZE * 2, NODE_SIZE * 2 );+ name = "Center1";+ text(name, center1.position().x() - (name.length() * 26 / 10), center1.position().y() + 14);+ */++ // draw edges+ stroke( 160 );+ beginShape( LINES );+ for ( int i = 0; i < physics.numberOfSprings(); ++i ) {+ Spring e = physics.getSpring( i );+ Particle a = e.getOneEnd();+ Particle b = e.getTheOtherEnd();+ vertex( a.position().x(), a.position().y() );+ vertex( b.position().x(), b.position().y() );+ }+ endShape();+}++void keyPressed() {+ if ( key == 'c' ) {+ initializePhysics();+ return;+ }++ if ( key == ' ' ) {+ Particle p = physics.makeParticle();+ addRelation(p, physics.getParticle( (int) random( 0, physics.numberOfParticles()-1) ));+ addAttraction(p);+ return;+ }+}++void updateCentroid() {+ float+ xMax = Float.NEGATIVE_INFINITY,+ xMin = Float.POSITIVE_INFINITY,+ yMin = Float.POSITIVE_INFINITY,+ yMax = Float.NEGATIVE_INFINITY;++ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle p = physics.getParticle( i );+ xMax = max( xMax, p.position().x() );+ xMin = min( xMin, p.position().x() );+ yMin = min( yMin, p.position().y() );+ yMax = max( yMax, p.position().y() );+ }+ float deltaX = xMax-xMin;+ float deltaY = yMax-yMin;+ if ( deltaY > deltaX )+ centroid.setTarget( xMin + 0.5*deltaX, yMin +0.5*deltaY, height/(deltaY+50) );+ else+ centroid.setTarget( xMin + 0.5*deltaX, yMin +0.5*deltaY, width/(deltaX+50) );+}++void initializePhysics() {+ physics.clear();+ center0 = physics.makeParticle(1.0, 0, 0, 0);+ center0.makeFixed();+ center1 = physics.makeParticle(1.0, EDGE_LENGTH * 30, 0, 0);+ center1.makeFixed();+ centroid.setValue( 0, 0, 1.0 );+}++void addAttraction(Particle p) {+ physics.makeAttraction(center0, p, 5000.0, 3 * EDGE_LENGTH);+ physics.makeAttraction(center1, p, 5000.0, 3 * EDGE_LENGTH);++ // spacers+ for ( int i = 0; i < physics.numberOfParticles(); ++i ) {+ Particle q = physics.getParticle( i );+ if (p != q) physics.makeAttraction( p, q, -SPACER_STRENGTH, 20);+ }+}++void addRelation(Particle p, Particle other) {+ physics.makeSpring( p, other, EDGE_STRENGTH, EDGE_STRENGTH, EDGE_LENGTH );+ //p.moveTo( q.position().x() + random( -1, 1 ), q.position().y() + random( -1, 1 ), 0 );+}++static class host {+ String name;+ Particle node;+ public host(String name, Particle node) {+ this.name = name;+ this.node = node;+ }+}diff --git a/htroot/processing/put_in_libraries/animation.zip b/htroot/processing/put_in_libraries/animation.zipnew file mode 100755index 000000000..b917dddc4Binary files /dev/null and b/htroot/processing/put_in_libraries/animation.zip differdiff --git a/htroot/processing/put_in_libraries/physics.zip b/htroot/processing/put_in_libraries/physics.zipnew file mode 100755index 000000000..b99e97486Binary files /dev/null and b/htroot/processing/put_in_libraries/physics.zip differdiff --git a/htroot/terminal_p.html b/htroot/terminal_p.htmlnew file mode 100755index 000000000..90d494f2e--- /dev/null+++ b/htroot/terminal_p.html@@ -0,0 +1,136 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"+"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >+<head>+<title>YaCy System Monitor</title>+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />+<meta name="description" content="YaCy Peer Live Monitoring" />+<meta name="keywords" content="open,source,search,engine,monitor" />+<link rel="stylesheet" type="text/css" href="/env/terminal.css" />++<script type="text/javascript">+var loaderBanner = null;+var loaderPerformance = null;+var loaderNetwork = null;+var cnt=0;++function loadBanner() {+ document.images[0].src = "/Banner.png?textcolor=ffffff&bgcolor=000000&bordercolor=aaaaaa&cnt=" + cnt++;+}+function loadPerformance() {+ document.images[1].src = "/PerformanceGraph.png?cnt=" + cnt++;+}+function loadNetwork() {+ document.images[3].src = "/NetworkPicture.png?width=660&height=360&bgcolor=FFFFFF&cnt=" + cnt++;+}++function init() {+ loaderBanner = window.setInterval("loadBanner()", 28000);+ loaderPerformance = window.setInterval("loadPerformance()", 4000);+ loaderNetwork = window.setInterval("loadNetwork()", 57000);+}+</script>++</head>++<body onload="init();">++<div id="outer">++<div id="location">+<a href="http://yacy.net"><img src="/Banner.png?textcolor=ffffff&bgcolor=000000&bordercolor=aaaaaa" alt="YaCy" width="468" height="60" border="0" align="middle"></a>+</div>++<div class="bars"></div>++<div id="left"> <!-- begin left side -->++<div class="navouter">+<div class="navheader">Terminal</div>+<div class="navcontent">+<iframe src="/rssTerminal.html?set=PEERNEWS&width=430px&height=200px&maxlines=20&maxwidth=95"+ width="430" height="220" scrolling="no" name="newsframe"+ marginheight="0" marginwidth="0" frameborder="0">+</iframe>+</div>+</div>+++</div> <!-- end left side -->++++<div id="right"> <!-- start right side -->++<h1>Resource Monitor</h1>+<img src="/PerformanceGraph.png" width="330" height="120" name="graph" alt="PerformanceGraph"/>+<img src="/WebStructurePicture_p.png?host=auto&depth=2&width=660&height=240&nodes=100&time=1000" width="330" height="120" alt="WebStructurePicture"/>++<h1>Network Monitor</h1>+<div style="text-align:left;margin:0;padding:0;">+<img src="/NetworkPicture.png?width=660&height=360&bgcolor=FFFFFF" width="330" height="180" alt="The yacy Network" />+<embed src="http://maps.amung.us/flash/flashsrv.php?k=qp3j5gox&type=emb.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" allowScriptAccess="always" allowNetworking="all" type="application/x-shockwave-flash" flashvars="wausitehash=qp3j5gox&map=night&pin=star-orange&link=no" width="330" />+</div>++<h1>Domain Monitor</h1>+<div style="text-align:left;margin:0;padding:0;">++ <!--[if !IE]> -->+ <object classid="java:domaingraph.class"+ type="application/x-java-applet"+ archive="domaingraph.jar"+ width="660" height="400"+ standby="Loading Processing software..." >++ <param name="codebase" value="processing/domaingraph/applet/">+ <param name="archive" value="domaingraph.jar" />++ <param name="mayscript" value="true" />+ <param name="scriptable" value="true" />++ <param name="image" value="processing/domaingraph/applet/loading.gif" />+ <param name="boxmessage" value="Loading Processing software..." />+ <param name="boxbgcolor" value="#FFFFFF" />++ <param name="test_string" value="outer" />+ <!--<![endif]-->++ <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"+ codebase="http://java.sun.com/update/1.4.2/jinstall-1_4_2_12-windows-i586.cab"+ width="660" height="400"+ standby="Loading Processing software..." >++ <param name="code" value="domaingraph" />+ <param name="archive" value="processing/domaingraph/applet/domaingraph.jar" />++ <param name="mayscript" value="true" />+ <param name="scriptable" value="true" />++ <param name="image" value="processing/domaingraph/applet/loading.gif" />+ <param name="boxmessage" value="Loading Processing software..." />+ <param name="boxbgcolor" value="#FFFFFF" />++ <param name="test_string" value="inner" />++ <p>+ <strong>+ This browser does not have a Java Plug-in.+ <br />+ <a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in">+ Get the latest Java Plug-in here.+ </a>+ </strong>+ </p>++ </object>++ <!--[if !IE]> -->+ </object>+ <!--<![endif]-->+</div>++</div> <!-- end right side -->+</div>++</body>+</html>