Showing posts with label Organism. Show all posts
Showing posts with label Organism. Show all posts

Friday, 7 November 2008

Organism project update


The main interface was intended to be Flash based as shown in the file
TRACY office anno.jpg
No.1 is the funtion to exit the program.
No.2 is the list of stored "suspects"
No.3 is the "reply" function (styled as a typewriter)
No.4 is where the PI would answer the telephone ( Incoming Mail)

Unfortunately i have been unable to produce a working interface
in time

Organism project update

I found the solution to my connection problem! One little change to my code ( Literally adding an s on the end of Pop3) has allowed me to connect to the mail server and testing has found the spam in my dummy emails!

from

try
{
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);

store = session.getStore("pop3");

store.connect(popServer, popUser, popPassword);
folder = store.getDefaultFolder();

to

try
{
Properties props = System.getProperties();

Session session = Session.getDefaultInstance(prop
s, null);
store = session.getStore("pop3s");
store.connect(popServer, popUser, popPassword);

folder = store.getDefaultFolder();





I am so happy :) this has been bugging me for days.

Thursday, 6 November 2008

Organism project pop3 info



Organism project update

I have downloaded some sound clips to serve as alerts / background music etc for my flash GUI.

These files are from a popular game (Team Fortress 2) which is an american cartoon stylised first person shooter for the pc.







Organism project update

Java coding is definitely more complicated than I first thought.

I have "borrowed" the source code for a mail application with the intention of modifying it to interact with my flash GUI and i have managed to get the mail app to work... to a degree. unfortunately i have come acropper with the code because although it appears to work there are some connection issues between my computer and the mail server.


here is my mailreader

package mailproject;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
import net.sf.classifier4J.*;
import net.sf.classifier4J.bayesian.*;

import net.sf.classifier4J.summariser.*;
public class MailReader
{
public static void main(String[] args)
{
try

{
String popServer="pop.gmail.com";
String popUser="ss.tybs";
String popPassword="xenophobe1";
GetMail(popServer, popUser, popPassword);
}

catch (Exception e)
{
e.printStackTrace();
}
System.exit(0);
}

public static void GetMail(String popServer, String popUser, String popPassword)
{
Store store=null;
Folder folder=null;
String strEmail = "";
double dSpamScore = 0.0;
try
{
Properties props = System.getProperties();

Session session = Session.getDefaultInstance(props, null);
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassw
ord);
folder = store.getDefaultFolder();
if (folder == null) throw new Exception("No default folder");
folder = folder.getFolder("INBOX");
if (folder == null) throw new Exception("No POP3 INBOX");
folder.open(Folder.READ_ONLY);
Message[] msgs = folder.getMessages();
for (int nMsg = 0; nMsg < stremail =" buildMessage(msgs[nMsg]);" strsumm =" getSummary(strEmail,3);">
m.out.println(strSumm); dSpamScore = checkSpam(strEmail); //dSpamScore = checkSpamWithBayes(strEmail); if(dSpamScore > 0.7)
{
System.out.println("------------------------
--");
System.out.println("SPAM DETECTED:");
System.out.println("--------------------------");
System.out.println(strEmail);
System.out.println("--------------------------");
}}}
catch (Exception e)
{

e.printStackTrace();
}
finally
{
try
{
if (folder!=null) folder.close(false);
if (store!=null) store.close();
}
catch (Exception e2)

{
e2.printStackTrace();
}}}
public static String buildMessage(Message message)
{

String strReturn = "";
try
{
String from=((InternetAddress)message.getFrom()[0]).getPersonal();
if (from==null) from=((InternetAddress)message.getFrom()[0]).getAddress();
strReturn += "FROM: " + from;

String subject=message.getSubject();
strReturn += "SUBJECT: "+subject;
Part messagePart=message;
Object content=messagePart.getContent();
if (content instanceof Multipart)
{
messagePart=((Multipart)content).getBodyPart(0);
strReturn += "[ Multipart Message ]";

}
String contentType=messagePart.getContentType();
strReturn += "CONTENT:"+contentType;
if (contentType.startsWith("text/plain")|| contentType.startsWith("text/html"))
{
InputStream is = messagePart.getInputStream();
BufferedReader reader=new BufferedReader(n
ew InputStreamReader(is));
String thisLine=reader.readLine();
while (thisLine!=null)
{
strReturn +=thisLine;
thisLine=reader.readLine();
}}
}
catch (Exception ex)
{
ex.printStackTrace();
}
return strReturn;
}

public static double checkSpam(String strEmailBody)
{
double dClassification = 0.0;
try
{
SimpleClassifier classifier = new SimpleClassifier();
classifier.setSearchWord( "belgium" );
dClassification = classifier.classify(strEmailBod
y);
}
catch(Exception e)
{

e.printStackTrace();
}
return dClassification;
}
public static double checkSpamWithBayes(String strEmailBody)
{
double dReturn = 0.0;
try

{
IWordsDataSource wds = new SimpleWordsDataSource();
wds.addMatch("Belgium");
wds.addMatch("Vogon");
wds.addMatch("Devx");
IClassifier classifier = new BayesianClassifier(
wds);
dReturn = classifier.classify(strEmailBody);
}
catch(Exception e)
{
e.printStackTrace();
}

return dReturn;
}
public static String getSummary(String strEmailBody, int nSentences)
{
ISummariser summ = new SimpleSummariser();
String strSumm = summ.summarise(strEmailBody,nSentences);
return strSumm;
}
}

