You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(47) |
Aug
(21) |
Sep
(5) |
Oct
(17) |
Nov
|
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
(6) |
Mar
(7) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
|
2004 |
Jan
(8) |
Feb
(46) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(27) |
Feb
(2) |
Mar
|
Apr
(64) |
May
|
Jun
|
Jul
(11) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(2) |
From: Gordon M. <go...@us...> - 2006-04-14 07:39:39
|
Update of /cvsroot/bitcollider/jbitcollider/plugins/org.bitpedia.collider.video/src/org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20415/plugins/org.bitpedia.collider.video/src/org Log Message: Directory /cvsroot/bitcollider/jbitcollider/plugins/org.bitpedia.collider.video/src/org added to the repository |
From: Gordon M. <go...@us...> - 2006-04-14 07:39:38
|
Update of /cvsroot/bitcollider/jbitcollider/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20415/lib Log Message: Directory /cvsroot/bitcollider/jbitcollider/lib added to the repository |
From: Gordon M. <go...@us...> - 2006-04-14 07:36:13
|
Update of /cvsroot/bitcollider/jbitcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17709/jbitcollider Log Message: Directory /cvsroot/bitcollider/jbitcollider added to the repository |
From: Gordon M. <go...@us...> - 2006-02-21 22:32:24
|
Update of /cvsroot/bitcollider/webcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16546 Modified Files: webcollider.jar Log Message: updated jar Index: webcollider.jar =================================================================== RCS file: /cvsroot/bitcollider/webcollider/webcollider.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 Binary files /tmp/cvsrKJ99q and /tmp/cvshQ4k0U differ |
From: Gordon M. <go...@us...> - 2006-02-21 22:31:58
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16234/src/java/org/bitpedia Modified Files: Webcollider.java Log Message: make method protected, add more debug output Index: Webcollider.java =================================================================== RCS file: /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/Webcollider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Webcollider.java 11 Jan 2006 01:57:20 -0000 1.3 --- Webcollider.java 21 Feb 2006 22:31:52 -0000 1.4 *************** *** 93,97 **** * @param arg Object or Object[] to pass as arguments */ ! public void windowCallback(String callback, Object arg) { Object [] args; if(arg instanceof Object[]) { --- 93,97 ---- * @param arg Object or Object[] to pass as arguments */ ! protected void windowCallback(String callback, Object arg) { Object [] args; if(arg instanceof Object[]) { *************** *** 276,279 **** --- 276,283 ---- Webcollider.this.setBackground(Color.RED); Webcollider.this.repaint(); + System.out.println(filenames+" filenames"); + for(int j = 0; j<filenames.size();j++) { + System.out.println(" "+filenames.get(j)); + } windowCallback("start_call",filenames ); for(int j = 0;j<urls.size();j++) { |
From: Gordon M. <go...@us...> - 2006-01-11 09:03:01
|
Update of /cvsroot/bitcollider/webcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18694 Modified Files: todo-webcollider.txt Log Message: Index: todo-webcollider.txt =================================================================== RCS file: /cvsroot/bitcollider/webcollider/todo-webcollider.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** todo-webcollider.txt 11 Jan 2006 01:57:53 -0000 1.2 --- todo-webcollider.txt 11 Jan 2006 09:02:53 -0000 1.3 *************** *** 8,16 **** X - java: first20 X - CRC32 - kzhash - ed2k hash - parameterize which analyzers are run - security analysis/lockdown against misuse - applet: set background color, background image - html: hide until needed? ! ? - java: accept uri drops? --- 8,19 ---- X - java: first20 X - CRC32 + X - make work in IE - kzhash - ed2k hash - parameterize which analyzers are run - security analysis/lockdown against misuse + - only operate from bitzi.com, bitpedia.org webpages? - applet: set background color, background image + - idle, dragover, collide-in-progress colors/images - html: hide until needed? ! ? - java: accept uri drops? (sorta works in IE now) |
From: Gordon M. <go...@us...> - 2006-01-11 09:02:52
|
Update of /cvsroot/bitcollider/webcollider/src/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18634/src/web Modified Files: Webcollider.html Log Message: * Webcollider.html use cross-browser OBJECT tags Index: Webcollider.html =================================================================== RCS file: /cvsroot/bitcollider/webcollider/src/web/Webcollider.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Webcollider.html 10 Jan 2006 06:57:59 -0000 1.1 --- Webcollider.html 11 Jan 2006 09:02:44 -0000 1.2 *************** *** 1,81 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> ! ! ! <HTML> ! <HEAD> ! <TITLE>Webcollider</TITLE> ! ! <STYLE TYPE="text/css" MEDIA=screen> ! <!-- ! .TINY { height:0px; width:0px } ! --> ! </STYLE> ! ! ! <SCRIPT SRC="prototype.js"></SCRIPT> ! <SCRIPT SRC="json.js"></SCRIPT> ! <SCRIPT> ! var totalInProgress = 0; ! var totalDone = 0; ! function collider_start(files) { ! Element.addClassName("Collider","TINY"); ! totalDone = 0; ! totalInProgress = files.size(); ! collider_progress(); ! } ! function collider_progress(jsonobject) { ! var progressText = totalDone + "/" + totalInProgress+"\n<BR>"; ! if(jsonobject) { ! var pct = jsonobject.optInt("percent-done",0); ! progressText += pct +"% " + jsonobject.optString("filename",""); ! $("completedBar").style.width = pct+"%"; ! } else if (totalInProgress > totalDone) { ! progressText += "0%"; ! $("completedBar").style.width = "0%"; ! } else { ! progressText +="100%"; ! Element.removeClassName("Collider","TINY"); ! } ! $("progress").innerHTML = progressText; ! } ! function collider_finish(jsonobject) { ! var js = JSON.parse(jsonobject.toString()); ! var json = jsonobject.toString(1); ! new Insertion.After("top","<pre>\n"+json.escapeHTML()+"\n</pre>\n<hr>"); ! totalDone++; ! collider_progress(); ! if(js.error) { ! alert(js.error+"\nYou must grant the drop applet trusted permission to read files."); ! } ! } ! </SCRIPT> ! </HEAD> ! ! <BODY> ! ! <h1>Webcollider</h1> ! ! Drop file(s) to be analyzed into below rectangle. ! (Requires Java applet support installed and trusted status for signed applet.) ! <p> ! <DIV style="position:relative; border:2px black solid; width:100%; height:100px"> ! <OBJECT classid="java:org.bitpedia.Webcollider.class" id="Collider" ! type="application/x-java-applet" ! archive="../../webcollider.jar" ! width="100%" height="100" ! style="position:absolute"> ! <PARAM name="mayscript" value="true"> ! <PARAM name="start_call" value="collider_start"> ! <PARAM name="progress_call" value="collider_progress"> ! <PARAM name="finish_call" value="collider_finish"> ! no object support ! </OBJECT> ! <DIV ID="progressBar" STYLE="border:2px solid red; margin:10px 30px; height:30px"> ! <DIV ID="completedBar" STYLE="border:0px; width:0%; height:100%; float:left; background-color:green;"> ! </DIV> ! </DIV> ! </DIV> ! <SPAN ID="progress"><br></SPAN><BR> ! <HR ID="top"/> ! </BODY> </HTML> \ No newline at end of file --- 1,105 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> ! ! ! <HTML> ! <HEAD> ! <TITLE>Webcollider</TITLE> ! ! <STYLE TYPE="text/css" MEDIA=screen> ! <!-- ! .TINY { height:0px; width:0px } ! --> ! </STYLE> ! ! ! <SCRIPT SRC="prototype.js"></SCRIPT> ! <SCRIPT SRC="json.js"></SCRIPT> ! <SCRIPT> ! var totalInProgress = 0; ! var totalDone = 0; ! function collider_start(files) { ! Element.addClassName("Collider","TINY"); ! totalDone = 0; ! totalInProgress = files.size(); ! collider_progress(); ! } ! function collider_progress(jsonobject) { ! var progressText = totalDone + "/" + totalInProgress+"\n<BR>"; ! if(jsonobject) { ! var pct = jsonobject.optInt("percent-done",0); ! progressText += pct +"% " + jsonobject.optString("filename",""); ! $("completedBar").style.width = pct+"%"; ! } else if (totalInProgress > totalDone) { ! progressText += "0%"; ! $("completedBar").style.width = "0%"; ! } else { ! progressText +="100%"; ! Element.removeClassName("Collider","TINY"); ! } ! $("progress").innerHTML = progressText; ! } ! function collider_finish(jsonobject) { ! var js = JSON.parse(jsonobject.toString()); ! var json = jsonobject.toString(1); ! new Insertion.After("top","<pre>\n"+json.escapeHTML()+"\n</pre>\n<hr>"); ! totalDone++; ! collider_progress(); ! if(js.error) { ! alert(js.error+"\nYou must grant the drop applet trusted permission to read files."); ! } ! } ! </SCRIPT> ! </HEAD> ! ! <BODY> ! ! <h1>Webcollider</h1> ! ! Drop file(s) to be analyzed into below rectangle. ! (Requires Java applet support installed and trusted status for signed applet.) ! <p> ! <DIV style="position:relative; border:2px black solid; width:100%; height:100px"> ! <!--[if !IE]> Firefox and others will use outer object --> ! <object classid="java:org.bitpedia.Webcollider.class" ! type="application/x-java-applet" ! archive="../../webcollider.jar" ! height="100px" width="100%" ! style="position:absolute" ! id="Collider" > ! <PARAM name="mayscript" value="true"> ! <PARAM name="start_call" value="collider_start"> ! <PARAM name="progress_call" value="collider_progress"> ! <PARAM name="finish_call" value="collider_finish"> ! <!--<![endif]--> ! <!-- MSIE (Microsoft Internet Explorer) will use inner object --> ! <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ! codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab" ! height="96px" width="100%" ! style="position:absolute; left:0" ! id="Collider" > ! <param name="code" value="org.bitpedia.Webcollider" /> ! <param name="archive" value="../../webcollider.jar" /> ! <PARAM name="mayscript" value="true"> ! <PARAM name="start_call" value="collider_start"> ! <PARAM name="progress_call" value="collider_progress"> ! <PARAM name="finish_call" value="collider_finish"> ! <strong> ! This browser does not have a Java Plug-in. ! <br /> ! <a href="http://java.sun.com/products/plugin/downloads/index.html"> ! Get the latest Java Plug-in here. ! </a> ! </strong> ! </object> ! <!--[if !IE]> close outer object --> ! </object> ! <!--<![endif]--> ! <DIV ID="progressBar" STYLE="border:2px solid red; margin:10px 30px; height:30px"> ! <DIV ID="completedBar" STYLE="border:0px; width:0%; height:100%; float:left; background-color:green;"> ! </DIV> ! </DIV> ! </DIV> ! <SPAN ID="progress"><br></SPAN><BR> ! <HR ID="top"/> ! </BODY> </HTML> \ No newline at end of file |
From: Gordon M. <go...@us...> - 2006-01-11 01:58:01
|
Update of /cvsroot/bitcollider/webcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21241 Modified Files: todo-webcollider.txt Log Message: Index: todo-webcollider.txt =================================================================== RCS file: /cvsroot/bitcollider/webcollider/todo-webcollider.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** todo-webcollider.txt 10 Jan 2006 06:57:59 -0000 1.1 --- todo-webcollider.txt 11 Jan 2006 01:57:53 -0000 1.2 *************** *** 7,10 **** --- 7,15 ---- X - java: philippe hashes X - java: first20 + X - CRC32 + - kzhash + - ed2k hash + - parameterize which analyzers are run + - security analysis/lockdown against misuse - applet: set background color, background image - html: hide until needed? |
From: Gordon M. <go...@us...> - 2006-01-11 01:57:28
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21069/src/java/org/bitpedia Modified Files: Webcollider.java Log Message: * Webcollider.java, CRC32Analyzer.java add CRC32Analyzer Index: Webcollider.java =================================================================== RCS file: /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/Webcollider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Webcollider.java 10 Jan 2006 07:54:12 -0000 1.2 --- Webcollider.java 11 Jan 2006 01:57:20 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- import org.bitpedia.collider.BitprintAnalyzer; + import org.bitpedia.collider.CRC32Analyzer; import org.bitpedia.collider.ColliderAnalyzer; import org.bitpedia.collider.First20Analyzer; *************** *** 191,195 **** return new ColliderAnalyzer[] { new BitprintAnalyzer(), ! new First20Analyzer() }; } --- 192,197 ---- return new ColliderAnalyzer[] { new BitprintAnalyzer(), ! new First20Analyzer(), ! new CRC32Analyzer(), }; } |
From: Gordon M. <go...@us...> - 2006-01-11 01:57:28
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/collider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21069/src/java/org/bitpedia/collider Added Files: CRC32Analyzer.java Log Message: * Webcollider.java, CRC32Analyzer.java add CRC32Analyzer --- NEW FILE: CRC32Analyzer.java --- /* * CRC32Analyzer * Created on Jan 10, 2006 */ package org.bitpedia.collider; import java.util.zip.CRC32; import org.json.JSONException; import org.json.JSONObject; /** * Calculate CRC32 of passed content. * * @author gojomo */ public class CRC32Analyzer extends ColliderAnalyzer { CRC32 crc32; /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#start(org.json.JSONObject) */ public void start(JSONObject json) { crc32 = new CRC32(); } /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#update(org.json.JSONObject, byte[], int) */ public void update(JSONObject json, byte[] buff, int read) { crc32.update(buff,0,read); } /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#finish(org.json.JSONObject) */ public void finish(JSONObject json) { try { String hex = Long.toHexString(crc32.getValue()); while(hex.length()<8) { hex = "0"+hex; } json.put("crc32",hex); } catch (JSONException e) { // TODO Auto-generated catch block throw new RuntimeException(e); } } } |
From: Gordon M. <go...@us...> - 2006-01-10 07:55:07
|
Update of /cvsroot/bitcollider/webcollider/.settings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11975/.settings Removed Files: org.eclipse.jdt.core.prefs Log Message: Misc projet changes --- org.eclipse.jdt.core.prefs DELETED --- |
From: Gordon M. <go...@us...> - 2006-01-10 07:55:06
|
Update of /cvsroot/bitcollider/webcollider/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11975/bin Removed Files: java.policy.applet Log Message: Misc projet changes --- java.policy.applet DELETED --- |
From: Gordon M. <go...@us...> - 2006-01-10 07:55:06
|
Update of /cvsroot/bitcollider/webcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11975 Modified Files: .classpath Log Message: Misc projet changes Index: .classpath =================================================================== RCS file: /cvsroot/bitcollider/webcollider/.classpath,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** .classpath 10 Jan 2006 06:57:59 -0000 1.1 --- .classpath 10 Jan 2006 07:54:54 -0000 1.2 *************** *** 2,8 **** <classpath> <classpathentry kind="src" path="src/java"/> ! <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0"/> ! <classpathentry kind="lib" path="/usr/java/jdk1.5.0_03/jre/lib/plugin.jar"/> <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/> <classpathentry kind="output" path="bin"/> </classpath> --- 2,8 ---- <classpath> <classpathentry kind="src" path="src/java"/> ! <classpathentry kind="lib" path="C:/Program Files/Java/jdk1.5.0_04/jre/lib/plugin.jar"/> <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: Gordon M. <go...@us...> - 2006-01-10 07:54:22
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11877/src/java/org/bitpedia Modified Files: Webcollider.java Log Message: * Webcollider.java add flavor combo that's available under windows xp * webcollider.jar updated signed jar that works on XP Index: Webcollider.java =================================================================== RCS file: /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/Webcollider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Webcollider.java 10 Jan 2006 06:57:59 -0000 1.1 --- Webcollider.java 10 Jan 2006 07:54:12 -0000 1.2 *************** *** 1,283 **** ! /* ! * Webcollider.java ! * ! * Created on Jan 7, 2006 ! * (c) 2006 Bitzi Inc ! */ ! ! package org.bitpedia; ! import java.applet.Applet; ! import java.awt.Color; ! import java.awt.datatransfer.DataFlavor; ! import java.awt.datatransfer.Transferable; ! import java.awt.dnd.DnDConstants; ! import java.awt.dnd.DropTarget; ! import java.awt.dnd.DropTargetAdapter; ! import java.awt.dnd.DropTargetDragEvent; ! import java.awt.dnd.DropTargetDropEvent; ! import java.awt.dnd.DropTargetEvent; ! import java.io.BufferedInputStream; ! import java.io.BufferedReader; ! import java.io.Reader; ! import java.net.URL; ! import java.net.URLConnection; ! import java.util.ArrayList; ! ! import javax.swing.JOptionPane; ! ! import netscape.javascript.JSObject; ! ! import org.bitpedia.collider.BitprintAnalyzer; ! import org.bitpedia.collider.ColliderAnalyzer; ! import org.bitpedia.collider.First20Analyzer; ! import org.json.JSONException; ! import org.json.JSONObject; ! ! /** ! * Webcollider applet; accepts dropped files from local desktop, ! * calculates hashes and extracts other metadata, returns values ! * to page via call to Javascript and JSONObject. ! * ! * @author gojomo ! */ ! public class Webcollider extends Applet ! // implements Runnable ! { ! ! private static final long serialVersionUID = 1L; ! JSObject window; ! private FileDropTargetListener dropTargetAdapter; ! ! public void init() { ! try { ! window = JSObject.getWindow(this); ! } catch (Exception e) { ! System.out.println(e.getMessage()); ! } ! this.dropTargetAdapter = new FileDropTargetListener(); ! this.setDropTarget(new DropTarget(this, ! DnDConstants.ACTION_COPY_OR_MOVE, ! this.dropTargetAdapter, ! true)); ! } ! ! /** ! * Get the 'filename' from an URL (removing any leading path ! * segments). ! * ! * @param url ! * @return String filename ! */ ! public String filenameFromUrl(URL url) { ! String filename = url.getFile(); ! int lastSlash = url.getPath().lastIndexOf("/"); ! if(lastSlash==filename.length()) { ! filename = filename.substring(0,filename.length()-1); ! lastSlash = url.getPath().lastIndexOf("/"); ! } ! if(lastSlash>0) { ! filename = filename.substring(lastSlash+1); ! } ! return filename; ! } ! ! /** ! * Call the given javascript function back in the browser ! * window, with the given argument, wrapped in an array if ! * necessary. ! * @param callback String name of function to call ! * @param arg Object or Object[] to pass as arguments ! */ ! public void windowCallback(String callback, Object arg) { ! Object [] args; ! if(arg instanceof Object[]) { ! args = (Object[]) arg ; ! } else { ! args = new Object[] { arg }; ! } ! if(getParameter(callback) != null) { ! window.call(getParameter(callback),args); ! } ! } ! ! /** ! * Perform all hashing/analysis on the given URL, loading ! * the results into a JSONObject. ! * ! * @param url URL to hash/analyze ! * @return JSONObject of results ! */ ! protected JSONObject collide(URL url) { ! JSONObject json = new JSONObject(); ! long startTime = System.currentTimeMillis(); ! try { ! if(!url.toString().startsWith("file:")) { ! // only enter URL if it's not a 'file:' ! json.put("url",url.toString()); ! } ! String filename = filenameFromUrl(url); ! json.put("filename",filename); ! ! URLConnection conn = url.openConnection(); ! BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); ! ! String ct = conn.getContentType(); ! if(ct.equals("content/unknown")) { ! // TODO: bundle an extension->type map in applet ! // (javax.activations.MimetypesFileMap isn't available) ! } ! json.put("content-type",ct); ! ! ColliderAnalyzer[] analyzers = getAnalyzers(); ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].start(json); ! } ! ! byte[] buff = new byte[65536]; ! long totalRead = 0; ! long totalSize = 0; ! long percentDone = 0; ! int read; ! while((read=bis.read(buff))>-1) { ! totalRead += read; ! if(totalSize==0) { ! totalSize = conn.getContentLength(); // TODO handle long ! // lengths ! } ! ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].update(json,buff,read); ! } ! ! long newPercentDone = totalRead * 100 / totalSize; ! if(newPercentDone > percentDone && newPercentDone < 100) { ! percentDone = newPercentDone; ! json.put("percent-done",percentDone); ! windowCallback("progress_call",json); ! } ! } ! ! json.put("percent-done",100); ! // pass length as string to preserve precision ! json.put("length",String.valueOf(totalRead)); ! ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].finish(json); ! } ! ! long finishTime = System.currentTimeMillis(); ! json.put("collide-time-ms",(int)(finishTime-startTime)); ! } catch (Exception e) { ! try { ! json.put("error", e.getMessage()); ! } catch (JSONException e1) { ! // TODO Auto-generated catch block ! e1.printStackTrace(); ! } ! } ! return json; ! } ! ! ! /** ! * Return an array of all applicable ColliderAnalyzer modules. ! * ! * @return array of analyzers to apply ! */ ! private ColliderAnalyzer[] getAnalyzers() { ! return new ColliderAnalyzer[] { ! new BitprintAnalyzer(), ! new First20Analyzer() ! }; ! } ! ! ! ! class FileDropTargetListener extends DropTargetAdapter { ! public void dragEnter(DropTargetDragEvent evt) { ! Webcollider.this.requestFocusInWindow(); ! Webcollider.this.setBackground(Color.PINK); ! // Iterator iter = evt.getCurrentDataFlavorsAsList().iterator(); ! // while(iter.hasNext()) { ! // System.out.println("evt flavors:"); ! // System.out.println(iter.next()); ! // } ! ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! } ! // public void dragOver(DropTargetDragEvent evt) { ! // Webcollider.this.requestFocusInWindow(); ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! // } ! public void dragExit(DropTargetEvent evt) { ! Webcollider.this.setBackground(Color.WHITE); ! // Webcollider.this.repaint(); ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! } ! ! public void drop(DropTargetDropEvent evt) { ! try { ! Transferable tr = evt.getTransferable(); ! DataFlavor[] flavors = tr.getTransferDataFlavors(); ! for (int i = 0; i < flavors.length; i++) { ! // if (flavors[i].isFlavorJavaFileListType()) { ! // evt.acceptDrop(DnDConstants.ACTION_COPY); ! // java.util.List list2 = (java.util.List) tr ! // .getTransferData(flavors[i]); ! // ArrayList filenames = new ArrayList(); ! // for (int j = 0; j < list2.size(); j++) { ! // String path = list2.get(j).toString(); ! // filenames.add(path); ! // //window.eval("alert("+tr+");"); ! // } ! // if (filenames.size() > 0) { ! // // DOIT ! // evt.dropComplete(true); ! // return; ! // } ! // } ! System.out.println(flavors[i]); ! System.out.println(" "+flavors[i].getMimeType()); ! System.out.println(" "+flavors[i].getRepresentationClass()); ! if(flavors[i].getMimeType().startsWith("text/uri-list") ! && flavors[i].getRepresentationClass() == Reader.class) { ! evt.acceptDrop(DnDConstants.ACTION_COPY); ! Webcollider.this.setBackground(Color.RED); ! Webcollider.this.repaint(); ! BufferedReader reader = new BufferedReader((Reader)tr.getTransferData(flavors[i])); ! String line; ! ArrayList urls = new ArrayList(); ! ArrayList filenames = new ArrayList(); ! while((line = reader.readLine())!=null) { ! URL url = new URL(line.trim()); ! urls.add(url); ! filenames.add(filenameFromUrl(url)); ! } ! windowCallback("start_call",filenames ); ! for(int j = 0;j<urls.size();j++) { ! JSONObject ret = collide((URL) urls.get(j)); ! System.out.println(ret.toString(1)); ! windowCallback("finish_call",ret); ! } ! ! evt.dropComplete(true); ! Webcollider.this.setBackground(Color.WHITE); ! return; ! } ! } ! JOptionPane.showMessageDialog( ! Webcollider.this, ! "none accepted", ! "Invalid File Type", ! JOptionPane.WARNING_MESSAGE); ! evt.rejectDrop(); ! ! } catch (Exception e) { ! e.printStackTrace(); ! evt.rejectDrop(); ! } ! Webcollider.this.setBackground(Color.WHITE); ! } ! } ! ! } --- 1,303 ---- ! /* ! * Webcollider.java ! * ! * Created on Jan 7, 2006 ! * (c) 2006 Bitzi Inc ! */ ! ! package org.bitpedia; ! import java.applet.Applet; ! import java.awt.Color; ! import java.awt.datatransfer.DataFlavor; ! import java.awt.datatransfer.Transferable; ! import java.awt.dnd.DnDConstants; ! import java.awt.dnd.DropTarget; ! import java.awt.dnd.DropTargetAdapter; ! import java.awt.dnd.DropTargetDragEvent; ! import java.awt.dnd.DropTargetDropEvent; ! import java.awt.dnd.DropTargetEvent; ! import java.io.BufferedInputStream; ! import java.io.BufferedReader; ! import java.io.File; ! import java.io.Reader; ! import java.net.URL; ! import java.net.URLConnection; ! import java.util.ArrayList; ! import java.util.Iterator; ! import java.util.List; ! ! import javax.swing.JOptionPane; ! ! import netscape.javascript.JSObject; ! ! import org.bitpedia.collider.BitprintAnalyzer; ! import org.bitpedia.collider.ColliderAnalyzer; ! import org.bitpedia.collider.First20Analyzer; ! import org.json.JSONException; ! import org.json.JSONObject; ! ! /** ! * Webcollider applet; accepts dropped files from local desktop, ! * calculates hashes and extracts other metadata, returns values ! * to page via call to Javascript and JSONObject. ! * ! * @author gojomo ! */ ! public class Webcollider extends Applet ! // implements Runnable ! { ! ! private static final long serialVersionUID = 1L; ! JSObject window; ! private FileDropTargetListener dropTargetAdapter; ! ! public void init() { ! try { ! window = JSObject.getWindow(this); ! } catch (Exception e) { ! System.out.println(e.getMessage()); ! } ! this.dropTargetAdapter = new FileDropTargetListener(); ! this.setDropTarget(new DropTarget(this, ! DnDConstants.ACTION_COPY_OR_MOVE, ! this.dropTargetAdapter, ! true)); ! } ! ! /** ! * Get the 'filename' from an URL (removing any leading path ! * segments). ! * ! * @param url ! * @return String filename ! */ ! public String filenameFromUrl(URL url) { ! String filename = url.getFile(); ! int lastSlash = url.getPath().lastIndexOf("/"); ! if(lastSlash==filename.length()) { ! filename = filename.substring(0,filename.length()-1); ! lastSlash = url.getPath().lastIndexOf("/"); ! } ! if(lastSlash>0) { ! filename = filename.substring(lastSlash+1); ! } ! return filename; ! } ! ! /** ! * Call the given javascript function back in the browser ! * window, with the given argument, wrapped in an array if ! * necessary. ! * @param callback String name of function to call ! * @param arg Object or Object[] to pass as arguments ! */ ! public void windowCallback(String callback, Object arg) { ! Object [] args; ! if(arg instanceof Object[]) { ! args = (Object[]) arg ; ! } else { ! args = new Object[] { arg }; ! } ! if(getParameter(callback) != null) { ! window.call(getParameter(callback),args); ! } ! } ! ! /** ! * Perform all hashing/analysis on the given URL, loading ! * the results into a JSONObject. ! * ! * @param url URL to hash/analyze ! * @return JSONObject of results ! */ ! protected JSONObject collide(URL url) { ! JSONObject json = new JSONObject(); ! long startTime = System.currentTimeMillis(); ! try { ! if(!url.toString().startsWith("file:")) { ! // only enter URL if it's not a 'file:' ! json.put("url",url.toString()); ! } ! String filename = filenameFromUrl(url); ! json.put("filename",filename); ! ! URLConnection conn = url.openConnection(); ! BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); ! ! String ct = conn.getContentType(); ! if(ct.equals("content/unknown")) { ! // TODO: bundle an extension->type map in applet ! // (javax.activations.MimetypesFileMap isn't available) ! } ! json.put("content-type",ct); ! ! ColliderAnalyzer[] analyzers = getAnalyzers(); ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].start(json); ! } ! ! byte[] buff = new byte[65536]; ! long totalRead = 0; ! long totalSize = 0; ! long percentDone = 0; ! int read; ! while((read=bis.read(buff))>-1) { ! totalRead += read; ! if(totalSize==0) { ! totalSize = conn.getContentLength(); // TODO handle long ! // lengths ! } ! ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].update(json,buff,read); ! } ! ! long newPercentDone = totalRead * 100 / totalSize; ! if(newPercentDone > percentDone && newPercentDone < 100) { ! percentDone = newPercentDone; ! json.put("percent-done",percentDone); ! windowCallback("progress_call",json); ! } ! } ! ! json.put("percent-done",100); ! // pass length as string to preserve precision ! json.put("length",String.valueOf(totalRead)); ! ! for(int i = 0; i<analyzers.length;i++) { ! analyzers[i].finish(json); ! } ! ! long finishTime = System.currentTimeMillis(); ! json.put("collide-time-ms",(int)(finishTime-startTime)); ! } catch (Exception e) { ! try { ! json.put("error", e.getMessage()); ! } catch (JSONException e1) { ! // TODO Auto-generated catch block ! e1.printStackTrace(); ! } ! } ! return json; ! } ! ! ! /** ! * Return an array of all applicable ColliderAnalyzer modules. ! * ! * @return array of analyzers to apply ! */ ! private ColliderAnalyzer[] getAnalyzers() { ! return new ColliderAnalyzer[] { ! new BitprintAnalyzer(), ! new First20Analyzer() ! }; ! } ! ! ! ! class FileDropTargetListener extends DropTargetAdapter { ! public void dragEnter(DropTargetDragEvent evt) { ! Webcollider.this.requestFocusInWindow(); ! Webcollider.this.setBackground(Color.PINK); ! // Iterator iter = evt.getCurrentDataFlavorsAsList().iterator(); ! // while(iter.hasNext()) { ! // System.out.println("evt flavors:"); ! // System.out.println(iter.next()); ! // } ! ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! } ! // public void dragOver(DropTargetDragEvent evt) { ! // Webcollider.this.requestFocusInWindow(); ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! // } ! public void dragExit(DropTargetEvent evt) { ! Webcollider.this.setBackground(Color.WHITE); ! // Webcollider.this.repaint(); ! // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); ! } ! ! public void drop(DropTargetDropEvent evt) { ! try { ! Transferable tr = evt.getTransferable(); ! DataFlavor[] flavors = tr.getTransferDataFlavors(); ! for (int i = 0; i < flavors.length; i++) { ! // if (flavors[i].isFlavorJavaFileListType()) { ! // evt.acceptDrop(DnDConstants.ACTION_COPY); ! // java.util.List list2 = (java.util.List) tr ! // .getTransferData(flavors[i]); ! // ArrayList filenames = new ArrayList(); ! // for (int j = 0; j < list2.size(); j++) { ! // String path = list2.get(j).toString(); ! // filenames.add(path); ! // //window.eval("alert("+tr+");"); ! // } ! // if (filenames.size() > 0) { ! // // DOIT ! // evt.dropComplete(true); ! // return; ! // } ! // } ! System.out.println(flavors[i]); ! System.out.println(" "+flavors[i].getMimeType()); ! System.out.println(" "+flavors[i].getRepresentationClass()); ! ArrayList urls = new ArrayList(); ! ArrayList filenames = new ArrayList(); ! if(flavors[i].getMimeType().startsWith("text/uri-list") ! && flavors[i].getRepresentationClass() == Reader.class) { ! // this combo was available in Firefox/Linux FC3 ! evt.acceptDrop(DnDConstants.ACTION_COPY); ! BufferedReader reader = new BufferedReader((Reader)tr.getTransferData(flavors[i])); ! String line; ! urls = new ArrayList(); ! filenames = new ArrayList(); ! while((line = reader.readLine())!=null) { ! URL url = new URL(line.trim()); ! urls.add(url); ! filenames.add(filenameFromUrl(url)); ! } ! } else if (flavors[i].getMimeType().startsWith("application/x-java-file-list") ! && flavors[i].getRepresentationClass() == List.class) { ! // this combo was available in Firefox/ Windows XP ! evt.acceptDrop(DnDConstants.ACTION_COPY); ! List files = (List) tr.getTransferData(flavors[i]); ! Iterator iter = files.iterator(); ! while(iter.hasNext()) { ! File f = (File) iter.next(); ! urls.add(f.toURL()); ! filenames.add(f.getName()); ! } ! } ! ! if(!urls.isEmpty()) { ! Webcollider.this.setBackground(Color.RED); ! Webcollider.this.repaint(); ! windowCallback("start_call",filenames ); ! for(int j = 0;j<urls.size();j++) { ! JSONObject ret = collide((URL) urls.get(j)); ! System.out.println(ret.toString(1)); ! windowCallback("finish_call",ret); ! } ! ! evt.dropComplete(true); ! Webcollider.this.setBackground(Color.WHITE); ! return; ! } ! } ! JOptionPane.showMessageDialog( ! Webcollider.this, ! "none accepted", ! "Invalid File Type", ! JOptionPane.WARNING_MESSAGE); ! evt.rejectDrop(); ! ! } catch (Exception e) { ! e.printStackTrace(); ! evt.rejectDrop(); ! } ! Webcollider.this.setBackground(Color.WHITE); ! } ! } ! ! } |
From: Gordon M. <go...@us...> - 2006-01-10 07:54:21
|
Update of /cvsroot/bitcollider/webcollider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11877 Modified Files: webcollider.jar Log Message: * Webcollider.java add flavor combo that's available under windows xp * webcollider.jar updated signed jar that works on XP Index: webcollider.jar =================================================================== RCS file: /cvsroot/bitcollider/webcollider/webcollider.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 Binary files /tmp/cvsZkjQd4 and /tmp/cvsNCqv9N differ |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:16
|
Update of /cvsroot/bitcollider/webcollider/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/bin Added Files: java.policy.applet Log Message: Initial commit. --- NEW FILE: java.policy.applet --- /* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ /* DO NOT EDIT */ grant { permission java.security.AllPermission; }; |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:15
|
Update of /cvsroot/bitcollider/webcollider/.settings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/.settings Added Files: org.eclipse.jdt.core.prefs Log Message: Initial commit. --- NEW FILE: org.eclipse.jdt.core.prefs --- #Sun Dec 19 18:16:53 PST 2004 org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:15
|
Update of /cvsroot/bitcollider/webcollider/src/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/src/web Added Files: Webcollider.html json.js prototype.js Log Message: Initial commit. --- NEW FILE: Webcollider.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE>Webcollider</TITLE> <STYLE TYPE="text/css" MEDIA=screen> <!-- .TINY { height:0px; width:0px } --> </STYLE> <SCRIPT SRC="prototype.js"></SCRIPT> <SCRIPT SRC="json.js"></SCRIPT> <SCRIPT> var totalInProgress = 0; var totalDone = 0; function collider_start(files) { Element.addClassName("Collider","TINY"); totalDone = 0; totalInProgress = files.size(); collider_progress(); } function collider_progress(jsonobject) { var progressText = totalDone + "/" + totalInProgress+"\n<BR>"; if(jsonobject) { var pct = jsonobject.optInt("percent-done",0); progressText += pct +"% " + jsonobject.optString("filename",""); $("completedBar").style.width = pct+"%"; } else if (totalInProgress > totalDone) { progressText += "0%"; $("completedBar").style.width = "0%"; } else { progressText +="100%"; Element.removeClassName("Collider","TINY"); } $("progress").innerHTML = progressText; } function collider_finish(jsonobject) { var js = JSON.parse(jsonobject.toString()); var json = jsonobject.toString(1); new Insertion.After("top","<pre>\n"+json.escapeHTML()+"\n</pre>\n<hr>"); totalDone++; collider_progress(); if(js.error) { alert(js.error+"\nYou must grant the drop applet trusted permission to read files."); } } </SCRIPT> </HEAD> <BODY> <h1>Webcollider</h1> Drop file(s) to be analyzed into below rectangle. (Requires Java applet support installed and trusted status for signed applet.) <p> <DIV style="position:relative; border:2px black solid; width:100%; height:100px"> <OBJECT classid="java:org.bitpedia.Webcollider.class" id="Collider" type="application/x-java-applet" archive="../../webcollider.jar" width="100%" height="100" style="position:absolute"> <PARAM name="mayscript" value="true"> <PARAM name="start_call" value="collider_start"> <PARAM name="progress_call" value="collider_progress"> <PARAM name="finish_call" value="collider_finish"> no object support </OBJECT> <DIV ID="progressBar" STYLE="border:2px solid red; margin:10px 30px; height:30px"> <DIV ID="completedBar" STYLE="border:0px; width:0%; height:100%; float:left; background-color:green;"> </DIV> </DIV> </DIV> <SPAN ID="progress"><br></SPAN><BR> <HR ID="top"/> </BODY> </HTML> --- NEW FILE: json.js --- /* Copyright (c) 2005 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* The global object JSON contains two methods. JSON.stringify(value) takes a JavaScript value and produces a JSON text. The value must not be cyclical. JSON.parse(text) takes a JSON text and produces a JavaScript value. It will throw a 'JSONError' exception if there is an error. */ var JSON = { copyright: '(c)2005 JSON.org', license: 'http://www.crockford.com/JSON/license.html', /* Stringify a JavaScript value, producing a JSON text. */ stringify: function (v) { var a = []; /* Emit a string. */ function e(s) { a[a.length] = s; } /* Convert a value. */ function g(x) { var c, i, l, v; switch (typeof x) { case 'object': if (x) { if (x instanceof Array) { e('['); l = a.length; for (i = 0; i < x.length; i += 1) { v = x[i]; if (typeof v != 'undefined' && typeof v != 'function') { if (l < a.length) { e(','); } g(v); } } e(']'); return; } else if (typeof x.valueOf == 'function') { e('{'); l = a.length; for (i in x) { v = x[i]; if (typeof v != 'undefined' && typeof v != 'function' && (!v || typeof v != 'object' || typeof v.valueOf == 'function')) { if (l < a.length) { e(','); } g(i); e(':'); g(v); } } return e('}'); } } e('null'); return; case 'number': e(isFinite(x) ? +x : 'null'); return; case 'string': l = x.length; e('"'); for (i = 0; i < l; i += 1) { c = x.charAt(i); if (c >= ' ') { if (c == '\\' || c == '"') { e('\\'); } e(c); } else { switch (c) { case '\b': e('\\b'); break; case '\f': e('\\f'); break; case '\n': e('\\n'); break; case '\r': e('\\r'); break; case '\t': e('\\t'); break; default: c = c.charCodeAt(); e('\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16)); } } } e('"'); return; case 'boolean': e(String(x)); return; default: alert('unhandled:'+typeof x); e('null'); return; } } g(v); return a.join(''); }, /* Parse a JSON text, producing a JavaScript value. */ parse: function (text) { return (/^(\s+|[,:{}\[\]]|"(\\["\\\/bfnrtu]|[^\x00-\x1f"\\]+)*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)+$/.test(text)) && eval('(' + text + ')'); } }; --- NEW FILE: prototype.js --- /* Prototype JavaScript framework, version 1.3.1 * (c) 2005 Sam Stephenson <sa...@co...> * * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff * against the source tree, available from the Prototype darcs repository. * * Prototype is freely distributable under the terms of an MIT-style license. * * For details, see the Prototype web site: http://prototype.conio.net/ * /*--------------------------------------------------------------------------*/ var Prototype = { Version: '1.3.1', emptyFunction: function() {} } var Class = { create: function() { [...999 lines suppressed...] if (!mode) return 0; if (mode == 'vertical') return ((this.offset[1] + element.offsetHeight) - this.ycomp) / element.offsetHeight; if (mode == 'horizontal') return ((this.offset[0] + element.offsetWidth) - this.xcomp) / element.offsetWidth; }, clone: function(source, target) { source = $(source); target = $(target); target.style.position = 'absolute'; var offsets = this.cumulativeOffset(source); target.style.top = offsets[1] + 'px'; target.style.left = offsets[0] + 'px'; target.style.width = source.offsetWidth + 'px'; target.style.height = source.offsetHeight + 'px'; } } |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:15
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/collider In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/src/java/org/bitpedia/collider Added Files: First20Analyzer.java BitprintAnalyzer.java ColliderAnalyzer.java Log Message: Initial commit. --- NEW FILE: First20Analyzer.java --- /* * First20Analyzer.java * * Created on Jan 9, 2006 * * (c) 2006 Bitzi Inc */ package org.bitpedia.collider; import java.math.BigInteger; import org.json.JSONException; import org.json.JSONObject; /** * Remember and report the 20 first bytes of the analyzed * content (or fewer if content is smaller than 20 bytes in * length). * * @author gojomo */ public class First20Analyzer extends ColliderAnalyzer { int bytesProcessed; byte[] first20; /** * Create analyzer. */ public First20Analyzer() { super(); } /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#start(org.json.JSONObject) */ public void start(JSONObject json) { bytesProcessed = 0; first20 = new byte[20]; } /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#update(org.json.JSONObject, byte[], int) */ public void update(JSONObject json, byte[] buff, int read) { if(bytesProcessed < 20) { int len = Math.min(read,20-bytesProcessed); System.arraycopy(buff,0,first20,bytesProcessed,len); bytesProcessed += len; } } /* (non-Javadoc) * @see org.bitpedia.collider.ColliderAnalyzer#finish(org.json.JSONObject) */ public void finish(JSONObject json) { byte[] firstUpTo20 = new byte[bytesProcessed]; System.arraycopy(first20,0,firstUpTo20,0,bytesProcessed); String hex = new BigInteger(1,firstUpTo20).toString(16); while(hex.length()<(bytesProcessed*2)) { hex = "0"+hex; } if(bytesProcessed==0) { hex =""; } try { json.put("first20",hex); } catch (NullPointerException e) { // TODO Auto-generated catch block throw new RuntimeException(e); } catch (JSONException e) { // TODO Auto-generated catch block throw new RuntimeException(e); } } } --- NEW FILE: BitprintAnalyzer.java --- /* * BitprintAnalyzer * * Created on Jan 9, 2006 * * (c) 2006 Bitzi Inc */ package org.bitpedia.collider; import java.security.MessageDigest; import org.bitpedia.util.Base32; import org.bitpedia.util.SHA1; import org.bitpedia.util.TigerTree; import org.json.JSONException; import org.json.JSONObject; /** * Calculate the SHA1 and TigerTree hashes which make up the * Bitzi Bitprint. * * @author gojomo */ public class BitprintAnalyzer extends ColliderAnalyzer { MessageDigest sha1; MessageDigest tigertree; /** * */ public BitprintAnalyzer() { super(); } /* (non-Javadoc) * @see org.bitpedia.ColliderAnalyzer#start(org.json.JSONObject) */ public void start(JSONObject json) { sha1 = new SHA1(); tigertree = new TigerTree(); } /* (non-Javadoc) * @see org.bitpedia.ColliderAnalyzer#update(org.json.JSONObject, byte[], int) */ public void update(JSONObject json, byte[] buff, int read) { sha1.update(buff,0,read); tigertree.update(buff,0,read); } /* (non-Javadoc) * @see org.bitpedia.ColliderAnalyzer#finish(org.json.JSONObject) */ public void finish(JSONObject json) { byte[] sha1digest = sha1.digest(); byte[] ttdigest = tigertree.digest(); try { json.put("sha1",Base32.encode(sha1digest)); json.put("tigertree",Base32.encode(ttdigest)); } catch (JSONException e) { throw new RuntimeException(e); } } } --- NEW FILE: ColliderAnalyzer.java --- /* * ColliderAnalyzer.java * * Created on Jan 9, 2006 * * (c) 2006 Bitzi Inc */ package org.bitpedia.collider; import org.json.JSONObject; /** * Abstract superclass for pluggable stream-analyzers, which are * fed the entire contents of a resource, then given a chance to * insert any final results of their analysis into the summary * structure. * * @author gojomo */ public abstract class ColliderAnalyzer { /** * Perform any initial setup; content of resource * described in given summary strucure is forthcoming. * * @param json summary structure describing resource-in-progress */ public abstract void start(JSONObject json); /** * Accept given batch of binary data from resource * described in summary structure. * * @param json summary structure describing resource-in-progress * @param buff binary data * @param read bytes, from position 0, valid in buff */ public abstract void update(JSONObject json, byte[] buff, int read); /** * Perform any final analysis; no more content is * forthcoming. Add any results to summary structure. * * @param json summary structure describing resource-in-progress */ public abstract void finish(JSONObject json); } |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:15
|
Update of /cvsroot/bitcollider/webcollider/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/src/java Added Files: scrap.jpage Log Message: Initial commit. --- NEW FILE: scrap.jpage --- Matcher m = (Pattern.compile("a.a")).matcher("abracadabra-shazam!"); while(m.find()) { System.out.println(m.start()); } m.find(); "\07".matches("\\W"); (boolean) true "\07".matches("\\p{Graph}"); (boolean) false " ".matches("[\\p{Graph}\\s]"); (boolean) true |
From: Gordon M. <go...@us...> - 2006-01-10 06:58:14
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3863/src/java/org/bitpedia Added Files: Webcollider.java Log Message: Initial commit. --- NEW FILE: Webcollider.java --- /* * Webcollider.java * * Created on Jan 7, 2006 * (c) 2006 Bitzi Inc */ package org.bitpedia; import java.applet.Applet; import java.awt.Color; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.Reader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import javax.swing.JOptionPane; import netscape.javascript.JSObject; import org.bitpedia.collider.BitprintAnalyzer; import org.bitpedia.collider.ColliderAnalyzer; import org.bitpedia.collider.First20Analyzer; import org.json.JSONException; import org.json.JSONObject; /** * Webcollider applet; accepts dropped files from local desktop, * calculates hashes and extracts other metadata, returns values * to page via call to Javascript and JSONObject. * * @author gojomo */ public class Webcollider extends Applet // implements Runnable { private static final long serialVersionUID = 1L; JSObject window; private FileDropTargetListener dropTargetAdapter; public void init() { try { window = JSObject.getWindow(this); } catch (Exception e) { System.out.println(e.getMessage()); } this.dropTargetAdapter = new FileDropTargetListener(); this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, this.dropTargetAdapter, true)); } /** * Get the 'filename' from an URL (removing any leading path * segments). * * @param url * @return String filename */ public String filenameFromUrl(URL url) { String filename = url.getFile(); int lastSlash = url.getPath().lastIndexOf("/"); if(lastSlash==filename.length()) { filename = filename.substring(0,filename.length()-1); lastSlash = url.getPath().lastIndexOf("/"); } if(lastSlash>0) { filename = filename.substring(lastSlash+1); } return filename; } /** * Call the given javascript function back in the browser * window, with the given argument, wrapped in an array if * necessary. * @param callback String name of function to call * @param arg Object or Object[] to pass as arguments */ public void windowCallback(String callback, Object arg) { Object [] args; if(arg instanceof Object[]) { args = (Object[]) arg ; } else { args = new Object[] { arg }; } if(getParameter(callback) != null) { window.call(getParameter(callback),args); } } /** * Perform all hashing/analysis on the given URL, loading * the results into a JSONObject. * * @param url URL to hash/analyze * @return JSONObject of results */ protected JSONObject collide(URL url) { JSONObject json = new JSONObject(); long startTime = System.currentTimeMillis(); try { if(!url.toString().startsWith("file:")) { // only enter URL if it's not a 'file:' json.put("url",url.toString()); } String filename = filenameFromUrl(url); json.put("filename",filename); URLConnection conn = url.openConnection(); BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); String ct = conn.getContentType(); if(ct.equals("content/unknown")) { // TODO: bundle an extension->type map in applet // (javax.activations.MimetypesFileMap isn't available) } json.put("content-type",ct); ColliderAnalyzer[] analyzers = getAnalyzers(); for(int i = 0; i<analyzers.length;i++) { analyzers[i].start(json); } byte[] buff = new byte[65536]; long totalRead = 0; long totalSize = 0; long percentDone = 0; int read; while((read=bis.read(buff))>-1) { totalRead += read; if(totalSize==0) { totalSize = conn.getContentLength(); // TODO handle long // lengths } for(int i = 0; i<analyzers.length;i++) { analyzers[i].update(json,buff,read); } long newPercentDone = totalRead * 100 / totalSize; if(newPercentDone > percentDone && newPercentDone < 100) { percentDone = newPercentDone; json.put("percent-done",percentDone); windowCallback("progress_call",json); } } json.put("percent-done",100); // pass length as string to preserve precision json.put("length",String.valueOf(totalRead)); for(int i = 0; i<analyzers.length;i++) { analyzers[i].finish(json); } long finishTime = System.currentTimeMillis(); json.put("collide-time-ms",(int)(finishTime-startTime)); } catch (Exception e) { try { json.put("error", e.getMessage()); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return json; } /** * Return an array of all applicable ColliderAnalyzer modules. * * @return array of analyzers to apply */ private ColliderAnalyzer[] getAnalyzers() { return new ColliderAnalyzer[] { new BitprintAnalyzer(), new First20Analyzer() }; } class FileDropTargetListener extends DropTargetAdapter { public void dragEnter(DropTargetDragEvent evt) { Webcollider.this.requestFocusInWindow(); Webcollider.this.setBackground(Color.PINK); // Iterator iter = evt.getCurrentDataFlavorsAsList().iterator(); // while(iter.hasNext()) { // System.out.println("evt flavors:"); // System.out.println(iter.next()); // } // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); } // public void dragOver(DropTargetDragEvent evt) { // Webcollider.this.requestFocusInWindow(); // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); // } public void dragExit(DropTargetEvent evt) { Webcollider.this.setBackground(Color.WHITE); // Webcollider.this.repaint(); // evt.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); } public void drop(DropTargetDropEvent evt) { try { Transferable tr = evt.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { // if (flavors[i].isFlavorJavaFileListType()) { // evt.acceptDrop(DnDConstants.ACTION_COPY); // java.util.List list2 = (java.util.List) tr // .getTransferData(flavors[i]); // ArrayList filenames = new ArrayList(); // for (int j = 0; j < list2.size(); j++) { // String path = list2.get(j).toString(); // filenames.add(path); // //window.eval("alert("+tr+");"); // } // if (filenames.size() > 0) { // // DOIT // evt.dropComplete(true); // return; // } // } System.out.println(flavors[i]); System.out.println(" "+flavors[i].getMimeType()); System.out.println(" "+flavors[i].getRepresentationClass()); if(flavors[i].getMimeType().startsWith("text/uri-list") && flavors[i].getRepresentationClass() == Reader.class) { evt.acceptDrop(DnDConstants.ACTION_COPY); Webcollider.this.setBackground(Color.RED); Webcollider.this.repaint(); BufferedReader reader = new BufferedReader((Reader)tr.getTransferData(flavors[i])); String line; ArrayList urls = new ArrayList(); ArrayList filenames = new ArrayList(); while((line = reader.readLine())!=null) { URL url = new URL(line.trim()); urls.add(url); filenames.add(filenameFromUrl(url)); } windowCallback("start_call",filenames ); for(int j = 0;j<urls.size();j++) { JSONObject ret = collide((URL) urls.get(j)); System.out.println(ret.toString(1)); windowCallback("finish_call",ret); } evt.dropComplete(true); Webcollider.this.setBackground(Color.WHITE); return; } } JOptionPane.showMessageDialog( Webcollider.this, "none accepted", "Invalid File Type", JOptionPane.WARNING_MESSAGE); evt.rejectDrop(); } catch (Exception e) { e.printStackTrace(); evt.rejectDrop(); } Webcollider.this.setBackground(Color.WHITE); } } } |
From: Gordon M. <go...@us...> - 2006-01-10 06:57:17
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/json In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3709/src/java/org/json Log Message: Directory /cvsroot/bitcollider/webcollider/src/java/org/json added to the repository |
From: Gordon M. <go...@us...> - 2006-01-10 06:57:17
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3709/src/java/org/bitpedia/util Log Message: Directory /cvsroot/bitcollider/webcollider/src/java/org/bitpedia/util added to the repository |
From: Gordon M. <go...@us...> - 2006-01-10 06:57:17
|
Update of /cvsroot/bitcollider/webcollider/src/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3709/src/web Log Message: Directory /cvsroot/bitcollider/webcollider/src/web added to the repository |
From: Gordon M. <go...@us...> - 2006-01-10 06:57:17
|
Update of /cvsroot/bitcollider/webcollider/src/java/org/bitpedia In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3709/src/java/org/bitpedia Log Message: Directory /cvsroot/bitcollider/webcollider/src/java/org/bitpedia added to the repository |