Milestones  Investigate Methods for AI development(week 2)  Revise initial design (week 3)  Develop functions to generate specific types of data: (week.

Slides:



Advertisements
Similar presentations
EXAMPLES (Arrays). Example Many engineering and scientific applications represent data as a 2-dimensional grid of values; say brightness of pixels in.
Advertisements

Presenter: James Huang Date: Sept. 29,  HTTP and WWW  Bottle Web Framework  Request Routing  Sending Static Files  Handling HTML  HTTP Errors.
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
Building Java Programs
Hip Hip Array! AP Computer Science. Remember Strings? Strings are an array of characters An array is a collection of variables all of the same type. Arrays.
CS-I Final Review Hao Jiang Computer Science Department Boston College.
Lecture 27 Exam outline Boxing of primitive types in Java 1.5 Generic types in Java 1.5.
1 CS 105 Lecture 8 Strings; Input Failure Mon, Mar 7, 2011, 3:39 pm.
Arrays Declare the Array of 100 elements 1.Integers: int[] integers = new int[100]; 2.Strings: String[] strings = new String[100]; 3.Doubles: double[]
Jan Art of Programming Yangjun Chen Dept. Business Computing University of Winnipeg.
Slides prepared by Rose Williams, Binghamton University Chapter 6 Arrays.
COMP 110 Introduction to Programming Mr. Joshua Stough September 10, 2007.
1 CMSC 132: Object-Oriented Programming II Java Constructs Department of Computer Science University of Maryland, College Park.
CS 117 Spring 2002 Review for Exam 3 arrays strings files classes.
CSC 142 J 1 CSC 142 Arrays [Reading: chapter 10].
Abstract Data Types (ADTs) and data structures: terminology and definitions A type is a collection of values. For example, the boolean type consists of.
Java File Structure.  File class which is defined by java.io does not operate on streams  deals directly with files and the file system  File class.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Data Type string #include // C++ String class string str1, str2; // Default constructor cin >> str1 >> str2; cout
Recitation 1 CS0445 Data Structures Mehmud Abliz.
FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)
PHP meets MySQL.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CSC 2720 Building Web Applications Database and SQL.
AP Comp Sci A Chapter 12 - Arrays. Ch 12 Goals: Goals: Declare and create arrays Declare and create arrays Access elements in arrays Access elements in.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CS Midterm Study Guide Fall General topics Definitions and rules Technical names of things Syntax of C++ constructs Meaning of C++ constructs.
Documentation Array and Searching. Documentation rules Easy rules: –Naming convention for variables, constants and methods Difficult rules: –Professional.
Database Data Generator Presented by: Christopher Jestice.
5. Simple SQL using Oracle1 Simple SQL using Oracle 5. Working with Tables: Data management and Retrieval 6. Working with Tables: Functions and Grouping.
Introduction to Java Lecture Notes 3. Variables l A variable is a name for a location in memory used to hold a value. In Java data declaration is identical.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
5. Simple SQL using Oracle1 Simple SQL using Oracle 5. Working with Tables: Data management and Retrieval 6. Working with Tables: Functions and Grouping.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Lecture 13: Arrays, Pointers, Code examples B Burlingame 2 Dec 2015.
Copyright © 2002 W. A. Tucker1 Chapter 9 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
CS 1430: Programming in C++ 1. Data Type string #include // C++ String class string str1, str2; // Default constructor cin >> str1 >> str2; cout
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
Arrays and ArrayLists Topic 6. One Dimensional Arrays Homogeneous – all of the same type Contiguous – all elements are stored sequentially in memory For.
COP 2510 Chapter 6 - Functions. Random function (randint) #import the desired function import random #integer random number in the range of 1 through.
CSC Java Programming, Fall, 2008 Week 3: Objects, Classes, Strings, Text I/O, September 11.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
CS 180 Recitation 7 Arrays. Used to store similar values or objects. An array is an indexed collection of data values of the same type. Arrays are the.
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
NMD202 Web Scripting Week2. Web site
Midterm Review Tami Meredith. Primitive Data Types byte, short, int, long Values without a decimal point,..., -1, 0, 1, 2,... float, double Values with.
Module 13: Properties and Indexers. Overview Using Properties Using Indexers.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
ARRAY AND LOOPS REVIEW Mr. Crone. What will the code below print? int[] arry = {2, 5, 2, 1, 3}; for(int i = 0; i < 5; i ++) System.out.print(arry[i]);
Sorting Algorithms. Sorting Sorting is a process that organizes a collection of data into either ascending or descending order. public interface ISort.
COMP234 – Perl SQL. SQL Syntax Keywords upper case: CREATE TABLE English like syntax Multi-word verbs –INSERT INTO Parentheses and other syntactical guides.
Example Program Development
T/F  The following code will compile without error. int x = 3, y = 4, z = 5; double k = 3.4; cout
Microsoft Excel Basic Skills
Chapter 6 Arrays Slides prepared by Rose Williams, Binghamton University Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
Database Data Generator
CS Week 8 Jim Williams, PhD.
Arrays Declare the Array of 100 elements Notes
null, true, and false are also reserved.
Summary.
Suggested self-checks: Section 7.11 #1-11
CSE 1020:Software Development
Sorting Algorithms.
Presentation transcript:

