<commit_before>package controller;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tablemanager.TaskTableManager;
import datamodel.Interval;
import datamodel.Task;
import datamodel.Task.CATEGORY;

public class HelloServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.getWriter().print("I am here");
		showDatabase(request, response);
		// response.setContentType("text/html");
		// response.setStatus(HttpServletResponse.SC_OK);
		// response.getWriter().println("<h1>Hello Servlet</h1>");
		// response.getWriter().println("session=" +
		// request.getSession(true).getId());
		// if (request.getRequestURI().endsWith("?db")) {
		// showDatabase(request,response);
		// } else {
		// // showHome(request,response);
		// }
	}

	private void showDatabase(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		TaskTableManager taskManager = TaskTableManager.getInstance();
		taskManager.createTable();
		
		ArrayList<Interval> ds = new ArrayList<Interval>();
		ds.add(new Interval(5, 9));
		Task t = new Task(101, "SMS", CATEGORY.FAMILY, ds, new Interval(1,3), true, 1);
		taskManager.writeTaskToDB(t);
		
		ArrayList<Task> tasks = taskManager.readTaskTable();
		for(Task task : tasks) {
			//System.out.println(task.toString());
			resp.getWriter().println(task.toString());
		}
		
	//	try {
			//connection = getConnection();

			//stmt = connection.createStatement();
			// stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
			// stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
			// ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");
			//
			// String out = "Hello!\n";
			// while (rs.next()) {
			// out += "Read from DB: " + rs.getTimestamp("tick") + "\n";
			// }
			// create
//			String sql = null;
//			
//			sql = "DROP TABLE IF EXISTS COMPANY;";
//			stmt.execute(sql);<commit_msg>added unsheduled list<commit_after>package controller;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tablemanager.TaskTableManager;
import datamodel.Interval;
import datamodel.Task;
import datamodel.Task.CATEGORY;

public class HelloServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.getWriter().print("I am here");
		showDatabase(request, response);
		// response.setContentType("text/html");
		// response.setStatus(HttpServletResponse.SC_OK);
		// response.getWriter().println("<h1>Hello Servlet</h1>");
		// response.getWriter().println("session=" +
		// request.getSession(true).getId());
		// if (request.getRequestURI().endsWith("?db")) {
		// showDatabase(request,response);
		// } else {
		// // showHome(request,response);
		// }
	}

	private void showDatabase(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		TaskTableManager taskManager = TaskTableManager.getInstance();
		taskManager.createTable();
		
		ArrayList<Interval> ds = new ArrayList<Interval>();
		ds.add(new Interval(5, 9));
		Task t = new Task(101, "SMS", CATEGORY.FAMILY, ds, new Interval(1,3), true, 1);
		taskManager.writeTaskToDB(t);
		
		ArrayList<Task> tasks = taskManager.readAllTasks();
		for(Task task : tasks) {
			//System.out.println(task.toString());
			resp.getWriter().println(task.toString());
		}
		
	//	try {
			//connection = getConnection();

			//stmt = connection.createStatement();
			// stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
			// stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
			// ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");
			//
			// String out = "Hello!\n";
			// while (rs.next()) {
			// out += "Read from DB: " + rs.getTimestamp("tick") + "\n";
			// }
			// create
//			String sql = null;
//			
//			sql = "DROP TABLE IF EXISTS COMPANY;";
//			stmt.execute(sql);
{'fraction_non_alphanumeric': 0.14664202094886014, 'fraction_numerical': 0.004107619634421853, 'mean_word_length': 4.334063526834611, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4543754', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1466, 'n_words': 313}