and here is what happens when i run it:





annoying to say the least!

Another issue i can't fathom to work around is jdeveloper does not work on my vista laptop! Upon which flash is installed and any hope of me combining the two parts of the organism. :(


Monday, 3 November 2008

Organism project update

I have scanned in my workbook to show the processes worked upon in the last few weeks. These include sketches of the process tree i expect from my organism.

I am working on applying these processes with java code. This way i can have a working format and work on the GUI later.




So these pages from my sketchbook show the thought processes behind the program's functionality... and that i think Jeff Han is a ninja....


Thursday, 9 October 2008

IDAT 204 ORGANISM Project

A new year, a new project and now the heat is on.

This module is interactive and intuitive programming. Workshop 2.
THE BRIEF:
Part 1 - Organism 25% Delivered by Dan Livingstone
organism n. 1. any living animal or plant including any bacterium or virus. Jean Baudrillard, Simulations2. anything resembling a living creature in structure, behavior, etc ----, organ’ismal or,organ’ismic adj. organ’ismally adv.
‘The artificial purification of all milieus, atmospheres, and environments will supplant the failing internal immune systems. If these systems are breaking down it is because an irreversible tendency called progress pushes the human body and spirit into relinquishing its systems of defense and self-determination, only to replace them with technical artifacts. Divested of his defenses, man becomes eminently vulnerable to science. Divested of his phantasies, he becomes eminently vulnerable to psychology. Freed of his germs, he becomes eminently vulnerable to medicine.
It would not be too far-fetched to say that the extermination of mankind begins with the extermination of germs.’ [ Jean Baudrillard ]
‘Artificial Intelligence: the art of making computers that behave like the ones in movies.’ [Bill Bulko]
Working in pairs generate "a living creature in structure, behavior, etc...". The final organism should be a form of interactive media, able to work on any platform from mobile, desktop, internet, ipod etc. The intention is to make the organisms accessible/downloadable on a live web siteThe rational behind this exercise?:
A: to generate a problem which is not technology driven, i.e. the idea drives the project. You should not start working on the computer until the ‘life form’ spec is generated. You will then have to find ways of realising it with appropriate software or platforms.
B: to force you to consider a truly timebased, multidimensional, interactive problem. In principle a life form needs to feed or to be fed, sleep, move, multiply, expel waste etc. It will be sensitive to certain conditions and have a life expectancy. Do not use buttons, instead concentrate on a process of interactions and behaviours. In defining a life form do not fall into the obvious trap of using cartoon characters, question existing models, redefine and innovate! What is digital life? What is OOPs?
Keywords: Artificial Life, Cellular Automata, Organism, Entity, Lifeform, Virus…

My first thought about this project was to combine it with the work I was attempting in SOFT 221.
(We are producing an instance of "Langstone's Ant") The ant would be used to edit images in an attractive, but possibly time consuming way. I decided this was quite a weak idea and went on with my generation of ideas.

My next idea was the Spam Demon. A little chappy that removes un-wanted emails from your system and sends back a reply:

"Your email has been eaten by the spam demon. Please do not send any more junk mail to this address.
If this is a mistake please reply with the keyword BANISH to ensure your email will be received."

The demon would be an animated figure on the desktop that notifies the user when spam has been eaten with a sound / visual animation allowing 24 hours before finally digesting them (deleting them) .

When the demon notifies the user it would provide functionality to reply to the "perpetrator" in an attempt to stop them from mailing the user.





After discussing this with Dan, he told me that most spam mail is sent from temporary email addresses that go dead soon after they send out the mail. So the Spam Demon idea took a turn towards deleting the spam mail, but also investigating further into the company / person that sent the email in an attempt to find a live email address that would receive the reply and act on it. For instance the director of a company is emailed instead of the dead email their company used to boradcast their spam.

And thus the demon dissolved to be replaced by Email Police and then a name came out of the Brainstom...

The Spam P.I. was born!


A Private investigator that will sift through the information provided (spam email addresses) and use it's detective's knowledge to search websites for similar addresses.


Products with similar functionality do exist, but in this project the P.I. will need to be kept busy in his hunt for "The Kingpin"


Some examples are Casper Spam Hunter: http://www.filetransit.com/screenshot.php?id=12218


And the search program would be based around something like Atomic Email Hunter: http://www.massmailsoftware.com/extractweb/screenshots.htm




Now then lets get cracking!