Milestones  Investigate Methods for AI development(week 2)  Revise initial design (week 3)  Develop functions to generate specific types of data: (week 4) Date, currency, timestamp, names, imbalanced types (like gender)  Make DBMS specific protocols (week 6) Include connection, retrieval, and insertion  Implement Website specific web crawler (week 7)  Design AI protocols (week 9) Must correlate desired types with minimal errors  Design User Interface (week 9) Incorporate standard interface functions with symmetrical design layout considerations  Complete final documentation and fine-tuning (week 10)

UtilitiesClass public void parseCSV(string path, ref string[] str1, ref string[] str2, ref string[] str3) { // List parsedData = new List (); try { using (StreamReader readFile = new StreamReader(path)) { string line; string[] row; int i = 0, k = 0, l = 0; while ((line = readFile.ReadLine()) != null) { row = line.Split(','); if (i < 5000) { Array.Resize(ref str1, str1.Length + 1); str1[i] = row[0]; i++; if (row[1].Length > 3) { Array.Resize(ref str2, str2.Length + 1); str2[k] = row[1]; k++; } if (row[2].Length > 1) { Array.Resize(ref str3, str3.Length + 1); str3[l] = row[2]; l++; } Array.Resize(ref str1, str1.Length - 1); Array.Resize(ref str2, str2.Length - 1); Array.Resize(ref str3, str3.Length - 1); } catch (Exception e) { MessageBox.Show(e.Message); }

UtilitiesClass public void parseTxt(string path, ref string[] str1) { try { using (StreamReader readFile = new StreamReader(path)) { string line; int i = 0; while ((line = readFile.ReadLine()) != null) { Array.Resize(ref str1, str1.Length + 1); str1[i] = line; i++; } catch (Exception e) { MessageBox.Show(e.Message); }

UtilitiesClass public void getColumn(ref string[] str1, ref string[] str2, int column) { try { string line; string[] row; int k = 0, l = 0; for (int i = 0; i < str2.Count(); i++) { line = str2[i]; row = line.Split(',', '(', ')'); Array.Resize(ref str1, str1.Length + 1); str1[i] = row[column]; } Array.Resize(ref str1, str1.Length - 1); } catch (Exception e) { MessageBox.Show(e.Message); }

UtilitiesClass public void parallelWrite(string[] str, string file, int start, int end) { TextWriter tw = TextWriter.Synchronized(File.AppendText(file)); Parallel.For(start, end, i => { //tw.WriteLine(str[i]); if (str[i] != null) { tw.WriteLine(str[i]); } ); tw.Close(); }

UtilitiesClass public void writeLine(string sqlstr, string filename) { TextWriter tw = TextWriter.Synchronized(File.AppendText(filename)); // write a line of text to the file tw.WriteLine(sqlstr); // close the stream tw.Close(); }

UtilitiesClass public string formatText(string str, int end = 0) { string tmp; tmp = "'" + str + "'"; if (end == 0) tmp += ", "; return tmp; }

UtilitiesClass public string formatNum(string str, int end = 0) { string tmp; tmp = str; if (end == 0) tmp += ", "; return tmp; }

UtilitiesClass public string formatDate(string tmp, string format = "mm/dd/yyyy") { string date = "(to_date(\'"+ tmp + "\'" + ",\'" + format + "\'))"; return date; }

generatorClass public void createFile(string[] array, int size, int filecount = 0) { bool atend = false; int count = array.Count(); int start = 0, end = count; double loop = (double)count / 1000 * size; string filename; if (array.Count() >= 1000 / size) { end = start / size; } //for(int i = 0; i < Math.Ceiling(loop); i++) while (atend == false) { if (end == array.Count()) { atend = true; } filename = "insert" + Convert.ToString(filecount) + ".sql"; + filename + ";", "insertall.sql"); uC.writeLine("INSERT ALL", filename); uC.parallelWrite(array, filename, start, end); uC.writeLine("SELECT * FROM dual;", filename); filecount++; start = end + 1; if (end / size - 1 >= array.Count() - 1) end = array.Count(); else end = end + (1000 / size); }

//builds an array of numbers for use with unique number sets public int[] initIds(int size) { int[] nums = new int[size]; nums[0] = 0; for (int i = 1; i < size; i++) nums[i] = nums[i - 1] + 1; return nums; }

//generates a random number based on the upper and lower boundaries int getRand(int ub, int lb = 0) { int num = 0; num = ThreadSafeRandom.Next(lb, ub); return num; }

//returns a value which is based on an uneven displacement //takes an array of integers to represent percentile for the value string of the same index //and the string array of values public string getImbalanced(int[] percentile, string[] values) { int num = 0, num2, count = 0, sum = 0; for (int i = 0; i < percentile.Count(); i++){sum += percentile[i];} num2 = getRand(sum + 1); bool found = false; while (found == false) { num += percentile[count]; if (num2 <= num){found = true;} else count++; } return values[count]; }

//generates a string of numbers buffered by zeros public string getZeroBufferString(int[] ids, int length) { string id, formatString = null; long num = -1; while (num == -1) { num = ids[getRand(ids.Count())]; } ids[num] = -1; for (int i = 0; i < length; i++) { formatString += '0'; } id = num.ToString(formatString); return id; }

//gets a randomly chosen name from the array passed to it public string getName(string[] name, int offset = 1) { string ChosenName = "blank"; int num = getRand(name.Count(), offset); ChosenName = name[num]; return ChosenName; }

//combines calls to the getDate function to generate a date within a specified range public string textDate(string format = "mm/dd/yyyy", int yearStart = 0, int yearEnd = 0) { if(yearStart == 0) yearStart = DateTime.Now.Year - 100; if(yearEnd == 0) yearEnd = DateTime.Now.Year; string date; if (format == "mm/dd/yyyy") { date = getDate(12, 1) + "/" + getDate(28, 1) + "/" + getDate(yearEnd, yearStart); } else { date = getDate(28, 1) + "/" + getDate(12, 1) + "/" + getDate(yearEnd, yearStart); } return date; }

//generates date within a given range public string getDate(int max, int min = 0) { max++; string date = null; int num = getRand(max, min); if (num < 10) { date += Convert.ToString(0); } date += Convert.ToString(num); return date; }

//generates a standard login name : first initial, with last name public string getlogin(string FirstName, string LastName) { if (FirstName == null || LastName == null) return null; string = FirstName.Substring(0, 1).ToLower() + LastName.ToLower(); return ; }

//uses a login and domain to generate a business address public string get (string login, string domain = "contoso.com") { return login + + domain; }

ThreadSafeRandom [ThreadStatic] private static Random _random; public ThreadSafeRandom() { _random = SafeRandom(); } private static Random SafeRandom() { return _random ?? (_random = new Random(Environment.TickCount)); } public static int Next(int lb, int ub) { try { int? x = _random.Next(lb, ub); if (x!=null) { return Convert.ToInt32(x); } else return Convert.ToInt32( Next(lb, ub)); } catch { _random = SafeRandom(); return Next(lb, ub); } }