From 8cbbe512d78787cc5ff6fcab8175159fa058be7d Mon Sep 17 00:00:00 2001 From: madchemist10 <2012kemp1234@gmail.com> Date: Mon, 28 Mar 2016 14:13:15 -0500 Subject: [PATCH 01/35] cart.java for review --- individual-files/Cart.java | 52 -------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 individual-files/Cart.java diff --git a/individual-files/Cart.java b/individual-files/Cart.java deleted file mode 100644 index 86f4cba..0000000 --- a/individual-files/Cart.java +++ /dev/null @@ -1,52 +0,0 @@ -package sessions; - -import javax.servlet.http.*; -import java.util.Vector; -import java.util.Enumeration; - -public class Cart { - Vector v = new Vector(); - String submit = null; - String item = null; - - private void addItem(String name) { - v.addElement(name); - } - - private void removeItem(String name) { - v.removeElement(name); - } - - public void setItem(String name) { - item = name; - } - - public void setSubmit(String s) { - submit = s; - } - - public String[] getItems() { - String[] s = new String[ v.size()]; - v.copyInto(s); - return s; - } - - public void processRequest(HttpServletRequest request) { - if (submit == null) - addItem(item); - - if (submit.equals("add")) - addItem(item); - else if (submit.equals("remove")) - removeItem(item); - - // reset at the end of the request - reset(); - } - - // reset - private void reset() { - submit = null; - item = null; - } -} From e6fbfc9c77881be7f3334cdec2313af35e438ab2 Mon Sep 17 00:00:00 2001 From: madchemist10 <2012kemp1234@gmail.com> Date: Mon, 28 Mar 2016 14:35:03 -0500 Subject: [PATCH 02/35] ControlFlow.java for review --- individual-files/ControlFlow.java | 45 ------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 individual-files/ControlFlow.java diff --git a/individual-files/ControlFlow.java b/individual-files/ControlFlow.java deleted file mode 100644 index 15fcc99..0000000 --- a/individual-files/ControlFlow.java +++ /dev/null @@ -1,45 +0,0 @@ -import java.io.IOException; -import java.util.logging.Logger; - -public class ControlFlow -{ - public ControlFlow() - { - byte inputBuffer[] = new byte[ 128 ]; - try - { - // Read data from the standard input - int byteCount = System.in.read( inputBuffer ); - - // Check whether data has been read or not - if( byteCount <= 0 ) - { - return; - } - - int i = 1; - switch ( i ) - { - case 1: - // Turn data into a String - tring s = new String( inputBuffer ); - s = s.substring( 0, byteCount-2 - - if( ( s.equals( "admin" ) ) == true ) - { - authorize( s ); - } - default: - break; - } - } - catch ( IOException e ) - { - final Logger logger = Logger.getAnonymousLogger(); - String exception = "Exception " + e; - logger.warning( exception ); - } - } - - - } From 9c757eb40c4731980c3cd0622c5ee8ee690de2b0 Mon Sep 17 00:00:00 2001 From: Austin Gerald Date: Tue, 29 Mar 2016 16:45:15 -0500 Subject: [PATCH 03/35] Delete DBExtract.java --- metricsanalyzer/DBExtract.java | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100755 metricsanalyzer/DBExtract.java diff --git a/metricsanalyzer/DBExtract.java b/metricsanalyzer/DBExtract.java deleted file mode 100755 index 3ca5e6f..0000000 --- a/metricsanalyzer/DBExtract.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * DBExtract.java - * - */ - -package metricsanalyzer; - -import java.io.*; -import java.sql.*; -/** - * - * @author Byron - */ -public class DBExtract { - - /** Creates a new instance of DBExtract */ - public DBExtract() { - MetricsDB db = new MetricsDB(); - Connection con = db.getConnection(); - String systemMetrics = "SELECT * FROM systemmetrics"; - String packageMetrics = "SELECT * FROM packagemetrics"; - String issues = "SELECT * FROM issues"; - String metrics= "SELECT * FROM metrics"; - String repository= "SELECT * FROM repository"; - String revisionData= "SELECT * FROM revisiondata"; - - try { - Statement stmt = con.createStatement(); - stmt.executeQuery(repository); - stmt.close(); - } catch (java.sql.SQLException sqe) { - System.out.println("error adding metrics values: "+ sqe); - } - db.closeConnection(); - } - -} From b564cf9e5b4a915fd93c1a52f757b87786ed3f19 Mon Sep 17 00:00:00 2001 From: srikar76 Date: Tue, 29 Mar 2016 16:54:10 -0500 Subject: [PATCH 04/35] Delete command.py --- individual-files/command.py | 159 ------------------------------------ 1 file changed, 159 deletions(-) delete mode 100755 individual-files/command.py diff --git a/individual-files/command.py b/individual-files/command.py deleted file mode 100755 index 2894408..0000000 --- a/individual-files/command.py +++ /dev/null @@ -1,159 +0,0 @@ -import abc -import os - - -class Command(object): - """The command interface.""" - - __metaclass__ = abc.ABCMeta - - @abc.abstractmethod - def execute(self): - """Method to execute the command.""" - pass - - @abc.abstractmethod - def undo(self): - """A method to undo the command.""" - pass - - -class LsCommand(Command): - """Concrete command that emulates ls unix command behavior.""" - - def __init__(self, receiver): - self.receiver = receiver - - def execute(self): - """The command delegates the call to its receiver.""" - self.receiver.show_current_dir() - - def undo(self): - """Can not undo ls command.""" - pass - - -class LsReceiver(object): - def show_current_dir(self): - """The receiver knows how to execute the command.""" - - cur_dir = './' - - filenames = [] - for filename in os.listdir(cur_dir): - if os.path.isfile(os.path.join(cur_dir, filename)): - filenames.append(filename) - - print 'Content of dir: ', ' '.join(filenames) - - -class TouchCommand(Command): - """Concrete command that emulates touch unix command behavior.""" - - def __init__(self, receiver): - self.receiver = receiver - - def execute(self): - self.receiver.create_file() - - def undo(self): - self.receiver.delete_file() - - -class TouchReceiver(object): - def __init__(self, filename): - self.filename = filename - - def create_file(self): - """Actual implementation of unix touch command.""" - with file(self.filename, 'a'): - os.utime(self.filename, None) - - def delete_file(self): - """Undo unix touch command. Here we simply delete the file.""" - os.remove(self.filename) - - -class RmCommand(Command): - """Concrete command that emulates rm unix command behavior.""" - - def __init__(self, receiver): - self.receiver = receiver - - def execute(self): - self.receiver.delete_file() - - def undo(self): - self.receiver.undo() - - -class RmReceiver(object): - def __init__(self, filename): - self.filename = filename - self.backup_name = None - - def delete_file(self): - """Deletes file with creating backup to restore it in undo method.""" - self.backup_name = '.' + self.filename - os.rename(self.filename, self.backup_name) - - def undo(self): - """Restores the deleted file.""" - original_name = self.backup_name[1:] - os.rename(self.backup_name, original_name) - self.backup_name = None - - -class Invoker(object): - def __init__(self, create_file_commands, delete_file_commands): - self.create_file_commands = create_file_commands - self.delete_file_commands = delete_file_commands - - def create_file(self): - print 'Creating file...' - - for command in self.create_file_commands: - command.execute() - self.history.append(command) - - print 'File created.\n' - - def delete_file(self): - print 'Deleting file...' - for command in self.delete_file_commands: - command.execute() - self.history.append(command) - print 'File deleted.\n' - - def undo_all(self): - print 'Undo all...' - - for command in reversed(self.history): - command.undo() - - print 'Undo all finished.' - - -if __name__ == '__main__': - # Client - - # List files in current directory - ls_receiver = LsReceiver() - ls_command = LsCommand(ls_receiver) - - # Create a file - touch_receiver = TouchReceiver('test_file') - touch_command = TouchCommand(touch_receiver) - - # Delete created file - rm_receiver = RmReceiver('test_file') - rm_command = Rm - Command(rm_receiver) - - create_file_commands = [ls_command, touch_command, ls_command] - delete_file_commands = [ls_command, rm_command, ls_command] - - invoker = Invoker(create_file_commands, delete_file_commands) - - invoker.make_file() - invoker.delete_file() - invoker.undo_all() From 13f48043ab3cd9e022d52d1aec3b120ab39be2f6 Mon Sep 17 00:00:00 2001 From: srikar76 Date: Tue, 29 Mar 2016 17:03:41 -0500 Subject: [PATCH 05/35] Added files via upload --- individual-files/command.py | 159 ++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 individual-files/command.py diff --git a/individual-files/command.py b/individual-files/command.py new file mode 100644 index 0000000..2894408 --- /dev/null +++ b/individual-files/command.py @@ -0,0 +1,159 @@ +import abc +import os + + +class Command(object): + """The command interface.""" + + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def execute(self): + """Method to execute the command.""" + pass + + @abc.abstractmethod + def undo(self): + """A method to undo the command.""" + pass + + +class LsCommand(Command): + """Concrete command that emulates ls unix command behavior.""" + + def __init__(self, receiver): + self.receiver = receiver + + def execute(self): + """The command delegates the call to its receiver.""" + self.receiver.show_current_dir() + + def undo(self): + """Can not undo ls command.""" + pass + + +class LsReceiver(object): + def show_current_dir(self): + """The receiver knows how to execute the command.""" + + cur_dir = './' + + filenames = [] + for filename in os.listdir(cur_dir): + if os.path.isfile(os.path.join(cur_dir, filename)): + filenames.append(filename) + + print 'Content of dir: ', ' '.join(filenames) + + +class TouchCommand(Command): + """Concrete command that emulates touch unix command behavior.""" + + def __init__(self, receiver): + self.receiver = receiver + + def execute(self): + self.receiver.create_file() + + def undo(self): + self.receiver.delete_file() + + +class TouchReceiver(object): + def __init__(self, filename): + self.filename = filename + + def create_file(self): + """Actual implementation of unix touch command.""" + with file(self.filename, 'a'): + os.utime(self.filename, None) + + def delete_file(self): + """Undo unix touch command. Here we simply delete the file.""" + os.remove(self.filename) + + +class RmCommand(Command): + """Concrete command that emulates rm unix command behavior.""" + + def __init__(self, receiver): + self.receiver = receiver + + def execute(self): + self.receiver.delete_file() + + def undo(self): + self.receiver.undo() + + +class RmReceiver(object): + def __init__(self, filename): + self.filename = filename + self.backup_name = None + + def delete_file(self): + """Deletes file with creating backup to restore it in undo method.""" + self.backup_name = '.' + self.filename + os.rename(self.filename, self.backup_name) + + def undo(self): + """Restores the deleted file.""" + original_name = self.backup_name[1:] + os.rename(self.backup_name, original_name) + self.backup_name = None + + +class Invoker(object): + def __init__(self, create_file_commands, delete_file_commands): + self.create_file_commands = create_file_commands + self.delete_file_commands = delete_file_commands + + def create_file(self): + print 'Creating file...' + + for command in self.create_file_commands: + command.execute() + self.history.append(command) + + print 'File created.\n' + + def delete_file(self): + print 'Deleting file...' + for command in self.delete_file_commands: + command.execute() + self.history.append(command) + print 'File deleted.\n' + + def undo_all(self): + print 'Undo all...' + + for command in reversed(self.history): + command.undo() + + print 'Undo all finished.' + + +if __name__ == '__main__': + # Client + + # List files in current directory + ls_receiver = LsReceiver() + ls_command = LsCommand(ls_receiver) + + # Create a file + touch_receiver = TouchReceiver('test_file') + touch_command = TouchCommand(touch_receiver) + + # Delete created file + rm_receiver = RmReceiver('test_file') + rm_command = Rm - Command(rm_receiver) + + create_file_commands = [ls_command, touch_command, ls_command] + delete_file_commands = [ls_command, rm_command, ls_command] + + invoker = Invoker(create_file_commands, delete_file_commands) + + invoker.make_file() + invoker.delete_file() + invoker.undo_all() From b890e71b38657e7d3a554281c76d5c752cae6695 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 10:04:38 -0500 Subject: [PATCH 06/35] Update ProcessCommmand.cs Overwriting what was done earlier, in error. --- individual-files/ProcessCommmand.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/individual-files/ProcessCommmand.cs b/individual-files/ProcessCommmand.cs index 64da785..cf57b51 100644 --- a/individual-files/ProcessCommmand.cs +++ b/individual-files/ProcessCommmand.cs @@ -22,5 +22,4 @@ class ProcessCommand {         ProcessCommand PC = new ProcessCommand();     }      -    Console.WritLine("Patch 1"); } From 37b151a21655ca3d9a5526f1b1ff9886f6e19ae9 Mon Sep 17 00:00:00 2001 From: jstewart1172 Date: Wed, 30 Mar 2016 10:07:58 -0500 Subject: [PATCH 07/35] Delete ProcessCommmand.cs --- individual-files/ProcessCommmand.cs | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 individual-files/ProcessCommmand.cs diff --git a/individual-files/ProcessCommmand.cs b/individual-files/ProcessCommmand.cs deleted file mode 100644 index cf57b51..0000000 --- a/individual-files/ProcessCommmand.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -   -class ProcessCommand { -    public ProcessCommand(){ -        Console.WriteLine("Enter OS command: "); -        string userCommand = Console.ReadLine(); -        Console.WriteLine(userCommand); -        if (userCommand.Length != 0) -            try -            { -                Process.Start(userCommand); -            } -            catch (System.ComponentModel.Win32Exception) -            { -                Console.WriteLine("Error opening file"); -            } -    } -    static void Main(string[] args){ -        ProcessCommand PC = new ProcessCommand(); -    } -     -} From cd1ad741f56abc2e1c8de1f608f17ab53792ab75 Mon Sep 17 00:00:00 2001 From: jstewart1172 Date: Wed, 30 Mar 2016 10:09:10 -0500 Subject: [PATCH 08/35] Delete ChatClient.java --- chatt-app/ChatClient.java | 155 -------------------------------------- 1 file changed, 155 deletions(-) delete mode 100755 chatt-app/ChatClient.java diff --git a/chatt-app/ChatClient.java b/chatt-app/ChatClient.java deleted file mode 100755 index e6514e1..0000000 --- a/chatt-app/ChatClient.java +++ /dev/null @@ -1,155 +0,0 @@ -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.*; -import java.net.*; - -import javax.swing.*; - - -public class ChatClient extends JFrame implements Runnable { - - Socket socket; - JTextArea ta; - JButton send, logout; - JTextField tf; - - Thread thread; - - DataInputStream din; - DataOutputStream dout; - - String LoginName; - - ChatClient(String login) throws UnknownHostException, IOException{ - super(login); - LoginName = login; - - addWindowListener(new WindowAdapter(){ - public void windowClosing(WindowEvent e){ - try { - dout.writeUTF(LoginName + " " + "LOGOUT"); - System.exit(1); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - }); - - ta = new JTextArea(18, 50); - tf = new JTextField(50); - - tf.addKeyListener(new KeyListener(){ - - @Override - public void keyTyped(KeyEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void keyPressed(KeyEvent e) { - // TODO Auto-generated method stub - if(e.getKeyCode() == KeyEvent.VK_ENTER){ - try { - if(tf.getText().length()>0) - dout.writeUTF(LoginName + " " + "DATA " + tf.getText().toString()); - tf.setText(""); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - // TODO Auto-generated method stub - - } - - }); - - send = new JButton("Send"); - logout = new JButton("Logout"); - - send.addActionListener(new ActionListener(){ - - @Override - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - try { - if(tf.getText().length()>0) - dout.writeUTF(LoginName + " " + "DATA " + tf.getText().toString()); - tf.setText(""); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - - }); - - logout.addActionListener(new ActionListener(){ - - @Override - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - try { - dout.writeUTF(LoginName + " " + "LOGOUT"); - System.exit(1); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - - }); - - socket = new Socket("localhost", 5217); - - din = new DataInputStream(socket.getInputStream()); - dout = new DataOutputStream(socket.getOutputStream()); - - dout.writeUTF(LoginName); - dout.writeUTF(LoginName + " " + "LOGIN"); - - thread = new Thread(this); - thread.start(); - setup(); - } - - private void setup() { - // TODO Auto-generated method stub - setSize(600, 400); - - JPanel panel = new JPanel(); - - panel.add(new JScrollPane(ta)); - panel.add(tf); - panel.add(send); - panel.add(logout); - add(panel); - - setVisible(true); - } - - @Override - public void run() { - // TODO Auto-generated method stub - while(true){ - try { - ta.append("\n" + din.readUTF()); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - -} From e203fad5d0c7a228d1401a3b6400f988c43093a7 Mon Sep 17 00:00:00 2001 From: jstewart1172 Date: Wed, 30 Mar 2016 10:09:33 -0500 Subject: [PATCH 09/35] Delete ChatServer.java --- chatt-app/ChatServer.java | 93 --------------------------------------- 1 file changed, 93 deletions(-) delete mode 100755 chatt-app/ChatServer.java diff --git a/chatt-app/ChatServer.java b/chatt-app/ChatServer.java deleted file mode 100755 index 75613bc..0000000 --- a/chatt-app/ChatServer.java +++ /dev/null @@ -1,93 +0,0 @@ -import java.io.*; -import java.net.*; -import java.util.StringTokenizer; -import java.util.Vector; - - -public class ChatServer { - static Vector ClientSockets; - static Vector LoginNames; - - ChatServer() throws IOException{ - ServerSocket server = new ServerSocket(5217); - ClientSockets = new Vector(); - LoginNames = new Vector(); - - while(true){ - Socket client = server.accept(); - AcceptClient acceptClient = new AcceptClient(client); - } - } - - public static void main(String[] args) throws IOException{ - ChatServer server = new ChatServer(); - } - - class AcceptClient extends Thread{ - Socket ClientSocket; - DataInputStream din; - DataOutputStream dout; - AcceptClient(Socket client) throws IOException{ - ClientSocket = client; - din = new DataInputStream(ClientSocket.getInputStream()); - dout = new DataOutputStream(ClientSocket.getOutputStream()); - - String LoginName = din.readUTF(); - - LoginNames.add(LoginName); - ClientSockets.add(ClientSocket); - - start(); - } - - public void run(){ - while(true){ - try { - String msgFromClient = din.readUTF(); - StringTokenizer st = new StringTokenizer(msgFromClient); - String LoginName = st.nextToken(); - String MsgType = st.nextToken(); - int lo = -1; - String msg = ""; - - while(st.hasMoreTokens()){ - msg=msg+ " " + st.nextToken(); - } - if(MsgType.equals("LOGIN")){ - for(int i = 0; i= 0){ - LoginNames.removeElementAt(lo); - ClientSockets.removeElementAt(lo); - } - } - else { - for(int i = 0; i Date: Wed, 30 Mar 2016 10:10:23 -0500 Subject: [PATCH 10/35] Delete Login.java --- chatt-app/Login.java | 81 -------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100755 chatt-app/Login.java diff --git a/chatt-app/Login.java b/chatt-app/Login.java deleted file mode 100755 index b126633..0000000 --- a/chatt-app/Login.java +++ /dev/null @@ -1,81 +0,0 @@ -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.io.IOException; -import java.net.UnknownHostException; - -import javax.swing.*; - - -public class Login { - public static void main(String[] args){ - final JFrame login = new JFrame("Login"); - JPanel panel = new JPanel(); - final JTextField loginName = new JTextField(20); - JButton enter = new JButton("Login"); - - panel.add(loginName); - panel.add(enter); - login.setSize(300, 100); - login.add(panel); - login.setVisible(true); - login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - enter.addActionListener(new ActionListener(){ - - @Override - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - try { - ChatClient client = new ChatClient(loginName.getText()); - login.setVisible(true); - login.dispose(); - } catch (UnknownHostException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - - }); - - loginName.addKeyListener(new KeyListener(){ - - @Override - public void keyTyped(KeyEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void keyPressed(KeyEvent e) { - // TODO Auto-generated method stub - if(e.getKeyCode() == KeyEvent.VK_ENTER){ - try { - ChatClient client = new ChatClient(loginName.getText()); - login.setVisible(false); - login.dispose(); - } catch (UnknownHostException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - } - } - - @Override - public void keyReleased(KeyEvent e) { - // TODO Auto-generated method stub - - } - - }); - - } -} From 717c146d98d31089ef7ad9b4cef487a062aca7a7 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 10:31:20 -0500 Subject: [PATCH 11/35] Delete ChangePronenessManager.java --- .../ChangePronenessManager.java | 154 ------------------ 1 file changed, 154 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/changeproneness/ChangePronenessManager.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/changeproneness/ChangePronenessManager.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/changeproneness/ChangePronenessManager.java deleted file mode 100644 index 6101265..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/changeproneness/ChangePronenessManager.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.msstate.cse.changecalculator.changeproneness; - - -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.msstate.cse.changecalculator.database.DbUtil; -import org.msstate.cse.changecalculator.diff.DiffParser; -import org.msstate.cse.changecalculator.hibernate.HibernateUtil; -import org.msstate.cse.changecalculator.hibernate.model.SvnHistroy; -import org.msstate.cse.changecalculator.properties.Properties; -import org.msstate.cse.changecalculator.svn.SvnUtil; -import org.msstate.cse.changecalculator.utility.Util; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNLogEntry; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -public class ChangePronenessManager { - private String svnUrl = ""; - private long startRevNum = -1; - private long endRevNum = -1; - - public ChangePronenessManager(Properties prop) { - if(null==prop){ - System.err.println("Properties file is null"); - } - this.svnUrl = prop.getSvn_url(); - this.startRevNum = prop.getStartRevNum(); - this.endRevNum = prop.getEndRevNum(); - } - - public void calculateChangeProneness() { - if (Util.isNullOrEmpty(svnUrl)) { - System.err.println("Invalid SVN URL."); - return; - } - if (startRevNum < 0) { - System.err.println("Invalid start revision nubmer "); - return; - } -// if (endRevNum < 0) { -// System.err.println("Invalid end revision nubmer "); -// return; -// } - - Collection logEntries = null; - try { - SVNRepository repository = getSvnRepository(); - // end revision number - endRevNum = repository.getLatestRevision(); - logEntries = repository.log(new String[] { "" }, null, startRevNum, endRevNum, true, true); - } catch (SVNException e) { - System.err.println(e.getMessage()); - e.printStackTrace(); - - } - - // ignore first revision - boolean isFirstRevision = true; - - //iterate over each log entries - for (Iterator entries = logEntries.iterator(); entries.hasNext();) { - try { - SVNLogEntry logEntry = (SVNLogEntry) entries.next(); - long revNum = logEntry.getRevision(); - - System.out.println("Currently Looking at revision # " +revNum); - - // ignore first revision - if (isFirstRevision) { - isFirstRevision = false; - continue; - } - - // get diff content - String diffString = SvnUtil.getDiffContent(svnUrl, revNum); - if (Util.isNullOrEmpty(diffString)) { - continue; - } - // get changed classes - List changedClassList = DiffParser.getChangedFiles(diffString); - if (null == changedClassList || changedClassList.isEmpty()) { - continue; - } - // iterate changedClassList - Iterator iter = changedClassList.iterator(); - while (iter.hasNext()) { - String classPath = iter.next(); - if (Util.isNullOrEmpty(classPath)) { - continue; - } - - if (classPath.contains(".java")) { - saveIntoDB(classPath, logEntry); - } - } - - } catch (Exception e) { - System.err.println(e.getMessage()); - e.printStackTrace(); - continue; - } - } - - } - - private void saveIntoDB(String filePath, SVNLogEntry logEntry){ - //create SvnHistory model - SvnHistroy svnHistory = new SvnHistroy(); - svnHistory.setClassPath(formatFilePath(filePath)); - svnHistory.setRevNum(logEntry.getRevision()); - svnHistory.setDate_milisecond(convertIntoMiliSecond(logEntry.getDate())); - DbUtil.saveIntoDB(svnHistory); - } - - private long convertIntoMiliSecond(Date date){ - if(null == date){ - System.err.println("Invalid Date"); - return -1 ; - } - return date.getTime(); - - } - - private String formatFilePath(String filePath) { - if (Util.isNullOrEmpty(filePath)) { - System.err.println("Invlalid filepath"); - return null; - } - int beginIndex = filePath.indexOf("org/apache/"); - String formattedString = filePath.substring(beginIndex); - return formattedString; - } - - private SVNRepository getSvnRepository() { - SVNRepository repository = null; - String name = "anonymous"; - String password = "anonymous"; - try { - repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(svnUrl)); - ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); - repository.setAuthenticationManager(authManager); - } catch (SVNException e) { - e.printStackTrace(); - } - return repository; - } -} From b632f03342d01a0663a43aec54cd5ea5d719bbc6 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 11:41:21 -0500 Subject: [PATCH 12/35] Delete DBConnection.java --- .../database/DBConnection.java | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DBConnection.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DBConnection.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DBConnection.java deleted file mode 100644 index 20858f4..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DBConnection.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.msstate.cse.changecalculator.database; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; - -public class DBConnection { - private static Connection connection = null; - - public static Connection createDatabaseConnection(String dbURL, String userName, String password){ - try { - Class.forName("com.mysql.jdbc.Driver"); - connection = DriverManager.getConnection(dbURL, userName, password); - } catch (SQLException e) { - System.err.println(e.getMessage()); - e.printStackTrace(); - System.exit(1); - } catch (ClassNotFoundException e) { - System.err.println("Error creating database connection. com.mysql.jdbc.Driver was not found"); - e.printStackTrace(); - } - return connection; - } - - public static Connection getConnection() { - return connection; - } - - - -} From 0a07d4e4ce35ea67be489341697109549df6cdec Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 11:43:50 -0500 Subject: [PATCH 13/35] Delete DbUtil.java --- .../cse/changecalculator/database/DbUtil.java | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DbUtil.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DbUtil.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DbUtil.java deleted file mode 100644 index dd16a5e..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/database/DbUtil.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.msstate.cse.changecalculator.database; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.msstate.cse.changecalculator.hibernate.HibernateUtil; -import org.msstate.cse.changecalculator.hibernate.model.SvnHistroy; -import org.msstate.cse.changecalculator.utility.Util; - -public class DbUtil { - private static PreparedStatement ps = null; - private static String tableName = null; - - - - public static void setTableName(String tableName) { - DbUtil.tableName = tableName; - } - - public static Connection getDBConnection(){ - DBConnection dbCon = new DBConnection(); - return dbCon.getConnection(); - } - - public static void saveIntoDB(Object obj){ - SvnHistroy svnHis = (SvnHistroy) obj; - /*//session - Session session = HibernateUtil.getSession(); - - //creating transaction object - Transaction t=session.beginTransaction(); - session.save(svnHis); -// session.persist(svnHis);//persisting the object - t.commit();//transaction is commited - //close session - session.close(); */ - - if(Util.isNullOrEmpty(tableName)){ - System.err.println("Please provide valid table name. Table name is empty."); - return; - } - - try { - Connection con = getDBConnection(); - ps = con.prepareStatement("SELECT * FROM " - + tableName - + " WHERE rev_num = ? AND class_path = ?"); - ps.setLong(1, svnHis.getRevNum()); - ps.setString(2, svnHis.getClassPath()); - ResultSet rs = ps.executeQuery(); - if (!rs.next()) { - // Issue not yet in DB. Add to DB. - ps = con.prepareStatement("INSERT INTO " - + tableName - + " (rev_num, class_path, date_time_ms) " - + "VALUES (?, ?, ?)"); - ps.setLong(1, svnHis.getRevNum()); - ps.setString(2, svnHis.getClassPath()); - ps.setLong(3, svnHis.getDate_milisecond()); - ps.executeUpdate(); - } - - } catch (SQLException e) { - System.err.println("Error inserting value"); - e.printStackTrace(); - - } - - } - -} From 5bf2b4254c09e366f6b3f77272b10bd615e44c47 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 11:51:40 -0500 Subject: [PATCH 14/35] Delete DiffParser.java --- .../cse/changecalculator/diff/DiffParser.java | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/diff/DiffParser.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/diff/DiffParser.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/diff/DiffParser.java deleted file mode 100644 index 77902ff..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/diff/DiffParser.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.msstate.cse.changecalculator.diff; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; - -public class DiffParser { - - public static List getChangedFiles(String diffContent) { //AJAY-NOTE: Change return from list set - if (diffContent != null && !diffContent.isEmpty()) { - List changedFileList = new ArrayList(); - InputStream in = new ByteArrayInputStream(diffContent.getBytes()); - Reader unbufferedReader = new InputStreamReader(in); - BufferedReader reader = new BufferedReader(unbufferedReader); - String currentLine; - try { - while ((currentLine = reader.readLine()) != null) { - if (currentLine.startsWith("Index:")) { - String[] splitStr = currentLine.split("Index:"); - if (splitStr.length == 2 && splitStr[1] != null - && !splitStr[1].isEmpty()) { - changedFileList.add(splitStr[1].trim()); - } - } - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (reader != null) - reader.close(); - if (unbufferedReader != null) - unbufferedReader.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - return changedFileList; - } - return null; - } - -} From 9312817501ef5449b3b5dc81e18cfe150b3bc06c Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 14:22:59 -0500 Subject: [PATCH 15/35] Delete SvnHistroy.java --- .../hibernate/model/SvnHistroy.java | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/model/SvnHistroy.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/model/SvnHistroy.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/model/SvnHistroy.java deleted file mode 100644 index 08d0390..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/model/SvnHistroy.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.msstate.cse.changecalculator. hibernate.model; - -public class SvnHistroy { - private long revNum ; - private String classPath ; - private long date_milisecond ; - - - public long getRevNum() { - return revNum; - } - public void setRevNum(long revNum) { - this.revNum = revNum; - } - public String getClassPath() { - return classPath; - } - public void setClassPath(String classPath) { - this.classPath = classPath; - } - public long getDate_milisecond() { - return date_milisecond; - } - public void setDate_milisecond(long date_milisecond) { - this.date_milisecond = date_milisecond; - } - - - -} From 62cd6688edc062876696fef799df8b88edc2f7e9 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 14:33:57 -0500 Subject: [PATCH 16/35] Delete HibernateUtil.java --- .../hibernate/HibernateUtil.java | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/HibernateUtil.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/HibernateUtil.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/HibernateUtil.java deleted file mode 100644 index 9db25c2..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/hibernate/HibernateUtil.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.msstate.cse.changecalculator.hibernate; - -import org.apache.log4j.BasicConfigurator; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.hibernate.cfg.Configuration; - - -public class HibernateUtil { - - private static SessionFactory factory = null; - - - private static SessionFactory getSessionFactory (){ - if(factory == null){ - try { - BasicConfigurator.configure(); - //create factory - Configuration cfg=new Configuration(); //creating configuration object - cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file - //creating seession factory object - factory=cfg.buildSessionFactory(); - } catch (Exception e) { - System.err.println("Hibernate Configuration Error"); - e.printStackTrace(); - } - return factory; - }else{ - return factory; - } - } - - public static Session getSession(){ - //factory - SessionFactory factory = getSessionFactory(); - //creating session object - Session session=factory.openSession(); - - return session; - } - -} From 1577e5ddadf8c5e2324dd4e44ab12aaa966bfabb Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 14:38:11 -0500 Subject: [PATCH 17/35] Delete JavaClass.java --- .../msstate/cse/changecalculator/javaclass/JavaClass.java | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/javaclass/JavaClass.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/javaclass/JavaClass.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/javaclass/JavaClass.java deleted file mode 100644 index 5a8a353..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/javaclass/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.msstate.cse.changecalculator.javaclass; - -public class JavaClass { - -} From 36f6c8a4830499ddae91eb454df5196fe1cca7f4 Mon Sep 17 00:00:00 2001 From: austinwgerald Date: Wed, 30 Mar 2016 16:00:16 -0500 Subject: [PATCH 18/35] Removed files --- metricsanalyzer/DBExtract.java | 37 ---------------------- metricsanalyzer/Main.java | 56 ---------------------------------- 2 files changed, 93 deletions(-) delete mode 100755 metricsanalyzer/DBExtract.java delete mode 100755 metricsanalyzer/Main.java diff --git a/metricsanalyzer/DBExtract.java b/metricsanalyzer/DBExtract.java deleted file mode 100755 index 3ca5e6f..0000000 --- a/metricsanalyzer/DBExtract.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * DBExtract.java - * - */ - -package metricsanalyzer; - -import java.io.*; -import java.sql.*; -/** - * - * @author Byron - */ -public class DBExtract { - - /** Creates a new instance of DBExtract */ - public DBExtract() { - MetricsDB db = new MetricsDB(); - Connection con = db.getConnection(); - String systemMetrics = "SELECT * FROM systemmetrics"; - String packageMetrics = "SELECT * FROM packagemetrics"; - String issues = "SELECT * FROM issues"; - String metrics= "SELECT * FROM metrics"; - String repository= "SELECT * FROM repository"; - String revisionData= "SELECT * FROM revisiondata"; - - try { - Statement stmt = con.createStatement(); - stmt.executeQuery(repository); - stmt.close(); - } catch (java.sql.SQLException sqe) { - System.out.println("error adding metrics values: "+ sqe); - } - db.closeConnection(); - } - -} diff --git a/metricsanalyzer/Main.java b/metricsanalyzer/Main.java deleted file mode 100755 index 5460af9..0000000 --- a/metricsanalyzer/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Main.java - */ - -package metricsanalyzer; -import java.io.*; -import java.util.Vector; -/** - * - * @author Byron - */ -public class Main { - - /** Creates a new instance of Main */ - public Main() { - - } - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - // TODO code application logic here - - String revisionNum; - //String[] revisions = {"599254", "599285"} ; - //String[] revisions = {"533549", "543076", "552009", "560024", "570247", "580646", "595448"} ; - String xmlDir = "C:\\Documents and Settings\\Byron\\My Documents\\ESE Research\\Science of Design\\Metrics\\Lucene\\XML\\"; - - File dir = new File(xmlDir); - Vector revisions = new Vector(); - String[] children = dir.list(); - if (children = null) { - // Either dir does not exist or is not a directory - } else { - for (int i=0; i Date: Wed, 30 Mar 2016 16:48:24 -0500 Subject: [PATCH 19/35] Delete TeePrintStream.java --- .../changecalculator/log/TeePrintStream.java | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/log/TeePrintStream.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/log/TeePrintStream.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/log/TeePrintStream.java deleted file mode 100644 index cb9417c..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/log/TeePrintStream.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.msstate.cse.changecalculator.log; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; - -public class TeePrintStream extends PrintStream { - private final PrintStream second; - - public TeePrintStream(OutputStream main, PrintStream second) { - super(main); - this.second = second; - } - - /** - * Closes the main stream. - * The second stream is just flushed but not closed. - * @see java.io.PrintStream#close() - */ - @Override - public void close() { - // just for documentation - super.close(); - } - - @Override - public void flush() { - super.flush(); - second.flush(); - } - - @Override - public void write(byte[] buf, int off, int len) { - super.write(buf, off, len); - second.write(buf, off, len); - } - - @Override - public void write(int b) { - super.write(b); - second.write(b); - } - - @Override - public void write(byte[] b) throws IOException { - super.write(b); - second.write(b); - } -} From a72d211d3f50d0ffe8862c262cceecdcc622f1a1 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 16:51:36 -0500 Subject: [PATCH 20/35] Delete Main.java --- .../cse/changecalculator/main/Main.java | 111 ------------------ 1 file changed, 111 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/main/Main.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/main/Main.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/main/Main.java deleted file mode 100644 index 55d21fe..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/main/Main.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.msstate.cse.changecalculator.main; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Calendar; -import java.util.Date; -import java.util.ResourceBundle; -import java.util.Scanner; - -import org.msstate.cse.changecalculator.changeproneness.ChangePronenessManager; -import org.msstate.cse.changecalculator.database.DBConnection; -import org.msstate.cse.changecalculator.database.DbUtil; -import org.msstate.cse.changecalculator.log.TeePrintStream; -import org.msstate.cse.changecalculator.properties.Properties; -import org.msstate.cse.changecalculator.utility.Util; - -public class Main { - - public static void main(String[] args) { - Main mainClass = new Main(); - try{ - // Introduction - System.out.println("Welcome to the Change Calculator!\n\n"); - // Request properties file - Properties prop = mainClass.getProperties(); - //console log output to file - mainClass.consoleOutputToFile(prop); - //log start time - mainClass.logStartTime(); - //initialization - mainClass.initialization(prop); - - //get change proneness - ChangePronenessManager CPManager = new ChangePronenessManager(prop); - CPManager.calculateChangeProneness(); - - }catch (Exception e){ - System.err.println(e.getMessage()); - e.printStackTrace(); - }finally { - //closing - mainClass.close(); - mainClass.logEndTime(); - System.out.println("Program Ended"); - } - } - - private Properties getProperties(){ - // Request properties file - System.out.println("What is the name of your properties file? (don't " - + "include '.properties')"); - Scanner input = new Scanner(System.in); - String propFileName = input.next(); - input.close(); - ResourceBundle propFileBundle = ResourceBundle.getBundle("config/" - + propFileName); - return new Properties(propFileBundle); - } - - private void consoleOutputToFile(Properties prop){ - try { - String logPath = prop.getLogPath(); - if(Util.isNullOrEmpty(logPath)){ - System.err.println("Log path is invalid"); - } - String fileName = new Date().getTime()+".txt"; - FileOutputStream fileOS = new FileOutputStream(logPath+"//"+fileName,true); - TeePrintStream tee = new TeePrintStream(fileOS, System.out); - System.setOut(tee); - System.out.println(fileName +" file created at "+logPath); - } catch (FileNotFoundException e) { - System.err.println("Error configuring console log file"); - e.printStackTrace(); - } - } - - private void logStartTime(){ - //printing current time - Date startTime = Calendar.getInstance().getTime(); - System.out.println("\nStart Time: "+ startTime+"\n"); - } - - private void logEndTime(){ - //printing current time - Date endTime = Calendar.getInstance().getTime(); - System.out.println("\nEnd Time: "+ endTime+"\n"); - } - - private void initialization(Properties prop){ - //initialize database connection - DBConnection.createDatabaseConnection(prop.getDb_url(), prop.getDb_user(), - prop.getDb_pass()); - DbUtil.setTableName(prop.getDb_table()); - } - - private void close(){ - //close db connection - Connection conn = DBConnection.getConnection(); - try { - if(conn!=null && !conn.isClosed()){ - conn.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - - } - -} From 889b50903478a48628f86d308f9a0dc94a32af9c Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 16:55:01 -0500 Subject: [PATCH 21/35] Delete Properties.java --- .../properties/Properties.java | 91 ------------------- 1 file changed, 91 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/properties/Properties.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/properties/Properties.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/properties/Properties.java deleted file mode 100644 index 3e1b30b..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/properties/Properties.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.msstate.cse.changecalculator.properties; - -import java.util.ResourceBundle; - -import org.msstate.cse.changecalculator.utility.Util; - -public class Properties { - - //database - private String db_url; - private String db_user; - private String db_pass; - private String db_table; - - //svn - private String svn_url; - private int startRevNum; - private int endRevNum; - - //log - private String logPath; - - - public Properties(ResourceBundle bundle) { - this.db_url = bundle.getString("db_url"); - this.db_user = bundle.getString("db_user"); - this.db_pass = bundle.getString("db_pass"); - this.db_table = bundle.getString("db_table"); - this.svn_url = bundle.getString("svn_url"); - this.logPath=bundle.getString("logPath"); - - //start revision number - String startRevNum = bundle.getString("startRevNum"); - if(Util.isNullOrEmpty(startRevNum)){ - this.startRevNum = -1; - System.err.println("Start Revision Number is missing in properties file"); - }else{ - this.startRevNum = Integer.parseInt(startRevNum); - } - - //end revision number - String endRevNum = bundle.getString("endRevNum"); - if(Util.isNullOrEmpty(endRevNum)){ - this.endRevNum = -1; - System.err.println("Start Revision Number is missing in properties file"); - }else{ - this.endRevNum = Integer.parseInt(endRevNum); - } - } - - - public String getDb_url() { - return db_url; - } - - - public String getDb_user() { - return db_user; - } - - - public String getDb_pass() { - return db_pass; - } - - - public String getDb_table() { - return db_table; - } - - - public String getSvn_url() { - return svn_url; - } - - - public int getStartRevNum() { - return startRevNum; - } - - - public int getEndRevNum() { - return endRevNum; - } - - - public String getLogPath() { - return logPath; - } - -} From 3e0e08231c12f9b9b09c7b2a31a252598d045426 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 16:55:29 -0500 Subject: [PATCH 22/35] Delete SvnUtil.java --- .../cse/changecalculator/svn/SvnUtil.java | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/svn/SvnUtil.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/svn/SvnUtil.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/svn/SvnUtil.java deleted file mode 100644 index 6be8799..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/svn/SvnUtil.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.msstate.cse.changecalculator.svn; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import org.msstate.cse.changecalculator.utility.Util; -import org.tmatesoft.svn.core.SVNDepth; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; -import org.tmatesoft.svn.core.wc.SVNClientManager; -import org.tmatesoft.svn.core.wc.SVNDiffClient; -import org.tmatesoft.svn.core.wc.SVNRevision; -import org.tmatesoft.svn.core.wc.SVNWCUtil; -import org.tmatesoft.svn.core.wc2.SvnOperationFactory; - -public class SvnUtil { - - private static SvnOperationFactory svnOperationFactory = null; - private static SVNClientManager svnClientManager = null; - - public static SvnOperationFactory getSvnOperationFactory(){ - if(svnOperationFactory==null){ - svnOperationFactory = new SvnOperationFactory(); - } - return svnOperationFactory; - } - - public static SVNClientManager getSvnClientManager(){ - if(svnClientManager == null){ - // SVNWCUtil is a utility class that creates a default options driver. - DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true); - - // Create instance of SVNClientManager providing authentication info and - // options driver - svnClientManager = SVNClientManager.newInstance(options, "anonymous", "anonymous"); - - } - return svnClientManager; - } - - /** - * Return diff content - * - * @param url svnUrl - * @param revisionNumber - * @return Output of "svn diff -c revisionNumber url" - */ - public static String getDiffContent(String url, long revisionNumber) { - if(Util.isNullOrEmpty(url)){ - System.err.println("Invalid URL."); - return null; - } - if(revisionNumber<0){ - System.err.println("Invalid revision number. Revision number cannot be less than zero."); - } - String diffString = ""; - try { - SVNURL svnURL = SVNURL.parseURIEncoded(url); - SVNRevision svnRevNumber = SVNRevision.create(revisionNumber); - SVNRevision prevSvnRevNumber = SVNRevision.create(revisionNumber - 1); - // Getting svn client manager - SVNClientManager clientManager = getSvnClientManager(); - SVNDiffClient diffClient = clientManager.getDiffClient(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream result = new PrintStream(baos); - diffClient.doDiff(svnURL, svnRevNumber, prevSvnRevNumber, - svnRevNumber, SVNDepth.INFINITY, true, result); - diffString = baos.toString(); - } catch (SVNException e) { - System.err.println("Error getting diff content with revison number " + revisionNumber+" at URL:" + url); - System.out.println(e.getMessage()); - e.printStackTrace(); - } - return diffString; - } -} From 79ae60bec1ce0cf32bd4a27012e28c42c72c4666 Mon Sep 17 00:00:00 2001 From: madchemist10 Date: Wed, 30 Mar 2016 16:55:35 -0500 Subject: [PATCH 23/35] Delete Util.java --- .../msstate/cse/changecalculator/utility/Util.java | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 changecalculator/src/main/java/org/msstate/cse/changecalculator/utility/Util.java diff --git a/changecalculator/src/main/java/org/msstate/cse/changecalculator/utility/Util.java b/changecalculator/src/main/java/org/msstate/cse/changecalculator/utility/Util.java deleted file mode 100644 index b787164..0000000 --- a/changecalculator/src/main/java/org/msstate/cse/changecalculator/utility/Util.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.msstate.cse.changecalculator.utility; - -public class Util { - - public static boolean isNullOrEmpty(String str){ - if (null == str) - { - return true; - } - return str.isEmpty(); - } - -} From 8f464a7e773e82cbcbdf23c71cf8f98be0136d34 Mon Sep 17 00:00:00 2001 From: austinwgerald Date: Wed, 30 Mar 2016 18:28:10 -0500 Subject: [PATCH 24/35] Removed XMLParser.java to begin commenting on it. --- metricsanalyzer/XMLParser.java | 62 ---------------------------------- 1 file changed, 62 deletions(-) delete mode 100755 metricsanalyzer/XMLParser.java diff --git a/metricsanalyzer/XMLParser.java b/metricsanalyzer/XMLParser.java deleted file mode 100755 index 4b8422c..0000000 --- a/metricsanalyzer/XMLParser.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * XMLParser.java - * - */ - -package metricsanalyzer; - -import javax.xml.parsers.*; -import org.xml.sax.*; -import java.io.*; -import java.util.Vector; -/** - * - * @author Byron - */ -public class XMLParser { - SAXParserFactory spf = SAXParserFactory.newInstance(); - SAXParser parser = null; - - /** Creates a new instance of XMLParser */ - public XMLParser() { - - spf.setNamespaceAware(true); - spf.setValidating(true); - - System.out.println("Parser will "+(spf.isNamespaceAware()?"":"not ") +"be namespace aware"); - System.out.println("Parser will "+(spf.isValidating()?"":"not ") + "validate XML"); - - try { - parser = spf.newSAXParser(); - System.out.println("Parser object is: "+ parser); - }catch(SAXException e){ - e.printStackTrace(System.err); - System.exit(1); - } catch(ParserConfigurationException e) { - e.printStackTrace(System.err); - System.exit(1); - } - } - - public void parseFile(File file, String revisionNum) { - System.out.println("\nStarting parsing of "+file+"\n"); - SAXHandler handler = new SAXHandler(revisionNum); - try { - parser.parse(file, handler); - } catch(IOException e) { - e.printStackTrace(System.err); - - } catch(SAXException e) { - e.printStackTrace(System.err); - } - - DBUpdate update = new DBUpdate(); - update.addRevision(revisionNum); - // update.setMetrics(handler.geMetricsList()); - //update.setSystemMetrics(handler.getSysMetrics()); - //update.setClassMetrics(handler.getClassMetrics()); - //update.setPackageMetrics(handler.getPackageMetrics()); - update.setMethodMetrics(handler.getMethodMetrics()); - } - -} From 13e798e78aa4ff119db4572de6b0193b7c3bab28 Mon Sep 17 00:00:00 2001 From: austinwgerald Date: Wed, 30 Mar 2016 19:08:17 -0500 Subject: [PATCH 25/35] Removed SAXHandler.java --- metricsanalyzer/SAXHandler.java | 133 -------------------------------- 1 file changed, 133 deletions(-) delete mode 100755 metricsanalyzer/SAXHandler.java diff --git a/metricsanalyzer/SAXHandler.java b/metricsanalyzer/SAXHandler.java deleted file mode 100755 index 09e9b01..0000000 --- a/metricsanalyzer/SAXHandler.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * SAXHandler.java - * - */ - -package metricsanalyzer; - -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.Attributes; -import java.util.Vector; - -/** - * - * @author Byron - */ -public class SAXHandler extends DefaultHandler{ - Vector metricsList = new Vector(); - Vector systemMetrics = new Vector(); - Vector classMetrics = new Vector(); - Vector methodMetrics = new Vector(); - Vector packageMetrics = new Vector(); - String revisionNum = new String(); - int length = 0; - String temp1, temp2, metric, metricID, metricName, per, total, max, stddev, avg, values; - String typeName, typeSource, typePackage, typeValue, typeData; - String directoryName, packageName, packageValue, packageData; - String methodName, methodSource, methodPackage, methodValue, methodData; - /** Creates a new instance of SAXHandler */ - public SAXHandler(String revisionNum) { - this.revisionNum = revisionNum; - } - - public void startDocument() { - System.out.println("Start document: "); - } - public void endDocument() { - System.out.println("End document: "); - } - - public void startElement(String uri, String localName, String qname, Attributes attr) { - //System.out.println("Start element: qname: " + qname); - length = attr.getLength(); - String zero = "0"; - if (qname.equals("Metric")) { - metricID = attr.getValue("id"); - metricName = attr.getValue("description"); - metric = metricID+","+metricName; - if (metricID.equals("NOP") || metricID.equals("TLOC")) { - per = "---"; - } - metricsList.addElement(metric); - // System.out.println(metric); - } else if (qname.equals("Values")) { - per = attr.getValue("per"); - total = attr.getValue("total"); - max = attr.getValue("max"); - stddev = attr.getValue("stddev"); - avg = attr.getValue("avg"); - values = metricID+","+revisionNum+","+per+","+total+","+avg+","+stddev+","+max; - systemMetrics.addElement(values); - // System.out.println(values); - } else if (qname.equals("Value")) { - if (per.equals("type")) { - typeName = attr.getValue("name"); - typeSource = attr.getValue("source"); - typePackage = attr.getValue("package"); - typeValue = attr.getValue("value"); - typeData = typeName+","+revisionNum+","+metricID+","+typeSource+","+typePackage+","+typeValue; - classMetrics.addElement(typeData); - // System.out.println(typeData); - } else if (per.equals("packageFragment")) { - directoryName = attr.getValue("name"); - packageName = attr.getValue("package"); - packageValue = attr.getValue("value"); - packageData = directoryName+","+revisionNum+","+metricID+","+packageName+","+packageValue; - packageMetrics.addElement(packageData); - // System.out.println(packageData); - } - - else if (per.equals("method")) { - methodName = attr.getValue("name"); - methodSource = attr.getValue("source"); - methodPackage = attr.getValue("package"); - methodValue = attr.getValue("value"); - methodData = methodName+","+revisionNum+","+metricID+","+methodSource+","+methodPackage+","+methodValue; - methodMetrics.addElement(methodData); - // System.out.println(methodData); - } else { - total = attr.getValue("total"); - values = metricID+","+revisionNum+","+zero+","+total+","+zero+","+zero+","+zero; - systemMetrics.addElement(values); - // System.out.println(values); - } - } - } - - public void endElement(String uri, String localName, String qname) { - //System.out.println("End element: qname: " + qname); - } - - public void characters(char[] ch, int start, int length) { - //System.out.println("Characters: " + new String(ch, start, length)); - } - - public void ignorableWhitespace(char[] ch, int start, int length) { - System.out.println("Ignorable whitespace: " + new String(ch, start, length)); - } - - public void skippedEntity(String name) { - System.out.println("WARNING____Skipped Entity: "+name); - } - - public Vector getSysMetrics() { - return (systemMetrics); - } - - public Vector getClassMetrics() { - return (classMetrics); - } - - public Vector getPackageMetrics() { - return (packageMetrics); - } - - public Vector getMethodMetrics() { - return (methodMetrics); - } - - public Vector geMetricsList() { - return (metricsList); - } - -} From 46ec23b8342481ee9ee9eebe818b5905e1e0b723 Mon Sep 17 00:00:00 2001 From: austinwgerald Date: Wed, 30 Mar 2016 20:45:50 -0500 Subject: [PATCH 26/35] Removed DBUpdate.java --- metricsanalyzer/DBUpdate.java | 229 ---------------------------------- 1 file changed, 229 deletions(-) delete mode 100755 metricsanalyzer/DBUpdate.java diff --git a/metricsanalyzer/DBUpdate.java b/metricsanalyzer/DBUpdate.java deleted file mode 100755 index 181756e..0000000 --- a/metricsanalyzer/DBUpdate.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * DBUpdate.java - * - */ - -package metricsanalyzer; - -import java.util.Vector; -import java.sql.*; -import java.util.StringTokenizer; -/** - * - * @author Byron - */ -public class DBUpdate { - - private Connection con; - private String add; - private StringTokenizer stz; - private String[] columns; - /** Creates a new instance of DBUpdate */ - public DBUpdate() { - } - - public void addRevision(String revisionNum) { - MetricsDB db = new MetricsDB(); - int zero = 0; - add = "INSERT INTO revisiondata VALUES('"+revisionNum+"','"+zero+"','"+zero+"','"+zero+"','"+zero + - "','"+zero+"','Revision: "+revisionNum+"','1')"; - con = db.getConnection(); - try { - Statement stmt = con.createStatement(); - stmt.executeUpdate(add); - stmt.close(); - } catch (java.sql.SQLException sqe) { - System.out.println("error adding revisiondata values: "+ sqe); - } - db.closeConnection(); - } - - public void setMethodMetrics(Vector metrics) { - MetricsDB db = new MetricsDB(); - int tokens = 0, counter; - - con = db.getConnection(); - - for (int i=0; i Date: Wed, 30 Mar 2016 20:53:11 -0500 Subject: [PATCH 27/35] Removed MetricsDB.java --- metricsanalyzer/MetricsDB.java | 58 ---------------------------------- 1 file changed, 58 deletions(-) delete mode 100755 metricsanalyzer/MetricsDB.java diff --git a/metricsanalyzer/MetricsDB.java b/metricsanalyzer/MetricsDB.java deleted file mode 100755 index 50df00a..0000000 --- a/metricsanalyzer/MetricsDB.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * MetricsDB.java - */ - -package metricsanalyzer; - -import java.sql.*; -/** - * - * @author Byron - */ -public class MetricsDB { - - private Connection con; - private String URL = "jdbc:mysql://localhost:3306/SoD"; - // private String URL = "jdbc:mysql://localhost:3306/SoD"; - private StringBuffer error = new StringBuffer(" "); - private String username = "root"; - private String password = "10ft3\"LB"; - - - /** Creates a new instance of MetricsDB */ - public MetricsDB() { - try { - Class.forName("org.gjt.mm.mysql.Driver"); - } catch (Exception e) { - System.out.println("ERROR: failed to load MySQL JDBC driver." + e); - error.append("MYSQL Driver Exception: " + e.toString()); - e.printStackTrace(); - return; - } - try { - con = DriverManager.getConnection(URL, username, password); - - } catch (SQLException ex) { - System.out.println("ERROR: Could not establish connection to MySQL Database at URL: "+URL+ "\nEXCEPTION:"+ ex); - error.append("SQL Connection Exception " + ex.toString()); - ex.printStackTrace(); - } - - } - - public Connection getConnection() { - return (con); - } - - public void closeConnection() { - try { - con.close(); - } catch (java.sql.SQLException sqle) { - System.out.println("Problem closing connection: " + sqle); - } - } - - public String getError() { - return (error.toString()); - } -} From 3ff05833efb8e981d8fb26df6bd4bc1f3a09cbc4 Mon Sep 17 00:00:00 2001 From: Hunter Holder Date: Thu, 31 Mar 2016 19:29:27 -0500 Subject: [PATCH 28/35] Delete gap_analysis.py --- YahooStockData/Apps-Trading/gap_analysis.py | 32 --------------------- 1 file changed, 32 deletions(-) delete mode 100644 YahooStockData/Apps-Trading/gap_analysis.py diff --git a/YahooStockData/Apps-Trading/gap_analysis.py b/YahooStockData/Apps-Trading/gap_analysis.py deleted file mode 100644 index 3607019..0000000 --- a/YahooStockData/Apps-Trading/gap_analysis.py +++ /dev/null @@ -1,32 +0,0 @@ - - -from StockAnalysis.historical_bars import TickerData -from StockAnalysis.historical_bars import BarData - -data = TickerData('FB', 'D', 'NASDAQ') -gap_ups = [] - - -def identify_gap_ups(percentage): - i = 0 - for current_bar in data.candlesticks: - # b.print_bar_data() - if i > 1: - last_bar = data.candlesticks[i-1] - try: - if current_bar.open > last_bar.close: - diff = float(current_bar.open) - float(last_bar.close) - calc_percent = diff / float(last_bar.close) - if calc_percent > .03: - print(current_bar.open + ' ' + last_bar.close + ' Date: '+current_bar.bar_datetime - + ' {0:.4f}'.format(calc_percent)) - gap_ups.append(current_bar) - - i += 1 - - -if __name__ == '__main__': - identify_gap_ups(4) - - # for bar_data in gap_ups: - # print(bar_data.bar_datetime) \ No newline at end of file From 45166e7fa5c2e5f32bf2b835d275842c11a7f7fb Mon Sep 17 00:00:00 2001 From: Project Manager Date: Thu, 31 Mar 2016 19:44:02 -0500 Subject: [PATCH 29/35] Delete historical_bars.py --- .../StockAnalysis/historical_bars.py | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 YahooStockData/StockAnalysis/historical_bars.py diff --git a/YahooStockData/StockAnalysis/historical_bars.py b/YahooStockData/StockAnalysis/historical_bars.py deleted file mode 100644 index da37608..0000000 --- a/YahooStockData/StockAnalysis/historical_bars.py +++ /dev/null @@ -1,42 +0,0 @@ -__author__ = 'byron' - -import datetime - -class TickerData(): - def __init__(self, ticker, time_frame, exchange): - self.ticker = ticker - self.time_frame = time_frame - self.exchange = exchange - self.candlesticks = [] - self.file_contents = self.get_ticker_data() - - - def get_ticker_data(self): - __folder = '/home/byron/Stock-Data/{0}'.format(self.exchange) - __file_name = '{0}/{1}-{2}.data'.format(__folder, self.ticker, self.time_frame) - - with open(__file_name, mode='r') as data_file: - for line in data_file: - # print(line) - self.candlesticks.append(BarData(line.split(','))) - # b = BarData(line.split(',')) - # - # BarData(line.split(',')).print_bar_data() - return data_file.read() - -class BarData(): - def __init__(self, ohlc): - self.bar_datetime = ohlc[0] - self.open = ohlc[1] - self.high = ohlc[2] - self.low = ohlc[3] - self.close = ohlc[4] - self.volume = ohlc[5] - self.candlestick = [self.bar_datetime, self.open, self.high, self.low, self.close, self.volume] - - def print_bar_data(self): - print('Time: {0} | Open: {1} | High: {2} | Low: {3} | Close: {4} | Volume: {5}'.format( - self.bar_datetime, self.open, self.close, self.high, self.low, self.close, self.volume)) - - def __iter__(self): - return iter(self.candlestick) From 9c94107627c0d1e9634a32cc88f691033ffc92fa Mon Sep 17 00:00:00 2001 From: Hunter Holder Date: Thu, 31 Mar 2016 20:05:33 -0500 Subject: [PATCH 30/35] Delete ts_check_view.py --- YahooStockData/Apps-Trading/ts_check_view.py | 41 -------------------- 1 file changed, 41 deletions(-) delete mode 100644 YahooStockData/Apps-Trading/ts_check_view.py diff --git a/YahooStockData/Apps-Trading/ts_check_view.py b/YahooStockData/Apps-Trading/ts_check_view.py deleted file mode 100644 index 9736c74..0000000 --- a/YahooStockData/Apps-Trading/ts_check_view.py +++ /dev/null @@ -1,41 +0,0 @@ - - -import tkinter as tk -from TradeStation.ts_check_controller import * - -text = '' - - - -window = tk.Tk() -window.title('TradeStation ETB') - -ticker_text = tk.StringVar() -response_text = tk.StringVar() - -tk.Label(window, text='TradeStation ETB').grid(row=0, column=0, sticky='w') - -ticker = tk.Entry(window, textvariable=ticker_text) - - -ticker.grid(row=0, column=1, sticky='w') -# tk.Button(window, text='Check', command=lambda: check_ticker(ticker_text.get())).grid(row=0, column=11, sticky='e') -check_button = tk.Button(window, text='Check') -check_button.grid(row=0, column=4, sticky='w') - -response = tk.Label(window, textvariable=response_text) -response.grid(row=2, columnspan=50) - -def button_clicked(ticker): - global text - text = check_ticker(ticker) - response_text.set(text) - -check_button.bind('', lambda event: button_clicked(ticker_text.get())) -ticker.bind('', lambda event: button_clicked(ticker_text.get())) - - - -window.mainloop() - - From 0c59919b3b956fd1e5957e37b7856c87539571e0 Mon Sep 17 00:00:00 2001 From: Hunter Holder Date: Thu, 31 Mar 2016 20:20:31 -0500 Subject: [PATCH 31/35] Delete key_statistics.py --- YahooStockData/key_statistics.py | 73 -------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 YahooStockData/key_statistics.py diff --git a/YahooStockData/key_statistics.py b/YahooStockData/key_statistics.py deleted file mode 100644 index ca81ef3..0000000 --- a/YahooStockData/key_statistics.py +++ /dev/null @@ -1,73 +0,0 @@ - - -from HTMLParser import HTMLParser -unwanted_headers = ['Financial Highlights', 'Fiscal Year', 'Profitability', - 'Management Effectiveness', 'Income Statement', 'Balance Sheet', - 'Cash Flow Statement', 'Stock Price History', - 'Share Statistics', 'Trading Information', - 'See '] - - -class YahooKeyStatistics(HTMLParser): - - def __init__(self): - HTMLParser.__init__(self) - self.reached_valuation_measures = False - self.valid_data_field = False - self.stat_data = {} - self.keys = [] - self.values = [] - self.data_count = 1 - - def handle_starttag(self, tag, attrs): - if tag = 'td' and self.reached_valuation_measures is True: - # print("Start tag:", tag) - tag = '' - self.valid_data_field = True - for attr in attrs: - if attr = "('class', 'yfnc_tablehead1')": - print(" attr:", attr) - elif attr == "('class', 'yfnc_tabledata1')": - print(" attr:", attr) - - def handle_data(self, data): - - if data == "Valuation Measures": - print("Valuation Measures Reached") - self.reached_valuation_measures = True - elif data == 'Dividends ': - print('Done with Statistics Data') - self.data_count = 3 - self.reached_valuation_measures = False - - if self.reached_valuation_measures is True and self.valid_data_field is True: - if '(' in data: - i = 0 - for char in data: - i += 1 - if char == '(': - data = data[0:i-2] - break - if data not in unwanted_headers and self.data_count < 2: - self.data_count = 2 - self.keys.append(data) - # print("Data :" + data + '*') - elif data not in unwanted_headers and self.data_count is 2: - self.data_count = 1 - self.values.append(data) - # print("Data :" + data + '^') - - self.valid_data_field = False - - def print_key_size(self): - print ('# Keys: '+str(len(self.keys)) + - ' #values'+str(len(self.values))) - - def build_stat_data(self): - i = 0 - for field in self.keys: - print(field+': '+self.values[i]) - self.stat_data.update({field: self.values[i]}) - i += 1 - - return self.stat_data From 08a60c9cc5fd58397eef3499bed01dcf6f150dc3 Mon Sep 17 00:00:00 2001 From: Project Manager Date: Thu, 31 Mar 2016 20:20:31 -0500 Subject: [PATCH 32/35] Delete ts_check_controller.py --- .../TradeStation/ts_check_controller.py | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 YahooStockData/TradeStation/ts_check_controller.py diff --git a/YahooStockData/TradeStation/ts_check_controller.py b/YahooStockData/TradeStation/ts_check_controller.py deleted file mode 100644 index 1532d1c..0000000 --- a/YahooStockData/TradeStation/ts_check_controller.py +++ /dev/null @@ -1,47 +0,0 @@ - - -from TradeStation.ts_requirements import * - -tmp = '' - - -def check_ticker(ticker): - prepare_files() - ts_easy = get_easy_borrow() - ts_margin = get_margin_requirements() - ts_threshold = get_threshold_securities() - global tmp - status_string = '' - tmp = '' - ticker = ticker.upper_case_letters_change_to() - - if ticker in ts_easy: - tmp = '\n{0} is EASY to Borrow'.format(ticker) - print(tmp) - status_string += tmp - tmp = '' - elif ticker in ts_threshold: - tmp = '\n' + ticker + ' **THRESHOLD SECURITY** Cannot Be Shorted' - status_string += tmp - print(tmp) - tmp = '' - else: - tmp = '\n*** SORRY {0} NOT EASY to Borrow please call \nthe trade desk' \ - ' at 1-800-871-3563 to locate the security ***'.format(ticker) - print(tmp) - status_string += tmp - tmp = '' - - if ticker.upper() in ts_margin: - tmp = '\n'+ticker + ' has margin requirements: ' + ts_margin[ticker] - print(tmp) - status_string += tmp - tmp = '' - - return status_string - - -if __name__ == '__main__': -# check_ticker('VLTC') # test ticker - - From c4a1b6568fc0eadf73864fc3feacb213cbfb3fde Mon Sep 17 00:00:00 2001 From: Hunter Holder Date: Thu, 31 Mar 2016 20:40:05 -0500 Subject: [PATCH 33/35] Delete get_data.py --- YahooStockData/get_data.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 YahooStockData/get_data.py diff --git a/YahooStockData/get_data.py b/YahooStockData/get_data.py deleted file mode 100644 index a8304ad..0000000 --- a/YahooStockData/get_data.py +++ /dev/null @@ -1,35 +0,0 @@ - - -import urllib2 -# from Tkinter import * -from key_statistics import YahooKeyStatistics - - -ticker = "AAPL" -parser = YahooKeyStatistics() -yahoo = urllib2.urlopen('http://finance.yahoo.com/q/ks?s='+ticker+'+Key+Statistics') -data = parser.feed(yahoo.read().decode('utf-8')) -parser.print_key_size() -key_stats = parser.build_stat_data() - - - - -# if __name__ == '__main__': -# -# # app = QApplication(sys.argv) -# # ex = Example() - # sys.exit(app.exec_()) - -# root = Tk() -# root.title("Stock Info") -# label = Label(root, text='Shares Short: ') -# label2 = Label(root, text=key_stats['Shares Short']) -# label.pack(side='left') -# label2.pack(side='right') -# print('*' + str(key_stats.keys()) + '*') -# counter_label(label) -# button = Button(root, text='Stop', width=25, command=root.destroy) -# button.pack() -# -# root.mainloop() \ No newline at end of file From a52c02571618c6f3bcfdb10aaf8d1e1777d8511d Mon Sep 17 00:00:00 2001 From: Project Manager Date: Thu, 31 Mar 2016 20:44:24 -0500 Subject: [PATCH 34/35] Delete ts_requirements.py --- .../TradeStation/ts_requirements.py | 88 ------------------- 1 file changed, 88 deletions(-) delete mode 100644 YahooStockData/TradeStation/ts_requirements.py diff --git a/YahooStockData/TradeStation/ts_requirements.py b/YahooStockData/TradeStation/ts_requirements.py deleted file mode 100644 index 566cacf..0000000 --- a/YahooStockData/TradeStation/ts_requirements.py +++ /dev/null @@ -1,88 +0,0 @@ - - -from os import walk -import os - -file_path = '~/Downloads/' -easy = 'easy.txt' -threshold = 'threshold.txt' -margin = 'margin.txt' - - -def prepare_files(): - f = [] - - global file_path, threshold, margin, easy - for (dirpath, dirnames, filenames) in walk(file_path): - f.extend(filenames) - break - - for file in f: - if file.startswith('TSEasy'): - os.rename(file_path + file, file_path + easy) - print('easy there') - - if file.startswith('TSSpecial'): - os.rename(file_path + file, file_path + margin) - print('margin there') - - if file.startswith('TSThreshold'): - os.rename(file_path + file, file_path + threshold) - print('threshold there') - - -def get_easy_borrow(): - global file_path, easy - easy_list = set() - - with open(file_path + easy, mode='r') as file_list: - for line in file_list: - - if line.startswith(';'): - continue - else: - easy_list.add(line.strip()) - # print(line.strip()) - - -def get_margin_requirements(): - global file_path, margin - margin_list = {} - ticker = '' - percentage = '' - - with open(file_path + margin, mode='r') as file_list: - for line in file_list: - - if line.startswith(';'): - continue - else: - temp = line.strip().split('|') - - if len(temp) > 1: - # print(temp[0] + ' ---- ' + temp[1]) - margin_list[temp[0]] = temp[1] - - -def get_threshold_securities(): - global file_path, threshold - threshold_list = set() - - with open(file_path + threshold, mode='r') as file_list: - for line in file_list: - - if line.startswith(';'): - continue - else: - threshold_list.add(line.strip()) - # print(line.strip()) - - return threshold_list - - - -if __name__ == '__main__': - prepare_files() - get_easy_borrow() - get_margin_requirements() - get_threshold_securities() From 917c2e1de650ef1d91df5ea4d9aeea4afe1606f9 Mon Sep 17 00:00:00 2001 From: Project Manager Date: Thu, 31 Mar 2016 21:27:20 -0500 Subject: [PATCH 35/35] Delete stock_data_window.py --- YahooStockData/stock_data_window.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 YahooStockData/stock_data_window.py diff --git a/YahooStockData/stock_data_window.py b/YahooStockData/stock_data_window.py deleted file mode 100644 index df6c515..0000000 --- a/YahooStockData/stock_data_window.py +++ /dev/null @@ -1,20 +0,0 @@ - - -from PyQt5.QtWidgets import QApplication, QWidget, QPushButton - -class Example(QWidget): - - def __init__(self): - QWidget.__init__(self) - self.button = QPushButton('Ticker', self) - self.init_ui() - - def init_ui(self): - # self.setGeometry(500, 600) - self.setWindowTitle('Stock Info') - # self.setWindowIcon(QIcon('web.png')) - - self.button.move(20, 20) - - self.show() -